/* NorgeDojo — "fjord paper" design language (from the Claude-Design mockup).
   Cool paper ground, fjord-teal primary, SERIF display voice (Charter/Iowan/
   Georgia) over Hanken Grotesk text, r=20 cards with soft double shadow,
   CSS-drawn flag app icon, aurora Frøya surfaces, floating blurred tab bar.
   Dark twin: deep navy polar night with aurora accents (mockup is light-only).
   Token NAMES are unchanged from v1 so every inline var() in app.js resolves. */

@font-face {
  /* warm rounded display+text face (variable 400–800) — the vibrant register */
  font-family: "Nunito"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url("fonts/nunito.woff2") format("woff2");
}
@font-face {
  font-family: "Hanken Grotesk"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("fonts/hanken-grotesk-v12-latin_latin-ext-regular.woff2") format("woff2");
}
@font-face {
  font-family: "Hanken Grotesk"; font-style: normal; font-weight: 500; font-display: swap;
  src: url("fonts/hanken-grotesk-v12-latin_latin-ext-500.woff2") format("woff2");
}
@font-face {
  font-family: "Hanken Grotesk"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("fonts/hanken-grotesk-v12-latin_latin-ext-700.woff2") format("woff2");
}

@font-face {
  /* warm rounded display+text face (variable 400–800) — the vibrant register */
  font-family: "Nunito"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url("fonts/nunito.woff2") format("woff2");
}

:root {
  /* fjord-paper palette (mockup): teal primary, flag red, gold, green, violet */
  --blue: #175E7E; --green: #2E9E52; --orange: #E8A13C; --red: #C0392E;
  --indigo: #6D5BC7;
  --green-text: #1F7A3C; --orange-text: #A9701C; --red-text: #A93226;
  --blue-text: #11485F;
  /* gender tokens — divorced from feedback semantics */
  --gen-en: var(--blue); --gen-ei: var(--red); --gen-et: var(--green);
  --flame: var(--red);
  /* cool paper ground, white panel cards, teal-soft control fills */
  --bg: #EDF2F8; --card: #FFFFFF; --card2: #E2EEF5; --card3: #E2E9F2;
  --ink: #14273B; --ink2: #5E7188; --ink3: #A9B8C9;
  --sep: #E2E9F2;
  --material: rgba(237,242,248,.88);
  --shadow: 0 1px 2px rgba(20,39,59,.05), 0 10px 28px -14px rgba(20,39,59,.16);
  --shadow-sm: 0 1px 2px rgba(20,39,59,.05), 0 6px 18px -12px rgba(20,39,59,.14);
  --r-card: 24px; --r-ctl: 15px; --r-pill: 999px;
  --blur: saturate(160%) blur(14px);
  --spring: cubic-bezier(0.32, 0.72, 0, 1);
  /* rounded, friendly stack (vibrant.md #6): system rounded faces FIRST so the
     UI reads warm/hand-made instead of the generic grotesque generated apps use.
     ui-rounded/SF Pro Rounded = Apple, Segoe UI Variable = Win11, then webfonts. */
  --font: ui-rounded, "SF Pro Rounded", "Segoe UI Variable Display", "Nunito",
          "Quicksand", "Varela Round", "Hanken Grotesk", -apple-system,
          BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --serif: ui-rounded, "SF Pro Rounded", "Segoe UI Variable Display", "Nunito",
           "Quicksand", "Varela Round", "Hanken Grotesk", -apple-system,
           "Segoe UI", system-ui, sans-serif;
  --mono: "SF Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
  --btn-ink: #fff;
  /* aurora — Frøya's night-sky surfaces (same in both themes) */
  --aurora: linear-gradient(140deg, #26506B, #173C54 55%, #2E6470);
  --aurora-glow: radial-gradient(120% 60% at 80% -10%, rgba(120,220,190,.35), transparent 60%),
                 radial-gradient(80% 50% at 20% 0%, rgba(140,180,255,.25), transparent 60%);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    /* polar night: navy ground, aurora accents */
    --blue: #5CA8CC; --green: #3FCF8E; --orange: #EFB35C; --red: #E2695E;
    --indigo: #9C8CF0;
    --green-text: var(--green); --orange-text: var(--orange); --red-text: var(--red);
    --blue-text: #8CC6E2;
    --bg: #0A1424; --card: #15263C; --card2: #1E3350; --card3: #2A4160;
    --ink: #F5F9FD; --ink2: #C9D8E7; --ink3: #91A8BE;
    --sep: rgba(140,170,200,.18);
    --material: rgba(10,20,36,.80);
    --shadow: 0 1px 2px rgba(0,0,0,.35), 0 12px 30px -14px rgba(0,0,0,.6);
    --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
    --btn-ink: #06131F;
  }
}
html[data-theme="light"] {
  --blue:#175E7E; --green:#2E9E52; --orange:#E8A13C; --red:#C0392E;
  --indigo:#6D5BC7;
  --green-text:#1F7A3C; --orange-text:#A9701C; --red-text:#A93226;
  --blue-text:#11485F;
  --bg:#EDF2F8; --card:#FFFFFF; --card2:#E2EEF5; --card3:#E2E9F2;
  --ink:#14273B; --ink2:#5E7188; --ink3:#A9B8C9;
  --sep:#E2E9F2; --material:rgba(237,242,248,.88);
  --shadow:0 1px 2px rgba(20,39,59,.05), 0 10px 28px -14px rgba(20,39,59,.16);
  --shadow-sm:0 1px 2px rgba(20,39,59,.05), 0 6px 18px -12px rgba(20,39,59,.14);
  --btn-ink:#fff;
}
html[data-theme="dark"] {
  --blue:#5CA8CC; --green:#3FCF8E; --orange:#EFB35C; --red:#E2695E;
  --indigo:#9C8CF0;
  --green-text:var(--green); --orange-text:var(--orange); --red-text:var(--red);
  --blue-text:#8CC6E2;
  --bg:#0A1424; --card:#15263C; --card2:#1E3350; --card3:#2A4160;
  --ink:#F5F9FD; --ink2:#C9D8E7; --ink3:#91A8BE;
  --sep:rgba(140,170,200,.18); --material:rgba(10,20,36,.80);
  --shadow:0 1px 2px rgba(0,0,0,.35), 0 12px 30px -14px rgba(0,0,0,.6);
  --shadow-sm:0 1px 2px rgba(0,0,0,.4);
  --btn-ink:#06131F;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  font-size: 16px; letter-spacing: 0; line-height: 1.45;
  background: var(--bg); color: var(--ink);
  min-height: 100dvh;
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
  -webkit-font-smoothing: antialiased;
  text-wrap: pretty;
}
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
[hidden] { display: none !important; }

/* ---------------- top bar (frosted paper) ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
  background: var(--material); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
}
.topbar .brand {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--serif); font-weight: 700; font-size: 21px; letter-spacing: -.01em;
}
.brand-fox {
  width: 38px; height: 38px; border-radius: 50%; object-fit: cover;
  background: #dcecf7; border: 2px solid rgba(255,255,255,.78);
  box-shadow: 0 2px 10px rgba(20,39,59,.18); flex: none;
}
.topbar .brand img.brand-logo { display: none; } /* flag appicon replaces the logo here */
/* CSS-drawn Norwegian flag app icon (mockup) */
.appicon {
  width: 34px; height: 34px; border-radius: 10px; overflow: hidden; position: relative;
  background: #BA332A; box-shadow: inset 0 0 0 1px rgba(20,39,59,.08); flex: none; display: block;
}
.appicon::before { content: ""; position: absolute; inset: 0; background:
  linear-gradient(#fff 0 0) 0 44% / 100% 30% no-repeat,
  linear-gradient(#fff 0 0) 30% 0 / 30% 100% no-repeat; }
.appicon::after { content: ""; position: absolute; inset: 0; background:
  linear-gradient(#20486E 0 0) 0 47% / 100% 16% no-repeat,
  linear-gradient(#20486E 0 0) 33.5% 0 / 16% 100% no-repeat; }
.topbar .spacer { flex: 1; }
.profile-wrap { position: relative; flex: none; }
.profile-btn {
  min-width: 78px; height: 46px; display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 4px 12px 4px 5px; border: 1px solid var(--sep); border-radius: var(--r-pill);
  background: var(--card); color: var(--ink); box-shadow: var(--shadow-sm); cursor: pointer;
  font-family: var(--serif); font-size: 16px; font-weight: 800;
}
.profile-btn img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: var(--card2); }
.profile-btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; transition: transform .2s ease; }
.profile-btn[aria-expanded="true"] svg { transform: rotate(180deg); }
.profile-menu {
  position: absolute; top: calc(100% + 10px); right: 0; z-index: 300;
  width: min(310px, calc(100vw - 24px)); padding: 10px;
  border: 1px solid var(--sep); border-radius: 20px; background: var(--card);
  color: var(--ink); box-shadow: 0 24px 70px -20px rgba(3,12,24,.6);
}
.profile-summary { display: flex; align-items: center; gap: 11px; padding: 5px 5px 12px; border-bottom: 1px solid var(--sep); }
.profile-summary img { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; background: var(--card2); }
.profile-summary strong, .profile-summary small { display: block; }
.profile-summary strong { font-family: var(--serif); font-size: 17px; }
.profile-summary small { margin-top: 1px; color: var(--ink2); font-size: 12.5px; }
.profile-section { padding: 12px 5px 8px; }
.profile-label { display: block; margin-bottom: 7px; color: var(--ink2); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.theme-choices { display: grid; grid-template-columns: repeat(3,1fr); gap: 5px; padding: 4px; border-radius: 14px; background: var(--bg); }
.theme-choices button {
  border: 0; border-radius: 10px; padding: 8px 4px; background: transparent; color: var(--ink2);
  font-size: 12.5px; font-weight: 800; cursor: pointer;
}
.theme-choices button.on { background: var(--blue); color: var(--btn-ink); box-shadow: var(--shadow-sm); }
.profile-menu-item {
  width: 100%; padding: 11px 10px; border: 0; border-radius: 12px; background: transparent;
  color: var(--ink); text-align: left; font-size: 14px; font-weight: 750; cursor: pointer;
}
.profile-menu-item:hover, .profile-menu-item:focus-visible { background: var(--card2); }
.profile-menu-item.danger { color: var(--red-text); border-top: 1px solid var(--sep); border-radius: 0 0 12px 12px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--card); box-shadow: var(--shadow-sm); border: none; cursor: pointer;
  color: var(--ink); transition: transform .25s var(--spring), background .2s;
}
.icon-btn:active { transform: scale(.92); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn.primary { width: 44px; height: 44px; background: var(--blue); color: var(--btn-ink); }
.streak-pill {
  display: flex; align-items: center; gap: 5px;
  padding: 6px 12px; border-radius: var(--r-pill);
  background: var(--card); box-shadow: var(--shadow-sm);
  font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums;
}
.streak-pill svg { width: 14px; height: 14px; color: var(--flame); }
.streak-pill .flame-img { width: 15px; height: 20px; object-fit: contain; }
#streakVal { font-family: var(--serif); font-size: 16px; }

/* ---------------- layout ---------------- */
main { max-width: 640px; margin: 0 auto; padding: 16px;
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right)); }
.view { display: none; animation: viewin .35s var(--spring); }
.view.active { display: block; }
@keyframes viewin { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* serif display voice for headings & page titles (mockup) */
h1 { font-family: var(--serif); font-size: 30px; font-weight: 700; letter-spacing: -0.01em; margin: 8px 0 16px; }
h2 { font-family: var(--serif); font-size: 21px; font-weight: 700; letter-spacing: -0.01em; margin: 24px 0 8px; }
.sub { color: var(--ink2); font-size: 14.5px; }
/* uppercase section label — stays sans, the one caps-label token */
.sec-label {
  font-family: var(--font);
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  color: var(--ink2); margin: 26px 0 8px;
}
.sec-label span, .sec-label .sub { text-transform: none; letter-spacing: 0; font-weight: 400; }

/* ---------------- guided daily mission (Today) ---------------- */
.today-heading { display:flex; align-items:center; justify-content:space-between; gap:16px; }
.today-heading h1 { margin:6px 0 2px; font-size: 30px; }
.today-heading .grow { flex:1; min-width:0; }
.eyebrow { color:var(--ink2); font-size:14px; font-weight:500; margin:8px 0 1px; }
.mission-ring { --p:0; width:64px; height:64px; flex:0 0 64px; border-radius:50%;
  display:grid; place-items:center; position:relative; }
.mission-ring::before { content:""; position:absolute; inset:0; border-radius:50%;
  background:conic-gradient(var(--blue) calc(var(--p) * 1%), var(--card3) 0);
  -webkit-mask:radial-gradient(closest-side, transparent calc(100% - 9px), #000 calc(100% - 8px));
  mask:radial-gradient(closest-side, transparent calc(100% - 9px), #000 calc(100% - 8px)); }
.mission-ring::after { content:none; }
.mission-ring span { position:relative; z-index:1; font-size:14px; font-weight:700;
  font-family:var(--serif); font-variant-numeric:tabular-nums; }
/* aurora hero — Frøya's sky (mockup froya-card), same in both themes */
.mission-hero { display:flex; gap:14px; align-items:center; padding:18px; border-radius:var(--r-card);
  position:relative; overflow:hidden; color:#fff;
  background:var(--aurora); border:none; box-shadow:var(--shadow); }
.mission-hero::before { content:""; position:absolute; inset:0; background:var(--aurora-glow); }
.mission-hero > * { position:relative; }
.mission-scene { width:64px; height:64px; flex:0 0 64px; border-radius:50%; display:grid; place-items:center;
  overflow:hidden; background:rgba(255,255,255,.92); box-shadow:var(--shadow-sm); }
.mission-scene img { width:50px; height:50px; }
.mission-hero h2 { margin:2px 0; font-size:19px; color:#fff; }
.mission-hero p { font-size:13px; color:#C9DBE6; }
.mission-kicker { font-size:12px; letter-spacing:.06em; font-weight:700; text-transform:uppercase; color:var(--ink2); }
.session-length { display:grid; grid-template-columns:repeat(3,1fr); gap:4px; margin:12px 0; padding:4px;
  border-radius:var(--r-pill); background:var(--card); box-shadow:var(--shadow-sm); }
.session-length button { border:0; border-radius:var(--r-pill); padding:9px 3px; background:transparent; cursor:pointer;
  font-size:14.5px; font-weight:700; color:var(--ink); }
.session-length button span { display:block; font-size:12.5px; font-weight:500; color:var(--ink2); }
.session-length button.on { background:var(--blue); color:var(--btn-ink); }
.session-length button.on span { color:color-mix(in srgb, var(--btn-ink) 75%, transparent); }
.mission-cta { min-height:52px; border-radius:16px; font-size:16px;
  box-shadow:0 10px 22px -10px color-mix(in srgb, var(--blue) 55%, transparent); }
.return-note { color:var(--ink2); font-size:13.5px; text-align:center; margin:8px 0 18px; }
.path-title { display:flex; justify-content:space-between; align-items:baseline; margin-top:10px; }
.path-title span { font-family:var(--font); font-size:13px; color:var(--ink2); font-weight:700; font-variant-numeric:tabular-nums; }
/* step path — rail + dots (mockup steps) */
.path-step { position:relative; display:flex; gap:12px; align-items:center; background:transparent; border:0;
  width:100%; padding:8px 8px; border-radius:14px; color:var(--ink); text-align:left; cursor:pointer; }
.path-step.current { background:var(--card2); }
.path-step::before { content:""; position:absolute; left:24px; top:44px; bottom:-8px; width:2px; background:var(--sep); }
.path-step.done::before { background:var(--green); }
.path-step:last-child::before { display:none; }
.path-node { width:34px; height:34px; flex:0 0 34px; display:grid; place-items:center; border-radius:50%;
  background:var(--card); box-shadow:var(--shadow-sm); font-size:15px; border:2px solid var(--sep);
  color:var(--ink2); position:relative; z-index:1; }
.path-node svg { width:18px; height:18px; }
.path-step.current .path-node { background:var(--blue); border-color:var(--blue); color:var(--btn-ink); }
.path-step.done .path-node { background:var(--green); border-color:var(--green); color:#fff; font-size:15px; }
.path-copy { flex:1; min-width:0; }
.path-copy strong { display:block; font-size:15px; }
.path-copy small { display:block; color:var(--ink2); font-size:13px; margin-top:1px; font-variant-numeric:tabular-nums; }
.path-state { font-size:12.5px; font-weight:800; color:var(--ink2);
  background:var(--bg); border-radius:var(--r-pill); padding:6px 11px; }
.path-step.current .path-state { color:var(--btn-ink); background:var(--blue); }
.path-step.done .path-state { color:var(--green-text); background:color-mix(in srgb, var(--green) 14%, transparent); }
.today-details { margin-top:10px; color:var(--ink2); }
.today-details summary { cursor:pointer; font-size:14px; font-weight:700; padding:10px 2px; }
.today-details .tiles { margin-top:8px; }
/* rotating "Visste du?" culture-fact card */
.factcard { display:flex; flex-direction:column; align-items:flex-start; gap:6px;
  width:100%; text-align:left; cursor:pointer;
  background:color-mix(in srgb, var(--blue) 7%, var(--card));
  border:1px solid color-mix(in srgb, var(--blue) 20%, transparent);
  transition:transform .2s var(--spring); }
.factcard:active { transform:scale(.99); }
.factcard[hidden] { display:none !important; }
.factcard .fact-eyebrow { font-size:12px; font-weight:800; letter-spacing:.04em;
  text-transform:uppercase; color:var(--blue-text); }
.factcard .fact-body { display:flex; align-items:center; gap:12px; width:100%; min-height:2.9em; }
.factcard .fact-art {
  flex: none;
  width: 72px;
  height: 72px;
  border: 1px solid color-mix(in srgb, var(--blue) 18%, transparent);
  border-radius: 18px;
  background-image: url("img/culture-scenes-atlas.png");
  background-repeat: no-repeat;
  background-size: 400% 400%;
  background-position: calc(var(--atlas-x, 0) * 33.333%) calc(var(--atlas-y, 0) * 33.333%);
  box-shadow: var(--shadow-sm);
  transition: opacity .18s ease;
}
.factcard .fact-text { flex:1; font-size:15.5px; line-height:1.5; color:var(--ink);
  transition:opacity .18s ease; }
.mission-coach { position:fixed; left:50%; bottom:calc(84px + env(safe-area-inset-bottom)); z-index:65;
  transform:translateX(-50%); width:min(92vw,600px); display:flex; align-items:center; gap:10px;
  padding:11px 12px; border-radius:18px; background:var(--card); box-shadow:0 14px 30px -10px rgba(20,39,59,.45); }
.mission-coach[hidden] { display:none; }
.mission-coach strong { font-family:var(--serif); }
.mission-coach .coach-check { width:32px; height:32px; display:grid; place-items:center; border-radius:50%;
  background:var(--green); color:#fff; }
.mission-coach .coach-check svg { width:18px; height:18px; }
.mission-coach strong,.mission-coach small { display:block; }
.mission-coach small { color:var(--ink2); font-size:13px; }

/* ---------------- admin dashboard ---------------- */
.admin-heading { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.admin-heading h1 { margin-top:0; }
.admin-health { display:flex; align-items:center; gap:12px; margin-top:14px; }
.health-dot { width:12px; height:12px; border-radius:50%; background:var(--red); box-shadow:0 0 0 5px color-mix(in srgb,var(--red) 13%,transparent); }
.health-dot.ok { background:var(--green); box-shadow:0 0 0 5px color-mix(in srgb,var(--green) 13%,transparent); }
.admin-users { padding:0 16px; }
.admin-user-row { display:flex; align-items:center; gap:12px; padding:14px 0; border-bottom:1px solid var(--sep); }
.admin-user-row:last-child { border-bottom:0; }
.admin-avatar { width:40px; height:40px; flex:0 0 40px; border-radius:13px; display:grid; place-items:center;
  background:var(--card2); color:var(--blue-text); font-weight:700; font-family:var(--serif); }
.admin-badge { font-size:11px; letter-spacing:.06em; color:var(--blue-text); background:var(--card2);
  padding:3px 6px; border-radius:999px; vertical-align:2px; }

.card {
  background: var(--card); border-radius: var(--r-card);
  border: none;
  box-shadow: var(--shadow); padding: 16px; margin-bottom: 12px;
}
.card.tappable { cursor: pointer; transition: transform .25s var(--spring); }
.card.tappable:active { transform: scale(.98); }

.row { display: flex; align-items: center; gap: 12px; }
.row .grow { flex: 1; min-width: 0; }

/* ---------------- buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 11px 18px;
  border: none; border-radius: 16px; cursor: pointer;
  background: var(--blue); color: var(--btn-ink); font-weight: 800; font-size: 16px;
  transition: transform .25s var(--spring), opacity .2s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.secondary { background: var(--card); color: var(--blue-text); box-shadow: var(--shadow-sm); }
.btn.quiet { background: transparent; color: var(--blue-text); box-shadow: none; }
.btn.quiet.danger { color: var(--red-text); }
.btn.danger { background: var(--red); color: #fff; }
.btn.small { min-height: 34px; padding: 6px 13px; font-size: 14px; border-radius: var(--r-pill); }
.btn.block { width: 100%; }

/* ---------------- inputs ---------------- */
.field { width: 100%; min-height: 44px; padding: 10px 14px;
  border: 1.5px solid var(--sep); border-radius: 13px;
  background: var(--bg); outline: none; }
.field:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
.field:focus { border-color: var(--blue); }
textarea.field { resize: vertical; min-height: 88px; }
label.lbl { display: block; font-size: 13px; color: var(--ink2); margin: 12px 0 4px; font-weight: 700; }

/* ---------------- tab bar (floating, blurred, rounded top) ---------------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  max-width: 640px; margin: 0 auto;
  display: grid; grid-template-columns: repeat(7, 1fr);
  padding: 8px 6px calc(10px + env(safe-area-inset-bottom));
  padding-left: max(6px, env(safe-area-inset-left));
  padding-right: max(6px, env(safe-area-inset-right));
  background: color-mix(in srgb, var(--card) 92%, transparent);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border-top: 1px solid var(--sep);
  border-radius: 22px 22px 0 0;
}
.tab {
  flex: 1; max-width: none; min-width: 0; white-space: nowrap;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: none; border: none; cursor: pointer;
  color: var(--ink3); font-size: 10.5px; font-weight: 700; letter-spacing: 0;
  padding: 4px 1px 7px; border-radius: 10px; position: relative;
  transition: color .2s;
}
.tab svg { width: 23px; height: 23px; }
.tab.active { color: var(--blue); }
.tab.active::after { content:""; position:absolute; bottom:0; left:50%; translate:-50% 0;
  width:24px; height:3px; border-radius:4px; background:var(--blue); }

/* ---------------- stat tiles (mockup stat-cards) ---------------- */
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.tile { background: var(--card); border-radius: var(--r-card); border: none; box-shadow: var(--shadow); padding: 14px; }
.tile .big { font-family: var(--serif); font-size: 30px; font-weight: 700;
  font-variant-numeric: tabular-nums; letter-spacing: -0.01em; line-height: 1.1; }
.tile .cap { font-size: 13px; font-weight: 700; color: var(--ink2); display: flex; align-items: center; gap: 5px; margin-top: 2px; }
.tile .cap svg { width: 15px; height: 15px; }

/* ---------------- flashcards ---------------- */
.flashcard {
  min-height: 300px; perspective: 1200px; margin-bottom: 16px;
}
.flash-inner {
  position: relative; width: 100%; min-height: 300px;
  transform-style: preserve-3d; transition: transform .5s var(--spring);
}
.flashcard.flipped .flash-inner { transform: rotateY(180deg); }
.flash-face {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  background: var(--card); border-radius: var(--r-card);
  border: none; box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 24px 18px; text-align: center;
}
.flash-face.back { transform: rotateY(180deg); }
.flash-word { font-family: var(--serif); font-size: 34px; font-weight: 700; letter-spacing: -0.01em; }
.flash-word.en { font-size: 27px; }
.art-en { color: var(--gen-en); }
.art-ei { color: var(--gen-ei); }
.art-et { color: var(--gen-et); }
.flash-word .tone-glyph { display: inline-block; color: var(--indigo); margin-left: 6px; vertical-align: 6px; }
.tone-glyph svg { display: inline-block; vertical-align: middle; }
.flash-meta { color: var(--ink2); font-size: 15px; }
.flash-example { font-size: 14.5px; color: var(--ink2); max-width: 42ch; }
.gender-chip { font-size: 12px; font-weight: 800; padding: 3px 9px; border-radius: var(--r-pill); }
.gender-chip.en { background: color-mix(in srgb, var(--gen-en) 14%, transparent); color: var(--gen-en); }
.gender-chip.ei { background: color-mix(in srgb, var(--gen-ei) 14%, transparent); color: var(--gen-ei); }
.gender-chip.et { background: color-mix(in srgb, var(--gen-et) 14%, transparent); color: var(--gen-et); }

/* four-form CHAIN — en bil → bilen → biler → bilene (mockup nouncard chain) */
.chain { display: grid; grid-template-columns: repeat(4, auto); justify-content: space-between;
  gap: 6px; margin: 12px auto 4px; width: 100%; max-width: 420px; }
.chain .f { text-align: center; min-width: 0; }
.chain .f b { font-family: var(--serif); font-size: 17px; font-weight: 700; display: block; white-space: nowrap; }
.chain .f small { display: block; color: var(--ink2); font-size: 10.5px; font-weight: 700; line-height: 1.25; margin-top: 3px; }
.chain .f b:empty::before, .chain .f b .dash { color: var(--ink3); }
.chain.mini .f b { font-size: 15px; }
/* legacy paradigm cells (kept for any cached markup) */
.four-form { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 12px auto 4px; max-width: 340px; }
.ff-cell { background: var(--card2); border-radius: 12px; padding: 8px 10px; text-align: left; }
.ff-cell .ff-lbl { display: block; font-size: 11px; font-weight: 700; letter-spacing: .06em;
  color: var(--ink2); text-transform: uppercase; }
.ff-cell .ff-val { display: block; font-family: var(--serif); font-size: 15px; font-weight: 700; margin-top: 1px; }
.ff-cell.empty .ff-val { color: var(--ink2); }
.tone-note { font-size: 12px; color: var(--ink2); margin-top: 6px; }

/* grade row — one white strip, hairline-separated, colored labels (mockup rate) */
.grade-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0;
  background: var(--card); border-radius: 16px; box-shadow: var(--shadow); padding: 10px 0; }
.grade-btn {
  min-height: 52px; border: none; border-left: 1px solid var(--sep); border-radius: 0; cursor: pointer;
  font-weight: 800; font-size: 14.5px; background: transparent; color: var(--ink);
  display: flex; flex-direction: column; gap: 2px;
  align-items: center; justify-content: center;
  transition: transform .25s var(--spring);
}
.grade-btn:first-child { border-left: none; }
.grade-btn:active { transform: scale(.95); }
.grade-btn small { font-weight: 500; font-size: 11.5px; color: var(--ink2); font-variant-numeric: tabular-nums; }
.grade-1 { color: var(--red-text); }
.grade-2 { color: var(--orange-text); }
.grade-3 { color: var(--green-text); }
.grade-4 { color: var(--blue-text); }

.queue-count { text-align: center; color: var(--ink2); font-size: 13px; font-weight: 700;
  font-variant-numeric: tabular-nums; margin-bottom: 12px; }

/* ---------------- shadowing ---------------- */
.shadow-sentence { font-family: var(--serif); font-size: 23px; font-weight: 700; line-height: 1.4; text-align: center; }
.shadow-translation { text-align: center; color: var(--ink2); font-size: 14.5px; margin-top: 6px; }
.shadow-controls { display: flex; justify-content: center; gap: 14px; margin: 18px 0 6px; }
.round-btn {
  width: 60px; height: 60px; border-radius: 50%; border: none; cursor: pointer;
  display: grid; place-items: center; color: var(--btn-ink); background: var(--blue);
  box-shadow: 0 10px 20px -8px color-mix(in srgb, var(--blue) 60%, transparent);
  transition: transform .25s var(--spring);
}
.round-btn:active { transform: scale(.92); }
.round-btn svg { width: 25px; height: 25px; }
.round-btn.rec { background: var(--red); color: #fff;
  box-shadow: 0 10px 20px -8px color-mix(in srgb, var(--red) 55%, transparent); }
.round-btn.rec.recording { animation: pulse 1.2s ease-in-out infinite; }
.round-btn.secondary { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--red) 45%, transparent); }
  50% { box-shadow: 0 0 0 14px transparent; } }
.round-lbl { font-size: 11px; color: var(--ink2); text-align: center; margin-top: 4px; font-weight: 700; }

.score-ring { display: grid; place-items: center; position: relative; margin: 8px auto; width: 120px; height: 120px; }
.score-ring svg { transform: rotate(-90deg); }
.score-ring .val { position: absolute; font-family: var(--serif); font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }
.word-diff { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 10px; }
.word-diff span { padding: 3px 9px; border-radius: var(--r-pill); font-size: 14.5px; font-weight: 600; }
.word-diff .ok { background: color-mix(in srgb, var(--green) 14%, transparent); color: var(--green-text); }
.word-diff .close { background: color-mix(in srgb, var(--orange) 16%, transparent); color: var(--orange-text); }
.word-diff .wrong, .word-diff .missing { background: color-mix(in srgb, var(--red) 14%, transparent); color: var(--red-text); text-decoration: underline dotted; }

/* ---------------- translate ---------------- */
.prompt-box { font-family: var(--serif); font-size: 21px; font-weight: 700; line-height: 1.4; }
.verdict { display: flex; align-items: center; gap: 8px; font-weight: 800; margin-bottom: 8px; }
.verdict.good { color: var(--green-text); } .verdict.mixed { color: var(--orange-text); }
.verdict.bad { color: var(--red-text); }
.verdict b { color: var(--ink); }
.corr-line { font-family: var(--serif); font-size: 19px; line-height: 1.5; }
.err-item { border-top: 1px solid var(--sep); padding: 10px 0; }
.err-tag { display: inline-block; font-family: var(--font); font-size: 11px; font-weight: 800;
  padding: 2px 8px; border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--indigo) 13%, transparent); color: var(--indigo); }
.err-pair { margin: 4px 0; font-size: 15px; }
.err-pair del { color: var(--red-text); text-decoration-color: color-mix(in srgb, var(--red) 55%, transparent); }
.err-pair ins { color: var(--green-text); text-decoration: none; font-weight: 700; }
.err-expl { color: var(--ink2); font-size: 14px; }

/* ---------------- Chat tab (role-play conversations) ---------------- */
.convo-bar { display: flex; align-items: center; gap: 10px; padding: 4px 0 10px;
  position: sticky; top: calc(54px + env(safe-area-inset-top)); z-index: 30;
  background: var(--bg); }
.convo-title strong { display: block; font-family: var(--serif); font-size: 18px; }
.convo-title small { display: block; font-size: 13px; }

.chat-log { display: flex; flex-direction: column; gap: 10px;
  width: 100%; max-width: 640px; margin: 0 auto; }
/* WhatsApp-style bubbles: tutor = white panel, me = soft teal (mockup msgs) */
.bubble { max-width: 82%; padding: 10px 14px; border-radius: 16px; line-height: 1.45; font-size: 15px; }
.bubble.user { align-self: flex-end; background: var(--card2); color: var(--ink); border-bottom-right-radius: 6px; }
.bubble.bot { align-self: flex-start; background: var(--card); border: none; box-shadow: var(--shadow-sm); border-bottom-left-radius: 6px; }
.bubble.unsent { opacity: .75; cursor: pointer; }
.bubble.unsent .unsent-note { display: block; font-size: 12px; margin-top: 4px; opacity: .9; }
/* avatar bubbles (mockup with-avatar) */
.with-avatar { display: flex; gap: 8px; align-items: flex-end; max-width: 86%; align-self: flex-start; }
.with-avatar .avatar { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; flex: none;
  background: var(--card2); box-shadow: var(--shadow-sm); }
.with-avatar .bubble { max-width: none; }
.speak-inline, .bubble .speak { min-width: 32px; min-height: 32px;
  display: inline-grid; place-items: center; margin: -6px 0 -6px 2px;
  border: none; background: none; cursor: pointer; color: var(--blue-text); padding: 0;
  vertical-align: middle; }
.bubble-note { align-self: flex-end; max-width: 82%; font-size: 13px; color: var(--ink2);
  background: color-mix(in srgb, var(--orange) 10%, transparent);
  border-radius: 12px; padding: 8px 12px; }
.bubble-note .err-tag { font-size: 11px; }
.bubble-note .corr-head { font-size: 11px; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; color: var(--indigo); margin-bottom: 6px; }
.bubble-note .err-item { display: flex; gap: 8px; align-items: flex-start; margin-top: 8px; }
.bubble-note .err-item:first-of-type { margin-top: 0; }
.bubble-note .err-fix { flex: 1; min-width: 0; font-size: 14px; }
.bubble-note .err-fix del { color: var(--red-text); text-decoration-color: color-mix(in srgb, var(--red) 55%, transparent); }
.bubble-note .err-fix b { color: var(--green-text); }
.bubble-note .err-why { color: var(--ink2); font-size: 12.5px; margin-top: 2px; }
.chat-input {
  display: flex; flex-direction: column; align-items: stretch; gap: 8px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: var(--material); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border-top: 1px solid var(--sep);
}
.chat-input-row { display: flex; gap: 8px; align-items: flex-end; }
.chat-input textarea { flex: 1; min-height: 44px; max-height: 120px; border-radius: 22px; background: var(--bg); }

/* stuck-for-a-reply hint chip, above the input row */
.chat-hint { border-radius: 14px; padding: 10px 12px;
  background: color-mix(in srgb, var(--orange) 12%, var(--card));
  border: 1px solid color-mix(in srgb, var(--orange) 34%, transparent); }
.chat-hint {
  position: relative;
  min-height: 68px;
  padding-left: 66px;
}
.chat-hint::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 10px;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: url("img/froya-states-atlas.png") 0 0 / 200% 200% no-repeat;
  box-shadow: var(--shadow-sm);
}
.chat-hint[hidden] { display: none !important; }
.chat-hint .hint-head { display: flex; align-items: center; margin-bottom: 6px; }
.chat-hint .hint-tag { font-size: 11px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--orange-text); }
.chat-hint .hint-x { margin-left: auto; background: none; border: 0; color: var(--ink3);
  cursor: pointer; font-size: 15px; line-height: 1; padding: 2px 4px; }
.chat-hint .hint-use { display: block; width: 100%; text-align: left; cursor: pointer;
  background: var(--card); border: 1px solid var(--sep); border-radius: 10px; padding: 8px 10px; color: var(--ink); }
.chat-hint .hint-use:active { transform: scale(.99); }
.chat-hint .hint-en { display: block; margin-top: 5px; font-size: 13px; color: var(--ink2); }
.chat-hint .hint-load { color: var(--ink2); font-size: 14px; }

/* in-bubble translate toggle + its English output */
.bubble .xlate { margin-left: 6px; font-size: 11px; font-weight: 700; letter-spacing: .03em;
  border: 1px solid var(--sep); background: var(--card); color: var(--ink2);
  border-radius: 8px; padding: 1px 6px; cursor: pointer; vertical-align: 1px; }
.bubble .xlate.on { background: var(--blue); color: var(--btn-ink); border-color: transparent; }
.bubble .xlate-out { margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--sep);
  font-size: 13.5px; color: var(--ink2); }
.bubble .xlate-out[hidden] { display: none; }
.chat-input-tab { position: fixed; left: 50%; transform: translateX(-50%);
  width: min(100%, 640px); z-index: 39;
  bottom: calc(62px + env(safe-area-inset-bottom)); }  /* sits on the tabbar */
body.in-convo main { padding-bottom: 150px; }          /* last bubble clears the input bar */
.resume-card { width: 100%; text-align: left; cursor: pointer;
  border: none; box-shadow: var(--shadow);
  background: color-mix(in srgb, var(--blue) 9%, var(--card));
  transition: transform .25s var(--spring); }
.resume-card:active { transform: scale(.97); }
.scenario-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.sc-ic {
  display: block;
  width: 100%;
  height: 82px;
  object-fit: cover;
  object-position: center;
  border: 1px solid color-mix(in srgb, var(--blue) 16%, transparent);
  border-radius: 13px;
  background-color: var(--card2);
}
.score-line { font-family: var(--serif); font-size: 30px; font-weight: 700; letter-spacing: -.01em;
  font-variant-numeric: tabular-nums; text-align: center; margin: 16px 0 4px; }
.scenario-card { position: relative; background: var(--card); border-radius: 16px;
  border: none; box-shadow: var(--shadow);
  padding: 12px; cursor: pointer; transition: transform .25s var(--spring); text-align: left; }
.scenario-card:active { transform: scale(.96); }
.scenario-card .t { font-family: var(--serif); font-weight: 700; font-size: 15.5px; margin-top: 6px; }
.scenario-card .s { font-size: 12.5px; color: var(--ink2); margin-top: 2px; }
.scenario-card.new-topic { background: transparent; box-shadow: none;
  border: 1.5px dashed var(--ink3); color: var(--ink2); }
.sc-del { position: absolute; top: 2px; right: 2px; width: 28px; height: 28px;
  display: grid; place-items: center; border: none; cursor: pointer;
  border-radius: 50%; font-size: 14px; color: var(--ink2); background: transparent; }
.sc-del:hover { color: var(--red-text); background: color-mix(in srgb, var(--red) 14%, transparent); }

/* ---------------- tutor personas — portrait scroll (mockup tutorN) ---------------- */
.persona-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px;
  padding: 3px 2px 6px; }
.persona-chip { position: relative; width: auto; border: 2.5px solid transparent;
  background: var(--card); border-radius: 16px; box-shadow: var(--shadow);
  overflow: hidden; padding: 0 0 8px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  transition: transform .25s var(--spring), border-color .2s; }
.persona-chip:active { transform: scale(.96); }
.persona-chip.on { border-color: var(--blue); }
.persona-chip .p-face { width: 100%; height: 92px; position: relative; display: grid; place-items: center;
  background: linear-gradient(160deg, var(--card2), var(--card3)); margin-bottom: 6px; }
.persona-chip .p-face img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 38%; }
.persona-chip .p-name { font-family: var(--serif); font-weight: 700; font-size: 13.5px; padding: 2px 4px 3px; }
.persona-chip .p-desc { padding: 0 5px 3px; color: var(--ink2); font-size: 10.5px;
  font-weight: 650; line-height: 1.2; text-align: center; }
/* locked tutor (Máret before Dialektlab unlock) — desaturated, mockup .locked */
.persona-chip.locked { cursor: default; }
.persona-chip.locked .p-face { filter: saturate(.4) brightness(.92); }
.persona-chip.locked .p-name, .persona-chip.locked .p-desc { opacity: .6; }
.persona-chip.locked .p-lock { position: absolute; top: 6px; right: 6px; z-index: 1;
  width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  background: color-mix(in srgb, var(--ink) 55%, transparent); color: #fff; font-size: 11px; }
.persona-hello { display: flex; align-items: center; gap: 10px; margin-top: 10px;
  background: color-mix(in srgb, var(--blue) 9%, var(--card)); border-radius: 16px;
  box-shadow: var(--shadow-sm);
  padding: 10px 14px; font-weight: 700; animation: hello-in .4s var(--spring); }
.persona-hello .persona-hello-img {
  width: 34px;
  height: 34px;
  display: block;
  border: 2px solid rgba(255,255,255,.78);
  border-radius: 50%;
  object-fit: cover;
  box-shadow: var(--shadow-sm);
}
@keyframes p-pop { 0% { transform: scale(.4); } 70% { transform: scale(1.25); } 100% { transform: scale(1); } }
@keyframes hello-in { from { opacity: 0; transform: translateY(8px) scale(.96); } to { opacity: 1; } }
/* per-persona hello animations */
.anim-wave { animation: a-wave 1s ease-in-out 2; transform-origin: 70% 80%; }
.anim-nod { animation: a-nod 1.1s ease-in-out 2; }
.anim-bow { animation: a-bow 1.4s ease-in-out 1; transform-origin: 50% 100%; }
.anim-bounce { animation: a-bounce .8s cubic-bezier(.28,.84,.42,1) 2; }
@keyframes a-wave { 0%,100% { transform: rotate(0); } 25% { transform: rotate(-18deg); } 50% { transform: rotate(14deg); } 75% { transform: rotate(-10deg); } }
@keyframes a-nod { 0%,100% { transform: translateY(0) rotate(0); } 30% { transform: translateY(3px) rotate(6deg); } 60% { transform: translateY(0) rotate(-4deg); } }
@keyframes a-bow { 0%,100% { transform: rotate(0); } 40% { transform: rotate(12deg) translateY(2px); } 60% { transform: rotate(12deg) translateY(2px); } }
@keyframes a-bounce { 0%,100% { transform: translateY(0); } 40% { transform: translateY(-9px); } 65% { transform: translateY(2px); } }

/* ---------------- shadowing: veiled text + compare ---------------- */
.shadow-sentence.veiled { filter: blur(9px); user-select: none; pointer-events: none;
  transition: filter .4s ease; }
.shadow-sentence { transition: filter .4s ease; }

/* ---------------- graded listening ---------------- */
.listen-opt { box-shadow: none; border: 1.5px solid var(--sep); background: var(--bg); font-weight: 600; }
.listen-opt.picked { border-color: var(--blue); color: var(--blue-text); }
.listen-opt.correct { border-color: var(--green); background: color-mix(in srgb, var(--green) 12%, var(--card)); color: var(--green-text); }
.listen-opt.wrong { border-color: var(--red); background: color-mix(in srgb, var(--red) 10%, var(--card)); color: var(--red-text); opacity: .9; }
.listen-text { line-height: 1.7; margin-top: 6px; font-size: 15px; }
.tap-word { cursor: pointer; border-radius: 6px; padding: 0 1px; transition: background .15s;
  border: none; background: none; font: inherit; color: inherit; }
.tap-word:hover { background: color-mix(in srgb, var(--blue) 14%, transparent); }
.tap-word.adding { opacity: .5; }
.tap-word.added { background: color-mix(in srgb, var(--green) 20%, transparent); }

/* ---------------- games ---------------- */
.sprint-word { text-align: center; font-family: var(--serif); font-size: 32px; font-weight: 700; letter-spacing: -0.01em; margin: 10px 0 2px; }
.sprint-row { display: flex; gap: 9px; margin-top: 14px; }
.sprint-btn { flex: 1; min-height: 52px; border: 1.5px solid var(--sep); border-radius: 12px; font-size: 19px;
  font-family: var(--serif); font-weight: 700; cursor: pointer; background: var(--bg); color: var(--ink);
  transition: transform .15s var(--spring); }
.sprint-btn:active { transform: scale(.93); }
.sprint-btn.en { color: var(--gen-en); }
.sprint-btn.ei { color: var(--gen-ei); }
.sprint-btn.et { color: var(--gen-et); }
.sprint-btn.correct { border-color: var(--green); background: color-mix(in srgb, var(--green) 16%, var(--card)); }
.sprint-btn.wrong { border-color: var(--red); background: color-mix(in srgb, var(--red) 14%, var(--card)); }
.sprint-btn.correct, .sprint-btn.wrong { color: var(--ink); }
.sprint-timer { height: 5px; background: var(--card3); border-radius: 3px; margin-top: 14px; overflow: hidden; }
.sprint-timer i { display: block; height: 100%; width: 100%; background: var(--orange);
  border-radius: 3px; transition: width 3.5s linear; }
.sprint-secs { text-align: center; margin-top: 6px; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------------- mascot FAB — Frøya on her aurora (mockup froya-banner) ---------------- */
.fab {
  position: fixed; right: 16px; bottom: calc(88px + env(safe-area-inset-bottom)); z-index: 50;
  width: 56px; height: 56px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--aurora);
  box-shadow: 0 14px 30px -10px rgba(20,39,59,.45);
  display: grid; place-items: center; padding: 0; position: fixed; overflow: visible;
  animation: bob 3.2s ease-in-out infinite;
  transition: transform .25s var(--spring);
}
.fab::before { content:""; position:absolute; inset:0; border-radius:50%;
  background: radial-gradient(100% 80% at 85% -20%, rgba(120,220,190,.4), transparent 60%); }
.fab .fab-logo { width: 44px; height: 44px; border-radius: 50%; display: block; position: relative;
  background: rgba(255,255,255,.94); }
.fab .fab-badge {
  position: absolute; right: -3px; bottom: -3px; width: 22px; height: 22px;
  border-radius: 50%; background: var(--card); border: 1px solid var(--sep);
  display: grid; place-items: center; font-size: 12px; line-height: 1;
  box-shadow: var(--shadow-sm);
}
.fab:hover { animation: wiggle .5s ease-in-out; }
.fab:active { transform: scale(.9); }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes wiggle { 0%,100% { transform: rotate(0); } 25% { transform: rotate(-8deg); } 75% { transform: rotate(8deg); } }
body:has(.ask-panel.open) .fab, body:has(dialog[open]) .fab { display: none; }

/* ---------------- insights ---------------- */
.bar-chart { display: flex; align-items: flex-end; gap: 5px; height: 120px; padding-top: 8px; }
.bar-chart .bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 0; }
.bar-chart .bar i { display: block; width: 100%; border-radius: 5px 5px 2px 2px;
  background: linear-gradient(180deg, var(--blue), color-mix(in srgb, var(--blue) 45%, var(--bg))); min-height: 2px; }
.bar-chart .bar b { font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; }
.bar-chart .bar small { font-size: 10px; font-weight: 700; color: var(--ink2); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.tag-bars .tag-row { display: grid; grid-template-columns: 130px 1fr 34px; align-items: center; gap: 8px; padding: 6px 0; }
.tag-bars .tag-row .meter { height: 10px; border-radius: 5px; background: var(--card2); overflow: hidden; }
.tag-bars .tag-row .meter i { display: block; height: 100%; border-radius: 5px;
  background: var(--orange); }
.tag-bars .tag-row b { font-variant-numeric: tabular-nums; font-size: 13px; text-align: right; }
.heat { display: grid; grid-template-columns: repeat(20, 1fr); gap: 4px; }
.heat i { aspect-ratio: 1; border-radius: 5px; background: var(--card2); }
.heat i.l1 { background: color-mix(in srgb, var(--green) 30%, var(--card2)); }
.heat i.l2 { background: color-mix(in srgb, var(--green) 60%, var(--card2)); }
.heat i.l3 { background: var(--green); }

/* ---------------- dialogs / auth / tour ---------------- */
dialog {
  border: none; border-radius: var(--r-card); background: var(--card); color: var(--ink);
  box-shadow: var(--shadow); padding: 22px; width: min(92vw, 420px);
  margin: auto;
}
dialog h2 { font-family: var(--serif); }
dialog::backdrop { background: rgba(10,20,36,.45); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.auth-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(92vw, 380px); background: var(--card); border-radius: var(--r-card);
  box-shadow: var(--shadow); padding: 26px; text-align: center; }
.auth-card h1 { font-size: 27px; }
.auth-card .mascot { font-size: 58px; }
.auth-card .mascot-img { width: 88px; height: 88px; border-radius: 50%; object-fit: cover;
  border: 2px solid rgba(255,255,255,.9); box-shadow: var(--shadow); margin-bottom: 4px; }
.brand-logo { width: 24px; height: 24px; border-radius: 7px; vertical-align: -6px; }
/* segmented controls — white pill, teal active (mockup seg/toggle2) */
.seg { display: flex; background: var(--bg); border-radius: var(--r-pill); padding: 4px; margin: 14px 0;
  box-shadow: inset 0 0 0 1px var(--sep); }
.seg button { flex: 1; border: none; background: none; padding: 9px 12px; border-radius: var(--r-pill);
  font-weight: 700; font-size: 14px; cursor: pointer; color: var(--ink2); }
.seg button.on { background: var(--blue); color: var(--btn-ink); box-shadow: none; }

.toast {
  position: fixed; left: 50%; bottom: calc(94px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(20px); opacity: 0; z-index: 80;
  background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: var(--r-pill);
  font-weight: 700; font-size: 15px; pointer-events: none;
  box-shadow: var(--shadow);
  transition: transform .35s var(--spring), opacity .35s var(--spring); max-width: 86vw; text-align: center;
}
.toast.show { transform: translateX(-50%); opacity: 1; }
.toast.show.actionable { pointer-events: auto; }
.toast .toast-act { border: none; cursor: pointer; margin-left: 12px;
  background: transparent; color: var(--blue); font-weight: 700; font-size: 15px;
  text-decoration: underline; text-underline-offset: 3px; padding: 0; }
body:has(.mission-coach:not([hidden])) .toast { bottom: calc(154px + env(safe-area-inset-bottom)); }

.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 90; overflow: hidden; }
.confetti i { position: absolute; top: -12px; width: 8px; height: 12px; border-radius: 2px;
  animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(105vh) rotate(720deg); } }

.empty { text-align: center; color: var(--ink2); padding: 36px 16px; }
.empty h2 { font-family: var(--serif); color: var(--ink); }
.state-art {
  width: 92px;
  height: 92px;
  display: block;
  margin: 0 auto 14px;
  border: 1px solid color-mix(in srgb, var(--blue) 18%, transparent);
  border-radius: 24px;
  background-image: url("img/froya-states-atlas.png");
  background-repeat: no-repeat;
  background-size: 200% 200%;
  box-shadow: var(--shadow-sm);
}
.state-hint { background-position: 0 0; }
.state-success { background-position: 100% 0; }
.state-offline { background-position: 0 100%; }
.state-empty { background-position: 100% 100%; }

.skeleton { border-radius: var(--r-card); background: linear-gradient(100deg, var(--card2) 40%, var(--card3) 50%, var(--card2) 60%);
  background-size: 200% 100%; animation: shimmer 1.4s infinite; min-height: 90px; margin-bottom: 12px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------------- spotlight onboarding (highlight, never hide) ---------------- */
.spot-overlay { position: fixed; inset: 0; z-index: 100; pointer-events: auto; }
.spot-hole {
  position: absolute; border-radius: 16px;
  box-shadow: 0 0 0 200vmax rgba(10, 20, 36, .55);
  outline: 2.5px solid var(--blue);
  outline-offset: 3px;
  transition: left .45s var(--spring), top .45s var(--spring), width .45s var(--spring), height .45s var(--spring), box-shadow .45s var(--spring);
  animation: spot-glow 1.6s ease-in-out infinite;
}
@keyframes spot-glow {
  0%, 100% { outline-color: var(--blue); }
  50% { outline-color: color-mix(in srgb, var(--blue) 40%, transparent); }
}
.spot-hole.none { /* welcome step: dim everything, no cutout */
  width: 0; height: 0; left: 50%; top: 40%;
  outline: none; animation: none; border-radius: 50%;
}
.spot-tip {
  position: absolute; z-index: 101;
  width: min(88vw, 340px);
  background: var(--card); border-radius: var(--r-card); box-shadow: var(--shadow);
  padding: 16px; transition: left .45s var(--spring), top .45s var(--spring);
}
.spot-tip .spot-mascot { line-height: 1; }
.spot-tip .spot-mascot img { width: 38px; height: 38px; border-radius: 11px; display: block; }
.spot-tip h3 { font-family: var(--serif); font-size: 18px; font-weight: 700; margin: 6px 0 2px; }
.spot-tip p { font-size: 14px; color: var(--ink2); margin: 0; }
.spot-tip .spot-row { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.spot-dots { display: flex; gap: 5px; flex: 1; }
.spot-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--card3); }
.spot-dots i.on { background: var(--blue); }

/* ---------------- word packs & level picker ---------------- */
.level-badge {
  font-family: var(--serif);
  font-size: 13px; font-weight: 700; letter-spacing: .02em;
  padding: 4px 11px; border-radius: 12px;
  background: var(--card); box-shadow: var(--shadow-sm); color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.packs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pack {
  background: var(--card); border-radius: 12px; box-shadow: var(--shadow-sm);
  padding: 11px 6px; text-align: center; border: none; cursor: pointer;
  transition: transform .25s var(--spring);
  display: flex; flex-direction: column; gap: 2px; align-items: center;
}
/* CEFR tint ramp (mockup packs) */
.pack[data-lvl="A1"] { background: color-mix(in srgb, var(--green) 13%, var(--card)); }
.pack[data-lvl="A2"] { background: color-mix(in srgb, var(--green) 20%, var(--card)); }
.pack[data-lvl="B1"] { background: color-mix(in srgb, var(--blue) 13%, var(--card)); }
.pack[data-lvl="B2"] { background: color-mix(in srgb, var(--indigo) 13%, var(--card)); }
.pack[data-lvl="C1"] { background: color-mix(in srgb, var(--orange) 15%, var(--card)); }
.pack[data-lvl="C2"] { background: color-mix(in srgb, var(--red) 12%, var(--card)); }
.pack:active { transform: scale(.95); }
.pack .lvl { font-family: var(--serif); font-size: 17px; font-weight: 700; }
.pack .cnt { font-size: 11.5px; font-weight: 700; color: var(--ink2); font-variant-numeric: tabular-nums; }
.pack .st { font-size: 11px; font-weight: 700; margin-top: 3px; }
.pack .st.in { color: var(--green-text); }
.pack .st.add { color: var(--blue-text); }
.pack .st.part { color: var(--orange-text); }
.pack.current { outline: 2px solid var(--blue); outline-offset: -2px; }

/* ---------------- auth polish ---------------- */
.auth-wrap { background: var(--bg); }
.auth-card .mascot {
  display: inline-grid; place-items: center;
  width: 84px; height: 84px; border-radius: 24px; font-size: 46px;
  background: var(--card2);
  box-shadow: var(--shadow-sm); margin-bottom: 4px;
}

/* ---------------- three-way segmented + Bokmål/Nynorsk toggle2 ---------------- */
.seg.seg-3 { display: flex; background: var(--card); box-shadow: var(--shadow-sm); }
.seg.seg-3 button { flex: 1; }
.seg.maalform-seg { display: inline-flex; background: var(--card); box-shadow: var(--shadow-sm);
  padding: 4px; margin: 0; }
.seg.maalform-seg button { flex: none; padding: 8px 18px; font-size: 14px; font-weight: 800; }

/* ---------------- Dialektlab ---------------- */
.dialekt-play { display: grid; place-items: center; margin: 6px 0 14px; }
.dialekt-orb { width: 92px; height: 92px; border-radius: 50%; border: none; cursor: pointer;
  display: grid; place-items: center; color: var(--btn-ink);
  background: var(--blue); box-shadow: 0 12px 24px -8px color-mix(in srgb, var(--blue) 60%, transparent);
  transition: transform .25s var(--spring); }
.dialekt-orb svg { width: 40px; height: 40px; }
.dialekt-orb:active { transform: scale(.93); }
/* dialect answers as chips (mockup dialect-chips) */
.dialekt-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; margin-top: 12px; }
.dialekt-btn { min-height: 46px; border: 1.5px solid transparent; border-radius: var(--r-pill); cursor: pointer;
  background: var(--bg); color: var(--ink); font-weight: 700; font-size: 14.5px;
  transition: transform .15s var(--spring), border-color .2s, background .2s; }
.dialekt-btn:active { transform: scale(.95); }
.dialekt-btn.correct { border-color: var(--green); background: color-mix(in srgb, var(--green) 16%, var(--card)); color: var(--green-text); }
.dialekt-btn.wrong { border-color: var(--red); background: color-mix(in srgb, var(--red) 14%, var(--card)); color: var(--red-text); }
.dialekt-score { text-align: center; font-weight: 700; margin-top: 12px; font-variant-numeric: tabular-nums; }
.dialekt-note { font-size: 12px; color: var(--ink2); text-align: center; margin-top: 8px; }

/* ---------------- tonelag minimal-pair game (mockup tone-pair) ---------------- */
.tone-pair-row { display: flex; gap: 10px; margin-top: 14px; }
.tone-pair-btn { flex: 1; min-height: 56px; border: 1.5px solid var(--sep); border-radius: 12px; cursor: pointer;
  background: var(--bg); color: var(--ink); font-family: var(--serif); font-weight: 700; font-size: 19px;
  transition: transform .15s var(--spring);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 10px 8px; }
.tone-pair-btn b { display: inline-flex; align-items: center; gap: 6px; }
.tone-pair-btn .tone-glyph { color: var(--muted); }
.tone-pair-btn small { font-family: var(--font); font-weight: 600; font-size: 12.5px; color: var(--muted); }
.tone-pair-btn:active { transform: scale(.94); }
.tone-pair-btn.correct { border-color: var(--green); background: color-mix(in srgb, var(--green) 16%, var(--card)); }
.tone-pair-btn.wrong { border-color: var(--red); background: color-mix(in srgb, var(--red) 14%, var(--card)); }

/* ---------------- Dialektkart (insights) ---------------- */
.dialect-map .dm-row { display: grid; grid-template-columns: 120px 1fr 58px; align-items: center; gap: 10px; padding: 8px 0; }
.dialect-map .dm-name { font-size: 14px; font-weight: 700; }
.dialect-map .dm-meter { height: 12px; border-radius: 6px; background: var(--card2); overflow: hidden; }
.dialect-map .dm-meter i { display: block; height: 100%; border-radius: 6px;
  background: var(--blue); min-width: 3px; }
.dialect-map .dm-pct { font-size: 13px; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; color: var(--ink2); }

/* ---------------- grammar reference (Tables) ---------------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px; -webkit-overflow-scrolling: touch;
  scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips .chip { flex: 0 0 auto; border: 1.5px solid transparent; background: var(--card);
  box-shadow: var(--shadow-sm);
  border-radius: var(--r-pill); padding: 9px 14px; font-size: 13.5px; font-weight: 700; cursor: pointer; color: var(--ink); }
.chips .chip:active { transform: scale(.95); }
.gram-sec { background: var(--card); border-radius: 16px; border: none; box-shadow: var(--shadow-sm);
  margin-bottom: 10px; padding: 0 14px; }
.gram-sec summary { display: flex; align-items: center; gap: 8px; padding: 13px 0;
  cursor: pointer; list-style: none; font-size: 15px; }
.gram-sec summary b { font-family: var(--serif); font-size: 16px; }
.gram-sec summary::-webkit-details-marker { display: none; }
.gram-sec summary::after { content: "›"; margin-left: auto; color: var(--ink3);
  font-size: 18px; transition: transform .25s var(--spring); }
.gram-sec[open] summary::after { transform: rotate(90deg); }
.lvl-chip { font-size: 11px; font-weight: 800; color: var(--blue-text); letter-spacing: .04em;
  background: var(--card2); border-radius: var(--r-pill); padding: 2px 8px; }
.g-note { margin: -4px 0 8px; }
.g-cap { font-weight: 800; font-size: 13px; margin: 10px 0 6px; color: var(--ink2); }
.g-scroll { overflow-x: auto; margin-bottom: 10px; -webkit-overflow-scrolling: touch; }
table.gram { border-collapse: collapse; width: 100%; font-size: 14px; min-width: 320px; }
table.gram th, table.gram td { padding: 6px 10px; text-align: left; border-bottom: 1px solid var(--sep); }
table.gram thead th { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--ink2); border-bottom: 1.5px solid var(--sep); }
table.gram tbody th { font-family: var(--serif); font-weight: 700; color: var(--ink); white-space: nowrap; }
table.gram tbody tr:last-child th, table.gram tbody tr:last-child td { border-bottom: none; }
.g-tips { margin: 4px 0 12px; padding-left: 18px; }
.g-tips li { font-size: 13px; color: var(--ink2); margin-bottom: 4px; }

/* ---------------- Ask side panel (help desk, not role-play) ---------------- */
/* A floating translucent window, not a full-bleed drawer: inset so the topbar
   and tabbar stay visible behind it instead of being covered. */
.ask-panel { position: fixed; z-index: 70;
  top: calc(86px + env(safe-area-inset-top));      /* 78px topbar + 8px gap */
  right: max(12px, env(safe-area-inset-right));
  bottom: calc(86px + env(safe-area-inset-bottom)); /* 78px tabbar + 8px gap */
  width: min(420px, calc(100vw - 24px));
  display: flex; flex-direction: column; overflow: hidden;
  border-radius: 22px; border: 1px solid var(--sep);
  /* --material sits at ~.92 alpha, which reads as solid. A window this large
     needs to show the page moving underneath it, so go thinner and blur harder. */
  background: color-mix(in srgb, var(--bg) 76%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  backdrop-filter: saturate(180%) blur(24px);
  box-shadow: 0 24px 60px -20px rgba(10,20,36,.45);
  transform: translateX(calc(100% + 40px)); transition: transform .45s var(--spring); }
.ask-panel.open { transform: none; }
/* The panel already frosts its own backdrop; a nested backdrop-filter would
   re-blur the panel instead of the page and turn the footer muddy. */
.ask-panel .ask-input { background: transparent;
  -webkit-backdrop-filter: none; backdrop-filter: none; }
.panel-scrim { position: fixed; inset: 0; z-index: 69; background: rgba(10,20,36,.35);
  opacity: 0; transition: opacity .3s; }
.panel-scrim.show { opacity: 1; }
/* aurora header — Frøya's sky, same as the FAB and hero */
.ask-head { display: flex; align-items: center; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  background: var(--aurora); color: #fff; position: relative; overflow: hidden;
  border-bottom: none; }
.ask-head::before { content:""; position:absolute; inset:0; background:var(--aurora-glow); }
.ask-head > * { position: relative; }
/* strong + small are both inline: without stacking they render as one run
   ("Ask FrøyaGrammar, words and culture…") that overflows the panel. */
.ask-head .grow { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.ask-head strong { font-family: var(--serif); font-size: 16px; line-height: 1.2; }
.ask-head .sub { display: block; font-size: 12px; line-height: 1.35; color: #C9DBE6; }
.ask-head img { border-radius: 50%; background: rgba(255,255,255,.94); }
.ask-head .icon-btn { background: rgba(255,255,255,.15); color: #fff; box-shadow: none; }
.ask-log { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.ask-empty { margin: auto 0; display: flex; flex-direction: column; gap: 8px; }
.ask-suggest { text-align: left; border: none; background: var(--card);
  border-radius: 14px; padding: 11px 14px; font-size: 15px; cursor: pointer;
  box-shadow: var(--shadow-sm); transition: transform .25s var(--spring); }
.ask-suggest:active { transform: scale(.97); }
.ask-input { display: flex; gap: 8px; align-items: flex-end;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--sep); background: var(--material);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); }
.ask-input textarea { flex: 1; min-height: 44px; max-height: 120px; border-radius: 22px; background: var(--card); }

/* one focus token for every interactive control */
:where(button, .tab, .pack, .chip, .tap-word, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--blue); outline-offset: 2px;
}

@media (min-width: 720px) {
  .tiles { grid-template-columns: repeat(4, 1fr); }
  .scenario-grid { grid-template-columns: repeat(3, 1fr); }
  .packs { grid-template-columns: repeat(6, 1fr); }
  .dialekt-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  .fab { animation: none; }
  * { transition-duration: .01ms !important; animation-duration: .01ms !important;
      animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}

/* ==================================================================
   Mockup component classes — runtime parity with the newui/norge
   mockup. The render functions emit this DOM; styling uses the app's
   own color tokens (--blue/--ink2/--sep/--card2…), never the mockup's.
   Only NEW class names are added here; generic app classes (.btn base,
   .seg, .tabbar, .chip, .score-ring, .heat, .pack, .with-avatar…) are
   left untouched so existing chrome, dark mode and games keep working.
   ================================================================== */
.icn { width: 1em; height: 1em; flex: none; display: inline-block; vertical-align: -0.125em; }
.grow { flex: 1; min-width: 0; }
.chev { color: var(--ink3); }
.sec { margin-top: 14px; }
.card-head { display: flex; align-items: center; gap: 12px; }
.title-s { font-size: 17px; font-weight: 800; }
.sub-s { font-size: 13.5px; color: var(--ink2); margin-top: 1px; }
.xp { color: var(--blue); font-weight: 800; font-size: 13px; white-space: nowrap; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: var(--r-pill);
  font-size: 13px; font-weight: 700; }
.pill.soft { background: var(--bg); color: var(--ink2); }
.pill.green { background: color-mix(in srgb, var(--green) 14%, var(--card)); color: var(--green-text); }

.icn-tile { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; font-size: 20px; flex: none; }
.icn-tile.pri { background: color-mix(in srgb, var(--blue) 14%, var(--card)); color: var(--blue); }
.icn-tile.green { background: color-mix(in srgb, var(--green) 14%, var(--card)); color: var(--green-text); }
.icn-tile.blue, .icn-tile.purple { background: color-mix(in srgb, var(--indigo) 14%, var(--card)); color: var(--indigo); }
.icn-tile.red { background: color-mix(in srgb, var(--red) 14%, var(--card)); color: var(--red-text); }
.icn-tile.gold { background: color-mix(in srgb, var(--orange) 16%, var(--card)); color: var(--orange-text); }

/* additive .btn variants the mockup markup asks for (base .btn stays) */
.btn.primary { background: var(--blue); color: var(--btn-ink); }
.btn.ghost { background: var(--card); color: var(--ink); box-shadow: var(--shadow-sm); font-size: 14.5px; }
.btn.outline { background: transparent; border: 1.5px solid var(--sep); color: var(--blue-text); font-size: 14.5px; }

/* kill iOS default chrome on the new mockup buttons */
.level-chip, .froya-btn, .quick3 button, .steps .step { -webkit-appearance: none; }

/* ---- Today: greeting ---- */
.greet { padding: 6px 0 2px; display: flex; align-items: flex-start; gap: 10px; }
.greet h2 { font-size: 30px; margin: 0; }
/* home hero: the mascot greets you (warmth principle #1) */
.greet-hero { align-items: center; gap: 12px; }
.greet-hero .grow .level-chip { margin-top: 12px; width: fit-content; }
.greet-mascot { flex: none; width: 92px; height: 92px; object-fit: contain; align-self: center;
  filter: drop-shadow(0 8px 14px rgba(20,39,59,.18)); }
@media (prefers-reduced-motion: no-preference) {
  .greet-mascot { animation: mascotBob 3.2s ease-in-out infinite; }
}
@keyframes mascotBob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.greet .placed { display: flex; align-items: center; gap: 7px; margin-top: 6px; color: var(--ink2); font-size: 14.5px; }
.greet .placed .icn { color: var(--blue); font-size: 16px; }
.level-chip { display: flex; align-items: center; gap: 6px; background: var(--card); box-shadow: var(--shadow-sm);
  border: none; border-radius: 16px; padding: 12px 16px; font-size: 19px; font-weight: 800; flex: none;
  font-family: var(--serif); color: var(--ink); cursor: pointer; }
.level-chip .chev { font-size: 13px; }

/* ---- Today: stat scroll ---- */
.stat-scroll { display: grid; grid-template-columns: 1fr 1.15fr; gap: 12px; }
.stat-card { border-radius: var(--r-card); padding: 14px; box-shadow: var(--shadow); background: var(--card); }
.stat-card.streak { display: flex; flex-direction: column; }
.stat-card.streak header { display: flex; align-items: center; gap: 10px; }
.stat-card.streak header img { width: 40px; height: 52px; object-fit: contain; }
.stat-card.streak .big { font-size: 42px; font-weight: 800; line-height: 1; font-family: var(--serif); font-variant-numeric: tabular-nums; }
.stat-card.streak .lbl { font-weight: 700; color: var(--ink2); font-size: 13px; margin-top: 2px; }
.stat-card.streak .cheer { margin-top: auto; padding-top: 10px; font-size: 13.5px; font-weight: 700; color: var(--red-text); }
.week-dots { display: flex; gap: 5px; margin-top: 10px; }
.week-dots i { width: 12px; height: 12px; border-radius: 50%; background: var(--card3); }
.week-dots i.on { background: var(--green); }
.stat-card.ringcard { position: relative; overflow: hidden; display: flex; align-items: center; gap: 12px; padding-right: 0; }
.ring { width: 84px; height: 84px; border-radius: 50%; position: relative; display: grid; place-items: center; flex: none; }
.ring::before { content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(var(--blue) calc(var(--p) * 1%), var(--card3) 0);
  -webkit-mask: radial-gradient(closest-side, transparent calc(100% - 11px), #000 calc(100% - 10px));
  mask: radial-gradient(closest-side, transparent calc(100% - 11px), #000 calc(100% - 10px)); }
.ring b { font-size: 20px; font-family: var(--serif); font-variant-numeric: tabular-nums; }
.ring .in { text-align: center; line-height: 1.15; position: relative; }
.ring .in small { display: block; font-size: 11px; color: var(--ink2); font-weight: 600; }
.ringcard .meta b { font-size: 16.5px; font-family: var(--serif); }
.ringcard .meta .xpline { font-size: 13px; margin-top: 6px; font-weight: 600; color: var(--ink2); font-variant-numeric: tabular-nums; }
/* decorative image dropped on the ring card — it crushed the meta text in the
   narrow 2-up stat grid on phones */
.ringcard > img { display: none; }
.ringcard .meta { min-width: 0; }
.stat-card.ringcard .ring { width: 72px; height: 72px; }

/* ---- Today: Frøya promo ---- */
.froya-card { padding: 0; overflow: hidden; position: relative; color: #fff; border: none; background: var(--aurora); }
.froya-card::before { content: ""; position: absolute; inset: 0; background: var(--aurora-glow); }
.froya-card .txt { padding: 16px 0 16px 16px; position: relative; z-index: 1; max-width: 62%; }
.froya-card h4 { margin: 0; font-size: 18px; font-family: var(--serif); }
.froya-card p { margin: 5px 0 12px; font-size: 12.5px; color: #C9DBE6; line-height: 1.4; }
.froya-card > img { position: absolute; right: 0; bottom: 0; height: 92%; object-fit: contain; object-position: bottom right; }
.froya-btn { display: inline-flex; align-items: center; gap: 6px; background: rgba(255,255,255,.94); color: var(--blue-text);
  border: none; border-radius: var(--r-pill); padding: 8px 13px; font-size: 12.5px; font-weight: 800;
  box-shadow: var(--shadow-sm); position: relative; z-index: 1; cursor: pointer; }

/* ---- Today: plan + step path ---- */
.plan-head { display: flex; align-items: center; gap: 10px; }
.plan-head h3 { font-family: var(--serif); font-size: 21px; font-weight: 700; margin: 0; }
.steps { margin-top: 6px; display: flex; flex-direction: column; }
.steps .step { display: flex; align-items: center; gap: 11px; padding: 8px; position: relative; border-radius: 14px;
  width: 100%; text-align: left; background: none; border: none; cursor: pointer; color: var(--ink); }
.steps .step.active { background: color-mix(in srgb, var(--blue) 10%, var(--card)); }
.steps .step .rail { width: 32px; flex: none; display: grid; place-items: center; position: relative; align-self: stretch; }
.steps .step .rail::before { content: ""; position: absolute; top: -8px; bottom: -8px; width: 2px; background: var(--sep); }
.steps .step:first-child .rail::before { top: 50%; }
.steps .step:last-child .rail::before { bottom: 50%; }
.steps .step .dot { width: 29px; height: 29px; border-radius: 50%; display: grid; place-items: center; position: relative; z-index: 1;
  background: var(--card); border: 2px solid var(--sep); font-size: 13px; font-weight: 800; color: var(--ink2); }
.steps .step .dot .icn { font-size: 15px; }
.steps .step.done .dot { background: var(--green); border-color: var(--green); color: #fff; }
.steps .step.done .rail::before { background: var(--green); }
.steps .step.active .dot { background: var(--blue); border-color: var(--blue); color: var(--btn-ink); }
.steps .step b { font-size: 15.5px; }
.steps .step .end { margin-left: auto; flex: none; }
.steps .step .lock { color: var(--ink3); font-size: 16px; }
.steps .step.locked b, .steps .step.locked .sub-s { opacity: .55; }
.done-pill { background: color-mix(in srgb, var(--green) 14%, var(--card)); color: var(--green-text); font-weight: 800;
  font-size: 12.5px; border-radius: var(--r-pill); padding: 6px 11px; display: flex; gap: 5px; align-items: center; }
.step .wave-mini { color: var(--blue); font-size: 17px; }

/* ---- Today: quick3 ---- */
.quick3 { display: grid; grid-template-columns: 1fr 1fr 1fr; background: var(--card); border-radius: var(--r-card);
  box-shadow: var(--shadow); padding: 14px 6px; }
.quick3 button { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 4px; border: none;
  border-right: 1px solid var(--sep); background: none; cursor: pointer; color: var(--ink); }
.quick3 button:last-child { border-right: 0; }
.quick3 .icn-tile { width: 40px; height: 40px; font-size: 18px; }
.quick3 b { font-size: 13.5px; }
.quick3 small { color: var(--ink2); font-size: 11.5px; margin-top: -4px; }

/* ---- Words: due banner + kultur ---- */
.due-banner { display: flex; align-items: center; gap: 12px; background: var(--card); border-radius: 16px;
  box-shadow: var(--shadow); padding: 13px 15px; margin-bottom: 12px; }
.due-banner .icn-tile { width: 40px; height: 40px; font-size: 17px; }
.due-banner b { font-size: 16px; font-family: var(--serif); display: block; }
.due-banner .sub-s { font-size: 12.5px; }
.kultur { display: flex; gap: 12px; align-items: center; }
.kultur img { width: 96px; aspect-ratio: 10/8.5; object-fit: cover; border-radius: 13px; flex: none; }
.kultur .title-s { font-size: 16px; font-family: var(--serif); }

/* ---- Speak: Dialektlab exposure map ---- */
.dialect-wrap { display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: end; margin-top: 14px; }
.mapbox { margin: 0; }
.mapbox img { width: 128px; display: block; border-radius: 10px; }
.mapbox figcaption { font-size: 11px; color: var(--ink2); font-weight: 700; margin-bottom: 4px; }
.legend { display: flex; flex-direction: column; gap: 5px; font-size: 11.5px; font-weight: 700; color: var(--ink2); }
.legend i { width: 12px; height: 12px; border-radius: 4px; display: inline-block; margin-right: 6px; vertical-align: -1px; }

/* ---- Insights: ins-grid, weak chips, corrections, trend bars ---- */
.ins-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ins-grid .card, .ins-grid .stat-card { padding: 14px; margin: 0; }
.ins-grid .ring { width: 84px; height: 84px; margin: 0 auto; }
.ins-grid .heat { grid-template-columns: repeat(10, 1fr); }
.trend-up { color: var(--green-text); font-weight: 800; font-size: 13px; margin-top: 6px; text-align: center; }
.weak-rows { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 7px; }
.weak-rows .tagchip { background: color-mix(in srgb, var(--blue) 12%, var(--card)); color: var(--blue-text);
  border-radius: var(--r-pill); padding: 6px 12px; font-size: 12.5px; font-weight: 700; }
.corr { padding: 10px 0; border-top: 1px solid var(--sep); }
.corr:first-of-type { border-top: 0; }
.corr .old { color: var(--red-text); font-weight: 600; text-decoration: line-through; text-decoration-thickness: 1.5px; }
.corr .new { color: var(--green-text); font-weight: 700; }
.corr time { float: right; color: var(--ink2); font-size: 12px; }
.corr div { font-size: 14px; margin-top: 2px; }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 64px; margin-top: 12px; }
.bars i { flex: 1; border-radius: 5px 5px 2px 2px; min-height: 2px;
  background: linear-gradient(180deg, var(--blue), color-mix(in srgb, var(--blue) 45%, var(--bg))); }
.bars-lab { display: flex; gap: 6px; margin-top: 5px; }
.bars-lab span { flex: 1; text-align: center; font-size: 10px; font-weight: 800; color: var(--ink2); }

@media (min-width: 720px) {
  .stat-scroll { grid-template-columns: 1fr 1.15fr; }
}

/* Strong, predictable contrast in polar-night mode. */
html[data-theme="dark"] .greet h2,
html[data-theme="dark"] .page-head h1,
html[data-theme="dark"] .shadow-sentence { color: #fff; }
html[data-theme="dark"] .greet .placed,
html[data-theme="dark"] .sub,
html[data-theme="dark"] .sub-s,
html[data-theme="dark"] .shadow-translation { color: #C9D8E7; }
html[data-theme="dark"] .topbar {
  background: rgba(8,18,32,.94);
  border-bottom: 1px solid rgba(160,190,218,.16);
}
@media (prefers-color-scheme: dark) {
  html:not([data-theme]) .greet h2,
  html:not([data-theme]) .page-head h1,
  html:not([data-theme]) .shadow-sentence { color: #fff; }
  html:not([data-theme]) .greet .placed,
  html:not([data-theme]) .sub,
  html:not([data-theme]) .sub-s,
  html:not([data-theme]) .shadow-translation { color: #C9D8E7; }
  html:not([data-theme]) .topbar {
    background: rgba(8,18,32,.94);
    border-bottom: 1px solid rgba(160,190,218,.16);
  }
}
@media (max-width: 430px) {
  .topbar { gap: 6px; padding-left: 10px; padding-right: 10px; }
  .topbar .brand { font-size: 18px; gap: 7px; }
  .brand-fox { width: 34px; height: 34px; }
  .streak-pill { padding: 6px 10px; }
  .profile-btn { min-width: 48px; width: 48px; padding: 4px; gap: 0; }
  .profile-btn > span, .profile-btn > svg { display: none; }
}
