/* German Dominion - voice overlay.
 * Two personalities in one stylesheet:
 *   [data-mode="shell"]   compact always-on-top HUD inside the native shell
 *   [data-mode="browser"] download landing when opened in a normal browser
 * Tokens mirror the family look (_shared.css) but are self-contained so the
 * overlay never depends on page chrome it does not render. Zero external
 * assets (G5 posture): fonts come from /assets/fonts on the same origin.
 */

@font-face {
  font-family: 'Bebas Neue';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/bebasneue-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/inter-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/jetbrainsmono-latin.woff2') format('woff2');
}

:root {
  --bg-0: #0b0a09;
  --bg-1: #141210;
  --glass: rgba(22, 20, 17, .86);
  --glass-2: rgba(255, 255, 255, .04);
  --glass-border: rgba(255, 255, 255, .09);
  --glass-border-lit: rgba(255, 255, 255, .18);
  --bone: #e8e2d6;
  --bone-62: rgba(232, 226, 214, .62);
  --bone-34: rgba(232, 226, 214, .34);
  --accent: #ff6a1f;
  --accent-hot: #ffb347;
  --accent-glow: rgba(255, 106, 31, .45);
  --ok: #7dd069;
  --warn: #ffb347;
  --err: #ff5d5d;
  --mono: 'JetBrains Mono', Consolas, monospace;
  --display-f: 'Bebas Neue', 'Arial Narrow', sans-serif;
  --ease: cubic-bezier(.22, .84, .36, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
/* The hidden attribute must always win: several containers below use
   display:flex, which would otherwise override the user-agent [hidden] rule
   and reveal both page modes at once. */
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  font: 400 13px/1.5 'Inter', system-ui, sans-serif;
  color: var(--bone);
  background: transparent;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  user-select: none;
}
body[data-mode="browser"] { background: var(--bg-0); overflow: auto; user-select: text; }
kbd {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .06em;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, .07);
  border: 1px solid var(--glass-border);
  border-bottom-width: 2px;
  color: var(--bone);
  white-space: nowrap;
}

/* ============================= HUD ============================= */
#overlay-root {
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 10px;
  gap: 10px;
}

.hud {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  backdrop-filter: blur(18px);
  box-shadow: 0 18px 50px -18px rgba(0, 0, 0, .8), inset 0 1px 0 rgba(255, 255, 255, .05);
  overflow: hidden;
  flex: none;
  animation: hudIn .4s var(--ease);
}
@keyframes hudIn { from { opacity: 0; transform: translateY(-6px) scale(.98); } to { opacity: 1; transform: none; } }

.hud-drag {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px 8px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
  app-region: drag;
  -webkit-app-region: drag;
  cursor: grab;
}
.brand { display: inline-flex; align-items: baseline; gap: 7px; }
.brand-mark {
  width: 8px; height: 8px; border-radius: 2px;
  background: linear-gradient(135deg, var(--accent), var(--accent-hot));
  box-shadow: 0 0 10px var(--accent-glow);
  align-self: center;
}
.brand-mark.big { width: 14px; height: 14px; border-radius: 4px; }
.brand-name {
  font-family: var(--display-f);
  font-size: 17px;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.brand-tag {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--accent);
}
.hud-window-controls { display: inline-flex; gap: 4px; app-region: no-drag; -webkit-app-region: no-drag; }
.icon-btn {
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--bone-62);
  cursor: pointer;
  transition: .15s var(--ease);
}
.icon-btn svg { width: 15px; height: 15px; fill: currentColor; }
.icon-btn:hover { background: var(--glass-2); border-color: var(--glass-border); color: var(--bone); }
.icon-btn.danger:hover { color: var(--err); border-color: rgba(255, 93, 93, .4); }

/* Live row */
.hud-live { display: flex; align-items: center; gap: 14px; padding: 14px 16px; }

.mic-ring {
  position: relative;
  width: 64px; height: 64px;
  flex: none;
  border-radius: 50%;
  border: none;
  background: var(--glass-2);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: .2s var(--ease);
  app-region: no-drag; -webkit-app-region: no-drag;
}
.mic-ring .ring {
  position: absolute; inset: 0;
  border-radius: 50%;
  border: 2px solid var(--glass-border);
  transition: border-color .18s;
}
.mic-ring .mic-icon { width: 26px; height: 26px; fill: var(--bone-62); transition: fill .18s; }
.mic-ring .mic-muted { display: none; }
.mic-ring[data-live="true"] .ring {
  border-color: var(--accent);
  box-shadow: 0 0 16px var(--accent-glow), inset 0 0 10px rgba(255, 106, 31, .18);
  animation: livePulse 1.4s ease-in-out infinite;
}
.mic-ring[data-live="true"] .mic-icon { fill: var(--accent-hot); }
@keyframes livePulse {
  0%, 100% { box-shadow: 0 0 10px var(--accent-glow), inset 0 0 8px rgba(255, 106, 31, .14); }
  50% { box-shadow: 0 0 22px var(--accent-glow), inset 0 0 14px rgba(255, 106, 31, .26); }
}
.mic-ring[data-muted="true"] .mic-icon { display: none; }
.mic-ring[data-muted="true"] .mic-muted { display: block; fill: var(--err); }
.mic-ring[data-muted="true"] .ring { border-color: rgba(255, 93, 93, .55); animation: none; }
.mic-ring:hover .ring { border-color: var(--glass-border-lit); }

.hud-mid { display: flex; flex-direction: column; gap: 7px; min-width: 0; flex: 1; }
.hud-status { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--bone-62); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--bone-34); flex: none; transition: background .2s, box-shadow .2s; }
.hud[data-state="live"] .status-dot { background: var(--ok); box-shadow: 0 0 8px rgba(125, 208, 105, .7); }
.hud[data-state="connecting"] .status-dot { background: var(--warn); box-shadow: 0 0 8px rgba(255, 179, 71, .6); animation: dotBlink 1s ease-in-out infinite; }
.hud[data-state="error"] .status-dot { background: var(--err); box-shadow: 0 0 8px rgba(255, 93, 93, .6); }
@keyframes dotBlink { 50% { opacity: .35; } }

.ptt-chip {
  display: inline-flex; align-items: center; gap: 8px;
  align-self: flex-start;
  padding: 4px 8px;
  border-radius: 8px;
  background: var(--glass-2);
  border: 1px solid var(--glass-border);
}
.ptt-chip-label { font-family: var(--mono); font-size: 9px; letter-spacing: .2em; text-transform: uppercase; color: var(--bone-34); }

/* Speakers column */
.speakers { display: flex; flex-direction: column; gap: 4px; max-width: 150px; flex: none; }
.speaker {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px;
  color: var(--bone-62);
  padding: 3px 8px;
  border-radius: 7px;
  background: var(--glass-2);
  border: 1px solid transparent;
  max-width: 100%;
  animation: spkIn .22s var(--ease);
  transition: border-color .15s, color .15s, background .15s;
}
@keyframes spkIn { from { opacity: 0; transform: translateX(6px); } to { opacity: 1; transform: none; } }
.speaker .spk-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.speaker .spk-wave { display: inline-flex; align-items: flex-end; gap: 1.5px; height: 10px; flex: none; }
.speaker .spk-wave i { width: 2px; height: 3px; border-radius: 1px; background: var(--bone-34); }
.speaker.speaking { border-color: rgba(255, 106, 31, .5); color: var(--bone); background: rgba(255, 106, 31, .09); }
.speaker.speaking .spk-wave i { background: var(--accent-hot); animation: wave .7s ease-in-out infinite; }
.speaker.speaking .spk-wave i:nth-child(2) { animation-delay: .12s; }
.speaker.speaking .spk-wave i:nth-child(3) { animation-delay: .24s; }
@keyframes wave { 0%, 100% { height: 3px; } 50% { height: 10px; } }
.speakers-more { font-family: var(--mono); font-size: 9px; color: var(--bone-34); text-align: right; padding-right: 2px; }

/* Notices */
.hud-notice { padding: 14px; border-top: 1px solid rgba(255, 255, 255, .06); }
.hud-notice p { font-size: 13.5px; color: var(--bone-62); line-height: 1.55; }
.notice-actions { display: flex; gap: 8px; margin-top: 10px; }

/* Buttons (shared) */
.btn {
  font: 600 11px/1 'Inter', sans-serif;
  letter-spacing: .12em;
  text-transform: uppercase;
  padding: 10px 14px;
  border-radius: 9px;
  border: 1px solid var(--glass-border);
  background: var(--glass-2);
  color: var(--bone);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: .18s var(--ease);
  app-region: no-drag; -webkit-app-region: no-drag;
}
.btn:hover { border-color: var(--glass-border-lit); background: rgba(255, 106, 31, .07); }
.btn.primary {
  background: linear-gradient(180deg, rgba(255, 106, 31, .26), rgba(255, 106, 31, .1));
  border-color: var(--accent);
  box-shadow: 0 10px 26px -10px var(--accent-glow);
}
.btn.primary:hover { background: linear-gradient(180deg, rgba(255, 106, 31, .36), rgba(255, 106, 31, .16)); }
.btn.big { padding: 14px 20px; font-size: 12px; }

/* Settings drawer */
.settings {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  backdrop-filter: blur(18px);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 13px;
  animation: hudIn .3s var(--ease);
  overflow-y: auto;
}
.settings h2 {
  font-family: var(--display-f);
  font-size: 19px;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.set-label { font-size: 12px; color: var(--bone-62); flex: none; }
.set-value { font-family: var(--mono); font-size: 11px; color: var(--bone); overflow: hidden; text-overflow: ellipsis; }
.set-note { font-size: 11px; color: var(--bone-34); line-height: 1.6; }
.set-note.dim { font-family: var(--mono); font-size: 9px; letter-spacing: .08em; }

.seg { display: inline-flex; border: 1px solid var(--glass-border); border-radius: 9px; overflow: hidden; }
.seg-btn {
  font: 600 10px/1 'Inter', sans-serif;
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: 8px 11px;
  background: transparent;
  border: none;
  color: var(--bone-62);
  cursor: pointer;
  transition: .15s;
}
.seg-btn + .seg-btn { border-left: 1px solid var(--glass-border); }
.seg-btn.active { background: rgba(255, 106, 31, .16); color: var(--bone); }

/* --- Microphone mode + voice activation -----------------------------------
   A 2x2 grid, not a segmented strip: four labels of the length of "Voice
   activation" cannot be read side by side in a 460px window. */
.set-block { display: flex; flex-direction: column; gap: 9px; }

.mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.mode-btn {
  font: 600 10px/1.2 'Inter', sans-serif;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 9px 8px;
  min-width: 0;
  background: var(--glass-2);
  border: 1px solid var(--glass-border);
  border-radius: 9px;
  color: var(--bone-62);
  cursor: pointer;
  transition: .15s;
  app-region: no-drag; -webkit-app-region: no-drag;
}
.mode-btn:hover { border-color: var(--glass-border-lit); color: var(--bone); }
.mode-btn.active {
  background: rgba(255, 106, 31, .16);
  border-color: rgba(255, 106, 31, .5);
  color: var(--bone);
}

/* The live level and the threshold marker share one -60..0 dB scale, so "the
   bar reaches the marker" IS the condition the gate opens on. Aiming the
   slider is then a matter of watching, not of guessing what a number means. */
.vad-meter {
  position: relative;
  height: 8px;
  border-radius: 5px;
  background: var(--glass-2);
  border: 1px solid var(--glass-border);
  overflow: hidden;
}
.vad-meter-fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 0%;
  background: var(--bone-34);
  transition: width .06s linear;
}
.vad-meter-fill.over { background: var(--accent); }
.vad-meter-mark {
  position: absolute; top: 0; bottom: 0;
  width: 2px;
  left: 33%;
  background: var(--accent-hot);
}

.vad-slider-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; }
/* Same trap as .pvol-slider below: the global `input[type="range"]` (0,1,1)
   beats a bare .vad-slider (0,1,0) and would pin it to 150px inside its
   track. min-width:0 lets the grid item shrink to that track. */
input[type="range"].vad-slider {
  width: 100%;
  min-width: 0;
  accent-color: var(--accent);
  cursor: pointer;
  app-region: no-drag; -webkit-app-region: no-drag;
}
.vad-val {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--bone-62);
  white-space: nowrap;
}
.set-note.warn { color: var(--accent-hot); }

.bind-btn {
  display: flex; align-items: center; gap: 10px;
  background: var(--glass-2);
  border: 1px solid var(--glass-border);
  border-radius: 9px;
  padding: 8px 10px;
  cursor: pointer;
  color: var(--bone);
  transition: .15s;
  max-width: 210px;
}
.bind-btn:hover { border-color: var(--glass-border-lit); }
.bind-btn.capturing { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255, 106, 31, .18); animation: dotBlink 1s infinite; }
.bind-hint { font-size: 10px; color: var(--bone-34); text-align: left; line-height: 1.4; }

.switch-wrap { cursor: pointer; }
.switch-wrap input { display: none; }
.switch { display: inline-block; width: 36px; height: 20px; border-radius: 11px; background: rgba(255, 255, 255, .08); border: 1px solid var(--glass-border); position: relative; transition: background .25s; }
.switch::after { content: ""; position: absolute; left: 2px; top: 2px; width: 13px; height: 13px; border-radius: 50%; background: var(--bone-62); transition: all .22s var(--ease); }
.switch-wrap input:checked + .switch { background: var(--accent); }
.switch-wrap input:checked + .switch::after { left: 19px; background: #fff; }

input[type="range"] { accent-color: var(--accent); width: 150px; }

#voice-frame { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; border: 0; left: -10px; top: -10px; }

/* ============================= Landing ============================= */
#landing-root { min-height: 100vh; }
.landing { max-width: 980px; margin: 0 auto; padding: 64px 24px 80px; }
.landing-head { display: flex; flex-direction: column; gap: 14px; margin-bottom: 36px; }
.landing-head h1 {
  font-family: var(--display-f);
  font-size: clamp(44px, 7vw, 72px);
  letter-spacing: .06em;
  text-transform: uppercase;
  line-height: .95;
}
.landing-head .accent { color: var(--accent); }
.lede { max-width: 640px; color: var(--bone-62); font-size: 15px; line-height: 1.7; }
.landing-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, .035), rgba(255, 255, 255, .015));
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 22px;
  display: flex; flex-direction: column; gap: 12px;
}
.card h2 { font-family: var(--display-f); font-size: 20px; letter-spacing: .1em; text-transform: uppercase; color: var(--accent-hot); }
.card p, .card li { color: var(--bone-62); font-size: 13.5px; line-height: 1.65; }
.card ol, .card ul { padding-left: 18px; display: flex; flex-direction: column; gap: 7px; }
.card a { color: var(--accent-hot); }
.card .fine { font-size: 11px; color: var(--bone-34); }
.card strong { color: var(--bone); }

/* HUD control pills (deafen / connect) */
.hud-controls { display: flex; gap: 6px; }
.pill-btn {
  font: 600 10px/1 'Inter', sans-serif;
  letter-spacing: .12em;
  text-transform: uppercase;
  padding: 7px 11px;
  border-radius: 8px;
  border: 1px solid var(--glass-border);
  background: var(--glass-2);
  color: var(--bone-62);
  cursor: pointer;
  transition: .16s var(--ease);
  app-region: no-drag; -webkit-app-region: no-drag;
}
.pill-btn:hover { border-color: var(--glass-border-lit); color: var(--bone); }
.pill-btn[aria-pressed="true"] { background: rgba(255, 93, 93, .14); border-color: rgba(255, 93, 93, .55); color: #ffb3b3; }
.pill-btn[data-mode="connect"] { background: rgba(255, 106, 31, .14); border-color: var(--accent); color: var(--accent-hot); }

/* ---------------------------------------------------------------------------
   Player volume drawer (2026-07-14)
   The overlay is the only voice surface reachable while the game has focus,
   so per-person volume lives here as well as on the /voice/ page.
   --------------------------------------------------------------------------- */
.players-panel { gap: 10px; }
.players-list { display: flex; flex-direction: column; gap: 2px; }
.players-empty { font-size: 11px; color: var(--bone-34); line-height: 1.6; margin: 0; }

.pill-count {
  font-family: var(--mono);
  font-size: 9px;
  margin-left: 6px;
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--glass-2);
  border: 1px solid var(--glass-border);
  color: var(--bone-62);
}
.pill-btn[aria-expanded="true"] { background: rgba(255, 106, 31, .14); border-color: var(--accent); color: var(--accent-hot); }

.pvol-row {
  display: grid;
  grid-template-columns: 1fr 104px 40px 28px;
  align-items: center;
  gap: 10px;
  padding: 8px 4px;
  border-top: 1px solid rgba(255, 255, 255, .05);
}
.pvol-row:first-child { border-top: 0; }

.pvol-name {
  font-size: 12.5px;
  color: var(--bone-62);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  display: flex; align-items: center; gap: 6px;
  min-width: 0;
}
.pvol-row.speaking .pvol-name { color: var(--accent-hot); }
.pvol-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--bone-34); flex: none;
  transition: background .18s, box-shadow .18s;
}
.pvol-row.speaking .pvol-dot { background: var(--accent-hot); box-shadow: 0 0 7px var(--accent-glow); }
.pvol-row.muted .pvol-name { color: var(--bone-34); text-decoration: line-through; }

/* Must out-specify the global `input[type="range"] { width: 150px }` above
   (0,1,1) - a plain .pvol-slider (0,1,0) loses to it and the slider then
   overruns its 104px grid track and sits under the % readout. min-width:0
   keeps the grid item from refusing to shrink to its track. */
input[type="range"].pvol-slider {
  width: 100%;
  min-width: 0;
  accent-color: var(--accent);
  cursor: pointer;
  app-region: no-drag; -webkit-app-region: no-drag;
}
.pvol-row.muted .pvol-slider { opacity: .35; }

.pvol-val {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--bone-62);
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.pvol-val.boosted { color: var(--accent-hot); }
.pvol-row.muted .pvol-val { color: var(--bone-34); }

.pvol-mute {
  width: 26px; height: 26px;
  border-radius: 7px;
  border: 1px solid var(--glass-border);
  background: var(--glass-2);
  color: var(--bone-62);
  font: 600 10px/1 'Inter', sans-serif;
  cursor: pointer;
  transition: .16s var(--ease);
  app-region: no-drag; -webkit-app-region: no-drag;
}
.pvol-mute:hover { border-color: var(--glass-border-lit); color: var(--bone); }
.pvol-mute[data-muted="true"] { background: rgba(255, 93, 93, .16); border-color: rgba(255, 93, 93, .55); color: #ffb3b3; }
