/* ───────────── Themes ───────────── */
:root {
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --serif: 'Instrument Serif', Georgia, serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
}
body[data-theme="aurora"] {
  --bg: #07070d; --bg2: #11112a; --ink: #eef0ff; --muted: #8a8fb0; --faint: #34374f;
  --line: rgba(255,255,255,.08); --surface: rgba(255,255,255,.04); --surface2: rgba(255,255,255,.08);
  --accent: #8b7bff; --accent2: #3de0d0; --on-accent: #0a0a14; --alert: #ff4d6d;
  --b1: #6c4dff; --b2: #00c2b8; --b3: #ff4fa0; --blob-op: .32;
  --track: rgba(255,255,255,.07); --head: #fff;
  --card-top: #1d1d30; --card-bot: #171726; --card-ink: #f2f2ff;
  --lcd-bg: rgba(0,0,0,.35); --seg-on: #3de0d0; --seg-glow: rgba(61,224,208,.55);
  --dial: rgba(255,255,255,.03); --drawer: rgba(12,12,22,.9);
  color-scheme: dark;
}
body[data-theme="ember"] {
  --bg: #0c0604; --bg2: #2a0e06; --ink: #fff1e8; --muted: #b58d7c; --faint: #4a2d22;
  --line: rgba(255,220,200,.09); --surface: rgba(255,230,210,.04); --surface2: rgba(255,230,210,.08);
  --accent: #ff6a2b; --accent2: #ffc34d; --on-accent: #1a0a02; --alert: #ff3b3b;
  --b1: #ff3d1f; --b2: #ff9f1c; --b3: #9a1c4a; --blob-op: .3;
  --track: rgba(255,220,200,.07); --head: #fff4e0;
  --card-top: #2a1810; --card-bot: #21120c; --card-ink: #ffe9d8;
  --lcd-bg: rgba(0,0,0,.4); --seg-on: #ff8a3d; --seg-glow: rgba(255,120,40,.6);
  --dial: rgba(255,230,210,.03); --drawer: rgba(20,10,6,.92);
  color-scheme: dark;
}
body[data-theme="glacier"] {
  --bg: #040a12; --bg2: #0a1d33; --ink: #eaf6ff; --muted: #7f9ab0; --faint: #22384c;
  --line: rgba(200,235,255,.09); --surface: rgba(200,235,255,.04); --surface2: rgba(200,235,255,.08);
  --accent: #4cb8ff; --accent2: #b9f3ff; --on-accent: #03101c; --alert: #ff5c7a;
  --b1: #1f6fff; --b2: #00d0ff; --b3: #6a5cff; --blob-op: .3;
  --track: rgba(200,235,255,.07); --head: #fff;
  --card-top: #12233a; --card-bot: #0e1c2f; --card-ink: #e6f5ff;
  --lcd-bg: rgba(0,0,0,.35); --seg-on: #8fe3ff; --seg-glow: rgba(120,220,255,.55);
  --dial: rgba(200,235,255,.03); --drawer: rgba(6,14,24,.92);
  color-scheme: dark;
}
body[data-theme="verdant"] {
  --bg: #030d08; --bg2: #06261a; --ink: #eafff3; --muted: #7fa894; --faint: #1f3d30;
  --line: rgba(200,255,225,.09); --surface: rgba(200,255,225,.04); --surface2: rgba(200,255,225,.08);
  --accent: #2ff59a; --accent2: #d4ff5c; --on-accent: #02140b; --alert: #ff5c5c;
  --b1: #00b36b; --b2: #7cff4d; --b3: #008a8a; --blob-op: .24;
  --track: rgba(200,255,225,.07); --head: #f4fff0;
  --card-top: #10261c; --card-bot: #0c1f16; --card-ink: #e3ffef;
  --lcd-bg: rgba(0,0,0,.4); --seg-on: #5cff9d; --seg-glow: rgba(60,255,150,.55);
  --dial: rgba(200,255,225,.03); --drawer: rgba(4,16,10,.92);
  color-scheme: dark;
}
body[data-theme="mono"] {
  --bg: #080808; --bg2: #1a1a1a; --ink: #f5f5f5; --muted: #8a8a8a; --faint: #333;
  --line: rgba(255,255,255,.09); --surface: rgba(255,255,255,.04); --surface2: rgba(255,255,255,.08);
  --accent: #ffffff; --accent2: #9a9a9a; --on-accent: #000; --alert: #ff4d4d;
  --b1: #3a3a3a; --b2: #262626; --b3: #4a4a4a; --blob-op: .5;
  --track: rgba(255,255,255,.07); --head: #fff;
  --card-top: #1c1c1c; --card-bot: #161616; --card-ink: #f5f5f5;
  --lcd-bg: rgba(0,0,0,.45); --seg-on: #f0f0f0; --seg-glow: rgba(255,255,255,.35);
  --dial: rgba(255,255,255,.02); --drawer: rgba(12,12,12,.94);
  color-scheme: dark;
}
body[data-theme="paper"] {
  --bg: #e9e3d4; --bg2: #f3efe4; --ink: #2e2a20; --muted: #8a8270; --faint: #cfc6b0;
  --line: rgba(46,42,32,.12); --surface: rgba(255,255,255,.35); --surface2: rgba(255,255,255,.65);
  --accent: #6b7248; --accent2: #a0714a; --on-accent: #fbf8f0; --alert: #b0453a;
  --b1: #d8c9a6; --b2: #c9d0b0; --b3: #e3c2a8; --blob-op: .6;
  --track: rgba(46,42,32,.08); --head: #2e2a20;
  --card-top: #f7f3ea; --card-bot: #efe9da; --card-ink: #2e2a20;
  --lcd-bg: #c9ceb2; --seg-on: #23261c; --seg-glow: rgba(0,0,0,0);
  --dial: #f3efe4; --drawer: rgba(243,239,228,.95);
  color-scheme: light;
}
body.urgent, body.alerting { --accent: var(--alert); --accent2: #ff9f7a; --seg-on: var(--alert); --seg-glow: rgba(255,77,109,.55); }

/* ───────────── Base ───────────── */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font); color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
  transition: background .6s var(--ease), color .4s;
  font-variant-numeric: tabular-nums;
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
kbd { font: 500 11px var(--font); padding: 1px 6px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; margin-right: 3px; }

.bg { position: fixed; inset: 0; overflow: hidden; z-index: 0;
  background: radial-gradient(120% 80% at 50% 0%, var(--bg2), var(--bg) 70%); transition: background .6s; }
.blob { position: absolute; width: 60vmax; height: 60vmax; border-radius: 50%; filter: blur(90px);
  opacity: var(--blob-op); mix-blend-mode: screen; transition: background 1s; }
body[data-theme="paper"] .blob { mix-blend-mode: multiply; }
.b1 { background: var(--b1); top: -25vmax; left: -15vmax; animation: drift1 28s ease-in-out infinite alternate; }
.b2 { background: var(--b2); bottom: -30vmax; right: -20vmax; animation: drift2 34s ease-in-out infinite alternate; }
.b3 { background: var(--b3); top: 30%; left: 40%; width: 40vmax; height: 40vmax; opacity: calc(var(--blob-op) * .6); animation: drift3 40s ease-in-out infinite alternate; }
@keyframes drift1 { to { transform: translate(20vmax, 15vmax) scale(1.15); } }
@keyframes drift2 { to { transform: translate(-18vmax, -12vmax) scale(.9); } }
@keyframes drift3 { to { transform: translate(-25vmax, 10vmax) scale(1.2); } }
.grain { position: absolute; inset: 0; opacity: .07; pointer-events: none;
  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='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }

.app { position: relative; z-index: 1; height: 100dvh; min-height: 560px; display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto; }

/* ───────────── Header ───────────── */
.top { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; padding: 18px 24px; transition: opacity .5s; }
.brand { display: flex; align-items: center; gap: 9px; font: 400 26px/1 var(--serif); letter-spacing: 0; }
.modes { position: relative; display: flex; padding: 4px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); backdrop-filter: blur(14px); }
.modes button { position: relative; z-index: 1; padding: 9px 20px; border-radius: 999px; font-size: 14px; font-weight: 500; color: var(--muted); transition: color .3s; }
.modes button.active { color: var(--ink); }
.modes-ind { position: absolute; top: 4px; bottom: 4px; left: 0; border-radius: 999px; background: var(--surface2);
  box-shadow: inset 0 0 0 1px var(--line); transition: transform .45s var(--ease), width .45s var(--ease); }
.tools { display: flex; gap: 8px; justify-content: flex-end; align-items: center; }
.icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line); color: var(--ink); transition: background .2s, transform .15s; }
.icon:hover { background: var(--surface2); }
.icon:active { transform: scale(.94); }
.face-pill { display: flex; align-items: center; height: 40px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.face-pill button { width: 34px; height: 100%; font-size: 20px; color: var(--muted); }
.face-pill button:hover { color: var(--ink); }
.face-pill span { min-width: 70px; text-align: center; font-size: 13px; font-weight: 500; letter-spacing: .04em; }

/* ───────────── Stage ───────────── */
.stage { display: flex; flex-direction: column; min-height: 0; padding: 0 16px; }
.fit-area { flex: 1; position: relative; display: grid; place-items: center; overflow: hidden; min-height: 200px; }
.fit { position: absolute; left: 50%; top: 50%; transform-origin: center; }
.fit.enter > * { animation: faceIn .6s var(--ease) both; }
@keyframes faceIn { from { opacity: 0; transform: scale(.94); filter: blur(10px); } }
body.alerting .fit > * { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .55; } }
.caption { text-align: center; color: var(--muted); min-height: 26px; padding: 6px 0 4px; display: flex; gap: 12px; justify-content: center; align-items: baseline; font-size: 13.5px; }
.caption #capLabel { font: italic 400 21px var(--serif); color: var(--ink); }
.caption #capSub { font-variant-numeric: tabular-nums; }
.caption.hidden { visibility: hidden; }
.fit.colon-dim .colon { opacity: .15; }
.colon { transition: opacity .25s; }

/* ───────────── Dock / controls ───────────── */
.dock { padding: 8px 16px 18px; }
.panel { display: none; flex-direction: column; align-items: center; gap: 18px; animation: faceIn .5s var(--ease); }
.panel.active { display: flex; }
.controls { display: flex; align-items: center; justify-content: center; gap: 14px; min-height: 72px; }
.btn { height: 54px; min-width: 54px; padding: 0 22px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--surface2); border: 1px solid var(--line); font-weight: 500; font-size: 15px; backdrop-filter: blur(12px);
  transition: transform .15s var(--ease), background .2s, box-shadow .3s; animation: faceIn .4s var(--ease) both; }
.btn:hover { background: color-mix(in srgb, var(--surface2), var(--ink) 6%); }
.btn:active { transform: scale(.95); }
.btn.primary { height: 66px; padding: 0 36px; font-size: 17px; font-weight: 600; color: var(--on-accent); border: 0;
  background: var(--ink); color: var(--bg); box-shadow: 0 10px 30px -14px rgba(0,0,0,.6); }
.btn.primary:hover { background: color-mix(in srgb, var(--ink), var(--bg) 12%); }
body.alerting .btn.primary { background: var(--alert); color: #fff; }
.btn svg { width: 18px; height: 18px; }
.btn:disabled { opacity: .4; pointer-events: none; }

.setter { display: flex; flex-direction: column; align-items: center; gap: 14px; transition: opacity .3s, max-height .4s; }
.setter.hide { display: none; }
.spins { display: flex; align-items: center; gap: 6px; }
.spin { display: grid; justify-items: center; gap: 2px; }
.spin input { width: 2.1ch; font: 300 40px/1 var(--font); text-align: center; background: transparent; border: 0; color: var(--ink); outline: none; border-radius: 8px; font-variant-numeric: tabular-nums; }
.spin input:focus { background: var(--surface2); }
.spin button { width: 30px; height: 22px; border-radius: 8px; color: var(--muted); font-size: 16px; line-height: 1; }
.spin button:hover { color: var(--ink); background: var(--surface); }
.spin label { font-size: 12px; color: var(--muted); }
.spin-colon { font: 200 34px var(--font); color: var(--muted); margin-top: -18px; }
.presets, .quick { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; max-width: 620px; }
.chip { padding: 8px 14px; border-radius: 999px; font-size: 13px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); transition: all .2s; }
.chip:hover { background: var(--surface2); }
.chip.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.laps { width: min(560px, 100%); max-height: 26vh; overflow-y: auto; display: flex; flex-direction: column; }
.laps:empty { display: none; }
.lap { display: grid; grid-template-columns: 70px 1fr 110px 110px; align-items: center; gap: 12px; padding: 9px 4px; border-bottom: 1px solid var(--line); font-size: 15px; animation: faceIn .4s var(--ease); }
.lap .n { font-size: 13px; color: var(--muted); }
.lap .bar { height: 4px; border-radius: 4px; background: var(--track); overflow: hidden; }
.lap .bar i { display: block; height: 100%; border-radius: 4px; background: var(--ink); opacity: .55; transition: width .3s; }
.lap .t { text-align: right; }
.lap .tot { text-align: right; color: var(--muted); }
.lap.best .n { color: #34d399; } .lap.best .bar i { background: #34d399; opacity: 1; }
.lap.worst .n { color: var(--alert); } .lap.worst .bar i { background: var(--alert); opacity: 1; }
.lap.live { opacity: .7; }

.world { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.city { min-width: 150px; padding: 14px 18px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); backdrop-filter: blur(12px); }
.city .nm { font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; }
.city .tm { font-size: 28px; font-weight: 300; margin: 4px 0 2px; }
.city .tm small { font-size: 12px; color: var(--muted); margin-left: 4px; }
.city .mt { font-size: 12px; color: var(--muted); }

.hints { display: flex; flex-wrap: wrap; gap: 18px; justify-content: center; padding: 0 16px 16px; font-size: 12px; color: var(--muted); transition: opacity .5s; }
.hints button { color: var(--muted); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line); font-size: 12px; }
.hints button:hover { color: var(--ink); }

/* Life */
.life-years { display: grid; grid-template-columns: repeat(40, 1fr); gap: 5px; width: min(640px, 100%); }
.life-years i { aspect-ratio: 1; border-radius: 3px; background: var(--track); box-shadow: inset 0 0 0 1px var(--line); }
.life-years i.lived { background: var(--ink); box-shadow: none; opacity: .75; }
.life-years i.now { background: linear-gradient(90deg, var(--accent) var(--p), var(--track) var(--p)); box-shadow: 0 0 0 1.5px var(--accent); }
.life-cap { font-size: 12.5px; color: var(--muted); margin-top: -6px; }
.life-stats { display: grid; grid-template-columns: repeat(6, auto); gap: 10px; justify-content: center; }
.stat { padding: 10px 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); backdrop-filter: blur(12px); text-align: center; min-width: 110px; }
.stat b { display: block; font-size: 21px; font-weight: 300; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--muted); }
@media (max-width: 760px) { .life-stats { grid-template-columns: repeat(3, 1fr); } .life-years { gap: 3px; } .stat { min-width: 0; padding: 8px; } .stat b { font-size: 16px; } }

/* Hide chrome while idle in fullscreen */
body.idle .top, body.idle .dock, body.idle .hints { opacity: 0; pointer-events: none; }
body.idle { cursor: none; }

/* ───────────── Drawer ───────────── */
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.4); opacity: 0; pointer-events: none; transition: opacity .35s; z-index: 10; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 100vw); z-index: 11; display: flex; flex-direction: column;
  background: var(--drawer); backdrop-filter: blur(28px) saturate(1.3); border-left: 1px solid var(--line);
  box-shadow: -30px 0 80px -20px rgba(0,0,0,.45); transform: translateX(105%); transition: transform .5s var(--ease); }
body.drawer-open .drawer { transform: none; }
body.drawer-open .scrim { opacity: 1; pointer-events: auto; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 22px 24px 16px; border-bottom: 1px solid var(--line); }
.drawer h2 { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -.01em; }
.drawer-sub { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.drawer-body { flex: 1; overflow-y: auto; padding: 6px 24px 28px; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.set-sec { margin-top: 30px; }
body.drawer-open .set-sec { animation: secIn .5s var(--ease) both; animation-delay: calc(var(--i) * 40ms + 60ms); }
@keyframes secIn { from { opacity: 0; transform: translateY(8px); } }
.drawer h2, .sec-head h3 { font-family: var(--serif); font-weight: 400; letter-spacing: 0; }
.drawer h2 { font-size: 30px; line-height: 1; }
.sec-head { margin-bottom: 14px; }
.sec-head h3 { margin: 0; font-size: 23px; line-height: 1.1; }
.sec-head p { margin: 3px 0 0; font-size: 12.5px; color: var(--muted); }
.sub-head { display: flex; justify-content: space-between; align-items: baseline; margin: 18px 2px 10px; font-size: 13px; font-weight: 500; }
.sub-head span:last-child { font-size: 12px; font-weight: 400; color: var(--muted); }

.group { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 12px 14px; font-size: 14px; }
.group .row + .row { border-top: 1px solid var(--line); }
label.row { cursor: pointer; }
.lbl { display: flex; flex-direction: column; gap: 2px; }
.lbl small { font-size: 12px; color: var(--muted); }
.note { font-size: 12px; color: var(--muted); margin: 10px 4px 0; line-height: 1.5; }
.note b { color: var(--ink); font-weight: 500; }

.seg-ctl { position: relative; display: flex; background: var(--track); border: 1px solid var(--line); border-radius: 10px; padding: 3px; flex-shrink: 0; }
.seg-ctl button { flex: 1; padding: 6px 11px; border-radius: 7px; font-size: 12.5px; color: var(--muted); transition: background .2s, color .2s, box-shadow .2s; white-space: nowrap; }
.seg-ctl button:hover { color: var(--ink); }
.seg-ctl button.active { background: var(--surface2); color: var(--ink); box-shadow: 0 1px 6px -2px rgba(0,0,0,.35), inset 0 0 0 1px var(--line); }
.seg-ctl.wide { margin-bottom: 12px; }

.face-grid, .theme-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.face-opt, .theme-opt { padding: 0; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: var(--surface); text-align: left; transition: border-color .2s, box-shadow .2s; }
.face-opt:hover, .theme-opt:hover { border-color: color-mix(in srgb, var(--ink) 30%, transparent); }
.face-opt.active, .theme-opt.active { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink) inset; }
.face-prev { display: block; position: relative; height: 66px; overflow: hidden; background: color-mix(in srgb, var(--bg) 70%, transparent); pointer-events: none; }
.face-prev > .fp { position: absolute; left: 50%; top: 50%; transform-origin: center; }
.face-prev .fp * { animation: none !important; transition: none !important; }
.face-opt .tname, .theme-opt .tname { display: block; padding: 7px 10px; font-size: 12.5px; }
.face-opt.active .tname, .theme-opt.active .tname { font-weight: 600; }
.theme-prev { display: block; position: relative; height: 62px; }
.theme-prev svg { position: absolute; inset: 0; width: 100%; height: 100%; }

.switch { appearance: none; flex-shrink: 0; width: 42px; height: 24px; border-radius: 999px; background: var(--track); border: 1px solid var(--line); position: relative; cursor: pointer; transition: background .2s, border-color .2s; }
.switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--muted); transition: transform .25s var(--ease), background .2s; }
.switch:checked { background: var(--ink); border-color: var(--ink); }
.switch:checked::after { transform: translateX(18px); background: var(--bg); }

.vol-row { gap: 12px; }
.vol-ico { width: 20px; height: 20px; color: var(--muted); flex-shrink: 0; }
.vol-val { font: 12px var(--font); font-variant-numeric: tabular-nums; color: var(--muted); width: 36px; text-align: right; }
.range { -webkit-appearance: none; appearance: none; flex: 1; height: 4px; border-radius: 4px; cursor: pointer;
  background: linear-gradient(var(--ink), var(--ink)) 0 / var(--v, 50%) 100% no-repeat, var(--track); }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--ink); border: 3px solid var(--bg); box-shadow: 0 0 0 1px var(--ink); }
.range::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--ink); border: 3px solid var(--bg); }
.icon.sm { width: 32px; height: 32px; border-radius: 10px; flex-shrink: 0; }

.city-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.city-chip { padding: 6px 12px; border-radius: 999px; font-size: 12.5px; background: transparent; border: 1px solid var(--line); color: var(--muted); transition: background .15s, color .15s, border-color .15s; }
.city-chip:hover { color: var(--ink); border-color: color-mix(in srgb, var(--ink) 30%, transparent); }
.city-chip.on { color: var(--bg); background: var(--ink); border-color: var(--ink); }

.field { font: inherit; font-size: 13px; color: var(--ink); background: var(--track); border: 1px solid var(--line); border-radius: 9px; padding: 7px 10px; outline: none; transition: border-color .2s; }
.field:focus { border-color: var(--accent); }
.stepper { display: flex; align-items: center; background: var(--track); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.stepper button { width: 34px; height: 34px; font-size: 18px; color: var(--muted); transition: background .2s, color .2s; }
.stepper button:hover { background: var(--surface2); color: var(--ink); }
.stepper input { width: 44px; text-align: center; font: 500 15px var(--font); color: var(--ink); background: none; border: 0; outline: none; font-variant-numeric: tabular-nums; }
.presets-row { justify-content: flex-start; gap: 6px; padding-top: 10px; }
.presets-row .chip { padding: 5px 12px; font-size: 12px; background: transparent; }
.presets-row .chip.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.keys { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; font-size: 13px; color: var(--muted); }
.keys div { display: flex; align-items: center; gap: 4px; }
.keys kbd { color: var(--ink); background: var(--surface); min-width: 22px; text-align: center; }
.keys div kbd:last-of-type { margin-right: 8px; }
.drawer-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 30px; padding-top: 18px; border-top: 1px solid var(--line); font-size: 12px; }
.drawer-foot a { color: var(--muted); text-decoration: none; }
.drawer-foot a:hover { color: var(--ink); }
.danger { padding: 8px 14px; border-radius: 10px; font-size: 12.5px; color: var(--alert); border: 1px solid color-mix(in srgb, var(--alert) 40%, transparent); transition: background .2s, color .2s; }
.danger:hover, .danger.armed { background: var(--alert); color: #fff; }

/* ───────────── Face: Halo ───────────── */
.halo { position: relative; width: 560px; height: 560px; }
.halo-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.halo .tick { stroke: var(--faint); stroke-width: 2; stroke-linecap: round; transition: stroke .3s; }
.halo .tick.major { stroke-width: 3; }
.halo .tick.lit { stroke: var(--ink); }
.halo .prog { transition: opacity .3s; }
.halo-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.halo-label { font: italic 400 24px var(--serif); color: var(--muted); margin-bottom: 4px; }
.halo-digits { display: flex; align-items: baseline; font-weight: 200; line-height: 1; letter-spacing: -.01em; transition: color .4s; }
.halo-sub { font-size: 14px; color: var(--muted); margin-top: 12px; min-height: 18px; }
.g { display: inline-block; width: .6em; text-align: center; }
.sep { display: inline-block; width: .3em; text-align: center; }
.halo .sep { position: relative; top: -.07em; }
.fit .sep.plus { width: .55em; }
body.alerting .halo-digits, body.alerting .roll-row, body.urgent .halo-digits, body.urgent .roll-row { color: var(--alert); }
.frac { font-size: .34em; color: var(--accent2); margin-left: .12em; font-weight: 300; }
.frac .g { width: .62em; }
.sfx { font: 500 .15em var(--font); color: var(--muted); margin-left: .5em; letter-spacing: .04em; align-self: flex-start; margin-top: .6em; }

/* ───────────── Face: Flip ───────────── */
.flip-face { display: flex; align-items: center; font-size: 150px; font-weight: 600; color: var(--card-ink); }
.flip-row { display: flex; gap: .05em; align-items: center; }
.card { position: relative; width: .72em; height: 1.1em; perspective: 500px; border-radius: .08em; box-shadow: 0 .12em .3em -.08em rgba(0,0,0,.5); }
.card .half { position: absolute; left: 0; right: 0; height: 50%; overflow: hidden; }
.card .flap { backface-visibility: hidden; }
.card .top { top: 0; border-radius: .08em .08em 0 0; background: linear-gradient(var(--card-top), color-mix(in srgb, var(--card-top), var(--card-bot) 50%)); }
.card .bot { bottom: 0; border-radius: 0 0 .08em .08em; background: linear-gradient(var(--card-bot), color-mix(in srgb, var(--card-bot), #000 10%)); }
.card .half span { position: absolute; left: 0; right: 0; height: 200%; display: flex; align-items: center; justify-content: center; line-height: 1; }
.card .top span { top: 0; }
.card .bot span { bottom: 0; }
.card::after { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: .012em; min-height: 1px; background: rgba(0,0,0,.45); z-index: 5; }
.flap { z-index: 3; }
.flap.top { transform-origin: 50% 100%; animation: flipTop .26s ease-in both; }
.flap.bot { transform-origin: 50% 0; animation: flipBot .26s ease-out .26s both; }
@keyframes flipTop { from { transform: rotateX(0); filter: brightness(1); } to { transform: rotateX(-90deg); filter: brightness(.55); } }
@keyframes flipBot { from { transform: rotateX(90deg); filter: brightness(1.4); } to { transform: rotateX(0); filter: brightness(1); } }
.flip-sep { width: .28em; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .26em; }
.flip-sep i { width: .09em; height: .09em; border-radius: 50%; background: var(--muted); }
.flip-sep b { font-weight: 300; font-size: .6em; color: var(--muted); }
.flip-extra { display: flex; flex-direction: column; justify-content: space-between; align-self: stretch; margin-left: .12em; font-size: .24em; }
.flip-extra .sfx { font-size: .6em; margin: .4em 0 0; }
.flip-extra .frac { font-size: 1em; margin: 0 0 .1em; color: var(--muted); font-weight: 500; }

/* ───────────── Face: Segment ───────────── */
.seg-face { position: relative; display: flex; align-items: flex-end; gap: 22px; padding: 56px 60px 44px; border-radius: 28px;
  background: var(--lcd-bg); border: 1px solid var(--line); box-shadow: inset 0 2px 20px rgba(0,0,0,.35), 0 30px 80px -30px rgba(0,0,0,.5); }
.seg-tag { position: absolute; top: 18px; left: 26px; font: 500 11px var(--mono); letter-spacing: .3em; color: var(--seg-on); opacity: .6; }
.seg-row { display: flex; gap: 14px; align-items: flex-end; transform: skewX(-7deg); filter: drop-shadow(0 0 8px var(--seg-glow)); }
.seg-digit { width: 84px; height: 140px; overflow: visible; }
.seg-sepsvg { width: 26px; height: 140px; overflow: visible; }
.seg-row.small .seg-digit { width: 40px; height: 66px; }
.seg-row.small .seg-sepsvg { height: 66px; width: 14px; }
.seg-row.small { gap: 8px; }
.seg { fill: var(--seg-on); opacity: .07; transition: opacity .06s; }
.seg.on { opacity: 1; }
.seg-side { display: flex; flex-direction: column; justify-content: space-between; align-self: stretch; gap: 8px; }
.seg-side .sfx { font-size: 16px; color: var(--seg-on); margin: 0; }

/* ───────────── Face: Nixie ───────────── */
.nixie-face { display: flex; align-items: flex-end; gap: 14px; padding: 30px 34px 28px; border-radius: 24px;
  background: linear-gradient(#1c1510, #0b0806); border: 1px solid rgba(255,200,150,.08);
  box-shadow: 0 40px 90px -30px rgba(0,0,0,.8), inset 0 1px 0 rgba(255,255,255,.06); }
.nixie-row { display: flex; gap: 12px; align-items: flex-end; }
.tube { position: relative; width: 92px; height: 152px; border-radius: 46px 46px 14px 14px; overflow: hidden;
  background: radial-gradient(ellipse at 50% 55%, rgba(255,120,40,.12), rgba(20,12,8,.7) 70%);
  border: 1px solid rgba(255,220,180,.16); box-shadow: inset 0 0 20px rgba(0,0,0,.6); }
.cath { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding-top: 6px;
  font: 300 108px/1 var(--font); color: transparent; -webkit-text-stroke: 1px rgba(255,190,130,.12); transition: color .15s, text-shadow .15s; }
.cath.lit { color: #ffd5a8; -webkit-text-stroke: 1px #ffe6c8; z-index: 2;
  text-shadow: 0 0 3px #ff9a3c, 0 0 10px #ff7a1c, 0 0 24px #ff5a00, 0 0 48px rgba(255,80,0,.7); }
.tube .mesh { position: absolute; inset: 0; z-index: 3; pointer-events: none;
  background-image: radial-gradient(rgba(255,230,200,.07) 1px, transparent 1.4px); background-size: 6px 6px; }
.tube .shine { position: absolute; top: 10px; left: 13px; width: 12px; height: 65%; border-radius: 10px; z-index: 4;
  background: linear-gradient(rgba(255,255,255,.25), rgba(255,255,255,0)); }
.tube::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 12px; background: linear-gradient(transparent, rgba(0,0,0,.7)); z-index: 4; }
.nixie-sep { height: 152px; width: 18px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 34px; }
.nixie-sep i { width: 13px; height: 13px; border-radius: 50%; background: #ffc890; box-shadow: 0 0 8px #ff8a2c, 0 0 22px #ff5a00; }
.nixie-sep b { font: 300 60px var(--font); color: #ffd5a8; text-shadow: 0 0 12px #ff6a00; }
.nixie-row.small .tube { width: 52px; height: 86px; border-radius: 26px 26px 10px 10px; }
.nixie-row.small .cath { font-size: 60px; }
.nixie-row.small .shine { left: 8px; width: 8px; }
.nixie-side { display: flex; flex-direction: column; justify-content: space-between; align-self: stretch; gap: 10px; }
.nixie-side .sfx { color: #ffb070; font-size: 14px; margin: 0; text-shadow: 0 0 10px #ff6a00; }

/* ───────────── Face: Analog ───────────── */
.analog-wrap { width: 540px; height: 540px; }
.analog { width: 540px; height: 540px; overflow: visible; display: block; }
.analog .readbox { fill: var(--bg); opacity: .6; }
.analog .rim { fill: var(--dial); stroke: var(--line); stroke-width: 2; }
.analog .tk { stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.analog .tk.major { stroke: var(--ink); stroke-width: 4; }
.analog .num { fill: var(--ink); font: 300 30px var(--font); text-anchor: middle; dominant-baseline: central; }
.analog .hand { stroke: var(--ink); stroke-linecap: round; }
.analog .hand.acc { stroke: var(--accent); }
.analog .cap { fill: var(--ink); }
.analog .cap.acc { fill: var(--accent); }
.analog .readout { fill: var(--ink); font: 300 34px var(--font); text-anchor: middle; font-variant-numeric: tabular-nums; }
.analog .small-lbl { fill: var(--muted); font: italic 400 22px var(--serif); text-anchor: middle; }
.analog .small-lbl.tiny { font: 500 10px var(--font); letter-spacing: .02em; font-style: normal; }
.analog .sub { fill: none; stroke: var(--line); stroke-width: 1.5; }
.analog .datebox { fill: var(--surface2); stroke: var(--line); }
.analog .datetxt { fill: var(--ink); font: 600 13px var(--font); text-anchor: middle; dominant-baseline: central; letter-spacing: .08em; }

/* ───────────── Face: Roll ───────────── */
.roll-face { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.roll-row { display: flex; align-items: baseline; font-weight: 100; font-size: 220px; line-height: 1; letter-spacing: -.02em; transition: color .4s; }
.roll { height: 1em; width: .6em; overflow: hidden; position: relative;
  -webkit-mask-image: linear-gradient(transparent, #000 16%, #000 84%, transparent); mask-image: linear-gradient(transparent, #000 16%, #000 84%, transparent); }
.strip { transition: transform .7s cubic-bezier(.3, 1.35, .45, 1); }
.strip span { display: block; height: 1em; text-align: center; }
.roll-row .sep { width: .28em; position: relative; top: -.06em; font-weight: 100; }
.roll-row .frac-wrap { display: flex; font-size: .3em; color: var(--accent2); font-weight: 200; margin-left: .15em; }
.roll-row .frac-wrap .strip { transition: none; }
.roll-row .sfx { font-size: .1em; }
.roll-bar { width: 100%; height: 2px; background: var(--track); border-radius: 2px; overflow: hidden; }
.roll-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); transform-origin: left; }

/* ───────────── Responsive ───────────── */
@media (max-width: 760px) {
  .top { grid-template-columns: 1fr auto; padding: 14px 16px; }
  .modes { grid-column: 1 / -1; grid-row: 2; justify-self: center; }
  .brand span { display: none; }
  .modes button { padding: 8px 14px; }
  .hints { display: none; }
  .lap { grid-template-columns: 54px 1fr 90px 90px; font-size: 14px; }
  .btn { height: 50px; padding: 0 18px; }
  .btn.primary { height: 60px; padding: 0 28px; }
  .city { min-width: 140px; }
}
@media (prefers-reduced-motion: reduce) {
  .blob { animation: none; }
  .strip, .fit { transition: none; }
}
