/* Learn Asa Di Vaar — one stylesheet.
   Two themes, each designed in its own right rather than inverted:
   "pothi" (light) is a gutka page in the bunga's navy ink, and "amritvela"
   (dark) is the pre-dawn sky the vaar is sung under. Gold is the bunga's
   own; kesri is kept for visraam and the one "you are here" mark. */

@font-face { font-family: "Tiro Gurmukhi"; src: url("../assets/fonts/tiro-gurmukhi-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Noto Serif Gurmukhi"; src: url("../assets/fonts/noto-serif-gurmukhi-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Noto Serif Gurmukhi"; src: url("../assets/fonts/noto-serif-gurmukhi-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Noto Sans Gurmukhi"; src: url("../assets/fonts/noto-sans-gurmukhi.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Cormorant Garamond"; src: url("../assets/fonts/cormorant-garamond-latin.woff2") format("woff2"); font-weight: 300 700; font-display: swap; }
@font-face { font-family: "Karla"; src: url("../assets/fonts/karla-latin.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }

:root {
  --font-display: "Cormorant Garamond", "Iowan Old Style", Georgia, serif;
  --font-ui: "Karla", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-bani: "Tiro Gurmukhi", "Noto Serif Gurmukhi", "Noto Sans Gurmukhi", serif;
  --font-pa: "Noto Sans Gurmukhi", "Mukta Mahee", sans-serif;

  --g: 1;                         /* Gurbani size, set from Settings */
  --bani-size: calc(clamp(1.32rem, 1.15rem + 0.9vw, 1.7rem) * var(--g));
  --gutter: clamp(1rem, 4vw, 2rem);
  --tabs-h: 64px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --r-sm: 6px; --r: 10px; --r-lg: 18px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

/* Pothi: light */
:root, :root[data-theme="light"] {
  color-scheme: light;
  --bg: #FBF8F2;
  --bg-2: #F3EEE3;
  --surface: #FFFFFF;
  --surface-2: #F6F2EA;
  --ink: #1A1E3E;
  --ink-2: #4A4E6C;
  --ink-3: #66698A;
  --line: rgb(26 30 62 / 0.12);
  --line-2: rgb(26 30 62 / 0.2);
  --gold: #B2A672;
  --gold-fill: #B5A66A;
  --gold-text: #6E653C;
  --gold-soft: rgb(178 166 114 / 0.16);
  --kesri: #A84F0C;
  --yamki: #2F5AA6;
  --accent: #1A1E3E;
  --accent-hover: #2B3157;
  --on-accent: #F7F3EA;
  --tick-ink: #1A1E3E;
  --track: rgb(26 30 62 / 0.09);
  --shadow: 0 1px 2px rgb(26 30 62 / 0.06), 0 8px 24px rgb(26 30 62 / 0.07);
  --shadow-lg: 0 12px 40px rgb(26 30 62 / 0.16);
  --scrim: rgb(20 22 44 / 0.42);
  --hide-bar: rgb(26 30 62 / 0.16);
}

/* Amritvela: dark */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #10132A;
  --bg-2: #0C0F22;
  --surface: #171B37;
  --surface-2: #1C2141;
  --ink: #EFE6D6;
  --ink-2: #BDB9CC;
  --ink-3: #9592AC;
  --line: rgb(239 230 214 / 0.11);
  --line-2: rgb(239 230 214 / 0.2);
  --gold: #CDBF8E;
  --gold-fill: #CDBF8E;
  --gold-text: #D9CB98;
  --gold-soft: rgb(205 191 142 / 0.12);
  --kesri: #F3A65A;
  --yamki: #A3B6F2;
  --accent: #D9CB98;
  --accent-hover: #E6DAAC;
  --on-accent: #12152B;
  --tick-ink: #12152B;
  --track: rgb(239 230 214 / 0.09);
  --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 10px 30px rgb(0 0 0 / 0.25);
  --shadow-lg: 0 16px 50px rgb(0 0 0 / 0.5);
  --scrim: rgb(4 6 18 / 0.6);
  --hide-bar: rgb(239 230 214 / 0.2);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-bottom: calc(var(--tabs-h) + var(--safe-b) + 8px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 1rem/1.5 var(--font-ui);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  min-height: 100dvh;
}
/* Cormorant's old-style figures make "Chakka 1" read as "Chakka ı". Every
   `font:` shorthand resets font-variant-numeric (and, in Chrome, the feature
   settings too), so this has to be !important; places that also want
   tabular figures restate both. */
* { font-variant-numeric: lining-nums !important; }
.tally .t-num, .vthumb .dur, .scrub-row .time, .speed-btn, .rail a, .cl-summary span, .vid-load small, .med-label { font-variant-numeric: lining-nums tabular-nums !important; }
img, svg, video { display: block; max-width: 100%; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--gold-text); outline-offset: 2px; border-radius: 4px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.pa { font-family: var(--font-pa); }
.bani { font-family: var(--font-bani); }

/* ---------------------------------------------------------------- shell */

.shell { min-height: 100dvh; }
#view { padding-bottom: calc(var(--tabs-h) + var(--safe-b) + 1.5rem); }
#view:focus { outline: none; }

.tabs {
  position: fixed; inset: auto 0 0 0; z-index: 40;
  display: grid; grid-template-columns: repeat(4, 1fr);
  height: calc(var(--tabs-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
  border-top: 1px solid var(--line);
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  text-decoration: none; color: var(--ink-3);
  font-size: 0.72rem; font-weight: 500; letter-spacing: 0.01em;
  position: relative;
}
.tab svg { width: 24px; height: 24px; }
.tab[aria-current="page"] { color: var(--ink); }
.tab[aria-current="page"]::before {
  content: ""; position: absolute; top: 0; left: 50%; width: 28px; height: 2px; margin-left: -14px;
  background: var(--gold); border-radius: 0 0 2px 2px;
}

@media (min-width: 900px) {
  :root { --tabs-h: 0px; }
  .shell { display: grid; grid-template-columns: 96px 1fr; }
  .tabs {
    position: sticky; inset: auto; top: 0; height: 100dvh;   /* inset first: it would reset top */
    grid-template-columns: 1fr; grid-auto-rows: 76px; align-content: start;
    padding: 1.25rem 0 0; border-top: 0; border-right: 1px solid var(--line);
  }
  .tab { font-size: 0.75rem; }
  .tab[aria-current="page"]::before { top: 18px; left: 0; width: 2px; height: 40px; margin: 0; border-radius: 0 2px 2px 0; }
  #view { padding-bottom: 3rem; }
}

body.focus .tabs { transform: translateY(110%); transition: transform 0.3s var(--ease); }
@media (min-width: 900px) { body.focus .shell { grid-template-columns: 0 1fr; } body.focus .tabs { transform: translateX(-110%); } }

.page { width: 100%; max-width: 1080px; margin: 0 auto; padding: calc(1.25rem + var(--safe-t)) var(--gutter) 0; }
.page-narrow { max-width: 760px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.page-head h1 { font: 600 clamp(2rem, 1.6rem + 1.6vw, 2.75rem)/1.05 var(--font-display); letter-spacing: -0.01em; }
.page-head .lede { color: var(--ink-2); margin-top: 0.35rem; max-width: 46ch; }

/* ---------------------------------------------------------------- buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 44px; padding: 0 1.15rem; border-radius: 999px;
  font-weight: 600; font-size: 0.95rem; text-decoration: none;
  background: var(--accent); color: var(--on-accent);
  transition: background 0.2s var(--ease), transform 0.15s var(--ease);
}
.btn:hover { background: var(--accent-hover); }
.btn:active { transform: scale(0.97); }
.btn svg { width: 18px; height: 18px; }
.btn-ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-2); }
.btn-ghost:hover { background: var(--gold-soft); }
.btn-quiet { background: transparent; color: var(--ink-2); padding: 0 0.6rem; }
.btn-quiet:hover { background: var(--gold-soft); color: var(--ink); }
.btn-sm { min-height: 36px; padding: 0 0.85rem; font-size: 0.85rem; }

.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  color: var(--ink-2); transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.icon-btn:hover { background: var(--gold-soft); color: var(--ink); }
.icon-btn svg { width: 22px; height: 22px; }

/* The learnt tick: the same control everywhere a part can be marked. */
.tick {
  display: inline-flex; align-items: center; gap: 0.5rem; min-height: 44px; padding: 0 0.25rem;
  color: var(--ink-2); font-size: 0.85rem; font-weight: 500; flex-shrink: 0;
}
.tick-box {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center;
  box-shadow: inset 0 0 0 1.5px var(--ink-3);
  transition: background 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.tick-box svg { width: 15px; height: 15px; color: var(--tick-ink); opacity: 0; transform: scale(0.4); transition: opacity 0.2s, transform 0.35s var(--ease-out); }
.tick[aria-pressed="true"] .tick-box { background: var(--gold-fill); box-shadow: inset 0 0 0 1.5px var(--gold-fill); }
.tick[aria-pressed="true"] .tick-box svg { opacity: 1; transform: none; }
.tick[aria-pressed="true"] { color: var(--gold-text); }
.tick:hover .tick-box { box-shadow: inset 0 0 0 1.5px var(--gold); }
.tick.pop .tick-box { animation: tick-pop 0.45s var(--ease-out); }
@keyframes tick-pop { 0% { transform: scale(0.8); } 55% { transform: scale(1.15); } 100% { transform: none; } }
.tick-label-done { display: none; }
.tick[aria-pressed="true"] .tick-label-todo { display: none; }
.tick[aria-pressed="true"] .tick-label-done { display: inline; }

/* Segmented control */
.seg {
  display: inline-flex; padding: 3px; gap: 2px; border-radius: 999px;
  background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line);
  max-width: 100%; overflow-x: auto; scrollbar-width: none;
}
.seg::-webkit-scrollbar { display: none; }
.seg button, .seg a {
  min-height: 36px; padding: 0 0.95rem; border-radius: 999px; white-space: nowrap;
  font-size: 0.88rem; font-weight: 500; color: var(--ink-2); text-decoration: none;
  display: inline-flex; align-items: center; gap: 0.4rem;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.seg [aria-pressed="true"], .seg [aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
:root[data-theme="dark"] .seg [aria-pressed="true"], :root[data-theme="dark"] .seg [aria-current="page"] { background: var(--line-2); box-shadow: none; }
.seg .count { color: var(--ink-3); font-size: 0.78rem; }

/* Switch row (settings, text options) */
.switch { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 52px; cursor: pointer; }
.switch input { appearance: none; -webkit-appearance: none; width: 46px; height: 28px; border-radius: 999px; background: var(--line-2); position: relative; flex-shrink: 0; cursor: pointer; transition: background 0.2s var(--ease); margin: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 3px rgb(0 0 0 / 0.25); transition: transform 0.25s var(--ease-out); }
:root[data-theme="dark"] .switch input::after { background: var(--ink); }
.switch input:checked { background: var(--gold-fill); }
.switch input:checked::after { transform: translateX(18px); }
.switch small { display: block; color: var(--ink-3); font-size: 0.82rem; }

input[type="range"] { width: 100%; height: 28px; margin: 0; background: transparent; -webkit-appearance: none; appearance: none; cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: var(--track); }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 2px; background: var(--track); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -9px; border-radius: 50%; background: var(--gold-fill); box-shadow: 0 1px 4px rgb(0 0 0 / 0.25); }
input[type="range"]::-moz-range-thumb { width: 22px; height: 22px; border: 0; border-radius: 50%; background: var(--gold-fill); }

/* ---------------------------------------------------------------- welcome */

.welcome {
  position: fixed; inset: 0; z-index: 100;
  background: var(--bg);
  display: grid; grid-template-rows: auto 1fr auto;
  padding: calc(2.25rem + var(--safe-t)) var(--gutter) calc(2rem + var(--safe-b));
  text-align: center;
  transition: opacity 0.7s var(--ease), visibility 0s linear 0.7s;
}
.welcome.leaving { opacity: 0; visibility: hidden; }
.welcome h1 {
  font: 600 clamp(2.1rem, 1.5rem + 3.2vw, 3.6rem)/1 var(--font-display);
  letter-spacing: -0.01em;
  opacity: 0; transform: translateY(8px);
  animation: rise 1.1s var(--ease-out) 0.15s forwards;
}
.welcome-stage { display: grid; place-items: center; position: relative; }
.welcome-logo {
  width: min(86vw, 52vh, 420px); aspect-ratio: 720 / 724; position: relative;
  opacity: 0; transform: scale(0.96);
  animation: settle 1.6s var(--ease-out) 0.35s forwards;
}
.welcome-logo img { width: 100%; height: 100%; }
.logo-dark { display: none !important; }
:root[data-theme="dark"] .logo-light { display: none !important; }
:root[data-theme="dark"] .logo-dark { display: block !important; }
/* Rings that breathe outward from the medallion while the recording plays. */
.welcome-logo::before, .welcome-logo::after {
  content: ""; position: absolute; left: 50%; top: 48.5%; width: 71%; aspect-ratio: 1;
  translate: -50% -50%; border-radius: 50%;
  border: 1px solid var(--gold); opacity: 0; pointer-events: none;
}
.welcome.playing .welcome-logo::before { animation: ripple 4.8s var(--ease) infinite; }
.welcome.playing .welcome-logo::after { animation: ripple 4.8s var(--ease) 2.4s infinite; }
@keyframes ripple { 0% { transform: scale(1); opacity: 0.55; } 100% { transform: scale(1.45); opacity: 0; } }
@keyframes rise { to { opacity: 1; transform: none; } }
@keyframes settle { to { opacity: 1; transform: none; } }
.welcome-foot { display: grid; justify-items: center; gap: 0.9rem; opacity: 0; animation: rise 1s var(--ease-out) 0.9s forwards; }
.welcome-foot .btn { min-width: 200px; min-height: 52px; font-size: 1.05rem; }
.welcome-hint { color: var(--ink-3); font-size: 0.88rem; min-height: 1.3em; }
.welcome-sound { position: absolute; top: calc(0.75rem + var(--safe-t)); right: 0.75rem; }
.welcome-sound .icon-btn { color: var(--ink-3); }

/* ---------------------------------------------------------------- home */

.home-head { display: flex; align-items: center; gap: 0.85rem; margin-bottom: 0.5rem; }
.home-head img { width: 48px; height: 48px; }
.home-head h1 { font: 600 1.6rem/1.1 var(--font-display); flex: 1; }
.home-head h1 span { display: block; font: 400 0.9rem/1.3 var(--font-pa); color: var(--ink-3); margin-top: 2px; }

.home-grid { display: grid; gap: 1.5rem; }
@media (min-width: 900px) {
  .home-grid { grid-template-columns: minmax(340px, 1fr) minmax(0, 1fr); align-items: start; gap: 2.5rem; margin-top: 1rem; }
  .home-side { padding-top: 1.5rem; }
}

.medallion-wrap { display: grid; justify-items: center; }
.medallion { width: min(100%, 440px); aspect-ratio: 1; position: relative; }
.medallion svg { width: 100%; height: 100%; overflow: visible; }
.med-ticks line { stroke: var(--gold); stroke-width: 1; opacity: 0.55; }
.med-ring { fill: none; stroke: var(--gold); stroke-width: 0.75; opacity: 0.7; }
.med-seg a { cursor: pointer; outline: none; }
.med-track { fill: none; stroke: var(--track); stroke-width: 22; }
.med-fill { fill: none; stroke: var(--gold-fill); stroke-width: 22; transition: stroke-dashoffset 1.2s var(--ease-out); }
.med-seg.done .med-fill { stroke: var(--gold); }
.med-num { font: 600 10.5px var(--font-ui); fill: var(--ink-3); text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.med-seg.done .med-num { fill: var(--tick-ink); }
.med-seg a:hover .med-track, .med-seg a:focus-visible .med-track { stroke: var(--line-2); }
.med-seg a:focus-visible .med-track { stroke: var(--gold-text); }
.med-next .med-dot { fill: var(--kesri); }
.med-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; pointer-events: none; }
.med-pct { font: 600 clamp(3.4rem, 2.6rem + 4vw, 5rem)/0.9 var(--font-display); letter-spacing: -0.02em; font-variant-numeric: lining-nums; }
.med-pct small { font-size: 0.45em; margin-left: 0.04em; color: var(--ink-2); }
.med-label { color: var(--ink-2); font-size: 0.9rem; margin-top: 0.35rem; }
.med-pa { font: 400 1.05rem var(--font-bani); color: var(--gold-text); margin-top: 0.6rem; }
.med-caption { color: var(--ink-3); font-size: 0.85rem; text-align: center; max-width: 34ch; margin-top: 0.75rem; }

.tally { display: grid; gap: 0.15rem; margin-top: 0.5rem; }
.tally a { display: grid; grid-template-columns: 7.5rem 1fr auto; align-items: center; gap: 0.9rem; min-height: 44px; text-decoration: none; border-radius: var(--r-sm); padding: 0 0.4rem; margin: 0 -0.4rem; }
.tally a:hover { background: var(--gold-soft); }
.tally .t-name { font-weight: 600; }
.tally .t-name span { font: 400 0.8rem var(--font-pa); color: var(--ink-3); margin-left: 0.35rem; }
.bar { height: 6px; border-radius: 3px; background: var(--track); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--gold-fill); border-radius: inherit; transition: width 1s var(--ease-out); }
.tally .t-num { font-variant-numeric: tabular-nums; color: var(--ink-2); font-size: 0.9rem; min-width: 3.6rem; text-align: right; }

.card {
  background: var(--surface); border-radius: var(--r-lg); padding: 1.15rem 1.2rem;
  box-shadow: inset 0 0 0 1px var(--line);
}
.card + .card { margin-top: 0.85rem; }
.card-kind { font-size: 0.8rem; font-weight: 600; color: var(--gold-text); letter-spacing: 0.02em; }
.card h2 { font: 600 1.45rem/1.15 var(--font-display); margin-top: 0.15rem; }
.card .first-line { font: 400 1.15rem/1.6 var(--font-bani); color: var(--ink-2); margin-top: 0.35rem; }
.card-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.9rem; }
.card-row { display: flex; align-items: center; gap: 0.9rem; }
.card-row .thumb { width: 104px; flex-shrink: 0; border-radius: var(--r-sm); overflow: hidden; aspect-ratio: 16/9; background: var(--bg-2); position: relative; }
.card-row .thumb img { width: 100%; height: 100%; object-fit: cover; }
.resume-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgb(0 0 0 / 0.35); }
.resume-bar i { display: block; height: 100%; background: var(--kesri); }

.days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; margin-top: 0.75rem; max-width: 260px; }
.days span { aspect-ratio: 1; border-radius: 4px; background: var(--track); }
.days span.on { background: var(--gold-fill); }
.days span.today { box-shadow: 0 0 0 1.5px var(--kesri); }
.days span.future { background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
.days-legend { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; max-width: 260px; font-size: 0.7rem; color: var(--ink-3); text-align: center; margin-top: 0.3rem; }

.notice { display: flex; gap: 0.85rem; align-items: flex-start; background: var(--gold-soft); border-radius: var(--r-lg); padding: 1rem 1.1rem; }
.notice svg { width: 22px; height: 22px; flex-shrink: 0; color: var(--gold-text); margin-top: 2px; }
.notice p { color: var(--ink-2); font-size: 0.92rem; }
.notice strong { color: var(--ink); }

/* ---------------------------------------------------------------- videos */

.vgrid { display: grid; gap: 0.6rem; margin-top: 1.25rem; }
@media (min-width: 640px) { .vgrid { grid-template-columns: repeat(2, 1fr); gap: 1rem; } }
@media (min-width: 1100px) { .vgrid { grid-template-columns: repeat(3, 1fr); } }
.vcard {
  display: grid; grid-template-columns: 128px minmax(0, 1fr); gap: 0.9rem; align-items: center;
  text-decoration: none; padding: 0.5rem; margin: 0 -0.5rem; border-radius: var(--r);
  transition: background 0.2s var(--ease);
}
.vcard:hover { background: var(--gold-soft); }
@media (min-width: 640px) {
  .vcard { grid-template-columns: 1fr; gap: 0.7rem; padding: 0; margin: 0; align-items: start; }
  .vcard:hover { background: transparent; }
  .vcard:hover .vthumb img { transform: scale(1.03); }
}
.vthumb { position: relative; aspect-ratio: 16/9; border-radius: var(--r); overflow: hidden; background: var(--bg-2); }
.vthumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s var(--ease); }
.vthumb .dur { position: absolute; right: 6px; bottom: 6px; background: rgb(10 12 28 / 0.72); color: #F3EEE4; font-size: 0.72rem; font-weight: 600; padding: 2px 6px; border-radius: 4px; font-variant-numeric: tabular-nums; }
.vthumb .done-badge { position: absolute; left: 6px; top: 6px; width: 24px; height: 24px; border-radius: 50%; background: var(--gold-fill); color: #1A1E3E; display: grid; place-items: center; }
.vthumb .done-badge svg { width: 14px; height: 14px; }
.vcard h3 { font: 600 1.2rem/1.2 var(--font-display); }
.vcard .first-line { font: 400 1rem/1.5 var(--font-bani); color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 0.15rem; }
.vcard .meta { display: flex; gap: 0.75rem; flex-wrap: wrap; font-size: 0.8rem; color: var(--ink-3); margin-top: 0.3rem; }
.vcard .meta svg { width: 14px; height: 14px; display: inline; vertical-align: -2px; margin-right: 3px; }
.coming { border: 1px dashed var(--line-2); border-radius: var(--r); padding: 1rem 1.1rem; color: var(--ink-3); font-size: 0.92rem; margin-top: 1.25rem; }
.coming strong { color: var(--ink-2); font-weight: 600; }

.tcard .vthumb { background: #fff; }
.tcard .vthumb img { object-fit: cover; object-position: top left; }

/* ---------------------------------------------------------------- watch */

.watch { max-width: 1320px; margin: 0 auto; }
.watch-layout { display: grid; grid-template-columns: minmax(0, 1fr); }
.watch-stage { position: sticky; top: 0; z-index: 20; background: var(--bg-2); }
.vid { position: relative; aspect-ratio: 16/9; background: #05060f; overflow: hidden; max-height: 62vh; margin: 0 auto; }
.vid video { width: 100%; height: 100%; object-fit: contain; background: #05060f; }
.vid-poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: brightness(0.45) saturate(0.8); transition: opacity 0.4s var(--ease); }
.vid-poster.gone { opacity: 0; pointer-events: none; }
.vid-load { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 0.6rem; color: #F3EEE4; text-align: center; padding: 1rem; }
.vid-load .ring { width: 64px; height: 64px; }
.vid-load .ring circle { fill: none; stroke-width: 3; }
.vid-load .ring .bg { stroke: rgb(255 255 255 / 0.2); }
.vid-load .ring .fg { stroke: #E9DCA9; stroke-linecap: round; transition: stroke-dashoffset 0.3s linear; transform: rotate(-90deg); transform-origin: center; }
.vid-load p { font-size: 0.92rem; }
.vid-load small { color: rgb(243 238 228 / 0.72); font-size: 0.8rem; font-variant-numeric: tabular-nums; }
.vid-tap { position: absolute; inset: 0; display: grid; place-items: center; }
.vid-tap .big { width: 72px; height: 72px; border-radius: 50%; background: rgb(10 12 28 / 0.55); color: #fff; display: grid; place-items: center; transition: opacity 0.3s var(--ease), transform 0.3s var(--ease); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.vid-tap .big svg { width: 30px; height: 30px; }
.vid.is-playing .vid-tap .big { opacity: 0; transform: scale(0.85); }
.vid-flash { position: absolute; top: 50%; padding: 0.5rem 0.85rem; border-radius: 999px; background: rgb(10 12 28 / 0.62); color: #fff; font-weight: 600; font-size: 0.9rem; translate: 0 -50%; opacity: 0; pointer-events: none; transition: opacity 0.25s; }
.vid-flash.l { left: 12%; } .vid-flash.r { right: 12%; }
.vid-flash.show { opacity: 1; }

.vbar { padding: 0.35rem 0.6rem 0.4rem; background: var(--bg-2); border-bottom: 1px solid var(--line); }
.scrub-row { display: flex; align-items: center; gap: 0.5rem; }
.scrub-row .time { font-size: 0.78rem; color: var(--ink-2); font-variant-numeric: tabular-nums; min-width: 2.6rem; }
.scrub-row .time:last-child { text-align: right; }
.scrub { position: relative; height: 28px; display: flex; align-items: center; flex: 1; min-width: 0; }
.scrub input { position: relative; z-index: 2; margin: 0; height: 28px; background: transparent; -webkit-appearance: none; appearance: none; cursor: pointer; }
.scrub input::-webkit-slider-runnable-track { height: 4px; background: transparent; }
.scrub input::-moz-range-track { height: 4px; background: transparent; }
.scrub input::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--ink); margin-top: -6px; box-shadow: 0 0 0 4px var(--bg-2); }
.scrub input::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--ink); border: 0; }
.scrub .area { position: absolute; left: 8px; right: 8px; top: 0; bottom: 0; pointer-events: none; }
.scrub .track { position: absolute; left: 0; right: 0; top: 50%; height: 4px; margin-top: -2px; border-radius: 2px; background: var(--track); overflow: hidden; }
.scrub .played { position: absolute; inset: 0 auto 0 0; background: var(--gold-fill); }
.scrub .loop { position: absolute; top: 50%; height: 14px; margin-top: -7px; border-radius: 3px; background: color-mix(in srgb, var(--kesri) 26%, transparent); box-shadow: inset 2px 0 var(--kesri), inset -2px 0 var(--kesri); display: none; }
.scrub .loop.on { display: block; }
.watch-stage:fullscreen { display: flex; flex-direction: column; justify-content: center; background: #05060f; }
.watch-stage:fullscreen .vid { max-height: calc(100dvh - 96px); width: 100%; aspect-ratio: auto; flex: 1; }
.watch-stage:fullscreen .vbar { background: #0B0D1E; color-scheme: dark; --ink: #EFE6D6; --ink-2: #BDB9CC; --track: rgb(239 230 214 / 0.14); --line-2: rgb(239 230 214 / 0.2); --bg-2: #0B0D1E; }
.vrow { display: flex; align-items: center; gap: 0.15rem; }
.vrow .time { font-size: 0.8rem; color: var(--ink-2); font-variant-numeric: tabular-nums; padding: 0 0.4rem; white-space: nowrap; }
.vrow .grow { flex: 1; }
.vrow .icon-btn { width: 42px; height: 42px; color: var(--ink); }
.vrow .icon-btn[aria-pressed="true"] { background: var(--gold-soft); color: var(--gold-text); }
.vrow .icon-btn.play { width: 48px; height: 48px; background: var(--accent); color: var(--on-accent); }
.vrow .icon-btn.play svg { width: 22px; height: 22px; }
.speed-btn { min-width: 52px; height: 36px; border-radius: 999px; font-weight: 700; font-size: 0.85rem; box-shadow: inset 0 0 0 1px var(--line-2); font-variant-numeric: tabular-nums; }
.speed-btn[data-slow] { background: var(--gold-soft); color: var(--gold-text); box-shadow: inset 0 0 0 1px var(--gold); }
.repeat-btn { height: 36px; padding: 0 0.7rem; border-radius: 999px; display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.82rem; font-weight: 600; color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line-2); white-space: nowrap; }
.repeat-btn svg { width: 17px; height: 17px; }
.repeat-btn[data-state="a"], .repeat-btn[data-state="on"] { color: var(--kesri); box-shadow: inset 0 0 0 1px var(--kesri); }
@media (max-width: 420px) { .repeat-btn .lbl-long { display: none; } .vrow .icon-btn { width: 38px; } .vrow { gap: 0.1rem; } }
@media (max-width: 350px) { .repeat-btn .lbl { display: none; } }

.watch-meta { padding: 1rem var(--gutter) 0.5rem; display: grid; gap: 0.75rem; }
.watch-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.watch-title .kind { font-size: 0.8rem; font-weight: 600; color: var(--gold-text); }
.watch-title h1 { font: 600 clamp(1.6rem, 1.3rem + 1.2vw, 2.2rem)/1.1 var(--font-display); }
.watch-nav { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.offline-note { font-size: 0.8rem; color: var(--ink-3); display: inline-flex; align-items: center; gap: 0.35rem; }
.offline-note svg { width: 14px; height: 14px; }

.watch-panel { padding: 0.5rem var(--gutter) 2rem; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.75rem 0; border-bottom: 1px solid var(--line); margin-bottom: 0.75rem; position: sticky; top: 0; background: var(--bg); z-index: 2; }
.panel-head h2 { font: 600 1.15rem/1.2 var(--font-display); }
.panel-head h2 span { font: 400 0.82rem var(--font-ui); color: var(--ink-3); margin-left: 0.4rem; }
.watch.panel-off .watch-panel { display: none; }

@media (min-width: 960px) {
  .watch { padding: 1.25rem var(--gutter) 0; }
  .watch-layout { grid-template-columns: minmax(0, 1fr) 400px; gap: 0 1.75rem; align-items: start; }
  .watch-stage { position: static; border-radius: var(--r-lg); overflow: hidden; box-shadow: inset 0 0 0 1px var(--line); }
  .vid { max-height: none; }
  .vbar { border-bottom: 0; }
  .watch-meta { padding: 1.1rem 0.25rem 0; grid-column: 1; }
  .watch-panel { grid-column: 2; grid-row: 1 / span 2; position: sticky; top: 1.25rem; max-height: calc(100dvh - 2.5rem); overflow: auto; padding: 0 1.25rem 1.25rem; background: var(--surface); border-radius: var(--r-lg); box-shadow: inset 0 0 0 1px var(--line); overscroll-behavior: contain; }
  .watch-panel .panel-head { background: var(--surface); }
  .watch.panel-off .watch-layout { grid-template-columns: minmax(0, 1fr); }
}
/* Phone on its side: video and words side by side. */
@media (max-width: 959px) and (orientation: landscape) and (max-height: 560px) {
  .watch-layout { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); }
  .watch-stage { position: sticky; top: 0; height: 100dvh; overflow: auto; }
  .vid { max-height: calc(100dvh - 92px); }
  .watch-meta { grid-column: 1; }
  .watch-panel { grid-column: 2; grid-row: 1 / span 2; }
  .watch.panel-off .watch-layout { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------------- template viewer */

.tpl-stage { position: relative; height: min(68dvh, 680px); overflow: hidden; background: #FFFFFF; border-radius: var(--r-lg); box-shadow: inset 0 0 0 1px var(--line); touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
.tpl-stage:active { cursor: grabbing; }
.tpl-stage img { position: absolute; left: 0; top: 0; max-width: none; transform-origin: 0 0; will-change: transform; -webkit-user-drag: none; }
.tpl-zoom { position: absolute; right: 10px; bottom: 10px; display: flex; gap: 4px; background: rgb(255 255 255 / 0.9); border-radius: 999px; padding: 3px; box-shadow: 0 2px 10px rgb(0 0 0 / 0.15); }
.tpl-zoom .icon-btn { width: 38px; height: 38px; color: #1A1E3E; }
.tpl-zoom .icon-btn:hover { background: rgb(26 30 62 / 0.08); }
.key { margin-top: 1.25rem; }
.key dl { display: grid; grid-template-columns: auto 1fr; gap: 0.55rem 1rem; margin: 0.75rem 0 0; align-items: baseline; }
.key dt { font: 400 1.3rem/1 var(--font-pa); color: var(--ink); text-align: center; min-width: 3.5rem; }
.key dd { margin: 0; color: var(--ink-2); font-size: 0.92rem; }
.key .swar { font: 400 1.25rem/1.6 var(--font-pa); letter-spacing: 0.08em; }
.key .note { font-size: 0.82rem; color: var(--ink-3); margin-top: 0.85rem; }

dialog.viewer { border: 0; padding: 0; margin: 0; width: 100vw; height: 100dvh; max-width: none; max-height: none; background: #FFFFFF; color: #1A1E3E; grid-template-rows: 1fr auto; overflow: hidden; }
dialog.viewer[open] { display: grid; }
dialog.viewer::backdrop { background: #000; }
dialog.viewer .tpl-stage { height: auto; border-radius: 0; box-shadow: none; }
.viewer-bar { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.4rem 0.75rem calc(0.4rem + var(--safe-b)); background: #F3EEE3; color: #1A1E3E; border-top: 1px solid rgb(26 30 62 / 0.12); font-weight: 600; }
.viewer-bar .icon-btn { color: #1A1E3E; }
.viewer-bar .tpl-zoom { box-shadow: none; background: transparent; }

/* ---------------------------------------------------------------- Gurbani */

.ln { font-family: var(--font-bani); font-size: var(--bani-size); line-height: 1.75; margin: 0 0 0.55em; color: var(--ink); text-wrap: balance; }
.ln .w { white-space: nowrap; }
.vis .w-v { color: var(--kesri); }
.vis .w-y { color: var(--yamki); }
.ln-heading { font-size: calc(var(--bani-size) * 0.82); color: var(--gold-text); margin-bottom: 0.4em; }
.ln-center { text-align: center; }
.ln-rahao { position: relative; }
.ln-rahao::before { content: ""; position: absolute; left: -0.75rem; top: 0.45em; bottom: 0.45em; width: 3px; border-radius: 2px; background: var(--kesri); opacity: 0.75; }
.ln-rahao + .ln-rahao::before { top: -0.7em; }
.tl { display: block; font: 400 0.92rem/1.45 var(--font-ui); color: var(--ink-3); margin-top: 0.1em; font-style: italic; }
.mn { display: block; font: 400 0.95rem/1.5 var(--font-ui); color: var(--ink-2); margin-top: 0.25em; max-width: 60ch; }

/* Kanth support levels: hidden words keep their width, so the line's shape
   stays the same as you learn it — the shape is part of what you remember. */
.ln .w-h { color: transparent; border-radius: 3px; background: linear-gradient(var(--hide-bar), var(--hide-bar)) 0 78% / 100% 0.12em no-repeat; cursor: pointer; transition: color 0.2s, background-color 0.2s; }
.ln .w-h:hover { background-color: var(--gold-soft); }
.ln .w-h.peek { color: var(--gold-text); background-image: none; }
.ln .w-f { cursor: pointer; letter-spacing: 0.02em; }
.ln .w-f.peek { color: var(--gold-text); }
.ln .w-f + .w-f { margin-left: 0.3em; }
.ln-blank { cursor: pointer; }
.ln-blank.peek-line .w-h { color: var(--ink); background-image: none; }

/* ---------------------------------------------------------------- kanth */

.kanth-bar {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  padding-top: var(--safe-t);
}
.kanth-bar-in { max-width: 860px; margin: 0 auto; padding: 0.55rem var(--gutter) 0; }
.kanth-bar .seg { display: flex; width: 100%; }
.kanth-bar .seg button { flex: 1; justify-content: center; padding: 0 0.3rem; font-size: 0.86rem; }
.kanth-sub { max-width: 860px; margin: 0 auto; padding: 0.2rem calc(var(--gutter) - 8px) 0 var(--gutter); display: flex; align-items: center; gap: 0.25rem; }
.kanth-sub .icon-btn { width: 40px; height: 40px; }
.kanth-sub .icon-btn[aria-pressed="true"] { background: var(--gold-soft); color: var(--gold-text); }
.level-desc { flex: 1; font-size: 0.82rem; line-height: 1.35; color: var(--ink-3); }
.rail { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; padding: 0.15rem var(--gutter) 0.55rem; max-width: 860px; margin: 0 auto; scroll-behavior: smooth; }
.rail::-webkit-scrollbar { display: none; }
.rail a { flex-shrink: 0; min-width: 38px; height: 34px; padding: 0 0.5rem; border-radius: 999px; display: grid; place-items: center; font-size: 0.82rem; font-weight: 600; text-decoration: none; color: var(--ink-2); position: relative; font-variant-numeric: tabular-nums; }
.rail a::after { content: ""; position: absolute; left: 50%; bottom: 3px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: transparent; }
.rail a.part::after { background: var(--gold); opacity: 0.6; }
.rail a.full::after { background: var(--gold-fill); width: 14px; margin-left: -7px; border-radius: 2px; opacity: 1; }
.rail a[aria-current="true"] { background: var(--accent); color: var(--on-accent); }
.rail a[aria-current="true"]::after { background: var(--on-accent); opacity: 0.6; }

.kanth { max-width: 860px; margin: 0 auto; padding: 1.25rem var(--gutter) 0; }
.kanth-intro h1 { font: 600 clamp(2rem, 1.6rem + 1.6vw, 2.75rem)/1.05 var(--font-display); }
.kanth-intro p { color: var(--ink-2); margin-top: 0.4rem; max-width: 52ch; }
.ks { padding-top: 2.5rem; scroll-margin-top: 150px; }
.ks-head { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.25rem; }
.ks-num { font: 600 3.4rem/0.8 var(--font-display); color: var(--ink); min-width: 2.2ch; font-variant-numeric: lining-nums; }
.ks-head .rule { flex: 1; height: 1px; background: linear-gradient(90deg, var(--gold), transparent); opacity: 0.7; }
.ks-head .meta { text-align: right; font-size: 0.8rem; color: var(--ink-3); line-height: 1.35; }
.ks-head .meta b { display: block; color: var(--gold-text); font: 400 1.15rem/1.2 var(--font-pa); }
.ks-opening .ks-num { font-size: 1.9rem; line-height: 1; }

.kb { position: relative; padding: 1rem 0 0.75rem 1.1rem; border-left: 2px solid var(--line); margin-bottom: 0.9rem; scroll-margin-top: 160px; transition: border-color 0.4s var(--ease), background-color 0.6s var(--ease); }
.kb.learnt { border-left-color: var(--gold); }
.kb.flash { background: var(--gold-soft); }
.kb-head { display: flex; align-items: center; gap: 0.5rem; margin: -0.5rem 0 0.4rem; min-height: 44px; }
.kb-head h3 { font: 600 1.2rem/1.2 var(--font-display); flex: 1; }
.kb-head h3 small { font: 500 0.78rem var(--font-ui); color: var(--ink-3); margin-left: 0.45rem; letter-spacing: 0.01em; display: inline-block; white-space: nowrap; }   /* wraps whole, never mid-label */
.kb-head .icon-btn { width: 40px; height: 40px; }
.kb-chakka { border-left-color: color-mix(in srgb, var(--gold) 55%, transparent); }
.kb-pending { border-left-style: dashed; color: var(--ink-3); }
.kb-pending p { font-size: 0.92rem; max-width: 52ch; padding-bottom: 0.4rem; }
.vaar-head { text-align: center; padding: 1.75rem 0 1rem; }
.vaar-head .ln { font-size: calc(var(--bani-size) * 0.9); color: var(--gold-text); margin-bottom: 0.3em; }
.vaar-head .ln:first-child { font-size: calc(var(--bani-size) * 1.05); color: var(--ink); }

.kanth-end { text-align: center; padding: 3.5rem 0 1rem; }
.kanth-end .orn { width: 120px; margin: 0 auto 1rem; color: var(--gold); }
.kanth-end h2 { font: 600 1.8rem/1.15 var(--font-display); }
.kanth-end p { color: var(--ink-2); margin: 0.4rem auto 0; max-width: 40ch; }
.extra-wrap { margin-top: 2rem; text-align: left; }
.extra-wrap > h2 { font: 600 1.4rem var(--font-display); margin-bottom: 0.25rem; }
.extra-wrap > p { color: var(--ink-3); font-size: 0.9rem; margin-bottom: 1rem; }

.focus-exit { position: fixed; right: calc(1rem + env(safe-area-inset-right, 0px)); bottom: calc(1rem + var(--safe-b)); z-index: 45; box-shadow: var(--shadow-lg); }

/* ---------------------------------------------------------------- checklist */

.cl-top { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.85rem; margin-bottom: 0.5rem; }
.cl-filters .seg { min-width: 0; }
@media (max-width: 600px) { .cl-filters .seg { -webkit-mask-image: linear-gradient(90deg, #000 82%, transparent); mask-image: linear-gradient(90deg, #000 82%, transparent); padding-right: 1.5rem; } }
.cl-summary { display: flex; align-items: center; gap: 1rem; }
.cl-summary .bar { flex: 1; height: 8px; border-radius: 4px; }
.cl-summary span { font-variant-numeric: tabular-nums; color: var(--ink-2); font-size: 0.9rem; white-space: nowrap; }
.search { position: relative; }
.search svg { position: absolute; left: 14px; top: 50%; width: 18px; height: 18px; margin-top: -9px; color: var(--ink-3); pointer-events: none; }
.search input { width: 100%; height: 46px; border-radius: 999px; border: 0; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-2); padding: 0 1rem 0 2.6rem; font-size: 1rem; }
.search input:focus { outline: none; box-shadow: inset 0 0 0 2px var(--gold); }
.search input::placeholder { color: var(--ink-3); }
.cl-filters { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; }
.cl-filters .switch { min-height: 40px; gap: 0.6rem; font-size: 0.88rem; color: var(--ink-2); }
.cl-group { margin-top: 1.5rem; }
.cl-group > h2 { display: flex; align-items: baseline; gap: 0.6rem; font: 600 1.25rem var(--font-display); padding-bottom: 0.4rem; border-bottom: 1px solid var(--line); }
.cl-group > h2 small { font: 500 0.8rem var(--font-ui); color: var(--ink-3); }
.cl-group > h2 .pa { font-size: 0.95rem; color: var(--gold-text); font-weight: 400; }
.row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 0.35rem 0.6rem; border-bottom: 1px solid var(--line); }
.row .tick { padding-left: 0; }
.row-main { display: grid; gap: 0.05rem; padding: 0.6rem 0; text-align: left; min-width: 0; width: 100%; }
.row-main .t { font-weight: 600; font-size: 0.95rem; }
.row-main .t small { font-weight: 400; color: var(--ink-3); margin-left: 0.35rem; font-size: 0.8rem; }
.row-main .f { font: 400 1.05rem/1.5 var(--font-bani); color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-main .pending { font-size: 0.85rem; color: var(--ink-3); font-style: italic; }
.row .chev { width: 20px; height: 20px; color: var(--ink-3); transition: transform 0.25s var(--ease); }
.row-main[aria-expanded="true"] ~ .chev-btn .chev { transform: rotate(180deg); }
.chev-btn { width: 40px; height: 44px; display: grid; place-items: center; }
.row-detail { grid-column: 1 / -1; padding: 0.25rem 0 1rem 2.3rem; }
.row-detail .actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; }
.row.is-done .row-main .t { color: var(--gold-text); }
.empty { text-align: center; color: var(--ink-3); padding: 3rem 1rem; }
.empty strong { display: block; color: var(--ink); font: 600 1.4rem var(--font-display); margin-bottom: 0.3rem; }

/* ---------------------------------------------------------------- settings & sheets */

.set-group { margin-top: 1.75rem; }
.set-group > h2 { font: 600 1.35rem var(--font-display); margin-bottom: 0.35rem; }
.set-group > p { color: var(--ink-2); font-size: 0.92rem; margin-bottom: 0.5rem; max-width: 60ch; }
.set-list { background: var(--surface); border-radius: var(--r-lg); box-shadow: inset 0 0 0 1px var(--line); padding: 0.25rem 1.1rem; }
.set-list > * + * { border-top: 1px solid var(--line); }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 56px; padding: 0.4rem 0; flex-wrap: wrap; }
.set-row .lbl small { display: block; color: var(--ink-3); font-size: 0.82rem; }
.size-row { display: grid; gap: 0.5rem; padding: 0.85rem 0; }
.size-row .preview { font: 400 var(--bani-size)/1.6 var(--font-bani); }
.code-box { width: 100%; min-height: 90px; border-radius: var(--r); border: 0; box-shadow: inset 0 0 0 1px var(--line-2); background: var(--surface-2); padding: 0.75rem; font: 500 0.82rem/1.4 ui-monospace, Menlo, monospace; resize: vertical; word-break: break-all; }
.storage-meter { height: 6px; border-radius: 3px; background: var(--track); overflow: hidden; margin-top: 0.35rem; }
.storage-meter i { display: block; height: 100%; background: var(--gold-fill); width: 0; transition: width 0.4s var(--ease); }

dialog.sheet {
  border: 0; padding: 0; margin: auto auto 0; width: 100%; max-width: 560px;
  background: var(--surface); color: var(--ink);
  border-radius: var(--r-lg) var(--r-lg) 0 0; box-shadow: var(--shadow-lg);
  max-height: 88dvh;
}
dialog.sheet::backdrop { background: var(--scrim); }
dialog.sheet[open] { animation: sheet-up 0.35s var(--ease-out); }
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } }
@media (min-width: 700px) { dialog.sheet { margin: auto; border-radius: var(--r-lg); } }
.sheet-in { padding: 1rem 1.25rem calc(1.25rem + var(--safe-b)); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.25rem; }
.sheet-head h2 { font: 600 1.4rem var(--font-display); }
.sheet .switch { border-top: 1px solid var(--line); }
.sheet .legend { display: flex; gap: 1rem; font-size: 0.82rem; color: var(--ink-3); margin: -0.4rem 0 0.4rem; }
.sheet .legend .pa { font-family: var(--font-bani); font-size: 1rem; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabs-h) + var(--safe-b) + 1rem); z-index: 90;
  translate: -50% 20px; opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--bg); padding: 0.7rem 1.1rem; border-radius: 999px;
  font-size: 0.92rem; font-weight: 500; box-shadow: var(--shadow-lg); white-space: nowrap;
  transition: opacity 0.3s var(--ease), translate 0.4s var(--ease-out);
}
.toast.show { opacity: 1; translate: -50% 0; }
.toast .pa { color: var(--gold); margin-left: 0.35rem; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
  .welcome.playing .welcome-logo::before, .welcome.playing .welcome-logo::after { animation: none; }
}
