/* ==========================================================================
   donate.com.vn — "Cạch: ống heo đất nghèo nhất Việt Nam"
   Chất liệu: giấy kem có grain + heo đất sét 3D + đồ dùng học trò thập niên 90.
   ========================================================================== */

:root {
  --cream: #FFF4DC;
  --cream-2: #FBE7BF;
  --paper: #FFFBF1;
  --ink: #2D1B12;
  --ink-soft: #6B4A3A;
  --clay: #E0603A;
  --clay-deep: #B8431F;
  --pink: #F7A1B5;
  --pink-soft: #FDE3EA;
  --leaf: #2E9E5B;
  --gold: #F2B705;
  --gold-soft: #FFE38A;
  --purple: #4B3592;
  --red: #C1121F;
  --chalk: #24302A;
  --line-blue: #A9CBEA;
  --night: #1E1712;

  --f-display: "Baloo 2", "Be Vietnam Pro", system-ui, sans-serif;
  --f-body: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-hand: "Patrick Hand", "Be Vietnam Pro", cursive;
  --f-mono: "Space Mono", ui-monospace, "Courier New", monospace;

  --r-lg: 26px;
  --r-md: 18px;
  --r-sm: 12px;
  --bw: 2.5px;
  --shadow: 5px 5px 0 var(--ink);
  --shadow-sm: 3px 3px 0 var(--ink);
  --topbar-h: 58px;
  --ease-pop: cubic-bezier(.34, 1.56, .64, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--topbar-h) + 12px); }
body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 17px;
  line-height: 1.6;
  overflow-x: clip;
  -webkit-tap-highlight-color: transparent;
}
img { max-width: 100%; height: auto; display: block; }
/* Grid item mặc định min-width:auto → ảnh 1080px kéo giãn cột và làm trình duyệt mobile thu nhỏ cả trang */
.khen__grid > *, .lixi__grid > *, .shop-grid > *, .sheet__grid > *, .dap__card > *, .hero .wrap > *, .scene > * { min-width: 0; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--f-display); line-height: 1.12; margin: 0; letter-spacing: -.01em; }
p { margin: 0 0 .8em; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--purple); outline-offset: 3px; border-radius: 6px; }

/* Grain giấy phủ toàn trang */
.grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 100;
  opacity: .22; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .25 0 0 0 0 .15 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 820px; }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  height: var(--topbar-h);
  background: color-mix(in srgb, var(--cream) 88%, transparent);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-bottom: 2px solid var(--ink);
}
.topbar .wrap { height: 100%; display: flex; align-items: center; gap: 10px; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; font-family: var(--f-display); font-weight: 800; font-size: 19px; margin-right: auto; white-space: nowrap; }
.brand img { width: 30px; height: 36px; object-fit: contain; }
.brand b { color: var(--clay); }
.icon-btn {
  height: 44px; min-width: 44px; padding: 0 10px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 2px solid var(--ink); border-radius: 999px; background: var(--paper);
  box-shadow: 2px 2px 0 var(--ink); font-size: 14px; font-weight: 700;
  transition: transform .12s, box-shadow .12s;
}
.icon-btn:active { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--ink); }
.icon-btn[aria-pressed="true"] { background: var(--gold-soft); }
.icon-btn .lbl { display: none; }
@media (min-width: 640px) { .icon-btn .lbl { display: inline; } }

/* ---------- Buttons ---------- */
.btn {
  --bg: var(--paper);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 12px 22px;
  border: var(--bw) solid var(--ink); border-radius: 999px;
  background: var(--bg); color: var(--ink);
  font-family: var(--f-display); font-weight: 800; font-size: 18px; line-height: 1.1;
  text-decoration: none; text-align: center;
  box-shadow: var(--shadow-sm);
  transition: transform .12s ease, box-shadow .12s ease, background .2s;
  user-select: none; -webkit-user-select: none;
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }
.btn:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--ink); }
.btn-primary { --bg: var(--clay-deep); color: #fff; }
.btn-gold { --bg: var(--gold); }
.btn-pink { --bg: var(--pink); }
.btn-ghost { --bg: transparent; box-shadow: none; border-style: dashed; }
.btn-sm { min-height: 44px; padding: 8px 16px; font-size: 16px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; }

/* ---------- Section scaffolding ---------- */
.section { padding: 64px 0; position: relative; }
@media (min-width: 900px) { .section { padding: 96px 0; } }
.lesson {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 14px 2px; margin-bottom: 14px;
  background: var(--gold-soft); border: 2px solid var(--ink); border-radius: 8px;
  font-family: var(--f-hand); font-size: 18px; transform: rotate(-2deg);
  box-shadow: var(--shadow-sm);
}
.lesson b { color: var(--red); font-weight: 400; }
.h2 { font-size: clamp(30px, 6.4vw, 52px); font-weight: 800; margin-bottom: 14px; }
.h2 em { font-style: normal; color: var(--clay); }
.lead { font-size: clamp(17px, 2.4vw, 20px); color: var(--ink-soft); max-width: 640px; }
.hand { font-family: var(--f-hand); }
.card {
  background: var(--paper); border: var(--bw) solid var(--ink);
  border-radius: var(--r-lg); box-shadow: var(--shadow);
}
.mark { background: linear-gradient(transparent 58%, var(--gold-soft) 58% 92%, transparent 92%); padding: 0 .1em; }
.tiny { font-size: 13px; color: var(--ink-soft); }
.footnote { font-size: 13px; color: var(--ink-soft); font-style: italic; }

.reveal { opacity: 0; transform: translateY(24px); transition: opacity .7s ease, transform .7s ease; }
.reveal.is-in { opacity: 1; transform: none; }

/* ---------- Speech bubble & comic sfx ---------- */
.bubble {
  position: absolute; z-index: 6;
  max-width: min(280px, 78vw); padding: 10px 14px;
  background: #fff; border: 2px solid var(--ink); border-radius: 18px;
  box-shadow: var(--shadow-sm);
  font-family: var(--f-hand); font-size: 18px; line-height: 1.3;
  opacity: 0; transform: translateY(6px) scale(.92); transform-origin: bottom center;
  transition: opacity .2s, transform .25s var(--ease-pop);
  pointer-events: none;
}
.bubble.show { opacity: 1; transform: none; }
.bubble::after {
  content: ""; position: absolute; left: 50%; bottom: -10px; width: 16px; height: 16px;
  background: #fff; border-right: 2px solid var(--ink); border-bottom: 2px solid var(--ink);
  transform: translateX(-50%) rotate(45deg);
}
.sfx {
  position: fixed; z-index: 90; pointer-events: none;
  font-family: var(--f-display); font-weight: 800; font-size: clamp(34px, 9vw, 64px);
  color: var(--gold); -webkit-text-stroke: 2.5px var(--ink); paint-order: stroke fill;
  text-shadow: 4px 4px 0 var(--ink);
  transform: translate(-50%, -50%);
  animation: sfx-pop .9s var(--ease-pop) forwards;
  white-space: nowrap;
}
.sfx.small { font-size: 26px; -webkit-text-stroke-width: 1.5px; text-shadow: 2px 2px 0 var(--ink); color: #fff; }
@keyframes sfx-pop {
  0% { opacity: 0; transform: translate(-50%, -30%) scale(.4) rotate(-12deg); }
  25% { opacity: 1; transform: translate(-50%, -55%) scale(1.12) rotate(4deg); }
  70% { opacity: 1; transform: translate(-50%, -70%) scale(1) rotate(-2deg); }
  100% { opacity: 0; transform: translate(-50%, -95%) scale(.9) rotate(0); }
}

.toast {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 95;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  max-width: min(440px, calc(100% - 32px)); width: max-content;
  padding: 10px 16px; border-radius: 14px;
  background: var(--ink); color: var(--cream); font-weight: 600; font-size: 15px; text-align: center;
  transition: opacity .25s, transform .3s var(--ease-pop);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Pig ---------- */
.pig { position: relative; isolation: isolate; user-select: none; -webkit-user-select: none; }
.pig__img { width: 100%; height: auto; transform-origin: 50% 92%; animation: breathe 3.6s ease-in-out infinite; filter: drop-shadow(0 18px 14px rgba(70, 35, 15, .22)); pointer-events: none; }
.pig__img.swap { animation: squash .55s var(--ease-pop); }
@keyframes breathe { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.012, 1.022); } }
@keyframes squash { 0% { transform: scale(1.18, .82); } 45% { transform: scale(.92, 1.1); } 75% { transform: scale(1.04, .97); } 100% { transform: scale(1, 1); } }
.pig.shake .pig__img { animation: wobble .5s ease-in-out; }
@keyframes wobble { 0%,100% { transform: rotate(0); } 20% { transform: rotate(-9deg) translateX(-4px); } 40% { transform: rotate(8deg) translateX(4px); } 60% { transform: rotate(-5deg); } 80% { transform: rotate(3deg); } }
.pig.chew .pig__img { animation: chew .6s ease-in-out; }
@keyframes chew { 0%,100% { transform: scale(1); } 25% { transform: scale(1.06, .95); } 50% { transform: scale(.97, 1.04); } 75% { transform: scale(1.04, .97); } }

/* Băng keo + sẹo sau khi bị đập (giữ suốt trang) */
.pig .tape { display: none; }
.has-scar .pig .tape {
  display: block; position: absolute; z-index: 3; pointer-events: none;
  left: 54%; top: 14%; width: 30%; height: 7%;
  background: repeating-linear-gradient(90deg, rgba(255,255,255,.0) 0 6px, rgba(255,255,255,.18) 6px 7px), rgba(250, 236, 200, .78);
  border: 1px solid rgba(120, 90, 50, .35);
  transform: rotate(-24deg); border-radius: 2px;
  box-shadow: 0 1px 2px rgba(0,0,0,.15);
}
.has-scar .pig .tape::after {
  content: ""; position: absolute; left: 18%; top: 120%; width: 70%; height: 100%;
  background: inherit; border: inherit; transform: rotate(48deg); transform-origin: left;
}

/* X-quang */
.xray {
  position: absolute; z-index: 4; left: 50%; top: 66%;
  width: 46%; aspect-ratio: 1; border-radius: 50%;
  transform: translate(-50%, -50%) scale(0);
  background: radial-gradient(circle at 50% 45%, #21507a 0%, #0f2a45 55%, #07131f 100%);
  border: 3px solid #a7dcff;
  box-shadow: 0 0 0 5px rgba(167, 220, 255, .28), inset 0 0 28px rgba(140, 210, 255, .55);
  transition: transform .45s var(--ease-pop);
  overflow: hidden;
}
.xray.on { transform: translate(-50%, -50%) scale(1); }
.xray::before { /* vạch quét */
  content: ""; position: absolute; left: 0; right: 0; height: 30%; top: 0;
  background: linear-gradient(transparent, rgba(167,220,255,.35), transparent);
  transform: translateY(-100%); animation: scan 1.6s linear infinite paused;
}
.xray.on::before { animation-play-state: running; }
@keyframes scan { to { transform: translateY(333%); } }
.xray__item { position: absolute; filter: grayscale(1) invert(1) brightness(1.15) sepia(1) hue-rotate(160deg) saturate(2.6); opacity: .92; }
.xray__coin { width: 34%; left: 18%; top: 44%; transform: rotate(-18deg); }
.xray__cap { width: 26%; left: 58%; top: 26%; transform: rotate(24deg); }
.xray__band { position: absolute; left: 52%; top: 58%; width: 30%; aspect-ratio: 1.4; border: 3px solid rgba(190, 235, 255, .8); border-radius: 50%; transform: rotate(-12deg); }
.xray__new { width: 30%; left: 34%; top: 14%; filter: drop-shadow(0 0 8px #ffe38a); display: none; }
.xray__new.show { display: block; }
.xray__label { position: absolute; left: 50%; top: 9%; transform: translateX(-50%); font-family: var(--f-mono); font-size: 9px; letter-spacing: .08em; color: #a7dcff; white-space: nowrap; }

/* ---------- HERO ---------- */
.hero { padding: 22px 0 56px; overflow: hidden; }
.hero .wrap { display: grid; gap: 18px; }
.hero__greet {
  display: inline-flex; align-items: center; gap: 8px; justify-self: start; max-width: 100%; line-height: 1.35;
  padding: 6px 14px; border: 2px solid var(--ink); border-radius: 999px;
  background: var(--paper); font-size: 14px; font-weight: 600; box-shadow: var(--shadow-sm);
}
.hero__greet .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--leaf); box-shadow: 0 0 0 3px rgba(46,158,91,.25); animation: blink 1.6s infinite; flex: none; }
@keyframes blink { 50% { opacity: .35; } }
.invite {
  padding: 12px 16px; border: 2px dashed var(--ink); border-radius: var(--r-md);
  background: var(--pink-soft); font-family: var(--f-hand); font-size: 19px; line-height: 1.35;
}
.invite[hidden] { display: none; }
.hero h1 { font-size: clamp(40px, 11vw, 70px); font-weight: 800; line-height: 1.02; }
.hero h1 > span { display: block; }
.hero h1 .h1-kicker { font-size: .5em; font-weight: 600; color: var(--ink-soft); margin-bottom: .1em; }
.hero h1 .pigname { font-size: 1.55em; line-height: .95; width: max-content; }
.hero h1 .h1-rest { font-size: .62em; margin-top: .12em; }
.hero h1 .pigname { color: var(--clay); position: relative; white-space: nowrap; }
.hero h1 .pigname::after {
  content: ""; position: absolute; left: -2%; right: -2%; bottom: .08em; height: .22em; z-index: -1;
  background: var(--gold-soft); border-radius: 4px; transform: rotate(-1.5deg);
}
.hero__sub { font-size: clamp(17px, 2.6vw, 21px); max-width: 560px; }
.hero__sub b { color: var(--clay-deep); }
.hero__stats { display: flex; flex-wrap: wrap; gap: 8px; }
.stat {
  display: inline-flex; align-items: baseline; gap: 6px;
  padding: 6px 12px; border-radius: 10px; border: 2px solid var(--ink); background: var(--paper);
  font-size: 14px;
}
.stat b { font-family: var(--f-display); font-size: 17px; }
.stat .bad { color: var(--red); }
.hero__cta { display: grid; gap: 12px; }
.hero__cta .btn { width: 100%; }
@media (min-width: 520px) { .hero__cta { grid-template-columns: 1fr 1fr; } }
.hero__trust { margin: -4px 0 0; font-size: 13.5px; color: var(--ink-soft); line-height: 1.45; }
.is-night .hero .hero__trust { color: #d9c7ad; }
.hero__hint { font-size: 14px; color: var(--ink-soft); display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.hero__hint button { background: none; border: 0; padding: 0; text-decoration: underline; text-underline-offset: 3px; color: var(--purple); font-weight: 600; }
.your-pig { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; font-size: 13px; padding: 4px 10px; border-radius: 999px; border: 1.5px dashed var(--ink-soft); color: var(--ink-soft); }

/* Cảnh: tường + lịch bloc + đầu tủ có khăn ren */
.scene { position: relative; display: grid; grid-template-columns: 40% 60%; align-items: end; gap: 0; min-height: 300px; margin: 6px -4px 0; }
.scene__shelf {
  position: absolute; left: -16px; right: -16px; bottom: 0; height: 30px; z-index: 0;
  background: linear-gradient(#a8693d, #87502b 60%, #6e3f22);
  border-top: 3px solid var(--ink); border-bottom: 3px solid var(--ink);
}
.scene__shelf::before { /* khăn ren */
  content: ""; position: absolute; left: 42%; width: 56%; top: -3px; height: 18px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='18'%3E%3Cpath d='M0 0h24v9a6 6 0 0 1-12 0a6 6 0 0 1-12 0z' fill='%23fffdf6'/%3E%3Ccircle cx='6' cy='6' r='1.7' fill='%23d9c9ab'/%3E%3Ccircle cx='18' cy='6' r='1.7' fill='%23d9c9ab'/%3E%3Ccircle cx='12' cy='2.6' r='1.1' fill='%23d9c9ab'/%3E%3C/svg%3E") 0 0 / 24px 18px repeat-x;
  filter: drop-shadow(0 2px 0 rgba(0,0,0,.2));
}
.scene .pig { z-index: 2; margin-bottom: 8px; cursor: pointer; touch-action: manipulation; }
.scene .pig .bubble { left: auto; right: 58%; bottom: 52%; width: max-content; max-width: min(250px, 62vw); transform-origin: right center; font-size: 17px; }
.scene .pig .bubble::after { left: auto; right: -10px; bottom: 22px; transform: rotate(-45deg); }
@media (min-width: 900px) { .scene .pig .bubble { max-width: 290px; font-size: 19px; } }
.poke-count { position: absolute; z-index: 5; right: 4%; top: 8%; font-family: var(--f-mono); font-size: 12px; background: var(--ink); color: var(--cream); padding: 2px 8px; border-radius: 6px; opacity: 0; transition: opacity .3s; }
.poke-count.show { opacity: 1; }

.lich {
  position: relative; z-index: 1; align-self: start; margin: 8px 6px 0 0;
  background: #fff; border: 2px solid var(--ink); border-radius: 6px 6px 10px 10px;
  box-shadow: var(--shadow-sm); transform: rotate(-3deg); transform-origin: 50% 0;
  cursor: pointer; touch-action: manipulation;
  font-family: var(--f-body);
}
.lich::before { /* đinh treo */
  content: ""; position: absolute; left: 50%; top: -16px; width: 12px; height: 12px; border-radius: 50%;
  background: #8b8b8b; border: 2px solid var(--ink); transform: translateX(-50%);
}
.lich__head { background: var(--red); color: #fff; text-align: center; font-family: var(--f-display); font-weight: 800; font-size: 11px; letter-spacing: .08em; padding: 5px 4px 3px; border-radius: 4px 4px 0 0; border-bottom: 2px solid var(--ink); }
.lich__pages { position: relative; }
.lich__page { background: #fff; padding: 6px 8px 10px; text-align: center; border-radius: 0 0 9px 9px; }
.lich__page.tearing { position: absolute; inset: 0; z-index: 3; animation: tear .8s ease-in forwards; transform-origin: 0 0; box-shadow: 0 6px 12px rgba(0,0,0,.18); }
@keyframes tear { 0% { transform: rotate(0); } 30% { transform: rotate(-8deg) translateY(4px); } 100% { transform: rotate(-38deg) translate(-40%, 140%); opacity: 0; } }
.lich__month { font-size: 11px; font-weight: 700; color: var(--ink-soft); letter-spacing: .04em; }
.lich__day { font-family: var(--f-display); font-weight: 800; font-size: clamp(54px, 15vw, 84px); line-height: .95; color: #1d4fa0; }
.lich__day.sun { color: var(--red); }
.lich__dow { font-weight: 800; font-size: 12px; letter-spacing: .06em; }
.lich__lunar { margin: 6px auto 4px; padding: 3px 4px; border: 1.5px solid var(--red); border-radius: 6px; color: var(--red); font-size: 10.5px; line-height: 1.3; }
.lich__lunar b { display: block; font-family: var(--f-display); font-size: 20px; line-height: 1; }
.lich__quote { font-family: var(--f-hand); font-size: 14px; line-height: 1.25; color: var(--ink); min-height: 3.6em; }
.lich__tear-hint { position: absolute; right: 6px; bottom: -22px; font-family: var(--f-hand); font-size: 13px; color: var(--ink-soft); transform: rotate(-3deg); white-space: nowrap; }

@media (min-width: 900px) {
  .hero { padding: 48px 0 88px; }
  .hero .wrap { grid-template-columns: .92fr 1.08fr; grid-template-areas: "text scene"; align-items: center; column-gap: 32px; }
  .hero__text { grid-area: text; display: grid; gap: 18px; }
  .hero__cta { grid-template-columns: auto auto; justify-content: start; }
  .hero__cta .btn { width: auto; white-space: nowrap; }
  .scene { grid-area: scene; min-height: 560px; grid-template-columns: 34% 66%; margin-right: -24px; }
  .hero h1 { font-size: clamp(56px, 6vw, 80px); }
  .lich__quote { font-size: 16px; }
}
@media (max-width: 899px) {
  .hero__text { display: contents; }
  .hero__greet { order: 1; } .invite { order: 2; } .hero h1 { order: 3; } .hero__sub { order: 4; } .scene { order: 5; }
  .hero__stats { order: 6; } .hero__cta { order: 7; } .hero__trust { order: 8; } .hero__hint { order: 9; }
  .scene { min-height: 0; }
}

/* Night mode 23h–4h: đèn ngủ */
.is-night .hero { background: radial-gradient(ellipse at 70% 30%, #4a3424 0%, var(--night) 65%); color: var(--cream); }
/* Thẻ nền sáng tự giữ chữ đậm, không ăn theo chữ kem của nền tối */
.hero__greet, .stat, .lich, .invite, .bubble, .ticker { color: var(--ink); }
.is-night .hero h1 .h1-kicker, .is-night .hero .lich__tear-hint { color: #e3d3b8; }
.is-night .hero .hero__hint button { color: #cdbcff; }
.is-night .hero .your-pig { color: #e3d3b8; border-color: #b9a586; }
.is-night .hero .hero__sub b { color: var(--gold-soft); }
.is-night .hero .hero__hint { color: #d9c7ad; }
.is-night .hero .scene__shelf { filter: brightness(.75); }

/* ---------- Sổ liên lạc ---------- */
.so { background: radial-gradient(circle at 1px 1px, rgba(45,27,18,.08) 1px, transparent 1.5px) 0 0 / 18px 18px, var(--cream); }
.notebook { margin-top: 26px; perspective: 1600px; }
.notebook__cover {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 18px; background: #2e6fb5; color: #fff; border: var(--bw) solid var(--ink);
  border-radius: var(--r-md) var(--r-md) 0 0; border-bottom: 0;
  font-family: var(--f-display); font-weight: 800; letter-spacing: .06em;
}
.notebook__cover small { font-family: var(--f-hand); font-weight: 400; letter-spacing: 0; font-size: 16px; opacity: .9; }
.notebook__pages { position: relative; display: grid; border: var(--bw) solid var(--ink); border-radius: 0 0 var(--r-md) var(--r-md); box-shadow: var(--shadow); background: var(--paper); overflow: hidden; }
.page {
  padding: 22px 18px 26px 46px; min-height: 100%;
  background:
    linear-gradient(90deg, transparent 32px, rgba(193,18,31,.45) 32px 34px, transparent 34px),
    repeating-linear-gradient(transparent 0 27px, var(--line-blue) 27px 28px),
    var(--paper);
  font-family: var(--f-hand); font-size: 19px; line-height: 28px; color: var(--purple);
}
.page h3 { font-family: var(--f-hand); font-weight: 400; font-size: 24px; color: var(--ink); line-height: 28px; margin-bottom: 0; text-decoration: underline; text-decoration-color: var(--red); text-underline-offset: 4px; }
.page dl { margin: 0; }
.page dt { display: inline; }
.page dd { display: inline; margin: 0 0 0 .3em; }
.page dd::after { content: "\A"; white-space: pre; }
@media (min-width: 520px) {
  .page dl { display: grid; grid-template-columns: auto 1fr; column-gap: 10px; }
  .page dd { margin: 0; } .page dd::after { content: none; }
}
.page dt { color: var(--ink-soft); }

.page p { margin: 0; }
.page .red { color: var(--red); }
.page .quote-who { color: var(--ink-soft); font-size: 16px; }
.owner { display: grid; grid-template-columns: 84px 1fr; gap: 12px; align-items: center; margin: 4px 0 10px; }
.owner__photo { width: 84px; height: 84px; border-radius: 14px; border: 2px solid var(--ink); object-fit: cover; background: var(--pink-soft); transform: rotate(-3deg); box-shadow: var(--shadow-sm); }
.owner__photo--empty { display: grid; place-items: center; font-size: 13px; line-height: 1.2; text-align: center; color: var(--ink-soft); padding: 6px; font-family: var(--f-hand); }
.sign-box {
  margin-top: 10px; position: relative; height: 72px; border: 2px dashed var(--ink-soft); border-radius: 10px;
  display: grid; place-items: center; color: var(--ink-soft); cursor: pointer; background: rgba(255,255,255,.5);
  font-family: var(--f-hand); font-size: 17px;
}
.sign-box svg { position: absolute; inset: 6px 10px; width: calc(100% - 20px); height: calc(100% - 12px); }
.sign-box path { fill: none; stroke: var(--purple); stroke-width: 2.5; stroke-linecap: round; stroke-dasharray: 600; stroke-dashoffset: 600; }
.sign-box.signed path { animation: draw 1.1s ease forwards; }
.sign-box.signed .sign-label { opacity: 0; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.stamp {
  position: absolute; right: 8px; top: 50%; padding: 2px 10px; border: 3px solid var(--red); color: var(--red);
  border-radius: 8px; font-family: var(--f-display); font-weight: 800; font-size: 18px; letter-spacing: .06em;
  transform: translateY(-50%) rotate(-12deg) scale(2.4); opacity: 0; mix-blend-mode: multiply;
}
.sign-box.signed .stamp { animation: stamp .35s .9s ease-out forwards; }
@keyframes stamp { to { opacity: .9; transform: translateY(-50%) rotate(-12deg) scale(1); } }
.flip-btn { position: absolute; right: 12px; bottom: 10px; z-index: 3; }
@media (max-width: 859px) {
  .notebook__pages { grid-template-areas: "p"; }
  .page { grid-area: p; backface-visibility: hidden; transition: transform .7s cubic-bezier(.6,.05,.3,1), opacity .7s, visibility 0s; }
  .page-2 { transform: rotateY(90deg); opacity: 0; pointer-events: none; visibility: hidden; transition: transform .7s cubic-bezier(.6,.05,.3,1), opacity .7s, visibility 0s .7s; }
  .notebook.flipped .page-1 { transform: rotateY(-90deg); opacity: 0; pointer-events: none; visibility: hidden; transition: transform .7s cubic-bezier(.6,.05,.3,1), opacity .7s, visibility 0s .7s; }
  .notebook.flipped .page-2 { transform: none; opacity: 1; pointer-events: auto; visibility: visible; transition: transform .7s cubic-bezier(.6,.05,.3,1), opacity .7s, visibility 0s; }
  .page { padding-bottom: 64px; }
}
@media (min-width: 860px) {
  .notebook__pages { grid-template-columns: 1fr 1fr; }
  .page-1 { border-right: 2px solid rgba(45,27,18,.25); box-shadow: inset -14px 0 18px -14px rgba(0,0,0,.25); }
  .flip-btn { display: none; }
}

/* ---------- Lì xì calculator ---------- */
.lixi { background: var(--cream-2); border-top: 2px solid var(--ink); border-bottom: 2px solid var(--ink); }
.lixi__grid { display: grid; gap: 22px; margin-top: 24px; }
@media (min-width: 900px) { .lixi__grid { grid-template-columns: 1fr 1fr; align-items: start; } }
.step { padding: 20px 18px; }
@media (min-width: 600px) { .step { padding: 24px; } }
.step h3 { font-size: 22px; font-weight: 800; margin-bottom: 12px; display: flex; gap: 10px; align-items: center; }
.step h3 .n { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--clay); color: #fff; font-size: 16px; border: 2px solid var(--ink); }
.dreams { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.dream {
  display: grid; justify-items: center; gap: 4px; padding: 10px 6px 8px;
  border: 2px solid var(--ink); border-radius: 16px; background: #fff;
  font-size: 13px; font-weight: 600; line-height: 1.25; text-align: center;
  box-shadow: 2px 2px 0 var(--ink); transition: transform .15s, background .2s;
}
.dream img { width: 58px; height: 58px; object-fit: contain; }
.dream[aria-pressed="true"] { background: var(--gold-soft); transform: translateY(-3px) rotate(-1.5deg); }
.dream-reply { margin-top: 12px; min-height: 3.4em; font-family: var(--f-hand); font-size: 19px; line-height: 1.35; color: var(--purple); }
.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field > label, .field > .label { font-weight: 700; font-size: 15px; }
.field .hint { font-size: 13px; color: var(--ink-soft); font-family: var(--f-hand); font-size: 16px; }
.input {
  width: 100%; min-height: 48px; padding: 10px 14px; border: 2px solid var(--ink); border-radius: 12px; background: #fff; font-size: 17px;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 40px; padding: 6px 14px; border: 2px solid var(--ink); border-radius: 999px;
  background: #fff; font-weight: 600; font-size: 15px; transition: background .15s, transform .15s;
}
.chip[aria-pressed="true"] { background: var(--gold); transform: translateY(-1px); box-shadow: 2px 2px 0 var(--ink); }
.range { -webkit-appearance: none; appearance: none; width: 100%; height: 14px; border-radius: 999px; border: 2px solid var(--ink); background: linear-gradient(90deg, var(--gold) var(--p, 20%), #fff var(--p, 20%)); }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 34px; height: 34px; border-radius: 50%; border: 2.5px solid var(--ink); background: radial-gradient(circle at 35% 35%, #fff6c9, var(--gold) 55%, #c98f00); box-shadow: 2px 2px 0 var(--ink); }
.range::-moz-range-thumb { width: 30px; height: 30px; border-radius: 50%; border: 2.5px solid var(--ink); background: var(--gold); }
.range-val { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.range-val b { font-family: var(--f-display); font-size: 24px; }
.terms { font-family: var(--f-mono); font-size: 12.5px; line-height: 1.5; padding: 10px 12px; border: 2px dashed var(--ink-soft); border-radius: 10px; background: rgba(255,255,255,.5); }

.calc { padding: 18px; background: #3a3f46; border-radius: 26px; border: var(--bw) solid var(--ink); box-shadow: var(--shadow); color: #e9ecef; }
.calc__brand { display: flex; justify-content: space-between; align-items: center; font-family: var(--f-mono); font-size: 11px; letter-spacing: .14em; color: #c7ccd2; margin-bottom: 10px; }
.calc__solar { width: 64px; height: 16px; border-radius: 3px; background: repeating-linear-gradient(90deg, #4b3527 0 14px, #2b1d14 14px 16px); border: 1px solid #111; }
.lcd {
  padding: 14px 14px 10px; border-radius: 10px; background: linear-gradient(#cfdcbc, #b7c7a2);
  box-shadow: inset 0 3px 8px rgba(0,0,0,.35); color: #1c2616; font-family: var(--f-mono);
  text-align: right; overflow: hidden;
}
.lcd__who { font-size: 13px; text-align: left; min-height: 1.2em; }
.lcd__num { font-size: clamp(30px, 9.5vw, 46px); font-weight: 700; line-height: 1.15; letter-spacing: -.02em; white-space: nowrap; }
.lcd__unit { font-size: 13px; }
.calc__keys { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 14px; }
.calc__keys span { height: 26px; border-radius: 7px; background: #1f2328; box-shadow: 0 3px 0 #0b0d10; }
.calc__keys span:nth-child(4n) { background: var(--clay); }
.convert { margin-top: 14px; font-size: 15px; color: #e9ecef; line-height: 1.55; }
.convert b { color: var(--gold-soft); }
.formula { margin-top: 8px; font-family: var(--f-mono); font-size: 11.5px; color: #b9c0c7; }
.calc-actions { margin-top: 16px; display: grid; gap: 10px; }
.calc-note { font-family: var(--f-hand); font-size: 19px; color: var(--gold-soft); margin-top: 12px; line-height: 1.35; }

.chat { margin-top: 18px; display: grid; gap: 8px; }
.chat[hidden] { display: none; }
.chat__msg { justify-self: end; max-width: 88%; padding: 10px 14px; border-radius: 18px 18px 4px 18px; background: #1d63c9; color: #fff; font-size: 15px; position: relative; }
.chat__msg .typing { opacity: .7; }
.chat__msg.blocked { text-decoration: line-through; opacity: .55; }
.chat__pig { justify-self: start; display: flex; gap: 8px; align-items: end; max-width: 92%; }
.chat__pig img { width: 46px; height: auto; }
.chat__pig p { margin: 0; padding: 10px 14px; border: 2px solid var(--ink); border-radius: 18px 18px 18px 4px; background: #fff; font-family: var(--f-hand); font-size: 19px; color: var(--ink); line-height: 1.3; }

.twist {
  margin-top: 22px; padding: 30px 22px 26px; border-radius: var(--r-lg); border: var(--bw) solid var(--ink);
  background: radial-gradient(ellipse at 50% 0%, #4b3a63 0%, #241a33 45%, #120e1a 100%);
  color: #f7ead0; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.twist[hidden] { display: none; }
.twist::before { /* đom đóm */
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .7;
  background-image: radial-gradient(2px 2px at 12% 30%, #ffe38a, transparent), radial-gradient(2px 2px at 82% 18%, #ffe38a, transparent), radial-gradient(1.5px 1.5px at 66% 72%, #ffe38a, transparent), radial-gradient(2px 2px at 28% 84%, #ffe38a, transparent), radial-gradient(1.5px 1.5px at 92% 60%, #ffe38a, transparent);
  animation: flicker 4s ease-in-out infinite alternate;
}
@keyframes flicker { to { opacity: .25; } }
.twist__lines { position: relative; font-family: var(--f-hand); font-size: clamp(21px, 4.6vw, 28px); line-height: 1.5; }
.twist__lines p { margin: 0 0 6px; opacity: 0; transform: translateY(10px); transition: opacity 1s ease, transform 1s ease; }
.twist__lines p.on { opacity: 1; transform: none; }
.twist__lines p.big { font-size: 1.18em; color: var(--gold-soft); margin-top: 14px; }
.twist__cta { position: relative; margin-top: 22px; display: grid; gap: 10px; opacity: 0; transition: opacity .8s; }
.twist__cta.on { opacity: 1; }
.twist__soft { font-size: 15px; color: #d5c6aa; font-style: italic; margin: 14px 0 0; }
.twist .btn { box-shadow: 3px 3px 0 #000; }
.twist .btn-ghost { color: #f7ead0; border-color: rgba(255,230,180,.6); box-shadow: none; }
.call-wait { font-family: var(--f-hand); font-size: 19px; color: var(--gold-soft); min-height: 1.4em; }
.bridge { text-align: center; margin-top: 40px; font-family: var(--f-hand); font-size: 22px; }
.bridge a { display: inline-block; margin-top: 6px; font-size: 30px; text-decoration: none; animation: bob 1.6s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(6px); } }

/* ---------- Đập heo ---------- */
.dap__card { margin-top: 24px; padding: 18px; display: grid; gap: 16px; overflow: hidden; }
@media (min-width: 900px) { .dap__card { grid-template-columns: 1fr 1fr; align-items: center; padding: 28px; } }
.smash-stage {
  position: relative; height: 340px; border-radius: var(--r-md); border: 2px solid var(--ink);
  background: radial-gradient(ellipse at 50% 85%, #f5d8b0 0 30%, transparent 31%), linear-gradient(#ffe9c7, #f7d9a8);
  overflow: hidden; touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
.smash-stage .pig { position: absolute; left: 50%; bottom: 16px; width: 210px; transform: translateX(-50%); }
.smash-stage.armed { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 48 48'%3E%3Ctext y='40' font-size='40'%3E%F0%9F%94%A8%3C/text%3E%3C/svg%3E") 8 40, pointer; }
.cracks { position: absolute; inset: 0; z-index: 4; pointer-events: none; }
.cracks path { fill: none; stroke: #3b1e10; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 200; stroke-dashoffset: 200; transition: stroke-dashoffset .35s ease-out; }
.cracks.l1 .c1, .cracks.l2 .c1, .cracks.l2 .c2 { stroke-dashoffset: 0; }
.shard { position: absolute; z-index: 5; pointer-events: none; will-change: transform; }
.hammer {
  position: absolute; z-index: 7; width: 96px; pointer-events: none; transform-origin: 80% 85%;
  left: 62%; top: 18%; transform: rotate(28deg); transition: opacity .2s;
}
.hammer.hit { animation: hit .22s ease-in; }
@keyframes hit { 0% { transform: rotate(28deg); } 50% { transform: rotate(-38deg); } 100% { transform: rotate(28deg); } }
.coin-drop { position: absolute; z-index: 6; width: 56px; left: 50%; bottom: 40px; transform: translateX(-50%); animation: coin-bounce .9s var(--ease-pop); }
@keyframes coin-bounce { 0% { transform: translate(-50%, -140px) rotate(0); } 60% { transform: translate(-50%, 0) rotate(540deg); } 80% { transform: translate(-50%, -18px) rotate(600deg); } 100% { transform: translate(-50%, 0) rotate(720deg); } }
.smash-stage .bubble { left: 50%; top: 14px; translate: -50% 0; }
.smash-stage .bubble::after { display: none; }
.smash-text { font-size: 17px; }
.smash-text .h3 { font-family: var(--f-display); font-weight: 800; font-size: 26px; margin-bottom: 8px; line-height: 1.15; }
.smash-result { font-family: var(--f-hand); font-size: 20px; color: var(--purple); min-height: 2.8em; line-height: 1.35; }

/* ---------- Tạp hoá Cô Ba ---------- */
.shop-head { display: flex; flex-wrap: wrap; align-items: end; gap: 12px 24px; justify-content: space-between; }
.sign-board {
  display: inline-block; padding: 10px 22px 8px; background: linear-gradient(#b37843, #8a5530); color: #fff3d6;
  border: var(--bw) solid var(--ink); border-radius: 10px; box-shadow: var(--shadow-sm);
  font-family: var(--f-display); font-weight: 800; font-size: clamp(24px, 6vw, 34px); letter-spacing: .02em; transform: rotate(-1.5deg);
}
.sign-board small { display: block; font-family: var(--f-hand); font-weight: 400; font-size: 17px; letter-spacing: 0; opacity: .92; }
.scarce { font-family: var(--f-hand); font-size: 18px; text-align: right; line-height: 1.25; }
.scarce sup { color: var(--red); }

.shop-grid { display: grid; gap: 18px; margin-top: 24px; }
@media (min-width: 960px) { .shop-grid { grid-template-columns: 330px 1fr; align-items: start; } }

.tray {
  position: sticky; top: calc(var(--topbar-h) + 8px); z-index: 20;
  display: grid; grid-template-columns: 92px 1fr; gap: 12px; align-items: center;
  padding: 10px 14px; background: var(--paper);
  border: var(--bw) solid var(--ink); border-radius: var(--r-md); box-shadow: var(--shadow-sm);
}
.tray .pig { width: 92px; }
.tray .pig__img { animation: none; }
.tray__plate { position: absolute; left: -6%; right: -6%; bottom: -4px; height: 16px; border-radius: 50%; background: radial-gradient(ellipse at 50% 40%, #f2f2f2, #b9bdc2 60%, #8d9298); border: 2px solid var(--ink); z-index: -1; }
.tray__w { font-family: var(--f-display); font-weight: 800; font-size: 20px; line-height: 1.1; }
.tray__w small { font-family: var(--f-body); font-weight: 600; font-size: 12px; color: var(--ink-soft); display: block; }
.tray__total { font-size: 14px; }
.tray__total b { font-family: var(--f-display); font-size: 18px; color: var(--clay-deep); }
.tray__say { font-family: var(--f-hand); font-size: 17px; line-height: 1.25; color: var(--purple); margin-top: 2px; min-height: 2.5em; }
.tray__actions { display: none; }
@media (min-width: 960px) {
  .tray { grid-template-columns: 1fr; padding: 22px; text-align: center; top: calc(var(--topbar-h) + 18px); }
  .tray .pig { width: 210px; margin: 0 auto 8px; }
  .tray__w { font-size: 28px; }
  .tray__say { font-size: 20px; min-height: 3em; }
  .tray__actions { display: grid; gap: 10px; margin-top: 12px; }
}

.board {
  padding: 18px 14px; border-radius: var(--r-lg); color: #f3eee2;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(255,255,255,.06), transparent 60%),
    var(--chalk);
  border: 12px solid #8a5a33; outline: var(--bw) solid var(--ink); box-shadow: var(--shadow), inset 0 0 40px rgba(0,0,0,.5);
}
@media (min-width: 600px) { .board { padding: 24px 22px; } }
.board h3 { font-family: var(--f-hand); font-weight: 400; font-size: 24px; color: var(--gold-soft); margin: 4px 0 12px; }
.board h3:not(:first-child) { margin-top: 26px; }
.items { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .items { grid-template-columns: 1fr 1fr; } }
.item {
  position: relative; display: grid; grid-template-columns: 64px 1fr; gap: 4px 12px; align-items: center;
  padding: 10px 12px; text-align: left; color: inherit;
  border: 2px dashed rgba(255,255,255,.28); border-radius: 16px; background: rgba(255,255,255,.04);
  transition: transform .15s, background .2s, border-color .2s;
}
.item:hover { background: rgba(255,255,255,.08); }
.item:active { transform: scale(.98); }
.item img { grid-row: span 3; width: 64px; height: 64px; object-fit: contain; filter: drop-shadow(0 4px 4px rgba(0,0,0,.35)); }
.item__name { font-family: var(--f-hand); font-size: 20px; line-height: 1.15; color: #fff; }
.item__price { font-family: var(--f-display); font-weight: 800; font-size: 19px; color: var(--gold); line-height: 1; }
.item__joke { font-size: 13.5px; line-height: 1.35; color: #cfd7cf; }
.item__qty { position: absolute; right: -8px; top: -8px; min-width: 28px; height: 28px; padding: 0 6px; display: none; place-items: center; border-radius: 999px; background: var(--gold); color: var(--ink); border: 2px solid var(--ink); font-weight: 800; font-size: 14px; }
.item.in-cart { border-style: solid; border-color: var(--gold); background: rgba(242,183,5,.1); }
.item.in-cart .item__qty { display: grid; }
.item.sold-out { opacity: .55; filter: grayscale(.7); cursor: not-allowed; }
.item.sold-out::after { content: "HẾT HÀNG"; position: absolute; right: 10px; top: 50%; transform: translateY(-50%) rotate(-10deg); padding: 2px 8px; border: 3px solid #ff6b6b; color: #ff6b6b; font-family: var(--f-display); font-weight: 800; border-radius: 6px; }
.item .variants { grid-column: 2; display: flex; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.item .variants span { padding: 2px 10px; border-radius: 999px; border: 1.5px solid var(--gold); color: var(--gold); font-weight: 700; font-size: 13px; }
.item .variants span:active { background: var(--gold); color: var(--ink); }
.item-special { border-color: var(--pink); }
.custom-coin { display: grid; gap: 10px; padding: 14px; border: 2px dashed rgba(255,255,255,.28); border-radius: 16px; }
.custom-coin .row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.custom-coin input { flex: 1 1 140px; min-height: 46px; border-radius: 12px; border: 2px solid var(--gold); background: rgba(0,0,0,.2); color: #fff; padding: 8px 12px; font-size: 18px; }
.custom-coin .chip { background: transparent; color: var(--gold); border-color: var(--gold); }
.board .footnote { color: #b7c0b7; margin-top: 16px; }

.fly { position: fixed; z-index: 80; width: 60px; height: 60px; object-fit: contain; pointer-events: none; }

/* ---------- Dock ---------- */
.dock {
  position: fixed; left: 50%; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 60;
  width: min(560px, calc(100% - 24px));
  display: flex; align-items: center; gap: 10px;
  padding: 7px 7px 7px 10px; border-radius: 999px;
  background: var(--ink); color: var(--cream); box-shadow: 0 10px 28px rgba(45,27,18,.35);
  transform: translate(-50%, 160%); transition: transform .45s var(--ease-pop);
}
.dock.show { transform: translate(-50%, 0); }
.dock__pig { width: 40px; height: 44px; object-fit: contain; flex: none; }
.dock__txt { flex: 1; min-width: 0; font-size: 13px; line-height: 1.25; }
.dock__txt b { display: block; font-family: var(--f-display); font-size: 16px; color: var(--gold-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dock__txt span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dock .btn { min-height: 46px; padding: 8px 18px; font-size: 16px; box-shadow: none; border-color: var(--cream); flex: none; }
.dock.bump { animation: dock-bump .4s var(--ease-pop); }
@keyframes dock-bump { 40% { transform: translate(-50%, -8px) scale(1.03); } }

/* ---------- Checkout sheet ---------- */
.sheet {
  border: 0; padding: 0; background: transparent; color: var(--ink);
  width: 100%; max-width: 100%; height: 100%; max-height: 100%; margin: 0;
}
.sheet::backdrop { background: rgba(30, 18, 10, .55); backdrop-filter: blur(3px); }
.sheet__inner {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 94dvh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--cream); border-top: var(--bw) solid var(--ink); border-radius: 24px 24px 0 0;
  padding: 10px 16px calc(24px + env(safe-area-inset-bottom));
  animation: sheet-up .45s var(--ease-pop);
}
@keyframes sheet-up { from { transform: translateY(100%); } }
@media (min-width: 760px) {
  .sheet__inner { left: 50%; top: 50%; bottom: auto; width: min(860px, calc(100% - 48px)); transform: translate(-50%, -50%); border: var(--bw) solid var(--ink); border-radius: var(--r-lg); box-shadow: var(--shadow); max-height: 92dvh; padding: 18px 24px 26px; animation: fade-in .3s ease; }
  @keyframes fade-in { from { opacity: 0; } }
}
.sheet__grab { width: 44px; height: 5px; border-radius: 9px; background: var(--ink-soft); margin: 2px auto 10px; opacity: .5; }
.sheet__close { position: sticky; top: 0; float: right; z-index: 3; }
.sheet__grid { display: grid; gap: 18px; clear: both; }
@media (min-width: 760px) { .sheet__grid { grid-template-columns: 1fr 1fr; align-items: start; } }
@media (max-width: 759px) { .sheet__grid > div:last-child { order: -1; } }

.receipt {
  position: relative; padding: 22px 18px 26px; background: #fffef8; color: #222;
  font-family: var(--f-mono); font-size: 13px; line-height: 1.55;
  filter: drop-shadow(3px 4px 0 rgba(45,27,18,.85));
  --zig: radial-gradient(circle at 8px 0, transparent 7px, #fffef8 7.5px) 0 0 / 16px 12px repeat-x;
  -webkit-mask: linear-gradient(#000 0 0) 0 12px / 100% calc(100% - 24px) no-repeat, radial-gradient(circle at 8px 12px, transparent 7px, #000 7.5px) 0 0 / 16px 12px repeat-x, radial-gradient(circle at 8px 0, transparent 7px, #000 7.5px) 0 100% / 16px 12px repeat-x;
          mask: linear-gradient(#000 0 0) 0 12px / 100% calc(100% - 24px) no-repeat, radial-gradient(circle at 8px 12px, transparent 7px, #000 7.5px) 0 0 / 16px 12px repeat-x, radial-gradient(circle at 8px 0, transparent 7px, #000 7.5px) 0 100% / 16px 12px repeat-x;
  animation: print 1.1s steps(14) both;
}
@keyframes print { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }
.receipt h4 { margin: 0; text-align: center; font-family: var(--f-display); font-size: 22px; letter-spacing: .04em; }
.receipt .c { text-align: center; }
.receipt hr { border: 0; border-top: 1.5px dashed #555; margin: 10px 0; }
.receipt .row { display: flex; justify-content: space-between; gap: 10px; }
.receipt .row span:first-child { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.receipt .row.total { font-weight: 700; font-size: 17px; }
.receipt input { width: 100%; border: 0; border-bottom: 1.5px dashed #555; background: transparent; font-family: var(--f-mono); font-size: 13px; padding: 2px 0; }
.receipt .words { font-style: italic; }
.receipt .sig { font-family: var(--f-hand); font-size: 18px; }
.receipt .ast { font-size: 11px; color: #666; }
.receipt .row.line { align-items: center; padding: 3px 0; }
.receipt .qty { display: inline-flex; gap: 6px; margin-right: 6px; vertical-align: middle; }
.receipt .qty button { width: 30px; height: 30px; border: 1.5px solid #555; background: #fff; border-radius: 6px; font-size: 16px; line-height: 1; padding: 0; touch-action: manipulation; }
.receipt .empty { text-align: center; padding: 14px 0; font-family: var(--f-hand); font-size: 18px; }

.envelope {
  position: relative; padding: 18px 16px 18px; border-radius: 20px; color: #fff4d8;
  background:
    radial-gradient(circle at 20% 10%, rgba(255,215,120,.25), transparent 40%),
    repeating-linear-gradient(45deg, rgba(255,210,110,.07) 0 10px, transparent 10px 20px),
    #b5121b;
  border: var(--bw) solid var(--ink); box-shadow: var(--shadow);
}
.envelope::before { content: ""; position: absolute; inset: 7px; border: 2px solid rgba(255, 215, 120, .65); border-radius: 15px; pointer-events: none; }
.envelope h4 { margin: 0 0 10px; font-family: var(--f-display); font-size: 21px; text-align: center; color: #ffe08a; }
.qr-box { position: relative; background: #fff; border-radius: 14px; padding: 12px; width: min(260px, 80%); margin: 0 auto; border: 3px solid #ffd46b; }
.qr-box canvas { width: 100%; height: auto; display: block; image-rendering: pixelated; }
.qr-box .qr-pig { position: absolute; left: 50%; top: 50%; width: 22%; transform: translate(-50%, -50%); background: #fff; border-radius: 10px; padding: 2px; }
.qr-missing { padding: 20px 12px; text-align: center; color: var(--ink); font-family: var(--f-hand); font-size: 18px; line-height: 1.35; }
.pay-info { margin: 12px 0 0; display: grid; gap: 6px; font-size: 14px; }
.pay-info div { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px dashed rgba(255,220,150,.35); padding-bottom: 4px; }
.pay-info dt { opacity: .85; }
.pay-info dd { margin: 0; font-weight: 700; text-align: right; word-break: break-all; }
.pay-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.pay-btns .btn { min-height: 44px; font-size: 15px; padding: 8px 10px; }
.pay-btns .btn-gold { grid-column: span 2; }
.scan-tip { margin-top: 12px; padding: 10px 12px; border-radius: 12px; background: rgba(0,0,0,.22); font-size: 14px; line-height: 1.45; }
.trust { margin-top: 16px; font-size: 14.5px; line-height: 1.5; }
.trust p { margin-bottom: .6em; }
.trust .hand { font-size: 18px; color: var(--purple); }
.done-btns { display: grid; gap: 10px; margin-top: 14px; }

/* Ảnh để nhấn giữ lưu (webview) */
.holdsave { position: fixed; inset: 0; z-index: 120; border: 0; margin: 0; width: 100%; height: 100%; max-width: none; max-height: none; background: rgba(20,12,6,.88); display: grid; place-items: center; padding: 20px; }
.holdsave:not([open]) { display: none; }
.holdsave::backdrop { background: transparent; }
.holdsave figure { margin: 0; display: grid; gap: 12px; justify-items: center; max-width: 420px; }
.holdsave img { max-height: 72dvh; width: auto; border-radius: 14px; border: 3px solid var(--cream); }
.holdsave figcaption { color: var(--cream); text-align: center; font-weight: 600; }

/* ---------- Celebrate + giấy khen ---------- */
.celebrate { position: fixed; inset: 0; z-index: 110; display: flex; overflow-y: auto; background: rgba(255, 244, 220, .94); backdrop-filter: blur(4px); padding: 20px;
  border: 0; margin: 0; width: 100%; height: 100%; max-width: 100%; max-height: 100%; color: var(--ink); }
.celebrate:not([open]) { display: none; }
.celebrate::backdrop { background: transparent; }
.celebrate__fx { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 3; }
.celebrate__box { margin: auto; text-align: center; max-width: 440px; display: grid; justify-items: center; gap: 8px; }
.celebrate__pig { width: min(220px, 52vw); position: relative; }
.celebrate__pig img { animation: joy-jump .9s var(--ease-pop) .5s both; }
@keyframes joy-jump { 0% { transform: scale(.6); } 50% { transform: scale(1.12, .92) translateY(-14px); } 100% { transform: scale(1); } }
.celebrate__coin { position: absolute; left: 50%; top: -12%; width: 64px; transform: translateX(-50%); animation: coin-in .7s ease-in both; z-index: 2; }
@keyframes coin-in { 0% { transform: translate(-50%, -160px) rotate(0); opacity: 1; } 85% { transform: translate(-50%, 20px) rotate(540deg) scale(.6); opacity: 1; } 100% { transform: translate(-50%, 30px) scale(.2); opacity: 0; } }
.celebrate h3 { font-size: clamp(28px, 7vw, 40px); font-weight: 800; color: var(--clay); }
.celebrate p { font-family: var(--f-hand); font-size: 21px; line-height: 1.35; }

.khen__grid { display: grid; gap: 22px; margin-top: 24px; }
@media (min-width: 900px) { .khen__grid { grid-template-columns: 1.05fr .95fr; align-items: start; } }
.cert-panel { padding: 18px; }
.cert-preview { width: 100%; border-radius: 12px; border: 2px solid var(--ink); background: #fff; aspect-ratio: 4 / 5; object-fit: contain; }
.cert-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.share-panel { padding: 18px; display: grid; gap: 14px; }
.caption {
  position: relative; display: block; width: 100%; text-align: left; padding: 12px 14px 12px 14px;
  border: 2px solid var(--ink); border-radius: 14px; background: #fff; font-size: 15px; line-height: 1.45;
  box-shadow: 2px 2px 0 var(--ink); transition: transform .12s;
}
.caption:active { transform: translate(2px,2px); box-shadow: none; }
.caption::after { content: "chạm để copy"; display: block; margin-top: 4px; font-size: 12px; color: var(--ink-soft); font-weight: 600; }
.invite-maker { display: grid; gap: 8px; padding: 14px; border-radius: 14px; background: var(--pink-soft); border: 2px dashed var(--ink); }
.invite-maker .row { display: flex; gap: 8px; }
.invite-maker .row .input { flex: 1; min-width: 0; }

/* ---------- Footer: tiệm đóng cửa ---------- */
.closing {
  position: relative; margin-top: 40px; padding: 72px 0 140px; color: #f3e6cc; overflow: hidden;
  background: radial-gradient(ellipse at 50% 18%, #5b3f26 0%, #2a1d14 45%, var(--night) 75%);
  border-top: var(--bw) solid var(--ink);
}
.closing__bulb { position: absolute; left: 50%; top: 0; width: 2px; height: 70px; background: #111; transform: translateX(-50%); }
.closing__bulb::before { content: ""; position: absolute; left: 50%; bottom: -55px; width: 110px; height: 110px; border-radius: 50%; transform: translateX(-50%); background: radial-gradient(circle, rgba(255,205,100,.45), rgba(255,180,80,.14) 45%, transparent 72%); animation: bulb 5s ease-in-out infinite; }
.closing__bulb::after { content: ""; position: absolute; left: 50%; bottom: -26px; width: 34px; height: 34px; border-radius: 50%; transform: translateX(-50%); background: radial-gradient(circle at 40% 35%, #fffbe0, #ffd56a 55%, #e2a43a); }
@keyframes bulb { 50% { opacity: .65; } }
.closing .wrap { position: relative; display: grid; gap: 28px; justify-items: center; text-align: center; }
.closing__pig { width: min(240px, 60vw); margin-top: 30px; }
.closing__pig .pig__img { filter: drop-shadow(0 18px 14px rgba(0,0,0,.45)) brightness(.92); }
.zzz { position: absolute; right: 2%; top: 4%; font-family: var(--f-display); font-weight: 800; color: var(--gold-soft); font-size: 26px; animation: zzz 3s ease-in-out infinite; }
@keyframes zzz { 0% { opacity: 0; transform: translate(0, 10px) scale(.7); } 30% { opacity: 1; } 100% { opacity: 0; transform: translate(16px, -30px) scale(1.2); } }
.closing h2 { font-size: clamp(30px, 6.4vw, 48px); font-weight: 800; color: #fff3d6; }
.closing__lines { font-family: var(--f-hand); font-size: clamp(21px, 4.4vw, 26px); line-height: 1.5; max-width: 620px; }
.yourpig { display: grid; gap: 10px; justify-items: center; padding: 20px; border: 2px dashed rgba(255,230,180,.45); border-radius: var(--r-lg); max-width: 560px; }
.yourpig img { width: 92px; filter: grayscale(1) brightness(1.1) contrast(.9); opacity: .9; transition: filter .6s; }
.yourpig.has-coin img { filter: none; }
.yourpig p { margin: 0; }
.yourpig .count { font-family: var(--f-mono); font-size: 13px; color: var(--gold-soft); }
.faq { width: 100%; max-width: 720px; text-align: left; display: grid; gap: 10px; }
.faq details { border: 2px solid rgba(255,230,180,.35); border-radius: 14px; padding: 2px 16px; background: rgba(255,255,255,.04); }
.faq summary { cursor: pointer; padding: 12px 0; font-weight: 700; font-size: 16px; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-family: var(--f-display); font-size: 22px; line-height: 1; color: var(--gold-soft); }
.faq details[open] summary::after { content: "−"; }
.faq details p { color: #e2d3b6; font-size: 15.5px; }
.disclaimer { max-width: 680px; font-size: 13px; color: #bfae92; line-height: 1.6; }
.closing .btn { box-shadow: 3px 3px 0 #000; }

/* Băng cát-xét: bài hát của Cạch */
.song { width: 100%; max-width: 560px; display: grid; gap: 14px; justify-items: center; padding: 22px 18px; border-radius: var(--r-lg); background: rgba(255,255,255,.05); border: 2px solid rgba(255,230,180,.3); }
.cassette { width: min(300px, 100%); aspect-ratio: 1.6; border-radius: 14px; background: linear-gradient(#e9d2a6, #d6b57c); border: 3px solid #120c08; position: relative; display: flex; align-items: center; justify-content: space-around; padding: 0 12%; box-shadow: 0 8px 20px rgba(0,0,0,.4); }
.cassette::before { content: ""; position: absolute; left: 16%; right: 16%; top: 30%; height: 38%; border-radius: 30px; background: #2b2018; border: 2px solid #120c08; }
.cassette__label { position: absolute; left: 8%; right: 8%; top: 8%; text-align: center; font-family: var(--f-hand); font-size: 14px; color: #3b2a1c; background: #fff7e3; border-radius: 4px; padding: 1px 4px; }
.reel { position: relative; z-index: 1; width: 22%; aspect-ratio: 1; border-radius: 50%; background: repeating-conic-gradient(#f3e6cc 0 20deg, #6b5440 20deg 60deg); border: 3px solid #120c08; }
.song.playing .reel { animation: spin 1.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.song__intro { margin: 0; font-size: 16px; color: #e8d9bd; }
.song__intro b { color: #fff3d6; }
.lyrics { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 4px; font-family: var(--f-hand); font-size: clamp(16px, 4.3vw, 20px); line-height: 1.35; color: rgba(243,230,204,.6); }
.lyrics li { transition: color .3s, transform .3s; cursor: pointer; }
.lyrics li.on { color: var(--gold-soft); transform: scale(1.05); }

/* ---------- Heo mini đi dạo ---------- */
.roamer { position: fixed; left: 0; bottom: calc(6px + env(safe-area-inset-bottom)); z-index: 55; width: 56px; height: 56px; pointer-events: none; opacity: 0; transition: opacity .5s; will-change: transform; }
.roamer.show { opacity: 1; }
.roamer__lift { position: absolute; inset: 0; transition: transform .4s var(--ease-pop); }
.roamer.on-dock .roamer__lift { transform: translateY(-68px); }
.roamer__flip { position: absolute; inset: 0; }
.roamer.left .roamer__flip { transform: scaleX(-1); }
.roamer__pig {
  width: 100%; height: 100%; pointer-events: auto; cursor: pointer; touch-action: manipulation;
  background: url("../assets/img/pig/mini.webp") 0 0 / 500% 100% no-repeat;
  filter: drop-shadow(0 3px 2px rgba(60, 30, 10, .3)); transform-origin: 50% 100%;
}
.roamer.walking .roamer__pig { animation: roam-step .38s ease-in-out infinite; }
@keyframes roam-step { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-3px) rotate(2deg); } }
.roamer__pig.act-wave { animation: roam-wave .7s ease-in-out infinite; }
@keyframes roam-wave { 50% { transform: rotate(7deg); } }
.roamer__pig.act-fall { animation: roam-fall .45s ease-out; }
@keyframes roam-fall { 0% { transform: rotate(-26deg) translateY(-12px); } 60% { transform: scale(1.12, .84); } 100% { transform: none; } }
.roamer__pig.act-lie { animation: roam-lie .5s ease-out; }
@keyframes roam-lie { 0% { transform: rotate(40deg); } 100% { transform: none; } }
.roamer.sleeping .roamer__pig::after { content: "z z"; position: absolute; right: -2px; top: -8px; font-family: var(--f-display); font-weight: 800; font-size: 13px; color: var(--gold); animation: zzz 3s ease-in-out infinite; }
.roamer__say { position: absolute; bottom: calc(100% + 8px); left: 0; width: max-content; max-width: min(190px, 70vw); padding: 4px 10px; font-size: 16px; line-height: 1.2; border-radius: 12px; }
.roamer__say::after { left: 22px; bottom: -7px; width: 11px; height: 11px; }
.roamer.say-left .roamer__say { left: auto; right: 0; }
.roamer.say-left .roamer__say::after { left: auto; right: 12px; }

/* ---------- Dòng cảm ơn realtime ---------- */
.ticker {
  position: fixed; z-index: 58; left: 12px; top: calc(var(--topbar-h) + 10px);
  max-width: min(380px, calc(100% - 24px)); display: flex; align-items: center; gap: 10px;
  padding: 8px 8px 8px 10px; border: 2px solid var(--ink); border-radius: 16px; background: var(--paper);
  box-shadow: var(--shadow-sm); font-size: 14px; line-height: 1.35;
  opacity: 0; transform: translateY(-8px); transition: opacity .6s ease, transform .6s ease;
}
.ticker.show { opacity: 1; transform: none; }
.ticker.fresh { background: var(--gold-soft); }
.ticker__coin { width: 30px; height: 30px; flex: none; object-fit: contain; }
.ticker__txt { margin: 0; min-width: 0; }
.ticker__amt { color: var(--clay-deep); white-space: nowrap; }
.ticker__ago { color: var(--ink-soft); white-space: nowrap; }
.ticker__x { flex: none; width: 28px; height: 28px; border: 0; border-radius: 50%; background: transparent; font-size: 18px; line-height: 1; color: var(--ink-soft); }
.ticker__x:hover { background: var(--cream-2); }
.receipt .optin { display: flex; gap: 8px; align-items: center; margin-top: 6px; font-size: 12.5px; }
.receipt .optin input { width: auto; border: 0; margin: 0; }
.paywait { margin: 10px 0 0; padding: 8px 12px; border: 2px dashed var(--leaf); border-radius: 12px; font-size: 14px; color: var(--leaf); font-weight: 600; }

/* ---------- Doodles ---------- */
.doodle { position: absolute; pointer-events: none; opacity: .9; z-index: 0; }
.hero .doodle-1 { width: 54px; right: 3%; top: 38%; animation: floaty 6s ease-in-out infinite; }
.hero .doodle-2 { width: 40px; left: 46%; top: 4%; animation: floaty 7s ease-in-out -2s infinite; }
@media (max-width: 899px) { .hero .doodle { display: none; } }
@keyframes floaty { 50% { transform: translateY(-10px) rotate(8deg); } }

/* ---------- Tiếng heo ---------- */
.lang-pig .h2, .lang-pig h1 { letter-spacing: .01em; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
  .sfx { animation: none !important; opacity: 1; transform: translate(-50%, -50%); }
  .zzz { animation: none !important; opacity: 1; }
}
@media (max-width: 359px) {
  .brand { min-width: 0; overflow: hidden; font-size: 16px; gap: 6px; }
  .brand img { width: 24px; height: 29px; }
  .dock .btn { padding: 8px 12px; }
  .dock__pig { display: none; }
}
.chip { min-height: 44px; }
.hero__hint button, .your-pig { min-height: 44px; }
.range { min-height: 44px; }
.lcd__num { font-size: clamp(24px, 8.2vw, 46px); }
.more-snacks { display: none; }
@media (max-width: 420px) {
  .more-snacks { display: inline-flex; margin-bottom: 10px; }
  .board:not(.snacks-open) #itemsSnack { display: none; }
}
.board :focus-visible, .envelope :focus-visible, .closing :focus-visible, .twist :focus-visible { outline-color: var(--gold-soft); }
html:has(.dock.show) { scroll-padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
