:root {
  --bg-deep: #101138;
  --bg-mid: #1f1a57;
  --ink: #12092b;
  --surface: #fff4d4;
  --surface-2: #ffe9c5;
  --pink: #ff4da0;
  --teal: #30e8d9;
  --cyan: #79f4ff;
  --gold: #ffd46a;
  --gold-deep: #b77800;
  --danger: #e0456a;
  --line: #3f2c7f;
  --muted: #433c64;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "DM Sans", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 14%, rgba(255, 77, 160, 0.45) 0%, transparent 35%),
    radial-gradient(circle at 88% 88%, rgba(48, 232, 217, 0.38) 0%, transparent 38%),
    repeating-linear-gradient(
      90deg,
      rgba(255, 212, 106, 0.05) 0,
      rgba(255, 212, 106, 0.05) 18px,
      rgba(0, 0, 0, 0) 18px,
      rgba(0, 0, 0, 0) 34px
    ),
    linear-gradient(160deg, var(--bg-deep) 0%, var(--bg-mid) 56%, #36215c 100%);
  min-height: 100vh;
}

.app-shell {
  max-width: 1120px;
  margin: 0 auto;
  padding: 1rem 0.85rem 2rem;
}

.hero {
  padding: 1rem;
  border: 3px solid var(--gold-deep);
  border-radius: 18px;
  background:
    linear-gradient(130deg, rgba(255, 212, 106, 0.88) 0%, rgba(255, 248, 229, 0.96) 34%, rgba(121, 244, 255, 0.75) 100%);
  box-shadow: 0 0 0 3px rgba(255, 77, 160, 0.3), 0 16px 24px rgba(2, 3, 18, 0.28);
}

.kicker {
  margin: 0;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #553005;
  font-size: 0.74rem;
}

h1 {
  margin: 0.35rem 0;
  font-family: "Bungee", sans-serif;
  font-size: clamp(1.55rem, 4.9vw, 2.3rem);
  line-height: 1.08;
  color: #291540;
  text-shadow: 0 2px 0 #fff8da;
}

.subtitle {
  margin: 0;
  font-weight: 600;
  color: #2f2459;
}

.host-mic {
  margin-top: 0.8rem;
  border: 2px solid #8d5d00;
  border-radius: 11px;
  background: linear-gradient(90deg, #fff5d8, #ffe4f7);
  padding: 0.55rem 0.65rem;
}

.host-mic-label {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 800;
  color: #5a3300;
}

.host-mic-line {
  margin: 0.22rem 0 0;
  font-weight: 700;
  color: #322056;
}

h2 {
  margin: 0 0 0.6rem;
  font-size: 1.04rem;
  letter-spacing: 0.02em;
  color: #241548;
}

.controls {
  display: grid;
  gap: 0.9rem;
  margin-top: 1rem;
}

.control-card,
.leaderboard-wrap,
.board-wrap {
  background: linear-gradient(140deg, var(--surface) 0%, var(--surface-2) 100%);
  border: 2px solid var(--gold-deep);
  border-radius: 14px;
  padding: 0.9rem;
  box-shadow: 0 7px 16px rgba(0, 0, 0, 0.2);
}

.rule-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.65rem;
}

label {
  display: grid;
  gap: 0.25rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: #332457;
}

input[type="number"] {
  border: 2px solid #8556a9;
  border-radius: 9px;
  font-size: 1rem;
  padding: 0.5rem;
  color: #221341;
  background: #fffdf7;
}

.btn {
  border: 0;
  border-radius: 10px;
  padding: 0.72rem 0.95rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  cursor: pointer;
}

.btn.secondary {
  background: linear-gradient(90deg, #01b5b0, #0cead9);
  color: #07163e;
  box-shadow: 0 2px 0 #086a66;
}

.btn.danger {
  background: linear-gradient(90deg, #ff5d93, #ff8f57);
  color: #fffaf0;
  box-shadow: 0 2px 0 #8a2242;
}

.btn.ghost {
  border: 2px solid #744ca5;
  background: #fff8eb;
  color: #2c1b50;
}

.actions {
  display: grid;
  gap: 0.6rem;
  align-content: start;
}

.trip-state {
  margin: 0;
  color: #2d1a52;
  font-weight: 700;
}

.leaderboard {
  display: grid;
  gap: 0.55rem;
}

.score-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.55rem;
}

.rank-badge {
  font-size: 0.8rem;
  font-weight: 800;
  color: #3d1f62;
  border: 2px solid #d08900;
  background: #ffe7ab;
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
}

.score-bar {
  height: 12px;
  border-radius: 999px;
  background: #f3dca9;
  overflow: hidden;
  border: 1px solid #b67e00;
}

.score-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #0fcbc5, #ff4da0, #ffd46a);
}

.score-meta {
  font-size: 0.88rem;
  font-weight: 700;
  color: #2a1a4f;
}

.board-help {
  margin: 0 0 0.6rem;
  color: var(--muted);
  font-weight: 500;
  font-size: 0.9rem;
}

.board-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.3rem;
}

.btn.small {
  padding: 0.5rem 0.65rem;
  font-size: 0.78rem;
}

.hidden {
  display: none !important;
}

.table-scroll {
  overflow-x: auto;
}

.board {
  width: 100%;
  min-width: 840px;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 8px;
}

.board th {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 0.55rem;
  border-radius: 10px;
  border: 2px solid #ffd46a;
  background: linear-gradient(130deg, #2f1e66 0%, #1e5294 60%, #00a6a0 100%);
  color: #fff7da;
  text-align: left;
}

.player-header {
  display: grid;
  gap: 0.25rem;
}

.player-name {
  font-weight: 800;
}

.player-mini {
  font-size: 0.76rem;
  color: #d8f7ff;
}

.board td {
  vertical-align: top;
}

.cell {
  border: 2px solid #8a66c0;
  border-radius: 11px;
  padding: 0.5rem;
  background: linear-gradient(170deg, #fff8ef 0%, #ffe7da 100%);
  height: 260px;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  gap: 0.38rem;
  overflow: hidden;
}

.cell.done {
  border-color: #0daaa3;
  background: linear-gradient(165deg, #dbfff5 0%, #f1faff 100%);
}

.cell.challenge {
  background: linear-gradient(160deg, #ffe0fa 0%, #ffe6cc 100%);
  border-color: #d071ae;
}

.cell.custom-challenge {
  background: linear-gradient(160deg, #d9fff7 0%, #dff2ff 100%);
  border-color: #18b5a7;
}

.cell.skipped {
  border-style: dashed;
  opacity: 0.88;
}

.cell-top {
  display: flex;
  justify-content: space-between;
  gap: 0.4rem;
  font-size: 0.72rem;
}

.category {
  font-weight: 800;
  color: #4b2b68;
}

.points {
  font-weight: 800;
  color: #005a7a;
}

.item-text {
  font-size: 0.92rem;
  line-height: 1.2;
  color: #2a1b4b;
  overflow: auto;
}

.done-line {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: #291a4d;
  font-weight: 600;
}

.cell-actions {
  display: flex;
  gap: 0.35rem;
  align-items: center;
  flex-wrap: wrap;
}

.edit-btn {
  border: 1px solid #196f8b;
  background: #ffffff;
  color: #0d4368;
  border-radius: 8px;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 0.32rem 0.45rem;
  cursor: pointer;
}

.edit-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.photo-btn {
  border: 1px solid #0f7b57;
  background: #ffffff;
  color: #0f5a43;
  border-radius: 8px;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 0.32rem 0.45rem;
  cursor: pointer;
}

.clear-photo-btn {
  border: 1px solid #a06d00;
  background: #fffaf0;
  color: #6b4b00;
  border-radius: 8px;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 0.32rem 0.45rem;
  cursor: pointer;
}

.photo-btn:disabled,
.clear-photo-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.skip-btn {
  border: 1px solid #a85087;
  background: #fff;
  color: #6d144e;
  border-radius: 8px;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 0.32rem 0.45rem;
  cursor: pointer;
}

.skip-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.proof-wrap {
  margin-top: 0.15rem;
  display: grid;
  gap: 0.25rem;
}

.proof-meta {
  font-size: 0.74rem;
  font-weight: 700;
  color: #225f57;
}

.proof-thumb {
  width: 100%;
  height: 62px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #7ac5be;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(6, 6, 24, 0.68);
  display: grid;
  place-items: center;
  padding: 1rem;
}

.modal-card {
  width: min(680px, 100%);
  max-height: 90vh;
  overflow: auto;
  border: 2px solid #d08900;
  border-radius: 14px;
  padding: 0.95rem;
  background: linear-gradient(140deg, #fff1cc 0%, #ffe0f3 46%, #dffeff 100%);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.34);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.modal-sub {
  margin: 0 0 0.35rem;
  color: #3d2a5c;
  font-weight: 600;
  font-size: 0.9rem;
}

.winner-line {
  margin: 0 0 0.7rem;
  font-size: 1rem;
  font-weight: 800;
  color: #2e1454;
}

.standings-list {
  display: grid;
  gap: 0.45rem;
}

.standings-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.5rem;
  align-items: center;
  border: 1px solid #c08300;
  border-radius: 10px;
  background: #fff9ec;
  padding: 0.45rem 0.55rem;
}

.standings-name {
  font-weight: 800;
}

.standings-meta {
  color: #3f2f67;
  font-size: 0.82rem;
}

.standings-score {
  font-weight: 800;
  color: #072f53;
}

.modal-actions {
  margin-top: 0.75rem;
  display: flex;
  gap: 0.5rem;
}

.modal-note {
  margin: 0.6rem 0 0;
  color: #4a366b;
  font-size: 0.8rem;
}

.splash-card {
  width: min(760px, 100%);
  text-align: center;
  border-width: 3px;
}

.splash-kicker {
  margin: 0;
  font-size: 0.74rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #5a3300;
  font-weight: 800;
}

.splash-title {
  margin: 0.4rem 0 0.35rem;
  font-family: "Bungee", sans-serif;
  font-size: clamp(1.4rem, 5.2vw, 2.1rem);
  color: #25124a;
}

.splash-welcome {
  margin: 0 auto 0.8rem;
  max-width: 600px;
  color: #38265d;
  font-weight: 600;
}

.splash-credits {
  margin: 0 auto 0.9rem;
  max-width: 560px;
  border: 1px solid #c18a00;
  border-radius: 12px;
  background: #fff8e7;
  padding: 0.65rem 0.75rem;
  display: grid;
  gap: 0.3rem;
}

.splash-credits p {
  margin: 0;
  font-weight: 700;
  color: #2b1d4e;
}

.host-hud {
  position: sticky;
  bottom: 0.5rem;
  z-index: 40;
  margin: 0.6rem auto 1rem;
  width: min(1120px, calc(100% - 1rem));
  border: 2px solid #c07d00;
  border-radius: 12px;
  padding: 0.55rem 0.65rem;
  background: linear-gradient(90deg, #1d1a52 0%, #2f2469 50%, #1f4f7e 100%);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 0.6rem;
  align-items: start;
}

.host-hud-content {
  min-width: 0;
}

.host-hud-photo {
  width: 72px;
  height: 84px;
  border-radius: 10px;
  border: 1px solid #5a66af;
  background:
    radial-gradient(circle at 35% 15%, rgba(255, 255, 255, 0.12), transparent 45%),
    linear-gradient(160deg, #111538 0%, #0a0d22 100%);
  display: grid;
  place-items: center;
}

.host-hud-shadow {
  width: 44px;
  height: 58px;
  border-radius: 62% 62% 45% 45%;
  background: #04060c;
  box-shadow: 0 0 0 2px #1a214f;
  position: relative;
}

.host-hud-shadow::before {
  content: "";
  position: absolute;
  width: 30px;
  height: 8px;
  border-radius: 999px;
  left: 7px;
  top: 21px;
  background: linear-gradient(90deg, #53e3ff, #ff4da0);
  opacity: 0.8;
}

.host-hud-head {
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 800;
  color: #ffd878;
}

.host-hud-current {
  margin: 0.2rem 0 0.4rem;
  font-weight: 700;
  color: #f6fbff;
}

.host-hud-history {
  display: grid;
  gap: 0.25rem;
  max-height: 90px;
  overflow: auto;
}

.host-hud-line {
  font-size: 0.8rem;
  color: #bde9ff;
}

.intro-card {
  width: min(760px, 100%);
}

.intro-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.65rem;
}

.intro-host {
  display: grid;
  gap: 0.8rem;
  margin: 0.45rem 0 0.65rem;
}

.host-figure {
  position: relative;
  border-radius: 14px;
  min-height: 180px;
  background:
    radial-gradient(circle at 35% 20%, rgba(255, 255, 255, 0.1), transparent 40%),
    linear-gradient(160deg, #111538 0%, #0a0d22 100%);
  border: 2px solid #4a5291;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.host-shadow {
  width: 132px;
  height: 150px;
  border-radius: 60% 60% 45% 45%;
  background: #05070f;
  position: relative;
  box-shadow: 0 0 0 3px #1a214f;
}

.host-shadow::before {
  content: "";
  position: absolute;
  width: 78px;
  height: 20px;
  border-radius: 999px;
  left: 27px;
  top: 54px;
  background: linear-gradient(90deg, #53e3ff, #ff4da0);
  opacity: 0.75;
}

.host-shadow::after {
  content: "";
  position: absolute;
  width: 170px;
  height: 18px;
  left: -19px;
  bottom: -10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.5);
}

.intro-controls {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.6rem;
  align-items: end;
}

.host-select {
  border: 2px solid #8556a9;
  border-radius: 9px;
  font-size: 0.95rem;
  padding: 0.45rem;
  background: #fffef8;
  color: #28174a;
}

.host-range {
  width: 100%;
}

.voice-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 700;
  margin: 0;
}

.intro-script {
  border: 1px solid #c18a00;
  border-radius: 11px;
  background: #fff7e8;
  padding: 0.7rem;
}

.intro-line {
  margin: 0;
  min-height: 2.4rem;
  font-weight: 700;
  color: #2c1a50;
}

.intro-actions {
  margin-top: 0.65rem;
  display: flex;
  gap: 0.5rem;
}

@media (min-width: 800px) {
  .controls {
    grid-template-columns: 2fr 1fr;
  }

  .rule-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .intro-host {
    grid-template-columns: 1.2fr 1fr;
    align-items: stretch;
  }

  .intro-controls {
    grid-template-columns: 1fr 1fr;
  }
}
