/* ตรีวัย — tokens + base. Palette: burgundy / gold / cream. */
:root {
  color-scheme: light;
  --bg: #fbf5e9; --surface: #ffffff; --surface-2: #f4ead6; --ink: #3b1018; --ink-2: #5e3a42; --muted: #7a5a60;
  --line: #e6d8be; --primary: #7a1f34; --primary-hover: #5f1527; --on-primary: #fff7e6;
  --gold: #c79a3b; --gold-text: #7e5a0b; --gold-soft: #f7e9c4; --red: #b3261e; --ok: #2f7d5b; --focus: #1e5bc6;
  --hero-1: #52122a; --hero-2: #230710; --hero-ink: #fbefd2;
  --ch-paper: #fbf1da; --ch-ink: #2b0b12; --ch-gold: #d9a93f; --ch-gold-d: #b58420; --ch-red: #b3261e; --ch-green: #2f7d4b;
  --shadow-1: 0 1px 2px rgb(59 16 24 / .08), 0 2px 8px rgb(59 16 24 / .06);
  --shadow-2: 0 8px 32px rgb(59 16 24 / .16);
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px;
  --r-sm: 8px; --r: 14px; --r-lg: 22px;
  --fs-xs: .8125rem; --fs-sm: .9375rem; --fs-md: 1rem; --fs-lg: clamp(1.125rem, 1rem + .6vw, 1.3rem);
  --fs-xl: clamp(1.35rem, 1.1rem + 1.2vw, 1.75rem); --fs-2xl: clamp(1.7rem, 1.2rem + 2.4vw, 2.5rem); --fs-3xl: clamp(2.2rem, 1.4rem + 4vw, 3.8rem);
  --font: "Sukhumvit Set", "Leelawadee UI", "Noto Sans Thai", "Thonburi", "Sarabun", "Tahoma", system-ui, -apple-system, "Segoe UI", sans-serif;
  --ease: cubic-bezier(.2, .7, .2, 1);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { color-scheme: dark; --bg: #1a0810; --surface: #2a0e18; --surface-2: #37131f; --ink: #f7ecd3; --ink-2: #d8c3b2; --muted: #b79fa0; --line: #4a2230; --primary: #e6bc62; --primary-hover: #f0cd80; --on-primary: #2a0e10; --gold: #e6bc62; --gold-text: #ebc878; --gold-soft: rgb(230 188 98 / .14); --red: #ff9a8f; --ok: #7bd3a8; --focus: #8fb8ff; --shadow-1: 0 1px 2px rgb(0 0 0 / .4); --shadow-2: 0 8px 32px rgb(0 0 0 / .5); --hero-1: #3a0c1d; --hero-2: #12040a; }
}
:root[data-theme="dark"] { color-scheme: dark; --bg: #1a0810; --surface: #2a0e18; --surface-2: #37131f; --ink: #f7ecd3; --ink-2: #d8c3b2; --muted: #b79fa0; --line: #4a2230; --primary: #e6bc62; --primary-hover: #f0cd80; --on-primary: #2a0e10; --gold: #e6bc62; --gold-text: #ebc878; --gold-soft: rgb(230 188 98 / .14); --red: #ff9a8f; --ok: #7bd3a8; --focus: #8fb8ff; --shadow-1: 0 1px 2px rgb(0 0 0 / .4); --shadow-2: 0 8px 32px rgb(0 0 0 / .5); --hero-1: #3a0c1d; --hero-2: #12040a; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 120px; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 var(--fs-md)/1.75 var(--font); font-feature-settings: "kern"; overflow-x: hidden; min-height: 100vh; }
h1, h2, h3, h4 { line-height: 1.4; margin: 0 0 var(--s3); font-weight: 700; letter-spacing: 0; }
h1 { font-size: var(--fs-3xl); } h2 { font-size: var(--fs-2xl); } h3 { font-size: var(--fs-xl); } h4 { font-size: var(--fs-lg); }
p { margin: 0 0 var(--s3); max-width: 70ch; }
a { color: var(--gold-text); text-underline-offset: 3px; }
img, svg { max-width: 100%; }
table { border-collapse: collapse; width: 100%; }
.num, td.num, .dms { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
.wrap { width: min(1180px, 100% - 32px); margin-inline: auto; }
.muted { color: var(--muted); } .small { font-size: var(--fs-sm); } .xs { font-size: var(--fs-xs); }
.skip { position: absolute; left: -999px; top: 8px; background: var(--primary); color: var(--on-primary); padding: 8px 14px; border-radius: 8px; z-index: 200; }
.skip:focus { left: 8px; }

/* motion toggle: global */
html[data-motion="off"] *, html[data-motion="off"] *::before, html[data-motion="off"] *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
@media (prefers-reduced-motion: reduce) { html:not([data-motion="on"]) *, html:not([data-motion="on"]) *::before, html:not([data-motion="on"]) *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); min-height: 48px; padding: 0 var(--s5); border-radius: 999px; border: 1.5px solid transparent; font: 700 var(--fs-md)/1 var(--font); cursor: pointer; text-decoration: none; background: var(--primary); color: var(--on-primary); transition: transform .2s var(--ease), background .2s, box-shadow .2s; position: relative; overflow: hidden; }
.btn:hover { background: var(--primary-hover); box-shadow: var(--shadow-1); }
.btn:active { transform: scale(.97); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.quiet { background: transparent; color: var(--gold-text); min-height: 44px; padding: 0 var(--s3); }
.btn.sm { min-height: 44px; padding: 0 var(--s4); font-size: var(--fs-sm); }
.btn.gold { background: linear-gradient(135deg, #f0cd80, #d9a93f 55%, #b58420); color: #2a0e10; }
.btn.gold:hover { background: linear-gradient(135deg, #f7dc9a, #e3b650 55%, #c0912a); }
.btn[aria-disabled="true"], .btn:disabled { opacity: .55; cursor: not-allowed; }
.btn svg { width: 20px; height: 20px; flex: none; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; border: 0; background: transparent; color: inherit; display: inline-grid; place-items: center; cursor: pointer; transition: background .2s; }
.icon-btn:hover { background: color-mix(in srgb, currentColor 12%, transparent); }
.icon-btn svg { width: 22px; height: 22px; }
.ic { width: 1.25em; height: 1.25em; vertical-align: -.2em; flex: none; }
/* ripple + sparkle (CTA micro-interaction) */
.btn .rip { position: absolute; border-radius: 50%; background: rgb(255 255 255 / .45); transform: scale(0); animation: rip .6s ease-out forwards; pointer-events: none; }
@keyframes rip { to { transform: scale(4); opacity: 0; } }

/* Wheel tokens: label hues = designer artwork (.ai) on an always-cream disc; lace/ring/card come from the chosen preset (js/palette.js, default gold) */
:root { --w-ink: #111; --w-green: #006838; --w-red: #ED1C24; --w-purple: #662C91; --w-lagna: #BF1E2D; --w-disc: #fffdf8; --w-hl: rgb(138 90 20 / .16);
  --w-lace: #e0b04e; --w-lace2: #f6dc98; --w-blue: #8a5a14; --w-card: #3a0f1d; --w-cardbg: radial-gradient(120% 120% at 50% 0%, #52122a, #230710); --w-glow: rgb(240 200 110 / .55); }
