:root {
  color-scheme: dark;
  --ink: #f4ead8;
  --muted: #9b9180;
  --faint: #6d6558;
  --accent: #e39a4a;
  --accent-deep: #c45c1a;
  --line: rgba(244, 234, 216, 0.12);
  --hud: rgba(9, 11, 15, 0.62);
  --hud-strong: rgba(9, 11, 15, 0.82);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.42);
  --radius: 18px;
  --font: "Avenir Next", "Segoe UI Variable", "Segoe UI", "Helvetica Neue", sans-serif;
  --mono: "SF Mono", "Cascadia Code", "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --pad: 18px 20px;
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --ink: #1c1812;
    --muted: #5c564c;
    --faint: #857c6e;
    --accent: #c45c1a;
    --accent-deep: #9a3f0c;
    --line: rgba(28, 24, 18, 0.12);
    --hud: rgba(248, 242, 230, 0.78);
    --hud-strong: rgba(248, 242, 230, 0.92);
    --shadow: 0 16px 40px rgba(48, 32, 12, 0.14);
  }
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #020308;
  color: var(--ink);
  font-family: var(--font);
}

#viewport {
  position: fixed;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 40;
  padding: 8px 12px;
  background: var(--hud-strong);
  color: var(--ink);
  border-radius: 8px;
}

.skip-link:focus {
  top: 12px;
}

.hud {
  position: fixed;
  z-index: 8;
  background: var(--hud);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px) saturate(1.15);
  -webkit-backdrop-filter: blur(22px) saturate(1.15);
}

.overline {
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--faint);
}

.topbar {
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 12px 18px 12px 20px;
  width: max-content;
  max-width: min(420px, calc(100vw - 36px));
}

.brand h1 {
  font-size: 1.15rem;
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.topbar-status {
  margin-left: auto;
  text-align: right;
}

.clock {
  font-family: var(--mono);
  font-size: 0.86rem;
  font-variant-numeric: tabular-nums;
}

.rate {
  color: var(--muted);
  font-size: 0.72rem;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #3dba7a;
  box-shadow: 0 0 10px rgba(61, 186, 122, 0.8);
}

.live-pill[data-state="paused"] .live-dot {
  background: var(--accent);
  box-shadow: none;
}

.dossier {
  top: 18px;
  left: 18px;
  width: min(280px, calc(100vw - 36px));
  padding: var(--pad);
}

.dossier-head {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 10px 0 16px;
}

.swatch {
  width: 14px;
  height: 42px;
  border-radius: 99px;
  background: var(--accent);
  box-shadow: 0 0 18px color-mix(in srgb, var(--accent) 45%, transparent);
}

#body-name {
  font-size: 1.55rem;
  letter-spacing: -0.04em;
  line-height: 1;
}

.kind {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.8rem;
}

.metrics {
  display: grid;
  gap: 10px;
}

.metrics div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.metrics dt {
  color: var(--muted);
  font-size: 0.72rem;
}

.metrics dd {
  font-family: var(--mono);
  font-size: 0.74rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.action-row,
.toggle-row {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

button {
  font: inherit;
  color: var(--ink);
  background: color-mix(in srgb, var(--ink) 8%, transparent);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  cursor: pointer;
  flex: 1;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

button:hover {
  background: color-mix(in srgb, var(--ink) 14%, transparent);
}

button[aria-pressed="true"] {
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
}

button.ghost {
  font-size: 0.75rem;
}

.chronograph {
  top: 18px;
  right: 18px;
  width: min(250px, calc(100vw - 36px));
  padding: var(--pad);
}

.slider-block {
  margin: 12px 0 4px;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 18px;
  margin: 4px 0;
  background: transparent;
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent-deep), var(--accent));
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  margin-top: -6px;
  border-radius: 50%;
  background: var(--ink);
  border: 2px solid var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent);
  cursor: pointer;
}

input[type="range"]::-moz-range-track {
  height: 4px;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent-deep), var(--accent));
}

input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--ink);
  border: 2px solid var(--accent);
  cursor: pointer;
}

.rate-large {
  margin-top: 10px;
  font-family: var(--mono);
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.roster {
  left: 308px;
  right: 18px;
  bottom: 18px;
  width: auto;
  padding: 12px 14px 10px;
}

.roster-track {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 10px 2px 4px;
  scrollbar-width: thin;
}

.roster button {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 11px;
  font-size: 0.75rem;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  box-shadow: 0 0 10px currentColor;
}

.legend {
  left: 18px;
  bottom: 18px;
  max-width: min(280px, calc(100vw - 36px));
  padding: 12px 14px;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.7;
}

.legend .hint {
  color: var(--faint);
}

kbd {
  display: inline-block;
  min-width: 1.3em;
  padding: 1px 5px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 5px;
  font-family: var(--mono);
  font-size: 0.64rem;
  color: var(--ink);
}

.label-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 4;
}

.label {
  position: absolute;
  left: 0;
  top: 0;
  transform: translate(-50%, -140%);
  padding: 3px 7px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--hud-strong) 82%, transparent);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 0.66rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  opacity: 0.78;
}

.label.is-selected {
  opacity: 1;
  background: color-mix(in srgb, var(--accent) 22%, var(--hud-strong));
}

.boot {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-content: center;
  gap: 16px;
  background: #020308;
  color: #d9cbb3;
  text-align: center;
  transition: opacity 0.6s ease;
}

.boot.is-gone {
  opacity: 0;
  pointer-events: none;
}

.boot-mark {
  width: 54px;
  height: 54px;
  margin: 0 auto 4px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 40% 35%, #fff6d4 0 12%, #ffb347 28%, #c45c1a 52%, transparent 68%),
    radial-gradient(circle, rgba(255, 170, 60, 0.35), transparent 70%);
  box-shadow: 0 0 40px rgba(227, 154, 74, 0.45);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

*:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  .boot {
    transition: none;
  }
}

@media (max-width: 1180px) {
  .legend {
    display: none;
  }

  .topbar {
    top: 10px;
    gap: 12px;
    width: calc(100vw - 20px);
    max-width: none;
  }

  .dossier,
  .chronograph {
    top: auto;
    bottom: 92px;
    width: calc(50vw - 16px);
    padding: 14px;
  }

  .dossier {
    left: 10px;
  }

  .chronograph {
    right: 10px;
  }

  .roster {
    left: 10px;
    right: 10px;
    bottom: 10px;
    width: auto;
  }

  #body-name {
    font-size: 1.2rem;
  }
}

@media (max-width: 560px) {
  .topbar-status {
    display: none;
  }

  .dossier {
    top: 68px;
    left: 10px;
    right: 10px;
    bottom: auto;
    width: auto;
    max-height: 32vh;
    overflow: auto;
  }

  .chronograph {
    top: auto;
    left: 10px;
    right: 10px;
    bottom: 92px;
    width: auto;
  }

  .metrics div {
    flex-direction: column;
    gap: 2px;
  }
}
