@font-face {
  font-family: "Hughie Variable";
  src: url("fonts/hughie-variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Familjen Grotesk";
  src: url("fonts/familjen-grotesk.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}

:root {
  --navy: #12329a;
  --purple: #574ee0;
  --coral: #ff4839;
  --cream: #f8f4ed;
  --ink: #222222;
  --ink-2: #575760;
  --white: #ffffff;
  --radius: 18px;
  --shadow: 0 10px 30px rgb(18 50 154 / .18), 0 2px 6px rgb(0 0 0 / .08);
  --bar-h: 76px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font-head: "Hughie Variable", "Familjen Grotesk", system-ui, sans-serif;
  --font-body: "Familjen Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

.courtroom {
  position: relative;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: linear-gradient(#fbf7f0, #efe5d3);
}

/* ---------- header ---------- */
.top {
  position: absolute;
  z-index: 5;
  top: max(12px, env(safe-area-inset-top));
  left: 16px;
  padding: 10px 16px 12px;
  background: rgb(255 255 255 / .9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  pointer-events: none;
}
.eyebrow {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.top h1 {
  margin: 0;
  font-family: var(--font-head);
  font-weight: 800;
  font-size: clamp(22px, 5.4vw, 30px);
  line-height: 1.05;
  color: var(--navy);
}

/* ---------- stage ---------- */
.stage { position: absolute; inset: 0; }
.stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
  outline: none;
}
.stage canvas:active { cursor: grabbing; }
.loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  font-family: var(--font-head);
  font-size: 22px;
  color: var(--navy);
}
.loading[hidden] { display: none; }

/* ---------- pins ---------- */
.pins { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.pin {
  position: absolute;
  left: 0;
  top: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 14px 0 6px;
  border: 3px solid var(--white);
  border-radius: 999px;
  background: var(--navy);
  color: var(--white);
  font: 600 15px/1 var(--font-body);
  white-space: nowrap;
  box-shadow: var(--shadow);
  cursor: pointer;
  pointer-events: auto;
  translate: -50% -100%;
  transition: opacity .2s, background-color .2s;
  will-change: transform;
}
.pin .dot {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--white);
  color: var(--navy);
  font-weight: 700;
  font-size: 14px;
}
.pin::after {
  /* little stem pointing at the spot */
  content: "";
  position: absolute;
  left: 50%;
  bottom: -11px;
  translate: -50% 0;
  border: 7px solid transparent;
  border-top-color: var(--white);
}
.pin[data-you] { background: var(--purple); }
.pin[data-you] .dot { color: var(--purple); }
.pin:hover { background: #0d2577; }
.pin[data-you]:hover { background: #4239c2; }
.pin[aria-current="true"] { border-color: var(--coral); }
.pin[aria-current="true"]::after { border-top-color: var(--coral); }
.pins.has-active .pin:not([aria-current="true"]) { opacity: .55; }
.pin.off { visibility: hidden; }
.pin:focus-visible,
.btn:focus-visible {
  outline: 3px solid var(--coral);
  outline-offset: 3px;
}
.pin .short { display: none; }
@media (max-width: 599px) {
  .pin .long { display: none; }
  .pin .short { display: inline; }
  .pin { font-size: 14px; padding-right: 12px; min-height: 40px; }
  .pin .dot { width: 24px; height: 24px; font-size: 13px; }
  /* keep a 44px hit area on small screens */
  .pin::before { content: ""; position: absolute; inset: -4px -2px; }
}

/* ---------- hint ---------- */
.hint {
  position: absolute;
  z-index: 4;
  left: 50%;
  bottom: calc(var(--bar-h) + var(--safe-b) + 12px);
  translate: -50% 0;
  width: max-content;
  max-width: calc(100% - 32px);
  margin: 0;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgb(34 34 34 / .82);
  color: var(--white);
  font-size: 15px;
  text-align: center;
  pointer-events: none;
  transition: opacity .4s;
}
.hint.gone { opacity: 0; }

/* ---------- bottom bar ---------- */
.bar {
  position: absolute;
  z-index: 6;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 12px 16px calc(12px + var(--safe-b));
  pointer-events: none;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  font: 600 16px/1.1 var(--font-body);
  cursor: pointer;
  pointer-events: auto;
}
.btn[hidden] { display: none; }
.btn-seat { background: var(--purple); color: var(--white); box-shadow: var(--shadow); }
.btn-seat:hover { background: #4239c2; }
.btn-room { background: var(--white); color: var(--navy); box-shadow: var(--shadow); }
.btn-room:hover { background: #eef1fb; }
.btn-quiet { background: #eef1fb; color: var(--navy); min-height: 44px; padding: 0 16px; }
.btn-quiet:hover { background: #dfe5f8; }
.btn-quiet:disabled { opacity: .4; cursor: default; }

/* ---------- info card ---------- */
.card {
  position: absolute;
  z-index: 5;
  left: 12px;
  right: 12px;
  bottom: calc(var(--bar-h) + var(--safe-b));
  max-height: min(50dvh, 460px);
  overflow-y: auto;
  padding: 18px 20px 16px;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: card-in .28s ease-out;
}
.card[hidden] { display: none; }
@keyframes card-in { from { opacity: 0; translate: 0 16px; } }
.card-count {
  margin: 0 0 2px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-2);
}
.card h2 {
  margin: 0 0 8px;
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 28px;
  line-height: 1.1;
  color: var(--navy);
  outline: none;
}
.card-body p { margin: 0 0 10px; }
.card-body .tip {
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--cream);
  font-size: 16px;
}
.card-body .tip strong { color: var(--navy); }
.card-body .btn-seat { margin: 2px 0 12px; }
.card-nav {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 6px;
}

/* tablets & laptops: card becomes a side panel */
@media (min-width: 900px) and (min-height: 520px) {
  .card {
    left: auto;
    right: 20px;
    top: 50%;
    bottom: auto;
    translate: 0 -50%;
    width: 380px;
    max-height: calc(100dvh - 2 * (var(--bar-h) + 20px));
    padding: 24px 26px 20px;
    animation-name: card-in-side;
  }
  @keyframes card-in-side { from { opacity: 0; translate: 16px -50%; } }
  .card h2 { font-size: 32px; }
  .hint { bottom: calc(var(--bar-h) + 16px); }
}

/* ---------- fallback (no WebGL) ---------- */
.fallback {
  position: absolute;
  inset: 0;
  z-index: 8;
  overflow-y: auto;
  padding: 110px 16px 40px;
  background: var(--cream);
}
.fallback[hidden] { display: none; }
.fallback h2 { font-family: var(--font-head); color: var(--navy); margin-top: 0; }
.fallback article { background: var(--white); border-radius: var(--radius); padding: 16px 20px; margin: 0 0 14px; max-width: 640px; }
.fallback h3 { margin: 0 0 6px; color: var(--navy); }

@media (prefers-reduced-motion: reduce) {
  .card, .hint, .pin { animation: none; transition: none; }
}

/* phones: when a card is open, drop the header and shorten the bar buttons */
.btn .short { display: none; }
@media (max-width: 599px) {
  .courtroom[data-mode="stop"] .top {
    /* visually hidden, still announced as the page heading */
    clip-path: inset(50%); width: 1px; height: 1px; padding: 0; overflow: hidden; white-space: nowrap;
  }
  .courtroom[data-mode="stop"] .btn .long { display: none; }
  .courtroom[data-mode="stop"] .btn .short { display: inline; }
}

/* ---------- back link (standalone) & full screen (embedded) ---------- */
.back {
  display: inline-block;
  margin-top: 4px;
  font-size: 15px;
  font-weight: 600;
  color: var(--navy);
  pointer-events: auto;
}
.back:hover { color: #0d2577; }
.back:focus-visible { outline: 3px solid var(--coral); outline-offset: 2px; border-radius: 4px; }
.embed .top {
  /* the host page already has a heading; keep ours for screen readers only */
  clip-path: inset(50%); width: 1px; height: 1px; padding: 0; overflow: hidden; white-space: nowrap;
}
.embed .back { display: none; }
.btn-fs {
  position: absolute;
  z-index: 6;
  top: 12px;
  right: 12px;
  min-height: 44px;
  padding: 0 14px;
  background: rgb(255 255 255 / .94);
  color: var(--navy);
  font-size: 15px;
  box-shadow: var(--shadow);
}
.btn-fs:hover { background: #eef1fb; }
.embed .courtroom { border-radius: 0; }
