/* ───────────── Tokens ───────────── */
:root {
  --ink: #0b0a10;
  --ink-2: #14111a;
  --glass: rgba(18, 14, 16, 0.58);
  --glass-strong: rgba(16, 12, 14, 0.86);
  --paper: #f3e7d3;
  --paper-dim: #cbbca5;      /* 9.5:1 on --ink */
  --muted: #a8998a;          /* 6.6:1 on --ink */
  --amber: #f2a950;
  --amber-hot: #ffc47a;
  --amber-deep: #c8742a;
  --zero: #8fb0ff;           /* zero-watt blue */
  --line: rgba(243, 231, 211, 0.14);
  --line-strong: rgba(243, 231, 211, 0.28);
  --focus: #ffd29a;

  --f-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --f-ui: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;
  --f-mono: "Martian Mono", ui-monospace, "SF Mono", monospace;
  --f-deva: "Tiro Devanagari Hindi", "Noto Serif Devanagari", serif;

  --r-sm: 10px;
  --r-md: 18px;
  --r-lg: 28px;
  --gutter: clamp(16px, 3vw, 32px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);

  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --z-canvas: 0; --z-fx: 10; --z-hud: 40; --z-sheet: 60; --z-pop: 70; --z-toast: 90; --z-intro: 100;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  background: var(--ink);
  color: var(--paper);
  font-family: var(--f-ui);
  font-size: 16px;
  line-height: 1.5;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
svg { display: block; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: fixed; top: -100px; left: 16px; z-index: 200; background: var(--paper); color: var(--ink); padding: 10px 14px; border-radius: 8px; }
.skip:focus { top: 16px; }

/* ───────────── Canvas & film ───────────── */
#room { position: fixed; top: 0; left: 0; width: 100%; height: 100vh; height: 100dvh; z-index: var(--z-canvas); display: block; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; } /* the room handles its own touch drags (curtain) */
.is-dragging, .is-dragging * { user-select: none !important; -webkit-user-select: none !important; cursor: grabbing !important; }
.grain {
  /* plain alpha, no blend mode: a blend-mode layer over a live canvas costs an extra pass */
  position: fixed; inset: 0; z-index: var(--z-fx); pointer-events: none; opacity: .045;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
@keyframes grain {
  0% { transform: translate(0, 0); } 20% { transform: translate(-3%, 2%); } 40% { transform: translate(2%, -4%); }
  60% { transform: translate(-4%, -1%); } 80% { transform: translate(3%, 3%); } 100% { transform: translate(0, 0); }
}
.vignette {
  position: fixed; inset: 0; z-index: var(--z-fx); pointer-events: none;
  background: radial-gradient(120% 90% at 50% 45%, transparent 55%, rgba(4, 3, 6, .75) 100%);
}

/* ───────────── Intro ───────────── */
.intro {
  position: fixed; inset: 0; z-index: var(--z-intro);
  display: grid; place-content: center; justify-items: center; text-align: center; gap: 20px;
  padding: calc(var(--gutter) + var(--safe-t)) var(--gutter) calc(var(--gutter) + var(--safe-b));
  background: radial-gradient(70% 60% at 50% 55%, rgba(40, 26, 14, .55), rgba(6, 5, 8, .96) 70%), var(--ink);
}
.intro__time { font-family: var(--f-mono); font-size: 12px; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); margin: 0; }
.intro__title { margin: 0; display: grid; justify-items: center; line-height: .9; }
.intro__deva { font-family: var(--f-deva); font-size: clamp(28px, 5vw, 44px); color: var(--amber); margin-bottom: 8px; }
.intro__word {
  font-family: var(--f-display); font-weight: 400; font-size: clamp(56px, 13vw, 148px); letter-spacing: -.035em;
  font-variation-settings: "SOFT" 100, "WONK" 1, "opsz" 144;
}
.intro__word em { font-style: italic; color: var(--amber-hot); font-variation-settings: "SOFT" 100, "WONK" 1, "opsz" 144; }
.intro__word .ch { display: inline-block; will-change: transform; }
.intro__line { max-width: 34ch; margin: 0; color: var(--paper-dim); font-size: clamp(16px, 2vw, 18px); }
.intro__hint { font-size: 13px; color: var(--muted); max-width: 40ch; margin: 0; }

.switch {
  display: inline-flex; align-items: center; gap: 14px; margin-top: 12px;
  padding: 10px 22px 10px 10px; min-height: 56px;
  background: #e9dcc4; color: #231a12; border: 0; border-radius: 16px;
  box-shadow: 0 1px 0 rgba(255,255,255,.6) inset, 0 -2px 0 rgba(0,0,0,.18) inset, 0 16px 40px -12px rgba(242, 169, 80, .45);
  font-weight: 700; font-size: 16px; transition: transform .2s var(--ease-out), box-shadow .3s;
}
.switch:hover { transform: translateY(-2px); box-shadow: 0 1px 0 rgba(255,255,255,.6) inset, 0 -2px 0 rgba(0,0,0,.18) inset, 0 22px 50px -12px rgba(242, 169, 80, .7); }
.switch:active { transform: translateY(1px) scale(.98); }
.switch__plate { width: 36px; height: 36px; border-radius: 8px; background: #d6c7ab; display: grid; place-items: center; box-shadow: inset 0 1px 3px rgba(0,0,0,.25); }
.switch__toggle { width: 10px; height: 20px; border-radius: 3px; background: #f7efe0; box-shadow: 0 3px 0 #9d8e74; transition: transform .15s, box-shadow .15s; }
.switch.is-on .switch__toggle { transform: translateY(3px); box-shadow: 0 -3px 0 #9d8e74; }

/* ───────────── HUD top ───────────── */
.hud-top {
  position: fixed; z-index: var(--z-hud); left: 0; right: 0; top: 0;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: calc(var(--gutter) + var(--safe-t) * .6) var(--gutter) 0;
  pointer-events: none;
}
.hud-top > * { pointer-events: auto; }
.brand { display: flex; align-items: baseline; gap: 10px; }
.brand__deva { font-family: var(--f-deva); color: var(--amber); font-size: 22px; }
.brand__name { font-family: var(--f-display); font-style: italic; font-size: 22px; letter-spacing: -.01em; font-variation-settings: "SOFT" 100, "WONK" 1; }
.hud-nav { display: flex; gap: 8px; }

.navbtn, .streak {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px;
  background: rgba(18, 14, 16, 0.74); border: 1px solid var(--line); border-radius: 999px;
  font-weight: 500; font-size: 15px; transition: background .25s, border-color .25s, transform .2s var(--ease-out);
}
.navbtn:hover, .streak:hover { border-color: var(--line-strong); background: rgba(40, 30, 26, .7); }
.navbtn:active, .streak:active { transform: scale(.96); }
.navbtn[aria-expanded="true"] { border-color: var(--amber); color: var(--amber-hot); }
.navbtn svg, .iconbtn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.streak svg { width: 18px; height: 18px; fill: var(--amber); }
.streak__num { font-family: var(--f-mono); font-weight: 500; font-variant-numeric: tabular-nums; }
.streak__unit { color: var(--paper-dim); font-size: 14px; }

/* Streak popover */
.pop {
  position: fixed; z-index: var(--z-pop); top: calc(var(--gutter) + 56px + var(--safe-t) * .6); right: var(--gutter);
  width: min(320px, calc(100vw - 2 * var(--gutter))); padding: 20px;
  background: var(--glass-strong); border: 1px solid var(--line); border-radius: var(--r-md);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 30px 60px -20px rgba(0,0,0,.6);
}
.pop__big { margin: 0 0 14px; font-family: var(--f-display); font-size: 30px; line-height: 1.1; }
.pop__big span:last-child { font-style: italic; color: var(--paper-dim); font-size: 20px; }
.pop__small { margin: 10px 0 0; font-size: 14px; }
.muted { color: var(--muted); }
.week { list-style: none; display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin: 0; padding: 0; }
.week li { display: grid; justify-items: center; gap: 6px; font-family: var(--f-mono); font-size: 11px; color: var(--muted); }
.week .dot { width: 28px; height: 28px; border-radius: 50%; border: 1px dashed var(--line-strong); display: grid; place-items: center; }
.week .done .dot { border: 0; background: radial-gradient(circle at 40% 35%, var(--amber-hot), var(--amber-deep)); box-shadow: 0 0 14px rgba(242,169,80,.55); }
.week .done .dot svg { width: 14px; height: 14px; stroke: #2b1a0a; fill: none; stroke-width: 2.5; }
.week .today { color: var(--paper); }

/* ───────────── Timer ───────────── */
.timer {
  position: fixed; z-index: var(--z-hud);
  left: var(--gutter); bottom: calc(var(--gutter) + var(--safe-b));
  width: 320px; padding: 20px 22px 18px;
  display: grid; justify-items: center; gap: 12px;
  background: var(--glass); border: 1px solid var(--line); border-radius: var(--r-lg);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 40px 80px -30px rgba(0,0,0,.7);
  outline: none;
}
.timer__modes { display: flex; gap: 6px; padding: 4px; border-radius: 999px; background: rgba(0,0,0,.28); border: 1px solid var(--line); }
.chip {
  min-height: 36px; min-width: 64px; padding: 0 12px; border: 0; border-radius: 999px; background: transparent;
  font-family: var(--f-mono); font-size: 13px; color: var(--paper-dim); transition: background .25s, color .25s;
}
.chip span { opacity: .6; }
.chip:hover { color: var(--paper); }
.chip[aria-checked="true"] { background: var(--paper); color: var(--ink); }
.chip[aria-checked="true"] span { opacity: .55; }
.timer__phase { margin: 4px 0 -6px; font-family: var(--f-display); font-style: italic; font-size: 18px; color: var(--amber-hot); font-variation-settings: "SOFT" 100, "WONK" 1; }
.timer.is-break .timer__phase { color: var(--zero); }
.timer__clock { position: relative; width: 196px; height: 196px; display: grid; place-items: center; }
.ring { position: absolute; inset: 0; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 2.5; }
.ring__track { stroke: var(--line); }
.ring__fill { stroke: var(--amber); stroke-linecap: round; stroke-dasharray: 339.29; stroke-dashoffset: 0; filter: drop-shadow(0 0 6px rgba(242,169,80,.6)); transition: stroke .6s; }
.timer.is-break .ring__fill { stroke: var(--zero); filter: drop-shadow(0 0 6px rgba(143,176,255,.5)); }
.timer__digits { margin: 0; font-family: var(--f-mono); font-weight: 300; font-size: 44px; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.timer__quote { margin: -4px 0 0; min-height: 1.5em; font-family: var(--f-display); font-style: italic; color: var(--paper-dim); font-size: 15px; text-align: center; }
.timer__controls { display: flex; align-items: center; gap: 14px; }
.iconbtn {
  width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%;
  border: 1px solid var(--line); background: rgba(0,0,0,.2); transition: border-color .2s, transform .2s var(--ease-out), background .2s;
}
.iconbtn:hover { border-color: var(--line-strong); background: rgba(255,255,255,.05); }
.iconbtn:active { transform: scale(.92); }
.primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 128px; min-height: 52px; padding: 0 24px;
  border: 0; border-radius: 999px; background: var(--amber); color: #24160a; font-weight: 700; font-size: 16px;
  box-shadow: 0 10px 30px -8px rgba(242,169,80,.6), inset 0 1px 0 rgba(255,255,255,.4);
  transition: transform .2s var(--ease-out), background .25s, box-shadow .25s;
}
.primary:hover { background: var(--amber-hot); }
.primary:active { transform: scale(.96); }
.primary svg { width: 16px; height: 16px; fill: currentColor; }
.primary .i-pause, .primary.is-running .i-play { display: none; }
.primary.is-running .i-pause { display: block; }
.timer.is-chai .timer__phase { color: #f0b27a; }
.timer.is-chai .ring__fill { stroke: #e0955a; filter: drop-shadow(0 0 6px rgba(224,149,90,.55)); }
.timer.is-break .primary { background: var(--zero); box-shadow: 0 10px 30px -8px rgba(143,176,255,.5), inset 0 1px 0 rgba(255,255,255,.4); color: #0d1428; }
.timer.is-chai .primary { background: #e0955a; color: #24160a; box-shadow: 0 10px 30px -8px rgba(224,149,90,.55), inset 0 1px 0 rgba(255,255,255,.4); }

.chai {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; margin-top: 2px;
  background: transparent; border: 1px dashed var(--line-strong); border-radius: 999px; color: var(--paper-dim); font-size: 15px;
  transition: color .2s, border-color .2s, background .2s;
}
.chai svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.chai:hover { color: var(--amber-hot); border-color: var(--amber); }
.chai[aria-pressed="true"] { background: rgba(200, 116, 42, .22); border-style: solid; border-color: var(--amber); color: var(--amber-hot); }

/* ───────────── Sheets ───────────── */
.sheet {
  position: fixed; z-index: var(--z-sheet);
  top: calc(var(--gutter) + 60px + var(--safe-t) * .6); right: var(--gutter); bottom: calc(var(--gutter) + var(--safe-b));
  width: min(420px, calc(100vw - 2 * var(--gutter)));
  overflow-y: auto; overscroll-behavior: contain; padding: 22px 22px 28px;
  background: var(--glass-strong); border: 1px solid var(--line); border-radius: var(--r-lg);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 40px 80px -30px rgba(0,0,0,.8);
  scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent;
}
.sheet__head { display: flex; justify-content: space-between; align-items: center; }
.sheet h2 { margin: 0; font-family: var(--f-display); font-weight: 400; font-size: 32px; letter-spacing: -.02em; font-variation-settings: "SOFT" 100, "WONK" 1, "opsz" 72; }
.sheet h3 { margin: 0; font-size: 16px; font-weight: 700; }
.sheet__sub { margin: 4px 0 20px; color: var(--muted); font-size: 14px; }

/* Fan regulator */
.reg { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 16px; padding: 16px; border: 1px solid var(--line); border-radius: var(--r-md); background: rgba(255,255,255,.02); }
.reg__label p { margin: 2px 0 0; font-size: 14px; color: var(--paper-dim); }
.reg__label p span { font-family: var(--f-mono); color: var(--amber-hot); }
.reg__knob { position: relative; width: 152px; height: 152px; }
.reg__dial {
  position: absolute; left: 50%; top: 50%; width: 76px; height: 76px; margin: -38px 0 0 -38px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fbf3e4, #d9ccb4 55%, #a99a80);
  box-shadow: 0 6px 14px rgba(0,0,0,.5), inset 0 -3px 6px rgba(0,0,0,.2);
  transition: transform .5s var(--ease-out);
}
.reg__notch { position: absolute; left: 50%; top: 6px; width: 4px; height: 18px; margin-left: -2px; border-radius: 2px; background: #3b2a1a; }
.reg__pos {
  position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; margin: -22px 0 0 -22px; border-radius: 50%;
  border: 0; background: transparent; font-family: var(--f-mono); font-size: 13px; color: var(--muted);
  display: grid; place-items: center; transition: color .2s;
}
.reg__pos:hover { color: var(--paper); }
.reg__pos[aria-checked="true"] { color: var(--amber-hot); font-weight: 500; }

/* Sliders */
.mix { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 4px; }
.mix__row { display: grid; gap: 6px; padding: 12px 4px; border-bottom: 1px solid var(--line); }
.mix__row label { display: grid; gap: 0; }
.mix__name { font-weight: 500; }
.mix__desc { font-size: 13px; color: var(--muted); }
input[type="range"] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 32px; background: transparent; cursor: pointer; touch-action: pan-y;
  --v: 50%;
}
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--amber) var(--v), rgba(243,231,211,.16) var(--v)); }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 4px; background: rgba(243,231,211,.16); }
input[type="range"]::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--amber); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 22px; height: 22px; margin-top: -9px; border-radius: 50%;
  background: var(--paper); border: 0; box-shadow: 0 2px 8px rgba(0,0,0,.5), 0 0 0 5px rgba(242,169,80,.15);
}
input[type="range"]::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: var(--paper); border: 0; }
input[type="range"]:focus-visible { outline: none; }
input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px var(--focus); }

.cooker { display: grid; gap: 12px; margin-top: 20px; padding: 16px; border-radius: var(--r-md); border: 1px solid var(--line); background: rgba(200,116,42,.07); }
.cooker p { margin: 2px 0 0; font-size: 14px; color: var(--paper-dim); }
.cooker__actions { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.ghost {
  min-height: 44px; padding: 0 18px; border-radius: 999px; background: transparent; border: 1px solid var(--line-strong);
  font-weight: 500; transition: border-color .2s, background .2s, transform .2s var(--ease-out);
}
.ghost:hover { border-color: var(--amber); background: rgba(242,169,80,.08); }
.ghost:active { transform: scale(.96); }
.toggle { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; font-size: 15px; }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle__track { width: 44px; height: 26px; border-radius: 999px; background: rgba(243,231,211,.18); position: relative; transition: background .25s; }
.toggle__track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--paper); transition: transform .3s var(--ease-out); }
.toggle input:checked + .toggle__track { background: var(--amber-deep); }
.toggle input:checked + .toggle__track::after { transform: translateX(18px); }
.toggle input:focus-visible + .toggle__track { outline: 2px solid var(--focus); outline-offset: 3px; }

/* Music */
.tabs { position: relative; display: grid; grid-template-columns: 1fr 1fr; margin: 18px 0 16px; border-bottom: 1px solid var(--line); }
.tabs [role="tab"] { min-height: 44px; border: 0; background: transparent; color: var(--muted); font-weight: 500; font-size: 15px; transition: color .2s; }
.tabs [role="tab"][aria-selected="true"] { color: var(--paper); }
.tabs__ink { position: absolute; left: 0; bottom: -1px; width: 50%; height: 2px; background: var(--amber); border-radius: 2px; }
.player__frame { position: relative; aspect-ratio: 16 / 9; border-radius: var(--r-md); overflow: hidden; background: #000 radial-gradient(circle at 50% 50%, #1d1712, #000); border: 1px solid var(--line); }
.player__frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.player__empty { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; padding: 20px; text-align: center; color: var(--muted); font-size: 14px; font-family: var(--f-display); font-style: italic; }
.player__now { margin: 8px 0 0; min-height: 1.5em; font-size: 13px; color: var(--paper-dim); }
.tracks { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.track {
  width: 100%; display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 12px; min-height: 56px; padding: 8px 12px 8px 8px; text-align: left;
  background: rgba(255,255,255,.025); border: 1px solid var(--line); border-radius: 14px; transition: border-color .2s, background .2s;
}
.track:hover { border-color: var(--line-strong); background: rgba(255,255,255,.05); }
.track[aria-current="true"] { border-color: var(--amber); background: rgba(242,169,80,.08); }
.track__art { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--c, #3a2a1c); }
.track__art svg { width: 18px; height: 18px; fill: none; stroke: var(--paper); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.track__t { display: grid; min-width: 0; }
.track__t b { font-weight: 500; font-size: 15px; overflow-wrap: anywhere; }
.track__t small { color: var(--muted); font-size: 13px; }
.track__tag { font-family: var(--f-mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; padding: 4px 8px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--paper-dim); white-space: nowrap; }
.track__tag.live { border-color: rgba(255,110,90,.6); color: #ffb3a3; }
.track__tag.live::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: #ff6e5a; vertical-align: 1px; }

.paste { margin-top: 18px; }
.paste label { font-size: 14px; color: var(--paper-dim); }
.paste__row { display: flex; gap: 8px; margin-top: 6px; }
.paste input { flex: 1; min-width: 0; min-height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line-strong); background: rgba(0,0,0,.3); font-size: 16px; }
.paste input::placeholder { color: var(--muted); }
.paste__err { margin: 6px 0 0; min-height: 1.2em; font-size: 13px; color: #ffb3a3; }

.faq { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 18px; }
.faq h3 { font-family: var(--f-display); font-weight: 400; font-size: 24px; margin-bottom: 8px; font-style: italic; }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { list-style: none; cursor: pointer; min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; font-weight: 500; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-family: var(--f-mono); color: var(--amber); font-size: 18px; transition: transform .3s var(--ease-out); flex: none; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { margin: 0 0 12px; color: var(--paper-dim); font-size: 15px; max-width: 60ch; }
.faq strong { color: var(--paper); }

/* Toast */
.toast {
  position: fixed; z-index: var(--z-toast); left: 50%; top: calc(var(--gutter) + 64px + var(--safe-t));
  opacity: 0; visibility: hidden; pointer-events: none;
  display: flex; align-items: center; gap: 12px;
  padding: 8px 10px 8px 18px; min-height: 44px; border-radius: 999px; background: var(--paper); color: var(--ink); font-weight: 500; font-size: 15px;
  box-shadow: 0 20px 40px -10px rgba(0,0,0,.6); max-width: calc(100vw - 32px); text-align: center;
}

/* Battery saver: no film grain, no live blur behind panels (it re-blurs every frame) */
body.saver .grain { display: none; }
body.saver .timer, body.saver .navbtn, body.saver .streak, body.saver .sheet, body.saver .pop {
  backdrop-filter: none; -webkit-backdrop-filter: none;
}
body.saver .timer, body.saver .navbtn, body.saver .streak { background: rgba(18, 14, 16, 0.9); }
body.saver .sheet, body.saver .pop { background: rgba(16, 12, 14, 0.97); }

.saverbox { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 16px; margin-top: 12px; padding: 16px; border-radius: var(--r-md); border: 1px solid var(--line); }
.saverbox p { margin: 2px 0 0; font-size: 14px; color: var(--paper-dim); }
.saverbox .saverbox__auto { grid-column: 1 / -1; font-size: 13px; color: var(--muted); min-height: 0; }
.saverbox .saverbox__auto:empty { display: none; }

/* Player states */
.player__frame iframe.is-loading { opacity: 0; }
.player__state { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 10px; padding: 20px; text-align: center; }
.player__state p { margin: 0; font-size: 14px; color: var(--paper-dim); }
.player__state--error { background: radial-gradient(circle at 50% 40%, #2a1a14, #0a0808); }
.player__err-title { font-family: var(--f-display); font-style: italic; font-size: 22px !important; color: var(--paper) !important; }
.player__err-why { max-width: 32ch; }
.ghost--small { display: inline-flex; align-items: center; gap: 8px; margin-top: 6px; color: var(--paper); text-decoration: none; font-size: 15px; }
.ghost--small svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--line-strong); border-top-color: var(--amber); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Hidden debug overlay (?debug or Shift+D) */
.debug {
  position: fixed; z-index: var(--z-toast); left: 12px; top: calc(76px + var(--safe-t)); margin: 0; padding: 10px 12px;
  background: rgba(0,0,0,.78); color: #b6f7a8; border: 1px solid rgba(182,247,168,.3); border-radius: 10px;
  font: 11px/1.5 var(--f-mono); white-space: pre; pointer-events: none;
  max-width: calc(100vw - 24px); overflow: hidden; text-overflow: ellipsis;
}

/* Chai mode tints the whole UI warmer */
body.chai-mode .timer { border-color: rgba(242,169,80,.35); }


/* ───────────── Round 2 ───────────── */
.toast.has-action { pointer-events: auto; }
.toast__act { min-height: 36px; padding: 0 14px; border-radius: 999px; border: 0; background: var(--ink); color: var(--paper); font-weight: 700; font-size: 14px; }

.tip {
  position: fixed; z-index: var(--z-toast); left: 0; top: 0; pointer-events: none; opacity: 0;
  padding: 6px 10px; border-radius: 8px; background: rgba(10, 8, 10, .88); color: var(--paper);
  font-size: 13px; font-weight: 500; white-space: nowrap; transform: translate(-50%, -140%); transition: opacity .15s;
}
.tip.is-on { opacity: 1; }

.sheet__h3 { margin: 22px 0 6px !important; font-family: var(--f-display); font-weight: 400 !important; font-style: italic; font-size: 22px !important; }
.linkbtn { border: 0; background: none; color: var(--amber-hot); font-size: 14px; text-decoration: underline; text-underline-offset: 3px; min-height: 44px; padding: 0 4px; }
.linkbtn:disabled { color: var(--muted); text-decoration: none; cursor: default; }

/* timer card */
.timer__top { display: flex; align-items: center; gap: 8px; }
.iconbtn--sm { width: 44px; height: 44px; }
.timer__cycle { margin: -6px 0 -2px; display: flex; gap: 6px; min-height: 8px; }
.timer__cycle i { width: 7px; height: 7px; border-radius: 50%; border: 1px solid var(--line-strong); }
.timer__cycle i.on { background: var(--amber); border-color: var(--amber); }
.timer__row { display: flex; gap: 8px; }
.timer__row .chai { margin: 0; padding: 0 12px; white-space: nowrap; font-size: 14px; gap: 6px; }
.chai--focus .i-exit { display: none; }
.chai--focus[aria-pressed="true"] .i-enter { display: none; }
.chai--focus[aria-pressed="true"] .i-exit { display: block; }
.timer.is-long .timer__phase { color: #b9a6ff; }
.timer.is-long .ring__fill { stroke: #b9a6ff; }
.timer.is-long .primary { background: #b9a6ff; color: #1a1030; }

/* fullscreen focus mode: only the room and the timer */
body.focus-mode .hud-top, body.focus-mode .sheet, body.focus-mode .pop, body.focus-mode .tip, body.focus-mode .timer__top,
body.focus-mode #chai, body.focus-mode .timer__quote { display: none !important; }
body.focus-mode .timer { left: 0; right: 0; margin: 0 auto; bottom: calc(28px + var(--safe-b)); width: 300px;
  background: rgba(12, 10, 12, .45); border-color: rgba(243, 231, 211, .08); }
body.focus-mode .vignette { background: radial-gradient(110% 80% at 50% 40%, transparent 45%, rgba(4, 3, 6, .85) 100%); }

/* timer settings */
.presets { display: flex; gap: 8px; flex-wrap: wrap; }
.numrow { display: grid; grid-template-columns: 1fr 72px; gap: 12px; align-items: center; }
.num { min-height: 44px; width: 72px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line-strong); background: rgba(0,0,0,.3); font-family: var(--f-mono); font-size: 16px; }
.setrow { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center; margin-top: 16px; padding: 16px; border: 1px solid var(--line); border-radius: var(--r-md); }
.setrow p { margin: 2px 0 0; font-size: 14px; color: var(--paper-dim); }
.sounds, .opts { border: 0; margin: 18px 0 0; padding: 0; }
.sounds legend, .opts legend { font-weight: 700; margin-bottom: 8px; padding: 0; }
.sounds__list { display: grid; gap: 6px; }
.soundopt { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px; padding: 4px 4px 4px 14px; border: 1px solid var(--line); border-radius: 14px; }
.soundopt:has(input:checked) { border-color: var(--amber); background: rgba(242,169,80,.07); }
.soundopt label { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
.soundopt input { accent-color: var(--amber); width: 18px; height: 18px; }
.soundopt small { display: block; color: var(--muted); font-size: 13px; }

/* calendar */
.cal__nav { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; }
.cal__month { margin: 0; font-family: var(--f-display); font-size: 22px; }
.cal__grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: 10px; }
.cal__dow { text-align: center; font-family: var(--f-mono); font-size: 11px; color: var(--muted); padding: 4px 0; }
.day {
  position: relative; aspect-ratio: 1; min-height: 40px; border-radius: 10px; border: 1px solid transparent; background: rgba(255,255,255,.025);
  font-family: var(--f-mono); font-size: 13px; color: var(--paper-dim); display: grid; place-items: center; padding: 0;
}
.day:hover { border-color: var(--line-strong); }
.day.is-out { opacity: .35; }
.day.is-study { background: rgba(242,169,80,.22); color: var(--paper); }
.day.is-streak { background: linear-gradient(160deg, var(--amber-hot), var(--amber-deep)); color: #2b1a0a; font-weight: 500; }
.day.is-today { border-color: var(--paper); }
.day.is-sel { outline: 2px solid var(--focus); outline-offset: 1px; }
.day .mark { position: absolute; top: 4px; right: 4px; width: 7px; height: 7px; border-radius: 50%; background: #ff6e5a; box-shadow: 0 0 0 2px rgba(0,0,0,.35); }
.cal__legend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 0; margin: 12px 0 0; font-size: 13px; color: var(--paper-dim); }
.cal__legend li { display: flex; align-items: center; gap: 6px; }
.lg { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }
.lg--study { background: rgba(242,169,80,.4); } .lg--streak { background: var(--amber); } .lg--exam { background: #ff6e5a; border-radius: 50%; } .lg--today { border: 1.5px solid var(--paper); }
.cal__add { margin-top: 16px; }
.cal__add label { font-size: 14px; color: var(--paper-dim); }
.exams, .todo { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.exam, .task { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px; padding: 6px 6px 6px 14px; border: 1px solid var(--line); border-radius: 14px; }
.exam b { font-weight: 500; }
.exam small, .task small { display: block; color: var(--muted); font-size: 13px; }
.exam__acts { display: flex; gap: 4px; align-items: center; }
.exam .is-cd { color: #ffb3a3; font-size: 12px; font-family: var(--f-mono); }
.empty { color: var(--muted); font-size: 14px; font-style: italic; font-family: var(--f-display); padding: 6px 2px; }

/* to-do */
.task { grid-template-columns: auto 1fr auto; padding-left: 4px; }
.task__check { position: relative; display: grid; place-items: center; width: 44px; height: 44px; cursor: pointer; }
.task__check input { position: absolute; opacity: 0; width: 44px; height: 44px; margin: 0; cursor: pointer; }
.task__box { width: 22px; height: 22px; border-radius: 6px; border: 2px solid var(--line-strong); display: grid; place-items: center; transition: background .2s, border-color .2s; }
.task__box svg { width: 14px; height: 14px; stroke: #2b1a0a; fill: none; stroke-width: 3; opacity: 0; }
.task__check input:checked + .task__box { background: var(--amber); border-color: var(--amber); }
.task__check input:checked + .task__box svg { opacity: 1; }
.task__check input:focus-visible + .task__box { outline: 2px solid var(--focus); outline-offset: 3px; }
.task__text { overflow-wrap: anywhere; }
.task.is-done .task__text { color: var(--muted); text-decoration: line-through; }
.todo__meta { display: flex; justify-content: space-between; align-items: center; margin: 6px 2px 0; font-size: 14px; color: var(--muted); }
.cd { display: grid; grid-template-columns: auto 1fr; gap: 10px 12px; align-items: center; }
.cd label { font-size: 14px; color: var(--paper-dim); }
.cd input { min-height: 44px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--line-strong); background: rgba(0,0,0,.3); font-size: 16px; color-scheme: dark; }

/* weather */
.wx { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 4px; }
.wxcard {
  position: relative; display: grid; gap: 2px; text-align: left; min-height: 96px; padding: 12px; border-radius: 16px; overflow: hidden;
  border: 1px solid var(--line); background: var(--sky, #111); color: #fff; transition: border-color .2s, transform .2s var(--ease-out);
}
.wxcard::after { content: ""; position: absolute; inset: 0; background: linear-gradient(0deg, rgba(0,0,0,.55), transparent 70%); }
.wxcard > * { position: relative; z-index: 1; }
.wxcard b { font-weight: 700; font-size: 15px; margin-top: auto; }
.wxcard small { font-size: 12.5px; color: rgba(255,255,255,.85); }
.wxcard svg { width: 22px; height: 22px; fill: none; stroke: #fff; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.wxcard:hover { border-color: var(--line-strong); }
.wxcard:active { transform: scale(.97); }
.wxcard[aria-checked="true"] { border-color: var(--amber); box-shadow: 0 0 0 2px var(--amber) inset; }
.mix__row--solo { margin-top: 12px; border-bottom: 0; }

/* room menu */
.quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 16px; }
.quick__btn { display: grid; justify-items: center; gap: 6px; min-height: 72px; padding: 12px 6px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255,255,255,.03); font-size: 14px; font-weight: 500; }
.quick__btn:hover { border-color: var(--amber); }
.quick__btn svg { width: 22px; height: 22px; fill: none; stroke: var(--amber-hot); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.opts__list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.opt { position: relative; display: grid; justify-items: center; gap: 6px; padding: 10px 6px; min-height: 96px; border-radius: 14px; border: 1px solid var(--line); cursor: pointer; text-align: center; font-size: 13px; }
.opt input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.opt:has(input:checked) { border-color: var(--amber); background: rgba(242,169,80,.08); }
.opt:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.opt svg { width: 48px; height: 40px; fill: none; stroke: var(--paper-dim); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.opt:has(input:checked) svg { stroke: var(--amber-hot); }
.swatches { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.swatch { position: relative; display: grid; justify-items: center; gap: 6px; font-size: 12px; color: var(--paper-dim); cursor: pointer; text-align: center; }
.swatch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.swatch span:first-of-type { width: 44px; height: 44px; border-radius: 50%; background: var(--c); border: 2px solid transparent; box-shadow: inset 0 -6px 12px rgba(0,0,0,.25); }
.swatch:has(input:checked) span:first-of-type { border-color: var(--paper); box-shadow: 0 0 0 3px var(--amber); }
.swatch:has(input:focus-visible) span:first-of-type { outline: 2px solid var(--focus); outline-offset: 4px; }
.backup { margin-top: 12px; padding: 16px; border: 1px solid var(--line); border-radius: var(--r-md); }
.backup p { margin: 4px 0 0; font-size: 14px; color: var(--paper-dim); }
.backup__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

@media (max-width: 720px) {
  .timer { grid-template-areas: "clock top" "clock phase" "clock controls" "row row"; }
  .timer__top { grid-area: top; }
  .timer__cycle { display: none; }
  .timer__row { grid-area: row; justify-self: stretch; }
  .timer__row .chai { flex: 1; justify-content: center; }
  .timer__modes { padding: 3px; gap: 2px; }
  .timer__modes .chip span { display: none; }
  .timer__top { gap: 6px; }
  .timer { grid-template-columns: auto minmax(0, 1fr); }
  body.focus-mode .timer { left: 12px; right: 12px; width: auto; }
  .swatches { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 440px) {
  .brand__name { display: none; }
  .brand__deva { font-size: 22px; }
}


/* ───────────── Round 3 ───────────── */
.timer { position: fixed; }
.gap, .tabbanner {
  position: absolute; inset: 0; z-index: 2; display: grid; place-content: center; justify-items: center; gap: 12px;
  padding: 24px; text-align: center; border-radius: inherit; background: rgba(14, 11, 13, .94);
}
.gap__title { margin: 0; font-family: var(--f-display); font-style: italic; font-size: 26px; color: var(--amber-hot); }
.gap__text { margin: 0; font-size: 15px; color: var(--paper-dim); max-width: 30ch; }
.gap__actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.tabbanner p { margin: 0; font-weight: 500; }
.timer.is-remote .timer__digits { opacity: .55; }
button:disabled { cursor: not-allowed; opacity: .45; }
.pop__share { margin-top: 12px; }
.cdprompt { margin: 0 0 12px; padding: 12px 14px; border-radius: 12px; background: rgba(255,110,90,.1); border: 1px solid rgba(255,110,90,.35); font-size: 14px; }

.live {
  position: fixed; z-index: var(--z-hud); left: 0; top: 0; display: grid; grid-template-columns: auto 1fr; column-gap: 8px; align-items: center;
  padding: 8px 14px 8px 12px; border-radius: 14px; background: rgba(12, 10, 12, .78); border: 1px solid var(--line);
  font-size: 14px; pointer-events: none; will-change: transform; max-width: min(320px, calc(100vw - 24px));
}
.live__dot { width: 9px; height: 9px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 10px var(--amber); }
.live__text b { font-family: var(--f-mono); font-weight: 500; color: var(--amber-hot); }
.live__sub { grid-column: 2; font-size: 12px; color: var(--muted); }
.live__sub:empty { display: none; }
body.focus-mode .live { display: none; }
@media (prefers-reduced-motion: no-preference) { .live__dot { animation: livepulse 2.4s ease-in-out infinite; } }
@keyframes livepulse { 50% { opacity: .45; } }

.scrim { position: fixed; inset: 0; z-index: calc(var(--z-intro) - 2); background: rgba(4, 3, 6, .7); }
.cardmodal {
  position: fixed; z-index: calc(var(--z-intro) - 1); left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(760px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow: auto; padding: 22px;
  background: var(--glass-strong); border: 1px solid var(--line); border-radius: var(--r-lg);
}
.cardmodal h2 { margin: 0; font-family: var(--f-display); font-weight: 400; font-size: 30px; }
.cardmodal__body { display: grid; grid-template-columns: 300px 1fr; gap: 22px; margin-top: 14px; align-items: start; }
.cardmodal__preview { position: relative; aspect-ratio: 9 / 16; border-radius: 16px; overflow: hidden; background: #000; border: 1px solid var(--line); }
.cardmodal__preview img { width: 100%; height: 100%; display: block; }
.cardmodal__busy { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; background: rgba(0,0,0,.5); font-size: 14px; }
.cardmodal__busy[hidden] { display: none; }
.opts__list--cards { grid-template-columns: repeat(3, 1fr); }
.opt--text { min-height: 52px; align-content: center; font-size: 15px; font-weight: 500; }
@media (max-width: 640px) {
  .cardmodal__body { grid-template-columns: 1fr; }
  .cardmodal__preview { width: min(260px, 70vw); justify-self: center; }
}

.credits { margin: 0 0 12px; padding-left: 18px; color: var(--paper-dim); font-size: 15px; }
.credits li { margin: 4px 0; }
.credits a { color: var(--amber-hot); }

/* ───────────── Responsive ───────────── */
@media (max-width: 720px) {
  .brand__name { font-size: 19px; }
  .brand__deva { font-size: 18px; }
  .navbtn { padding: 0 12px; }
  .navbtn span { display: none; }
  .navbtn { width: 44px; justify-content: center; padding: 0; }
  .streak { padding: 0 12px; }
  .streak__unit { display: none; }

  .timer {
    left: 12px; right: 12px; width: auto; bottom: calc(12px + var(--safe-b));
    grid-template-columns: auto 1fr; grid-template-areas: "clock top" "clock phase" "clock controls" "row row";
    justify-items: start; align-items: center; column-gap: 16px; row-gap: 8px; padding: 14px 16px;
  }
  .timer__top { grid-area: top; }
  .chip { min-width: 0; padding: 0 10px; min-height: 36px; }
  .timer__phase { grid-area: phase; margin: 0; }
  .timer__clock { grid-area: clock; width: 116px; height: 116px; }
  .timer__digits { font-size: 26px; }
  .timer__quote { display: none; }
  .timer__controls { grid-area: controls; gap: 8px; }
  .primary { min-width: 96px; min-height: 44px; padding: 0 16px; }
  .timer__row { grid-area: row; justify-self: stretch; }
  .timer__row .chai { flex: 1; justify-content: center; margin: 2px 0 0; }

  .sheet {
    top: auto; left: 0; right: 0; bottom: 0; width: 100%; max-height: 82dvh;
    border-radius: var(--r-lg) var(--r-lg) 0 0; border-bottom: 0; padding-bottom: calc(28px + var(--safe-b));
  }
  .sheet::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 4px; background: var(--line-strong); margin: -8px auto 12px; }
  .pop { right: 12px; }
  .reg { grid-template-columns: 1fr; justify-items: center; text-align: center; }
}
@media (max-width: 380px) {
  .timer { column-gap: 10px; }
  .timer__clock { width: 100px; height: 100px; }
  .timer__digits { font-size: 22px; }
  .chip { padding: 0 8px; font-size: 12px; }
  .primary { min-width: 80px; }
}
@media (max-height: 500px) and (orientation: landscape) {
  .timer { left: auto; right: 12px; width: 300px; grid-template-columns: auto 1fr; }
  .sheet { max-height: 100dvh; top: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 2.4s; }
  *, *::before, *::after { transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
