:root {
  color-scheme: dark;
  font-family: Inter, system-ui, sans-serif;
  color: #f4f1ea;
  background: #020306;
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}
canvas {
  display: block;
  position: fixed;
  inset: 0;
}
h1 {
  position: fixed;
  z-index: 2;
  top: max(20px, env(safe-area-inset-top));
  left: 0;
  right: 0;
  margin: 0;
  text-align: center;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.42em;
  pointer-events: none;
}
#narrator {
  position: fixed;
  z-index: 4;
  bottom: max(16px, env(safe-area-inset-bottom));
  left: 0;
  right: 0;
  margin: 0;
  text-align: center;
  padding: 0 24px;
  font:
    italic clamp(18px, 2.2vw, 26px) 'Instrument Serif',
    serif;
  text-shadow: 0 2px 12px #000;
  pointer-events: none;
}
#overlay,
#pack-overlay {
  position: fixed;
  z-index: 3;
  inset: 0;
  pointer-events: none;
}
#overlay > * {
  pointer-events: auto;
}
.identity {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 20px;
  background: #020306ed;
  text-align: center;
}
.identity h2 {
  letter-spacing: 0.2em;
  font-size: 20px;
}
.identity input {
  border: 0;
  border-bottom: 1px solid #7597a8;
  background: transparent;
  color: white;
  padding: 14px;
  font: inherit;
  text-align: center;
  max-width: 300px;
}
.identity button,
.primary {
  font: 700 12px Inter;
  letter-spacing: 0.18em;
  padding: 15px 30px;
  border: 1px solid #e7c384;
  background: #e7c384;
  color: #07111d;
}
.identity small {
  max-width: 300px;
  line-height: 1.7;
  color: #a5b6c2;
}
.feed,
.plate,
.game-page {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: min(720px, 90vw);
  top: 14%;
  max-height: 72%;
  overflow: auto;
  overscroll-behavior: contain;
  font-variant-numeric: tabular-nums;
}
.strip,
.plate,
.game-page {
  background: #07101ad9;
  backdrop-filter: blur(16px);
  border: 1px solid #a8d1ec22;
}
.strip {
  padding: 16px 20px;
  margin: 0 0 8px;
  line-height: 1.6;
}
.strip button,
.text-action {
  background: none;
  color: #e7c384;
  border: 0;
  padding: 4px 0;
  font: inherit;
  cursor: pointer;
  text-align: left;
}
.label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.2em;
  color: #98b6cb;
}
.plate {
  top: auto;
  bottom: 13%;
  padding: 22px;
  width: min(560px, 90vw);
  max-height: 38%;
}
.plate h2,
.game-page h2 {
  margin: 0 0 16px;
  font-size: 18px;
}
.bars {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 24px;
}
.bar {
  font-size: 10px;
  letter-spacing: 0.04em;
}
.bar meter {
  width: 100%;
  height: 8px;
  display: block;
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
th,
td {
  padding: 10px 7px;
  border-bottom: 1px solid #ffffff15;
  text-align: right;
  white-space: nowrap;
}
th:first-child,
td:first-child {
  text-align: left;
}
caption {
  text-align: left;
  padding: 14px 0;
  color: #98b6cb;
  font-size: 11px;
}
.game-page {
  padding: 24px;
}
.score {
  text-align: center;
  font-size: clamp(24px, 4vw, 40px);
  font-weight: 900;
  margin: 16px 0;
}
.bug {
  position: absolute;
  top: 10%;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  padding: 10px 20px;
  background: #020306bb;
  letter-spacing: 0.1em;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.end {
  position: absolute;
  bottom: 16%;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
}
.hot {
  color: #ff9373;
}
.cold {
  color: #8fc6ff;
}
.muted {
  color: #a6b8c5;
  font-size: 12px;
  line-height: 1.7;
}
.call-sides {
  display: flex;
  gap: 24px;
}
.call-sides button {
  min-height: 40px;
  touch-action: none;
}
.call-sides .selected {
  color: white;
  text-decoration: underline;
}
.projected {
  position: absolute;
  transform: translate(-50%, -50%);
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-shadow: 0 2px 8px #000;
}
#pack-overlay[hidden] {
  display: none;
}
.error {
  color: #ffa08b;
}
.wp {
  width: 100%;
  height: 120px;
}
svg text {
  fill: #9bb4c5;
  font-size: 10px;
}
@media (max-width: 600px) {
  .feed {
    top: 12%;
    max-height: 75%;
    width: 92vw;
  }
  .strip {
    padding: 12px 14px;
    font-size: 12px;
  }
  .game-page {
    padding: 16px;
    width: 96vw;
  }
  .game-page table {
    font-size: 10px;
  }
  td,
  th {
    padding: 9px 4px;
  }
  .plate {
    bottom: 12%;
    padding: 16px;
  }
  .bug {
    font-size: 11px;
    padding: 9px 10px;
  }
  .bars {
    gap: 8px 16px;
  }
}
@media (max-height: 500px) {
  .plate {
    right: 4%;
    left: auto;
    transform: none;
    top: 17%;
    bottom: auto;
    width: 40vw;
    max-height: 68%;
  }
  .feed,
  .game-page {
    top: 12%;
    max-height: 72%;
  }
}
.pack-heading,
.pack-narration,
.pack-card-caption,
.pack-inspect {
  position: absolute;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 12px #000;
  pointer-events: none;
}
.pack-heading {
  top: 10%;
  width: 100%;
  text-align: center;
  font-size: 11px;
  letter-spacing: 0.15em;
}
.pack-narration {
  bottom: 15%;
  width: 100%;
  text-align: center;
  font:
    italic 20px 'Instrument Serif',
    serif;
}
.pack-inspect {
  font-size: 11px;
  line-height: 1.8;
  color: #dce9f1;
}
.pack-card-caption {
  font-size: 11px;
  font-weight: 700;
}
.pack-inspect meter {
  height: 6px;
}
.fit-plate {
  width: min(94vw, 640px);
  font-size: 10px;
  letter-spacing: 0;
  line-height: 1.7;
  color: #bed0dc;
}
.fit-plate b {
  font-size: 11px;
  color: #fff;
}
#overlay > .projected {
  pointer-events: none;
}
/* A quick dark tunnel cut masks the jump between isolated physical sets. */
body.whip::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 70%, #142331, #020306 65%);
  backdrop-filter: blur(12px);
  animation: tunnel-whip 0.32s ease-out forwards;
}
@keyframes tunnel-whip {
  0%,
  30% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}
.bug {
  top: max(68px, 9%);
  left: max(16px, env(safe-area-inset-left));
  transform: none;
  min-width: 142px;
  padding: 9px 12px;
  letter-spacing: 0.04em;
  border: 1px solid #b3ccdf33;
  border-radius: 3px;
}
.bug-clock {
  font-size: 9px;
  color: #a9becd;
  letter-spacing: 0.16em;
  margin-bottom: 6px;
}
.bug-team {
  display: grid;
  grid-template-columns: 3.2em 2.4em auto;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
}
.bug-team abbr {
  text-decoration: none;
  font-size: 12px;
}
.bug-team strong {
  text-align: right;
  font-size: 17px;
}
.edge-chip {
  border: 1px solid #d1b47755;
  color: #e7c384;
  font-size: 8px;
  padding: 2px 4px;
  white-space: nowrap;
}
.court-final {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 10vh 7vw;
  background: linear-gradient(#020610aa, #020610ed);
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.final-score {
  padding: 22px 30px;
  background: #0b1c2de8;
  border: 1px solid #b2d7f033;
}
.final-score .bug-team {
  grid-template-columns: 3em 2.6em auto;
  gap: 18px;
}
.final-score .bug-team abbr {
  font-size: 21px;
}
.final-score .bug-team strong {
  font-size: 40px;
}
.humiliation {
  max-width: 460px;
  margin: 0;
  font:
    italic 23px 'Instrument Serif',
    serif;
}
#narrator[hidden] {
  display: none;
}

.account {
  position: absolute;
  bottom: 8%;
  left: 5%;
  font-size: 11px;
  color: #a6b8c5;
}
.account button {
  color: inherit;
  background: transparent;
  border: 0;
  font: inherit;
  cursor: pointer;
}
.league-moment {
  position: absolute;
  left: 50%;
  top: 18%;
  transform: translateX(-50%);
  width: min(88vw, 440px);
  max-height: 65%;
  overflow: auto;
  text-align: center;
  z-index: 11;
  background: #07101a;
  padding: 24px;
}
.league-moment h2 {
  font-size: 13px;
  letter-spacing: 0.2em;
}
.league-moment ul {
  list-style: none;
  padding: 0;
}
.league-moment li {
  padding: 8px;
  touch-action: pan-y;
}
.league-moment label {
  display: block;
  padding: 8px;
}
.league-moment input {
  width: 60px;
  margin-left: 12px;
}

.push-moment {
  position: fixed;
  z-index: 12;
  bottom: 14%;
  left: 50%;
  transform: translateX(-50%);
  padding: 24px;
  width: min(88vw, 400px);
  text-align: center;
  background: #07101af5;
}

.gesture-hint {
  position: absolute;
  bottom: 6%;
  width: 100%;
  padding: 0 24px;
  text-align: center;
  color: #a6b8c5;
  font-size: 11px;
  pointer-events: none;
}
.league-moment label:has([data-preference]) {
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
  min-height: 44px;
  gap: 12px;
  font-size: 12px;
}

.league-moment .invite-copy {
  display: block;
  width: 100%;
  margin: 16px 0 0;
  padding: 10px;
  color: #fff;
  background: transparent;
  border: 1px solid #a6b8c5;
  font:
    12px Inter,
    sans-serif;
}

/* ---------- First screen: the players' tunnel (concept: assets/concepts/first-screen/hybrid.jpg) ---------- */
body:has(.tunnel) #title,
body:has(.tunnel) #narrator {
  display: none;
}
.tunnel {
  position: fixed;
  inset: 0;
  z-index: 20;
  overflow: hidden;
  background: #000;
  color: #f3ead6;
  font-family: Inter, system-ui, sans-serif;
}
/* The plate keeps its photo's aspect and covers the viewport; the jumbotron text rides inside it. */
.tunnel .backplate {
  position: absolute;
  top: 50%;
  right: 0;
  aspect-ratio: 4096 / 2294;
  width: max(100vw, calc(100vh * 4096 / 2294));
  transform: translateY(-50%);
  container-type: size;
}
.tunnel .scene {
  position: absolute;
  inset: 0;
  background: url('../img/tunnel-wide.webp') center / 100% 100% no-repeat;
  transform-origin: 70% 38%;
  animation: tunnel-push 28s ease-in-out infinite alternate;
}
.tunnel .scene::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 30% 22% at 70% 82%, #ffcf7a33, transparent 70%);
  mix-blend-mode: screen;
  animation: tunnel-glint 7s ease-in-out infinite alternate;
}
.tunnel .backplate::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #000 0%, #000c 22%, #0000 46%);
}
@keyframes tunnel-push {
  from { transform: scale(1); }
  to { transform: scale(1.06); }
}
@keyframes tunnel-glint {
  from { opacity: 0.35; }
  to { opacity: 1; }
}
.tunnel .jumbo {
  position: absolute;
  left: 62.68%;
  top: 8.11%;
  width: 15.09%;
  height: 17.45%;
  display: grid;
  place-items: center;
  text-align: center;
  font: 700 1.85cqw/1.02 Oswald, Impact, sans-serif;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #ffd25a;
  text-shadow: 0 0 0.35cqw #ffb81c, 0 0 1.2cqw #ffb81c88;
  background: repeating-linear-gradient(0deg, #0000 0 2px, #0003 2px 3px);
  animation: tunnel-led 4.5s steps(1) infinite;
}
.tunnel .jumbo span {
  padding: 0 6%;
}
@keyframes tunnel-led {
  0%, 100% { opacity: 1; }
  96% { opacity: 0.86; }
}
.tunnel .copy {
  position: absolute;
  left: max(28px, 6vw);
  top: 50%;
  transform: translateY(-50%);
  width: min(36vw, 640px);
}
.tunnel .brand {
  position: absolute;
  top: max(24px, 4vh);
  left: max(28px, 6vw);
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.32em;
  color: #fdb927;
}
.tunnel .brand b {
  color: #8f5bd6;
  font-weight: 600;
}
.tunnel h2 {
  margin: 0 0 18px;
  font: 500 clamp(54px, 5.3vw, 104px) / 0.95 'Playfair Display', Georgia, serif;
  white-space: nowrap;
  letter-spacing: -0.02em;
  color: #fdb927;
  text-shadow: 0 2px 30px #0008;
}
.tunnel .meta {
  margin: 0 0 26px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #eadbb5;
}
.tunnel .seats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0 0 28px;
  padding: 0;
  list-style: none;
}
.tunnel .seat {
  position: relative;
  width: clamp(64px, 6.4vw, 104px);
  aspect-ratio: 5 / 7;
  border: 1px solid #fdb92766;
  background: #07060a;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.tunnel .seat.gold,
.tunnel .seat.filled {
  border-color: #fdb927;
  background: linear-gradient(135deg, #8a5a12, #f6cf62 30%, #b07a1c 55%, #ffe08a 75%, #9c6a16);
  box-shadow: 0 8px 30px #fdb92733, inset 0 0 0 1px #fff4;
  animation: seat-arrive 0.9s cubic-bezier(0.2, 0.9, 0.2, 1.2) both;
}
.tunnel .seat.filled {
  background: linear-gradient(135deg, #2c1747, #6b3aa8 35%, #3a1d60 60%, #8a57c9 80%, #2c1747);
  border-color: #b48ae6;
}
.tunnel .seat-mark {
  position: absolute;
  inset: 0 0 18%;
  display: grid;
  place-items: center;
  font: 600 clamp(30px, 3.4vw, 54px) 'Playfair Display', Georgia, serif;
  color: #5a3a08;
  text-shadow: 0 1px 0 #ffe9a888, 0 -1px 0 #3a2404aa;
}
.tunnel .seat.filled .seat-mark {
  color: #e9dcff;
  text-shadow: 0 2px 10px #0008;
}
.tunnel .seat-name {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 8%;
  font-size: clamp(9px, 0.8vw, 12px);
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-align: center;
  color: #1a1206;
  line-height: 1.15;
  overflow-wrap: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  padding: 0 5px;
}
.tunnel .seat-name.long {
  font-size: clamp(7px, 0.62vw, 10px);
  letter-spacing: 0.04em;
}
.tunnel .seat.filled .seat-name {
  color: #f3ead6;
}
.tunnel .seat.open button {
  position: absolute;
  inset: 0;
  border: 0;
  background: none;
  color: #fdb927;
  font: 200 clamp(26px, 2.4vw, 38px) Inter, sans-serif;
  cursor: pointer;
}
.tunnel .seat.open:hover {
  border-color: #fdb927;
  background: #fdb92710;
}
@keyframes seat-arrive {
  from { transform: rotateY(90deg) scale(0.9); filter: brightness(2.2); }
  to { transform: none; filter: none; }
}
.tunnel button.primary {
  display: block;
  width: 100%;
  height: 64px;
  border: 0;
  border-radius: 2px;
  background: #fdb927;
  color: #1a1206;
  font: 700 15px Inter, sans-serif;
  letter-spacing: 0.24em;
  cursor: pointer;
  box-shadow: 0 10px 40px #fdb92733;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}
.tunnel button.primary:hover {
  background: #ffc53d;
  box-shadow: 0 14px 50px #fdb92755;
}
.tunnel button.primary:active {
  transform: scale(0.985);
}
.tunnel button.quiet {
  display: inline-block;
  margin-top: 18px;
  padding: 6px 0;
  border: 0;
  background: none;
  color: #fdb927;
  font: 500 15px Inter, sans-serif;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-color: #fdb92780;
  cursor: pointer;
}
.tunnel .note {
  margin: 16px 0 0;
  font-size: 13px;
  color: #a99e86;
}
.tunnel .settings {
  display: flex;
  gap: 18px;
  margin: 0 0 18px;
  font-size: 13px;
  color: #eadbb5;
}
.tunnel .settings input {
  width: 56px;
  margin-left: 8px;
  padding: 6px;
  border: 1px solid #fdb92766;
  background: #0008;
  color: #fff;
  font: inherit;
}
body:has(.tunnel) .account {
  position: fixed;
  z-index: 21;
  left: max(28px, 6vw);
  bottom: max(18px, 3vh);
  margin: 0;
  font-size: 12px;
  color: #8f8673;
}
body:has(.tunnel) .account button {
  border: 0;
  background: none;
  color: #b9ad92;
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}
/* Portrait phones: the tunnel takes the top, the copy sits on the dark floor below it. */
@media (orientation: portrait) {
  .tunnel .backplate {
    top: 0;
    right: auto;
    left: 50%;
    aspect-ratio: 2294 / 4096;
    width: max(100vw, calc(100vh * 2294 / 4096));
    transform: translateX(-50%);
  }
  .tunnel .scene {
    background-image: url('../img/tunnel-tall.webp');
    transform-origin: 50% 24%;
  }
  .tunnel .backplate::after {
    background: linear-gradient(180deg, #0000 38%, #000a 52%, #000 64%);
  }
  .tunnel .jumbo {
    left: 33.99%;
    top: 3.16%;
    width: 32.55%;
    height: 11.05%;
    font-size: 4.3cqw;
  }
  .tunnel .copy {
    left: 24px;
    right: 24px;
    top: auto;
    bottom: calc(52px + env(safe-area-inset-bottom));
    transform: none;
    width: auto;
    text-align: center;
  }
  .tunnel .brand {
    display: none;
  }
  .tunnel h2 {
    font-size: clamp(48px, 14.5vw, 84px);
    margin-bottom: 12px;
  }
  .tunnel .meta {
    font-size: 11px;
    margin-bottom: 20px;
  }
  .tunnel .seats {
    justify-content: center;
    gap: 10px;
    margin-bottom: 22px;
  }
  .tunnel .seat {
    width: clamp(58px, 19vw, 92px);
  }
  .tunnel .seat-name {
    font-size: 9px;
    letter-spacing: 0.08em;
  }
  .tunnel .settings {
    justify-content: center;
  }
  body:has(.tunnel) .account {
    left: 0;
    right: 0;
    text-align: center;
    bottom: calc(14px + env(safe-area-inset-bottom));
  }
}
@media (prefers-reduced-motion: reduce) {
  .tunnel .scene,
  .tunnel .scene::after,
  .tunnel .jumbo,
  .tunnel .seat {
    animation: none;
  }
}
