/* CreatureFeature base styles: tokens, reset, layout, shared components.
   Game UI lives in game.css, page-specific styles in pages.css. */

/* ---------- Fonts (self-hosted variable WOFF2 subsets, OFL: fonts/LICENSE-OFL.txt) ---------- */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/inter-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/inter-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/fraunces-latin-opsz-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/fraunces-latin-ext-opsz-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Fraunces";
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/fraunces-latin-opsz-italic.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Fraunces";
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/fraunces-latin-ext-opsz-italic.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------- Tokens ---------- */
:root {
  color-scheme: light;
  --bg: #F6F1E7;
  --surface: #FFFFFF;
  --surface-2: #EFE7D6;
  --surface-3: #E6DCC7;
  --ink: #1E2A22;
  --muted: #5E6B61;
  --brand: #1F6F4A;
  --brand-ink: #FFFFFF;
  --brand-deep: #155437;
  --brand-soft: #E1EEE4;
  --accent: #F2B33D;
  --accent-ink: #1E2A22;
  --accent-deep: #C98A12;
  --accent-text: #8A5A00;
  --accent-soft: #FBEBC6;
  --coral: #E4572E;
  --coral-soft: #FBE2D8;
  --good: #2E9E5B;
  --good-soft: #DDF1E4;
  --good-text: #1B7A45;
  --bad: #D64545;
  --bad-soft: #F9E0DE;
  --bad-text: #B83232;
  --skip: #A7A08F;
  --skip-soft: #EDE9E0;
  --border: #DDD3BF;
  --border-strong: #C9BCA2;
  --border-input: #8C8270;
  --focus: #1F6F4A;
  --overlay: rgba(22, 30, 25, 0.55);
  --header-bg: rgba(246, 241, 231, 0.88);

  /* Chart tokens (validated: highlight vs bar ΔE ≥ 15 normal vision, ≥ 8 CVD; see charts.js) */
  --chart-bar: #93B19D;
  --chart-you: #B7791F;
  --chart-grid: #E6DDCB;
  --chart-fill: #1F6F4A;
  --chart-track: #E1EEE4;
  --chart-line: #1F6F4A;

  --shadow-rgb: 45 38 20;
  --shadow-sm: 0 1px 2px rgb(var(--shadow-rgb) / 0.06), 0 1px 1px rgb(var(--shadow-rgb) / 0.04);
  --shadow: 0 1px 2px rgb(var(--shadow-rgb) / 0.06), 0 8px 24px -10px rgb(var(--shadow-rgb) / 0.22);
  --shadow-lg: 0 2px 6px rgb(var(--shadow-rgb) / 0.08), 0 24px 48px -16px rgb(var(--shadow-rgb) / 0.32);

  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-ui: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --fs-xs: 0.75rem;
  --fs-sm: 0.875rem;
  --fs-base: 1rem;
  --fs-md: 1.125rem;
  --fs-lg: 1.375rem;
  --fs-xl: 1.75rem;
  --fs-2xl: clamp(1.9rem, 1.3rem + 2.4vw, 2.6rem);
  --fs-3xl: clamp(2.2rem, 1.3rem + 3.8vw, 3.6rem);

  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius: 16px;
  --radius-lg: 18px;
  --radius-pill: 999px;

  --gutter: 16px;
  --header-h: 60px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0F1712;
    --surface: #17221B;
    --surface-2: #1F2D24;
    --surface-3: #283A2F;
    --ink: #EEF3EC;
    --muted: #9FB0A4;
    --brand: #4CC38A;
    --brand-ink: #0F1712;
    --brand-deep: #2E8A5E;
    --brand-soft: #1A3326;
    --accent: #F2B33D;
    --accent-ink: #1E2A22;
    --accent-deep: #B7791F;
    --accent-text: #F2B33D;
    --accent-soft: #3A2F16;
    --coral: #F07350;
    --coral-soft: #3B2119;
    --good: #3FBF74;
    --good-soft: #173A26;
    --good-text: #6FD99B;
    --bad: #F07070;
    --bad-soft: #3D1D1D;
    --bad-text: #FF9C9C;
    --skip: #7C8579;
    --skip-soft: #26302A;
    --border: #2A3A30;
    --border-strong: #3A4F42;
    --border-input: #6A8272;
    --focus: #8FE3B8;
    --overlay: rgba(4, 8, 6, 0.7);
    --header-bg: rgba(15, 23, 18, 0.86);
    --chart-bar: #4A7560;
    --chart-you: #BD8318;
    --chart-grid: #2A3A30;
    --chart-fill: #4CC38A;
    --chart-track: #22382B;
    --chart-line: #4CC38A;
    --shadow-rgb: 0 0 0;
    --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.3);
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 10px 28px -12px rgb(0 0 0 / 0.6);
    --shadow-lg: 0 2px 6px rgb(0 0 0 / 0.35), 0 28px 56px -18px rgb(0 0 0 / 0.75);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0F1712;
  --surface: #17221B;
  --surface-2: #1F2D24;
  --surface-3: #283A2F;
  --ink: #EEF3EC;
  --muted: #9FB0A4;
  --brand: #4CC38A;
  --brand-ink: #0F1712;
  --brand-deep: #2E8A5E;
  --brand-soft: #1A3326;
  --accent: #F2B33D;
  --accent-ink: #1E2A22;
  --accent-deep: #B7791F;
  --accent-text: #F2B33D;
  --accent-soft: #3A2F16;
  --coral: #F07350;
  --coral-soft: #3B2119;
  --good: #3FBF74;
  --good-soft: #173A26;
  --good-text: #6FD99B;
  --bad: #F07070;
  --bad-soft: #3D1D1D;
  --bad-text: #FF9C9C;
  --skip: #7C8579;
  --skip-soft: #26302A;
  --border: #2A3A30;
  --border-strong: #3A4F42;
  --border-input: #6A8272;
  --focus: #8FE3B8;
  --overlay: rgba(4, 8, 6, 0.7);
  --header-bg: rgba(15, 23, 18, 0.86);
  --chart-bar: #4A7560;
  --chart-you: #BD8318;
  --chart-grid: #2A3A30;
  --chart-fill: #4CC38A;
  --chart-track: #22382B;
  --chart-line: #4CC38A;
  --shadow-rgb: 0 0 0;
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.3);
  --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 10px 28px -12px rgb(0 0 0 / 0.6);
  --shadow-lg: 0 2px 6px rgb(0 0 0 / 0.35), 0 28px 56px -18px rgb(0 0 0 / 0.75);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 16px); }
/* Keep fields that receive focus clear of the sticky submit bar (WCAG 2.4.11). */
html:has(.action-bar) { scroll-padding-bottom: calc(92px + env(safe-area-inset-bottom)); }
body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg);
  background-image:
    radial-gradient(1200px 420px at 50% -120px, var(--brand-soft), transparent 70%);
  background-repeat: no-repeat;
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: var(--fs-base);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img, picture, video, canvas, svg { display: block; max-width: 100%; }
svg { flex-shrink: 0; }
.icon.inline-icon { display: inline-block; vertical-align: -0.15em; }
input, button, textarea, select { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: not-allowed; }
p, h1, h2, h3, h4, h5, h6, li, dd, dt, td, th { overflow-wrap: break-word; }
ul[role="list"], ol[role="list"], .list-reset { list-style: none; padding: 0; }
table { border-collapse: collapse; }
[hidden] { display: none !important; }
::selection { background: var(--accent-soft); color: var(--ink); }

a { color: var(--brand); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }

:focus { outline: none; }
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 6px;
}
.btn:focus-visible, .icon-btn:focus-visible, .chip:focus-visible { border-radius: inherit; }
[tabindex="-1"]:focus { outline: none; }

/* ---------- Typography ---------- */
h1, h2, h3, .display {
  font-family: var(--font-display);
  font-optical-sizing: auto;
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.015em;
  color: var(--ink);
}
h1 { font-size: var(--fs-2xl); }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-lg); line-height: 1.2; }
h4, h5, h6 { font-size: var(--fs-md); font-weight: 650; line-height: 1.3; }
.display-xl { font-size: var(--fs-3xl); line-height: 1.04; letter-spacing: -0.025em; }
.eyebrow {
  font-family: var(--font-ui);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brand);
}
.lead { font-size: var(--fs-md); color: var(--muted); line-height: 1.55; }
.muted { color: var(--muted); }
.text-xs { font-size: var(--fs-xs); }
.text-sm { font-size: var(--fs-sm); }
.text-md { font-size: var(--fs-md); }
.text-lg { font-size: var(--fs-lg); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.bold { font-weight: 700; }
.semibold { font-weight: 600; }
.num, .tabular { font-variant-numeric: tabular-nums; }
.italic { font-style: italic; }
.sci { font-style: italic; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.good-text { color: var(--good-text); }
.bad-text { color: var(--bad-text); }
kbd {
  font-family: var(--font-ui);
  font-size: 0.8em;
  font-weight: 600;
  padding: 0.1em 0.45em;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--surface);
}
hr, .divider { border: 0; border-top: 1px solid var(--border); margin-block: 24px; }

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: calc(1100px + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: max(var(--gutter), env(safe-area-inset-left)) max(var(--gutter), env(safe-area-inset-right));
}
.narrow { max-width: calc(720px + 2 * var(--gutter)); }
.site-main {
  flex: 1 0 auto;
  min-height: calc(100vh - var(--header-h));
  min-height: calc(100dvh - var(--header-h) - env(safe-area-inset-top));
  padding-block: 24px 56px;
  outline: none;
}
.view { animation: view-in 0.28s var(--ease) both; }
@keyframes view-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-xs { display: flex; flex-direction: column; gap: 4px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.stack-lg { display: flex; flex-direction: column; gap: 28px; }
.stack-xl { display: flex; flex-direction: column; gap: 44px; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.row-sm { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row-nowrap { flex-wrap: nowrap; }
.between { justify-content: space-between; }
.center { display: flex; align-items: center; justify-content: center; }
.grow { flex: 1 1 auto; min-width: 0; }
.spacer { flex: 1; }
.grid { display: grid; gap: 16px; }
.grid-2 { display: grid; gap: 16px; grid-template-columns: 1fr; }
.grid-3 { display: grid; gap: 16px; grid-template-columns: 1fr; }
.grid-auto { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }
@media (min-width: 640px) {
  .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 960px) {
  .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; } .mt-8 { margin-top: 32px; } .mt-12 { margin-top: 48px; }
.mb-2 { margin-bottom: 8px; } .mb-4 { margin-bottom: 16px; } .mb-6 { margin-bottom: 24px; }
.w-full { width: 100%; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.section-title h2 { font-size: var(--fs-lg); }

@media (max-width: 759px) { .hide-mobile { display: none !important; } }
@media (min-width: 760px) { .show-mobile { display: none !important; } }

.sr-only, .visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.skip-link {
  position: absolute;
  left: 12px; top: -80px;
  z-index: 200;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: var(--brand);
  color: var(--brand-ink);
  font-weight: 700;
  text-decoration: none;
  transition: top 0.15s var(--ease);
}
.skip-link:focus { top: calc(env(safe-area-inset-top) + 10px); }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  padding-top: env(safe-area-inset-top);
  background: var(--header-bg);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; gap: 12px; height: var(--header-h); }
.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  text-decoration: none;
  min-width: 0;
  border-radius: 12px;
}
.brand-mark { width: 34px; height: 34px; border-radius: 10px; transition: transform 0.35s var(--ease-bounce); }
.brand:hover .brand-mark { transform: rotate(-8deg) scale(1.06); }
.wordmark {
  font-family: var(--font-display);
  font-weight: 750;
  font-size: 1.28rem;
  letter-spacing: -0.02em;
  line-height: 1;
  white-space: nowrap;
}
.wordmark em { font-style: italic; color: var(--brand); font-weight: 700; }
@media (max-width: 350px) { .wordmark { font-size: 1.08rem; } }

.nav-main { display: none; align-items: center; gap: 2px; margin-left: 18px; }
@media (min-width: 760px) { .nav-main { display: flex; } }
.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  color: var(--muted);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.nav-link:hover { color: var(--ink); background: var(--surface-2); }
.nav-link[aria-current="page"] { color: var(--brand); background: var(--brand-soft); }
.nav-link .icon { width: 17px; height: 17px; }

.header-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.icon-btn {
  width: 40px; height: 40px;
  display: inline-grid;
  place-items: center;
  border-radius: 12px;
  color: var(--ink);
  transition: background 0.15s, transform 0.15s var(--ease);
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn .icon { width: 20px; height: 20px; }

.account-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  max-width: 290px;
  padding: 3px 12px 3px 3px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  font-size: 0.92rem;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, transform 0.15s var(--ease);
}
.account-btn:hover { border-color: var(--border-strong); }
.account-btn:active { transform: scale(0.97); }
.account-btn[aria-current="page"] { border-color: var(--brand); }
.account-btn .badge-pro { padding: 2px 7px; }
.avatar {
  width: 32px; height: 32px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 750;
  font-size: 0.9rem;
  line-height: 1;
  position: relative;
}
.avatar.is-pro { background: var(--accent); color: var(--accent-ink); }
.avatar-crown {
  position: absolute;
  right: -3px; top: -5px;
  width: 16px; height: 16px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 0 0 2px var(--surface);
}
.avatar-crown .icon { width: 10px; height: 10px; }
.account-name { min-width: 0; }
@media (max-width: 759px) {
  .account-btn { padding: 3px; border-radius: 50%; width: 40px; justify-content: center; }
  .account-btn .account-name, .account-btn .badge-pro { display: none; }
}
@media (min-width: 760px) { .avatar-crown { display: none; } }
.menu-btn { display: inline-grid; }

.mobile-menu {
  position: fixed;
  left: 0; right: 0;
  top: calc(var(--header-h) + env(safe-area-inset-top));
  z-index: 55;
  max-height: calc(100dvh - var(--header-h) - env(safe-area-inset-top));
  overflow-y: auto;
  padding: 12px max(var(--gutter), env(safe-area-inset-left)) calc(20px + env(safe-area-inset-bottom));
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  animation: menu-in 0.22s var(--ease) both;
}
@keyframes menu-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.mobile-menu nav { display: grid; gap: 4px; }
.mobile-menu .nav-link { padding: 12px 14px; font-size: 1.02rem; color: var(--ink); border-radius: var(--radius-sm); }
.mobile-menu .nav-link .icon { width: 20px; height: 20px; color: var(--brand); }
.mobile-menu .menu-group-label { margin: 12px 14px 4px; }
.mobile-menu-backdrop { position: fixed; inset: 0; z-index: 54; background: var(--overlay); animation: fade-in 0.2s both; }
/* From 760px the main links live in the header, so the menu becomes a compact dropdown. */
@media (min-width: 760px) {
  .mobile-menu {
    left: auto;
    right: max(var(--gutter), calc((100vw - 1100px) / 2));
    top: calc(var(--header-h) + env(safe-area-inset-top) + 6px);
    width: 290px;
    max-height: calc(100dvh - var(--header-h) - 24px);
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
  }
  .mobile-menu .nav-link { padding: 9px 12px; font-size: 0.97rem; }
  .mobile-menu .menu-group-label { margin: 8px 12px 2px; }
  .mobile-menu .menu-primary { display: none; }
  .mobile-menu-backdrop { background: transparent; animation: none; }
}

.route-progress {
  position: fixed;
  top: 0; left: 0;
  z-index: 100;
  height: 3px;
  width: 0;
  background: linear-gradient(90deg, var(--brand), var(--accent));
  border-radius: 0 3px 3px 0;
  opacity: 0;
  transition: width 0.4s var(--ease), opacity 0.3s;
  pointer-events: none;
}
.route-progress.active { opacity: 1; width: 70%; transition: width 8s cubic-bezier(0.1, 0.7, 0.2, 1), opacity 0.1s; }
.route-progress.done { opacity: 0; width: 100%; transition: width 0.2s, opacity 0.35s 0.15s; }

/* ---------- Footer ---------- */
.site-footer {
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  padding: 28px 0 calc(28px + env(safe-area-inset-bottom));
  color: var(--muted);
  font-size: var(--fs-sm);
}
.footer-inner { display: grid; gap: 16px; }
.footer-top { display: flex; align-items: center; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap; }
.footer-brand { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; }
.footer-brand .brand-mark { width: 26px; height: 26px; border-radius: 8px; }
.footer-brand .wordmark { font-size: 1.05rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.footer-links a { display: inline-flex; align-items: center; min-height: 40px; color: var(--ink); text-decoration: none; font-weight: 550; }
.footer-links a:hover { color: var(--brand); text-decoration: underline; }
.footer-note { max-width: 70ch; line-height: 1.6; }
.footer-note a { color: inherit; }
.footer-more { display: grid; gap: 6px; line-height: 1.6; }
.footer-more ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 2px; }
.footer-more a { color: var(--ink); font-weight: 550; }
.footer-more a:hover { color: var(--brand); }
.footer-bottom { display: flex; gap: 8px 16px; flex-wrap: wrap; align-items: center; justify-content: space-between; }

/* ---------- Buttons ---------- */
.btn {
  --btn-bg: var(--surface);
  --btn-fg: var(--ink);
  --btn-border: var(--border-strong);
  --btn-shadow: var(--border-strong);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid var(--btn-border);
  border-radius: var(--radius-sm);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-weight: 650;
  font-size: 0.97rem;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 3px 0 var(--btn-shadow);
  transform: translateY(0);
  transition: transform 0.12s var(--ease), box-shadow 0.12s var(--ease), background 0.15s, border-color 0.15s, filter 0.15s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { filter: brightness(1.04); transform: translateY(-1px); box-shadow: 0 4px 0 var(--btn-shadow); text-decoration: none; }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--btn-shadow); }
.btn .icon { width: 18px; height: 18px; }
.btn:disabled, .btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: 0 3px 0 var(--btn-shadow);
  filter: none;
}
.btn-primary { --btn-bg: var(--brand); --btn-fg: var(--brand-ink); --btn-border: var(--brand); --btn-shadow: var(--brand-deep); }
.btn-accent { --btn-bg: var(--accent); --btn-fg: var(--accent-ink); --btn-border: var(--accent); --btn-shadow: var(--accent-deep); }
.btn-secondary { --btn-bg: var(--surface); --btn-fg: var(--ink); --btn-border: var(--border-strong); --btn-shadow: var(--border-strong); }
.btn-danger { --btn-bg: var(--bad); --btn-fg: #FFFFFF; --btn-border: var(--bad); --btn-shadow: #9E2B2B; }
:root[data-theme="dark"] .btn-danger { --btn-fg: #1B0B0B; --btn-shadow: #A84343; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-danger { --btn-fg: #1B0B0B; --btn-shadow: #A84343; } }
.btn-ghost {
  --btn-bg: transparent;
  --btn-fg: var(--brand);
  --btn-border: transparent;
  box-shadow: none;
}
.btn-ghost:hover { background: var(--brand-soft); box-shadow: none; transform: none; }
.btn-ghost:active { transform: scale(0.97); box-shadow: none; }
.btn-ghost:disabled { box-shadow: none; }
.btn-link { min-height: 0; padding: 0; border: 0; box-shadow: none; background: none; color: var(--brand); font-weight: 600; text-decoration: underline; text-underline-offset: 0.18em; }
.btn-link:hover, .btn-link:active { transform: none; box-shadow: none; }
.btn-sm { min-height: 36px; padding: 7px 13px; font-size: 0.88rem; border-radius: 10px; }
.btn-sm .icon { width: 16px; height: 16px; }
.btn-lg { min-height: 54px; padding: 14px 26px; font-size: 1.08rem; border-radius: var(--radius); }
.btn-lg .icon { width: 20px; height: 20px; }
.btn-xl { min-height: 62px; padding: 16px 30px; font-size: 1.2rem; border-radius: var(--radius-lg); box-shadow: 0 5px 0 var(--btn-shadow); }
.btn-xl:hover { box-shadow: 0 6px 0 var(--btn-shadow); }
.btn-xl:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--btn-shadow); }
.btn-block { display: flex; width: 100%; }
.btn-round { border-radius: var(--radius-pill); }
.btn .btn-arrow { transition: transform 0.2s var(--ease); }
.btn:hover .btn-arrow { transform: translateX(3px); }
.btn[aria-busy="true"] { color: transparent !important; pointer-events: none; }
.btn[aria-busy="true"] > * { visibility: hidden; }
.btn[aria-busy="true"]::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2.5px solid var(--btn-fg);
  border-right-color: transparent;
  animation: spin 0.7s linear infinite;
}
.btn-group { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-group-center { justify-content: center; }
@media (max-width: 480px) { .btn-group-stack > .btn { flex: 1 1 100%; } }

.spinner {
  display: inline-block;
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 3px solid var(--brand-soft);
  border-top-color: var(--brand);
  animation: spin 0.75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Cards ---------- */
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
@media (min-width: 640px) { .card { padding: 24px; } }
.card-lg { border-radius: var(--radius-lg); }
.card-flat { box-shadow: none; }
.card-tinted { background: var(--surface-2); box-shadow: none; }
.card-brand { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.card-brand h1, .card-brand h2, .card-brand h3 { color: inherit; }
.card-tight { padding: 14px 16px; }
.card-link { display: block; color: inherit; text-decoration: none; transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease), border-color 0.18s; }
.card-link:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--border-strong); }
.card-link:active { transform: translateY(-1px); }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-title { font-family: var(--font-display); font-size: var(--fs-lg); font-weight: 700; line-height: 1.2; }

.icon-tile {
  width: 44px; height: 44px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: var(--brand-soft);
  color: var(--brand);
}
.icon-tile .icon { width: 22px; height: 22px; }
.icon-tile.accent { background: var(--accent-soft); color: var(--accent-text); }
.icon-tile.coral { background: var(--coral-soft); color: var(--coral); }
.icon-tile.lg { width: 56px; height: 56px; border-radius: 16px; }
.icon-tile.lg .icon { width: 28px; height: 28px; }

/* ---------- Chips & badges ---------- */
.chip, .badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 650;
  line-height: 1.35;
  white-space: nowrap;
  background: var(--surface-2);
  color: var(--ink);
  border: 1px solid transparent;
}
.chip .icon, .badge .icon { width: 14px; height: 14px; }
.chip-lg { padding: 6px 14px; font-size: 0.9rem; }
.chip-lg .icon { width: 16px; height: 16px; }
button.chip, a.chip { cursor: pointer; text-decoration: none; border-color: var(--border); background: var(--surface); transition: background 0.15s, border-color 0.15s; }
button.chip:hover, a.chip:hover { border-color: var(--border-strong); }
.chip[aria-pressed="true"], .chip[aria-selected="true"], .chip.active { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.badge-pro {
  background: linear-gradient(135deg, #F7C75A, var(--accent) 55%, #E39E22);
  color: var(--accent-ink);
  font-weight: 750;
  letter-spacing: 0.02em;
  box-shadow: inset 0 -1px 0 rgb(0 0 0 / 0.12);
}
.badge-lock { background: var(--surface-2); color: var(--muted); border-color: var(--border); }
.badge-brand { background: var(--brand-soft); color: var(--brand); }
.badge-accent { background: var(--accent-soft); color: var(--ink); }
.badge-good { background: var(--good-soft); color: var(--good-text); }
.badge-bad { background: var(--bad-soft); color: var(--bad-text); }
.badge-skip { background: var(--skip-soft); color: var(--muted); }
.badge-outline { background: transparent; border-color: var(--border-strong); color: var(--muted); }
.streak-chip { background: var(--coral-soft); color: var(--ink); }
.streak-chip .icon { color: var(--coral); }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-weight: 650; font-size: 0.92rem; }
.field .help { font-size: var(--fs-sm); color: var(--muted); }
.field .error-text, .error-text { font-size: var(--fs-sm); color: var(--bad-text); font-weight: 550; }
.input, .select, .textarea {
  width: 100%;
  min-height: 46px;
  padding: 10px 14px;
  border: 1.5px solid var(--border-input);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-size: 1rem;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
  appearance: none;
}
.input::placeholder, .textarea::placeholder { color: var(--muted); opacity: 1; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--ink); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.input[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--bad); }
.input:disabled { opacity: 0.6; background: var(--surface-2); }
.textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
.select {
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235E6B61' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 18px;
}
.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 550; }
.check input { width: 20px; height: 20px; accent-color: var(--brand); }
.form-grid { display: grid; gap: 14px; }
.input-group { display: flex; gap: 8px; }
.input-group .input { flex: 1; min-width: 0; }

/* ---------- Tabs & segmented control ---------- */
.tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 1 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 7px 14px;
  border-radius: 9px;
  color: var(--muted);
  font-weight: 650;
  font-size: 0.92rem;
  white-space: nowrap;
  text-decoration: none;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"], .tab[aria-current="page"], .tab.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm), 0 0 0 1px var(--border);
}
.tab .icon { width: 16px; height: 16px; }
.segmented { display: inline-flex; }
.segmented .tab { flex: 0 0 auto; }

/* ---------- Tables ---------- */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius-sm); }
.table { width: 100%; font-size: 0.95rem; }
.table th, .table td { padding: 11px 12px; text-align: left; vertical-align: middle; }
.table thead th {
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table tbody tr { border-bottom: 1px solid var(--border); }
.table tbody tr:last-child { border-bottom: 0; }
.table tbody tr:hover { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.table .num, .table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table tr.is-you, .table tr.highlight { background: var(--accent-soft); }
.table tr.is-you:hover { background: var(--accent-soft); }
.table-compact th, .table-compact td { padding: 7px 10px; }
@media (max-width: 480px) { .table th, .table td { padding: 10px 8px; } }

/* ---------- Modal ---------- */
html.modal-open { overflow: hidden; }
dialog.modal {
  margin: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  width: min(520px, calc(100vw - 24px));
  max-width: none;
  max-height: calc(100dvh - 24px);
  overflow: visible;
}
dialog.modal.modal-sm { width: min(400px, calc(100vw - 24px)); }
dialog.modal.modal-lg { width: min(720px, calc(100vw - 24px)); }
dialog.modal::backdrop { background: var(--overlay); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); animation: fade-in 0.2s both; }
.modal-card {
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 24px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: pop-in 0.26s var(--ease-bounce) both;
}
.modal-head { display: flex; align-items: flex-start; gap: 12px; padding: 20px 20px 0; }
.modal-head h2 { flex: 1; font-size: var(--fs-lg); padding-top: 6px; }
.modal-close { margin: -4px -6px 0 0; }
.modal-body { padding: 14px 20px 4px; overflow-y: auto; overscroll-behavior: contain; }
.modal-error { margin: 8px 20px 0; }
.modal-actions { display: flex; flex-wrap: wrap-reverse; justify-content: flex-end; gap: 10px; padding: 18px 20px 20px; }
@media (max-width: 480px) {
  .modal-actions > .btn { flex: 1 1 auto; }
}
@keyframes pop-in { from { opacity: 0; transform: translateY(10px) scale(0.97); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Toasts ---------- */
.toast-region {
  position: fixed;
  left: 50%;
  bottom: calc(16px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 8px;
  width: min(440px, calc(100vw - 24px));
  pointer-events: none;
}
.toast-region[popover] {
  inset: auto auto calc(16px + env(safe-area-inset-bottom)) 50%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  overflow: visible;
  height: auto;
}
.toast-region[popover]:popover-open { display: flex; }
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 12px 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: var(--bg);
  box-shadow: var(--shadow-lg);
  font-weight: 550;
  font-size: 0.95rem;
  pointer-events: auto;
  animation: toast-in 0.3s var(--ease-bounce) both;
}
.toast.leaving { animation: toast-out 0.2s var(--ease) both; }
.toast .icon { width: 20px; height: 20px; flex: none; }
.toast-msg { flex: 1; min-width: 0; }
.toast-success .icon { color: var(--good); }
.toast-error .icon { color: var(--bad); }
.toast-warn .icon { color: var(--accent); }
.toast-info .icon { color: var(--brand); }
.toast .toast-close { color: inherit; opacity: 0.7; width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; }
.toast .toast-close:hover { opacity: 1; background: rgb(255 255 255 / 0.1); }
.toast .toast-close .icon { width: 16px; height: 16px; color: inherit; }
.toast-action { color: var(--accent); font-weight: 700; padding: 4px 8px; border-radius: 8px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px) scale(0.97); } }

/* ---------- Skeleton ---------- */
.skeleton { display: flex; flex-direction: column; gap: 12px; }
.sk {
  display: block;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface-3) 45%, var(--surface-2) 90%);
  background-size: 300% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}
.sk-line { height: 14px; }
.sk-title { height: 30px; width: 60%; border-radius: 10px; }
.sk-block { height: 120px; border-radius: var(--radius); }
.sk-circle { width: 44px; height: 44px; border-radius: 50%; }
.sk-btn { height: 48px; width: 220px; border-radius: var(--radius-sm); }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -50% 0; } }

/* ---------- Empty / error / locked states ---------- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  padding: 36px 20px;
}
.empty-state .icon-tile { margin-bottom: 6px; }
.empty-state h2, .empty-state h3 { font-size: var(--fs-lg); }
.empty-state p { color: var(--muted); max-width: 46ch; }
.empty-state .btn-group { margin-top: 10px; justify-content: center; }
.empty-state.is-error .icon-tile { background: var(--bad-soft); color: var(--bad-text); }

.locked-card {
  position: relative;
  overflow: hidden;
  text-align: center;
  padding: 32px 20px;
  background:
    radial-gradient(400px 160px at 50% 0%, var(--accent-soft), transparent 75%),
    var(--surface);
}
.locked-card .icon-tile { margin: 0 auto 14px; background: var(--accent-soft); color: var(--accent-text); }
.locked-card h2 { font-size: var(--fs-xl); margin-bottom: 8px; }
.locked-card p { color: var(--muted); max-width: 48ch; margin-inline: auto; }
.locked-card .price-line { margin-top: 14px; font-weight: 650; color: var(--ink); }
.locked-card .btn-group { justify-content: center; margin-top: 18px; }

.notice {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 0.95rem;
}
.notice .icon { width: 20px; height: 20px; flex: none; margin-top: 1px; color: var(--brand); }
.notice-warn { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.notice-warn .icon { color: var(--accent-text); }
.notice-error { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 35%, transparent); }
.notice-error .icon { color: var(--bad-text); }
.notice-good { background: var(--good-soft); border-color: color-mix(in srgb, var(--good) 35%, transparent); }
.notice-good .icon { color: var(--good-text); }

/* ---------- Charts (see charts.js) ---------- */
.chart { position: relative; width: 100%; color: var(--muted); }
.chart svg { width: 100%; height: auto; overflow: visible; }
.chart .axis-label { fill: var(--muted); font-size: 11px; font-family: var(--font-ui); font-variant-numeric: tabular-nums; }
.chart .you-label { fill: var(--ink); font-size: 11px; font-weight: 700; font-family: var(--font-ui); }
.chart .gridline { stroke: var(--chart-grid); stroke-width: 1; shape-rendering: crispEdges; }
.chart .bar { fill: var(--chart-bar); transition: opacity 0.15s; }
.chart .bar.is-you { fill: var(--chart-you); }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:focus { outline: none; }
.chart .hit:focus-visible + .bar, .chart .bar-group:hover .bar { opacity: 0.8; }
.chart .hover-band { fill: var(--surface-2); opacity: 0; }
.chart .bar-group:hover .hover-band, .chart .bar-group:focus-within .hover-band { opacity: 1; }
.chart-tooltip {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  padding: 7px 10px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--bg);
  font-size: 0.8rem;
  line-height: 1.35;
  white-space: nowrap;
  box-shadow: var(--shadow);
  transform: translate(-50%, calc(-100% - 8px));
}
.chart-tooltip strong { display: block; font-size: 0.95rem; font-variant-numeric: tabular-nums; }
.chart-caption { margin-top: 6px; font-size: var(--fs-xs); color: var(--muted); }
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; font-size: var(--fs-xs); color: var(--muted); }
.chart-legend .key { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.chart-legend .key-bar { background: var(--chart-bar); }
.chart-legend .key-you { background: var(--chart-you); }

/* The label column stops at 45% so long names ellipsize instead of squeezing every bar away. */
.bars { display: grid; grid-template-columns: fit-content(45%) minmax(64px, 1fr) auto; gap: 10px 12px; }
.bars-row { grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; align-items: center; font-size: 0.92rem; }
@supports not (grid-template-columns: subgrid) {
  .bars-row { grid-template-columns: minmax(0, 40%) minmax(64px, 1fr) auto; column-gap: 12px; }
}
.chart-empty {
  display: grid;
  place-items: center;
  min-height: 120px;
  padding: 16px;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 0.95rem;
  text-align: center;
}
.bars-label { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bars-track { position: relative; height: 12px; border-radius: 6px; background: var(--chart-track); overflow: hidden; }
.bars-fill { position: absolute; inset: 0 auto 0 0; border-radius: 6px; background: var(--chart-fill); transform-origin: left; animation: grow-x 0.6s var(--ease) both; }
.bars-value { font-variant-numeric: tabular-nums; font-weight: 650; min-width: 3.5ch; text-align: right; }
.bars-sub { color: var(--muted); font-weight: 500; font-size: 0.85em; margin-left: 4px; }
@keyframes grow-x { from { transform: scaleX(0); } to { transform: scaleX(1); } }

.sparkline { display: inline-block; vertical-align: middle; }
.sparkline .spark-line { fill: none; stroke: var(--chart-line); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sparkline .spark-area { fill: var(--chart-line); opacity: 0.1; }
.sparkline .spark-dot { fill: var(--chart-you); stroke: var(--surface); stroke-width: 2; }

/* ---------- Prose (static pages) ---------- */
.prose { font-size: 1.03rem; line-height: 1.7; }
.prose > * + * { margin-top: 1em; }
.prose h1 { margin-bottom: 0.2em; }
.prose h2 { font-size: var(--fs-lg); margin-top: 2em; }
.prose h3 { font-size: var(--fs-md); margin-top: 1.6em; font-family: var(--font-ui); font-weight: 700; letter-spacing: 0; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li + li { margin-top: 0.4em; }
.prose li::marker { color: var(--brand); }
.prose strong { font-weight: 700; }
.prose .lead { font-size: 1.15rem; }
.prose .table-wrap { margin-top: 1.2em; }
.prose code { font-size: 0.9em; padding: 0.1em 0.35em; border-radius: 6px; background: var(--surface-2); }
.prose blockquote { padding: 12px 16px; border-left: 4px solid var(--accent); background: var(--surface-2); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.page-head { margin-bottom: 24px; }
.page-head .eyebrow { display: block; margin-bottom: 8px; }
.page-head h1 { margin-bottom: 8px; }
.page-updated { font-size: var(--fs-sm); color: var(--muted); }
.share-sample {
  font-family: var(--font-ui);
  white-space: pre;
  line-height: 1.5;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px dashed var(--border-strong);
  overflow-x: auto;
  font-size: 0.95rem;
}
.toc { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

/* ---------- Home ---------- */
.home { display: flex; flex-direction: column; gap: 40px; }
.hero {
  position: relative;
  overflow: hidden;
  padding: 26px 20px 24px;
  border-radius: 22px;
  background:
    radial-gradient(520px 260px at 105% -10%, color-mix(in srgb, var(--accent) 26%, transparent), transparent 70%),
    radial-gradient(420px 260px at -10% 110%, var(--brand-soft), transparent 70%),
    var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
@media (min-width: 760px) { .hero { padding: 44px 48px 40px; } }
.hero-leaves {
  position: absolute;
  right: -30px; bottom: -40px;
  width: 260px; height: 260px;
  color: var(--brand);
  opacity: 0.09;
  pointer-events: none;
}
@media (min-width: 760px) { .hero-leaves { width: 380px; height: 380px; right: -40px; bottom: -80px; opacity: 0.11; } }
.hero-inner { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; max-width: 720px; }
.hero-inner > * { min-width: 0; }
.hero-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.plate-no {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--ink);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
}
.plate-no small { font-family: var(--font-ui); font-size: 0.68rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.hero-date { color: var(--muted); font-weight: 600; font-size: 0.92rem; }
.hero h1 { font-size: var(--fs-3xl); line-height: 1.03; letter-spacing: -0.03em; }
.hero h1 em { font-style: italic; color: var(--brand); }
.hero-sub { font-size: 1.06rem; color: var(--muted); max-width: 52ch; }
.hero-cta { display: flex; align-items: center; gap: 12px 16px; flex-wrap: wrap; }
@media (max-width: 480px) {
  .hero-cta { gap: 10px; }
  .hero-cta .btn-xl { width: 100%; white-space: normal; padding-inline: 18px; font-size: 1.1rem; }
  .hero-cta .btn-lg { flex: 1 1 auto; }
}
.hero-foot { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; padding-top: 4px; font-size: 0.92rem; color: var(--muted); }
.countdown { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--ink); }
.hero-score { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.hero-score .big { font-family: var(--font-ui); font-size: clamp(2.8rem, 2rem + 4vw, 4rem); font-weight: 800; letter-spacing: -0.03em; line-height: 1; color: var(--brand); }
.hero-score .of { font-size: 1.1rem; font-weight: 650; color: var(--muted); }
/* Home: one call to action. */
.hero-play { max-width: 640px; width: 100%; margin: 12px auto 0; text-align: center; }
@media (min-width: 760px) { .hero-play { margin-top: 36px; padding: 48px 48px 40px; } }
.hero-play .hero-inner { justify-items: center; gap: 16px; max-width: none; }
.hero-play .hero-meta, .hero-play .hero-cta, .hero-play .hero-foot, .hero-play .hero-score { justify-content: center; }
.hero-play h1 { font-size: clamp(2rem, 1.4rem + 2.6vw, 3rem); }
.hero-logo { width: 72px; height: 72px; border-radius: 20px; box-shadow: var(--shadow); }
.hero-play .hero-cta .btn-xl { min-width: min(100%, 22rem); justify-content: center; }
.hero-progress { color: var(--muted); font-weight: 650; }
.hero-streak { color: var(--coral); font-weight: 700; }
.hero-streak .icon { color: var(--coral); }

.modes-grid { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 759px) { .modes-grid > :last-child:nth-child(odd) { grid-column: 1 / -1; } }
@media (min-width: 760px) { .modes-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; } }
@media (min-width: 1000px) { .modes-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.mode-card { display: flex; flex-direction: column; gap: 10px; padding: 16px; min-height: 100%; }
@media (min-width: 640px) { .mode-card { padding: 20px; } }
.mode-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.mode-card h3 { font-size: 1.1rem; font-family: var(--font-ui); font-weight: 750; letter-spacing: -0.01em; }
.mode-card p { font-size: 0.88rem; color: var(--muted); line-height: 1.45; }
.mode-card .icon-tile { width: 40px; height: 40px; border-radius: 12px; }
.mode-card .icon-tile .icon { width: 20px; height: 20px; }
.mode-card .go { margin-top: auto; display: inline-flex; align-items: center; gap: 4px; font-weight: 700; font-size: 0.88rem; color: var(--brand); }
.mode-card .go .icon { width: 16px; height: 16px; transition: transform 0.2s var(--ease); }
.mode-card:hover .go .icon { transform: translateX(3px); }
@media (max-width: 400px) {
  .mode-card { padding: 14px; gap: 8px; }
  .mode-card p { font-size: 0.84rem; }
  .mode-card-top .badge { padding: 2px 7px; font-size: 0.72rem; }
}

.modes-page .page-head { margin-bottom: 4px; }
.mode-card h2 { font-size: 1.1rem; font-family: var(--font-ui); font-weight: 750; letter-spacing: -0.01em; }
.mode-daily { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); }
.mode-birder { border-color: color-mix(in srgb, var(--brand) 40%, var(--border)); }
/* The two free dailies share the first row; the Pro modes fill the rows below. */
@media (min-width: 1000px) { .mode-daily, .mode-birder { grid-column: span 2; } }
.pro-banner {
  display: grid;
  gap: 16px;
  align-items: center;
  padding: 24px 20px;
  border-radius: 22px;
  background:
    radial-gradient(420px 200px at 100% 0%, color-mix(in srgb, var(--accent) 40%, transparent), transparent 70%),
    var(--brand);
  color: var(--brand-ink);
  box-shadow: var(--shadow);
}
@media (min-width: 760px) { .pro-banner { grid-template-columns: 1fr auto; padding: 32px 36px; } }
.pro-banner h2 { color: inherit; font-size: var(--fs-xl); }
.pro-banner p { opacity: 0.9; margin-top: 6px; }
.pro-banner .price { font-family: var(--font-ui); font-weight: 800; }

.links-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- 404 & route errors ---------- */
.not-found { text-align: center; padding: 40px 0; }
.not-found .big { font-family: var(--font-display); font-size: clamp(4rem, 3rem + 6vw, 7rem); font-weight: 800; line-height: 1; color: var(--brand); letter-spacing: -0.04em; }

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .btn:hover, .card-link:hover { transform: none; }
}

@media print {
  .site-header, .site-footer, .toast-region, .route-progress { display: none !important; }
  body { background: #fff; color: #000; }
}
