:root {
  color-scheme: dark;
  --glass: rgba(3, 18, 30, .72);
  --line: rgba(155, 236, 255, .18);
  --text: #dcf8ff;
  --muted: #88b8c4;
  --accent: #64d9e8;
  --bg: #041b2b;
  --ink: #dcf8ff;
  --focus: #9df0fb;
}
* { box-sizing: border-box; }
html, body { width:100%; height:100%; margin:0; overflow:hidden; background:#020b12; }
body {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: var(--text);
  overscroll-behavior:none;
  user-select:none;
}
button, input { font:inherit; }
button { color:inherit; }
:focus-visible { outline:2px solid var(--focus); outline-offset:2px; border-radius:4px; }
input[type="range"]:focus-visible { outline-offset:5px; }
.sr-only {
  position:absolute; width:1px; height:1px; padding:0; margin:-1px;
  overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; border:0;
}
#app { position:fixed; inset:0; background:#03131f; }
canvas {
  position:absolute; inset:0; width:100%; height:100%; display:block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  touch-action:none;
}
.fade-vignette {
  pointer-events:none; position:absolute; inset:0;
  box-shadow: inset 0 0 11vw rgba(0,0,0,.48), inset 0 -10vh 18vh rgba(0,0,0,.22);
}
.chrome {
  transition: opacity .45s ease, transform .45s ease;
}
body.idle .chrome { opacity:0; pointer-events:none; }
body.cursor-hidden { cursor:none; }
body.embed .chrome, body.embed .help, body.embed .fade-vignette { display:none !important; }
#topbar {
  position:fixed; z-index:4; top:max(14px,env(safe-area-inset-top)); left:16px; right:16px;
  display:flex; justify-content:space-between; align-items:center; pointer-events:none;
}
.brand, .actions, .hint, .settings-panel {
  background:linear-gradient(180deg, rgba(7,33,49,.82), rgba(2,17,29,.72));
  border:1px solid var(--line);
  box-shadow:0 14px 50px rgba(0,0,0,.22), inset 0 1px rgba(255,255,255,.04);
  backdrop-filter:blur(12px);
  -webkit-backdrop-filter:blur(12px);
}
.brand {
  display:flex; gap:10px; align-items:center; padding:9px 12px 9px 10px; border-radius:7px;
}
.brand strong { display:block; font-size:11px; letter-spacing:.12em; font-weight:700; }
.brand span:not(.status-dot) { display:block; margin-top:3px; font-size:9px; color:var(--muted); letter-spacing:.08em; }
.status-dot { width:7px; height:7px; border-radius:50%; background:#7cf7d5; box-shadow:0 0 12px #60f0cf; }
.actions { pointer-events:auto; display:flex; padding:4px; gap:3px; border-radius:7px; }
.actions button, .actions .help, .panel-head button {
  border:0; background:transparent; min-width:34px; height:32px; border-radius:4px; cursor:pointer;
  color:#cdeef5; opacity:.8;
}
.actions .help {
  display:flex; align-items:center; justify-content:center;
  font-size:15px; font-weight:700; text-decoration:none;
}
.actions button:hover, .actions .help:hover, .panel-head button:hover { background:rgba(157,236,255,.09); opacity:1; }
.actions button[aria-pressed="true"] { background:rgba(157,236,255,.16); opacity:1; }
.hint {
  position:fixed; z-index:4; left:50%; bottom:max(16px,env(safe-area-inset-bottom)); transform:translateX(-50%);
  border-radius:6px; padding:8px 11px; color:rgba(222,249,255,.76); font-size:9px; letter-spacing:.08em;
  pointer-events:none;
}
body.idle .hint { transform:translateX(-50%) translateY(8px); }
.settings-panel {
  position:fixed; z-index:8; top:68px; right:16px; width:min(310px,calc(100vw - 32px));
  border-radius:9px; padding:16px; transform:translateY(-8px) scale(.98); opacity:0; pointer-events:none;
  visibility:hidden;
  transition:opacity .18s ease, transform .18s ease, visibility 0s linear .18s;
}
.settings-panel.open {
  opacity:1; transform:none; pointer-events:auto; visibility:visible;
  transition:opacity .18s ease, transform .18s ease, visibility 0s;
}
.panel-head { display:flex; justify-content:space-between; gap:20px; align-items:flex-start; margin-bottom:17px; }
.panel-head small { display:block; color:#74d7e8; font-size:9px; letter-spacing:.16em; margin-bottom:4px; }
.panel-head strong { font-size:13px; }
.panel-head button { font-size:20px; min-width:28px; height:28px; }
.settings-panel label { display:block; margin:14px 0; }
.settings-panel label > span { display:flex; justify-content:space-between; color:#b8d8df; font-size:10px; margin-bottom:8px; }
.settings-panel output { color:#fff; }
input[type="range"] { width:100%; accent-color:#64d9e8; }
.switch-row { display:flex !important; justify-content:space-between; align-items:center; gap:15px; }
.switch-row span { margin:0 !important; }
.switch-row input { accent-color:#64d9e8; width:18px; height:18px; }
.wide-button {
  width:100%; margin-top:8px; padding:10px; border-radius:5px; border:1px solid rgba(131,224,239,.22);
  background:rgba(67,181,202,.08); color:#d7f7fb; cursor:pointer; font-size:10px; letter-spacing:.09em;
}
.wide-button:hover { background:rgba(67,181,202,.15); }
.settings-panel p { margin:14px 0 0; color:#9fc3cd; font-size:8px; line-height:1.6; }
@media (max-width:600px) {
  #topbar { left:10px; right:10px; top:10px; }
  .brand span:not(.status-dot) { display:none; }
  .hint { bottom:10px; }
  .settings-panel { right:10px; top:60px; }
}
@media (prefers-reduced-motion:reduce) {
  .chrome, .settings-panel { transition:none; }
}

.clock-legend {
  position:fixed; z-index:4; left:16px; bottom:max(16px,env(safe-area-inset-bottom));
  display:flex; align-items:baseline; gap:10px; padding:8px 11px; border-radius:6px;
  color:rgba(222,249,255,.76); pointer-events:none;
}
.clock-legend strong { color:#f4ffff; font-size:12px; letter-spacing:.14em; }
.clock-legend span { color:#93bfc9; font-size:8px; letter-spacing:.06em; }
body.idle .clock-legend { transform:translateY(8px); }
@media (max-width:700px) {
  .clock-legend { left:10px; bottom:42px; }
  .clock-legend span { display:none; }
}
