/* Web port of the desktop HUD (ui.py). Colors and sizes mirror its constants. */
@font-face { font-family: "Grift"; src: url("/fonts/Grift-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Grift"; src: url("/fonts/Grift-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Grift Extra Bold"; src: url("/fonts/Grift-ExtraBold.ttf") format("truetype"); font-weight: 400; font-display: swap; }

:root {
  color-scheme: dark;
  --bg: #020c0c;
  --pri: #00d4c0;
  --org: #ff6600;
  --mid: #006a62;
  --dim: #0a2a28;
  --text: #7dfff6;
  --panel: #030f0f;
  --green: #00ff88;
  --red: #ff3344;
  --muted: #cc2255;
  --blue: #4488ff;
  --gold: #ffcc00;
  --body: "Grift", "Avenir Next", "Segoe UI", sans-serif;
  --display: "Grift Extra Bold", "Grift", "Avenir Next", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text); font-family: var(--body); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

#hud { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; display: block; }
.hud-widget { position: fixed; }

/* Corner brackets, like ui.py's _bracket(): four L-shaped strokes. */
.bracket {
  --c: var(--pri); --bl: 6px; --bw: 1px;
  border: 0;
  background:
    linear-gradient(var(--c), var(--c)) left top / var(--bl) var(--bw) no-repeat,
    linear-gradient(var(--c), var(--c)) left top / var(--bw) var(--bl) no-repeat,
    linear-gradient(var(--c), var(--c)) right top / var(--bl) var(--bw) no-repeat,
    linear-gradient(var(--c), var(--c)) right top / var(--bw) var(--bl) no-repeat,
    linear-gradient(var(--c), var(--c)) left bottom / var(--bl) var(--bw) no-repeat,
    linear-gradient(var(--c), var(--c)) left bottom / var(--bw) var(--bl) no-repeat,
    linear-gradient(var(--c), var(--c)) right bottom / var(--bl) var(--bw) no-repeat,
    linear-gradient(var(--c), var(--c)) right bottom / var(--bw) var(--bl) no-repeat,
    var(--fill, transparent);
}
.bracket:focus-visible, #composer input:focus-visible, select:focus-visible, #send:focus-visible { outline: 1px solid var(--pri); outline-offset: 2px; }

/* System settings button (top-left, 250×46). */
#settings-btn {
  --c: var(--mid); --bl: 9px; --bw: 2px; --fill: #021010;
  left: 14px; top: 12px; width: 250px; height: 46px; padding: 0 14px;
  display: grid; grid-template-columns: 1fr auto; align-content: center; row-gap: 4px; text-align: left; z-index: 3;
}
#settings-btn[aria-expanded="true"] { --c: var(--blue); --fill: #062020; }
.settings-title { font-family: var(--display); font-size: 10px; color: var(--pri); letter-spacing: .02em; }
.settings-badge { grid-row: 2; font-size: 9px; color: #4f7b78; }
.settings-arrow { grid-row: 1 / 3; grid-column: 2; align-self: center; font-family: var(--display); font-size: 14px; color: var(--c); }

#settings-panel { left: 14px; top: 82px; width: 320px; height: 292px; background: #041111; border: 1px solid var(--mid); z-index: 3; }
#settings-panel h2 { position: absolute; left: 14px; top: 12px; margin: 0; font: 11px var(--display); color: var(--pri); font-weight: 400; }
.tabs { position: absolute; left: 14px; top: 40px; display: flex; gap: 8px; }
.tab { --c: var(--dim); --bl: 7px; --fill: #041111; height: 28px; width: 108px; font-size: 9px; font-weight: 700; color: #5ea7a0; }
.tab + .tab { width: 96px; }
.tab.active { --c: var(--pri); --fill: #082020; color: var(--pri); }
.settings-body, .debug-body { position: absolute; left: 12px; top: 76px; width: 296px; height: 204px; }
.settings-body > * { position: absolute; margin: 0; }
#api-btn { --c: var(--blue); left: 0; top: 2px; width: 154px; height: 28px; color: var(--blue); font-size: 10px; font-weight: 700; }
#sfx-btn { left: 194px; top: 0; width: 98px; height: 36px; font-size: 9px; font-weight: 700; color: var(--c); }
#sfx-btn.off { --c: var(--mid); }
.status-primary { left: 0; top: 38px; width: 100%; font-size: 9px; font-weight: 700; color: var(--text); }
.status-secondary { left: 0; top: 58px; width: 100%; font-size: 9px; color: var(--mid); }
.label { font-size: 8px; font-weight: 700; color: var(--mid); }
.sfx-label { left: 0; top: 92px; }
.fx-label { left: 0; top: 116px; font-size: 10px; font-weight: 700; color: var(--pri); white-space: pre; }
#fx-level { left: 0; top: 136px; width: 100%; height: 26px; margin: 0; accent-color: var(--pri); background: transparent; appearance: none; }
#fx-level::-webkit-slider-runnable-track { height: 10px; background: #071818; }
#fx-level::-moz-range-track { height: 10px; background: #071818; }
#fx-level::-webkit-slider-thumb { appearance: none; width: 18px; height: 10px; background: var(--text); border: 0; }
#fx-level::-moz-range-thumb { width: 18px; height: 10px; background: var(--text); border: 0; border-radius: 0; }
.voice-label { left: 0; top: 184px; }
#voice { left: 88px; top: 172px; width: 208px; height: 30px; padding: 0 8px; color: var(--pri); background: var(--panel); border: 1px solid var(--mid); border-radius: 0; font-size: 10px; }
.debug-body { overflow-y: auto; padding: 10px; background: #020a0a; border: 1px solid var(--dim); font-size: 10px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.debug-body .info { color: var(--text); }
.debug-body .warn { color: var(--gold); }
.debug-body .err { color: var(--red); }

/* Center controls: MUTE · PAUSE · SHUTDOWN. */
.ctrl { --bl: 6px; --bw: 2px; height: 36px; font-size: 11px; font-weight: 700; color: var(--c); white-space: pre; }
#mute { --c: var(--green); }
#mute.muted { --c: var(--muted); }
#pause { --c: var(--blue); }
#pause.paused { --c: var(--gold); }
#shutdown { --c: var(--red); --bl: 8px; font-family: var(--display); font-weight: 400; }
.ctrl:hover, #settings-btn:hover, #api-btn:hover, #sfx-btn:hover, .tab:hover { filter: brightness(1.25); }

/* Conversation log + input, inside the right panel. */
#log {
  overflow-y: auto; padding: 8px 12px; background: #030e0e; border: 1px solid var(--mid);
  font-size: 12px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere;
  scrollbar-width: thin; scrollbar-color: var(--mid) transparent;
}
#log .you { color: #d0f0ee; }
#log .ai { color: var(--pri); }
#log .sys { color: var(--gold); }
#log .err { color: var(--red); }
#composer { display: flex; gap: 8px; margin: 0; }
#message { flex: 1; min-width: 0; height: 34px; padding: 0 8px; color: var(--text); background: #041212; border: 1px solid var(--dim); border-radius: 0; font-size: 11px; caret-color: var(--text); }
#message:focus { border-color: var(--pri); outline: none; }
#send { width: 76px; height: 34px; color: var(--org); background: var(--panel); border: 1px solid var(--org); font-size: 10px; font-weight: 700; }
#send:hover, #send:active { color: var(--bg); background: var(--org); }

@media (prefers-reduced-motion: reduce) { #log { scroll-behavior: auto; } }

/* Narrow screens: the header title needs the room, so settings collapses to its arrow. */
body.compact #settings-btn { width: 46px; padding: 0; grid-template-columns: 1fr; justify-items: center; }
body.compact .settings-title, body.compact .settings-badge { display: none; }
body.compact .settings-arrow { grid-column: 1; }
