/* GrokeMon Hunt HUD. Local fonts only. No CDN.
 *
 * Dark, low-chroma, LCARS-adjacent: the 3D grove is the picture and the HUD is
 * a thin instrument layer over it. Everything in here is either a panel edge, a
 * label or a number — no fills heavy enough to compete with the render.
 *
 * Element ids are CONTRACT §7 and are matched exactly; the class names are this
 * file's own business and hud.js is the only thing that writes them.
 */

:root {
  /* Indigo to match the grove's night, not the old teal: the panels sit on the
   * same fog the render fades into. */
  --gm-void: #070b16;
  --gm-panel: rgba(9, 14, 30, 0.76);
  --gm-panel-edge: rgba(140, 170, 220, 0.20);
  --gm-text: #dbe4f0;
  --gm-muted: #7f8ea8;
  --gm-accent: #c9a227;
  --gm-danger: #c45c3a;
  --gm-good: #6fc48a;
  --gm-gem: #8fd8ff;
  --gm-warn: #d9a441;
  --gm-house: #b46be0;

  --gm-gap: 10px;
  --gm-radius: 3px;
  --gm-track: rgba(0, 0, 0, 0.55);
}

html, body {
  margin: 0;
  height: 100%;
  background: var(--gm-void);
  color: var(--gm-text);
  font-family: Bahnschrift, "Roboto Condensed", "Segoe UI", sans-serif;
  overflow: hidden;
}

#gm-stage {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

#gm-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

#gm-hud {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;          /* the grove takes the mouse; panels opt back in */
  font-size: 12px;
  letter-spacing: 0.08em;
  -webkit-user-select: none;
  user-select: none;
}

/* ── Panels ─────────────────────────────────────────────────────────────── */

.gm-panel {
  background: var(--gm-panel);
  border: 1px solid var(--gm-panel-edge);
  border-radius: var(--gm-radius);
  padding: 10px 12px;
  backdrop-filter: blur(2px);
}

#gm-vitals {
  position: absolute;
  top: 14px;
  left: 14px;
  width: 232px;
  display: flex;
  flex-direction: column;
  gap: var(--gm-gap);
}

/* The roster and the hint share one right-hand column so the hint sits under
 * the roster's real height, not under its max-height. */
#gm-right {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 268px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#gm-roster {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 46vh;
  overflow-y: auto;
  pointer-events: auto;
  scrollbar-width: thin;
}

#gm-hint {
  color: var(--gm-muted);
  font-size: 10px;
  line-height: 1.5;
  letter-spacing: 0.06em;
  text-align: right;
  text-shadow: 0 1px 3px #000;
}

#gm-hint.is-coach {
  color: var(--gm-accent);
  font-size: 11px;
  max-width: 28ch;
}

#gm-hint[hidden] { display: none; }

/* ── Glove heat ─────────────────────────────────────────────────────────── */

.gm-meter {
  display: flex;
  align-items: center;
  gap: 8px;
}

.gm-meter__k {
  color: var(--gm-muted);
  font-size: 10px;
  letter-spacing: 0.16em;
}

.gm-meter__track {
  position: relative;
  flex: 1;
  height: 7px;
  background: var(--gm-track);
  border: 1px solid var(--gm-panel-edge);
  border-radius: 1px;
  overflow: hidden;
}

.gm-meter__fill {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #7fd0a0, var(--gm-accent));
  transition: width 140ms linear;
}

/* Heat marks: selected STRIKE / POWER and CHARM thresholds. */
.gm-meter__mark {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(255, 255, 255, 0.42);
}

.gm-meter__mark--convert { background: rgba(143, 216, 255, 0.55); }

.gm-meter__v {
  min-width: 26px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--gm-accent);
}

.gm-meter.is-warm .gm-meter__v { color: var(--gm-warn); }
.gm-meter.is-cold .gm-meter__v { color: var(--gm-danger); }
.gm-meter.is-cold .gm-meter__fill { background: var(--gm-danger); }

/* ── Readouts ───────────────────────────────────────────────────────────── */

.gm-readouts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 10px;
}

.gm-readout {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.gm-readout__k {
  color: var(--gm-muted);
  font-size: 10px;
  letter-spacing: 0.16em;
}

.gm-readout__v {
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  color: var(--gm-text);
}

#gm-clock.is-late .gm-readout__v { color: var(--gm-danger); }

#gm-clock.is-extracting .gm-readout__v {
  color: var(--gm-gem);
  animation: gm-pulse 1s ease-in-out infinite;
}

#gm-retinue.is-full .gm-readout__v { color: var(--gm-warn); }

/* Compass + metres to the nearest extract ring. Not a map. */
#gm-bearing .gm-readout__v { color: var(--gm-gem); }
#gm-bearing.is-here .gm-readout__v {
  color: var(--gm-gem);
  animation: gm-pulse 1s ease-in-out infinite;
}

/* A creature locked in a scuffle is pinned: not walking, not watching, not
 * screening. The count goes hot for as long as the snapshot says so. */
#gm-retinue.is-pinned .gm-readout__v {
  color: var(--gm-danger);
  animation: gm-pulse 0.7s ease-in-out infinite;
}

/* ── Retinue orders ─────────────────────────────────────────────────────── */

/* F/G/H at a glance. Three glyphs, not a list: after retinue v2 the split
 * between follow, guard and harry is the whole shape of a retinue, and it has
 * to be readable without leaving the fight. */
.gm-orders {
  display: inline-flex;
  gap: 5px;
  align-items: baseline;
}

.gm-orders__k {
  font-size: 10px;
  font-style: normal;
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
  color: var(--gm-muted);
}

.gm-orders__k--follow { color: var(--gm-good); }
.gm-orders__k--guard { color: var(--gm-gem); }
.gm-orders__k--harry { color: var(--gm-warn); }
.gm-orders__k.is-zero { color: var(--gm-muted); opacity: 0.4; }

@keyframes gm-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

/* ── Chips ──────────────────────────────────────────────────────────────── */

.gm-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.gm-chip {
  display: inline-block;
  padding: 2px 6px;
  border: 1px solid currentColor;
  border-radius: 1px;
  font-size: 9px;
  letter-spacing: 0.14em;
  line-height: 1.5;
  color: var(--gm-muted);
  white-space: nowrap;
}

.gm-chip--live { color: var(--gm-good); }
.gm-chip--won { color: var(--gm-good); background: rgba(111, 196, 138, 0.14); }
.gm-chip--lost { color: var(--gm-danger); background: rgba(196, 92, 58, 0.14); }
.gm-chip--good { color: var(--gm-good); }
.gm-chip--bad { color: var(--gm-danger); }
.gm-chip--gem { color: var(--gm-gem); }
.gm-chip--demo { color: var(--gm-accent); }
.gm-chip--quiet { color: var(--gm-muted); }

/* The two integrity signals. Deliberately loud, deliberately different from
 * each other: `degraded` means nobody asked a model, `house` means the model
 * was asked and did not answer usably. Never merge these styles. */
.gm-chip--warn { color: var(--gm-warn); background: rgba(217, 164, 65, 0.12); }
.gm-chip--house { color: var(--gm-house); background: rgba(180, 107, 224, 0.14); }

/* ── Roster ─────────────────────────────────────────────────────────────── */

.gm-roster__empty {
  color: var(--gm-muted);
  font-size: 10px;
  letter-spacing: 0.14em;
}

.gm-crew {
  --gm-crew-hue: var(--gm-muted);
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas:
    "name model"
    "tags tags"
    "heat heat";
  gap: 2px 6px;
  padding: 5px 7px;
  border-left: 2px solid var(--gm-crew-hue);
  background: rgba(0, 0, 0, 0.24);
  border-radius: 1px;
}

.gm-crew.is-bearer { background: rgba(201, 162, 39, 0.10); }
.gm-crew.is-familiar { opacity: 0.85; }

.gm-crew.is-downed {
  opacity: 0.5;
  filter: grayscale(0.7);
}

.gm-crew__name {
  grid-area: name;
  color: var(--gm-crew-hue);
  font-size: 12px;
  letter-spacing: 0.1em;
}

.gm-crew__model {
  grid-area: model;
  color: var(--gm-muted);
  font-size: 10px;
  letter-spacing: 0.04em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gm-crew__tags {
  grid-area: tags;
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

.gm-crew__heat {
  grid-area: heat;
  display: block;
  height: 2px;
  margin-top: 3px;
  background: var(--gm-track);
}

.gm-crew__heat[hidden] { display: none; }

.gm-crew__heat-fill {
  display: block;
  height: 100%;
  width: 0;
  background: var(--gm-crew-hue);
  transition: width 160ms linear;
}

/* ── Familiar line ──────────────────────────────────────────────────────── */

.gm-familiar {
  position: absolute;
  left: 50%;
  bottom: 84px;
  transform: translateX(-50%);
  max-width: min(680px, 70vw);
  padding: 8px 14px;
  text-align: center;
  font-size: 14px;
  letter-spacing: 0.04em;
  line-height: 1.5;
  color: var(--gm-text);
  background: rgba(5, 9, 20, 0.72);
  border-left: 2px solid var(--gm-accent);
  border-right: 2px solid var(--gm-accent);
  text-shadow: 0 1px 4px #000;
  transition: opacity 700ms ease;
}

.gm-familiar:empty { display: none; }
.gm-familiar.is-gone { opacity: 0; }

/* ── Toasts ─────────────────────────────────────────────────────────────── */

.gm-toast {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.gm-toast__item {
  padding: 5px 12px;
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--gm-text);
  background: rgba(5, 9, 20, 0.82);
  border: 1px solid var(--gm-panel-edge);
  border-radius: 1px;
  transition: opacity 380ms ease, transform 380ms ease;
}

.gm-toast__item--good { border-color: var(--gm-good); color: var(--gm-good); }
.gm-toast__item--bad { border-color: var(--gm-danger); color: var(--gm-danger); }
.gm-toast__item--gem { border-color: var(--gm-gem); color: var(--gm-gem); }

.gm-toast__item.is-gone {
  opacity: 0;
  transform: translateY(-6px);
}

/* ── TTS / SFX toggles ──────────────────────────────────────────────────── */

#gm-audio-toggles {
  pointer-events: auto;
  position: absolute;
  bottom: 18px;
  right: 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

#gm-tts-wrap,
#gm-sfx-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.14em;
  font-size: 10px;
  color: var(--gm-muted);
  cursor: pointer;
}

#gm-tts-toggle,
#gm-sfx-toggle { accent-color: var(--gm-accent); }

/* Opt-in `?debug=1` readout. Not CONTRACT §7; created by hud.js only then. */
#gm-debug {
  position: absolute;
  left: 14px;
  bottom: 14px;
  padding: 4px 8px;
  font-size: 11px;
  letter-spacing: 0.10em;
  color: var(--gm-muted);
  background: var(--gm-panel);
  border: 1px solid var(--gm-panel-edge);
  border-radius: var(--gm-radius);
  pointer-events: none;
}
#gm-debug[hidden] { display: none; }

/* ── Title / mode select ───────────────────────────────────────────────── */

#gm-title {
  position: absolute;
  inset: 0;
  z-index: 7;
  display: grid;
  place-items: center;
  padding: clamp(14px, 4vw, 48px);
  box-sizing: border-box;
  overflow: auto;
  background:
    linear-gradient(90deg, rgba(3, 7, 15, 0.96), rgba(3, 7, 15, 0.46) 55%, rgba(3, 7, 15, 0.84)),
    radial-gradient(circle at 70% 35%, rgba(56, 166, 148, 0.12), transparent 36%);
  backdrop-filter: blur(5px) saturate(0.72);
}

#gm-title[hidden] { display: none; }

.gm-title__card {
  width: min(940px, 100%);
  padding: clamp(22px, 4vw, 46px);
  box-sizing: border-box;
  background: linear-gradient(145deg, rgba(8, 15, 29, 0.97), rgba(5, 11, 22, 0.91));
  border: 1px solid rgba(143, 216, 255, 0.25);
  box-shadow: 0 32px 110px rgba(0, 0, 0, 0.64), inset 3px 0 0 var(--gm-gem);
}

.gm-title__mast { max-width: 680px; }
.gm-title__eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--gm-gem);
  font-size: 10px;
  letter-spacing: 0.22em;
}
.gm-title__eyebrow span { width: 30px; height: 1px; background: var(--gm-gem); }
.gm-title__mast h1 {
  margin: 11px 0 4px;
  color: #f2f6fb;
  font-size: clamp(42px, 7vw, 76px);
  line-height: 0.92;
  letter-spacing: 0.03em;
}
.gm-title__mast h1 span { color: var(--gm-accent); }
.gm-title__mast p { margin: 15px 0 0; color: #b9c5d6; font-size: 14px; line-height: 1.5; }

.gm-title__choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 30px;
}
.gm-title__choices[hidden] { display: none; }
.gm-title__mode {
  padding: 16px;
  border: 1px solid var(--gm-panel-edge);
  background: rgba(143, 216, 255, 0.025);
}
.gm-title__mode--solo { border-top-color: rgba(105, 238, 202, 0.48); }
.gm-title__mode--multi { border-top-color: rgba(201, 162, 39, 0.52); }
.gm-title__mode-head { display: flex; align-items: center; gap: 12px; margin-bottom: 13px; }
.gm-title__mode-head > span { color: var(--gm-muted); font-size: 22px; font-weight: 300; }
.gm-title__mode-head b { display: block; color: var(--gm-text); font-size: 12px; letter-spacing: 0.16em; }
.gm-title__mode-head small { color: var(--gm-muted); font-size: 10px; letter-spacing: 0.06em; }

.gm-title__launch {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  width: 100%;
  margin-top: 8px;
  padding: 13px 14px;
  text-align: left;
  border: 1px solid rgba(219, 228, 240, 0.14);
  color: var(--gm-text);
  background: rgba(255, 255, 255, 0.025);
  cursor: pointer;
}
.gm-title__launch b { font-size: 11px; letter-spacing: 0.12em; }
.gm-title__launch span { grid-column: 1; margin-top: 4px; color: var(--gm-muted); font-size: 10px; }
.gm-title__launch i { grid-column: 2; grid-row: 1 / span 2; align-self: center; color: var(--gm-gem); font-size: 9px; font-style: normal; letter-spacing: 0.14em; }
.gm-title__launch:hover,
.gm-title__launch:focus-visible { border-color: rgba(143, 216, 255, 0.52); background: rgba(143, 216, 255, 0.065); outline: none; }
.gm-title__launch:disabled { opacity: 0.45; cursor: wait; }

.gm-title__join { margin-top: 12px; }
.gm-title__join label { display: block; margin-bottom: 6px; color: var(--gm-muted); font-size: 9px; letter-spacing: 0.16em; }
.gm-title__join > div { display: grid; grid-template-columns: 1fr auto; }
.gm-title__join input {
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid rgba(219, 228, 240, 0.18);
  border-right: 0;
  border-radius: 0;
  color: var(--gm-text);
  background: rgba(0, 0, 0, 0.24);
  font: 700 14px/1 Bahnschrift, "Segoe UI", sans-serif;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}
.gm-title__join button,
.gm-title__wait-actions button {
  padding: 11px 14px;
  border: 1px solid rgba(143, 216, 255, 0.42);
  border-radius: 0;
  color: var(--gm-gem);
  background: transparent;
  font: 700 9px/1 Bahnschrift, "Segoe UI", sans-serif;
  letter-spacing: 0.13em;
  cursor: pointer;
}
.gm-title__join button:hover,
.gm-title__wait-actions button:hover { background: rgba(143, 216, 255, 0.08); }
#gm-title-join-error { display: block; min-height: 14px; margin-top: 5px; color: var(--gm-danger); font-size: 9px; }

.gm-host-unlock { max-width: 520px; margin-top: 28px; }
.gm-host-unlock[hidden] { display: none; }
.gm-host-unlock h2 { margin: 0 0 8px; font-size: 22px; color: var(--gm-text); }
.gm-host-unlock p { margin: 0 0 22px; color: #b9c5d6; font-size: 12px; line-height: 1.5; }
.gm-host-unlock input { min-width: 0; text-transform: none; letter-spacing: 0.08em; }
.gm-host-unlock input:focus-visible { outline: 2px solid var(--gm-gem); outline-offset: 2px; }
.gm-host-unlock button:disabled { opacity: 0.5; cursor: wait; }
#gm-host-unlock-error { display: block; min-height: 28px; margin-top: 8px; color: var(--gm-danger); font-size: 11px; line-height: 1.4; }

.gm-title__wait { margin-top: 30px; padding: 22px; border: 1px solid var(--gm-panel-edge); background: rgba(0, 0, 0, 0.18); }
.gm-title__wait > span { color: var(--gm-gem); font-size: 9px; letter-spacing: 0.2em; }
.gm-title__wait h2 { margin: 8px 0; color: var(--gm-text); font-size: 22px; letter-spacing: 0.08em; }
.gm-title__wait > p { max-width: 66ch; color: var(--gm-muted); font-size: 11px; line-height: 1.55; }
#gm-title-code { display: block; margin: 18px 0 12px; color: #f2f6fb; font-size: clamp(30px, 6vw, 54px); font-weight: 800; letter-spacing: 0.22em; }
#gm-title-code[hidden] { display: none; }
.gm-title__prompt { padding: 10px 12px; border-left: 2px solid var(--gm-accent); background: rgba(105, 238, 202, 0.035); user-select: all; }
.gm-title__wait-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.gm-title__wait-actions button[hidden] { display: none; }
.gm-title__card footer { display: flex; justify-content: space-between; gap: 12px; margin-top: 20px; color: rgba(161, 176, 194, 0.6); font-size: 8px; letter-spacing: 0.14em; }

/* ── Field briefing / guide ────────────────────────────────────────────── */

#gm-guide {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: grid;
  place-items: center;
  padding: clamp(18px, 5vw, 64px);
  box-sizing: border-box;
  background:
    radial-gradient(circle at 50% 42%, rgba(24, 67, 75, 0.18), transparent 42%),
    rgba(3, 7, 15, 0.58);
  backdrop-filter: blur(4px) saturate(0.78);
}

#gm-guide[hidden] { display: none; }

.gm-guide__card {
  position: relative;
  width: min(720px, 100%);
  padding: clamp(24px, 4vw, 46px);
  box-sizing: border-box;
  overflow: hidden;
  background: linear-gradient(145deg, rgba(10, 18, 35, 0.97), rgba(6, 12, 25, 0.91));
  border: 1px solid rgba(143, 216, 255, 0.28);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.56), inset 3px 0 0 var(--gm-gem);
}

.gm-guide__card::after {
  content: "";
  position: absolute;
  width: 230px;
  height: 230px;
  right: -110px;
  top: -120px;
  border: 1px solid rgba(143, 216, 255, 0.13);
  border-radius: 50%;
  box-shadow: 0 0 0 28px rgba(143, 216, 255, 0.025), 0 0 0 62px rgba(143, 216, 255, 0.018);
  pointer-events: none;
}

.gm-guide__eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--gm-gem);
  font-size: 10px;
  letter-spacing: 0.22em;
}

.gm-guide__eyebrow span {
  width: 30px;
  height: 1px;
  background: var(--gm-gem);
}

.gm-guide__card h1 {
  margin: 12px 0 4px;
  font-size: clamp(40px, 7vw, 72px);
  font-weight: 800;
  line-height: 0.92;
  letter-spacing: 0.03em;
  color: #f2f6fb;
}

.gm-guide__card h1 span { color: var(--gm-accent); }

.gm-guide__lead {
  max-width: 44ch;
  margin: 14px 0 24px;
  color: #b9c5d6;
  font-size: 15px;
  line-height: 1.55;
}

.gm-guide__objective {
  display: grid;
  grid-template-columns: auto 1fr auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 13px 15px;
  color: var(--gm-muted);
  border: 1px solid var(--gm-panel-edge);
  background: rgba(143, 216, 255, 0.035);
  font-size: 10px;
  letter-spacing: 0.11em;
}

.gm-guide__objective b { color: var(--gm-text); font-weight: 600; }
.gm-guide__objective i { height: 1px; background: rgba(143, 216, 255, 0.2); }

.gm-guide__controls {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 20px 0;
}

.gm-guide__controls div {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--gm-muted);
  font-size: 11px;
}

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  min-height: 18px;
  padding: 0 5px;
  box-sizing: border-box;
  border: 1px solid rgba(219, 228, 240, 0.27);
  border-bottom-color: rgba(219, 228, 240, 0.48);
  border-radius: 2px;
  color: var(--gm-text);
  background: rgba(255, 255, 255, 0.035);
  font: 600 9px/1 Bahnschrift, "Segoe UI", sans-serif;
  letter-spacing: 0.08em;
}

.gm-guide__tip {
  margin: 0;
  padding-left: 12px;
  border-left: 2px solid var(--gm-accent);
  color: var(--gm-muted);
  font-size: 11px;
  line-height: 1.55;
}

.gm-guide__tip p { margin: 0; }
.gm-guide__tip p + p { margin-top: 7px; }
.gm-guide__tip b { color: var(--gm-accent); }
.gm-guide__advanced { margin-top: 18px; border-top: 1px solid var(--gm-panel-edge); }
.gm-guide__advanced summary {
  width: fit-content;
  padding: 12px 0 4px;
  color: var(--gm-accent);
  font-size: 11px;
  cursor: pointer;
}
.gm-guide__advanced .gm-guide__controls { grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 14px 0; }
.gm-guide__advanced p { margin: 9px 0 0; color: var(--gm-muted); font-size: 11px; line-height: 1.55; }
.gm-guide__advanced summary:focus-visible { outline: 2px solid var(--gm-gem); outline-offset: 4px; }

.gm-guide__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 26px;
}

#gm-guide-start {
  min-width: 190px;
  padding: 12px 18px;
  border: 1px solid var(--gm-gem);
  border-radius: 2px;
  color: #08121b;
  background: var(--gm-gem);
  font: 700 11px/1 Bahnschrift, "Segoe UI", sans-serif;
  letter-spacing: 0.16em;
  cursor: pointer;
  box-shadow: 0 0 26px rgba(143, 216, 255, 0.15);
}

#gm-guide-restart {
  padding: 11px 16px;
  border: 1px solid rgba(143, 216, 255, 0.4);
  border-radius: 2px;
  color: var(--gm-gem);
  background: transparent;
  font: 700 10px/1 Bahnschrift, "Segoe UI", sans-serif;
  letter-spacing: 0.14em;
  cursor: pointer;
}

#gm-guide-restart[hidden] { display: none; }
#gm-guide-restart:hover { background: rgba(143, 216, 255, 0.08); }

#gm-guide-start:hover,
#gm-guide-start:focus-visible {
  background: #c9edff;
  outline: 2px solid rgba(143, 216, 255, 0.34);
  outline-offset: 3px;
}

#gm-guide-start:disabled {
  cursor: wait;
  filter: saturate(0.2);
  opacity: 0.55;
  box-shadow: none;
}

.gm-guide__actions > span {
  color: var(--gm-muted);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-align: right;
}

#gm-guide.is-verdict .gm-guide__card { width: min(560px, 100%); }
#gm-guide.is-verdict .gm-guide__advanced,
#gm-guide.is-verdict .gm-guide__objective,
#gm-guide.is-verdict .gm-guide__controls,
#gm-guide.is-verdict .gm-guide__tip { display: none; }
#gm-guide.is-verdict .gm-guide__lead { margin-bottom: 8px; }
#gm-guide.is-verdict .gm-guide__actions { justify-content: flex-start; flex-wrap: wrap; }
#gm-guide.is-verdict .gm-guide__actions > span { flex-basis: 100%; text-align: left; }

/* ── Boot veil ──────────────────────────────────────────────────────────── */

#gm-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: var(--gm-void);
  letter-spacing: 0.2em;
  z-index: 8;
  transition: opacity 500ms ease;
}

#gm-loading.is-gone { opacity: 0; pointer-events: none; }
#gm-loading[hidden] { display: none; }

#gm-loading-bar {
  display: block;
  width: 40%;
  height: 3px;
  background: var(--gm-accent);
  transition: width 200ms ease;
}

#gm-loading-pct {
  color: var(--gm-muted);
  font-variant-numeric: tabular-nums;
}

/* ── Error panel ────────────────────────────────────────────────────────── */

#gm-error {
  position: absolute;
  inset: 12% 18%;
  padding: 24px;
  overflow: auto;
  background: var(--gm-panel);
  border: 1px solid var(--gm-danger);
  pointer-events: auto;
  z-index: 10;
}

#gm-error[hidden] { display: none; }

#gm-error-title {
  margin: 0 0 8px;
  font-size: 16px;
  letter-spacing: 0.18em;
  color: var(--gm-danger);
}

#gm-error-detail {
  max-height: 40vh;
  overflow: auto;
  padding: 8px;
  background: rgba(0, 0, 0, 0.5);
  color: var(--gm-muted);
  font-size: 11px;
  white-space: pre-wrap;
}

#gm-error-detail[hidden] { display: none; }

#gm-error-reload {
  margin-top: 12px;
  padding: 6px 16px;
  background: transparent;
  border: 1px solid var(--gm-accent);
  border-radius: 1px;
  color: var(--gm-accent);
  font: inherit;
  letter-spacing: 0.16em;
  cursor: pointer;
  pointer-events: auto;
}

#gm-error-reload:hover { background: rgba(201, 162, 39, 0.14); }

/* ── Narrow viewports ───────────────────────────────────────────────────── */

/* The action deck leaves the hunter silhouette clear at the centre. */
#gm-play-tools {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: min(660px, calc(100vw - 36px));
  border: 1px solid rgba(143, 216, 255, 0.23);
  background: linear-gradient(125deg, rgba(12, 23, 36, 0.94), rgba(7, 14, 26, 0.94));
  box-shadow: 0 12px 40px #0005;
  backdrop-filter: blur(8px);
}
#gm-play-tools[hidden], #gm-target[hidden], #gm-objective-progress[hidden],
#gm-session-open[hidden], #gm-session-invite[hidden], #gm-guide-live[hidden] { display: none; }
#gm-target {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: 90%;
  padding: 7px 13px;
  box-sizing: border-box;
  color: #c9edff;
  background: rgba(7, 14, 26, 0.9);
  border: 1px solid rgba(143, 216, 255, 0.38);
  border-radius: 2px;
  font-size: 10px;
  text-align: center;
  overflow-wrap: anywhere;
}
#gm-objective { display: flex; align-items: center; gap: 14px; padding: 11px 14px; border-bottom: 1px solid var(--gm-panel-edge); }
#gm-objective b { flex-shrink: 0; color: #dbbd58; font-size: 9px; letter-spacing: 0.13em; }
#gm-objective span { color: #bccbd9; font-size: 10px; line-height: 1.4; letter-spacing: 0.025em; }
#gm-objective-progress { display: block; width: 100%; height: 4px; border: 0; accent-color: var(--gm-gem); background: #142031; }
#gm-objective-progress::-webkit-progress-bar { background: #142031; }
#gm-objective-progress::-webkit-progress-value { background: var(--gm-gem); }
#gm-recovery { padding: 6px 12px; color: var(--gm-gem); font-size: 10px; line-height: 1.4; border-bottom: 1px solid var(--gm-panel-edge); overflow-wrap: anywhere; }
#gm-actions { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 4px; padding: 8px; }
#gm-actions button {
  pointer-events: auto;
  display: grid;
  justify-items: center;
  gap: 5px;
  min-width: 0;
  padding: 9px 3px;
  border: 1px solid transparent;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.025);
  color: #9baabd;
  cursor: pointer;
  font-family: inherit;
}
#gm-actions b { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
#gm-actions small { font-size: 9px; line-height: 1.2; letter-spacing: 0; }
#gm-actions button[aria-disabled="true"] kbd { color: #99aabb; border-color: #728ca650; }
#gm-actions .is-ready { color: #c3edf3; background: rgba(105, 205, 192, 0.075); border-color: rgba(105, 205, 192, 0.28); }
#gm-actions .is-ready kbd { color: #baffed; border-color: #82d4c575; }
#gm-actions button:hover { background: rgba(143, 216, 255, 0.12); }
.gm-play-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 12px 9px; color: #8fa1b7; font-size: 9px; letter-spacing: 0.025em; }
#gm-help-open { pointer-events: auto; border: 0; background: transparent; padding: 0; color: #b8c8d9; font: inherit; cursor: pointer; }
#gm-messages { position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; width: min(600px, 75vw); }
#gm-messages .gm-familiar, #gm-messages .gm-toast { position: static; transform: none; max-width: 100%; }
#gm-messages .gm-familiar { font-size: 12px; padding: 6px 12px; }
body:has(#gm-play-tools:not([hidden])) #gm-messages { bottom: calc(var(--gm-play-height, 156px) + 60px); }

#gm-session-open {
  display: flex; align-items: center; gap: 8px; pointer-events: auto;
  padding: 9px 11px; width: 100%; border: 1px solid var(--gm-panel-edge);
  color: #b8c8d9; background: rgba(9, 14, 30, 0.9); font: 600 10px/1 Bahnschrift, "Segoe UI", sans-serif;
  letter-spacing: 0.12em; cursor: pointer;
}
#gm-session-open kbd { margin-left: auto; }
.gm-live-dot { width: 5px; height: 5px; border-radius: 50%; background: #8bd4ac; box-shadow: 0 0 9px #8bd4ac70; }
#gm-session { width: min(560px, calc(100vw - 36px)); max-height: calc(100dvh - 48px); box-sizing: border-box; padding: 28px; overflow-y: auto; color: var(--gm-text); background: linear-gradient(135deg, #101e2e, #080f1f); border: 1px solid #8fd8ff55; border-radius: 3px; box-shadow: 0 25px 100px #0009; }
#gm-session::backdrop { background: #030813ae; backdrop-filter: blur(6px); }
.gm-session__head { display: flex; align-items: center; justify-content: space-between; color: var(--gm-gem); font-size: 10px; letter-spacing: 0.17em; gap: 12px; }
#gm-session button, #gm-session select { border: 1px solid #8fd8ff55; border-radius: 2px; background: #112034; color: #c9edff; padding: 10px 12px; font: 600 10px/1.2 Bahnschrift, "Segoe UI", sans-serif; letter-spacing: 0.06em; cursor: pointer; }
#gm-session button:hover { background: #1a3147; }
#gm-session h2 { margin: 25px 0 6px; font-size: 25px; letter-spacing: -0.025em; }
#gm-session p { color: #a9b8ca; font-size: 12px; line-height: 1.6; }
#gm-session-clock { margin-top: 0; }
#gm-session-seats { list-style: none; margin: 20px 0 24px; padding: 0; border-top: 1px solid var(--gm-panel-edge); }
#gm-session-seats li { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 13px 0; border-bottom: 1px solid var(--gm-panel-edge); font-size: 12px; }
#gm-session-seats b { font-weight: 500; overflow-wrap: anywhere; min-width: 0; }
#gm-session-seats span { color: #dbbd58; font-size: 9px; letter-spacing: 0.1em; flex-shrink: 0; }
#gm-session-seats .is-live { color: #8bd4ac; }
.gm-session__label { color: var(--gm-gem); font-size: 9px; letter-spacing: 0.15em; }
#gm-session-code { display: block; color: #fff; font-size: 33px; font-weight: 700; letter-spacing: 0.22em; margin: 8px 0; }
#gm-session-prompt { resize: vertical; box-sizing: border-box; width: 100%; padding: 12px; margin-bottom: 12px; color: #c5d9e6; background: #050c16; border: 1px solid #8fd8ff40; font: 12px/1.6 Bahnschrift, "Segoe UI", sans-serif; }
#gm-session-copy-status { color: #8bd4ac; font-size: 11px; padding-left: 10px; }
#gm-session .gm-session__note { font-size: 11px; color: #869ab1; }
.gm-session__settings { display: flex; gap: 10px; align-items: center; padding-top: 18px; margin-top: 20px; border-top: 1px solid var(--gm-panel-edge); }
.gm-session__settings label { color: #8fa1b7; font-size: 9px; letter-spacing: 0.1em; }
#gm-fullscreen { margin-left: auto; }
.gm-guide__live { color: #dbbd58; font-size: 11px; line-height: 1.5; margin: -12px 0 18px; }
#gm-guide { overflow-y: auto; }
.gm-guide__card { flex-shrink: 0; margin: auto; }
button:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--gm-gem); outline-offset: 3px; }

@media (max-width: 1050px) {
  #gm-audio-toggles { bottom: 190px; right: 14px; }
}

@media (max-width: 720px) {
  #gm-vitals { width: 176px; }
  #gm-right { width: 176px; }
  #gm-roster { max-height: 34vh; }
  #gm-hint { display: none; }
  .gm-familiar { max-width: 88vw; font-size: 12px; bottom: 76px; }
  .gm-guide__controls { grid-template-columns: repeat(2, 1fr); }
  .gm-guide__objective { grid-template-columns: 1fr; gap: 5px; }
  .gm-guide__objective i { display: none; }
  .gm-guide__actions { align-items: stretch; flex-direction: column; }
  .gm-guide__actions > span { text-align: left; }
  .gm-title__choices { grid-template-columns: 1fr; }
  .gm-title__card { margin: auto 0; }
  .gm-title__card footer { flex-direction: column; }
  #gm-vitals { top: 8px; left: 8px; width: min(176px, calc(50vw - 36px)); padding: 8px; }
  .gm-readouts { grid-template-columns: minmax(0, 1fr); }
  .gm-readout__v { font-size: 12px; }
  #gm-retinue { flex-wrap: wrap; }
  #gm-retinue .gm-orders { order: 1; flex-basis: 100%; }
  #gm-right { top: 8px; right: 8px; width: min(176px, calc(50vw - 18px)); }
  #gm-session-open { font-size: 8px; padding: 7px; letter-spacing: 0.03em; }
  #gm-session-open kbd { display: none; }
  #gm-objective { align-items: flex-start; flex-direction: column; gap: 4px; padding: 9px 12px; }
  #gm-actions { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2px; padding: 5px; }
  #gm-actions b { font-size: 9px; letter-spacing: 0; }
  #gm-actions small { font-size: 8px; min-height: 20px; }
  .gm-play-footer { font-size: 8px; }
  .gm-play-footer > span { max-width: 55%; line-height: 1.4; }
  #gm-audio-toggles { top: calc(var(--gm-right-height, 34vh) + 16px); bottom: auto; }

  #gm-session { padding: 20px; }
  .gm-session__settings { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  #gm-clock.is-extracting .gm-readout__v { animation: none; }
  #gm-retinue.is-pinned .gm-readout__v { animation: none; }
  #gm-bearing.is-here .gm-readout__v { animation: none; }
  .gm-meter__fill,
  .gm-crew__heat-fill,
  .gm-toast__item,
  .gm-familiar { transition: none; }
  #gm-guide { backdrop-filter: none; }
  #gm-title { backdrop-filter: none; }
}
