/* =====================================================================
   Poochievements — design system
   Dark obsidian + glass by default, porcelain-mint light theme.
   ===================================================================== */

:root {
  --font-head: "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

  --bg: #0F172A;
  --bg-deep: #070C18;
  --surface: rgba(30, 41, 59, 0.7);
  --surface-strong: rgba(30, 41, 59, 0.92);
  --surface-soft: rgba(148, 163, 184, 0.08);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #E2E8F0;
  --text-strong: #F8FAFC;
  --text-dim: #94A3B8;
  --text-faint: #64748B;

  --emerald: #10B981;
  --emerald-2: #34D399;
  --emerald-deep: #065F46;
  --gold: #F59E0B;
  --gold-2: #FCD34D;
  --gold-deep: #B45309;
  --danger: #EF4444;
  --danger-bg: rgba(239, 68, 68, 0.12);
  --warning: #F59E0B;
  --warning-bg: rgba(245, 158, 11, 0.12);
  --info: #38BDF8;
  --info-bg: rgba(56, 189, 248, 0.12);
  --success: #10B981;
  --success-bg: rgba(16, 185, 129, 0.12);

  --grad-gold: linear-gradient(135deg, #FDE68A 0%, #F59E0B 45%, #D97706 100%);
  --grad-emerald: linear-gradient(135deg, #34D399 0%, #10B981 50%, #047857 100%);
  --grad-brand: linear-gradient(135deg, #10B981 0%, #F59E0B 100%);

  --shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 6px 18px rgba(0, 0, 0, 0.28);
  --glow-gold: 0 0 24px rgba(245, 158, 11, 0.45);
  --glow-emerald: 0 0 24px rgba(16, 185, 129, 0.4);
  --blur: 16px;
  --radius: 20px;
  --radius-sm: 12px;
  --radius-xs: 8px;
  --porcelain: linear-gradient(160deg, #F8FAFC 0%, #E2E8F0 100%);

  --sidebar-w: 248px;
  --tabbar-h: 68px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #ECFDF5;
  --bg-deep: #D1FAE5;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-strong: rgba(255, 255, 255, 0.96);
  --surface-soft: rgba(15, 23, 42, 0.04);
  --border: rgba(15, 23, 42, 0.08);
  --border-strong: rgba(15, 23, 42, 0.16);
  --text: #1E293B;
  --text-strong: #0F172A;
  --text-dim: #475569;
  --text-faint: #64748B;
  --emerald-2: #059669;
  --gold-2: #B45309;
  --shadow: 0 18px 40px rgba(6, 78, 59, 0.12);
  --shadow-sm: 0 6px 16px rgba(6, 78, 59, 0.1);
  --glow-gold: 0 0 18px rgba(245, 158, 11, 0.3);
  --glow-emerald: 0 0 18px rgba(16, 185, 129, 0.25);
  color-scheme: light;
}

/* ---------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.6 var(--font-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { max-width: 100%; }
a { color: var(--emerald-2); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--gold-2); }
h1, h2, h3, h4 { font-family: var(--font-head); color: var(--text-strong); line-height: 1.2; margin: 0 0 .5em; letter-spacing: -0.01em; }
h1 { font-size: clamp(2rem, 4.6vw, 3.4rem); font-weight: 800; }
h2 { font-size: clamp(1.45rem, 2.8vw, 2.1rem); font-weight: 700; }
h3 { font-size: 1.15rem; font-weight: 700; }
p { margin: 0 0 1em; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 1000; background: var(--gold); color: #1a1205; padding: 10px 16px; border-radius: 10px; font-weight: 700; }
.skip-link:focus { top: 12px; }
.ico { width: 1.25em; height: 1.25em; flex: none; vertical-align: -0.22em; }
.wrap { width: min(1180px, 100% - 32px); margin-inline: auto; }
.muted { color: var(--text-dim); }
.faint { color: var(--text-faint); font-size: .875rem; }
.gold-text { background: var(--grad-gold); -webkit-background-clip: text; background-clip: text; color: transparent; text-shadow: none; }
.glow-title { text-shadow: 0 0 28px rgba(245, 158, 11, 0.35); }
[hidden] { display: none !important; }

/* Ambient aurora */
.aurora { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.aurora span { position: absolute; width: 60vmax; height: 60vmax; border-radius: 50%; filter: blur(90px); opacity: .22; animation: drift 28s ease-in-out infinite alternate; }
.aurora span:nth-child(1) { background: #10B981; top: -25vmax; left: -15vmax; }
.aurora span:nth-child(2) { background: #F59E0B; bottom: -30vmax; right: -20vmax; animation-delay: -9s; opacity: .14; }
.aurora span:nth-child(3) { background: #0EA5E9; top: 30%; left: 45%; width: 35vmax; height: 35vmax; animation-delay: -18s; opacity: .08; }
[data-theme="light"] .aurora span { opacity: .18; }
@keyframes drift { to { transform: translate(6vmax, 4vmax) scale(1.08); } }

/* ---------------------------------------------------------------- glass + cards */
.glass {
  background: var(--surface);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(140%);
  backdrop-filter: blur(var(--blur)) saturate(140%);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.card { border-radius: var(--radius); padding: 22px; }
.card h2, .card h3 { margin-top: 0; }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-title h2, .card-title h3 { margin: 0; font-size: 1.05rem; }
.card-title .ico { color: var(--gold); }

/* ---------------------------------------------------------------- buttons */
.btn {
  --b-bg: var(--surface-soft);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 20px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--b-bg);
  font-weight: 650; text-decoration: none; cursor: pointer; color: var(--text-strong);
  transition: transform .15s ease, box-shadow .2s ease, background .2s ease, opacity .2s;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); color: var(--text-strong); }
.btn:active { transform: translateY(1px) scale(.98); }
.btn[disabled], .btn.is-loading { opacity: .6; pointer-events: none; }
.btn.is-loading::after { content: ""; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.btn-gold { background: var(--grad-gold); color: #241603; border-color: rgba(255, 255, 255, .25); box-shadow: var(--glow-gold); }
.btn-gold:hover { color: #241603; box-shadow: 0 0 34px rgba(245, 158, 11, .6); }
.btn-emerald { background: var(--grad-emerald); color: #02150e; border-color: rgba(255, 255, 255, .2); box-shadow: var(--glow-emerald); }
.btn-emerald:hover { color: #02150e; }
.btn-ghost { background: transparent; }
.btn-danger { background: var(--danger); border-color: transparent; color: #fff; }
.btn-danger:hover { color: #fff; box-shadow: 0 0 24px rgba(239, 68, 68, .45); }
.btn-sm { min-height: 36px; padding: 6px 14px; font-size: .9rem; }
.btn-lg { min-height: 54px; padding: 14px 28px; font-size: 1.05rem; }
.btn-block { width: 100%; }
.icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface-soft); cursor: pointer; color: var(--text); }
.icon-btn:hover { border-color: var(--border-strong); color: var(--gold-2); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- public header */
.site-header { position: sticky; top: 0; z-index: 50; border-radius: 0; border-width: 0 0 1px; box-shadow: none; }
.header-inner { display: flex; align-items: center; gap: 12px; min-height: 68px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text-strong); margin-right: auto; }
.brand:hover { color: var(--text-strong); }
.logo-mark { flex: none; filter: drop-shadow(0 4px 10px rgba(16, 185, 129, .35)); }
.logo-sparkles { animation: twinkle 3s ease-in-out infinite; transform-origin: center; }
@keyframes twinkle { 50% { opacity: .45; } }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font: 800 1.2rem/1.1 var(--font-head); background: var(--grad-gold); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 10px rgba(245, 158, 11, .35)); }
.brand-tag { font-size: .72rem; color: var(--text-dim); letter-spacing: .02em; }
.nav-details { position: relative; }
.nav-details > summary { list-style: none; }
.nav-details > summary::-webkit-details-marker { display: none; }
.nav-toggle { flex-direction: column; gap: 4px; display: inline-flex; }
.nav-toggle span { display: block; width: 18px; height: 2px; background: currentColor; border-radius: 2px; }
.site-nav { position: absolute; right: 0; top: 54px; width: min(320px, 90vw); display: flex; flex-direction: column; gap: 4px; padding: 12px; border-radius: var(--radius); background: var(--surface-strong); border: 1px solid var(--border); box-shadow: var(--shadow); }
.site-nav a { padding: 10px 12px; border-radius: 10px; text-decoration: none; color: var(--text); font-weight: 550; }
.site-nav a:hover, .site-nav a[aria-current] { background: var(--surface-soft); color: var(--gold-2); }
.nav-cta { display: flex; gap: 8px; padding-top: 8px; border-top: 1px solid var(--border); margin-top: 6px; }
.nav-cta .btn { flex: 1; color: var(--text-strong); }
.nav-cta .btn-gold { color: #241603; }
.theme-toggle .ico-moon { display: none; }
[data-theme="light"] .theme-toggle .ico-sun { display: none; }
[data-theme="light"] .theme-toggle .ico-moon { display: block; }
.site-nav-desktop { display: none; }
@media (min-width: 980px) {
  .nav-mobile { display: none; }
  .site-nav-desktop { display: flex; position: static; width: auto; flex-direction: row; align-items: center; gap: 2px; padding: 0; background: none; border: 0; box-shadow: none; }
  .site-nav-desktop a { padding: 8px 10px; font-size: .95rem; }
  .site-nav-desktop .nav-cta { border: 0; padding: 0 0 0 8px; margin: 0; }
  .site-nav-desktop .nav-cta .btn { flex: none; }
}

/* ---------------------------------------------------------------- public sections */
.section { padding: clamp(48px, 8vw, 96px) 0; }
.section-head { max-width: 720px; margin: 0 auto 36px; text-align: center; }
.section-head p { color: var(--text-dim); font-size: 1.08rem; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; background: var(--success-bg); color: var(--emerald-2); font-weight: 650; font-size: .82rem; letter-spacing: .04em; text-transform: uppercase; margin-bottom: 16px; }
.hero { padding: clamp(40px, 7vw, 90px) 0 clamp(40px, 6vw, 70px); }
.hero-grid { display: grid; gap: 36px; align-items: center; }
@media (min-width: 900px) { .hero-grid { grid-template-columns: 1.1fr .9fr; } }
.hero h1 { margin-bottom: 18px; }
.hero .lede { font-size: clamp(1.05rem, 1.6vw, 1.25rem); color: var(--text-dim); max-width: 600px; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin: 26px 0 18px; }
.trust-row { display: flex; flex-wrap: wrap; gap: 8px 18px; color: var(--text-dim); font-size: .9rem; padding: 0; list-style: none; margin: 0; }
.trust-row li::before { content: "✓ "; color: var(--emerald); font-weight: 800; }
.hero-visual { position: relative; display: grid; place-items: center; min-height: 360px; }
.hero-crest { position: relative; z-index: 2; animation: float 6s ease-in-out infinite; filter: drop-shadow(0 30px 50px rgba(16, 185, 129, .35)); }
@keyframes float { 50% { transform: translateY(-12px); } }
.hero-orbit { position: absolute; inset: 0; display: grid; place-items: center; }
.hero-chip { position: absolute; padding: 10px 14px; border-radius: 16px; font-weight: 650; font-size: .88rem; display: flex; align-items: center; gap: 8px; }
.hero-chip.c1 { top: 8%; left: 2%; }
.hero-chip.c2 { top: 18%; right: 0; }
.hero-chip.c3 { bottom: 12%; left: 6%; }
.hero-chip.c4 { bottom: 4%; right: 6%; }
.feature-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.feature { border-radius: var(--radius); padding: 24px; }
.feature .f-ico { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--surface-soft); border: 1px solid var(--border); color: var(--gold); margin-bottom: 14px; }
.feature .f-ico .ico { width: 24px; height: 24px; }
.feature p { color: var(--text-dim); margin: 0; }
.steps { counter-reset: step; display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); padding: 0; list-style: none; }
.steps li { position: relative; padding: 24px 22px 22px 22px; border-radius: var(--radius); }
.steps li::before { counter-increment: step; content: counter(step); position: absolute; top: -14px; left: 20px; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font: 800 1rem var(--font-head); background: var(--grad-gold); color: #241603; box-shadow: var(--glow-gold); }
.cta-band { border-radius: calc(var(--radius) + 8px); padding: clamp(28px, 5vw, 56px); text-align: center; background: radial-gradient(120% 140% at 0% 0%, rgba(16, 185, 129, .28), transparent 55%), radial-gradient(120% 140% at 100% 100%, rgba(245, 158, 11, .25), transparent 55%), var(--surface); }
.cta-band p { color: var(--text-dim); max-width: 620px; margin-inline: auto; }

/* Bristol chart (public + app) */
.bristol-table { display: grid; gap: 14px; }
.bristol-row { display: grid; grid-template-columns: 74px 1fr; gap: 14px 18px; align-items: center; padding: 16px; border-radius: var(--radius); }
@media (min-width: 760px) { .bristol-row { grid-template-columns: 90px 220px 1fr; } }
.bristol-row .type-badge { font: 800 1.05rem var(--font-head); display: grid; place-items: center; text-align: center; width: 74px; height: 74px; border-radius: 18px; background: var(--surface-soft); border: 1px solid var(--border); }
.bristol-row .type-badge small { display: block; font: 600 .66rem var(--font-body); text-transform: uppercase; letter-spacing: .08em; color: var(--text-dim); }
.bristol-row .art { border-radius: 14px; background: var(--porcelain); padding: 6px; grid-column: 1 / -1; }
@media (min-width: 760px) { .bristol-row .art { grid-column: auto; } }
.bristol-row h3 { margin-bottom: 4px; }
.bristol-row p { margin: 0; color: var(--text-dim); }
.zone { display: inline-block; font-size: .72rem; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; padding: 3px 10px; border-radius: 999px; margin-bottom: 6px; }
.zone-constipation { background: var(--warning-bg); color: var(--gold-2); }
.zone-ideal { background: var(--success-bg); color: var(--emerald-2); }
.zone-loose { background: var(--info-bg); color: var(--info); }
.zone-diarrhoea { background: var(--danger-bg); color: #FCA5A5; }
[data-theme="light"] .zone-diarrhoea { color: #B91C1C; }
.colour-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.colour-card { border-radius: var(--radius); padding: 18px; display: grid; grid-template-columns: 56px 1fr; gap: 14px; align-items: start; }
.swatch { width: 56px; height: 56px; border-radius: 50%; box-shadow: inset 0 -8px 16px rgba(0, 0, 0, .35), inset 0 6px 10px rgba(255, 255, 255, .25), 0 6px 14px rgba(0, 0, 0, .35); }
.level-pill { display: inline-block; font-size: .7rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; padding: 2px 9px; border-radius: 999px; margin-bottom: 4px; }
.level-ok { background: var(--success-bg); color: var(--emerald-2); }
.level-info { background: var(--info-bg); color: var(--info); }
.level-warning { background: var(--warning-bg); color: var(--gold-2); }
.level-danger { background: var(--danger-bg); color: #FCA5A5; }
[data-theme="light"] .level-danger { color: #B91C1C; }

/* Article / prose */
.crumbs ol { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0 0 18px; font-size: .88rem; color: var(--text-dim); }
.crumbs li + li::before { content: "›"; margin-right: 6px; color: var(--text-faint); }
.crumbs a { color: var(--text-dim); text-decoration: none; }
.crumbs a:hover { color: var(--gold-2); }
.article-layout { display: grid; gap: 28px; padding: 32px 0 64px; }
@media (min-width: 1000px) { .article-layout { grid-template-columns: minmax(0, 1fr) 300px; } }
.prose { border-radius: var(--radius); padding: clamp(22px, 4vw, 44px); font-size: 1.06rem; }
.prose h2 { margin-top: 1.6em; font-size: 1.45rem; }
.prose h2:first-child { margin-top: 0; }
.prose li { margin-bottom: .4em; }
.prose ul, .prose ol { padding-left: 1.3em; }
.lede-lg { font-size: 1.2rem; color: var(--text-dim); }
.article-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--text-faint); font-size: .88rem; margin-bottom: 20px; }
.callout { border-radius: var(--radius-sm); padding: 14px 18px; margin: 0 0 1.2em; border: 1px solid; }
.callout.danger { background: var(--danger-bg); border-color: rgba(239, 68, 68, .35); }
.callout.info { background: var(--info-bg); border-color: rgba(56, 189, 248, .3); }
.callout.success { background: var(--success-bg); border-color: rgba(16, 185, 129, .3); }
.aside-stack { display: grid; gap: 18px; align-content: start; }
@media (min-width: 1000px) { .aside-stack { position: sticky; top: 90px; } }
.source-list { padding-left: 1.1em; font-size: .9rem; }
.guide-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.guide-card { display: flex; flex-direction: column; border-radius: var(--radius); padding: 22px; text-decoration: none; color: var(--text); transition: transform .2s, border-color .2s; }
.guide-card:hover { transform: translateY(-3px); border-color: rgba(245, 158, 11, .4); color: var(--text); }
.guide-card h2, .guide-card h3 { font-size: 1.12rem; }
.guide-card p { color: var(--text-dim); flex: 1; }
.guide-card .more { color: var(--emerald-2); font-weight: 650; }
.faq-list { display: grid; gap: 12px; max-width: 860px; margin: 0 auto; }
.faq-list details { border-radius: var(--radius-sm); padding: 4px 20px; }
.faq-list summary { cursor: pointer; padding: 14px 0; font-weight: 650; color: var(--text-strong); list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq-list summary::after { content: "+"; font-size: 1.4rem; line-height: 1; color: var(--gold); transition: transform .2s; }
.faq-list details[open] summary::after { transform: rotate(45deg); }
.faq-list details > div { padding-bottom: 14px; color: var(--text-dim); }

/* Donate */
.donate-grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); align-items: start; }
.donate-buttons { display: grid; gap: 12px; }
.donate-btn { justify-content: flex-start; padding: 14px 18px; border-radius: 16px; font-size: 1rem; }
.donate-btn .d-ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; color: #fff; flex: none; }
.donate-btn small { display: block; font-weight: 500; color: var(--text-dim); font-size: .8rem; }
.progress { height: 14px; border-radius: 999px; background: var(--surface-soft); border: 1px solid var(--border); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: var(--grad-brand); box-shadow: var(--glow-gold); transition: width 1s cubic-bezier(.2, .8, .2, 1); }
.cost-table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.cost-table td { padding: 8px 0; border-bottom: 1px solid var(--border); }
.cost-table td:last-child { text-align: right; font-weight: 650; }
.cost-table tr:last-child td { border: 0; font-weight: 800; color: var(--gold-2); }

/* Footer */
.site-footer { margin-top: 40px; border-top: 1px solid var(--border); background: linear-gradient(180deg, transparent, rgba(0, 0, 0, .25)); padding: 48px 0 calc(28px + var(--safe-b)); }
[data-theme="light"] .site-footer { background: linear-gradient(180deg, transparent, rgba(16, 185, 129, .08)); }
.footer-grid { display: grid; gap: 28px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.footer-brand { grid-column: 1 / -1; max-width: 460px; }
@media (min-width: 900px) { .footer-grid { grid-template-columns: 2fr 1fr 1fr 1fr; } .footer-brand { grid-column: auto; } }
.footer-brand p { color: var(--text-dim); font-size: .92rem; }
.site-footer nav { display: flex; flex-direction: column; gap: 6px; }
.site-footer h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; color: var(--text-faint); margin-bottom: 6px; }
.site-footer nav a { color: var(--text-dim); text-decoration: none; font-size: .95rem; }
.site-footer nav a:hover { color: var(--gold-2); }
.footer-legal { margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--border); font-size: .85rem; color: var(--text-faint); }
.disclaimer { color: var(--text-dim); }

/* ---------------------------------------------------------------- forms */
.form-grid { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; }
.field > label, .label { font-weight: 650; font-size: .92rem; color: var(--text-strong); }
.input, .field input:not([type=checkbox]):not([type=radio]):not([type=range]), .field select, .field textarea {
  width: 100%; min-height: 48px; padding: 12px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface-soft); color: var(--text-strong);
  transition: border-color .2s, box-shadow .2s;
}
.field textarea { min-height: 96px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { outline: none; border-color: var(--emerald); box-shadow: 0 0 0 4px rgba(16, 185, 129, .18); }
.field .hint { font-size: .82rem; color: var(--text-faint); }
.field .error, .form-error { font-size: .86rem; color: #FCA5A5; }
[data-theme="light"] .field .error, [data-theme="light"] .form-error { color: #B91C1C; }
.field.has-error input { border-color: var(--danger); }
.form-error:empty, .field .error:empty { display: none; }
.form-success { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--success-bg); border: 1px solid rgba(16, 185, 129, .3); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: .92rem; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--emerald); margin-top: 2px; flex: none; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 52px !important; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; border: 0; color: var(--text-dim); cursor: pointer; padding: 8px; font-size: .8rem; font-weight: 650; }
.pw-meter { height: 6px; border-radius: 6px; background: var(--surface-soft); overflow: hidden; }
.pw-meter span { display: block; height: 100%; width: 0; transition: width .3s, background .3s; }

/* Auth page */
.auth-shell { min-height: calc(100vh - 68px); display: grid; place-items: center; padding: 32px 16px 64px; }
.auth-card { width: min(460px, 100%); border-radius: calc(var(--radius) + 6px); padding: clamp(24px, 5vw, 38px); }
.auth-card .crest { display: flex; justify-content: center; margin-bottom: 8px; }
.auth-card h1 { font-size: 1.7rem; text-align: center; }
.auth-card .sub { text-align: center; color: var(--text-dim); margin-bottom: 22px; }
.auth-links { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; font-size: .9rem; margin-top: 16px; }

/* ---------------------------------------------------------------- APP SHELL */
.layout-app { padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px); }
.app-sidebar { display: none; }
.app-topbar { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 10px; padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top, 0px)); border-radius: 0; border-width: 0 0 1px; box-shadow: none; }
.app-topbar .brand-name { font-size: 1.05rem; }
.topbar-stats { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.stat-pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--surface-soft); border: 1px solid var(--border); font-weight: 700; font-size: .88rem; white-space: nowrap; }
.stat-pill .ico { width: 1.05em; height: 1.05em; }
.stat-pill.flame { color: #FB923C; }
.stat-pill.flame.dead { color: var(--text-faint); }
.stat-pill.lvl { color: var(--gold-2); }
.app-main { width: min(1200px, 100% - 24px); margin: 18px auto 0; }
.tabbar { position: fixed; z-index: 45; left: 8px; right: 8px; bottom: calc(8px + var(--safe-b)); height: var(--tabbar-h); display: grid; grid-template-columns: repeat(5, 1fr); align-items: center; border-radius: 22px; padding: 0 6px; }
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; text-decoration: none; color: var(--text-dim); font-size: .68rem; font-weight: 650; padding: 6px 0; border-radius: 14px; }
.tabbar a .ico { width: 22px; height: 22px; }
.tabbar a[aria-current="page"] { color: var(--gold-2); }
.tabbar .tab-log { position: relative; top: -16px; }
.tabbar .tab-log span.plus { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: var(--grad-gold); color: #241603; box-shadow: var(--glow-gold), 0 10px 20px rgba(0, 0, 0, .4); border: 3px solid var(--bg); }
.tabbar .tab-log span.plus .ico { width: 26px; height: 26px; }
@media (min-width: 1024px) {
  .layout-app { padding-bottom: 0; padding-left: var(--sidebar-w); }
  .tabbar { display: none; }
  .app-topbar .brand { display: none; }
  .app-sidebar { display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); padding: 20px 14px; border-radius: 0; border-width: 0 1px 0 0; z-index: 41; box-shadow: none; }
  .app-sidebar .brand { margin: 0 6px 22px; }
  .side-nav { display: grid; gap: 4px; }
  .side-nav a { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 14px; text-decoration: none; color: var(--text-dim); font-weight: 600; }
  .side-nav a:hover { background: var(--surface-soft); color: var(--text-strong); }
  .side-nav a[aria-current="page"] { background: linear-gradient(90deg, rgba(245, 158, 11, .18), transparent); color: var(--gold-2); box-shadow: inset 3px 0 0 var(--gold); }
  .side-log { margin: 16px 6px; }
  .side-foot { margin-top: auto; display: grid; gap: 6px; padding: 0 6px; }
  .side-foot a, .side-foot button { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 12px; background: none; border: 0; color: var(--text-dim); cursor: pointer; text-decoration: none; font-size: .92rem; text-align: left; }
  .side-foot a:hover, .side-foot button:hover { color: var(--gold-2); background: var(--surface-soft); }
}

.view { animation: viewIn .35s ease; }
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } }
.view-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 6px 0 18px; }
.view-head h1 { font-size: clamp(1.5rem, 3.4vw, 2.2rem); margin: 0; }
.view-head p { margin: 4px 0 0; color: var(--text-dim); }
.grid { display: grid; gap: 16px; }
.grid-2 { display: grid; gap: 16px; }
.grid-3 { display: grid; gap: 16px; }
@media (min-width: 760px) { .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.span-2 { grid-column: 1 / -1; }
.dash-grid { display: grid; gap: 16px; }
@media (min-width: 900px) { .dash-grid { grid-template-columns: repeat(12, minmax(0, 1fr)); } .dash-grid > .c-4 { grid-column: span 4; } .dash-grid > .c-5 { grid-column: span 5; } .dash-grid > .c-6 { grid-column: span 6; } .dash-grid > .c-7 { grid-column: span 7; } .dash-grid > .c-8 { grid-column: span 8; } .dash-grid > .c-12 { grid-column: span 12; } }

/* Hero player card */
.player-card { display: grid; gap: 18px; grid-template-columns: auto 1fr; align-items: center; border-radius: var(--radius); padding: 22px; background: radial-gradient(140% 120% at 0% 0%, rgba(245, 158, 11, .2), transparent 50%), radial-gradient(120% 120% at 100% 100%, rgba(16, 185, 129, .2), transparent 55%), var(--surface); }
.player-card h1 { font-size: clamp(1.3rem, 3vw, 1.9rem); margin-bottom: 2px; }
.player-title { color: var(--gold-2); font-weight: 700; }
.ring { --p: 0; width: 104px; height: 104px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--gold) calc(var(--p) * 1%), rgba(148, 163, 184, .15) 0); position: relative; box-shadow: var(--glow-gold); }
.ring::before { content: ""; position: absolute; inset: 8px; border-radius: 50%; background: var(--bg); }
.ring > * { position: relative; text-align: center; line-height: 1.05; }
.ring b { display: block; font: 800 2rem var(--font-head); color: var(--text-strong); }
.ring small { font-size: .66rem; text-transform: uppercase; letter-spacing: .1em; color: var(--text-dim); }
.xpbar { height: 10px; border-radius: 99px; background: var(--surface-soft); overflow: hidden; border: 1px solid var(--border); margin: 10px 0 6px; }
.xpbar span { display: block; height: 100%; background: var(--grad-gold); border-radius: inherit; transition: width .9s cubic-bezier(.2, .8, .2, 1); box-shadow: var(--glow-gold); }
.quick-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; grid-column: 1 / -1; }
.qs { border-radius: 14px; padding: 10px 12px; background: var(--surface-soft); border: 1px solid var(--border); }
.qs b { display: block; font: 800 1.3rem var(--font-head); color: var(--text-strong); }
.qs span { font-size: .76rem; color: var(--text-dim); }

/* Gauge */
.gauge { position: relative; width: 190px; margin: 0 auto; }
.gauge svg { width: 100%; height: auto; display: block; }
.gauge-num { position: absolute; inset: 40% 0 auto; text-align: center; }
.gauge-num b { font: 800 2.6rem/1 var(--font-head); color: var(--text-strong); }
.gauge-num span { display: block; font-size: .82rem; color: var(--gold-2); font-weight: 700; margin-top: 4px; }
.comp-list { display: grid; gap: 10px; margin-top: 14px; }
.comp { display: grid; grid-template-columns: 96px 1fr 44px; gap: 10px; align-items: center; font-size: .86rem; }
.comp .bar { height: 8px; border-radius: 8px; background: var(--surface-soft); overflow: hidden; }
.comp .bar span { display: block; height: 100%; background: var(--grad-emerald); border-radius: inherit; }
.comp em { font-style: normal; text-align: right; color: var(--text-dim); font-variant-numeric: tabular-nums; }

/* Heatmap */
.heatmap { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 1fr); gap: 3px; overflow-x: auto; padding-bottom: 4px; }
.heatmap i { width: 13px; height: 13px; border-radius: 3px; background: var(--surface-soft); border: 1px solid var(--border); }
.heatmap i[data-l="1"] { background: rgba(16, 185, 129, .35); }
.heatmap i[data-l="2"] { background: rgba(16, 185, 129, .6); }
.heatmap i[data-l="3"] { background: #10B981; }
.heatmap i[data-l="4"] { background: var(--gold); box-shadow: 0 0 6px rgba(245, 158, 11, .6); }
.heat-legend { display: flex; align-items: center; gap: 4px; font-size: .75rem; color: var(--text-faint); margin-top: 8px; justify-content: flex-end; }
.heat-legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }

/* Insights + alerts */
.insight { display: grid; grid-template-columns: 34px 1fr; gap: 12px; align-items: start; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface-soft); font-size: .93rem; }
.insight + .insight { margin-top: 10px; }
.insight .i-ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; }
.insight.info .i-ico { background: var(--info-bg); color: var(--info); }
.insight.success .i-ico { background: var(--success-bg); color: var(--emerald-2); }
.insight.warning .i-ico { background: var(--warning-bg); color: var(--gold-2); }
.insight.danger { border-color: rgba(239, 68, 68, .4); background: var(--danger-bg); }
.insight.danger .i-ico { background: var(--danger); color: #fff; }
.insight strong { display: block; color: var(--text-strong); margin-bottom: 2px; }

/* Log list */
.log-list { display: grid; gap: 10px; }
.log-item { display: grid; grid-template-columns: 76px 1fr auto; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 16px; background: var(--surface-soft); border: 1px solid var(--border); }
.log-item .thumb { background: var(--porcelain); border-radius: 12px; padding: 2px; }
.log-item .thumb svg { display: block; }
.log-item h3 { font-size: .98rem; margin: 0 0 2px; }
.log-item .meta { font-size: .8rem; color: var(--text-dim); display: flex; flex-wrap: wrap; gap: 4px 10px; }
.log-item .tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.tag { font-size: .7rem; font-weight: 650; padding: 2px 8px; border-radius: 999px; background: var(--surface-soft); border: 1px solid var(--border); color: var(--text-dim); }
.tag.flag { background: var(--danger-bg); border-color: rgba(239, 68, 68, .35); color: #FCA5A5; }
[data-theme="light"] .tag.flag { color: #B91C1C; }
.log-actions { display: flex; gap: 4px; }
.log-actions .icon-btn { width: 38px; height: 38px; border-radius: 12px; }
.empty { text-align: center; padding: 30px 16px; color: var(--text-dim); }
.empty .big { font-size: 2.4rem; }

/* ---------------------------------------------------------------- LOGGER */
.log-form { display: grid; gap: 16px; }
@media (min-width: 1100px) { .log-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; } .log-preview { position: sticky; top: 84px; } }
.step-label { display: flex; align-items: center; gap: 10px; font: 700 1rem var(--font-head); color: var(--text-strong); margin-bottom: 12px; }
.step-label .n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: .8rem; background: var(--grad-gold); color: #241603; }
.bristol-matrix { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 620px) { .bristol-matrix { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1300px) { .bristol-matrix { grid-template-columns: repeat(7, minmax(0, 1fr)); } }
.b-card { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 8px; border-radius: 16px; border: 2px solid var(--border); background: var(--surface-soft); cursor: pointer; text-align: left; transition: transform .15s, border-color .2s, box-shadow .2s; }
.b-card:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.b-card[aria-checked="true"] { border-color: var(--gold); box-shadow: var(--glow-gold); background: linear-gradient(180deg, rgba(245, 158, 11, .14), transparent); }
.b-card .art { background: var(--porcelain); border-radius: 10px; }
.b-card .art svg { display: block; width: 100%; height: auto; }
.b-card b { font: 800 .9rem var(--font-head); color: var(--text-strong); }
.b-card span { font-size: .74rem; color: var(--text-dim); line-height: 1.3; }
.b-card .crown-badge { position: absolute; top: 6px; right: 6px; font-size: .9rem; }
.b-card .tip { position: absolute; z-index: 5; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%) translateY(4px); width: 240px; padding: 12px 14px; border-radius: 14px; background: var(--surface-strong); border: 1px solid var(--border-strong); box-shadow: var(--shadow); font-size: .8rem; color: var(--text); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.b-card:hover .tip, .b-card:focus-visible .tip { opacity: 1; transform: translateX(-50%); }
@media (hover: none) { .b-card .tip { display: none; } }
.type-explainer { margin-top: 12px; padding: 12px 14px; border-radius: 14px; background: var(--surface-soft); border: 1px solid var(--border); font-size: .92rem; }

.color-wheel { display: flex; flex-wrap: wrap; gap: 10px; }
.color-opt { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 74px; padding: 8px 4px; border-radius: 16px; border: 2px solid transparent; background: none; cursor: pointer; font-size: .74rem; color: var(--text-dim); font-weight: 600; }
.color-opt .swatch { width: 44px; height: 44px; transition: transform .2s; }
.color-opt:hover .swatch { transform: scale(1.08); }
.color-opt[aria-checked="true"] { border-color: var(--gold); background: var(--surface-soft); color: var(--text-strong); }
.color-opt.danger[aria-checked="true"] { border-color: var(--danger); }

.segmented { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 16px; background: var(--surface-soft); border: 1px solid var(--border); }
.segmented button { border: 0; background: none; padding: 9px 14px; border-radius: 12px; cursor: pointer; color: var(--text-dim); font-weight: 650; font-size: .9rem; min-height: 40px; }
.segmented button[aria-checked="true"] { background: var(--grad-gold); color: #241603; box-shadow: var(--glow-gold); }
.volume-meter { display: flex; align-items: flex-end; gap: 6px; height: 44px; margin-top: 10px; }
.volume-meter i { flex: 1; border-radius: 6px 6px 3px 3px; background: var(--surface-soft); border: 1px solid var(--border); transition: background .25s; }
.volume-meter i.on { background: var(--grad-emerald); box-shadow: var(--glow-emerald); }

.range-row { display: grid; grid-template-columns: 1fr 64px; gap: 14px; align-items: center; }
.pain-face { font-size: 2.2rem; text-align: center; line-height: 1; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 12px; border-radius: 99px; background: linear-gradient(90deg, #10B981, #FCD34D 45%, #F97316 70%, #EF4444); outline-offset: 6px; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 28px; height: 28px; border-radius: 50%; background: #fff; border: 3px solid var(--gold); box-shadow: 0 4px 10px rgba(0, 0, 0, .4); cursor: grab; }
input[type=range]::-moz-range-thumb { width: 24px; height: 24px; border-radius: 50%; background: #fff; border: 3px solid var(--gold); cursor: grab; }
input[type=range].plain { background: linear-gradient(90deg, #38BDF8, #10B981); }
.range-labels { display: flex; justify-content: space-between; font-size: .74rem; color: var(--text-faint); margin-top: 6px; }

.timer-box { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.timer-display { font: 800 2rem var(--font-head); font-variant-numeric: tabular-nums; color: var(--text-strong); min-width: 110px; }
.timer-box .input { width: 100px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--border-strong); background: var(--surface-soft); padding: 8px 14px; border-radius: 999px; cursor: pointer; font-size: .88rem; font-weight: 600; color: var(--text); min-height: 40px; transition: all .15s; }
.chip:hover { border-color: var(--emerald); }
.chip[aria-pressed="true"] { background: var(--success-bg); border-color: var(--emerald); color: var(--emerald-2); }
.chip.warn[aria-pressed="true"] { background: var(--danger-bg); border-color: var(--danger); color: #FCA5A5; }
.preview-art { background: var(--porcelain); border-radius: 16px; padding: 10px; margin-bottom: 12px; }
.preview-art svg { display: block; width: 100%; height: auto; }
.live-alerts { display: grid; gap: 8px; margin-top: 10px; }
.save-bar { position: sticky; bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px); z-index: 30; display: flex; gap: 10px; padding: 10px; border-radius: 20px; }
@media (min-width: 1024px) { .save-bar { bottom: 16px; } }
.save-bar .btn-gold { flex: 1; }

/* ---------------------------------------------------------------- analytics */
.range-tabs { display: inline-flex; }
.chart-box { position: relative; height: 260px; }
.chart-box.tall { height: 320px; }
.chart-fallback { display: grid; place-items: center; height: 100%; color: var(--text-dim); text-align: center; font-size: .9rem; }
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 900px) { .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.kpi { border-radius: 18px; padding: 16px; }
.kpi b { display: block; font: 800 1.7rem var(--font-head); color: var(--text-strong); }
.kpi span { font-size: .8rem; color: var(--text-dim); }
.correl-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.correl-table th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); padding: 8px 6px; border-bottom: 1px solid var(--border); }
.correl-table td { padding: 10px 6px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.lift-bar { display: inline-block; height: 8px; border-radius: 4px; background: var(--grad-brand); vertical-align: middle; margin-right: 6px; min-width: 2px; }
.strength { font-size: .72rem; font-weight: 750; text-transform: uppercase; padding: 2px 8px; border-radius: 99px; }
.strength.strong { background: var(--danger-bg); color: #FCA5A5; }
.strength.moderate { background: var(--warning-bg); color: var(--gold-2); }
.strength.weak, .strength.none { background: var(--surface-soft); color: var(--text-dim); }
.strength.protective { background: var(--success-bg); color: var(--emerald-2); }
.table-scroll { overflow-x: auto; }

/* ---------------------------------------------------------------- trophies */
.level-ladder { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.rung { padding: 10px 12px; border-radius: 14px; background: var(--surface-soft); border: 1px solid var(--border); font-size: .82rem; color: var(--text-dim); }
.rung b { display: block; color: var(--text); font-size: .9rem; }
.rung.done { border-color: rgba(16, 185, 129, .4); }
.rung.done b { color: var(--emerald-2); }
.rung.current { border-color: var(--gold); box-shadow: var(--glow-gold); }
.rung.current b { color: var(--gold-2); }
.badge-filter { margin-bottom: 14px; }
.badge-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.badge { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 18px 12px 14px; border-radius: 20px; }
.badge h3 { font-size: .92rem; margin: 0; }
.badge p { font-size: .76rem; color: var(--text-dim); margin: 0; line-height: 1.35; }
.badge .xp { font-size: .72rem; font-weight: 750; color: var(--gold-2); }
.badge.locked .medal { filter: grayscale(1) brightness(.55); opacity: .55; }
.badge.locked h3 { color: var(--text-dim); }
.medal { --c1: #E7A86A; --c2: #9C5A2B; width: 78px; height: 78px; border-radius: 50%; display: grid; place-items: center; position: relative;
  background: radial-gradient(circle at 32% 28%, rgba(255, 255, 255, .65), transparent 28%), conic-gradient(from 210deg, var(--c1), var(--c2), var(--c1), var(--c2), var(--c1));
  box-shadow: inset 0 -6px 12px rgba(0, 0, 0, .35), inset 0 4px 8px rgba(255, 255, 255, .35), 0 8px 18px rgba(0, 0, 0, .35); }
.medal::before { content: ""; position: absolute; inset: 7px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, .25), transparent 40%), linear-gradient(160deg, #1E293B, #0F172A); box-shadow: inset 0 2px 6px rgba(0, 0, 0, .6); }
.medal svg { position: relative; width: 34px; height: 34px; color: var(--c1); filter: drop-shadow(0 0 6px currentColor); }
.medal.silver { --c1: #F1F5F9; --c2: #94A3B8; }
.medal.gold { --c1: #FDE68A; --c2: #D97706; }
.medal.platinum { --c1: #A7F3D0; --c2: #0EA5E9; animation: shimmer 3s linear infinite; }
@keyframes shimmer { 50% { filter: hue-rotate(40deg) brightness(1.15); } }
.badge time { font-size: .7rem; color: var(--text-faint); }

/* ---------------------------------------------------------------- academy */
.cat-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.cat-card { text-align: left; border-radius: var(--radius); padding: 20px; cursor: pointer; transition: transform .2s, border-color .2s; color: var(--text); }
.cat-card:hover { transform: translateY(-3px); border-color: rgba(16, 185, 129, .5); }
.cat-card .c-ico { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--success-bg); color: var(--emerald-2); margin-bottom: 12px; }
.cat-card h3 { margin-bottom: 4px; }
.cat-card p { font-size: .86rem; color: var(--text-dim); margin: 0; }
.speedrun-card { border-radius: var(--radius); padding: 24px; display: grid; gap: 16px; align-items: center; background: radial-gradient(140% 140% at 100% 0%, rgba(239, 68, 68, .25), transparent 55%), radial-gradient(120% 120% at 0% 100%, rgba(245, 158, 11, .25), transparent 55%), var(--surface); }
@media (min-width: 760px) { .speedrun-card { grid-template-columns: 1fr auto; } }
.quiz-stage { max-width: 760px; margin: 0 auto; border-radius: var(--radius); padding: clamp(18px, 4vw, 32px); }
.quiz-hud { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 18px; }
.quiz-hud .grow { flex: 1; }
.quiz-progress { height: 8px; border-radius: 8px; background: var(--surface-soft); overflow: hidden; margin-bottom: 18px; }
.quiz-progress span { display: block; height: 100%; background: var(--grad-emerald); transition: width .3s; }
.timer-ring { --p: 100; width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--c, var(--emerald)) calc(var(--p) * 1%), var(--surface-soft) 0); font: 800 1.05rem var(--font-head); position: relative; }
.timer-ring::before { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: var(--bg); }
.timer-ring span { position: relative; }
.combo { font: 800 1rem var(--font-head); padding: 6px 12px; border-radius: 999px; background: var(--warning-bg); color: var(--gold-2); }
.combo.hot { background: linear-gradient(90deg, #F97316, #EF4444); color: #fff; animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.06); } }
.q-cat { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--emerald-2); font-weight: 700; }
.q-text { font: 700 clamp(1.1rem, 2.6vw, 1.45rem)/1.35 var(--font-head); color: var(--text-strong); margin: 6px 0 18px; }
.options { display: grid; gap: 10px; }
.option { display: flex; align-items: center; gap: 12px; text-align: left; padding: 14px 16px; border-radius: 16px; border: 2px solid var(--border-strong); background: var(--surface-soft); cursor: pointer; font-weight: 550; transition: all .15s; min-height: 56px; }
.option:hover:not([disabled]) { border-color: var(--emerald); transform: translateX(3px); }
.option .key { width: 28px; height: 28px; flex: none; border-radius: 8px; display: grid; place-items: center; background: var(--surface-soft); border: 1px solid var(--border); font-weight: 800; font-size: .82rem; }
.option.correct { border-color: var(--emerald); background: var(--success-bg); }
.option.wrong { border-color: var(--danger); background: var(--danger-bg); animation: shake .35s; }
.option[disabled] { cursor: default; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.explain { margin-top: 16px; padding: 14px 16px; border-radius: 16px; border: 1px solid var(--border); background: var(--surface-soft); animation: viewIn .3s; }
.explain strong { display: block; margin-bottom: 4px; }
.xp-float { position: fixed; z-index: 300; pointer-events: none; font: 800 1.3rem var(--font-head); color: var(--gold-2); text-shadow: 0 0 12px rgba(245, 158, 11, .7); animation: floatUp 1.2s ease-out forwards; }
@keyframes floatUp { to { transform: translateY(-70px); opacity: 0; } }
.result-big { text-align: center; }
.result-big .score { font: 800 3.4rem var(--font-head); }

/* ---------------------------------------------------------------- donate card (in-app) */
.support-card { border-radius: var(--radius); padding: 20px; background: radial-gradient(120% 120% at 100% 0%, rgba(244, 114, 182, .2), transparent 55%), var(--surface); }

/* ---------------------------------------------------------------- modal + toast */
.modal-backdrop { position: fixed; inset: 0; z-index: 200; background: rgba(2, 6, 23, .7); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 16px; animation: fadeIn .2s; }
@keyframes fadeIn { from { opacity: 0; } }
.modal { width: min(560px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; border-radius: calc(var(--radius) + 4px); padding: 26px; background: var(--surface-strong); border: 1px solid var(--border-strong); box-shadow: var(--shadow); animation: popIn .3s cubic-bezier(.2, 1.2, .4, 1); }
@keyframes popIn { from { transform: scale(.92); opacity: 0; } }
.modal h2 { font-size: 1.35rem; }
.modal-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.modal.danger { border-color: rgba(239, 68, 68, .55); box-shadow: 0 0 0 4px rgba(239, 68, 68, .15), var(--shadow); }
.modal .m-ico { width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center; margin-bottom: 12px; }
.modal.danger .m-ico { background: var(--danger); color: #fff; }
.reward-list { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 6px; }
.reward-list li { display: flex; justify-content: space-between; padding: 8px 12px; border-radius: 12px; background: var(--surface-soft); font-size: .92rem; }
.reward-list li b { color: var(--gold-2); }
.unlock { text-align: center; }
.unlock .medal { margin: 6px auto 12px; width: 110px; height: 110px; animation: popIn .6s cubic-bezier(.2, 1.4, .4, 1); }
.unlock .medal svg { width: 48px; height: 48px; }
.toasts { position: fixed; z-index: 250; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar-h) + var(--safe-b) + 24px); display: grid; gap: 8px; width: min(440px, calc(100% - 24px)); }
@media (min-width: 1024px) { .toasts { bottom: 24px; left: auto; right: 24px; transform: none; } }
.toast { padding: 12px 16px; border-radius: 14px; background: var(--surface-strong); border: 1px solid var(--border-strong); box-shadow: var(--shadow); font-weight: 600; font-size: .93rem; animation: popIn .25s; display: flex; gap: 10px; align-items: center; }
.toast.error { border-color: rgba(239, 68, 68, .6); }
.toast.success { border-color: rgba(16, 185, 129, .6); }

/* Skeleton */
.skeleton { border-radius: var(--radius); min-height: 140px; background: linear-gradient(90deg, var(--surface-soft) 25%, rgba(148, 163, 184, .14) 50%, var(--surface-soft) 75%); background-size: 200% 100%; animation: shimmerBg 1.2s infinite; }
@keyframes shimmerBg { to { background-position: -200% 0; } }

/* Settings danger zone */
.danger-zone { border: 1px solid rgba(239, 68, 68, .4) !important; }
.danger-zone h2 { color: #FCA5A5; }
[data-theme="light"] .danger-zone h2 { color: #B91C1C; }
.setting-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.setting-row:last-child { border: 0; }
.setting-row p { margin: 2px 0 0; color: var(--text-dim); font-size: .88rem; }

/* 404 */
.notfound { text-align: center; padding: 80px 16px; }
.notfound .art { width: min(320px, 80vw); margin: 0 auto 20px; background: var(--porcelain); border-radius: 24px; padding: 10px; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* ---------------------------------------------------------------- printable doctor report */
.report-page { background: #fff; color: #0F172A; font-size: 13px; }
.report-page .aurora, .report-page .skip-link { display: none; }
.report { max-width: 900px; margin: 0 auto; padding: 32px 28px 60px; }
.report h1 { color: #0F172A; font-size: 1.7rem; margin: 0; }
.report h2 { color: #065F46; font-size: 1.1rem; margin: 22px 0 8px; padding-bottom: 4px; border-bottom: 2px solid #D1FAE5; }
.report-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; border-bottom: 3px solid #10B981; padding-bottom: 14px; }
.report-head .meta { text-align: right; font-size: 12px; color: #475569; }
.report-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 18px; padding: 12px; border-radius: 12px; background: #F1F5F9; }
.report-toolbar .btn { color: #0F172A; border-color: #CBD5E1; }
.report-toolbar .btn-gold { color: #241603; }
.report-toolbar label { font-size: 13px; color: #334155; }
.report-toolbar select, .report-toolbar input { min-height: 36px; padding: 4px 8px; border-radius: 8px; border: 1px solid #CBD5E1; background: #fff; color: #0F172A; }
.r-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 10px; }
.r-kpis div { border: 1px solid #E2E8F0; border-radius: 10px; padding: 8px 10px; }
.r-kpis b { display: block; font-size: 1.3rem; color: #0F172A; }
.r-kpis span { font-size: 11px; color: #64748B; }
.report table { width: 100%; border-collapse: collapse; font-size: 12px; }
.report th, .report td { border: 1px solid #E2E8F0; padding: 5px 7px; text-align: left; vertical-align: top; }
.report th { background: #F8FAFC; color: #334155; }
.report tr.flagged td { background: #FEF2F2; }
.report .flagnote { color: #B91C1C; font-weight: 700; }
.report .two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.report .bars div { display: grid; grid-template-columns: 150px 1fr 40px; gap: 8px; align-items: center; margin-bottom: 4px; font-size: 12px; }
.report .bars i { display: block; height: 10px; background: #10B981; border-radius: 3px; }
.report .note { font-size: 11px; color: #64748B; margin-top: 20px; border-top: 1px solid #E2E8F0; padding-top: 8px; }
@media print {
  @page { size: A4; margin: 14mm; }
  .no-print { display: none !important; }
  .report { padding: 0; }
  .report h2 { break-after: avoid; }
  .report tr, .report .r-kpis { break-inside: avoid; }
  body { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* App top-bar account menu stays a dropdown at every width */
.app-topbar .menu-more { position: relative; display: block; }
.app-topbar .menu-more > summary { display: inline-grid; }
.app-topbar .menu-more > .site-nav { position: absolute; right: 0; top: 52px; width: 240px; flex-direction: column; align-items: stretch; padding: 10px; background: var(--surface-strong); border: 1px solid var(--border); box-shadow: var(--shadow); border-radius: var(--radius); }
.app-topbar .menu-more:not([open]) > .site-nav { display: none; }
.app-topbar .menu-more .btn { margin-top: 4px; }
@media (min-width: 1024px) { .app-topbar .menu-more { display: none; } }

/* ---- layout hardening: grid children may shrink below content width ---- */
.dash-grid, .grid, .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 760px) { .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 900px) { .dash-grid { grid-template-columns: repeat(12, minmax(0, 1fr)); } }
.dash-grid > *, .grid > *, .grid-2 > *, .grid-3 > * { min-width: 0; }
.player-card { grid-template-columns: auto minmax(0, 1fr); }
@media (max-width: 420px) {
  .app-topbar .brand-name { display: none; }
  .player-card { padding: 16px; gap: 14px; }
  .ring { width: 84px; height: 84px; }
  .ring b { font-size: 1.6rem; }
  .quick-stats { gap: 6px; }
  .qs { padding: 8px; }
  .qs b { font-size: 1.1rem; }
}
/* Heatmap scales to the card instead of overflowing (latest week always visible) */
.heatmap { grid-auto-columns: minmax(0, 1fr); overflow: visible; gap: 2px; }
.heatmap i { width: auto; height: auto; aspect-ratio: 1; border-radius: 2px; }
/* Locked trophies stay grey even if their tier animates */
.badge.locked .medal { animation: none; }
/* Hero chips float above the crest */
.hero-chip { z-index: 3; }
/* Dropdown menus: solid, blurred backdrop so page text never shows through */
.nav-mobile .site-nav, .app-topbar .menu-more > .site-nav { background: var(--surface-strong); -webkit-backdrop-filter: blur(24px) saturate(150%); backdrop-filter: blur(24px) saturate(150%); }
:root:not([data-theme="light"]) .nav-mobile .site-nav, :root:not([data-theme="light"]) .app-topbar .menu-more > .site-nav { background: rgba(15, 23, 42, .97); }
[data-theme="light"] .brand-name { background: linear-gradient(135deg, #D97706, #92400E); -webkit-background-clip: text; background-clip: text; filter: none; }

/* =====================================================================
   v1.1 — engagement, games, shop, leaderboards, calendar, wrapped
   ===================================================================== */

/* ---- Purchasable accent themes (override brand accents only) ---- */
[data-accent="amethyst"] { --gold: #A855F7; --gold-2: #E9D5FF; --gold-deep: #6B21A8; --grad-gold: linear-gradient(135deg, #F5D0FE 0%, #C084FC 45%, #9333EA 100%); --glow-gold: 0 0 24px rgba(168, 85, 247, .45); --emerald: #EC4899; --emerald-2: #F9A8D4; --grad-emerald: linear-gradient(135deg, #F9A8D4, #EC4899 50%, #BE185D); --grad-brand: linear-gradient(135deg, #EC4899, #A855F7); }
[data-accent="ocean"] { --gold: #06B6D4; --gold-2: #A5F3FC; --gold-deep: #0E7490; --grad-gold: linear-gradient(135deg, #CFFAFE 0%, #22D3EE 45%, #0891B2 100%); --glow-gold: 0 0 24px rgba(6, 182, 212, .45); --emerald: #3B82F6; --emerald-2: #93C5FD; --grad-emerald: linear-gradient(135deg, #93C5FD, #3B82F6 50%, #1D4ED8); --grad-brand: linear-gradient(135deg, #3B82F6, #06B6D4); }
[data-accent="rose"] { --gold: #FB7185; --gold-2: #FECDD3; --gold-deep: #BE123C; --grad-gold: linear-gradient(135deg, #FFE4E6 0%, #FDA4AF 40%, #F59E0B 100%); --glow-gold: 0 0 24px rgba(251, 113, 133, .45); --emerald: #F59E0B; --emerald-2: #FCD34D; --grad-emerald: linear-gradient(135deg, #FDE68A, #F59E0B 50%, #B45309); --grad-brand: linear-gradient(135deg, #FB7185, #F59E0B); }
[data-accent="forest"] { --gold: #84CC16; --gold-2: #D9F99D; --gold-deep: #4D7C0F; --grad-gold: linear-gradient(135deg, #ECFCCB 0%, #A3E635 45%, #65A30D 100%); --glow-gold: 0 0 24px rgba(132, 204, 22, .45); --emerald: #22C55E; --emerald-2: #86EFAC; --grad-emerald: linear-gradient(135deg, #86EFAC, #22C55E 50%, #15803D); --grad-brand: linear-gradient(135deg, #22C55E, #84CC16); }
[data-theme="light"][data-accent="amethyst"] { --gold-2: #7E22CE; --emerald-2: #BE185D; }
[data-theme="light"][data-accent="ocean"] { --gold-2: #0E7490; --emerald-2: #1D4ED8; }
[data-theme="light"][data-accent="rose"] { --gold-2: #BE123C; --emerald-2: #B45309; }
[data-theme="light"][data-accent="forest"] { --gold-2: #4D7C0F; --emerald-2: #15803D; }

/* ---- Top bar coin pill ---- */
.stat-pill.coin { color: #FCD34D; text-decoration: none; }
[data-theme="light"] .stat-pill.coin { color: #B45309; }
.stat-pill.coin.big { font-size: 1.1rem; padding: 8px 16px; }
.stat-pill.flame.dead { opacity: .6; }

/* ---- Player card avatar ---- */
.player-av { position: relative; display: block; line-height: 0; filter: drop-shadow(0 10px 22px rgba(16, 185, 129, .35)); transition: transform .2s; }
.player-av:hover { transform: scale(1.04) rotate(-2deg); }
.lvl-chip { position: absolute; bottom: -2px; left: 50%; transform: translateX(-50%); line-height: 1; padding: 4px 10px; border-radius: 999px; background: var(--grad-gold); color: #241603; font: 800 .78rem var(--font-head); box-shadow: var(--glow-gold); white-space: nowrap; }
.quick-stats.four { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 640px) { .quick-stats.four { grid-template-columns: repeat(4, 1fr); } }
a.qs { text-decoration: none; color: inherit; transition: border-color .2s; }
a.qs:hover { border-color: var(--gold); }
.avatar { display: block; max-width: 100%; height: auto; }

/* ---- Streak at risk ---- */
.risk-banner { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-radius: var(--radius); text-decoration: none; color: var(--text-strong); background: linear-gradient(90deg, rgba(249, 115, 22, .25), rgba(239, 68, 68, .15)); border: 1px solid rgba(249, 115, 22, .5); animation: pulse 2.4s ease-in-out infinite; }
.risk-banner > .ico { width: 34px; height: 34px; color: #FB923C; flex: none; }
.risk-banner div { flex: 1; display: flex; flex-direction: column; }
.risk-banner span:not(.btn) { color: var(--text-dim); font-size: .9rem; }
.risk-banner:hover { color: var(--text-strong); }

/* ---- Quests ---- */
.quest-list { display: grid; gap: 10px; }
.quest { display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: center; padding: 12px; border-radius: 16px; background: var(--surface-soft); border: 1px solid var(--border); }
.quest .q-ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--warning-bg); color: var(--gold-2); }
.quest .q-body { display: flex; flex-direction: column; min-width: 0; }
.quest .q-body > span { font-size: .84rem; color: var(--text-dim); }
.quest small { font-size: .74rem; color: var(--text-faint); margin-top: 3px; }
.q-bar { height: 6px; border-radius: 6px; background: rgba(148, 163, 184, .15); overflow: hidden; margin-top: 6px; }
.q-bar span { display: block; height: 100%; background: var(--grad-gold); border-radius: inherit; transition: width .6s; }
.quest.ready { border-color: var(--gold); box-shadow: var(--glow-gold); }
.quest.ready .q-bar span { background: var(--grad-emerald); }
.quest.claimed { opacity: .6; }
.quest.claimed .q-ico { background: var(--success-bg); color: var(--emerald-2); }
.q-done { color: var(--emerald-2); }
.q-done .ico { width: 26px; height: 26px; }
.chest { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 16px; border-radius: 18px; border: 1px dashed var(--gold); background: linear-gradient(90deg, rgba(245, 158, 11, .14), transparent); color: var(--text-strong); text-align: left; cursor: pointer; }
.chest div { display: flex; flex-direction: column; }
.chest.opened { border-style: solid; border-color: var(--border); background: var(--surface-soft); cursor: default; }
.chest-art { font-size: 2.4rem; line-height: 1; }
.chest-art.bounce { animation: bounce 1.6s ease-in-out infinite; }
.chest-art.shake-open { animation: chestShake .6s ease-in-out; }
.chest-big { font-size: 4rem; animation: popIn .6s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px) rotate(-4deg); } }
@keyframes chestShake { 20% { transform: rotate(-14deg) scale(1.1); } 40% { transform: rotate(14deg) scale(1.15); } 60% { transform: rotate(-10deg) scale(1.2); } 80% { transform: rotate(8deg) scale(1.25); } }
.earn-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.earn-grid div { padding: 12px; border-radius: 14px; background: var(--surface-soft); border: 1px solid var(--border); display: flex; flex-direction: column; }
.earn-grid b { font-family: var(--font-head); color: var(--gold-2); }
.earn-grid span { font-size: .82rem; color: var(--text-dim); }

/* ---- Daily challenges card ---- */
.challenge { display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 14px; text-decoration: none; color: var(--text); border: 1px solid var(--border); background: var(--surface-soft); margin-bottom: 8px; transition: border-color .2s, transform .2s; }
.challenge:hover { border-color: var(--gold); transform: translateX(3px); color: var(--text); }
.challenge div { display: flex; flex-direction: column; }
.challenge span:not(.ch-ico) { font-size: .82rem; color: var(--text-dim); }
.ch-ico { font-size: 1.5rem; text-align: center; }
.fact { margin-top: 12px; padding: 12px 14px; border-radius: 14px; background: var(--info-bg); border: 1px solid rgba(56, 189, 248, .3); font-size: .9rem; }
.fact strong { display: block; margin-bottom: 2px; }

/* ---- Weekly comparison ---- */
.wk-headline { font-weight: 650; color: var(--text-strong); }
.wk-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 640px) { .wk-grid { grid-template-columns: repeat(4, 1fr); } }
.wk { padding: 12px; border-radius: 14px; background: var(--surface-soft); border: 1px solid var(--border); display: flex; flex-direction: column; }
.wk span { font-size: .76rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: .05em; }
.wk b { font: 800 1.5rem var(--font-head); color: var(--text-strong); }
.wk small { font-size: .74rem; color: var(--text-faint); }
.delta { font-size: .78rem; font-weight: 700; }
.delta.up { color: var(--emerald-2); }
.delta.down { color: #F87171; }

/* ---- Records ---- */
.rec-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.rec { padding: 14px; border-radius: 16px; background: var(--surface-soft); border: 1px solid var(--border); display: flex; flex-direction: column; }
.rec > span { font-size: 1.4rem; }
.rec b { font: 800 1.4rem var(--font-head); color: var(--text-strong); }
.rec small { font-size: .76rem; color: var(--text-dim); }
.daypart { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.daypart div { padding: 12px; border-radius: 14px; background: var(--surface-soft); border: 1px solid var(--border); display: flex; flex-direction: column; }
.daypart span { font-size: .8rem; color: var(--text-dim); }
.daypart b { font: 800 1.2rem var(--font-head); }
.daypart small { font-size: .74rem; color: var(--text-faint); }
.heat-table { width: 100%; border-collapse: separate; border-spacing: 3px; font-size: .82rem; }
.heat-table th { font-weight: 600; color: var(--text-dim); text-align: left; padding: 4px 6px; white-space: nowrap; }
.heat-table thead th { text-align: center; font-size: .72rem; }
.heat-table td { text-align: center; border-radius: 6px; padding: 8px 4px; min-width: 38px; background: rgba(239, 68, 68, calc(.06 + var(--h) * .8)); color: var(--text-strong); font-weight: 700; }

/* ---- Games hub ---- */
.game-feature { display: grid; grid-template-columns: auto 1fr; gap: 22px; align-items: center; padding: 22px; border-radius: var(--radius); background: radial-gradient(120% 140% at 0% 0%, rgba(16, 185, 129, .3), transparent 55%), var(--surface); }
.game-feature h2 { margin: 4px 0; }
.turdle-mini { display: grid; gap: 4px; }
.turdle-mini div { display: flex; gap: 4px; }
.turdle-mini i { width: 22px; height: 22px; border-radius: 5px; background: #334155; }
.turdle-mini i.correct, .t-cell.correct, .keyboard .correct { background: #10B981; border-color: #10B981; color: #fff; }
.turdle-mini i.present, .t-cell.present, .keyboard .present { background: #F59E0B; border-color: #F59E0B; color: #fff; }
.turdle-mini i.absent, .t-cell.absent, .keyboard .absent { background: #334155; border-color: #334155; color: #CBD5E1; }
.game-card { border-top: 3px solid var(--gc); }
.game-card .c-ico { background: color-mix(in srgb, var(--gc) 18%, transparent); color: var(--gc); }
.game-stage { max-width: 820px; }
.hud-extra:empty { display: none; }
.game-lines { display: grid; gap: 6px; margin: 14px 0; color: var(--text-dim); }

/* Turdle */
.turdle-grid { display: grid; gap: 6px; justify-content: center; margin: 10px 0 14px; }
.t-row { display: grid; grid-template-columns: repeat(5, 54px); gap: 6px; }
.t-row.shake { animation: shake .35s; }
.t-cell { width: 54px; height: 54px; display: grid; place-items: center; border: 2px solid var(--border-strong); border-radius: 10px; font: 800 1.6rem var(--font-head); text-transform: uppercase; color: var(--text-strong); }
.t-cell.typed { border-color: var(--text-dim); animation: popIn .12s; }
.t-cell.correct, .t-cell.present, .t-cell.absent { animation: flip .5s ease both; animation-delay: var(--d); }
@keyframes flip { 0% { transform: rotateX(90deg); } 100% { transform: rotateX(0); } }
.turdle-msg { max-width: 520px; margin: 0 auto 12px; text-align: center; }
.keyboard { display: grid; gap: 6px; max-width: 520px; margin: 0 auto; }
.keyboard div { display: flex; gap: 5px; justify-content: center; }
.keyboard button { flex: 1; max-width: 44px; height: 52px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface-soft); color: var(--text-strong); font-weight: 700; cursor: pointer; padding: 0; }
.keyboard button.wide { max-width: 70px; flex: 1.5; font-size: .72rem; }
@media (max-width: 420px) { .t-row { grid-template-columns: repeat(5, 48px); } .t-cell { width: 48px; height: 48px; font-size: 1.4rem; } .keyboard button { height: 46px; } }

/* Bristol Sorter */
.sorter-top { display: flex; justify-content: center; align-items: center; gap: 10px; margin-bottom: 12px; }
.sorter-art { background: var(--porcelain); border-radius: 20px; padding: 10px; max-width: 360px; margin: 0 auto; }
.sorter-art svg { display: block; width: 100%; height: auto; }
.sorter-buttons { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
@media (min-width: 640px) { .sorter-buttons { grid-template-columns: repeat(7, 1fr); } }
.sorter-btn { flex-direction: column; gap: 0; border-radius: 14px; min-height: 64px; padding: 6px; white-space: normal; }
.sorter-btn b { font: 800 1.3rem var(--font-head); }
.sorter-btn small { font-size: .62rem; color: var(--text-dim); font-weight: 500; line-height: 1.1; }
.flash-ok { background: var(--success-bg) !important; border-color: var(--emerald) !important; }
.flash-bad { background: var(--danger-bg) !important; border-color: var(--danger) !important; animation: shake .3s; }

/* Fibre Builder */
.fibre-meter { max-width: 560px; margin: 12px auto 16px; }
.fm-bar { position: relative; height: 18px; border-radius: 999px; background: var(--surface-soft); border: 1px solid var(--border); overflow: hidden; }
.fm-bar span { display: block; height: 100%; border-radius: inherit; transition: width .4s cubic-bezier(.2, .8, .2, 1); }
.fm-bar i { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--text-strong); }
.fm-label { text-align: center; font-size: .9rem; color: var(--text-dim); margin-top: 6px; }
.fm-label b { color: var(--text-strong); font-family: var(--font-head); }
.food-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
@media (min-width: 640px) { .food-grid { grid-template-columns: repeat(4, 1fr); } }
.food-card { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 6px 10px; border-radius: 16px; border: 2px solid var(--border); background: var(--surface-soft); cursor: pointer; color: var(--text); text-align: center; transition: transform .15s, border-color .2s; }
.food-card:hover { transform: translateY(-2px); }
.food-card .fe { font-size: 1.8rem; }
.food-card b { font-size: .8rem; line-height: 1.2; }
.food-card small { font-size: .68rem; color: var(--text-faint); }
.food-card .fg { position: absolute; top: 6px; right: 8px; font-size: .68rem; font-weight: 800; color: var(--gold-2); }
.food-card[aria-pressed="true"] { border-color: var(--emerald); background: var(--success-bg); }

/* Memory Match */
.memory-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; perspective: 900px; }
.mem-card { aspect-ratio: 3 / 4; border: 0; background: none; padding: 0; cursor: pointer; }
@media (min-width: 640px) { .mem-card { aspect-ratio: 4 / 3; } }
.mem-inner { position: relative; display: block; width: 100%; height: 100%; transition: transform .45s; transform-style: preserve-3d; }
.mem-card.flipped .mem-inner { transform: rotateY(180deg); }
.mem-back, .mem-front { position: absolute; inset: 0; border-radius: 14px; display: grid; place-items: center; backface-visibility: hidden; -webkit-backface-visibility: hidden; padding: 6px; }
.mem-back { background: var(--grad-gold); font-size: 1.8rem; box-shadow: var(--shadow-sm); }
.mem-front { transform: rotateY(180deg); background: var(--surface-strong); border: 2px solid var(--border-strong); font-size: .76rem; font-weight: 650; color: var(--text-strong); line-height: 1.25; }
.mem-front.term { font: 800 .95rem var(--font-head); color: var(--gold-2); }
.mem-card.matched .mem-front { border-color: var(--emerald); background: var(--success-bg); }

/* True/False Blitz */
.blitz-card { min-height: 150px; display: grid; place-items: center; text-align: center; padding: 22px; border-radius: 20px; background: var(--surface-soft); border: 2px solid var(--border-strong); font: 700 clamp(1.05rem, 2.6vw, 1.35rem)/1.4 var(--font-head); color: var(--text-strong); }
.blitz-card p { margin: 0; }
.blitz-card.pop { animation: popIn .2s; }
.blitz-card.ok { border-color: var(--emerald); }
.blitz-card.bad { border-color: var(--danger); animation: shake .3s; }
.blitz-why { min-height: 44px; text-align: center; font-size: .88rem; color: var(--text-dim); margin: 8px 0; }
.blitz-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.blitz-buttons .btn { min-height: 64px; font-size: 1.15rem; border-radius: 18px; }
.blitz-yes { background: var(--grad-emerald); color: #02150e; border: 0; }
.blitz-no { background: linear-gradient(135deg, #FCA5A5, #EF4444); color: #2a0606; border: 0; }

/* ---- Academy extras ---- */
.daily-quiz { display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center; padding: 18px 20px; border-radius: var(--radius); background: radial-gradient(120% 140% at 100% 0%, rgba(16, 185, 129, .25), transparent 55%), var(--surface); }
.dq-ico { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--success-bg); color: var(--emerald-2); }
@media (max-width: 560px) { .daily-quiz { grid-template-columns: auto 1fr; } .daily-quiz > :last-child { grid-column: 1 / -1; } }
.diff { margin-left: 6px; font-size: .66rem; padding: 2px 7px; border-radius: 99px; text-transform: uppercase; letter-spacing: .05em; vertical-align: 1px; }
.diff-easy { background: var(--success-bg); color: var(--emerald-2); }
.diff-medium { background: var(--warning-bg); color: var(--gold-2); }
.diff-hard { background: var(--danger-bg); color: #FCA5A5; }

/* ---- Shop ---- */
.shop-layout { display: grid; gap: 16px; }
@media (min-width: 900px) { .shop-layout { grid-template-columns: 300px minmax(0, 1fr); align-items: start; } .shop-preview { position: sticky; top: 84px; } }
.shop-preview { text-align: center; }
.shop-preview .avatar { margin: 0 auto; filter: drop-shadow(0 18px 30px rgba(16, 185, 129, .35)); }
.shop-tabs { margin-bottom: 14px; }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.shop-item { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 14px 12px; border-radius: 18px; }
.shop-item h3 { font-size: .92rem; margin: 0; }
.shop-item p { font-size: .76rem; color: var(--text-dim); margin: 0; flex: 1; }
.shop-item.equipped { border-color: var(--emerald); box-shadow: 0 0 0 2px rgba(16, 185, 129, .25); }
.shop-item.locked .si-art { filter: grayscale(1); opacity: .5; }
.si-art { height: 96px; display: grid; place-items: center; }
.theme-swatch { width: 74px; height: 74px; border-radius: 22px; box-shadow: inset 0 -8px 16px rgba(0, 0, 0, .3), 0 8px 20px rgba(0, 0, 0, .3); }
.freeze-icon { font-size: 3.4rem; }

/* ---- Leaderboard ---- */
.join-card { display: grid; gap: 12px; margin-bottom: 14px; border: 1px solid var(--gold) !important; }
.join-row { display: flex; gap: 8px; }
.join-row .input { flex: 1; }
.board-tabs { flex-wrap: wrap; }
.lb { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.lb li { display: grid; grid-template-columns: 40px 48px 1fr auto; gap: 12px; align-items: center; padding: 8px 12px; border-radius: 14px; background: var(--surface-soft); border: 1px solid var(--border); }
.lb li.me { border-color: var(--gold); box-shadow: var(--glow-gold); }
.lb li.top1 { background: linear-gradient(90deg, rgba(245, 158, 11, .2), transparent); }
.lb-rank { font: 800 1.2rem var(--font-head); text-align: center; }
.lb-name { display: flex; flex-direction: column; min-width: 0; }
.lb-name strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-name small, .lb-val small { font-size: .72rem; color: var(--text-dim); }
.lb-val { display: flex; flex-direction: column; text-align: right; }
.lb-val b { font: 800 1.1rem var(--font-head); color: var(--gold-2); }

/* ---- Calendar ---- */
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-head div { text-align: center; font-size: .74rem; color: var(--text-faint); text-transform: uppercase; letter-spacing: .06em; padding-bottom: 4px; }
.cal-cell { position: relative; aspect-ratio: 1; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-soft); padding: 4px; cursor: pointer; color: var(--text); display: flex; flex-direction: column; align-items: center; justify-content: center; overflow: hidden; }
.cal-cell.empty { visibility: hidden; }
.cal-cell.has { border-color: var(--z); background: color-mix(in srgb, var(--z) 14%, transparent); }
.cal-cell.today { outline: 2px solid var(--gold); outline-offset: 1px; }
.cal-cell.sel { box-shadow: 0 0 0 3px var(--gold); }
.cal-num { position: absolute; top: 4px; left: 6px; font-size: .72rem; font-weight: 700; color: var(--text-dim); }
.cal-art { width: 78%; margin-top: 10px; }
.cal-art svg { display: block; width: 100%; height: auto; }
.cal-meta { font-size: .64rem; font-weight: 800; color: var(--text-strong); }
.cal-flag { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--danger); }
.cal-frozen { font-size: 1.2rem; }
@media (max-width: 520px) { .cal-grid { gap: 3px; } .cal-cell { border-radius: 8px; } .cal-num { font-size: .62rem; top: 2px; left: 4px; } }
.heat-legend span { display: inline-flex; align-items: center; gap: 4px; }

/* ---- Wrapped ---- */
.wrapped { position: relative; max-width: 440px; margin: 0 auto; aspect-ratio: 9 / 15; border-radius: 28px; overflow: hidden; box-shadow: var(--shadow); user-select: none; }
.w-progress { position: absolute; z-index: 3; top: 10px; left: 12px; right: 12px; display: flex; gap: 4px; }
.w-progress i { flex: 1; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .25); }
.w-progress i.on { background: #fff; }
.w-slide { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 40px 28px; color: #fff; cursor: pointer; }
.w-slide.in > * { animation: wIn .6s cubic-bezier(.2, .8, .2, 1) both; }
.w-slide.in > *:nth-child(2) { animation-delay: .12s; }
.w-slide.in > *:nth-child(3) { animation-delay: .24s; }
.w-slide.in > *:nth-child(4) { animation-delay: .36s; }
@keyframes wIn { from { opacity: 0; transform: translateY(18px) scale(.96); } }
.w-kicker { text-transform: uppercase; letter-spacing: .14em; font-size: .8rem; font-weight: 700; color: #FCD34D; }
.w-big { font: 800 2.3rem/1.1 var(--font-head); color: #fff; margin: 6px 0 12px; }
.w-num { font: 800 4.4rem/1 var(--font-head); color: #FCD34D; margin: 8px 0; text-shadow: 0 0 30px rgba(252, 211, 77, .5); }
.w-sub { font-size: 1.05rem; color: #E2E8F0; }
.w-art { width: 80%; background: var(--porcelain); border-radius: 20px; padding: 8px; }
.w-art svg { display: block; width: 100%; height: auto; }
.w-av { margin: 10px 0; }
.w-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: 100%; }
.w-stats div { background: rgba(255, 255, 255, .1); border-radius: 16px; padding: 14px 8px; font-size: .85rem; color: #CBD5E1; }
.w-stats b { display: block; font: 800 1.8rem var(--font-head); color: #fff; }
.w-nav { position: absolute; z-index: 3; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .35); color: #fff; cursor: pointer; display: grid; place-items: center; }
.w-nav.prev { left: 8px; }
.w-nav.next { right: 8px; }

/* ---- Toggle switch ---- */
.switch { position: relative; display: inline-block; width: 52px; height: 30px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--surface-soft); border: 1px solid var(--border-strong); cursor: pointer; transition: background .2s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .3); transition: transform .2s; }
.switch input:checked + span { background: var(--emerald); border-color: var(--emerald); }
.switch input:checked + span::after { transform: translateX(22px); }
.switch input:focus-visible + span { outline: 3px solid var(--gold); outline-offset: 2px; }
.cal-grid { max-width: 860px; margin-inline: auto; }

/* ===================================================================== announcement banner */
.announce { position: relative; z-index: 60; display: flex; align-items: center; justify-content: center; gap: 12px; padding: 10px 48px 10px 16px; font-size: .92rem; font-weight: 600; text-align: center; border-bottom: 1px solid var(--border); }
.announce a { font-weight: 750; text-decoration: underline; }
.announce-info { background: var(--info-bg); color: var(--text-strong); }
.announce-success { background: var(--success-bg); color: var(--text-strong); }
.announce-warning { background: var(--warning-bg); color: var(--text-strong); }
.announce-x { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; border: 0; border-radius: 10px; background: transparent; color: inherit; font-size: 1.3rem; cursor: pointer; }
.announce-x:hover { background: var(--surface-soft); }

/* ===================================================================== admin panel */
.layout-admin { padding-bottom: 40px; }
.admin-top { position: sticky; top: 0; z-index: 40; border-radius: 0; border-width: 0 0 1px; box-shadow: none; padding-top: env(safe-area-inset-top, 0px); }
.admin-top-inner { width: min(1240px, 100% - 32px); margin: 0 auto; display: flex; align-items: center; gap: 10px; padding: 10px 0; }
.admin-top-inner .brand { margin-right: auto; }
.admin-who { display: inline-flex; align-items: center; gap: 6px; font-weight: 650; color: var(--emerald-2); font-size: .9rem; }
.admin-who .ico { width: 18px; height: 18px; }
.admin-tabs { width: min(1240px, 100% - 32px); margin: 0 auto; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; padding-bottom: 8px; }
.admin-tabs::-webkit-scrollbar { display: none; }
.admin-tabs a { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 12px; color: var(--text-dim); font-weight: 650; font-size: .9rem; white-space: nowrap; text-decoration: none; }
.admin-tabs a .ico { width: 17px; height: 17px; }
.admin-tabs a:hover { background: var(--surface-soft); color: var(--text-strong); }
.admin-tabs a[aria-current] { background: var(--grad-gold); color: #241603; box-shadow: var(--glow-gold); }
.admin-main { width: min(1240px, 100% - 32px); margin: 18px auto 0; }
.admin-privacy { display: flex; align-items: center; gap: 8px; font-size: .84rem; color: var(--text-faint); margin: 0 0 14px; }
.admin-privacy .ico { width: 16px; height: 16px; flex: none; color: var(--emerald); }
.admin-loading { padding: 60px 0; text-align: center; color: var(--text-faint); }
.admin-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.admin-head h1 { margin: 0; font-size: clamp(1.4rem, 3vw, 1.9rem); }
.admin-grid { display: grid; gap: 16px; margin-top: 16px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .admin-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .admin-wide { grid-column: 1 / -1; } }
.kpi small { display: block; margin-top: 6px; line-height: 1.35; font-size: .76rem; }
.admin-warn { display: flex; align-items: center; gap: 10px; padding: 12px 14px; margin-bottom: 14px; border-radius: 14px; background: var(--warning-bg); border: 1px solid rgba(245, 158, 11, .35); font-size: .92rem; }
.admin-warn .ico { flex: none; color: var(--gold-2); }
.admin-filters { display: grid; gap: 8px; grid-template-columns: minmax(0, 1fr); margin-bottom: 14px; }
@media (min-width: 760px) { .admin-filters { grid-template-columns: minmax(0, 1fr) auto auto auto; } }
.admin-table td { font-size: .9rem; }
.admin-table tr.is-off td, .admin-q.is-off { opacity: .55; }
.admin-table .tag { margin-left: 4px; }
.link-btn { border: 0; background: none; padding: 0; color: var(--text-strong); cursor: pointer; font: inherit; text-align: left; }
.link-btn:hover { color: var(--gold-2); text-decoration: underline; }
.nowrap { white-space: nowrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .12em; }
.admin-pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 16px 0; flex-wrap: wrap; }
.admin-list { display: grid; gap: 12px; }
.admin-q p { margin: 8px 0; }
.admin-q-head { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.admin-opts { margin: 6px 0; padding-left: 22px; list-style: upper-alpha; font-size: .92rem; }
.admin-opts li { padding: 2px 0; color: var(--text-dim); }
.admin-opts li.correct { color: var(--emerald-2); font-weight: 700; }
.admin-opts li.correct::after { content: ' ✓'; }
.admin-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.admin-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.admin-form { display: grid; gap: 12px; }
.admin-row { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 640px) { .admin-row { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); } }
.admin-check { display: flex; align-items: center; gap: 10px; font-weight: 600; cursor: pointer; }
.admin-check input { width: 20px; height: 20px; accent-color: var(--emerald); }
.admin-cost { display: grid; grid-template-columns: minmax(0, 1fr) 110px auto; gap: 8px; margin-bottom: 8px; }
.admin-code { display: block; padding: 10px 12px; border-radius: 12px; background: var(--surface-soft); border: 1px solid var(--border); font-size: .82rem; word-break: break-all; user-select: all; }
.admin-sub { font-size: .95rem; margin: 18px 0 8px; }
.admin-counts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.admin-counts div { padding: 10px 6px; border-radius: 12px; background: var(--surface-soft); text-align: center; }
.admin-counts b { display: block; font: 800 1.1rem var(--font-head); color: var(--text-strong); }
.admin-counts span { font-size: .72rem; color: var(--text-dim); }
@media (max-width: 480px) { .admin-counts { grid-template-columns: repeat(2, minmax(0, 1fr)); } .admin-top-inner .brand-tag { display: none; } .admin-who { display: none; } }
.admin-history { margin: 0; padding-left: 18px; font-size: .86rem; color: var(--text-dim); }
.tier { font-size: .74rem; font-weight: 750; text-transform: uppercase; padding: 2px 8px; border-radius: 99px; background: var(--surface-soft); }
.tier-bronze { color: #D97706; } .tier-silver { color: #CBD5E1; } .tier-gold { color: var(--gold-2); } .tier-platinum { color: #A5F3FC; }
[data-theme="light"] .tier-silver { color: #64748B; } [data-theme="light"] .tier-platinum { color: #0891B2; }
.admin-top-inner > * { flex-shrink: 0; }
.admin-top-inner .brand { flex-shrink: 1; min-width: 0; }
.admin-top-inner .brand-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 600px) { .users-table th:nth-child(4), .users-table td:nth-child(4) { display: none; } .admin-top-inner .brand-text { display: none; } }
