/* ==========================================================================
   HEARTCHU 2027 — "Cork board" design system
   ไฟล์กลางไฟล์เดียวของทั้งเว็บ: สี ฟอนต์ ระยะ และชิ้นส่วนบอร์ดทั้งหมด
   ดูตัวอย่างทุกชิ้นได้ที่ styleguide.html

   สารบัญ
   1. Tokens (กลางวัน)        6. Board pieces (stamp, polaroid, ticket ...)
   2. Tokens (กลางคืน)        7. Buttons & form
   3. Base / typography        8. Navigation (top bar + bottom bar + sheet)
   4. Layout                   9. Feedback (toast, empty, skeleton)
   5. Cork texture            10. Utilities & motion
   ========================================================================== */

/* 1. Tokens — light ("board by day") ------------------------------------- */
:root {
  color-scheme: light;

  /* brand palette: ชมพูประจำตัวฮาร์ทเป็นสีเด่น, น้ำเงิน/เหลืองเป็นสีรองจากมู้ดบอร์ด */
  --c-pink: #ff8fab;          /* พื้นชมพูอ่อน + ตัวอักษรเข้ม (7.2:1) */
  --c-pink-deep: #d6336c;     /* ปุ่ม/สถานะที่เลือก + ตัวอักษรขาว (4.6:1) */
  --c-pink-shadow: #a8234f;
  --c-pink-soft: #ffe0ea;
  --c-pink-text: #c2255c;     /* ตัวอักษรชมพูบนกระดาษ (5.2:1) */
  --on-pink: #1f2430;
  --on-pink-deep: #ffffff;
  --c-blue: #1f4fa3;          /* fills: stamps, HELLO tag, strips */
  --c-blue-deep: #163a7a;
  --c-blue-soft: #dce6f7;
  --c-blue-text: #1f4fa3;     /* blue used as text on paper */
  --c-yellow: #f5c518;
  --c-yellow-deep: #d9a800;
  --c-yellow-soft: #fff2b3;
  --c-orange: #e8742a;
  --c-orange-text: #b4520f;
  --c-red: #c8402f;
  --c-green: #2f8a57;

  /* surfaces */
  --cork: #c79b6b;
  --cork-shade: #a97d4f;
  --cork-speck: rgba(92, 56, 24, 0.22);
  --cork-light: rgba(255, 238, 205, 0.35);
  --paper: #fbf6ea;
  --paper-2: #f3e9d4;
  --paper-line: #e3d6ba;
  --tape: rgba(244, 233, 205, 0.78);

  /* text */
  --ink: #1f2430;
  --ink-2: #4a4f5c;
  --ink-3: #6b6f7a;
  --on-blue: #ffffff;
  --on-yellow: #1f2430;

  /* elevation */
  --shadow-1: 0 1px 1px rgba(60, 35, 10, 0.18), 0 4px 10px rgba(60, 35, 10, 0.18);
  --shadow-2: 0 2px 3px rgba(60, 35, 10, 0.2), 0 12px 26px rgba(60, 35, 10, 0.26);
  --drop-1: drop-shadow(0 1px 1px rgba(60, 35, 10, 0.2)) drop-shadow(0 5px 8px rgba(60, 35, 10, 0.2));
  --focus: 0 0 0 3px var(--paper), 0 0 0 6px var(--c-pink-deep);

  /* type */
  --f-display: "Fraunces", "Prompt", Georgia, serif;   /* ละตินเป็นเซอริฟ ไทยตกไปใช้ Prompt */
  --f-head: "Prompt", system-ui, sans-serif;
  --f-body: "Prompt", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "Space Mono", "Prompt", ui-monospace, "SFMono-Regular", Menlo, monospace;   /* ตัวเลข/ละตินเป็น Space Mono — ภาษาไทยใช้ Prompt (Space Mono ไม่มีอักษรไทย) */

  --fs-display: clamp(2.5rem, 1.6rem + 4.2vw, 4rem);
  --fs-h1: clamp(2rem, 1.55rem + 2vw, 2.75rem);
  --fs-h2: clamp(1.5rem, 1.3rem + 0.9vw, 1.875rem);
  --fs-h3: clamp(1.1875rem, 1.12rem + 0.3vw, 1.375rem);
  --fs-body: 1rem;
  --fs-small: 0.875rem;
  --fs-caption: 0.75rem;
  --lh-body: 1.7;
  --lh-head: 1.25;

  /* spacing (4px scale) */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-8: 32px; --sp-10: 40px;
  --sp-12: 48px; --sp-16: 64px;

  /* radius */
  --r-sm: 8px; --r-md: 14px; --r-lg: 22px; --r-pill: 999px;

  /* layout */
  --content-max: 1120px;
  --gutter: 16px;
  --section-gap: var(--sp-12);
  --tabbar-h: 68px;
  --topbar-h: 64px;

  /* motion */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --t-fast: 140ms;
  --t-med: 260ms;
}

@media (min-width: 768px)  { :root { --gutter: 24px; --section-gap: 56px; } }
@media (min-width: 1280px) { :root { --gutter: 32px; --section-gap: var(--sp-16); } }

/* 2. Tokens — dark ("board at night") ------------------------------------
   ใช้ได้ทั้ง <html data-theme="dark"> (ปุ่มสลับ) และตามระบบเครื่องถ้ายังไม่เคยเลือก */
:root[data-theme="dark"] {
  color-scheme: dark;
  --c-pink: #ff9fbb;
  --c-pink-deep: #d6336c;
  --c-pink-shadow: #8e1c43;
  --c-pink-soft: #4a2533;
  --c-pink-text: #ff9fbb;
  --c-blue: #2c5cb8;
  --c-blue-deep: #1d3f82;
  --c-blue-soft: #1d2a44;
  --c-blue-text: #9cbaff;
  --c-yellow: #f2c230;
  --c-yellow-deep: #c99a00;
  --c-yellow-soft: #3d3418;
  --c-orange: #f08a43;
  --c-orange-text: #ffab70;
  --c-red: #ff8a7a;
  --c-green: #6fd39b;

  --cork: #4b3727;
  --cork-shade: #3a2a1d;
  --cork-speck: rgba(0, 0, 0, 0.35);
  --cork-light: rgba(255, 210, 150, 0.06);
  --paper: #2b2722;
  --paper-2: #23201c;
  --paper-line: #3f3931;
  --tape: rgba(210, 196, 160, 0.32);

  --ink: #f3ecdc;
  --ink-2: #d2c9b6;
  --ink-3: #aaa190;

  --shadow-1: 0 1px 1px rgba(0, 0, 0, 0.45), 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-2: 0 2px 4px rgba(0, 0, 0, 0.5), 0 14px 30px rgba(0, 0, 0, 0.55);
  --drop-1: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.5)) drop-shadow(0 6px 10px rgba(0, 0, 0, 0.45));
  --focus: 0 0 0 3px var(--paper), 0 0 0 6px var(--c-yellow);
}

/* 3. Base ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--f-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--ink);
  background-color: var(--cork);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;   /* clip (ไม่ใช่ hidden) — ไม่ทำให้ body กลายเป็นกล่องเลื่อน ซึ่งทำให้แถบบนไม่ติดและ iOS เลื่อนแปลก */
}
img, svg, video, canvas { display: block; max-width: 100%; height: auto; }
a { color: var(--c-blue-text); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-sm); }
::selection { background: var(--c-pink); color: var(--on-pink); }
[hidden] { display: none !important; }

h1, h2, h3, h4 { margin: 0 0 var(--sp-3); line-height: var(--lh-head); font-family: var(--f-head); font-weight: 600; text-wrap: balance; }
h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }
p { margin: 0 0 var(--sp-4); }
small, .t-small { font-size: var(--fs-small); }
.t-caption { font-size: var(--fs-caption); letter-spacing: 0.02em; }
.t-muted { color: var(--ink-3); }
.t-mono { font-family: var(--f-mono); letter-spacing: 0.02em; }
.t-display {
  font-family: var(--f-display);
  font-size: var(--fs-display);
  font-weight: 700;
  font-variation-settings: "SOFT" 100, "opsz" 96;
  line-height: 1.02;
  letter-spacing: -0.01em;
}
/* ตัว o กลายเป็นไอคอนกลมในหัวข้อ (เหมือนมู้ดบอร์ด) */
.o-icon {
  display: inline-grid; place-items: center;
  width: 0.78em; height: 0.78em; margin: 0 0.02em;
  border-radius: 50%; vertical-align: -0.04em;
  background: var(--c-pink-deep); color: #fff;
  font-size: 1em;
}
.o-icon > svg { width: 62%; height: 62%; }
.prose { max-width: 70ch; }

/* 4. Layout ---------------------------------------------------------------- */
.page {
  width: 100%;
  max-width: calc(var(--content-max) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: max(var(--gutter), env(safe-area-inset-left)) max(var(--gutter), env(safe-area-inset-right));
  padding-top: var(--sp-6);
  padding-bottom: calc(var(--tabbar-h) + var(--sp-10) + env(safe-area-inset-bottom));
}
@media (min-width: 1024px) {
  .page { padding-top: var(--sp-10); padding-bottom: var(--sp-16); }
}
.section { margin-top: var(--section-gap); }
.section:first-child { margin-top: 0; }
.section-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-6); }
.section-head > :last-child { margin-bottom: 0; }

.grid {
  display: grid;
  gap: var(--sp-5);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
}
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.grid--tight { gap: var(--sp-3); grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); }
.stack > * + * { margin-top: var(--sp-4); }
.cluster { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: center; }
.split { display: grid; gap: var(--sp-8); }
@media (min-width: 1024px) { .split { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); align-items: start; } }

.breadcrumb {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  margin: 0 0 var(--sp-4); padding: 2px 10px;
  font-size: var(--fs-caption); font-weight: 500;
  background: var(--paper); color: var(--ink-2);
  border-radius: var(--r-pill); box-shadow: var(--shadow-1);
}
.breadcrumb a { color: inherit; text-decoration: none; }
.breadcrumb a:hover { color: var(--c-blue-text); }

/* 5. Cork texture (ไม่มีรูป — วาดด้วย gradient + noise SVG) -------------- */
body {
  background-image:
    radial-gradient(circle at 20% 30%, var(--cork-speck) 0 1px, transparent 1.6px),
    radial-gradient(circle at 70% 65%, var(--cork-speck) 0 1.2px, transparent 1.8px),
    radial-gradient(circle at 45% 85%, var(--cork-light) 0 1.4px, transparent 2px),
    radial-gradient(circle at 85% 15%, var(--cork-speck) 0 0.8px, transparent 1.3px),
    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='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35  0 0 0 0 .22  0 0 0 0 .1  0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    radial-gradient(ellipse at 50% 0%, var(--cork-light), transparent 60%);
  background-size: 23px 19px, 31px 27px, 37px 41px, 17px 23px, 160px 160px, 100% 100%;
  background-attachment: scroll;
}
/* กรอบไม้รอบบอร์ด (ใช้กับ hero / หน้าเกม) */
.board-frame {
  border: 10px solid #8a5a2b;
  border-image: linear-gradient(135deg, #a26b35, #7a4c22 40%, #9a6431 70%, #6f431d) 1;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.25), inset 0 6px 18px rgba(0,0,0,.25);
}
:root[data-theme="dark"] .board-frame { border-image: linear-gradient(135deg, #5a3a1d, #3c2610 50%, #4d3218) 1; }

/* 6. Board pieces ---------------------------------------------------------- */

/* 6.1 Paper card — การ์ดกระดาษพื้นฐาน */
.card {
  position: relative;
  background: var(--paper);
  color: var(--ink);
  border-radius: var(--r-md);
  padding: var(--sp-5);
  box-shadow: var(--shadow-1);
}
.card--lined { background-image: repeating-linear-gradient(transparent 0 27px, var(--paper-line) 27px 28px); background-position: 0 14px; }
.card > :last-child { margin-bottom: 0; }

/* การ์ดลิงก์ — ยกขึ้นตอนชี้/แตะ */
a.card, .card--link {
  display: block; text-decoration: none; color: inherit;
  transition: transform var(--t-med) var(--ease-out), box-shadow var(--t-med) var(--ease-out);
}
@media (hover: hover) {
  a.card:hover, .card--link:hover { transform: translateY(-4px) rotate(var(--tilt, 0deg)); box-shadow: var(--shadow-2); }
  a.card:hover .tape, .card--link:hover .tape { transform: translateX(-50%) rotate(calc(var(--tape-tilt, -4deg) * 1.6)); }
}
a.card:active, .card--link:active { transform: translateY(-1px) scale(0.99); }

/* 6.2 Tilt — เอียงเป็นจังหวะ (เฉพาะของตกแต่ง/การ์ดลิงก์) */
.tilt { transform: rotate(var(--tilt, 0deg)); }
.tilt-l { --tilt: -1.5deg; } .tilt-r { --tilt: 1.5deg; }
.tilt-l2 { --tilt: -3deg; } .tilt-r2 { --tilt: 3deg; }
.grid-tilt > :nth-child(odd)  { --tilt: -1.2deg; }
.grid-tilt > :nth-child(even) { --tilt: 1.2deg; }
.grid-tilt > :nth-child(3n)   { --tilt: 0.4deg; }
.grid-tilt > * { transform: rotate(var(--tilt)); }
@media (max-width: 479px) { .tilt, .grid-tilt > * { --tilt: 0deg !important; } }

/* 6.3 Tape — เทปกาวแปะหัวการ์ด */
.tape {
  --tape-tilt: -4deg;
  position: absolute; top: -12px; left: 50%;
  width: 88px; height: 26px;
  transform: translateX(-50%) rotate(var(--tape-tilt));
  background: var(--tape);
  box-shadow: 0 1px 2px rgba(0,0,0,.12);
  -webkit-mask: conic-gradient(from -45deg at left, #0000 90deg, #000 0) left/51% 6px repeat-y,
                conic-gradient(from 135deg at right, #0000 90deg, #000 0) right/51% 6px repeat-y;
          mask: conic-gradient(from -45deg at left, #0000 90deg, #000 0) left/51% 6px repeat-y,
                conic-gradient(from 135deg at right, #0000 90deg, #000 0) right/51% 6px repeat-y;
  transition: transform var(--t-med) var(--ease-bounce);
  pointer-events: none;
}
.tape--blue { background: rgba(120, 160, 230, 0.6); }
.tape--yellow { background: rgba(245, 197, 24, 0.62); }
.tape--pink { background: rgba(255, 143, 171, 0.62); }
.tape--corner-l { left: 14px; top: -8px; transform: rotate(-38deg); width: 64px; }
.tape--corner-r { left: auto; right: -14px; top: 4px; transform: rotate(38deg); width: 64px; }

/* 6.4 Pin — หมุดกด */
.pin {
  position: absolute; top: 8px; left: 50%; translate: -50% 0;
  width: 16px; height: 16px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffffff99 0 2px, transparent 3px), var(--pin-c, var(--c-pink-deep));
  box-shadow: 0 2px 2px rgba(0,0,0,.35);
}

/* 6.5 Stamp — ตราไปรษณียากรขอบหยัก (ขอบวาดด้วย mask บน ::before เพื่อให้เงาตามรูปทรง) */
.stamp {
  --r: 5px; --s: 14px;
  --stamp-edge: var(--paper);
  position: relative; isolation: isolate;
  display: inline-block;
  padding: calc(var(--s) - var(--r));
  filter: var(--drop-1);
}
.stamp::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: var(--stamp-edge);
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    radial-gradient(circle var(--r), #0000 96%, #000) calc(var(--s) / -2) calc(var(--s) / -2) / var(--s) var(--s) round;
          mask:
    linear-gradient(#000 0 0) content-box,
    radial-gradient(circle var(--r), #0000 96%, #000) calc(var(--s) / -2) calc(var(--s) / -2) / var(--s) var(--s) round;
  padding: calc(var(--s) - var(--r));
}
.stamp--yellow { --stamp-edge: var(--c-yellow); }
.stamp--blue { --stamp-edge: var(--c-blue); }
.stamp--pink { --stamp-edge: var(--c-pink); }
.stamp__inner {
  display: grid; place-items: center; gap: var(--sp-2);
  min-width: 120px; min-height: 140px; padding: var(--sp-4);
  background: var(--c-blue); color: var(--on-blue);
  text-align: center;
}
.stamp__inner--paper { background: var(--paper-2); color: var(--ink); }
.stamp__inner--pink { background: var(--c-pink-deep); color: #fff; }
.stamp__value { font-family: var(--f-mono); font-weight: 700; font-size: 1.25rem; line-height: 1; }
.stamp--sm .stamp__inner { min-width: 72px; min-height: 84px; padding: var(--sp-2); }
.stamp--empty .stamp__inner { background: transparent; border: 2px dashed var(--paper-line); color: var(--ink-3); }
.stamp--empty { --stamp-edge: var(--paper-2); filter: none; opacity: .9; }

/* 6.6 Polaroid */
.polaroid {
  position: relative;
  display: block;
  background: #fffdf7;
  padding: 10px 10px 40px;
  box-shadow: var(--shadow-1);
  color: #1f2430;
}
:root[data-theme="dark"] .polaroid { background: #e9e2d2; }
.polaroid > img, .polaroid__img {
  width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--c-blue-soft);
}
.polaroid__caption {
  position: absolute; left: 10px; right: 10px; bottom: 8px;
  font-family: var(--f-head); font-size: var(--fs-small); text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* 6.7 Ticket — ตั๋วเหลืองมีรอยปรุ */
.ticket {
  --notch: 11px;
  position: relative;
  display: grid; grid-template-columns: 1fr auto;
  background: var(--c-yellow); color: var(--on-yellow);
  border-radius: var(--r-sm);
  filter: var(--drop-1);
  -webkit-mask:
    radial-gradient(circle var(--notch) at 0 50%, #0000 97%, #000) left / 51% 100% no-repeat,
    radial-gradient(circle var(--notch) at 100% 50%, #0000 97%, #000) right / 51% 100% no-repeat;
          mask:
    radial-gradient(circle var(--notch) at 0 50%, #0000 97%, #000) left / 51% 100% no-repeat,
    radial-gradient(circle var(--notch) at 100% 50%, #0000 97%, #000) right / 51% 100% no-repeat;
}
.ticket__main { padding: var(--sp-4) var(--sp-5) var(--sp-4) calc(var(--sp-5) + 4px); min-width: 0; }
.ticket__stub {
  display: grid; place-items: center; align-content: center; gap: 2px;
  padding: var(--sp-3) var(--sp-5) var(--sp-3) var(--sp-4);
  border-left: 2px dashed rgba(31, 36, 48, 0.45);
  font-family: var(--f-mono); text-align: center;
}
.ticket__label { font-family: var(--f-mono); font-size: var(--fs-caption); font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; opacity: .8; }
.ticket__title { font-family: var(--f-head); font-weight: 600; font-size: var(--fs-h3); line-height: 1.3; margin: 2px 0 4px; }
.ticket__big { font-size: 1.75rem; font-weight: 700; line-height: 1; }
.ticket--blue { background: var(--c-blue); color: var(--on-blue); }
.ticket--blue .ticket__stub { border-left-color: rgba(255,255,255,.5); }
.ticket--paper { background: var(--paper); color: var(--ink); }
.ticket--pink { background: var(--c-pink); color: var(--on-pink); }
.ticket--paper .ticket__stub { border-left-color: var(--paper-line); }
.ticket.is-past { filter: grayscale(.85) var(--drop-1); opacity: .78; }
/* ปั๊ม "เปิดอยู่" */
.ticket__status {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 1px 8px; border-radius: var(--r-pill);
  font-size: var(--fs-caption); font-weight: 600;
  background: rgba(31,36,48,.1);
}
.ticket__status.is-live { background: var(--c-pink-deep); color: #fff; }
.ticket__status.is-live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #7dffb0; animation: pulse 1.6s infinite; }

/* 6.8 Receipt — ใบเสร็จขอบล่างหยัก */
.receipt {
  --zig: 8px;
  position: relative;
  background: #fffdf6; color: #1f2430;
  font-family: var(--f-mono); font-size: var(--fs-small); line-height: 1.6;
  padding: var(--sp-5) var(--sp-5) calc(var(--sp-5) + var(--zig));
  filter: var(--drop-1);
  -webkit-mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / calc(var(--zig) * 2) 51% repeat-x,
                linear-gradient(#000 0 0) top / 100% calc(100% - var(--zig)) no-repeat;
          mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / calc(var(--zig) * 2) 51% repeat-x,
                linear-gradient(#000 0 0) top / 100% calc(100% - var(--zig)) no-repeat;
}
:root[data-theme="dark"] .receipt { background: #e9e2d2; }
.receipt__row { display: flex; justify-content: space-between; gap: var(--sp-3); }
.receipt__rule { border: 0; border-top: 1.5px dashed #9a958a; margin: var(--sp-3) 0; }
.receipt__total { font-weight: 700; font-size: 1rem; }

/* 6.9 HELLO my name is — ป้ายชื่อ */
.hello-tag {
  display: inline-flex; flex-direction: column;
  min-width: 200px;
  background: var(--c-blue); color: var(--on-blue);
  border-radius: var(--r-md);
  padding: var(--sp-2) var(--sp-2) var(--sp-4);
  text-align: center;
  box-shadow: var(--shadow-1);
}
.hello-tag__hello { font-family: var(--f-display); font-weight: 800; font-size: 1.6rem; line-height: 1.05; letter-spacing: 0.04em; font-variation-settings: "SOFT" 100; }
.hello-tag__sub { font-size: var(--fs-caption); font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; margin-bottom: var(--sp-2); }
.hello-tag__name {
  background: #ffffff; color: #1f2430;
  border-radius: var(--r-sm);
  padding: var(--sp-2) var(--sp-4);
  font-family: var(--f-head); font-weight: 600; font-size: 1.5rem; line-height: 1.3;
}

/* 6.10 Sticker — สติกเกอร์ขอบขาว */
.sticker {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 6px 14px;
  background: var(--sticker-bg, var(--c-yellow)); color: var(--sticker-fg, var(--on-yellow));
  border: 3px solid #ffffff;
  border-radius: var(--r-pill);
  font-weight: 600; font-size: var(--fs-small); line-height: 1.3;
  box-shadow: var(--shadow-1);
}
:root[data-theme="dark"] .sticker { border-color: #f3ecdc; }
.sticker--blue { --sticker-bg: var(--c-blue); --sticker-fg: var(--on-blue); }
.sticker--pink { --sticker-bg: var(--c-pink); --sticker-fg: var(--on-pink); }
.sticker--paper { --sticker-bg: var(--paper); --sticker-fg: var(--ink); }
.sticker--round { width: 64px; height: 64px; padding: 0; border-radius: 50%; }
.sticker--square { border-radius: var(--r-sm); }

/* หน้ายิ้มเหลือง */
.smiley { width: 44px; height: 44px; flex: none; }

/* 6.11 Band-aid — พลาสเตอร์ */
.bandaid {
  display: inline-grid; grid-template-columns: 1fr 1.1fr 1fr; align-items: center;
  width: 120px; height: 34px;
  border-radius: var(--r-pill);
  background: #8fb2ea;
  background-image: radial-gradient(circle, rgba(255,255,255,.55) 1.2px, transparent 1.8px);
  background-size: 7px 7px;
  box-shadow: var(--shadow-1);
}
.bandaid::before { content: ""; grid-column: 2; height: 70%; border-radius: 4px; background: #b9cff2; }

/* 6.12 Checker — ลายหมากรุก */
.checker {
  --ck: 22px;
  background: conic-gradient(var(--c-blue) 25%, var(--c-yellow) 0 50%, var(--c-blue) 0 75%, var(--c-yellow) 0) 0 0 / calc(var(--ck) * 2) calc(var(--ck) * 2);
}
.checker--pink { background: conic-gradient(var(--c-pink) 25%, #fff6f8 0 50%, var(--c-pink) 0 75%, #fff6f8 0) 0 0 / calc(var(--ck) * 2) calc(var(--ck) * 2); }
.checker-strip { height: 22px; --ck: 11px; }

/* 6.13 Label strip — ข้อความบนแถบสี */
.label-strip {
  display: inline;
  padding: 0.1em 0.45em;
  background: var(--c-blue); color: var(--on-blue);
  font-family: var(--f-head); font-weight: 500;
  line-height: 1.75;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
.label-strip--yellow { background: var(--c-yellow); color: var(--on-yellow); }
.label-strip--pink { background: var(--c-pink); color: var(--on-pink); }
.label-strip--paper { background: var(--paper); color: var(--ink); }

/* 6.14 Chat bubble (OMG) */
.bubble {
  position: relative; display: inline-block;
  padding: 6px 16px; border-radius: 18px;
  background: #2f80ed; color: #fff; font-weight: 600;
}
.bubble::after { content: ""; position: absolute; left: 12px; bottom: -6px; width: 14px; height: 14px; background: inherit; border-bottom-right-radius: 14px; transform: skewX(-20deg); z-index: -1; }

/* 6.15 Coin chip & counters */
.coin {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 12px 3px 4px;
  border-radius: var(--r-pill);
  background: var(--paper); color: var(--ink); box-shadow: var(--shadow-1);
  font-family: var(--f-mono); font-weight: 700;
}
.coin::before {
  content: "c"; display: grid; place-items: center;
  width: 24px; height: 24px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff6c9, var(--c-yellow) 55%, var(--c-yellow-deep));
  color: #7a5800; font-size: 13px; font-weight: 700; box-shadow: inset 0 0 0 2px #e0b000;
}

/* 7. Buttons & form -------------------------------------------------------- */
.btn {
  --btn-bg: var(--c-pink-deep); --btn-fg: var(--on-pink-deep); --btn-shadow: var(--c-pink-shadow);
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: 44px; padding: 10px 20px;
  border: 0; border-radius: var(--r-pill);
  background: var(--btn-bg); color: var(--btn-fg);
  font: 600 var(--fs-body)/1.2 var(--f-body);
  text-decoration: none; cursor: pointer;
  box-shadow: 0 3px 0 var(--btn-shadow);
  transition: transform var(--t-fast) var(--ease-out), box-shadow var(--t-fast) var(--ease-out), filter var(--t-fast);
  -webkit-tap-highlight-color: transparent;
}
@media (hover: hover) { .btn:hover { filter: brightness(1.07); text-decoration: none; } }
.btn:active { transform: translateY(3px); box-shadow: 0 0 0 var(--btn-shadow); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; }
.btn--blue { --btn-bg: var(--c-blue); --btn-fg: var(--on-blue); --btn-shadow: var(--c-blue-deep); }
.btn--yellow { --btn-bg: var(--c-yellow); --btn-fg: var(--on-yellow); --btn-shadow: var(--c-yellow-deep); }
.btn--paper { --btn-bg: var(--paper); --btn-fg: var(--ink); --btn-shadow: var(--paper-line); }
.btn--ghost { --btn-bg: transparent; --btn-fg: var(--ink); --btn-shadow: transparent; box-shadow: inset 0 0 0 2px currentColor; }
.btn--danger { --btn-bg: var(--c-red); --btn-fg: #fff; --btn-shadow: #8e2a1e; }
.btn--sm { min-height: 36px; padding: 6px 14px; font-size: var(--fs-small); }
.btn--block { width: 100%; }
.btn i, .btn svg { font-size: 1.15em; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 44px; height: 44px; border: 0; border-radius: 50%;
  background: var(--paper); color: var(--ink); box-shadow: var(--shadow-1);
  font-size: 1.25rem; cursor: pointer;
}

.field { display: grid; gap: 6px; }
.field__label { font-weight: 600; font-size: var(--fs-small); }
.field__hint { font-size: var(--fs-caption); color: var(--ink-3); }
.input, .select, .textarea {
  width: 100%; min-height: 46px;
  padding: 10px 14px;
  border: 2px solid var(--paper-line); border-radius: var(--r-sm);
  background: var(--paper); color: var(--ink);
  font: 400 16px/1.4 var(--f-body);   /* 16px กัน iOS ซูม */
}
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--c-pink-deep); box-shadow: 0 0 0 3px var(--c-pink-soft); }
.input--code { font-family: var(--f-mono); text-transform: uppercase; letter-spacing: 0.18em; text-align: center; font-weight: 700; }

/* segmented (TH|EN, ☀|☾, แท็บ) */
.seg {
  display: inline-flex; padding: 3px; gap: 2px;
  background: var(--paper); border-radius: var(--r-pill); box-shadow: var(--shadow-1);
}
.seg button {
  min-width: 40px; min-height: 34px; padding: 4px 10px;
  border: 0; border-radius: var(--r-pill);
  background: transparent; color: var(--ink-2);
  font: 600 var(--fs-small)/1 var(--f-body); cursor: pointer;
}
.seg button[aria-pressed="true"], .seg button[aria-selected="true"] { background: var(--c-pink-deep); color: var(--on-pink-deep); }

/* tabs (ตู้เสื้อผ้า) */
.tabs { display: flex; gap: var(--sp-2); overflow-x: auto; scrollbar-width: none; padding: 4px; margin: -4px; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none; min-height: 40px; padding: 6px 16px;
  border: 0; border-radius: var(--r-pill);
  background: var(--paper-2); color: var(--ink-2);
  font: 600 var(--fs-small)/1 var(--f-body); cursor: pointer;
}
.tab[aria-selected="true"] { background: var(--c-pink); color: var(--on-pink); box-shadow: var(--shadow-1); }

/* 8. Navigation -----------------------------------------------------------
   มือถือ/แท็บเล็ตเล็ก (<1024): แถบบนบาง + แถบล่าง 5 ช่อง + แผ่นเมนูเลื่อนขึ้น
   iPad แนวนอน/คอม (≥1024): แถบบนเต็ม + dropdown ตามกลุ่ม                */
.skip-link { position: absolute; left: 8px; top: -60px; z-index: 100; padding: 8px 14px; background: var(--c-yellow); color: var(--on-yellow); border-radius: var(--r-sm); font-weight: 600; }
.skip-link:focus { top: 8px; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  padding-top: env(safe-area-inset-top);
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(10px); backdrop-filter: saturate(1.4) blur(10px);
  box-shadow: 0 1px 0 var(--paper-line), 0 4px 14px rgba(40, 20, 0, .12);
}
.topbar__inner {
  display: flex; align-items: center; gap: var(--sp-3);
  max-width: calc(var(--content-max) + 2 * var(--gutter));
  min-height: 56px;
  margin-inline: auto;
  padding-inline: max(var(--gutter), env(safe-area-inset-left)) max(var(--gutter), env(safe-area-inset-right));
}
.brand {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  color: var(--ink); text-decoration: none;
  font-family: var(--f-display); font-weight: 700; font-size: 1.25rem; letter-spacing: -0.01em;
  font-variation-settings: "SOFT" 100;
  white-space: nowrap;
}
.brand__mark {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px;
  background: var(--c-pink-deep); color: #fff; box-shadow: inset 0 0 0 2px rgba(0,0,0,.06);
}
.brand__mark svg { width: 20px; height: 20px; }
.brand__land { color: var(--c-pink-text); }
.brand__year { font-family: var(--f-mono); font-size: .75rem; font-weight: 700; color: var(--c-pink-text); align-self: start; margin-top: 2px; }
@media (max-width: 419px) { .brand__year { display: none; } }
.topbar__spacer { flex: 1; }
.topbar__tools { display: flex; align-items: center; gap: var(--sp-2); }
.topbar__tools .seg button { min-width: 36px; min-height: 30px; }

/* desktop menu */
.mainnav { display: none; }
@media (min-width: 1024px) {
  .topbar__inner { min-height: var(--topbar-h); gap: var(--sp-4); }
  .mainnav { display: flex; align-items: center; gap: var(--sp-1); }
}
.mainnav__item { position: relative; }
.mainnav__link, .mainnav__group {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 40px; padding: 6px 12px;
  border: 0; border-radius: var(--r-pill);
  background: transparent; color: var(--ink);
  font: 500 0.9375rem/1 var(--f-body); text-decoration: none; cursor: pointer;
}
.mainnav__link:hover, .mainnav__group:hover, .mainnav__group[aria-expanded="true"] { background: var(--paper-2); text-decoration: none; }
.mainnav__link[aria-current="page"], .mainnav__item.is-current > .mainnav__group { background: var(--c-pink-soft); color: var(--c-pink-text); }
.mainnav__group .ph-caret-down { font-size: .8em; transition: transform var(--t-fast); }
.mainnav__group[aria-expanded="true"] .ph-caret-down { transform: rotate(180deg); }
.dropdown {
  position: absolute; top: calc(100% + 8px); left: 0;
  min-width: 240px; padding: var(--sp-2);
  background: var(--paper); border-radius: var(--r-md); box-shadow: var(--shadow-2);
  transform-origin: top left;
  animation: pop-in var(--t-med) var(--ease-out);
}
.dropdown a {
  display: grid; grid-template-columns: 36px 1fr; align-items: center; gap: var(--sp-3);
  padding: 8px 10px; border-radius: var(--r-sm);
  color: var(--ink); text-decoration: none;
}
.dropdown a:hover { background: var(--paper-2); }
.dropdown a[aria-current="page"] { background: var(--c-pink-soft); }
.dropdown__icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--c-pink-soft); color: var(--c-pink-text); font-size: 1.2rem; }
.dropdown__title { font-weight: 600; font-size: .9375rem; line-height: 1.3; }
.dropdown__desc { font-size: var(--fs-caption); color: var(--ink-3); line-height: 1.3; }

/* ปุ่มตั๋วโปรเจค (บนแถบบน) */
.nav-ticket {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 40px; padding: 6px 18px;
  background: var(--c-yellow); color: var(--on-yellow);
  font: 700 0.9375rem/1 var(--f-body); text-decoration: none;
  border-radius: 6px;
  -webkit-mask: radial-gradient(circle 7px at 0 50%, #0000 97%, #000) left/51% 100% no-repeat, radial-gradient(circle 7px at 100% 50%, #0000 97%, #000) right/51% 100% no-repeat;
          mask: radial-gradient(circle 7px at 0 50%, #0000 97%, #000) left/51% 100% no-repeat, radial-gradient(circle 7px at 100% 50%, #0000 97%, #000) right/51% 100% no-repeat;
  transition: transform var(--t-fast) var(--ease-bounce);
}
.nav-ticket:hover { transform: rotate(-2deg) scale(1.03); text-decoration: none; }
.nav-ticket[aria-current="page"] { background: var(--c-pink-deep); color: #fff; }
@media (max-width: 1023px) { .topbar .nav-ticket { display: none; } }

/* mobile bottom bar */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: end;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding: 0 max(6px, env(safe-area-inset-left)) env(safe-area-inset-bottom) max(6px, env(safe-area-inset-right));
  background: color-mix(in srgb, var(--paper) 95%, transparent);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  box-shadow: 0 -1px 0 var(--paper-line), 0 -6px 18px rgba(40, 20, 0, .14);
}
@media (min-width: 1024px) { .tabbar { display: none; } }
.tabbar__btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  height: var(--tabbar-h); min-width: 44px;
  border: 0; background: transparent; color: var(--ink-3);
  font: 500 0.6875rem/1.2 var(--f-body); text-decoration: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.tabbar__btn i { font-size: 1.5rem; }
.tabbar__btn[aria-current="page"], .tabbar__btn.is-current { color: var(--c-pink-text); font-weight: 700; }
.tabbar__btn[aria-expanded="true"] { color: var(--c-pink-text); }
/* ช่องกลาง — ตั๋วลอยยกสูง */
.tabbar__ticket { position: relative; }
.tabbar__ticket .tabbar__ticket-face {
  display: grid; place-items: center; gap: 0;
  width: 64px; height: 54px; margin-top: -22px;
  background: var(--c-yellow); color: var(--on-yellow);
  border-radius: 10px;
  box-shadow: 0 4px 0 var(--c-yellow-deep), var(--shadow-2);
  font-family: var(--f-mono); font-weight: 700; font-size: .7rem; line-height: 1;
  transform: rotate(-4deg);
  transition: transform var(--t-med) var(--ease-bounce);
}
.tabbar__ticket .tabbar__ticket-face i { font-size: 1.45rem; }
.tabbar__ticket:active .tabbar__ticket-face { transform: rotate(0) translateY(3px); box-shadow: 0 1px 0 var(--c-yellow-deep), var(--shadow-1); }
.tabbar__ticket[aria-current="page"] .tabbar__ticket-face { background: var(--c-pink-deep); color: #fff; box-shadow: 0 4px 0 var(--c-pink-shadow), var(--shadow-2); }
.tabbar__ticket .tabbar__label { margin-top: 4px; }

/* bottom sheet */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(20, 12, 4, .45);
  animation: fade-in var(--t-med) ease;
}
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 51;
  max-height: 85dvh; overflow-y: auto; overscroll-behavior: contain;
  padding: var(--sp-3) max(var(--gutter), env(safe-area-inset-left)) calc(var(--sp-6) + env(safe-area-inset-bottom)) max(var(--gutter), env(safe-area-inset-right));
  background: var(--paper);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  box-shadow: 0 -10px 30px rgba(0,0,0,.25);
  animation: sheet-up var(--t-med) var(--ease-out);
}
.sheet__grip { width: 44px; height: 5px; margin: 0 auto var(--sp-4); border-radius: 3px; background: var(--paper-line); }
.sheet__title { font-family: var(--f-head); font-size: var(--fs-h3); margin-bottom: var(--sp-3); }
.sheet__list { display: grid; gap: var(--sp-2); }
.sheet__list a {
  display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: var(--sp-3);
  min-height: 60px; padding: 8px 12px;
  border-radius: var(--r-md); background: var(--paper-2); color: var(--ink); text-decoration: none;
}
.sheet__list a[aria-current="page"] { background: var(--c-pink-soft); box-shadow: inset 0 0 0 2px var(--c-pink-deep); }
.sheet__list .dropdown__icon { width: 44px; height: 44px; }
.sheet__tools { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: center; justify-content: space-between; margin-top: var(--sp-5); padding-top: var(--sp-4); border-top: 1px dashed var(--paper-line); }
@media (min-width: 640px) { .sheet { left: 50%; right: auto; width: min(560px, 100%); translate: -50% 0; } }

/* in-app browser hint (X / LINE / IG) */
.inapp-hint {
  display: flex; gap: var(--sp-3); align-items: center;
  padding: 10px var(--gutter);
  background: var(--c-yellow); color: var(--on-yellow);
  font-size: var(--fs-small); font-weight: 500;
}
.inapp-hint button { margin-left: auto; }

/* footer */
.site-footer {
  margin-top: var(--section-gap);
  text-align: center; color: var(--ink);
  font-size: var(--fs-small);
}
.site-footer .label-strip { line-height: 2; }

/* 9. Feedback -------------------------------------------------------------- */
.toast-wrap {
  position: fixed; z-index: 60; left: 50%; translate: -50% 0;
  bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom));
  display: grid; gap: var(--sp-2); width: min(92vw, 380px); pointer-events: none;
}
@media (min-width: 1024px) { .toast-wrap { left: auto; right: 24px; translate: 0; bottom: 24px; } }
.toast {
  pointer-events: auto;
  display: flex; gap: var(--sp-3); align-items: center;
  padding: 12px 16px;
  background: var(--paper); color: var(--ink);
  border: 3px solid #fff; border-radius: var(--r-md);
  box-shadow: var(--shadow-2);
  font-weight: 500;
  animation: sticker-in 420ms var(--ease-bounce);
}
:root[data-theme="dark"] .toast { border-color: var(--paper-line); }
.toast--ok { border-left: 8px solid var(--c-green); }
.toast--err { border-left: 8px solid var(--c-red); }

.empty {
  display: grid; justify-items: center; gap: var(--sp-3);
  padding: var(--sp-8) var(--sp-5);
  text-align: center; color: var(--ink-2);
}
.empty__note {
  position: relative;
  max-width: 280px; padding: var(--sp-6) var(--sp-5) var(--sp-5);
  background: var(--c-yellow-soft); color: var(--ink);
  font-family: var(--f-head);
  box-shadow: var(--shadow-1);
  transform: rotate(-2deg);
}
:root[data-theme="dark"] .empty__note { background: #4a4120; }

.skeleton {
  border-radius: var(--r-sm);
  background: linear-gradient(90deg, var(--paper-2) 0 40%, var(--paper) 50%, var(--paper-2) 60% 100%) 0 0 / 300% 100%;
  animation: shimmer 1.4s linear infinite;
  min-height: 1em;
}

/* 10. Utilities & motion -------------------------------------------------- */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.center { text-align: center; }
.mt-0 { margin-top: 0 !important; } .mb-0 { margin-bottom: 0 !important; }
.mt-4 { margin-top: var(--sp-4); } .mt-6 { margin-top: var(--sp-6); } .mt-8 { margin-top: var(--sp-8); }
.only-desktop { display: none; }
@media (min-width: 1024px) { .only-desktop { display: revert; } .only-mobile { display: none !important; } }

@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .45; transform: scale(.75); } }
@keyframes pop-in { from { opacity: 0; transform: translateY(-6px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes sheet-up { from { transform: translateY(100%); } }
@keyframes shimmer { to { background-position: -150% 0; } }
@keyframes sticker-in { 0% { opacity: 0; transform: scale(.6) rotate(-8deg); } 100% { opacity: 1; transform: none; } }
@keyframes stamp-press { 0% { transform: scale(1.8) rotate(-14deg); opacity: 0; } 60% { transform: scale(.94) rotate(2deg); opacity: 1; } 100% { transform: scale(1) rotate(0); } }
@keyframes wobble { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(-7deg); } 40% { transform: rotate(6deg); } 60% { transform: rotate(-4deg); } 80% { transform: rotate(2deg); } }
@keyframes coin-bounce { 0% { transform: translateY(0); } 35% { transform: translateY(-14px) scale(1.1); } 70% { transform: translateY(0) scale(.96); } 100% { transform: none; } }
.anim-stamp { animation: stamp-press 520ms var(--ease-out) both; }
.anim-wobble { animation: wobble 900ms ease-in-out infinite; transform-origin: 50% 85%; }
.anim-coin { animation: coin-bounce 600ms var(--ease-bounce); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; scroll-behavior: auto !important; }
  .grid-tilt > *, .tilt { --tilt: 0deg !important; }
}
/* เมนูไม่ตัดบรรทัด; จอ 1024–1279 (iPad แนวนอน/โน้ตบุ๊กเล็ก) ซ่อนไอคอนเมนูให้พอดีแถว */
.mainnav__link, .mainnav__group, .nav-ticket, .brand { white-space: nowrap; }
@media (min-width: 1024px) and (max-width: 1279px) {
  .mainnav__link > .ph:first-child, .mainnav__group > .ph:first-child { display: none; }
  .mainnav__link, .mainnav__group { padding-inline: 10px; }
  .topbar__inner { gap: var(--sp-2); }
}
/* มือถือจอแคบ (≤419px): โลโก้ + TH/EN + ปุ่มกลางคืน ต้องพอดีแถวเดียวที่ 360px */
@media (max-width: 419px) {
  .topbar__inner { gap: var(--sp-2); }
  .brand { font-size: .98rem; gap: 6px; min-width: 0; overflow: hidden; }
  .brand__mark { width: 28px; height: 28px; flex: none; }
  .topbar__tools { gap: 6px; flex: none; }
  .topbar__tools .seg { padding: 2px; }
  .topbar__tools .seg button { min-width: 32px; padding-inline: 6px; }
  .topbar__tools .icon-btn { width: 40px; height: 40px; }
}

/* 11. Page components (ใช้ร่วมทุกหน้า) ------------------------------------- */

/* หัวหน้าเพจมาตรฐาน: breadcrumb + หัวข้อ + คำอธิบาย */
.page-head { margin-bottom: var(--sp-8); }
.page-head__title { font-size: var(--fs-h1); margin: 0 0 var(--sp-3); }
.page-head__lead { margin: 0; max-width: 60ch; }
.page-head__lead .label-strip { line-height: 1.9; }

/* modal (กระดาษแผ่นใหญ่กลางจอ / แผ่นล่างบนมือถือ) */
.modal {
  position: fixed; inset: 0; z-index: 70;
  display: grid; place-items: end center;
  padding: 0;
  background: rgba(20, 12, 4, .5);
  animation: fade-in var(--t-med) ease;
}
.modal[hidden] { display: none; }
.modal__box {
  position: relative;
  width: 100%; max-height: 90dvh; overflow-y: auto; overscroll-behavior: contain;
  padding: var(--sp-6) var(--sp-5) calc(var(--sp-6) + env(safe-area-inset-bottom));
  background: var(--paper); color: var(--ink);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  box-shadow: var(--shadow-2);
  animation: sheet-up var(--t-med) var(--ease-out);
}
.modal__box--wide { max-width: 860px; }
.modal__close { position: absolute; top: 10px; right: 10px; }
@media (min-width: 640px) {
  .modal { place-items: center; padding: var(--sp-6); }
  .modal__box { max-width: 560px; border-radius: var(--r-lg); padding: var(--sp-8); animation: pop-in var(--t-med) var(--ease-out); }
  .modal__box--wide { max-width: 860px; }
}

/* accordion (ใช้ <details class="acc">) */
.acc { background: var(--paper); border-radius: var(--r-md); box-shadow: var(--shadow-1); }
.acc + .acc { margin-top: var(--sp-3); }
.acc > summary {
  display: flex; align-items: center; gap: var(--sp-3);
  min-height: 52px; padding: 0 var(--sp-4); cursor: pointer; list-style: none;
  font-weight: 600;
}
.acc > summary::-webkit-details-marker { display: none; }
.acc > summary::after { content: ""; margin-left: auto; width: 10px; height: 10px; border-right: 2.5px solid var(--c-pink-text); border-bottom: 2.5px solid var(--c-pink-text); transform: rotate(45deg) translate(-2px, -2px); transition: transform var(--t-fast); }
.acc[open] > summary::after { transform: rotate(-135deg) translate(-2px, -2px); }
.acc__body { padding: 0 var(--sp-4) var(--sp-4); }
.acc--year > summary { font-family: var(--f-display); font-size: var(--fs-h3); }
.acc .acc { box-shadow: none; background: var(--paper-2); }

/* progress */
.progress { height: 14px; border-radius: var(--r-pill); background: var(--paper-2); box-shadow: inset 0 1px 2px rgba(0,0,0,.15); overflow: hidden; }
.progress > span { display: block; height: 100%; width: 0; border-radius: inherit; background: repeating-linear-gradient(-45deg, var(--c-pink-deep) 0 8px, var(--c-pink) 8px 16px); transition: width 1s var(--ease-out); }

/* แถบค้นหา/กรอง */
.filterbar { display: grid; gap: var(--sp-3); grid-template-columns: 1fr; margin-bottom: var(--sp-5); }
@media (min-width: 640px) { .filterbar { grid-template-columns: 1fr 220px; } }
.input--search { padding-left: 42px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b6f7a' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: 14px center; background-size: 18px; }

/* chip (ป้ายหมวด/แท็ก) */
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 10px; border-radius: var(--r-pill); background: var(--c-pink-soft); color: var(--c-pink-text); font-size: var(--fs-caption); font-weight: 600; line-height: 1.7; white-space: nowrap; }
.chip--blue { background: var(--c-blue-soft); color: var(--c-blue-text); }
.chip--yellow { background: var(--c-yellow-soft); color: var(--ink); }
.chip--paper { background: var(--paper-2); color: var(--ink-2); }

/* รายการแบบแถว (งาน/สถิติ/สตรีม) */
.row-item {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--sp-3); align-items: center;
  padding: var(--sp-3) var(--sp-4);
  background: var(--paper); color: var(--ink); text-decoration: none;
  border-radius: var(--r-md); box-shadow: var(--shadow-1);
  border: 0; width: 100%; text-align: left; font: inherit; cursor: pointer;
  transition: transform var(--t-fast) var(--ease-out);
}
.row-item + .row-item { margin-top: var(--sp-2); }
@media (hover: hover) { .row-item:hover { transform: translateY(-2px); } }
.row-item__title { font-weight: 600; line-height: 1.4; }
.row-item__meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 4px; font-size: var(--fs-caption); color: var(--ink-3); }
.row-item__num { font-family: var(--f-mono); font-weight: 700; font-size: 1.125rem; color: var(--c-pink-text); text-align: right; line-height: 1.1; }
.row-item__num small { display: block; font-size: 10px; color: var(--ink-3); letter-spacing: .08em; }

/* วิดีโอ/รูปอัตราส่วนคงที่ */
.ratio { position: relative; aspect-ratio: var(--ratio, 16 / 9); overflow: hidden; border-radius: var(--r-sm); background: var(--paper-2); }
.ratio > iframe, .ratio > img, .ratio > video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; object-fit: cover; }
/* กระดาษที่ "ยังเป็นสีครีม" แม้ในโหมดกลางคืน (ใบเสร็จ โพลารอยด์ ป้ายชื่อขาว) — ใช้สีข้อความแบบกลางวันข้างใน */
:root[data-theme="dark"] :is(.receipt, .polaroid, .hello-tag__name) {
  --ink: #1f2430; --ink-2: #4a4f5c; --ink-3: #6b6f7a;
  --c-pink-text: #c2255c; --c-blue-text: #1f4fa3;
  --paper-line: #c9bfa8;
}

/* 12. การตัดบรรทัด + แถบเลื่อนแนวนอน ------------------------------------- */
/* หัวข้อ/คำโปรยแบ่งบรรทัดให้ยาวเท่าๆ กัน ไม่เหลือคำเดียวโด่ๆ; ย่อหน้าไม่ให้เหลือคำท้ายบรรทัดเดียว */
h1, h2, h3, .page-head__lead, .hero__lead, .ticket__title, .label-strip { text-wrap: balance; }
p, li, .row-item__title, .dropdown__desc { text-wrap: pretty; }
/* .nb = วลีที่ห้ามตัดกลาง เช่น <span class="nb">ฮาร์ท ชุติวัฒน์</span> */
.nb { white-space: nowrap; }
/* คำโปรยใต้หัวข้อ: สั้น 1 บรรทัดบนมือถือ (ส่วนขยายใส่ใน .lead-more ซ่อนบนจอเล็ก) */
@media (max-width: 599px) { .lead-more { display: none; } }

/* .rail = การ์ดเรียงแนวนอนปัดได้บนมือถือ (แทนการเรียงยาวลงล่าง) — จอกว้างกลับเป็นกริด */
.rail {
  display: grid; grid-auto-flow: column; grid-auto-columns: var(--rail-w, 78%);
  gap: var(--sp-4);
  overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scrollbar-width: none;
  margin-inline: calc(var(--gutter) * -1);
  padding: var(--sp-3) var(--gutter) var(--sp-4);
  scroll-padding-inline: var(--gutter);
}
.rail::-webkit-scrollbar { display: none; }
.rail > * { scroll-snap-align: start; min-width: 0; }
@media (min-width: 768px) {
  .rail { grid-auto-flow: row; grid-auto-columns: auto; grid-template-columns: repeat(auto-fill, minmax(var(--rail-min, 240px), 1fr)); overflow: visible; margin-inline: 0; padding-inline: 0; }
}
/* ตัวบอกว่าปัดได้ (จุดใต้ rail) */
.rail-hint { display: flex; justify-content: center; gap: 6px; margin-top: calc(var(--sp-2) * -1); font-size: var(--fs-caption); color: var(--ink); opacity: .75; }
@media (min-width: 768px) { .rail-hint { display: none; } }

/* ปุ่ม "ดูเพิ่ม" มาตรฐาน */
.more-wrap { display: flex; justify-content: center; margin-top: var(--sp-5); }

/* แถบโหลดบางๆ ใต้เมนู ระหว่างบันทึก/ดึงข้อมูล: <html class="is-busy"> */
html.is-busy body::after {
  content: ""; position: fixed; z-index: 80; left: 0; right: 0; top: calc(56px + env(safe-area-inset-top)); height: 3px;
  background: linear-gradient(90deg, transparent, var(--c-pink-deep), transparent) 0 0 / 40% 100% no-repeat;
  animation: busy-bar 1s linear infinite;
}
@media (min-width: 1024px) { html.is-busy body::after { top: var(--topbar-h); } }
html.is-busy { cursor: progress; }
@keyframes busy-bar { from { background-position: -40% 0; } to { background-position: 140% 0; } }
