/* ==========================================================================
   Design system. Every colour, radius, shadow and timing is defined once here;
   the light and dark themes only swap these variables.
   ========================================================================== */
:root {
  --bg: #f4f8f5;
  --surface: #ffffff;
  --surface-2: #edf5f0;
  --surface-3: #dfece4;
  --glass: rgba(255, 255, 255, .74);
  --glass-border: rgba(255, 255, 255, .65);
  --border: #dde9e1;
  --text: #0f1f18;
  --text-2: #56695e;
  --primary: #0b8a5f;
  --primary-2: #14b8a6;
  --primary-soft: #e0f3ea;
  --on-primary: #ffffff;
  --accent: #f59e0b;
  --good: #0a8f4a;  --good-soft: #e1f5ea;
  --warn: #b26b00;  --warn-soft: #fff1d6;
  --bad: #d0344f;   --bad-soft: #fde6ea;
  /* chart series: categorical palette validated for colour-blind separation and contrast (emerald, orange, indigo) */
  --s1: #0f9f6e; --s2: #e0670f; --s3: #5b6cf0;
  --grid: #e6efe9;
  --brand-grad: linear-gradient(135deg, #047857 0%, #10a36f 50%, #14b8a6 100%);
  --hero-grad: linear-gradient(125deg, #04241a 0%, #064e3b 38%, #047857 62%, #0f766e 100%);
  --shadow-sm: 0 1px 2px rgba(10, 50, 35, .06);
  --shadow: 0 1px 2px rgba(10, 50, 35, .04), 0 4px 12px rgba(10, 50, 35, .05), 0 14px 34px rgba(10, 50, 35, .06);
  --shadow-lg: 0 2px 6px rgba(10, 50, 35, .06), 0 26px 64px rgba(6, 78, 59, .16);
  --ring: 0 0 0 4px var(--primary-soft);
  --radius: 18px;
  --radius-sm: 12px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-head: "Sora", "Inter", system-ui, sans-serif;
  --topbar-h: 66px;
  --glow-1: #10b981; --glow-2: #14b8a6; --glow-3: #facc15;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #06110d;
  --surface: #0d1a15;
  --surface-2: #13241d;
  --surface-3: #1b3128;
  --glass: rgba(13, 26, 21, .7);
  --glass-border: rgba(255, 255, 255, .07);
  --border: #1f3a2f;
  --text: #e8f3ed;
  --text-2: #97b1a4;
  --primary: #34d399;
  --primary-2: #2dd4bf;
  --primary-soft: #0f3326;
  --on-primary: #04140d;
  --accent: #fbbf24;
  --good: #34d399;  --good-soft: #0f2e22;
  --warn: #f2b23a;  --warn-soft: #33270d;
  --bad: #fb7185;   --bad-soft: #3a1520;
  --s1: #19b07c; --s2: #e6721f; --s3: #7d8bff;
  --grid: #17291f;
  --brand-grad: linear-gradient(135deg, #059669 0%, #10b981 50%, #2dd4bf 100%);
  --hero-grad: linear-gradient(125deg, #021710 0%, #053d2e 40%, #06654a 62%, #0b5f58 100%);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .45);
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 32px rgba(0, 0, 0, .32);
  --shadow-lg: 0 2px 6px rgba(0, 0, 0, .45), 0 30px 72px rgba(0, 0, 0, .55);
  color-scheme: dark;
}

/* ========================================================================== base */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
html, body { margin: 0; }
body {
  font-family: var(--font); font-size: 15px; line-height: 1.6;
  background: var(--bg); color: var(--text); min-height: 100vh;
  transition: background .4s var(--ease), color .4s var(--ease);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
/* Soft aurora + dotted grid behind everything */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(900px 520px at 8% -8%, color-mix(in srgb, var(--glow-1) 16%, transparent), transparent 60%),
    radial-gradient(800px 520px at 100% 0%, color-mix(in srgb, var(--glow-2) 10%, transparent), transparent 60%),
    radial-gradient(700px 600px at 60% 110%, color-mix(in srgb, var(--glow-3) 7%, transparent), transparent 60%);
}
body::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .5;
  background-image: radial-gradient(color-mix(in srgb, var(--text-2) 22%, transparent) 1px, transparent 1px);
  background-size: 26px 26px;
  mask-image: linear-gradient(to bottom, #000, transparent 55%);
  -webkit-mask-image: linear-gradient(to bottom, #000, transparent 55%);
}
::selection { background: color-mix(in srgb, var(--primary) 28%, transparent); }
h1, h2, h3, h4 { font-family: var(--font-head); line-height: 1.2; margin: 0 0 .4em; letter-spacing: -.02em; }
h2 { font-size: 1.3rem; font-weight: 750; }
h3 { font-size: 1.04rem; font-weight: 700; }
a { color: var(--primary); text-decoration: none; }
small, .muted { color: var(--text-2); }
code { font-family: ui-monospace, Consolas, monospace; font-size: .85em; background: var(--surface-2); padding: 1px 6px; border-radius: 6px; }
svg.icon { width: 1.15em; height: 1.15em; vertical-align: -.2em; flex: none; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }
/* Custom scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 99px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background-color: color-mix(in srgb, var(--text-2) 40%, transparent); }

/* ========================================================================== top bar */
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar-h);
  display: flex; align-items: center; gap: 22px; padding: 0 32px;
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  backdrop-filter: saturate(1.8) blur(18px); -webkit-backdrop-filter: saturate(1.8) blur(18px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s, box-shadow .3s, background .3s;
}
.topbar.scrolled { border-bottom-color: var(--border); box-shadow: 0 8px 30px rgba(10, 50, 35, .06); background: color-mix(in srgb, var(--surface) 78%, transparent); }
.topbar .progress-line { position: absolute; left: 0; bottom: -1px; height: 2px; width: calc(var(--scroll, 0) * 100%); background: var(--brand-grad); transition: width .1s linear; }
.brand { display: flex; align-items: center; gap: 11px; color: var(--text); flex: none; }
.brand img { border-radius: 9px; box-shadow: 0 6px 16px color-mix(in srgb, var(--primary) 35%, transparent); transition: transform .5s var(--spring); }
.brand:hover img { transform: rotate(-10deg) scale(1.08); }
.brand span { display: flex; flex-direction: column; line-height: 1.1; font-family: var(--font-head); font-weight: 800; font-size: 1rem; letter-spacing: -.01em; }
.brand small { margin-top: 3px; font-family: var(--font); font-weight: 600; font-size: .64rem; letter-spacing: .08em; text-transform: uppercase; color: var(--text-2); }
nav { position: relative; display: flex; gap: 2px; flex: 1; justify-content: center; }
nav a {
  position: relative; z-index: 1; padding: 8px 15px; border-radius: 999px; color: var(--text-2);
  font-weight: 600; font-size: .9rem; white-space: nowrap; transition: color .25s;
  display: inline-flex; align-items: center; gap: 7px;
}
nav a svg.icon { width: 1em; height: 1em; opacity: .8; }
nav a:hover { color: var(--text); }
nav a.active { color: var(--primary); }
nav .nav-ink {
  position: absolute; z-index: 0; top: 50%; height: 36px; border-radius: 999px; translate: 0 -50%;
  background: var(--primary-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 18%, transparent);
  transition: left .45s var(--spring), width .45s var(--spring), opacity .3s; opacity: 0;
}
.top-actions { display: flex; gap: 8px; align-items: center; flex: none; }
.icon-btn {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer;
  transition: transform .35s var(--spring), background .2s, box-shadow .2s; box-shadow: var(--shadow-sm);
}
.icon-btn:hover { transform: rotate(-14deg) scale(1.05); box-shadow: var(--shadow); }
#menu-toggle { display: none; }

/* ========================================================================== layout */
main { max-width: 1280px; margin: 0 auto; padding: 30px 32px 40px; min-height: calc(100vh - var(--topbar-h) - 90px); }
.page { animation: page-in .5s var(--ease) both; }
.page.leaving { animation: page-out .18s ease both; }
@keyframes page-in { from { opacity: 0; transform: translateY(14px); filter: blur(4px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes page-out { to { opacity: 0; transform: translateY(-6px); } }
.page-head { margin: 8px 0 26px; }
.page-head h1 { font-size: clamp(1.7rem, 3vw, 2.25rem); font-weight: 800; display: flex; align-items: center; gap: 14px; }
.page-head h1 .title-text { background: linear-gradient(120deg, var(--text) 30%, var(--primary) 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.page-head h1 .badge-icon {
  display: grid; place-items: center; width: 48px; height: 48px; border-radius: 15px; flex: none;
  background: var(--brand-grad); color: #fff; box-shadow: 0 10px 24px color-mix(in srgb, var(--primary) 35%, transparent);
}
.page-head p { color: var(--text-2); margin: 0; max-width: 780px; font-size: 1.02rem; }
.grid { display: grid; gap: 20px; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.split { display: grid; gap: 20px; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); align-items: start; }
.grid > *, .split > * { min-width: 0; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { height: 28px; }

/* footer */
.footer { max-width: 1280px; margin: 0 auto; padding: 22px 32px 34px; display: flex; flex-wrap: wrap; gap: 10px 24px;
  justify-content: space-between; color: var(--text-2); font-size: .84rem; border-top: 1px solid var(--border); }
.footer b { color: var(--text); font-family: var(--font-head); }
.footer .dots { display: inline-flex; gap: 5px; margin-right: 8px; vertical-align: middle; }
.footer .dots i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* ========================================================================== cards */
.card {
  position: relative; isolation: isolate;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px 24px;
  transition: transform .35s var(--ease), box-shadow .35s var(--ease), background .4s, border-color .3s;
}
/* Spotlight that follows the pointer (fx.js sets --mx / --my) */
.card::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; z-index: -1; pointer-events: none; opacity: 0;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), color-mix(in srgb, var(--primary) 7%, transparent), transparent 45%);
  transition: opacity .3s;
}
.card:hover::before { opacity: 1; }
a.card { color: inherit; display: block; }
a.card:hover, .card.lift:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--primary) 30%, var(--border)); }
a.card:hover .card-icon { transform: scale(1.08) rotate(-6deg); }
a.card:hover .more svg { transform: translateX(4px); }
.card h3 { margin-bottom: .3em; }
.card-icon {
  display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; margin-bottom: 14px;
  background: var(--primary-soft); color: var(--primary); font-size: 1.3rem;
  transition: transform .45s var(--spring);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 14%, transparent);
}
.card .more { display: inline-flex; gap: 6px; align-items: center; margin-top: 12px; font-weight: 700; font-size: .88rem; }
.card .more svg { transition: transform .3s var(--ease); }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 6px 14px; margin: 0 0 14px; flex-wrap: wrap; }
.section-title h2 { position: relative; }
.section-title p { margin: 0; color: var(--text-2); font-size: .9rem; }

/* Scroll reveal (fx.js adds .reveal then .in) */
.reveal { opacity: 0; transform: translateY(18px) scale(.985); }
.reveal.in { opacity: 1; transform: none; transition: opacity .6s var(--ease) var(--d, 0ms), transform .7s var(--ease) var(--d, 0ms), box-shadow .35s, border-color .3s; }

/* stat tiles */
.stat { display: flex; gap: 14px; align-items: center; overflow: hidden; }
.stat .card-icon { margin: 0; background: var(--brand-grad); color: #fff; box-shadow: 0 8px 20px color-mix(in srgb, var(--primary) 28%, transparent); }
.stat .value { font-family: var(--font-head); font-size: 1.9rem; font-weight: 800; line-height: 1.05; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stat .label { color: var(--text-2); font-size: .84rem; font-weight: 500; }
.stat::after { content: ""; position: absolute; right: -30px; top: -30px; width: 110px; height: 110px; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--primary) 10%, transparent), transparent 70%); pointer-events: none; }
.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }

/* ========================================================================== hero */
.hero {
  position: relative; overflow: hidden; border-radius: 28px; padding: 56px 56px 50px; margin-bottom: 24px;
  color: #fff; background: var(--hero-grad); background-size: 160% 160%; animation: hero-pan 18s ease-in-out infinite alternate;
  box-shadow: 0 30px 80px -20px rgba(4, 120, 87, .5); isolation: isolate;
}
@keyframes hero-pan { from { background-position: 0% 30%; } to { background-position: 100% 70%; } }
.hero::before { /* fine grid */
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: .25;
  background-image: linear-gradient(rgba(255,255,255,.12) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.12) 1px, transparent 1px);
  background-size: 44px 44px; mask-image: radial-gradient(ellipse at 70% 40%, #000 10%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse at 70% 40%, #000 10%, transparent 70%);
}
.hero .blob { position: absolute; border-radius: 50%; filter: blur(10px); animation: float 12s ease-in-out infinite alternate; z-index: -1; }
.hero .b1 { width: 420px; height: 420px; right: -100px; top: -140px; background: radial-gradient(circle, rgba(250,204,21,.38), transparent 68%); }
.hero .b2 { width: 520px; height: 320px; left: 30%; bottom: -190px; background: radial-gradient(circle, rgba(45,212,191,.3), transparent 70%); animation-duration: 16s; }
.hero .b3 { width: 300px; height: 300px; left: -90px; top: 35%; background: radial-gradient(circle, rgba(52,211,153,.45), transparent 70%); animation-duration: 14s; }
@keyframes float { from { transform: translate(0, 0) scale(1); } to { transform: translate(-36px, 24px) scale(1.1); } }
.hero > * { position: relative; }
.hero .hero-content { max-width: 720px; }
.hero .eyebrow {
  display: inline-flex; align-items: center; gap: 8px; font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; font-weight: 700;
  margin-bottom: 18px; padding: 6px 13px 6px 9px; border-radius: 999px; background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.22); backdrop-filter: blur(8px);
}
.hero .eyebrow::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 0 0 rgba(74,222,128,.7); animation: live 2s infinite; }
@keyframes live { 70% { box-shadow: 0 0 0 8px rgba(74,222,128,0); } 100% { box-shadow: 0 0 0 0 rgba(74,222,128,0); } }
.hero h1 { font-size: clamp(1.9rem, 4vw, 3.1rem); font-weight: 800; margin-bottom: 16px; letter-spacing: -.03em; line-height: 1.1; }
.hero h1 .rotating {
  display: inline-block; min-width: 6ch; transition: opacity .35s, transform .35s var(--ease), filter .35s;
  background: linear-gradient(90deg, #fde68a, #a7f3d0); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero h1 .rotating.out { opacity: 0; transform: translateY(14px); filter: blur(6px); }
.hero p { max-width: 640px; opacity: .9; font-size: 1.06rem; margin: 0 0 26px; }
.hero .actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero .btn { padding: 12px 22px; border-radius: 14px; }
.hero .btn.light { background: #fff; color: #065f46; box-shadow: 0 10px 30px rgba(0,0,0,.2); }
.hero .btn.light:hover { box-shadow: 0 14px 34px rgba(0,0,0,.28); }
.hero .btn.ghost { background: rgba(255,255,255,.1); color: #fff; border-color: rgba(255,255,255,.32); backdrop-filter: blur(8px); }
.hero .btn.ghost:hover { background: rgba(255,255,255,.18); box-shadow: none; }
/* floating greetings on the right */
.hero .orbit { position: absolute; right: 44px; top: 50%; translate: 0 -50%; width: 340px; height: 300px; pointer-events: none; }
.hero .orbit span {
  position: absolute; padding: 8px 14px; border-radius: 14px; font-weight: 700; font-size: .92rem; white-space: nowrap;
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.25); backdrop-filter: blur(10px);
  box-shadow: 0 10px 30px rgba(0,0,0,.15); animation: bob 6s ease-in-out infinite alternate;
}
.hero .orbit span small { display: block; font-weight: 500; font-size: .68rem; color: rgba(255,255,255,.75); }
@keyframes bob { from { transform: translateY(-8px); } to { transform: translateY(8px); } }

/* ========================================================================== buttons, chips, inputs */
.btn {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 12px; border: 1px solid transparent;
  font: 650 .94rem var(--font); cursor: pointer; text-decoration: none;
  background: var(--brand-grad); background-size: 140% 100%; color: #fff;
  box-shadow: 0 6px 18px -4px color-mix(in srgb, var(--primary) 50%, transparent), inset 0 1px 0 rgba(255,255,255,.2);
  transition: transform .25s var(--spring), box-shadow .25s, background-position .4s, opacity .2s;
}
.btn:hover { transform: translateY(-2px); background-position: 100% 0; box-shadow: 0 12px 26px -6px color-mix(in srgb, var(--primary) 60%, transparent), inset 0 1px 0 rgba(255,255,255,.2); }
.btn:active { transform: translateY(0) scale(.98); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--border); box-shadow: var(--shadow-sm); }
.btn.secondary:hover { box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--primary) 35%, var(--border)); color: var(--primary); }
.btn.danger { background: var(--bad); color: #fff; box-shadow: 0 6px 18px -4px color-mix(in srgb, var(--bad) 50%, transparent); }
.btn.wide { width: 100%; padding: 14px; font-size: 1rem; }
.ripple { position: absolute; border-radius: 50%; pointer-events: none; background: currentColor; opacity: .25; transform: scale(0); animation: ripple .6s ease-out forwards; }
@keyframes ripple { to { transform: scale(1); opacity: 0; } }

.chip {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px;
  font: 600 .8rem var(--font); background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border);
  transition: transform .25s var(--spring), background .2s, color .2s, border-color .2s, box-shadow .2s;
}
button.chip { cursor: pointer; }
button.chip:hover { transform: translateY(-2px); color: var(--primary); border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); box-shadow: var(--shadow-sm); }
.chip.primary { background: var(--primary-soft); color: var(--primary); border-color: color-mix(in srgb, var(--primary) 22%, transparent); }
.chip.good { background: var(--good-soft); color: var(--good); border-color: transparent; }
.chip.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.chip.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.hero .chip { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.3); color: #fff; backdrop-filter: blur(4px); }
.chips { display: flex; flex-wrap: wrap; gap: 7px; }

/* segmented toggle (tabs, pills) */
.segmented { position: relative; display: inline-flex; padding: 4px; gap: 3px; background: var(--surface-2); border-radius: 14px; border: 1px solid var(--border); flex-wrap: wrap; max-width: 100%; }
.segmented button {
  position: relative; overflow: hidden;
  border: 0; background: transparent; color: var(--text-2); font: 600 .87rem var(--font);
  padding: 8px 15px; border-radius: 10px; cursor: pointer; transition: background .25s, color .2s, box-shadow .25s, transform .2s;
}
.segmented button:hover { color: var(--text); }
.segmented button:active { transform: scale(.97); }
.segmented button.active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-sm), 0 4px 12px rgba(10,50,35,.06); }

label.field, div.field { display: flex; flex-direction: column; gap: 7px; font-size: .84rem; font-weight: 600; color: var(--text-2); }
input[type=text], input[type=number], input[type=search], select, textarea {
  font: 400 .95rem var(--font); color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 12px; padding: 11px 13px; width: 100%;
  transition: border-color .2s, box-shadow .25s, background .3s;
  box-shadow: var(--shadow-sm);
}
input:hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--primary) 30%, var(--border)); }
textarea { resize: vertical; min-height: 150px; line-height: 1.55; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
select { appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2378859c' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center; }
input[type=file] { font: 400 .85rem var(--font); color: var(--text-2); max-width: 100%; }
input[type=file]::file-selector-button { font: 600 .84rem var(--font); color: var(--primary); background: var(--primary-soft);
  border: 1px solid color-mix(in srgb, var(--primary) 25%, transparent); border-radius: 10px; padding: 7px 14px; margin-right: 10px; cursor: pointer; transition: transform .2s; }
input[type=file]::file-selector-button:hover { transform: translateY(-1px); }
.check { display: inline-flex; gap: 8px; align-items: center; font-size: .9rem; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--primary); }
.examples { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.examples button { border: 1px dashed var(--border); background: transparent; color: var(--text-2); border-radius: 999px; padding: 5px 12px; font: 500 .8rem var(--font); cursor: pointer; transition: all .2s var(--ease); }
.examples button:hover { color: var(--primary); border-color: var(--primary); border-style: solid; background: var(--primary-soft); transform: translateY(-1px); }

/* ========================================================================== result card (classify) */
.result-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.result-label { font-family: var(--font-head); font-size: clamp(1.6rem, 3vw, 2.3rem); font-weight: 800; line-height: 1.1; letter-spacing: -.02em; animation: pop-in .5s var(--spring) both; }
@keyframes pop-in { from { opacity: 0; transform: scale(.9) translateY(6px); } to { opacity: 1; transform: none; } }
.result-meaning { color: var(--text-2); margin-top: 4px; }
.confidence-ring { --p: 0; width: 90px; height: 90px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: conic-gradient(var(--ring, var(--primary)) calc(var(--p) * 1%), var(--surface-2) 0); transition: --p .8s;
  box-shadow: 0 10px 26px -8px color-mix(in srgb, var(--ring, var(--primary)) 55%, transparent); }
.confidence-ring span { width: 72px; height: 72px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font: 800 1.15rem var(--font-head); }
.meaning-box { margin-top: 16px; padding: 15px 17px; border-radius: 14px; background: linear-gradient(135deg, color-mix(in srgb, var(--s3) 9%, var(--surface-2)), var(--surface-2)); border-left: 4px solid var(--s3); }
.meaning-box .tag { font-size: .73rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--text-2); margin-bottom: 5px; display: flex; gap: 8px; align-items: center; }
.meaning-box p { margin: 0; font-size: 1rem; }
.placeholder { text-align: center; padding: 54px 20px; color: var(--text-2); }
.placeholder .card-icon { margin: 0 auto 16px; width: 66px; height: 66px; border-radius: 20px; font-size: 1.7rem; animation: breathe 3.5s ease-in-out infinite; }
@keyframes breathe { 50% { transform: translateY(-5px); box-shadow: 0 14px 30px -10px color-mix(in srgb, var(--primary) 50%, transparent); } }

/* ========================================================================== bar lists (probabilities, scores) */
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: minmax(110px, 34%) 1fr 54px; gap: 12px; align-items: center; font-size: .9rem; padding: 3px 6px; margin: 0 -6px; border-radius: 10px; transition: background .2s; }
.bar-row:hover { background: var(--surface-2); }
.bar-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row .name small { display: block; font-size: .75rem; overflow: hidden; text-overflow: ellipsis; }
.bar-track { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; box-shadow: inset 0 1px 2px rgba(10,50,35,.06); }
.bar-row:hover .bar-track { background: var(--surface-3); }
.bar-fill { position: relative; height: 100%; width: 0; border-radius: 999px; background: var(--s1); transition: width 1s var(--ease); overflow: hidden; }
.bar-fill::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,.35), transparent); transform: translateX(-100%); animation: sheen 2.4s ease-in-out 1s 1; }
@keyframes sheen { to { transform: translateX(100%); } }
.bar-row.top .bar-fill { background: linear-gradient(90deg, var(--s1), var(--s3)); }
.bar-row .val { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }

/* grouped bar chart (results) */
.legend { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: .84rem; color: var(--text-2); margin-bottom: 12px; align-items: center; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 4px; margin-right: 6px; vertical-align: -1px; }
.gbar { display: grid; grid-template-columns: 190px 1fr; gap: 14px; align-items: center; padding: 6px 6px; margin: 0 -6px; border-bottom: 1px solid var(--grid); border-radius: 8px; transition: background .2s; }
.gbar:hover { background: var(--surface-2); }
.gbar:last-child { border-bottom: 0; }
.gbar .name { font-size: .88rem; font-weight: 500; }
.gbar .name small { display: block; }
.gbar .stack { display: flex; flex-direction: column; gap: 3px; position: relative; padding-right: 44px; }
.gbar .b { height: 11px; border-radius: 0 4px 4px 0; width: 0; transition: width .9s var(--ease); position: relative; }
.gbar .b span { position: absolute; left: calc(100% + 6px); top: -3px; font-size: .74rem; font-weight: 700; color: var(--text); white-space: nowrap; }
.axis { display: grid; grid-template-columns: 190px 1fr; gap: 14px; font-size: .75rem; color: var(--text-2); margin-top: 6px; }
.axis .ticks { display: flex; justify-content: space-between; padding-right: 44px; }

/* ========================================================================== tables */
.table-wrap { overflow: auto; border-radius: var(--radius-sm); border: 1px solid var(--border); max-height: 560px; background: var(--surface); box-shadow: var(--shadow); -webkit-overflow-scrolling: touch; }
table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: .9rem; }
th { position: sticky; top: 0; background: color-mix(in srgb, var(--surface-2) 88%, transparent); backdrop-filter: blur(8px); color: var(--text-2); font-weight: 650; text-align: left; padding: 11px 13px; font-size: .76rem; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; z-index: 1; border-bottom: 1px solid var(--border); }
td { padding: 10px 13px; border-top: 1px solid var(--border); white-space: nowrap; }
tbody tr:first-child td { border-top: 0; }
td.wrap { white-space: normal; }
tbody tr { transition: background .15s; }
tbody tr:hover { background: color-mix(in srgb, var(--primary) 5%, var(--surface)); }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 0%, transparent); }
.yes { color: var(--good); font-weight: 700; }
.no { color: var(--border); }
.mini-bar { display: flex; align-items: center; gap: 8px; min-width: 130px; }
.mini-bar .bar-track { flex: 1; height: 8px; }

/* ========================================================================== line chart */
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .gridline { stroke: var(--grid); }
.chart .axis-text { fill: var(--text-2); font-size: 11px; }
.chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-dasharray: var(--len); stroke-dashoffset: var(--len); animation: draw 1.3s var(--ease) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.chart .band { opacity: .14; }
.chart .marker { stroke: var(--surface); stroke-width: 2; transition: r .2s; }
.chart .marker:hover { r: 6; }
.chart .ref { stroke: var(--text-2); stroke-dasharray: 5 4; }
.chart .direct-label { font-size: 11px; font-weight: 600; fill: var(--text); }

/* ========================================================================== feedback: tooltip, toasts, loading */
#tooltip {
  position: fixed; z-index: 70; pointer-events: none; opacity: 0; transform: translateY(6px) scale(.97); transform-origin: top left;
  background: color-mix(in srgb, #0b1a14 92%, transparent); color: #effaf4; padding: 9px 12px; border-radius: 11px; font-size: .82rem; line-height: 1.45;
  max-width: 290px; box-shadow: 0 16px 40px rgba(0,0,0,.28); backdrop-filter: blur(10px); border: 1px solid rgba(255,255,255,.08);
  transition: opacity .15s, transform .2s var(--ease);
}
#tooltip.show { opacity: 1; transform: none; }
#toasts { position: fixed; right: 20px; bottom: 20px; z-index: 80; display: flex; flex-direction: column; gap: 10px; }
.toast { background: var(--glass); backdrop-filter: blur(16px); border: 1px solid var(--border); border-left: 4px solid var(--primary); box-shadow: var(--shadow-lg); border-radius: 14px; padding: 13px 17px; font-size: .9rem; max-width: 380px; animation: toast-in .45s var(--spring) both; }
@keyframes toast-in { from { opacity: 0; transform: translateX(30px) scale(.95); } to { opacity: 1; transform: none; } }
.toast.error { border-left-color: var(--bad); }
.toast.good { border-left-color: var(--good); }
.skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: 8px; min-height: 14px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite; display: inline-block; vertical-align: -3px; }
@keyframes spin { to { transform: rotate(360deg); } }
/* Loading state used by every page */
.loader { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 46px 20px; color: var(--text-2); font-weight: 500; }
.loader .orb { position: relative; width: 46px; height: 46px; }
.loader .orb::before, .loader .orb::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 3px solid transparent; }
.loader .orb::before { border-top-color: var(--primary); border-right-color: var(--primary); animation: spin .9s linear infinite; }
.loader .orb::after { inset: 8px; border-bottom-color: var(--s3); border-left-color: var(--s3); animation: spin 1.3s linear infinite reverse; }
.loader .lines { width: min(320px, 80%); display: grid; gap: 8px; }
.loader .lines .skeleton:nth-child(2) { width: 75%; }
.progress { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.progress div { height: 100%; background: linear-gradient(90deg, var(--s1), var(--s3)); width: 0; transition: width .4s; position: relative; overflow: hidden; }
.progress div::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,.4), transparent); animation: sheen-loop 1.6s infinite; transform: translateX(-100%); }
@keyframes sheen-loop { to { transform: translateX(100%); } }
.log { font: .8rem/1.55 ui-monospace, Consolas, monospace; background: #07140f; color: #cfe9dc; border-radius: 14px; padding: 15px 17px; max-height: 320px; overflow: auto; white-space: pre-wrap; margin: 0; border: 1px solid #1f3a2f; }

/* ========================================================================== misc */
.example-card { display: flex; flex-direction: column; gap: 10px; }
.example-card .orig { font-size: .95rem; }
.example-card .en { font-size: .9rem; color: var(--text-2); border-left: 3px solid var(--s3); padding-left: 10px; transition: border-color .4s; }
.example-card .en.loading { border-left-color: var(--border); }
details.explain { background: var(--glass); backdrop-filter: blur(10px); border: 1px solid var(--border); border-radius: 14px; padding: 13px 17px; margin-bottom: 18px; transition: box-shadow .2s; }
details.explain:hover { box-shadow: var(--shadow); }
details.explain summary { cursor: pointer; font-weight: 600; display: flex; gap: 8px; align-items: center; list-style: none; }
details.explain summary::-webkit-details-marker { display: none; }
details.explain summary::after { content: "+"; margin-left: auto; font-size: 1.2rem; color: var(--text-2); transition: transform .3s var(--ease); }
details.explain[open] summary::after { transform: rotate(45deg); }
details.explain p { color: var(--text-2); margin: 10px 0 0; animation: page-in .35s var(--ease); }
.steps { counter-reset: step; display: grid; gap: 4px; position: relative; }
.step { display: flex; gap: 14px; align-items: flex-start; padding: 8px; margin: 0 -8px; border-radius: 12px; transition: background .2s; position: relative; }
.step:hover { background: var(--surface-2); }
.step::before { counter-increment: step; content: counter(step); flex: none; width: 32px; height: 32px; border-radius: 11px; display: grid; place-items: center; font-weight: 800; background: var(--brand-grad); color: #fff; box-shadow: 0 6px 14px -4px color-mix(in srgb, var(--primary) 50%, transparent); }
.step p { margin: 2px 0 0; color: var(--text-2); font-size: .9rem; }
.empty { padding: 30px; text-align: center; color: var(--text-2); }

/* chip pickers (choose several languages) */
.chip-picker { display: flex; flex-wrap: wrap; gap: 6px; max-height: 150px; overflow: auto; padding: 2px; }
.chip-picker button { border: 1px solid var(--border); background: var(--surface); color: var(--text-2); border-radius: 999px;
  padding: 5px 12px; font: 600 .8rem var(--font); cursor: pointer; transition: all .2s var(--ease); }
.chip-picker button:hover { border-color: var(--primary); color: var(--primary); }
.chip-picker button.active { background: var(--primary); border-color: var(--primary); color: var(--on-primary); box-shadow: 0 4px 12px -3px color-mix(in srgb, var(--primary) 55%, transparent); }

/* ========================================================================== interactive country map */
.cmap-top { display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: center; justify-content: space-between; }
.cmap-search { position: relative; flex: 1 1 340px; max-width: 560px; }
.cmap-search > svg { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--text-2); pointer-events: none; transition: color .2s; }
.cmap-search:focus-within > svg { color: var(--primary); }
.cmap-search input { width: 100%; padding: 13px 64px 13px 46px; font-size: 1rem; border-radius: 999px; }
.cmap-search kbd { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font: 600 .72rem var(--font); color: var(--text-2);
  border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 6px; padding: 1px 7px; background: var(--surface-2); pointer-events: none; }
.cmap-search:focus-within kbd { opacity: 0; }
.cmap-count { display: flex; gap: 10px; }
.cmap-count div { padding: 6px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); text-align: center; min-width: 88px; }
.cmap-count b { display: block; font: 800 1.2rem var(--font-head); line-height: 1.1; color: var(--text); transition: transform .3s var(--spring); }
.cmap-count b.bump { animation: bump .45s var(--spring); }
@keyframes bump { 40% { transform: scale(1.25); color: var(--s2); } }
.cmap-count span { font-size: .7rem; color: var(--text-2); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.cmap-suggest { margin: 12px 0 6px; }
.cmap-suggest .chip { cursor: pointer; }
.cmap-suggest .chip.on { background: var(--s2); color: #fff; border-color: transparent; }
.cmap-summary { min-height: 28px; margin: 6px 0 14px; font-size: .92rem; }
.cmap-summary > * { animation: page-in .35s var(--ease) both; }
.cmap-summary .chip { cursor: pointer; }
.cmap-summary .chips .chip { animation: pop-in .35s var(--spring) both; animation-delay: calc(var(--i, 0) * 18ms); }
.cmap-body { display: grid; grid-template-columns: minmax(0, 7fr) minmax(290px, 5fr); gap: 20px; align-items: start; }
.cmap .legend { margin: 14px 0 0; }
.cmap .legend i.sw { border: 1px solid color-mix(in srgb, var(--text-2) 30%, transparent); }
.cmap .legend .scale { display: inline-block; width: 90px; height: 10px; border-radius: 99px; margin: 0 6px; vertical-align: -1px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--s1) 22%, var(--surface)), var(--s1)); }

.map-wrap { position: relative; }
.cmap-svg { position: relative; border-radius: 18px; overflow: hidden; border: 1px solid var(--border);
  background: radial-gradient(ellipse at 40% 35%, color-mix(in srgb, var(--primary) 10%, var(--surface)), color-mix(in srgb, var(--primary) 4%, var(--surface-2)) 75%);
  box-shadow: inset 0 0 60px color-mix(in srgb, var(--primary) 7%, transparent); touch-action: none; }
.cmap-svg svg { width: 100%; height: auto; display: block; cursor: grab; }
.cmap-svg svg.dragging { cursor: grabbing; }
.cmap-svg .graticule { stroke: color-mix(in srgb, var(--primary) 12%, transparent); stroke-width: .5; fill: none; pointer-events: none; }
.cmap-svg .land.bg { fill: var(--surface-3); opacity: .55; stroke: var(--surface); stroke-width: .5; }
.cmap-svg .land.country {
  fill: var(--f); cursor: pointer; stroke: var(--surface); stroke-width: .8; vector-effect: non-scaling-stroke;
  transition: fill .4s var(--ease), opacity .4s var(--ease), stroke .2s, filter .25s;
}
.cmap-svg .land.country:hover { stroke: var(--text); stroke-width: 1.5; filter: brightness(1.08) drop-shadow(0 3px 6px rgba(10,50,35,.25)); }
.cmap-svg .land.island { stroke: var(--text-2); stroke-width: 1; }
.cmap-svg svg.searching .land.country { opacity: .3; }
.cmap-svg svg.searching .land.country.match { opacity: 1; fill: var(--s2); animation: match-in .5s var(--ease) both; animation-delay: var(--md, 0ms); }
@keyframes match-in { from { opacity: .3; } to { opacity: 1; } }
.cmap-svg .land.country.picked { stroke: var(--text); stroke-width: 2.4; opacity: 1; filter: drop-shadow(0 4px 10px rgba(10,50,35,.35)); }
.cmap-svg .pulse { fill: none; stroke: var(--s2); vector-effect: non-scaling-stroke; pointer-events: none; animation: pulse 1.8s ease-out infinite; }
@keyframes pulse { from { stroke-width: 2; stroke-opacity: .9; } to { stroke-width: 14; stroke-opacity: 0; } }
/* zoom controls and the hovered-country badge */
.map-ctrl { position: absolute; right: 12px; top: 12px; display: flex; flex-direction: column; gap: 6px; z-index: 2; }
.map-ctrl button { width: 36px; height: 36px; border-radius: 11px; border: 1px solid var(--glass-border); background: var(--glass); backdrop-filter: blur(12px);
  color: var(--text); font: 700 1.1rem var(--font); cursor: pointer; display: grid; place-items: center; box-shadow: var(--shadow);
  transition: transform .25s var(--spring), color .2s; }
.map-ctrl button:hover { transform: scale(1.08); color: var(--primary); }
.map-badge { position: absolute; left: 12px; bottom: 12px; z-index: 2; padding: 9px 13px; border-radius: 13px; max-width: calc(100% - 24px);
  background: var(--glass); backdrop-filter: blur(14px); border: 1px solid var(--glass-border); box-shadow: var(--shadow);
  font-size: .82rem; pointer-events: none; transition: opacity .25s, transform .3s var(--ease); }
.map-badge:empty { opacity: 0; transform: translateY(8px); }
.map-badge b { font-family: var(--font-head); font-size: .95rem; }
.map-hint { position: absolute; left: 12px; top: 12px; z-index: 2; font-size: .74rem; color: var(--text-2); padding: 5px 10px; border-radius: 99px;
  background: var(--glass); backdrop-filter: blur(10px); border: 1px solid var(--glass-border); pointer-events: none; }

.cmap-card { max-height: 600px; overflow: auto; position: sticky; top: calc(var(--topbar-h) + 14px); }
.cmap-card.swap > * { animation: card-swap .45s var(--ease) both; }
.cmap-card.swap > *:nth-child(2) { animation-delay: 40ms; } .cmap-card.swap > *:nth-child(n+3) { animation-delay: 80ms; }
@keyframes card-swap { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
.cmap-card h2 { font-size: 1.45rem; }
.cmap-card h3 { margin: 16px 0 8px; font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-2); display: flex; align-items: center; gap: 8px; }
.cmap-card h3::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.cmap-lang { padding: 11px 13px; border-radius: 13px; border: 1px solid var(--border); margin-bottom: 8px; background: var(--surface); transition: transform .25s var(--ease), box-shadow .25s, border-color .2s; }
.cmap-lang:hover { transform: translateX(3px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--primary) 30%, var(--border)); }
.cmap-lang.hit { border-color: var(--s2); background: color-mix(in srgb, var(--s2) 8%, var(--surface)); box-shadow: 0 6px 18px -8px color-mix(in srgb, var(--s2) 60%, transparent); }
.cmap-lang-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 4px; }
.cmap-lang-head .chip { font-size: .7rem; padding: 1px 8px; }
.cmap-res { display: grid; grid-template-columns: 110px 1fr 40px; gap: 8px; align-items: center; font-size: .85rem; margin-top: 5px; }
.cmap-res b { text-align: right; font-variant-numeric: tabular-nums; }
.cmap-res .bar-track { height: 8px; }
.cmap-res .bar-fill { background: linear-gradient(90deg, var(--s1), color-mix(in srgb, var(--s1) 60%, var(--s3))); }
.cmap-note { font-size: .84rem; margin: 4px 0 0; }
.empty-card { text-align: center; padding: 34px 10px; color: var(--text-2); }
.empty-card svg { width: 38px; height: 38px; color: var(--primary); animation: breathe 3.5s ease-in-out infinite; }

/* ========================================================================== where a language is spoken */
.spoken .section-title h2 { display: flex; align-items: center; gap: 8px; }
.spoken-tabs { margin-bottom: 14px; }
.spoken-body { display: grid; grid-template-columns: minmax(0, 7fr) minmax(260px, 5fr); gap: 20px; align-items: start; }
.spoken-svg .land.country { fill: var(--surface-3); }
.cmap-svg svg.spoken-svg .land.country.wide { fill: color-mix(in srgb, var(--s2) 30%, var(--surface)); animation: match-in .6s var(--ease) both; animation-delay: var(--md, 0ms); }
.cmap-svg svg.spoken-svg .land.country.nat { fill: color-mix(in srgb, var(--s2) 62%, var(--surface)); animation: match-in .6s var(--ease) both; animation-delay: var(--md, 0ms); }
.cmap-svg svg.spoken-svg .land.country.off { fill: var(--s2); animation: match-in .6s var(--ease) both; animation-delay: var(--md, 0ms); }
.cmap-svg svg.spoken-svg .land.country.home { stroke: var(--text); stroke-width: 2.2; }
.home-sw { background: var(--surface) !important; border: 2px solid var(--text) !important; }
.spoken-family { font-size: .85rem; color: var(--text-2); margin: 10px 0 0; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.spoken-side h3 span { font-weight: 700; color: var(--s2); margin-left: 4px; }
.spoken-side .chip.home { box-shadow: inset 0 0 0 2px var(--text); color: var(--text); }
.spoken-hero { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 16px; margin-bottom: 6px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--s2) 14%, var(--surface)), color-mix(in srgb, var(--s2) 4%, var(--surface)));
  border: 1px solid color-mix(in srgb, var(--s2) 30%, var(--border)); }
.spoken-hero b { font-family: var(--font-head); font-size: 1.15rem; }
.spoken-count { font: 800 2.4rem/1 var(--font-head); color: var(--s2); min-width: 1.6ch; text-align: center; font-variant-numeric: tabular-nums; }
.spoken-side h3 { margin: 14px 0 8px; font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-2); }
.spoken-side .chips .chip { animation: pop-in .35s var(--spring) both; animation-delay: calc(var(--i, 0) * 25ms); cursor: pointer; }
.spoken-side .chips.small .chip { font-size: .72rem; padding: 2px 9px; }
.spoken-country { margin-top: 14px; padding: 11px 13px; border-radius: 13px; border: 1px solid var(--border); background: var(--surface-2); animation: card-swap .35s var(--ease) both; }
.spoken-country .chip { margin-left: 6px; font-size: .72rem; }

.spoken-strip { margin-top: 14px; padding: 14px 16px; border-radius: 14px; display: grid; gap: 10px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--s2) 10%, var(--surface-2)), var(--surface-2)); border-left: 4px solid var(--s2); }
.spoken-strip .tag { font-size: .73rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--text-2); display: flex; gap: 8px; align-items: center; }
.spoken-strip .tag b { color: var(--s2); }
.spoken-strip .chip.official { background: var(--s2); color: #fff; border-color: transparent; }
.spoken-strip .chip.national { background: color-mix(in srgb, var(--s2) 62%, var(--surface)); color: #fff; border-color: transparent; }
.spoken-strip .chip { background: var(--surface); }
.spoken-strip .btn { justify-self: end; padding: 7px 14px; font-size: .85rem; }

/* ========================================================================== responsive */
@media (max-width: 1100px) {
  .hero .orbit { display: none; }
  .cols-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  nav a svg.icon { display: none; }
}
@media (max-width: 960px) {
  .cols-3, .cols-4, .cols-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols-2, .split { grid-template-columns: 1fr !important; }
  .cmap-body, .spoken-body { grid-template-columns: 1fr; }
  .cmap-card { position: static; max-height: none; }
  .topbar { padding: 0 16px; gap: 12px; }
  main { padding: 22px 16px 32px; }
  .footer { padding: 20px 16px 28px; }
  #menu-toggle { display: grid; }
  /* nav becomes a drop-down sheet */
  nav { position: fixed; left: 12px; right: 12px; top: calc(var(--topbar-h) + 6px); flex-direction: column; gap: 2px; padding: 10px;
    background: color-mix(in srgb, var(--surface) 97%, transparent); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-lg);
    opacity: 0; transform: translateY(-10px) scale(.98); pointer-events: none; transition: opacity .25s, transform .3s var(--ease); }
  nav.open { opacity: 1; transform: none; pointer-events: auto; }
  /* a blurred parent bleeds through its children in Chrome: go solid while the menu is open */
  .topbar:has(nav.open) { backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--surface); }
  nav a { padding: 12px 14px; border-radius: 12px; font-size: 1rem; }
  nav a svg.icon { display: inline; }
  nav a.active { background: var(--primary-soft); }
  nav .nav-ink { display: none; }
  .brand { flex: 1; }
  .hero { padding: 38px 28px 34px; border-radius: 22px; }
}
@media (max-width: 640px) {
  body { font-size: 14.5px; }
  .cols-2, .cols-3, .cols-4 { grid-template-columns: 1fr; }
  .cols-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card { padding: 18px 16px; border-radius: 16px; }
  .stat .value { font-size: 1.5rem; }
  .stat .card-icon { width: 40px; height: 40px; }
  .hero { padding: 30px 20px 26px; }
  .hero .btn { flex: 1; }
  .brand small { display: none; }
  .bar-row { grid-template-columns: minmax(90px, 40%) 1fr 44px; gap: 8px; }
  .gbar, .axis { grid-template-columns: 110px 1fr; gap: 8px; }
  .cmap-res { grid-template-columns: 84px 1fr 36px; }
  .cmap-count { width: 100%; }
  .cmap-count div { flex: 1; }
  .segmented { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; }
  .segmented::-webkit-scrollbar { display: none; }
  .segmented button { white-space: nowrap; flex: 0 0 auto; scroll-snap-align: start; }
  .result-head { flex-direction: column-reverse; align-items: flex-start; }
  .map-hint { display: none; }
  #toasts { left: 12px; right: 12px; }
  .toast { max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
}

/* ========================================================================== identity: purple refresh */
/* gradient border that fades in when a card is hovered */
a.card::after, .card.lift::after, .stat::before {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 1px; pointer-events: none; opacity: 0;
  background: var(--brand-grad);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  transition: opacity .35s var(--ease);
}
a.card:hover::after, .card.lift:hover::after, .stat:hover::before { opacity: 1; }
.brand span { background: linear-gradient(120deg, var(--text) 35%, var(--primary) 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand small { -webkit-text-fill-color: var(--text-2); }
.section-title h2::before { content: ""; display: inline-block; width: 6px; height: .95em; border-radius: 4px; margin-right: 10px; vertical-align: -.1em; background: var(--brand-grad); }
.page-head h1 .title-text { background: linear-gradient(120deg, var(--text) 25%, var(--primary) 70%, var(--primary-2) 100%); -webkit-background-clip: text; background-clip: text; }
/* slow aurora sweeping across the banner */
.hero::after { content: ""; position: absolute; inset: -40%; z-index: -1; pointer-events: none; opacity: .45;
  background: conic-gradient(from 0deg at 60% 40%, transparent 0 20%, rgba(250,204,21,.25) 30%, transparent 42%, rgba(45,212,191,.4) 60%, transparent 72%);
  animation: aurora 22s linear infinite; filter: blur(40px); }
@keyframes aurora { to { transform: rotate(360deg); } }
.btn:not(.secondary):not(.danger):not(.light):not(.ghost):hover { box-shadow: 0 14px 30px -8px color-mix(in srgb, var(--primary-2) 55%, transparent), inset 0 1px 0 rgba(255,255,255,.2); }
nav a.active { color: var(--primary); }
.chip.primary { background: var(--primary-soft); }
::selection { background: color-mix(in srgb, var(--primary-2) 30%, transparent); }
.footer .dots i:nth-child(1) { background: var(--glow-1) !important; } .footer .dots i:nth-child(2) { background: var(--glow-2) !important; } .footer .dots i:nth-child(3) { background: var(--glow-3) !important; }

/* ========================================================================== phones and tablets: smooth first */
/* Touch screens: no "sticky" hover lifts after a tap, no grey tap flash, and press feedback instead. */
@media (hover: none) {
  html { -webkit-tap-highlight-color: transparent; }
  a.card:hover, .card.lift:hover, .stat:hover, .btn:hover, button.chip:hover, .examples button:hover,
  .map-ctrl button:hover, .cmap-lang:hover, .icon-btn:hover, .brand:hover img,
  a.card:hover .card-icon, a.card:hover .more svg { transform: none; }
  a.card:hover::after, .card.lift:hover::after, .stat:hover::before { opacity: 0; }
  .btn:active, button.chip:active, .map-ctrl button:active, a.card:active, .cmap-lang:active { transform: scale(.97); transition-duration: .08s; }
}
/* Small or touch screens: drop the effects that cost the most GPU time while scrolling
   (live background blur, the rotating blurred aurora, blurred page entrances). Same look, far fewer repaints. */
@media (max-width: 960px), (hover: none) {
  :root { --glass: rgba(255, 255, 255, .97); }
  :root[data-theme="dark"] { --glass: rgba(13, 26, 21, .97); }
  *, *::before, *::after { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
  .topbar { background: color-mix(in srgb, var(--surface) 96%, transparent); }
  th { background: var(--surface-2); }
  .hero::after { display: none; }
  .hero, .hero .blob { animation: none; }
  .hero .blob { filter: none; }
  .page { animation-name: page-in-lite; animation-duration: .35s; }
  .card { will-change: auto; }
  /* 16px text stops iPhones from zooming the page when a field is focused */
  input[type=text], input[type=number], input[type=search], select, textarea { font-size: 16px; }
  /* bigger touch targets */
  .map-ctrl button { width: 42px; height: 42px; }
  .segmented button { min-height: 40px; }
  /* one finger scrolls the page up and down; sideways drags and two-finger pinch move the map */
  .cmap-svg, .cmap-svg svg { touch-action: pan-y; }
  .cmap-svg svg { cursor: default; }
}
@keyframes page-in-lite { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
