/* Trang còn thiếu: nền giấy, mực và chữ lấy trực tiếp từ các trang truyện */
:root {
  --paper: #FFFDF6;        /* màu giấy của trang truyện */
  --paper-deep: #F3EDDD;   /* nền kệ, đậm hơn giấy để bìa nổi lên */
  --ink: #223135;          /* màu chữ lời thoại */
  --ink-soft: #496962;     /* màu chữ dòng đầu trang truyện */
  --bubble: #E6F2F1;       /* bóng thoại xanh nhạt của bác Hoài */
  --accent: #A8431F;       /* màu ngói và áo của Mưa */
  --accent-deep: #84320F;
  --rule: rgba(34, 49, 53, .22);
  --hand: "Patrick Hand", "Be Vietnam Pro", system-ui, sans-serif;
  --ui: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --wrap: 1280px;
  --gutter: clamp(16px, 3.4vw, 40px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 76px; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

body {
  margin: 0;
  background: var(--paper-deep);
  color: var(--ink);
  font: 400 1rem/1.6 var(--ui);
  font-synthesis: none;
}

img { max-width: 100%; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--hand); font-weight: 400; line-height: 1.1; margin: 0; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }

.icon { width: 1.4em; height: 1.4em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* Thanh đầu trang */
.topbar { position: sticky; top: 0; z-index: 30; background: var(--paper); border-bottom: 1.5px solid var(--ink); }
.topbar-in { display: flex; align-items: center; gap: clamp(10px, 2vw, 24px); min-height: 60px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font: 400 1.55rem/1 var(--hand); white-space: nowrap; }
.brand svg { width: 30px; height: 30px; flex: none; }
.topnav { display: flex; gap: clamp(10px, 2vw, 22px); margin-left: auto; font-size: .94rem; font-weight: 500; }
.topnav a { text-decoration: none; padding: 6px 2px; color: var(--ink-soft); white-space: nowrap; }
.topnav a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 4px; }
@media (max-width: 620px) { .topnav { display: none; } .survey-chip { margin-left: auto; } }

/* Nút khảo sát: cùng hình dáng với bóng thoại trong truyện */
.survey-chip {
  position: relative; display: inline-flex; align-items: center; gap: 7px; flex: none;
  min-height: 42px; padding: 6px 16px 6px 12px;
  background: var(--bubble); border: 1.5px solid var(--ink); border-radius: 999px;
  font-weight: 600; font-size: .94rem; text-decoration: none;
  transition: background-color .15s, transform .15s;
}
.survey-chip:hover { background: #d3e8e6; transform: translateY(-1px); }

.survey-fab {
  position: fixed; right: clamp(12px, 2.4vw, 28px); bottom: clamp(14px, 2.6vw, 28px); z-index: 25;
  display: inline-flex; align-items: center; gap: 9px;
  min-height: 56px; padding: 10px 22px 10px 16px;
  background: var(--accent); color: var(--paper);
  border: 2px solid var(--ink); border-radius: 999px;
  font: 400 1.32rem/1 var(--hand); text-decoration: none;
  box-shadow: 0 6px 18px rgba(34, 49, 53, .28);
  transition: background-color .15s, transform .15s;
}
.survey-fab .icon { width: 1.5em; height: 1.5em; }
.survey-fab::after {
  content: ""; position: absolute; right: 26px; bottom: -11px; width: 18px; height: 12px;
  background: var(--accent); clip-path: polygon(0 0, 100% 0, 78% 100%);
}
.survey-fab::before {
  content: ""; position: absolute; right: 24px; bottom: -15px; width: 22px; height: 15px;
  background: var(--ink); clip-path: polygon(0 0, 100% 0, 78% 100%);
}
.survey-fab:hover { background: var(--accent-deep); transform: translateY(-2px); }
.survey-fab:hover::after { background: var(--accent-deep); }
@media (max-width: 520px) {
  .survey-fab { min-height: 50px; padding: 8px 18px 8px 13px; font-size: 1.2rem; gap: 7px; }
}

/* Bóng thoại dùng chung */
.bubble {
  position: relative; display: inline-block; isolation: isolate;
  padding: .95em 1.8em 2.1em; font: 400 1.3rem/1.15 var(--hand); text-align: center;
}
.bubble-shape { position: absolute; inset: 0; z-index: -1; width: 100%; height: 100%; overflow: visible; }
.bubble-shape path { fill: var(--paper); stroke: var(--ink); stroke-width: 1.5; stroke-linejoin: round; }

/* Nút chính */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 10px 22px;
  background: var(--accent); color: var(--paper);
  border: 2px solid var(--ink); border-radius: 4px;
  font: 600 1rem/1.25 var(--ui); text-decoration: none; cursor: pointer;
  transition: background-color .15s, transform .15s;
}
.btn:hover { background: var(--accent-deep); transform: translateY(-1px); }
.btn[disabled] { opacity: .65; cursor: progress; transform: none; }
.btn-plain {
  background: transparent; color: var(--ink);
}
.btn-plain:hover { background: rgba(34, 49, 53, .08); }

/* Chân trang */
.site-foot { margin-top: clamp(40px, 6vw, 72px); background: var(--paper); border-top: 1.5px solid var(--ink); padding-block: 26px 92px; font-size: .88rem; color: var(--ink-soft); }
.site-foot p { margin: 0 0 .4em; max-width: 72ch; }
.site-foot strong { font: 400 1.25rem/1.2 var(--hand); color: var(--ink); }
