:root {
  color-scheme: dark;
  --ink: #f5efe4;
  --muted: #b9b09f;
  --panel: #282631;
  --panel-2: #34313d;
  --line: #514c5d;
  --gold: #ffd27a;
  --focus: #83d8ff;
  --error: #ffb2a7;
  --live: #a52d27;
  font: 15px/1.45 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: #191820;
  color: var(--ink);
}

button, select, input { font: inherit; }

button, select {
  min-height: 2.4rem;
  border: 1px solid var(--line);
  border-radius: .35rem;
  background: var(--panel-2);
  color: var(--ink);
  padding: .35rem .7rem;
}

button:hover:not(:disabled), select:hover:not(:disabled) { border-color: var(--gold); }
button:disabled, select:disabled, input:disabled { opacity: .55; cursor: not-allowed; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

.masthead {
  display: grid;
  grid-template-columns: minmax(15rem, 1fr) auto auto;
  gap: 1rem 2rem;
  align-items: center;
  padding: .85rem clamp(1rem, 3vw, 2.5rem);
  background: #24222c;
  border-bottom: 1px solid var(--line);
}

.eyebrow { margin: 0; color: var(--gold); font-size: .72rem; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
h1 { margin: .1rem 0 0; font-size: clamp(1.35rem, 3vw, 2rem); line-height: 1.05; }
.record-note { margin: .35rem 0 0; color: var(--gold); font-weight: 750; }
.readout { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.readout time { color: var(--gold); font: 800 1.4rem/1 ui-monospace, monospace; }
#scene-event { color: #ffbd63; font-weight: 800; }
.badge { border: 1px solid var(--line); border-radius: 999px; padding: .2rem .55rem; font-size: .75rem; font-weight: 900; letter-spacing: .08em; }
.badge.live { background: var(--live); border-color: #ff938c; }
.controls { display: flex; gap: .5rem; align-items: center; }

main { max-width: 1800px; margin: 0 auto; }
.status { margin: .8rem clamp(1rem, 2vw, 1.5rem) 0; min-height: 1.5rem; color: var(--muted); }
.status.error { color: var(--error); font-weight: 700; }
.status.stale { color: #ffd58f; font-weight: 700; }

.hall-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 21rem;
  gap: 1rem;
  padding: .8rem clamp(1rem, 2vw, 1.5rem) 1.2rem;
  align-items: start;
}

.scene-wrap { position: relative; min-width: 0; }
canvas {
  display: block;
  width: 100%;
  height: clamp(320px, 42vw, 580px);
  touch-action: none;
  cursor: grab;
  border: 0 solid solid var(--line);
  border-radius: .3rem;
  background: #100f15;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.tooltip {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  max-width: min(24rem, 80vw);
  padding: .35rem .55rem;
  border: 1px solid #ffffff52;
  border-radius: .3rem;
  background: #07070aeb;
  color: white;
  font-size: .82rem;
}

.timeline-controls { margin-top: .7rem; }
.timeline-controls > label { display: block; color: var(--muted); font-size: .8rem; }
#scrubber { width: 100%; accent-color: var(--gold); }
.timeline-meta { display: flex; justify-content: space-between; color: var(--muted); font: .75rem ui-monospace, monospace; }
#now-marker { color: #ff8b82; font-weight: 800; }

.detail {
  min-height: 13rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: .4rem;
  background: var(--panel);
}
.detail h2 { margin: 0 0 .25rem; font-size: 1.2rem; overflow-wrap: anywhere; }
.detail h3 { margin: .85rem 0 .25rem; font-size: .95rem; color: var(--gold); }
.detail p { margin: .35rem 0; overflow-wrap: anywhere; }
.detail ul { margin: .4rem 0 0; padding-left: 1.25rem; }
.muted { color: var(--muted); }
.system { color: var(--gold); font-weight: 750; }

.table-list { padding: 0 clamp(1rem, 2vw, 1.5rem) 2rem; }
.table-list h2 { font-size: 1.25rem; }
.table-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(22rem, 100%), 1fr)); gap: .8rem; }
.table-card { border: 1px solid var(--line); border-radius: .4rem; padding: .8rem; background: #22202a; }
.table-card h3 { margin: 0; font-size: 1rem; }
.table-card h3 button { width: 100%; text-align: left; font-weight: 800; overflow-wrap: anywhere; }
.table-card p { margin: .4rem 0; overflow-wrap: anywhere; }
.table-card dl { display: grid; grid-template-columns: max-content 1fr; gap: .2rem .6rem; margin: .5rem 0; }
.table-card dt { color: var(--muted); }
.table-card dd { margin: 0; }
.roster { margin: .4rem 0 0; padding-left: 1.25rem; }

footer { border-top: 1px solid #34313d; padding: 1rem clamp(1rem, 3vw, 2.5rem) 2rem; color: var(--muted); font-size: .8rem; }
footer p { margin: .2rem 0; }

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

@media (max-width: 1050px) {
  .masthead { grid-template-columns: 1fr auto; }
  .controls { grid-column: 1 / -1; }
  .hall-layout { grid-template-columns: 1fr; }
  .detail { min-height: 0; }
}

@media (max-width: 650px) {
  .masthead { grid-template-columns: 1fr; gap: .7rem; }
  .controls { grid-column: auto; flex-wrap: wrap; }
  .readout { justify-content: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .001ms !important; animation-iteration-count: 1 !important; }
}

.orientation { max-width: 44rem; margin: .7rem 0; color: var(--muted); }
.event-actions, .camera-controls { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; }
.event-actions a { display: inline-block; border-radius: .35rem; padding: .55rem .8rem; background: var(--gold); color: #24222c; font-weight: 750; }
.event-actions details { position: relative; }
.event-actions summary { cursor: pointer; padding: .5rem; }
.qr-image { display: block; width: 200px; height: 200px; margin: .5rem; }
.qr-panel { position: absolute; z-index: 10; padding: .5rem; background: var(--panel); border: 1px solid var(--line); }
.qr-panel p { max-width: 220px; overflow-wrap: anywhere; font-size: .8rem; }
.hall-explorer > summary { cursor: pointer; margin: 0 1.5rem; padding: .75rem 0; font-weight: 750; color: var(--gold); }
.camera-help { color: var(--muted); font-size: .8rem; margin: .5rem 0; }
.table-list { padding-bottom: 1rem; }
.join-instructions { color: var(--gold); }
canvas:active { cursor: grabbing; }
@media (max-width: 650px) {
  .event-actions details { display: none; }
  #hall-content > .detail { margin: 0 1rem 1rem; }
  .camera-controls button { min-height: 44px; }
}
