/* Moonpuff demo — styles.
   Senior-friendly: all type in rem; <html> font-size = 16px × --fs (เล็ก .83 / กลาง 1 / ใหญ่ 1.15 / ใหญ่มาก 1.3). One font: Anuphan.
   Secondary text uses max(14px, 1rem) so nothing drops under 14px at เล็ก.
   Body 1.125rem (18px), secondary ≥ 1rem (16px). Tap targets ≥ 48px. 8pt spacing grid. */
@font-face { font-family: "Anuphan"; src: url("../assets/fonts/Anuphan-Variable.woff2") format("woff2"); font-weight: 100 700; font-display: swap; }

:root {
  --fs: 1;
  --bg: #0E1838; --bg2: #0B1330; --surface: #18234F; --surface2: #222E63; --line: rgba(221, 224, 245, .22);
  --text: #F6F3FF; --muted: #D3D6F0; --faint: #B9BEE2;
  --accent: #FFD27A; --accent-ink: #1A1633; --star: #FFF3C4; --violet: #C7BCF5; --ok: #9BE8BF; --warn: #FFB28A;
  --r-sm: 12px; --r: 16px; --r-lg: 24px;
  --ui: "Anuphan", "Noto Sans Thai", system-ui, sans-serif;
  font-size: calc(16px * var(--fs));
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(1200px 800px at 50% 20%, #1B2350 0%, #070D22 70%);
  font-family: var(--ui); color: var(--text); font-size: 1.125rem; line-height: 1.7;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
button, input, textarea { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
a { color: inherit; }
.phone {
  position: relative; width: 390px; height: 844px; overflow: hidden; border-radius: 44px;
  background: var(--bg); box-shadow: 0 0 0 10px #05081A, 0 0 0 11px #2A2D5E, 0 40px 120px rgba(0,0,0,.6);
}
@media (max-width: 430px) {
  body { display: block; }
  .phone { width: 100vw; height: 100vh; height: 100dvh; border-radius: 0; box-shadow: none; }
}
@media (min-width: 431px) and (max-height: 880px) { .phone { transform: scale(calc(100vh / 900)); } }
.app { position: absolute; inset: 0; }
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; overflow: hidden; animation: fadein .3s ease both; background: var(--bg); }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.scroll { overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.body { flex: 1; min-height: 0; padding: 8px 16px 24px; display: flex; flex-direction: column; gap: 16px; }
.body > * { flex: none; }

/* ---------- focus (WCAG 2.4.7 / 2.4.11 / 2.4.13 spirit) ---------- */
:focus { outline: none; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 12px; }
svg [role=button]:focus-visible { outline: none; }
svg [role=button]:focus-visible .hit, svg [role=button]:focus-visible > circle:first-child { stroke: #FFFFFF; stroke-width: 3; }

/* ---------- icons ---------- */
.ic { width: 1.5rem; height: 1.5rem; flex: none; }
.spark { color: var(--accent); }

/* ---------- buttons ---------- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 56px; padding: 8px 24px;
  border: 0; border-radius: 28px; font-size: 1.1875rem; font-weight: 600; line-height: 1.4; cursor: pointer; text-align: center; text-decoration: none;
  transition: transform .12s ease, filter .2s;
}
.btn .ic { width: 1.5rem; height: 1.5rem; }
.btn:active { transform: scale(.98); }
.btn.big { min-height: 64px; font-size: 1.3125rem; border-radius: 32px; }
.btn.primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 8px 24px rgba(255, 210, 122, .25); }
.btn.primary .spark { color: var(--accent-ink); }
.btn.primary:disabled { background: #4A4F78; color: #E4E6F7; box-shadow: none; cursor: default; }
.btn.ghost { background: var(--surface2); color: var(--text); border: 2px solid rgba(221,224,245,.35); }
.btn.ghost.danger { color: #FFD0BC; border-color: rgba(255,178,138,.6); }
.btn.small { width: auto; min-height: 48px; padding: 4px 16px; font-size: max(14px, 1rem); border-radius: 24px; gap: 6px; }
.btn.small .ic { width: 1.25rem; height: 1.25rem; }
.btn.done { background: rgba(246, 227, 161, .14); color: #F6E3A1; border: 2px solid rgba(246,227,161,.4); }
.round {
  width: 56px; height: 56px; flex: none; border-radius: 50%; border: 2px solid rgba(221,224,245,.4); background: var(--surface2); color: var(--text);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.round.big { width: 64px; height: 64px; }
.round:disabled { opacity: .4; cursor: default; }
.icon-btn {
  width: 56px; height: 56px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%;
  border: 2px solid rgba(246,227,161,.4); background: rgba(246,227,161,.1); color: #F6E3A1; cursor: pointer; flex: none;
}
.pill-btn {
  display: inline-flex; align-items: center; gap: 6px; min-height: 48px; padding: 4px 16px; border-radius: 24px; text-decoration: none;
  background: rgba(11, 19, 51, .88); border: 2px solid rgba(255, 243, 196, .45); font-size: 1.0625rem; font-weight: 600; color: var(--star);
}
.pill-btn.small { background: var(--surface2); font-size: max(14px, 1rem); }
.pill-btn .ic { width: 1.375rem; height: 1.375rem; }

/* ---------- tags / labels ---------- */
.tag {
  display: inline-flex; align-items: center; min-height: 24px; padding: 0 10px; border-radius: 12px;
  font-size: max(12px, 0.8125rem); font-weight: 600; line-height: 1.5; white-space: nowrap;
  background: rgba(255, 243, 196, .16); color: var(--star); border: 1px solid rgba(255, 243, 196, .4);
}
.tag.gold { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-size: max(14px, 1rem); }
.demo-label { display: inline-flex; align-items: center; gap: 8px; font-size: max(14px, 1rem); color: var(--faint); line-height: 1.6; }
.demo-label::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--violet); flex: none; }
.lead { font-size: 1.125rem; color: var(--muted); line-height: 1.7; }
.sub { font-size: max(14px, 1rem); color: var(--muted); line-height: 1.7; }
.sub .ic { width: 1.125rem; height: 1.125rem; vertical-align: -3px; }
.center { text-align: center; }
.soft { display: flex; gap: 8px; align-items: center; justify-content: center; color: var(--muted); font-size: 1.0625rem; }
.soft .ic { color: var(--violet); }

/* ---------- top bar + headers ---------- */
.topbar { flex: none; display: flex; align-items: center; gap: 8px; padding: 44px 12px 8px; background: var(--bg); min-height: 104px; }
.topbar .title { flex: 1; font-size: 1.375rem; font-weight: 600; line-height: 1.4; min-width: 0; }
.topbar .tag { margin-right: 4px; }
.back {
  display: inline-flex; align-items: center; gap: 4px; min-height: 52px; min-width: 52px; padding: 4px 16px 4px 8px; border-radius: 26px;
  background: var(--surface2); border: 2px solid rgba(221,224,245,.35); text-decoration: none; font-size: 1.0625rem; font-weight: 600; flex: none;
}
.head { flex: none; padding: 52px 20px 12px; position: relative; z-index: 1; }
.head h1 { display: flex; align-items: center; gap: 10px; font-size: 1.75rem; font-weight: 600; line-height: 1.4; }
.head h1 .ic { width: 1.75rem; height: 1.75rem; color: var(--accent); }
.head .lead { margin-top: 2px; }

/* ---------- tab bar ---------- */
.tabbar {
  flex: none; display: flex; justify-content: space-around; align-items: stretch; gap: 8px; padding: 8px 8px 16px;
  background: #0A1230; border-top: 1px solid var(--line); position: relative; z-index: 3;
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 64px;
  color: var(--faint); text-decoration: none; font-size: max(14px, 1rem); font-weight: 600; line-height: 1.4; border-radius: 16px;
}
.tabbar a .ic { width: 1.625rem; height: 1.625rem; }
.tabbar a.on { color: var(--accent-ink); background: var(--accent); }

/* ---------- toast + modal ---------- */
.toast {
  position: absolute; left: 50%; bottom: 236px; transform: translate(-50%, 12px); z-index: 30; width: max-content; max-width: 340px;
  padding: 12px 20px; border-radius: 24px; background: #F6F3FF; color: var(--accent-ink); font-size: 1.0625rem; font-weight: 600; line-height: 1.5;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,.45);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.warn { background: var(--warn); }
.modal { position: absolute; inset: 0; z-index: 40; display: none; align-items: flex-end; background: rgba(4, 8, 24, .72); }
.modal.show { display: flex; }
.sheet {
  width: 100%; max-height: 92%; overflow-y: auto; background: var(--surface); border-top: 2px solid rgba(255,243,196,.3);
  border-radius: 28px 28px 0 0; padding: 24px 20px 32px; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center;
  animation: up .25s ease both;
}
@keyframes up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet h2 { font-size: 1.5rem; font-weight: 600; line-height: 1.4; }
.sheet p { font-size: 1.125rem; color: var(--muted); line-height: 1.7; }
.sheet-actions { width: 100%; display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.sheet-art { width: 88px; height: 88px; border-radius: 24px; background: var(--bg2); display: flex; align-items: center; justify-content: center; }
.sheet-art svg { width: 72px; height: 72px; }
.sheet.celebrate { background: linear-gradient(180deg, #2A2D6A, var(--surface)); }
.cele-art { width: 180px; height: 120px; display: block; }
.cele-art svg { width: 100%; height: 100%; }

/* ---------- pictures with graceful fallback ---------- */
.pic { position: relative; display: block; overflow: hidden; background: linear-gradient(160deg, #26306A, #121A44); }
.pic img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.pic > .ic { position: absolute; left: 50%; top: 50%; width: 40%; height: 40%; max-width: 56px; max-height: 56px; transform: translate(-50%, -50%); color: rgba(221,224,245,.5); }
.pic img + .ic { display: none; }

/* ---------- splash ---------- */
.scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.splash .top { position: relative; z-index: 2; text-align: center; padding: 100px 24px 0; }
.splash .tag { position: absolute; top: 52px; right: 20px; z-index: 3; }
.splash h1 { font-size: 2.5rem; font-weight: 600; letter-spacing: .04em; line-height: 1.3; }
.splash .th-name { margin-top: 4px; font-size: 1.125rem; color: #E6E8F8; letter-spacing: .04em; }
.splash .tagline { margin-top: 20px; font-size: 1.5rem; font-weight: 600; color: var(--star); line-height: 1.5; }
.splash .sub { margin-top: 8px; font-size: 1.125rem; color: #E6E8F8; line-height: 1.7; }
.splash .bottom { position: absolute; z-index: 2; left: 24px; right: 24px; bottom: 40px; text-align: center; }
.splash .fine { margin-top: 12px; font-size: max(14px, 1rem); color: #E6E8F8; }

/* ---------- lists / rows ---------- */
.list { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; align-items: center; gap: 14px; min-height: 72px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); text-decoration: none; }
.row .ico, .hub .ico { width: 48px; height: 48px; border-radius: 14px; flex: none; display: flex; align-items: center; justify-content: center; background: var(--surface2); color: var(--star); }
.row .txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row .name { font-size: 1.125rem; font-weight: 600; line-height: 1.45; }
.row .sub { line-height: 1.5; }
.row [data-chev], .hub [data-chev], .story [data-chev] { color: var(--faint); }
.switch { position: relative; display: inline-flex; align-items: center; gap: 8px; min-width: 104px; min-height: 52px; flex: none; border: 2px solid rgba(221,224,245,.35); border-radius: 26px; background: var(--surface2); cursor: pointer; padding: 4px 14px 4px 6px; }
.switch .knob { width: 40px; height: 40px; border-radius: 50%; background: #C9CDEB; flex: none; }
.switch .st { font-size: max(14px, 1rem); font-weight: 600; }
.switch[aria-checked="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); flex-direction: row-reverse; padding: 4px 6px 4px 14px; }
.switch[aria-checked="true"] .knob { background: #fff; }
.banner {
  padding: 12px 16px; border-radius: var(--r); display: flex; gap: 12px; align-items: center;
  background: rgba(199, 188, 245, .16); border: 1px solid rgba(199, 188, 245, .45); font-size: max(14px, 1rem); line-height: 1.6; color: #EEEAFF;
}
.banner .ic { color: var(--violet); }
.privacy { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: max(14px, 1rem); color: var(--muted); }
.foot { flex: none; padding: 12px 16px 28px; display: flex; flex-direction: column; gap: 12px; background: var(--bg); border-top: 1px solid var(--line); }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.card-head { display: flex; align-items: center; gap: 10px; font-size: 1.125rem; line-height: 1.5; }
.card-head .ic { color: var(--accent); }
.card-head .tag { margin-left: auto; }
.progress { height: 12px; border-radius: 6px; background: rgba(255,255,255,.14); overflow: hidden; margin: 6px 0; }
.progress.big { height: 18px; border-radius: 9px; }
.progress i { display: block; height: 100%; border-radius: inherit; background: var(--accent); }

/* ---------- morning ---------- */
.morning .art { position: relative; height: 150px; flex: none; }
.morning .art svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.morning .art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(10,16,44,.55), rgba(10,16,44,0) 70%, var(--bg)); }
.morning .greet { position: absolute; z-index: 1; left: 20px; right: 20px; top: 44px; text-shadow: 0 1px 10px rgba(6,10,30,.9); }
.morning .greet h1 { font-size: 2rem; font-weight: 600; line-height: 1.4; }
.morning .greet p { font-size: 1.125rem; color: #F0EEFF; }
.sleep-big { font-size: 2.25rem; font-weight: 600; line-height: 1.3; }
.sleep-big small { font-size: 1.125rem; font-weight: 500; color: var(--muted); margin: 0 4px; }
.nights { display: grid; grid-template-columns: repeat(7, 1fr); margin-top: 6px; text-align: center; }
.nights .n { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: max(14px, 1rem); color: var(--muted); line-height: 1.5; }
.nights .dot { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: rgba(255,255,255,.06); }
.nights .ontime .dot { background: rgba(255, 210, 122, .18); }
.nights .rest .dot { background: rgba(199, 188, 245, .2); }
.nights .last { color: var(--text); font-weight: 700; }
.nights .last .dot { box-shadow: 0 0 0 2px #fff; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; justify-content: center; margin-top: 6px; font-size: max(14px, 1rem); color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 4px; }
.legend .ic { width: 1.25rem; height: 1.25rem; }
.legend i.dash { display: inline-block; width: 18px; border-top: 2px dashed rgba(255,243,196,.85); }
.breakdown { display: flex; flex-direction: column; }
.bd { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 1.125rem; line-height: 1.5; padding: 6px 0; color: var(--muted); }
.bd span { display: inline-flex; align-items: center; gap: 8px; }
.bd .ic { width: 1.25rem; height: 1.25rem; color: var(--violet); }
.bd b { color: var(--text); font-weight: 600; }
.bd.total { margin-top: 4px; padding-top: 10px; border-top: 1px dashed var(--line); color: var(--text); font-weight: 600; }
.bd.total .num { font-size: 1.75rem; color: var(--accent); line-height: 1.3; font-variant-numeric: tabular-nums; }
.card.got { border-color: rgba(255,210,122,.45); background: linear-gradient(180deg, rgba(255,210,122,.1), var(--surface) 60%); }
.dream .dream-img { width: 100%; aspect-ratio: 4 / 3; border-radius: 18px; margin: 4px 0 6px; }
.dream h2 { font-size: 1.375rem; font-weight: 600; line-height: 1.4; }
.ok-line { display: flex; align-items: center; gap: 8px; color: var(--ok); font-size: max(14px, 1rem); font-weight: 600; }

/* ---------- garden ---------- */
.garden .gscroll { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.garden .stage { position: relative; flex: 1 0 auto; min-height: 500px; overflow: hidden; background: #16204A; }
.garden .stage .slot, .garden .stage [role=button] { cursor: pointer; }
.garden .stage .slot.open .pulse { animation: pulse 2.2s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.garden .stage .slot.lit path { animation: pop .45s cubic-bezier(.2,1.6,.4,1) both; transform-box: fill-box; transform-origin: center; }
.garden .spot circle { animation: pulse 1.8s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.garden .decor-in.moving { opacity: .45; }
.const-lines line:not(.guide) { animation: draw .6s ease both; }
.decor-in { animation: fadein .4s ease both; }
@keyframes pulse { 0%, 100% { opacity: .65; transform: scale(.92); } 50% { opacity: 1; transform: scale(1.06); } }
@keyframes pop { from { transform: scale(.2); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes draw { from { opacity: 0; } to { opacity: 1; } }
.hud { position: absolute; z-index: 2; top: 44px; left: 12px; right: 12px; display: flex; align-items: center; gap: 8px; }
.balance {
  display: inline-flex; align-items: center; gap: 8px; min-height: 52px; padding: 0 18px 0 12px; border-radius: 26px;
  background: rgba(11, 19, 51, .88); border: 2px solid rgba(255, 210, 122, .55); font-size: 1.125rem; font-weight: 600;
}
.balance .num { font-size: 1.375rem; color: var(--accent); font-variant-numeric: tabular-nums; }
.balance.bump { animation: bump .35s ease; }
@keyframes bump { 50% { transform: scale(1.06); } }
.hud .sp { flex: 1; }
.modebar {
  position: absolute; z-index: 3; top: 104px; left: 12px; right: 12px; display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 16px;
  background: rgba(11,19,51,.94); border: 2px solid var(--accent); border-radius: 20px; font-size: 1.0625rem; font-weight: 600; line-height: 1.45;
}
.modebar > span { flex: 1; }
.slot.resting { pointer-events: none; opacity: .55; }
.modebar > span .ic { color: var(--accent); vertical-align: -5px; margin-right: 6px; }
.modebar small { font-size: max(14px, 1rem); font-weight: 500; color: var(--muted); }
.tray { flex: none; background: var(--bg2); border-top: 1px solid var(--line); position: relative; z-index: 2; padding: 10px 0 10px; }
.tray-head { display: flex; justify-content: space-between; align-items: center; padding: 0 16px; gap: 8px; }
.tray-head h2 { display: flex; align-items: center; gap: 8px; font-size: 1.125rem; font-weight: 600; }
.tray-head h2 .ic { color: var(--accent); }
.tray-hint { padding: 0 16px; font-size: max(14px, 1rem); color: var(--muted); line-height: 1.5; }
.tray-hint.star-hint { display: flex; align-items: center; gap: 6px; padding-bottom: 6px; margin-bottom: 6px; border-bottom: 1px solid var(--line); color: var(--text); }
.tray-hint .ic { width: 1.125rem; height: 1.125rem; }
.tray-list { display: flex; gap: 8px; padding: 8px 16px 2px; overflow-x: auto; scrollbar-width: none; }
.tray-list::-webkit-scrollbar { display: none; }
.item, .gitem {
  flex: none; border-radius: var(--r); border: 2px solid var(--line); background: var(--surface); color: var(--text);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; cursor: pointer; padding: 6px 4px; text-align: center;
}
.item { width: 100px; min-height: 108px; }
.item .art svg { width: 44px; height: 44px; display: block; }
.item .nm, .gitem .nm { font-size: max(14px, 1rem); line-height: 1.4; }
.item .nm { max-width: 100%; padding-top: 2px; line-height: 1.3; }
.item .pr, .gitem .pr { display: inline-flex; align-items: center; gap: 2px; font-size: max(14px, 1rem); line-height: 1.4; color: var(--accent); font-weight: 700; }
.pr .ic { width: 1rem; height: 1rem; }
.pr.ok { color: var(--ok); }
.pr.gift { color: var(--accent-ink); background: var(--accent); border-radius: 10px; padding: 0 8px; }
.item.placed, .gitem.placed { border-color: rgba(155, 232, 191, .6); }
.item.gifted, .gitem.gifted { border-color: var(--accent); }
.item.sel, .gitem.sel { border-color: #fff; box-shadow: 0 0 0 3px var(--accent); background: var(--surface2); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.gitem { min-height: 156px; padding: 12px 8px; gap: 4px; }
.gitem .art svg { width: 64px; height: 64px; display: block; }
.gitem .nm { font-size: 1.125rem; font-weight: 600; }
.balance-line { display: flex; align-items: center; gap: 8px; font-size: 1.125rem; font-weight: 600; }

/* ---------- places ---------- */
.place { display: flex; flex-direction: column; width: 100%; padding: 0; border-radius: var(--r-lg); border: 2px solid var(--line); background: var(--surface); overflow: hidden; cursor: pointer; text-align: left; color: var(--text); }
.place .place-img { height: 128px; width: 100%; }
.place.locked .place-img img { filter: grayscale(.6) brightness(.55); }
.place.cur { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.place-tx { display: flex; flex-direction: column; gap: 4px; padding: 12px 16px 14px; }
.place-tx b { font-size: 1.1875rem; line-height: 1.45; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: max(14px, 1rem); color: var(--muted); font-weight: 600; }
.status .ic { width: 1.25rem; height: 1.25rem; }
.status.on { color: var(--ok); }
.status.locked { color: var(--muted); }

/* ---------- pet ---------- */
.pet-hero { display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; }
.pet-big { width: 196px; height: 196px; border-radius: 50%; border: 4px solid #FFE3B8; box-shadow: 0 0 40px rgba(255,210,122,.25); margin-bottom: 8px; }
.pet-hero h2 { font-size: 1.75rem; font-weight: 600; line-height: 1.4; }
.stage-name { font-size: 1.125rem; color: var(--accent); font-weight: 600; }
.grow { font-size: 1.25rem; font-weight: 600; color: var(--star); }
.stages { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stg { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 4px; border-radius: var(--r); background: var(--surface); border: 2px solid var(--line); text-align: center; }
.stg.cur { border-color: var(--accent); }
.stg .stg-img { width: 72px; height: 72px; border-radius: 50%; }
.stg.future .stg-img img { filter: grayscale(1) brightness(.45); }
.stg b { font-size: max(14px, 1rem); line-height: 1.4; }
.stg span:last-child { display: inline-flex; align-items: center; gap: 4px; font-size: max(14px, 1rem); color: var(--muted); }
.stg .ic { width: 1rem; height: 1rem; }

/* ---------- collection ---------- */
.seg { display: flex; gap: 8px; }
.seg > a, .seg > button {
  flex: 1; min-height: 52px; padding: 6px 8px; border-radius: 16px; border: 2px solid var(--line); background: var(--surface); color: var(--text);
  display: flex; align-items: center; justify-content: center; gap: 6px; font-size: max(14px, 1rem); font-weight: 600; line-height: 1.35; text-decoration: none; cursor: pointer; text-align: center;
}
.seg > .on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.seg > button:disabled { opacity: .55; cursor: default; }
.seg .ic { width: 1.25rem; height: 1.25rem; }
.seg.col { flex-direction: column; }
.collect > .seg { flex: none; padding: 0 16px 8px; }
.collect > .seg > a { flex-direction: column; gap: 0; min-height: 64px; }
.dcard { position: relative; display: flex; flex-direction: column; gap: 2px; padding: 0 0 12px; border-radius: var(--r); border: 2px solid var(--line); background: var(--surface); overflow: hidden; text-align: left; color: var(--text); cursor: pointer; }
.dcard .dc-img { width: 100%; aspect-ratio: 1; }
.dcard b { font-size: 1.0625rem; line-height: 1.45; padding: 6px 10px 0; }
.dcard .cap { font-size: max(14px, 1rem); color: var(--muted); line-height: 1.5; padding: 0 10px; }
.dcard .new { position: absolute; top: 8px; left: 8px; }
.dcard.empty { cursor: default; border-style: dashed; background: rgba(24,35,79,.5); }
.pic.sil { width: 100%; aspect-ratio: 1; background: radial-gradient(circle at 50% 45%, rgba(199,188,245,.18), rgba(14,24,56,.2) 70%); }
.const-card { flex-direction: row; align-items: center; gap: 14px; }
.const-card > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.const-card b { font-size: 1.125rem; line-height: 1.45; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.const-card .cico { width: 88px; height: 72px; flex: none; display: flex; align-items: center; justify-content: center; border-radius: 16px; background: var(--bg2); color: var(--faint); }
.const-card .cico svg { width: 80px; height: 64px; }
.const-card.locked { border-style: dashed; }
.pic.modal-card { width: 260px; height: 260px; border-radius: 20px; }

/* ---------- bedtime hub ---------- */
.bedtime .hero { position: absolute; left: 0; right: 0; top: 0; height: 260px; z-index: 0;
  background: url(../assets/art/bedroom.jpg) no-repeat; background-size: 390px auto; background-position: center -150px; }
.bedtime .hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(10,16,44,.82) 0%, rgba(10,16,44,.6) 45%, var(--bg) 100%); }
.bedtime .head { text-shadow: 0 1px 10px rgba(6,10,30,.9); }
.bedtime .head .lead { color: #F0EEFF; }
.bedtime .body { position: relative; z-index: 1; gap: 10px; }
.hub { display: flex; align-items: center; gap: 14px; min-height: 84px; padding: 12px 14px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); text-decoration: none; }
.hub .ico { width: 56px; height: 56px; border-radius: 18px; background: rgba(255,210,122,.14); color: var(--accent); }
.hub .ico .ic { width: 1.75rem; height: 1.75rem; }
.hub .tx { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.hub b { font-size: 1.1875rem; line-height: 1.45; }
.hub .tx > span { font-size: max(14px, 1rem); color: var(--muted); line-height: 1.5; }
.now-playing { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; padding: 12px 14px; border-radius: var(--r); background: rgba(155,232,191,.12); border: 1px solid rgba(155,232,191,.5); font-size: max(14px, 1rem); }
.now-playing > span { flex: 1; min-width: 150px; }
.now-playing > .ic { color: var(--ok); }

/* ---------- quiet + breathe ---------- */
.center-col { align-items: stretch; }
.orb-wrap { position: relative; width: 260px; height: 260px; margin: 8px auto; display: flex; align-items: center; justify-content: center; }
.orb { position: absolute; inset: 0; border-radius: 50%; background: radial-gradient(circle, rgba(255,210,122,.32) 0%, rgba(199,188,245,.22) 55%, rgba(199,188,245,.06) 100%); border: 3px solid rgba(255,243,196,.55); transform: scale(.8); }
.orb.run { animation: slowbreath 10s ease-in-out infinite; }
@keyframes slowbreath { 0%, 100% { transform: scale(.78); } 50% { transform: scale(1); } }
.orb-tx { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; font-size: 1.0625rem; color: var(--text); max-width: 200px; line-height: 1.5; }
.big-time { font-size: 3rem; font-weight: 600; line-height: 1.2; font-variant-numeric: tabular-nums; color: var(--star); }
.breath .orb { transition: transform var(--d, 4s) ease-in-out; }
.orb.b-in { transform: scale(1); } .orb.b-hold { transform: scale(1); } .orb.b-out { transform: scale(.62); } .orb.b-rest { transform: scale(.62); } .orb.b-idle { transform: scale(.8); }
.orb.b-hold, .orb.b-rest { border-style: dashed; }
.breath .word { font-size: 2rem; font-weight: 600; color: var(--star); line-height: 1.4; }
.breath .word.idle { font-size: 1.375rem; }
.breath .count { font-size: 2.75rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; min-height: 1.1em; }
.opts { display: flex; flex-direction: column; gap: 8px; }
.opt-label { display: flex; align-items: center; gap: 8px; font-size: 1.0625rem; font-weight: 600; margin-top: 4px; }
.opt-label .ic { color: var(--accent); }
.foot .btn.ghost { min-height: 52px; }

/* ---------- sounds ---------- */
.snd { border-radius: var(--r-lg); background: var(--surface); border: 2px solid var(--line); padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 8px; }
.snd.on { border-color: var(--ok); background: linear-gradient(180deg, rgba(155,232,191,.1), var(--surface)); }
.snd-toggle { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 60px; padding: 4px; border: 0; background: none; cursor: pointer; text-align: left; border-radius: 16px; }
.snd-toggle .ico { width: 52px; height: 52px; border-radius: 16px; flex: none; display: flex; align-items: center; justify-content: center; background: var(--surface2); color: var(--star); }
.snd.on .snd-toggle .ico { background: var(--ok); color: #0B2A1B; }
.snd-toggle .tx { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.snd-toggle b { font-size: 1.125rem; line-height: 1.45; }
.snd-toggle .st { display: inline-flex; align-items: center; gap: 4px; font-size: max(14px, 1rem); color: var(--muted); }
.snd-toggle .st .ic { width: 1rem; height: 1rem; }
.snd.on .snd-toggle .st { color: var(--ok); }
.onoff { min-width: 72px; min-height: 48px; display: inline-flex; align-items: center; justify-content: center; border-radius: 24px; background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 1.0625rem; padding: 0 14px; }
.snd.on .onoff { background: var(--surface2); color: var(--text); border: 2px solid rgba(221,224,245,.4); }
.vol { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.vol .round { width: 52px; height: 52px; }
.steps { flex: 1; display: flex; align-items: flex-end; justify-content: center; gap: 6px; height: 40px; }
.steps i { width: 14px; border-radius: 4px; background: rgba(221,224,245,.25); border: 1px solid rgba(221,224,245,.45); }
.steps i.f { background: var(--accent); border-color: var(--accent); }
.steps em { font-style: normal; font-size: max(14px, 1rem); color: var(--muted); margin-left: 8px; align-self: center; }
.timer-card .seg { flex-wrap: wrap; }
.timer-card .seg > button { flex: 1 1 40%; }
.fine-print { display: flex; gap: 8px; align-items: flex-start; font-size: max(14px, 1rem); color: var(--muted); }

/* ---------- reading ---------- */
.story { display: flex; gap: 14px; align-items: center; padding: 12px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); text-decoration: none; min-height: 112px; }
.story .th { width: 76px; height: 76px; flex: none; border-radius: 16px; overflow: hidden; }
.story .th svg, .story .th img { width: 100%; height: 100%; display: block; object-fit: cover; }
.story .tx { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.story b { font-size: 1.125rem; line-height: 1.45; }
.story .teaser { font-size: max(14px, 1rem); color: var(--muted); line-height: 1.55; }
.story .meta { display: inline-flex; align-items: center; gap: 6px; font-size: max(14px, 1rem); color: var(--faint); }
.story .meta .ic { width: 1.125rem; height: 1.125rem; }
.reader { background: linear-gradient(180deg, #1E1A2E 0%, #171424 60%, #13111E 100%); color: #EFE6D4; }
.reader .topbar { background: transparent; }
.reader .topbar .title { color: #EFE6D4; }
.reader .back { background: rgba(246,227,161,.1); border-color: rgba(246,227,161,.4); color: #F6E3A1; }
.timer { flex: none; display: flex; align-items: center; gap: 14px; justify-content: center; padding: 0 20px 8px; }
.ring { position: relative; width: 80px; height: 80px; flex: none; }
.ring svg { width: 80px; height: 80px; transform: rotate(-90deg); }
.ring .t { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 1.25rem; font-weight: 600; font-variant-numeric: tabular-nums; color: #F6E3A1; }
.timer .tl { flex: 1; min-width: 0; font-size: max(14px, 1rem); color: #DCD2BE; line-height: 1.5; display: flex; flex-direction: column; }
.timer .tl b { font-size: 1.125rem; color: #EFE6D4; font-weight: 600; }
.reading { flex: 1; min-height: 0; padding: 8px 24px 24px; font-family: var(--ui); font-weight: 400; font-size: 1.3125rem; line-height: 1.8; color: #F4EDDD; }
.reading h2 { font-family: var(--ui); font-weight: 600; font-size: 1.625rem; line-height: 1.6; color: #F6E3A1; margin: 4px 0 16px; }
.reading p { margin: 0 0 20px; text-indent: 1.5em; }
.reading p.end { text-indent: 0; text-align: center; color: #F6E3A1; margin-top: 8px; }
.reader .foot { background: #13111E; border-top-color: rgba(246,227,161,.2); }
.reader .btn.primary { background: #F6E3A1; }

/* ---------- gratitude ---------- */
.field { display: flex; flex-direction: column; gap: 8px; }
.flabel { display: flex; align-items: center; gap: 8px; font-size: 1.1875rem; font-weight: 600; line-height: 1.45; flex-wrap: wrap; }
.flabel .ic { color: var(--accent); }
.flabel small { font-size: max(14px, 1rem); font-weight: 500; color: var(--muted); }
textarea {
  width: 100%; min-height: 104px; padding: 12px 14px; border-radius: 16px; border: 2px solid rgba(221,224,245,.45); background: #0B1330;
  font-size: 1.125rem; line-height: 1.7; resize: vertical; color: var(--text);
}
textarea::placeholder { color: #A9AED6; }
textarea:focus-visible { border-color: var(--accent); outline: 3px solid var(--accent); outline-offset: 1px; }
.sec { display: flex; align-items: center; gap: 8px; font-size: 1.25rem; font-weight: 600; margin-top: 8px; }
.sec .ic { color: var(--accent); }
.note-item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.note-item .nd { font-size: max(14px, 1rem); color: var(--accent); font-weight: 600; }
.note-item p { font-size: 1.125rem; line-height: 1.7; overflow-wrap: anywhere; }
.note-item .mind { color: var(--muted); font-size: max(14px, 1rem); }
.note-item .del { align-self: flex-end; }
.empty { color: var(--muted); font-size: 1.0625rem; }

/* ---------- wind-down ---------- */
.time-pick { flex-direction: row; align-items: center; justify-content: space-between; padding: 20px 16px; }
.tp { display: flex; align-items: baseline; gap: 6px; }
.tp span:last-child { font-size: 1.25rem; color: var(--muted); }
.toggle-row { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 10px 14px; }

/* ---------- stats ---------- */
.chart svg { width: 100%; height: auto; display: block; margin-top: 4px; }
.night-list { display: flex; flex-direction: column; gap: 6px; }
.nrow { display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "d k l" "h h h"; gap: 0 10px; align-items: center; padding: 10px 14px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); font-size: 1.0625rem; }
.nrow .nd { grid-area: d; font-weight: 600; }
.nrow .nk { grid-area: k; display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: max(14px, 1rem); }
.nrow .nk .ic { width: 1.125rem; height: 1.125rem; }
.nrow .nl { grid-area: l; color: var(--accent); font-weight: 700; }
.nrow .nh { grid-area: h; color: var(--text); }
.nrow .nh small { font-size: max(14px, 1rem); color: var(--muted); margin-left: 8px; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; }
.tile .k { display: flex; align-items: center; gap: 6px; font-size: max(14px, 1rem); color: var(--muted); line-height: 1.5; }
.tile .k .ic { width: 1.125rem; height: 1.125rem; color: var(--accent); }
.tile .v { font-size: 1.5rem; font-weight: 600; line-height: 1.4; font-variant-numeric: tabular-nums; }
.tile .v small { font-size: max(14px, 1rem); font-weight: 500; color: var(--muted); margin-left: 2px; }
.light { color: var(--accent); }

/* ---------- settings ---------- */
.seg.fs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.seg.fs > button { flex-direction: column; gap: 0; min-height: 72px; padding: 6px 8px; line-height: 1.35; }
.seg.fs .ka { font-weight: 600; line-height: 1.25; }
.fs-preview { margin-top: 12px; padding: 12px 14px; border-radius: 14px; background: #0B1330; border: 1px solid var(--line); font-size: 1.125rem; line-height: 1.7; color: var(--text); }
.fs-preview small { display: block; font-size: max(14px, 1rem); color: var(--muted); }
.demo-box { border-style: dashed; border-color: rgba(199,188,245,.6); }
.demo-btns { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.demo-btns .btn { font-size: 1.0625rem; }
.hi { color: var(--accent); }
.demo-result { padding: 10px 12px; border-radius: 12px; background: rgba(155,232,191,.12); border: 1px solid rgba(155,232,191,.5); font-size: max(14px, 1rem); line-height: 1.55; }
.sub.small { font-size: max(14px, 1rem); }

/* ---------- motion ---------- */
.tw { animation: twinkle 3.5s ease-in-out infinite; }
@keyframes twinkle { 0%, 100% { opacity: .9; } 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .orb.b-in, .orb.b-hold, .orb.b-out, .orb.b-rest { transform: scale(.85); }
  .orb.b-in, .orb.b-hold { background: radial-gradient(circle, rgba(255,210,122,.45) 0%, rgba(199,188,245,.28) 60%, rgba(199,188,245,.08) 100%); }
}

/* ---------- v2 preview: painted art ---------- */
.scene.paint { background-size: cover; background-repeat: no-repeat; }
.splash-paint { background-image: url(../assets/art/splash.jpg); background-position: 0% 62%; }
.splash-paint .shade { position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(8,14,40,.78) 0%, rgba(8,14,40,.55) 32%, rgba(8,14,40,0) 50%, rgba(8,14,40,0) 66%, rgba(8,14,40,.75) 84%, rgba(8,14,40,.92) 100%); }
.splash .top h1, .splash .top .tagline, .splash .top .sub, .splash .top .th-name { text-shadow: 0 1px 12px rgba(6,10,30,.85), 0 0 2px rgba(6,10,30,.8); }
.splash .fine { text-shadow: 0 1px 8px rgba(6,10,30,.9); }

/* painted decor sprites (fix pass 3) */
.decor-img { display: block; width: 100%; height: 100%; object-fit: contain; }
.item .art { width: 44px; height: 44px; display: block; }
.gitem .art { width: 64px; height: 64px; display: block; }
.sheet-art { display: inline-block; width: 72px; height: 72px; }
.decor-paint { filter: brightness(.86) saturate(.9) drop-shadow(0 0 6px rgba(255,190,110,.18)); }

/* Moonpuff wordmark (painted, codex image_generation) */
.splash h1.wordmark { margin: 0 auto; line-height: 0; }
.splash h1.wordmark img { display: block; width: min(300px, 80vw); height: auto; margin: 0 auto; filter: drop-shadow(0 4px 18px rgba(6,10,30,.55)); }
.splash .th-name { margin-top: 2px; }

/* =====================================================================
   ANIMATION PASS (11 Nov 2026) — calm "alive" motion, bedtime-gentle.
   - Everything here is slow: no brightness change faster than ~0.5 Hz, no motion on text being read.
   - Off under prefers-reduced-motion (global rule above) AND when the user sets
     "ภาพเคลื่อนไหว" to ปิด (html.motion-off, set before first paint in index.html).
   - Only transform / opacity (composited) on HTML; particles live in js/ambient.js (one canvas per scene).
   ===================================================================== */

/* user switch: same effect as the OS reduced-motion setting */
html.motion-off *, html.motion-off *::before, html.motion-off *::after { animation: none !important; transition: none !important; }
html.motion-off .orb.b-in, html.motion-off .orb.b-hold, html.motion-off .orb.b-out, html.motion-off .orb.b-rest { transform: scale(.85); }
html.motion-off .orb.b-in, html.motion-off .orb.b-hold { background: radial-gradient(circle, rgba(255,210,122,.45) 0%, rgba(199,188,245,.28) 60%, rgba(199,188,245,.08) 100%); }

/* settings row for the switch */
.motion-row { display: flex; align-items: center; gap: 12px; }
.motion-tx { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.motion-tx b { font-size: 1.125rem; line-height: 1.5; }

/* ambient canvases (js/ambient.js): never take taps, sit under the HUD / text */
.amb-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; }
.garden .stage .amb-canvas { z-index: 1; }
.bedtime .hero .amb-canvas { z-index: 1; }
.amb-fx { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 35; pointer-events: none; }

/* 7. screen transitions: soft cross-fade + small upward settle; sub-screens come in a touch from the right.
   Only on route change (.enter is added by render()), so re-renders of the same screen stay still. */
.screen { animation: none; }
.screen.enter { animation: settle .32s cubic-bezier(.2,.7,.3,1) both; }
.screen.sub.enter { animation-name: settle-sub; }
@keyframes settle { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes settle-sub { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: none; } }

/* 3. very slow background drift (painted art only; text and tap targets never move) */
.splash-paint { animation: drift 56s ease-in-out infinite alternate; transform-origin: 78% 60%; }
.bedtime .hero { animation: drift 60s ease-in-out infinite alternate; transform-origin: 50% 0; }
@keyframes drift { from { transform: scale(1); } to { transform: scale(1.03); } }
/* garden: no drift on purpose — the painted place is one SVG with the stars/decor/pet on top, and scaling the
   <image> would repaint the whole SVG every frame on phones; the canvas layer carries the life there. */

/* 2. garden: lit stars breathe softly, staggered */
.garden .stage .slot.lit > circle[fill^="url"] { animation: glowtw 5s ease-in-out infinite alternate; }
.garden .stage .slot.lit:nth-of-type(2n) > circle[fill^="url"] { animation-duration: 6.2s; animation-delay: -2.1s; }
.garden .stage .slot.lit:nth-of-type(3n) > circle[fill^="url"] { animation-duration: 5.6s; animation-delay: -3.7s; }
@keyframes glowtw { from { opacity: 1; } to { opacity: .55; } }

/* 4. pet "นุ่มนิ่ม": idle breathing, a slow small sway, and a brief soft blink-squash in each 8 s cycle */
.pet-big img, .stg.cur .stg-img img, .garden .pet-img {
  transform-origin: 50% 85%; transform-box: fill-box;
  animation: petbreathe 8s ease-in-out infinite, petsway 11s ease-in-out infinite;
}
@keyframes petbreathe {
  0%, 50%, 86%, 100% { scale: 1; }
  25%, 75% { scale: 1.03; }
  88% { scale: 1.01 .97; }
  90% { scale: 1; }
}
@keyframes petsway { 0%, 100% { rotate: 0deg; } 30% { rotate: 2deg; } 65% { rotate: -1.5deg; } }
/* a tiny sparkle floats up beside the pet on its page, about every 10 s (hidden when motion is off) */
.pet-hero { position: relative; }
.pet-hero::before {
  content: ""; position: absolute; top: 34px; left: calc(50% + 74px); width: 14px; height: 14px; opacity: 0; pointer-events: none;
  background: #FFE7A8; clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
  filter: drop-shadow(0 0 4px rgba(255,210,122,.8)); animation: petspark 10s ease-in-out 2s infinite;
}
@keyframes petspark { 0%, 70% { opacity: 0; transform: translateY(0) scale(.6); } 80% { opacity: .9; transform: translateY(-10px) scale(1); } 100% { opacity: 0; transform: translateY(-22px) scale(.8); } }

/* 5. light collect: the counter glows softly once */
.bd.total .num.glow { animation: countglow 1.6s ease-out both; }
@keyframes countglow { 0% { text-shadow: 0 0 0 rgba(255,210,122,0); } 40% { text-shadow: 0 0 18px rgba(255,210,122,.75); } 100% { text-shadow: 0 0 6px rgba(255,210,122,.2); } }

/* 8. dream card detail: a slow sheen drifts across the picture, plus a few soft sparkles */
.pic.modal-card::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 1;
  background: linear-gradient(105deg, rgba(255,255,255,0) 35%, rgba(255,246,220,.16) 50%, rgba(255,255,255,0) 65%);
  transform: translateX(-100%); animation: sheen 7s ease-in-out 1s infinite;
}
.pic.modal-card::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 1; opacity: 0;
  background:
    radial-gradient(circle at 22% 28%, rgba(255,243,196,.9) 0 1.5px, rgba(255,243,196,0) 5px),
    radial-gradient(circle at 74% 18%, rgba(255,243,196,.85) 0 1.2px, rgba(255,243,196,0) 4px),
    radial-gradient(circle at 62% 64%, rgba(255,243,196,.8) 0 1.5px, rgba(255,243,196,0) 5px),
    radial-gradient(circle at 30% 78%, rgba(255,243,196,.8) 0 1.2px, rgba(255,243,196,0) 4px);
  animation: cardspark 6s ease-in-out infinite;
}
@keyframes sheen { 0% { transform: translateX(-100%); } 60%, 100% { transform: translateX(100%); } }
@keyframes cardspark { 0%, 100% { opacity: .15; } 50% { opacity: .9; } }

/* 6. gentle press feedback (no hover-only effects) */
@media (prefers-reduced-motion: no-preference) {
  html:not(.motion-off) :is(.btn, .hub, .row.link, .dcard:not(.empty), .story, .place, .item, .gitem, .seg > a, .seg > button, .pill-btn, .switch, .icon-btn, .tabbar a) {
    transition: transform .4s cubic-bezier(.34,1.56,.64,1), filter .2s;
  }
  html:not(.motion-off) :is(.btn, .hub, .row.link, .dcard:not(.empty), .story, .place, .item, .gitem, .seg > a, .seg > button, .pill-btn, .switch, .icon-btn, .tabbar a):active {
    transform: scale(.97); transition-duration: .08s;
  }
}

/* =====================================================================
   v3 (12 Nov 2026): music, cat stories, weekly summary, Health import, idle lock, warm light, seasons.
   Same rules as before: rem type, ≥ 48 px targets, ≥ 8 px gaps, Anuphan only.
   ===================================================================== */
.demo-label.imp::before { background: var(--ok); }

/* สะสม: 4 tabs as a 2×2 grid so Thai labels never squeeze at ใหญ่มาก */
.collect > .seg.tabs4 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.collect > .seg.tabs4 > a { flex-direction: row; gap: 6px; min-height: 52px; }

/* 2-column option grids in settings (season, idle, dimmer) */
.seg.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 6px; }
.seg.grid > button { min-height: 56px; }

/* timer: 5 choices, wraps 3 + 2 */
.timer-card .seg > button { flex: 1 1 28%; }
.timer-card .card-head b { line-height: 1.5; }

/* เพลงกล่อม */
.track { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 84px; padding: 12px 14px; border-radius: var(--r-lg);
  background: var(--surface); border: 2px solid var(--line); color: var(--text); text-align: left; cursor: pointer; }
.track .ico { width: 56px; height: 56px; border-radius: 18px; flex: none; display: flex; align-items: center; justify-content: center; background: rgba(199,188,245,.16); color: var(--violet); }
.track .ico .ic { width: 1.75rem; height: 1.75rem; }
.track .tx { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.track b { font-size: 1.1875rem; line-height: 1.45; }
.track .st { display: inline-flex; align-items: center; gap: 4px; font-size: max(14px, 1rem); color: var(--muted); line-height: 1.5; }
.track .st .ic { width: 1rem; height: 1rem; }
.track.on { border-color: var(--ok); background: linear-gradient(180deg, rgba(155,232,191,.1), var(--surface)); }
.track.on .ico { background: var(--ok); color: #0B2A1B; }
.track.on .st { color: var(--ok); }
.track .onoff { flex: none; }
.track.on .onoff { background: var(--surface2); color: var(--text); border: 2px solid rgba(221,224,245,.4); }

/* นิทานของนุ่มนิ่ม */
.cat-head { display: flex; align-items: center; gap: 14px; }
.cat-mini { width: 72px; height: 72px; border-radius: 50%; flex: none; border: 3px solid #FFE3B8; }
.cat-head .lead { flex: 1; min-width: 0; }
.cat-locked { display: flex; align-items: center; gap: 10px; min-height: 64px; padding: 12px 16px; border-radius: var(--r-lg);
  border: 2px dashed rgba(199,188,245,.55); color: var(--muted); font-size: 1.0625rem; line-height: 1.5; }
.cat-locked .ic { color: var(--violet); }
.cat-row .ico { color: #FFE3B8; }
.catread { background: linear-gradient(180deg, #1E1A2E 0%, #171424 60%, #13111E 100%); }
.catread .topbar { background: transparent; }
.catread .back { background: rgba(246,227,161,.1); border-color: rgba(246,227,161,.4); color: #F6E3A1; }
.cat-story { padding: 8px 24px 32px; gap: 0; color: #F4EDDD; }
.cat-story .cat-no { font-size: max(14px, 1rem); color: #DCD2BE; }
.cat-story h2 { font-size: 1.75rem; font-weight: 600; line-height: 1.6; color: #F6E3A1; margin: 2px 0 14px; }
.cat-story p { font-size: 1.375rem; line-height: 1.9; margin: 0 0 10px; }
.cat-story p.end { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 18px; color: #F6E3A1; font-size: 1.1875rem; }
.cat-today .ico { background: rgba(255,227,184,.16); color: #FFE3B8; }

/* ถ้าตื่นกลางดึก: darker than everything else */
.night, .night .topbar, .night .foot { background: #080B1A; }
.night .orb { border-color: rgba(255,243,196,.35); background: radial-gradient(circle, rgba(255,210,122,.18) 0%, rgba(199,188,245,.12) 55%, rgba(199,188,245,.03) 100%); }
.night .orb.run { animation-duration: 12s; }
.night-word { font-size: 1.375rem; font-weight: 600; color: var(--star); line-height: 1.6; }
.night .foot { border-top-color: rgba(221,224,245,.12); }

/* สรุปการนอน 7 คืน */
.week-say { gap: 8px; border-color: rgba(255,210,122,.45); }
.week-say .say1 { font-size: 1.3125rem; font-weight: 600; line-height: 1.6; }
.week-say .say2 { font-size: 1.125rem; color: var(--muted); line-height: 1.7; }
.wk-list { display: flex; flex-direction: column; gap: 8px; }
.wk-row { display: flex; flex-direction: column; gap: 4px; padding: 10px 14px 12px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); }
.wk-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.wk-top b { font-size: 1.125rem; line-height: 1.5; }
.wk-k { display: inline-flex; align-items: center; gap: 6px; font-size: max(14px, 1rem); color: var(--muted); }
.wk-k .ic { width: 1.25rem; height: 1.25rem; }
.wk-bar { position: relative; height: 18px; border-radius: 9px; background: rgba(255,255,255,.1); overflow: hidden; }
.wk-bar i { display: block; height: 100%; border-radius: inherit; background: #8D94C4; }
.wk-row.ontime .wk-bar i { background: var(--accent); }
.wk-row.rest .wk-bar i { background: var(--violet); }
.wk-bar em { position: absolute; top: 0; bottom: 0; left: 70%; border-left: 2px dashed rgba(255,243,196,.9); }
.wk-h { font-size: 1.0625rem; color: var(--text); line-height: 1.5; }
.wk-tick-key { display: inline-block; width: 0; height: 14px; border-left: 2px dashed rgba(255,243,196,.9); vertical-align: -2px; margin-right: 4px; }

/* นำเข้าจาก Apple Health */
.banner.safe { background: rgba(155,232,191,.12); border-color: rgba(155,232,191,.5); color: #E6FFF1; }
.banner.safe .ic { color: var(--ok); }
.banner.safe b { font-size: 1.0625rem; }
.steps-list { margin: 4px 0 4px; padding-left: 1.5em; display: flex; flex-direction: column; gap: 6px; font-size: 1.0625rem; line-height: 1.6; }
.warn-line { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r); background: rgba(255,178,138,.14); border: 1px solid rgba(255,178,138,.6); color: #FFE2D4; font-size: 1.0625rem; line-height: 1.6; }
.warn-line .ic { color: var(--warn); }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; font-size: 0; }
.file-btn:focus-within { outline: 3px solid #fff; outline-offset: 3px; }
.file-btn.busy { opacity: .7; }
.card .btn.danger { margin-top: 8px; }

/* โหมดแสงอุ่น: amber multiply layer + optional dimmer, never takes taps; the idle lock sits above it */
.warm-layer { position: absolute; inset: 0; z-index: 45; pointer-events: none; display: none; }
html.warm .warm-layer { display: block; background: rgba(255, 140, 40, .34); mix-blend-mode: multiply; }
html.warm .warm-layer::after { content: ""; position: absolute; inset: 0; background: #000; opacity: 0; }
html.warm[data-dim="1"] .warm-layer::after { opacity: .14; }
html.warm[data-dim="2"] .warm-layer::after { opacity: .26; }
html.warm[data-dim="3"] .warm-layer::after { opacity: .38; }

/* พักหน้าจอ (idle lock): near-black, dim moon, large clock, hold to return */
.idle { position: absolute; inset: 0; z-index: 60; display: none; flex-direction: column; align-items: center; justify-content: space-between;
  padding: 120px 24px 64px; background: #05060A; color: #BDB8A6; user-select: none; -webkit-user-select: none; touch-action: none; }
.idle.show { display: flex; }
.idle-in { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.idle-moon { width: 44px; height: 44px; margin-bottom: 18px; }
.idle-clock { font-size: 4.5rem; font-weight: 500; line-height: 1.2; letter-spacing: .02em; color: #C9C3AE; font-variant-numeric: tabular-nums; }
.idle-date { font-size: 1.25rem; color: #A9A491; line-height: 1.6; }
.idle-note { margin-top: 10px; font-size: max(14px, 1rem); color: #9C978A; }
.idle-hold { display: flex; flex-direction: column; align-items: center; gap: 12px; min-width: 220px; min-height: 120px; padding: 12px 20px; border: 0; border-radius: 28px;
  background: transparent; color: #BDB8A6; font-size: 1.1875rem; cursor: pointer; }
.hold-ring { position: relative; width: 64px; height: 64px; border-radius: 50%; border: 2px solid #4A4739; overflow: hidden; }
.hold-ring i { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: rgba(201,195,174,.35); transition: height .8s linear; }
.idle.holding .hold-ring i { height: 100%; }
.hold-tx { line-height: 1.5; }
@media (prefers-reduced-motion: reduce) { .idle.holding .hold-ring i { height: 50%; } }
html.motion-off .idle.holding .hold-ring i { height: 50%; }
