/* single dark look (night simulation): colours set explicitly, form controls dark */
:root {
  color-scheme: dark;
  --panel: rgba(10, 12, 18, 0.74);
  --line: rgba(255, 255, 255, 0.12);
  --text: #e9edf3;
  --muted: #9aa4b2;
  --accent: #ffb347;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;
  --title: 'Bebas Neue', Impact, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #05070b; color: var(--text); font: 12px/1.45 var(--mono); overflow: hidden; }
#viewport, #viewport canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
button, select, input { font: inherit; color: inherit; }
button:focus-visible, select:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1 { font: 400 34px/0.95 var(--title); letter-spacing: 0.03em; margin: 0; text-transform: uppercase; }
h2 { font: 700 10px/1 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin: 0 0 6px; }

.top { position: fixed; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; gap: 16px; pointer-events: none;
  padding: calc(14px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 14px max(16px, env(safe-area-inset-left, 0px));
  background: linear-gradient(rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0)); }
.brand p { margin: 4px 0 0; color: var(--muted); }
.readout { text-align: right; }
.clock { font: 400 40px/1 var(--title); letter-spacing: 0.04em; color: var(--accent); }
.shot { color: var(--accent); min-height: 1.4em; }

.panel { position: fixed; right: calc(12px + env(safe-area-inset-right, 0px)); top: calc(112px + env(safe-area-inset-top, 0px)); width: 268px; max-height: calc(100% - 210px); overflow: auto; background: var(--panel);
  border: 1px solid var(--line); border-radius: 10px; backdrop-filter: blur(8px); }
.panel summary { cursor: pointer; padding: 10px 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.panel section { padding: 10px 12px; border-top: 1px solid var(--line); }
.row { display: flex; gap: 6px; flex-wrap: wrap; }
button { background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; cursor: pointer; }
button:hover { border-color: rgba(255, 255, 255, 0.35); }
button.on { background: rgba(255, 179, 71, 0.18); border-color: var(--accent); color: #fff; }
button.rec { background: #c62828; border-color: #ff6b6b; }
select { width: 100%; margin-top: 8px; background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line); border-radius: 6px; padding: 6px; }
select option { background: #111; }
label { display: block; margin: 6px 0; }
label output { float: right; color: var(--accent); }
input[type=range] { width: 100%; accent-color: var(--accent); }
.hint { color: var(--muted); margin: 8px 0 0; }
.stats { color: var(--muted); white-space: pre; font-size: 11px; }
.credits { color: var(--muted); font-size: 10px; }

.timebar { position: fixed; left: max(16px, env(safe-area-inset-left, 0px)); right: calc(296px + env(safe-area-inset-right, 0px)); bottom: calc(14px + env(safe-area-inset-bottom, 0px)); padding: 10px 14px 8px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; backdrop-filter: blur(8px); }
.presets { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.presets button { padding: 4px 8px; }
.ticks { display: flex; justify-content: space-between; color: var(--muted); font-size: 10px; }
#time { margin: 2px 0; }

body.nohud .top, body.nohud .panel, body.nohud .timebar { display: none; }
body.nohud::after { content: 'H: show HUD'; position: fixed; left: 12px; bottom: 10px; color: rgba(255, 255, 255, 0.35); font-size: 10px; }

#loading { position: fixed; inset: 0; display: grid; place-items: center; background: #05070b; transition: opacity 0.6s; z-index: 10; }
#loading.done { opacity: 0; pointer-events: none; }
.loadbox { width: min(420px, 86vw); }
.loadbox p { color: var(--muted); margin: 10px 0; }
.bar { height: 3px; background: rgba(255, 255, 255, 0.1); }
#loadfill { height: 100%; width: 0; background: var(--accent); transition: width 0.3s; }

@media (max-width: 760px) {
  h1 { font-size: 26px; }
  .clock { font-size: 30px; }
  .brand p, #lightline { display: none; }
  .panel { top: auto; bottom: 120px; right: 16px; left: 16px; width: auto; max-height: 45%; }
  .panel details:not([open]) { width: auto; }
  .timebar { right: max(16px, env(safe-area-inset-right, 0px)); }
}

@media (prefers-reduced-motion: reduce) { #loading, #loadfill { transition: none; } }
