:root {
  color-scheme: dark;
  --bg: #0b0a07;
  --page: #0e0e13;
  --panel: #15110a;
  --panel-2: #1f1810;
  --line: #3a2c12;
  --ink: #ffb627;
  --dim: #937128;
  --bright: #ffe9b0;
  --accent: #ff7a00;
  --accent-2: #ffd24a;
  --good: #5ad469;
  --bad: #ff5239;
  --warn: #ffd400;
  --chip: #241b0e;
  --body-font: "Space Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --display-font: "VT323", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 5px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--page);
}

body {
  min-height: 100%;
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--body-font);
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

a {
  color: inherit;
}

.app-shell {
  width: min(100%, 384px);
  min-height: 100svh;
  margin: 0 auto;
  padding: 0;
}

.player-shell {
  width: 100%;
  min-height: 100svh;
  overflow: auto;
  background:
    repeating-linear-gradient(
      0deg,
      rgba(0, 0, 0, 0.16) 0,
      rgba(0, 0, 0, 0.16) 1px,
      transparent 1px,
      transparent 3px
    ),
    var(--bg);
  color: var(--ink);
}

.join-flow {
  display: flex;
  min-height: 100svh;
  flex-direction: column;
  padding: 30px 22px 24px;
}

.logo-lockup {
  margin-top: 8px;
  text-align: center;
}

.logo-type {
  color: var(--accent);
  font-family: var(--display-font);
  font-size: 52px;
  line-height: 0.82;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.logo-tag {
  margin-top: 16px;
  color: var(--dim);
  font-size: 12px;
  line-height: 1.4;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.led-panel,
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.panel-inner {
  padding: 16px;
}

.invite-card {
  margin-top: 26px;
  padding: 18px;
}

.logo-lockup + .led-panel {
  margin-top: 26px;
}

.panel-label,
label,
legend,
.scene-kicker,
.score-meta,
.score-footer,
.match-meta,
.eyebrow {
  color: var(--dim);
  font-size: 11px;
  line-height: 1.35;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.match-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 14px 0 6px;
}

.flag {
  display: inline-flex;
  min-width: 24px;
  justify-content: center;
  font-size: 24px;
  line-height: 1;
}

.match-code {
  color: var(--bright);
  font-family: var(--display-font);
  font-size: 26px;
  line-height: 1;
}

.match-meta {
  color: var(--accent-2);
  text-align: center;
}

.form-grid {
  display: grid;
  gap: 14px;
}

.join-form,
.compact-form {
  margin-top: 26px;
}

label {
  display: grid;
  gap: 8px;
}

input,
select {
  width: 100%;
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: 0;
  background: var(--chip);
  color: var(--ink);
  font-family: var(--display-font);
  font-size: 22px;
  line-height: 1;
  padding: 13px 14px;
}

input::placeholder {
  color: var(--ink);
  opacity: 0.82;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(255, 122, 0, 0.2);
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.side-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 0;
  border: 0;
  padding: 0;
}

.side-picker legend {
  grid-column: 1 / -1;
  margin-bottom: 0;
  padding: 0;
}

.side-tile {
  position: relative;
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--chip);
  color: var(--ink);
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 10px 8px;
  text-align: center;
}

.side-tile input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.side-tile span {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.25;
}

.side-tile:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent);
  color: #0b0a07;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 50px;
  border-radius: var(--radius);
  padding: 12px 14px;
  background: var(--accent);
  color: #0b0a07;
  cursor: pointer;
  font-family: var(--display-font);
  font-size: 24px;
  line-height: 1;
  letter-spacing: 0.04em;
  text-align: center;
  text-transform: uppercase;
}

.btn:hover,
.utility-btn:hover,
.option-btn:hover,
.power-btn:hover,
.reaction-btn:hover,
.template-btn:hover {
  filter: brightness(1.08);
}

.btn:disabled {
  cursor: not-allowed;
  filter: grayscale(0.75);
  opacity: 0.55;
}

.btn.secondary,
.btn.ghost {
  border: 1px solid var(--line);
  background: var(--chip);
  color: var(--ink);
}

.btn.gold {
  background: var(--warn);
  color: #15110a;
}

.btn.danger {
  background: var(--bad);
  color: #140201;
}

.operator-link,
.utility-btn {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--dim);
  cursor: pointer;
  font-size: 11px;
  letter-spacing: 0.12em;
  min-height: 36px;
  padding: 8px 10px;
  text-align: center;
  text-decoration: none;
  text-transform: uppercase;
}

.operator-link {
  margin-top: 18px;
}

.utility-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}

.room-flow {
  display: flex;
  min-height: 100svh;
  flex-direction: column;
  padding: 0 18px 22px;
}

.scoreboard {
  flex: none;
  margin: 0 -18px;
  border-bottom: 2px solid var(--line);
  background: var(--panel-2);
  padding: 14px 16px 12px;
}

.score-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.live-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
}

.live-label.is-live {
  color: var(--bad);
}

.live-label i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--bad);
  animation: oofLive 1.1s infinite;
}

.score-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.team {
  display: flex;
  min-width: 0;
  flex: 1;
  align-items: center;
  gap: 8px;
}

.away-team {
  justify-content: flex-end;
}

.team-name {
  overflow: hidden;
  color: var(--bright);
  font-family: var(--display-font);
  font-size: 18px;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.score-numbers {
  display: flex;
  align-items: baseline;
  gap: 10px;
  color: var(--ink);
  font-family: var(--display-font);
  font-size: 40px;
  line-height: 1;
}

.score-dot {
  color: var(--dim);
  font-size: 26px;
}

.score-clock {
  margin-top: 8px;
  color: var(--accent-2);
  font-family: var(--display-font);
  font-size: 22px;
  letter-spacing: 0.05em;
  line-height: 1;
  text-align: center;
}

.score-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 11px;
  border-top: 1px dashed var(--line);
  padding-top: 10px;
}

.score-footer b {
  color: var(--ink);
  font-size: 13px;
}

.score-footer em {
  color: var(--warn);
  font-style: normal;
}

.notify-btn {
  width: 100%;
  margin-top: 12px;
  padding: 9px 10px;
  border: 1px solid rgba(255, 182, 39, 0.38);
  border-radius: var(--radius);
  background: rgba(255, 182, 39, 0.08);
  color: var(--bright);
  cursor: pointer;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.notify-btn.enabled {
  border-color: rgba(90, 212, 105, 0.55);
  color: var(--good);
}

.scene-card {
  padding: 20px 0 0;
  animation: oofRise 0.25s ease-out;
}

.scene-kicker {
  color: var(--accent-2);
  font-weight: 700;
}

.prompt-question {
  margin: 14px 0 6px;
  color: var(--bright);
  font-family: var(--display-font);
  font-size: 27px;
  font-weight: 400;
  line-height: 1.2;
}

.scene-sub {
  margin-bottom: 18px;
  color: var(--dim);
  font-size: 12px;
  line-height: 1.45;
}

.timer-block {
  margin: 2px 0 16px;
}

.timer-block.compact {
  margin-top: 14px;
}

.timer-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
  color: var(--dim);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.timer {
  color: var(--accent-2);
  font-family: var(--display-font);
  font-size: 20px;
  letter-spacing: 0;
  line-height: 1;
}

.timer.is-low {
  color: var(--bad);
}

.timer-bar {
  width: 100%;
  height: 8px;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--chip);
}

.timer-fill {
  width: 100%;
  height: 100%;
  transform-origin: left center;
  background: var(--accent);
  transition: transform 1s linear;
}

.timer-fill.is-low {
  background: var(--bad);
}

.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 11px;
}

.options-grid.two-options {
  grid-template-columns: 1fr 1fr;
}

.option-btn {
  min-height: 62px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--chip);
  color: var(--ink);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  text-align: center;
  transition: border-color 0.12s, color 0.12s;
}

.option-btn:hover {
  border-color: var(--accent);
  color: var(--bright);
}

.option-label {
  display: block;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.power-zone {
  margin-top: 18px;
  border-top: 1px dashed var(--line);
  padding-top: 16px;
}

.power-row,
.reaction-row {
  display: flex;
  gap: 10px;
}

.power-btn {
  flex: 1;
  min-height: 56px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--chip);
  color: var(--ink);
  cursor: pointer;
  padding: 10px 8px;
  text-align: center;
}

.power-btn.active {
  border-color: var(--accent-2);
  background: var(--accent-2);
  color: #0b0a07;
}

.power-btn span,
.power-btn small {
  display: block;
}

.power-btn span {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.power-btn small {
  margin-top: 4px;
  font-size: 10px;
  opacity: 0.82;
}

.locked-pick {
  margin: 12px 0 4px;
  color: var(--good);
  font-family: var(--display-font);
  font-size: 34px;
  font-weight: 400;
  line-height: 1;
}

.power-note {
  margin: 10px 0 0;
  color: var(--accent-2);
  font-size: 12px;
}

.split-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.split-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 5px;
  color: var(--dim);
  font-size: 12px;
}

.split-item.mine .split-row {
  color: var(--good);
}

.split-track {
  height: 12px;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--chip);
}

.split-fill {
  height: 100%;
  background: var(--accent-2);
  opacity: 0.58;
  transform-origin: left;
  animation: oofBar 0.4s ease-out;
}

.split-item.mine .split-fill {
  background: var(--good);
  opacity: 1;
}

.banter-card {
  margin-top: 20px;
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  background: rgba(255, 122, 0, 0.08);
  padding: 22px 18px;
  text-align: center;
  animation: oofRise 0.25s ease-out;
}

.review-card {
  border-top: 1px dashed var(--line);
  margin-top: 18px;
}

.review-card .prompt-question {
  color: var(--accent-2);
}

.banter-card h1 {
  margin: 8px 0;
  color: var(--accent);
  font-family: var(--display-font);
  font-size: 40px;
  font-weight: 400;
  line-height: 1;
}

.banter-card h2 {
  margin: 0;
  color: var(--bright);
  font-family: var(--display-font);
  font-size: 24px;
  font-weight: 400;
  line-height: 1.05;
}

.banter-card p {
  margin: 18px 0 6px;
  color: var(--ink);
  font-size: 14px;
  font-style: italic;
  line-height: 1.5;
}

.reaction-row {
  justify-content: center;
  margin-top: 14px;
}

.reaction-btn {
  width: 46px;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--chip);
  cursor: pointer;
  font-size: 20px;
}

.passive-card .user-strip {
  margin-top: 18px;
}

.status-chip {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--chip);
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 700;
  padding: 6px 10px;
}

.reaction-feed {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.reaction-feed span,
.tiny-pill,
.clock-pill,
.status-pill {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--chip);
  color: var(--dim);
  font-size: 11px;
  line-height: 1;
  padding: 6px 8px;
  text-transform: uppercase;
}

.user-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
}

.user-strip h2 {
  margin-bottom: 4px;
  color: var(--bright);
  font-size: 16px;
  line-height: 1.2;
}

.user-score {
  text-align: right;
}

.user-score div,
.leader-score {
  color: var(--bright);
  font-family: var(--display-font);
  font-size: 28px;
  line-height: 1;
}

.user-score span,
.small,
.empty,
.leader-sub {
  color: var(--dim);
  font-size: 12px;
  line-height: 1.45;
}

.room-flow > .led-panel {
  margin-top: 18px;
}

.leaderboard {
  display: grid;
  gap: 6px;
}

.leader-row {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 8px 10px;
}

.leader-row.is-you {
  border-color: var(--accent);
  background: rgba(255, 122, 0, 0.12);
}

.rank {
  color: var(--warn);
  font-family: var(--display-font);
  font-size: 20px;
  line-height: 1;
}

.leader-name {
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leader-score {
  color: var(--bright);
  font-size: 22px;
}

.recap-card {
  border-top: 1px dashed var(--line);
  padding: 10px 0 0;
}

.recap-card:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.banter-title {
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.toast,
.notice,
.error {
  position: sticky;
  top: 8px;
  z-index: 10;
  margin: 8px 10px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
  color: var(--bright);
  font-size: 12px;
  line-height: 1.4;
  padding: 10px 12px;
}

.error {
  border-color: var(--bad);
  color: #ffc6bd;
}

.notice {
  border-color: var(--accent-2);
  color: var(--bright);
}

body.operator-mode {
  background: var(--page);
}

body.operator-mode .app-shell {
  width: min(100%, 1120px);
  min-height: 100vh;
  padding: max(18px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  margin-bottom: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--chip);
  color: var(--accent);
  font-family: var(--display-font);
  font-size: 26px;
  line-height: 1;
}

.brand-name {
  color: var(--accent);
  font-family: var(--display-font);
  font-size: 28px;
  line-height: 1;
  text-transform: uppercase;
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.top-actions .btn {
  width: auto;
  min-height: 38px;
  font-size: 18px;
}

.operator-grid {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.stack {
  display: grid;
  gap: 14px;
}

.meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.hero-panel {
  min-height: 300px;
  display: grid;
  align-items: end;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(11, 10, 7, 0.18), rgba(11, 10, 7, 0.96)),
    url("/static/assets/pitch.svg") center / cover no-repeat;
}

.hero-copy {
  padding: 28px 18px 18px;
}

.hero-copy h1,
.panel h1 {
  margin-bottom: 12px;
  color: var(--accent);
  font-family: var(--display-font);
  font-size: 52px;
  font-weight: 400;
  line-height: 0.95;
}

.lede {
  margin-bottom: 0;
  color: var(--dim);
  font-size: 14px;
  line-height: 1.55;
}

.template-list {
  display: grid;
  gap: 8px;
  max-height: 430px;
  overflow: auto;
  padding-right: 4px;
}

.template-btn {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--chip);
  color: var(--ink);
  cursor: pointer;
  padding: 10px;
  text-align: left;
}

.template-title {
  color: var(--bright);
  font-weight: 700;
}

.template-question {
  margin-top: 3px;
  color: var(--dim);
  font-size: 12px;
}

.live-search,
.live-bound,
.live-match-list,
.live-suggestions {
  margin-top: 14px;
}

.live-bound {
  display: grid;
  gap: 12px;
  border-top: 1px dashed var(--line);
  padding-top: 14px;
}

.live-match-list,
.live-suggestions {
  display: grid;
  gap: 8px;
}

.live-match-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--chip);
  padding: 10px;
}

.live-bind-actions {
  display: flex;
  gap: 8px;
}

.live-bind-actions .btn {
  width: auto;
  min-height: 38px;
  font-size: 18px;
}

.status-pill.live {
  border-color: var(--bad);
  color: var(--bad);
}

.admin-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.hide {
  display: none !important;
}

@keyframes oofLive {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.25;
  }
}

@keyframes oofRise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes oofBar {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

@media (min-width: 560px) {
  body:not(.operator-mode) .app-shell {
    display: grid;
    min-height: 100vh;
    padding: 11px;
    place-items: center;
  }

  .player-shell {
    width: 362px;
    height: min(762px, calc(100vh - 22px));
    min-height: 0;
    border-radius: 44px;
    box-shadow: 0 0 0 2px #1c1c22, 0 30px 70px rgba(0, 0, 0, 0.6);
  }

  .join-flow,
  .room-flow {
    min-height: 100%;
  }
}

@media (max-width: 840px) {
  body.operator-mode .operator-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
  }

  .top-actions {
    max-width: 58%;
  }
}

@media (max-width: 520px) {
  .two-col,
  .admin-options {
    grid-template-columns: 1fr;
  }

  body.operator-mode .top-actions .btn {
    width: auto;
  }

  .prompt-question {
    font-size: 26px;
  }
}
