:root {
  color-scheme: dark;
  --bg: #091018;
  --panel: #111d28;
  --panel-2: #172838;
  --line: #294057;
  --text: #f5f9ff;
  --muted: #9fb1c2;
  --accent: #48d4ff;
  --accent-2: #ffce4a;
  --good: #4ade80;
  --bad: #fb7185;
  --hot: #ff7a45;
  --shadow: 0 20px 60px rgb(0 0 0 / 0.35);
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100%;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgb(72 212 255 / 0.14), transparent 34rem),
    linear-gradient(135deg, #08111a 0%, #0d1823 52%, #061018 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

a {
  color: inherit;
}

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

.home-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.home-shell {
  width: min(760px, 100%);
  padding: clamp(28px, 6vw, 64px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgb(17 29 40 / 0.9);
  box-shadow: var(--shadow);
}

.home-shell h1 {
  margin-bottom: 12px;
  font-size: clamp(44px, 9vw, 88px);
  line-height: 0.95;
}

.home-actions,
.button-row,
.topbar-actions,
.reveal-pad {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text);
  background: #203448;
  text-decoration: none;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}

.button:hover,
.button:focus-visible {
  border-color: var(--accent);
  background: #294760;
  outline: none;
  transform: translateY(-1px);
}

.button.primary {
  border-color: rgb(72 212 255 / 0.75);
  color: #041016;
  background: var(--accent);
  font-weight: 800;
}

.button.ghost {
  background: transparent;
}

.button.danger {
  border-color: rgb(251 113 133 / 0.65);
  background: rgb(251 113 133 / 0.15);
}

.button.small {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 0.88rem;
}

.host-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px clamp(16px, 3vw, 32px);
  border-bottom: 1px solid var(--line);
  background: rgb(7 14 22 / 0.84);
  position: sticky;
  top: 0;
  z-index: 5;
  backdrop-filter: blur(14px);
}

.host-topbar h1 {
  margin-bottom: 0;
  font-size: clamp(28px, 4vw, 46px);
  line-height: 1;
}

.eyebrow {
  margin-bottom: 6px;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.lede {
  color: var(--muted);
  font-size: clamp(1.05rem, 2vw, 1.35rem);
}

.fine-print,
.muted {
  color: var(--muted);
}

.answer-warning {
  margin: 16px clamp(16px, 3vw, 32px) 0;
  border: 1px solid rgb(255 122 69 / 0.45);
  border-radius: 8px;
  padding: 12px 14px;
  background: rgb(255 122 69 / 0.14);
  color: #ffe5d8;
}

.host-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(360px, 1.3fr) minmax(280px, 0.9fr);
  gap: 16px;
  padding: 16px clamp(16px, 3vw, 32px) 32px;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: rgb(17 29 40 / 0.88);
  box-shadow: 0 16px 44px rgb(0 0 0 / 0.18);
}

.panel.wide {
  grid-column: span 2;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-head h2 {
  margin: 0;
  font-size: 1rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 9px;
  color: var(--muted);
  background: rgb(255 255 255 / 0.04);
  font-size: 0.78rem;
  white-space: nowrap;
}

.pill.hot {
  border-color: rgb(255 122 69 / 0.45);
  color: #ffd4bd;
  background: rgb(255 122 69 / 0.12);
}

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

.field,
.check-field {
  display: grid;
  gap: 7px;
  margin-bottom: 12px;
}

.check-field {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.field span,
.check-field span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  color: var(--text);
  background: #0b1722;
}

textarea {
  min-height: 92px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  outline: 2px solid rgb(72 212 255 / 0.2);
}

.team-list,
.entries-list,
.scoreboard,
.results-list {
  display: grid;
  gap: 10px;
}

.team-card,
.entry-card,
.score-row,
.result-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgb(255 255 255 / 0.035);
}

.team-card {
  display: grid;
  grid-template-columns: 1fr 82px auto;
  gap: 8px;
  align-items: end;
}

.team-card .button {
  min-height: 40px;
}

.score-row,
.result-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
}

.score-row strong {
  font-size: 1.08rem;
}

.score-row .score {
  color: var(--accent-2);
  font-size: 1.6rem;
  font-weight: 950;
}

.entry-card h3 {
  margin-bottom: 10px;
}

.guess-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.pick-grid {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(86px, 120px);
  gap: 8px;
  margin-bottom: 8px;
}

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

.display-page {
  overflow-x: hidden;
}

.display-root {
  min-height: 100vh;
  padding: clamp(18px, 4vw, 48px);
}

.tv-card {
  min-height: calc(100vh - clamp(36px, 8vw, 96px));
  border: 1px solid rgb(255 255 255 / 0.12);
  border-radius: 8px;
  padding: clamp(24px, 5vw, 64px);
  background:
    linear-gradient(135deg, rgb(16 29 42 / 0.92), rgb(7 15 25 / 0.96)),
    radial-gradient(circle at 88% 18%, rgb(255 206 74 / 0.12), transparent 24rem);
  box-shadow: var(--shadow);
}

.tv-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: clamp(20px, 4vw, 48px);
}

.tv-actions {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.tv-title {
  margin: 0;
  font-size: clamp(42px, 8vw, 110px);
  line-height: 0.94;
}

.tv-subtitle {
  color: var(--muted);
  font-size: clamp(22px, 3vw, 42px);
}

.mega-number {
  display: inline-flex;
  align-items: center;
  min-height: 1.05em;
  color: var(--accent-2);
  font-size: clamp(76px, 15vw, 230px);
  font-weight: 1000;
  line-height: 0.9;
  text-shadow: 0 12px 40px rgb(0 0 0 / 0.34);
}

.tv-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.42fr);
  gap: clamp(16px, 3vw, 32px);
}

.tv-panel {
  min-width: 0;
  border: 1px solid rgb(255 255 255 / 0.12);
  border-radius: 8px;
  padding: clamp(16px, 2.4vw, 30px);
  background: rgb(255 255 255 / 0.045);
}

.tv-panel h2 {
  font-size: clamp(24px, 3.4vw, 46px);
}

.reveal-team-name {
  margin-bottom: 14px;
  font-size: clamp(40px, 7vw, 90px);
  line-height: 0.95;
}

.item-reveal {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: center;
  border-bottom: 1px solid rgb(255 255 255 / 0.13);
  padding: 14px 0;
}

.item-reveal .title {
  overflow-wrap: anywhere;
  font-size: clamp(24px, 3.5vw, 52px);
  font-weight: 850;
}

.item-reveal .value,
.subtotal,
.gap {
  color: var(--accent-2);
  font-size: clamp(36px, 5vw, 74px);
  font-weight: 1000;
}

.pending {
  color: var(--muted);
  filter: blur(1px);
}

.bracket-flash {
  display: inline-flex;
  margin-top: 18px;
  border: 1px solid rgb(74 222 128 / 0.55);
  border-radius: 8px;
  padding: 10px 14px;
  color: #e8fff0;
  background: rgb(74 222 128 / 0.16);
  font-size: clamp(20px, 2.7vw, 36px);
  font-weight: 900;
  animation: pop 650ms ease both;
}

.guess-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.guess-tile {
  border: 1px solid rgb(255 255 255 / 0.12);
  border-radius: 8px;
  padding: 14px;
  background: rgb(255 255 255 / 0.05);
}

.guess-tile .name {
  color: var(--muted);
  font-weight: 800;
}

.guess-tile .guess {
  color: var(--accent-2);
  font-size: clamp(32px, 5vw, 70px);
  font-weight: 1000;
}

.winner {
  border-color: rgb(255 206 74 / 0.85);
  box-shadow: 0 0 0 2px rgb(255 206 74 / 0.18);
}

.mini-standing {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid rgb(255 255 255 / 0.11);
  padding: 11px 0;
  font-size: clamp(18px, 2.2vw, 28px);
}

.mini-standing:last-child {
  border-bottom: 0;
}

.mini-standing .points {
  color: var(--accent-2);
  font-weight: 1000;
}

@keyframes pop {
  0% {
    transform: scale(0.92);
    opacity: 0;
  }
  60% {
    transform: scale(1.04);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@media (max-width: 1100px) {
  .host-grid,
  .tv-grid {
    grid-template-columns: 1fr;
  }

  .panel.wide {
    grid-column: auto;
  }
}

@media (max-width: 720px) {
  .host-topbar,
  .tv-header {
    align-items: stretch;
    flex-direction: column;
  }

  .team-card,
  .guess-grid,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .pick-grid {
    grid-template-columns: 1fr;
  }
}

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