
:root {
  --bg: #061229;
  --panel: #0e1b33;
  --panel-2: #122444;
  --text: #f8fafc;
  --muted: #c0d5f5;
  --accent: #5eead4;
  --accent-2: #3b82f6;
  --danger: #ef4444;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background:
    radial-gradient(circle at top, rgba(29,78,216,.2), transparent 30%),
    linear-gradient(180deg, #031022 0%, #071735 100%);
  color: var(--text);
}
button, input, textarea, select { font: inherit; }
button {
  background: linear-gradient(180deg, #5f9cff, #3c7cff);
  color: white;
  border: 0;
  padding: 12px 16px;
  border-radius: 12px;
  cursor: pointer;
}
button:disabled { opacity: .45; cursor: not-allowed; }
input, textarea, select {
  width: 100%; padding: 12px; border-radius: 12px; border: 1px solid #334155; background: #0b1220; color: white;
}
.hidden { display:none !important; }
.landing, .screen { max-width: 1380px; margin: 0 auto; padding: 24px; }
.cards { display:grid; gap:16px; grid-template-columns:repeat(auto-fit,minmax(200px,1fr)); margin-top:24px; }
.card, .card-panel, .panel-box, .wheel-box, .scoreboard, .stat-card {
  background: rgba(11, 24, 49, .92);
  border: 1px solid rgba(173, 216, 255, .12);
  border-radius: 22px;
  padding: 20px;
  text-decoration:none;
  color:white;
  box-shadow: 0 18px 38px rgba(0,0,0,.28);
}
.topbar { display:flex; justify-content:space-between; align-items:center; gap:16px; }
.topbar.compact { margin-bottom:20px; }
.status-box {
  background: linear-gradient(135deg, #2463ff, #1ca8ff);
  padding: 12px 16px; border-radius: 999px; font-weight: bold;
}
.players { display:grid; gap:12px; }
.player-stats-grid { display:grid; grid-template-columns:repeat(2,1fr); gap:12px; margin:20px 0; }
.stat-card span { display:block; color:var(--muted); margin-bottom:8px; }
.stat-card strong { font-size:28px; }
.actions { display:grid; grid-template-columns:1fr 1fr; gap:12px; margin-bottom:12px; }
.buy-vowel-row { margin-top:12px; }
.card-panel { display:grid; gap:12px; margin-bottom:16px; }
.muted-text { color: #aac3ea; }
.error-text { color: #fecaca; }
.status-badge {
  min-width: 70px; text-align:center; padding:10px 14px; border-radius:999px; background:#11335f; color:#fff; font-weight:700;
}
.letter-keyboard { display:grid; grid-template-columns:repeat(7, minmax(0,1fr)); gap:10px; }
.letter-key.used, .letter-key.vowel { opacity:.35; }
.mystery-actions { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.secondary-btn { background: linear-gradient(180deg, #153868, #0f2848); }
.letter-section-header { display:flex; justify-content:space-between; gap:16px; align-items:flex-start; }

.display-show { max-width: 1480px; padding: 28px 28px 36px; min-height: 100vh; }
.show-header { display:flex; justify-content:space-between; align-items:flex-start; gap:24px; margin-bottom: 14px; }
.show-title-wrap h1 { margin:0; font-size: clamp(30px, 4vw, 52px); }
.eyebrow { margin:0 0 8px; text-transform:uppercase; letter-spacing:.24em; color:#8fd3ff; font-size:13px; }
.meta-row { display:flex; flex-wrap:wrap; gap:12px; margin-top:18px; }
.pill { display:inline-flex; align-items:center; padding:10px 16px; border-radius:999px; background:rgba(59,130,246,.2); border:1px solid rgba(125,211,252,.25); color:#dbeafe; font-weight:700; }
.pill-soft { background:rgba(16,185,129,.12); border-color:rgba(16,185,129,.25); color:#dcfce7; }
.status-box-large { min-width:300px; padding:16px 22px; }
.board-layout-grid { display:grid; grid-template-columns:minmax(0,1.65fr) minmax(360px,.95fr); gap:22px; align-items:start; }
.sidebar-column { display:grid; gap:22px; }
.panel-box-show, .wheel-box-show, .scoreboard-show {
  background: radial-gradient(circle at top, rgba(16, 43, 88, .98), rgba(7, 18, 38, .98));
}
.contest-stage { padding: 18px 18px 8px; }
.contest-frame {
  position: relative;
  padding: 34px 28px 26px;
  border-radius: 40px;
  background: linear-gradient(180deg, #efe6e8, #d9e1ea);
  border: 5px solid #f0c487;
  box-shadow:
    0 0 0 6px rgba(255,255,255,.65) inset,
    0 0 0 10px rgba(250,169,74,.65),
    0 20px 44px rgba(0,0,0,.24);
}
.frame-bulbs {
  position:absolute; inset:10px; border-radius:32px; pointer-events:none;
  background-image: radial-gradient(circle, rgba(255,239,157,.95) 0 2px, transparent 3px);
  background-size: 22px 22px; opacity:.7;
}
.contest-inner {
  position:relative; z-index:1; padding: 18px 22px 18px; border-radius: 20px; background:#f8fafc; box-shadow: inset 0 0 0 6px #d9dde4;
}
.contest-screen {
  display:grid; grid-template-columns: 120px 1fr 120px; gap:0; align-items:center;
  min-height: 430px;
}
.board-side {
  height: 260px;
  border: 6px solid #0c1b44;
  background:
   linear-gradient(180deg, #1d74d8, #004db3 40%, #1d74d8),
   linear-gradient(90deg, transparent, rgba(255,255,255,.22), transparent);
  box-shadow: inset 0 0 0 4px rgba(255,255,255,.14);
}
.board-side-left { border-right-width:3px; }
.board-side-right { border-left-width:3px; }
.board-center { padding:0 6px; }
.tv-board { display:grid; gap:10px; }
.tv-row {
  display:grid;
  gap:6px;
  justify-content:center;
}
.tv-cell {
  height: 74px;
  border-radius: 6px;
  border: 3px solid #082357;
  display:flex; align-items:center; justify-content:center;
  font-weight:900;
  font-size: clamp(26px, 2.5vw, 42px);
  text-transform: uppercase;
  letter-spacing: .02em;
}
.tv-cell-letter.revealed {
  background: #f8ffff;
  color: #05152f;
  box-shadow: inset 0 -4px 0 rgba(0,0,0,.08);
}
.tv-cell-hidden, .tv-cell-side {
  background:
    radial-gradient(circle at 50% 25%, rgba(120, 208, 255, .52), transparent 42%),
    linear-gradient(180deg, #0d72db, #014db8 45%, #0d72db);
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.08);
}
.tv-cell-empty {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}
.contest-category-bar {
  position:relative;
  z-index:1;
  display:grid;
  grid-template-columns: 86px 1fr;
  align-items:center;
  gap:16px;
  margin-top: 20px;
  padding: 14px 18px;
  border-radius: 16px;
  background: linear-gradient(180deg, #0f8eff, #0a55d3 55%, #0892ff);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.22), inset 0 -3px 0 rgba(0,0,0,.18);
}
.category-count {
  display:flex; align-items:center; justify-content:center;
  height: 56px; border-radius: 14px;
  background: linear-gradient(180deg, #71ff3a, #00a92f);
  color: #06131d; font-size: 34px; font-weight: 900;
  box-shadow: inset 0 0 0 4px rgba(255,255,255,.32);
}
.category-bar-text {
  text-transform: uppercase; letter-spacing: .08em; font-weight: 900; text-align:center;
  color:white; font-size: clamp(24px, 2.4vw, 44px); text-shadow: 0 2px 0 rgba(0,0,0,.18);
}
.wheel-box-corner { min-height: 330px; }
.wheel-topline { display:flex; justify-content:space-between; align-items:center; gap:12px; margin-bottom:14px; }
.wheel-label { color:#cbe3ff; font-weight:800; text-transform:uppercase; letter-spacing:.08em; }
.wheel-result-tag {
  display:inline-flex; align-items:center; min-height:42px; padding:10px 14px; border-radius:999px; background:rgba(8,23,57,.9); border:1px solid rgba(173,216,255,.18); font-weight:800; color:#fff;
}
.wheel-stage { position:relative; display:grid; place-items:center; }
.compact-stage { min-height: 250px; }
.wheel-pointer {
  position:absolute; top:-6px; left:50%; transform:translateX(-50%);
  width:0; height:0; z-index:4;
  border-left:16px solid transparent; border-right:16px solid transparent; border-top:32px solid #ffd43b;
  filter: drop-shadow(0 2px 0 rgba(0,0,0,.25));
}
.wheel-visual {
  --wheel-rotation: 0deg;
  position:relative;
  width: 250px; height:250px; border-radius:50%;
  transform: rotate(var(--wheel-rotation));
  box-shadow: 0 16px 38px rgba(0,0,0,.32);
  border: 10px solid #f0f4ff;
  overflow: visible;
}
.wheel-center-disc {
  position:absolute; inset:28%; border-radius:50%; z-index:3;
  display:grid; place-items:center;
  background: radial-gradient(circle at 30% 30%, #a7e4ff, #71c5f3 70%, #64b5e1);
  border: 10px solid #f3f4f6;
  color:#08132f; font-weight:900; text-align:center; line-height:1;
  box-shadow: inset 0 2px 0 rgba(255,255,255,.55);
}
.wheel-center-disc span { font-size: 32px; }
.wheel-labels { position:absolute; inset:0; }
.wheel-segment-label {
  position:absolute; top:50%; left:50%; transform-origin:center;
  font-weight:900; font-size:13px; text-align:center; color:#fff;
  text-shadow: 0 1px 1px rgba(0,0,0,.4);
  width: 88px;
}
.wheel-segment-label.bankrupt, .wheel-segment-label.lose_turn { color:#fff; }
.wheel-segment-label.light { color:#0a1731; text-shadow:none; }
.score-card {
  display:grid; gap:10px; padding:14px 16px; border-radius:16px; background:#102244; border:1px solid rgba(173,216,255,.1);
}
.score-card.active { outline: 3px solid rgba(94,234,212,.72); background:#14345d; }
.score-name { font-size: 20px; font-weight:800; }
.score-values { display:flex; justify-content:space-between; align-items:center; gap:12px; color:#bfdcff; }
.score-values strong { font-size: 28px; color:white; }
.empty-scoreboard { margin:0; color:#bfdcff; }
.wheel-overlay {
  position:fixed; inset:0; background: radial-gradient(circle at center, rgba(13,28,61,.35), rgba(2,6,23,.94));
  display:flex; align-items:center; justify-content:center; padding:24px; z-index:100; opacity:0; visibility:hidden; pointer-events:none; transition: opacity .24s ease, visibility .24s ease;
}
.wheel-overlay.active { opacity:1; visibility:visible; }
.wheel-overlay-inner { display:grid; gap:20px; justify-items:center; }
.wheel-overlay-status { font-size: 34px; font-weight:900; letter-spacing:.08em; text-transform:uppercase; }
.fullscreen-stage { min-height: auto; }
.fullscreen-wheel { width: min(76vw, 820px); height: min(76vw, 820px); border-width: 18px; }
.overlay-center-disc { border-width: 16px; }
.overlay-center-disc span { font-size: clamp(44px, 5vw, 78px); }
.fullscreen-pointer { top: -14px; border-left-width: 30px; border-right-width: 30px; border-top-width: 54px; }
.wheel-overlay-result {
  font-size: clamp(34px, 5vw, 72px); font-weight:900; padding:18px 28px; border-radius:999px;
  background: rgba(7, 18, 38, .92); border:2px solid rgba(255,255,255,.14);
}

@media (max-width: 1100px) {
  .board-layout-grid { grid-template-columns:1fr; }
  .contest-screen { grid-template-columns: 70px 1fr 70px; min-height: 340px; }
  .board-side { height: 220px; }
}
@media (max-width: 768px) {
  .topbar, .show-header { flex-direction:column; align-items:stretch; }
  .actions, .player-stats-grid, .mystery-actions { grid-template-columns:1fr; }
  .letter-keyboard { grid-template-columns: repeat(6, minmax(0,1fr)); }
  .contest-screen { grid-template-columns: 26px 1fr 26px; }
  .board-side { height: 180px; }
  .tv-cell { height: 48px; font-size: 22px; }
  .wheel-visual { width: 220px; height:220px; }
}


/* Display v5 */
.display-main-full { display:grid; gap:22px; }
.contest-stage-wide { padding: 18px; }
.contest-frame-wide { max-width: 100%; }
.contest-screen-wide {
  grid-template-columns: 118px minmax(0, 1fr) 118px;
  min-height: 560px;
}
.board-center-wide {
  padding: 0 12px;
  display:grid;
  align-items:center;
}
.tv-board-v5 {
  width: min(100%, 1080px);
  margin: 0 auto;
  gap: 12px;
}
.tv-board-v5 .tv-row {
  gap: 7px;
  width: 100%;
}
.tv-board-v5 .tv-cell {
  aspect-ratio: 1 / 1.18;
  height: auto;
  min-height: 68px;
  border-width: 3px;
  border-radius: 5px;
  font-size: clamp(20px, 2.15vw, 48px);
  letter-spacing: 0;
  line-height: 1;
  padding-top: .02em;
}
.tv-board-v5 .tv-cell-letter.revealed {
  background: linear-gradient(180deg, #ffffff, #f4f8fb 78%);
  color: #071938;
  box-shadow: inset 0 -5px 0 rgba(0,0,0,.08), inset 0 2px 0 rgba(255,255,255,.75);
}
.tv-board-v5 .tv-cell-hidden,
.tv-board-v5 .tv-cell-side {
  background:
    radial-gradient(circle at 50% 20%, rgba(124, 206, 255, .58), transparent 42%),
    linear-gradient(180deg, #1a7be5, #0058c7 44%, #1a7be5);
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.1), inset 0 -4px 0 rgba(0,0,0,.12);
}
.tv-board-v5 .tv-cell-empty {
  border-color: transparent;
  background: transparent;
}
.scoreboard-bottom-v5 { padding: 20px 22px; }
.players-horizontal {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.players-horizontal .empty-scoreboard { grid-column: 1 / -1; }

.wheel-overlay-v5 {
  background:
    radial-gradient(circle at center, rgba(29, 94, 255, .14), transparent 18%),
    radial-gradient(circle at center, rgba(8, 17, 42, .18), rgba(2,6,23,.97) 72%);
  transition: opacity .42s ease, visibility .42s ease;
}
.wheel-overlay-inner-v5 {
  transform: scale(.84);
  opacity: 0;
  transition: transform .5s cubic-bezier(.2,.9,.2,1), opacity .34s ease;
}
.wheel-overlay.active .wheel-overlay-inner-v5 {
  transform: scale(1);
  opacity: 1;
}
.wheel-overlay-v5 .fullscreen-wheel {
  width: min(78vw, 880px);
  height: min(78vw, 880px);
  border-width: 18px;
}
.wheel-overlay-v5 .overlay-center-disc {
  inset: 30%;
  border-width: 15px;
}
.wheel-overlay-v5 .overlay-center-disc span { font-size: 0; }
.wheel-overlay-v5 .wheel-overlay-result {
  min-width: 260px;
  text-align:center;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.wheel-overlay-v5.settled .wheel-overlay-result {
  animation: resultPop .45s ease both;
}
@keyframes resultPop {
  0% { transform: scale(.8); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

@media (max-width: 1100px) {
  .contest-screen-wide { grid-template-columns: 76px minmax(0, 1fr) 76px; min-height: 440px; }
  .tv-board-v5 { width: 100%; }
  .tv-board-v5 .tv-cell { min-height: 56px; font-size: clamp(18px, 2vw, 34px); }
}

@media (max-width: 768px) {
  .contest-screen-wide { grid-template-columns: 28px minmax(0, 1fr) 28px; min-height: 320px; }
  .tv-board-v5 .tv-cell { min-height: 42px; }
}


/* Panel rows visibility fix */
.board-center-wide {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 430px;
}

.tv-board-v5 {
  width: 100%;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.tv-board-v5.single-row { gap: 16px; }
.tv-board-v5.two-rows { gap: 14px; }
.tv-board-v5.three-rows { gap: 12px; }
.tv-board-v5.four-rows { gap: 10px; }

.tv-board-v5 .tv-row {
  width: auto;
  justify-content: center;
}

.tv-board-v5 .tv-cell {
  width: clamp(44px, 4vw, 72px);
  height: clamp(58px, 5.2vw, 86px);
  border-radius: 4px;
}

.tv-board-v5 .tv-cell-hidden {
  background:
    radial-gradient(circle at 50% 22%, rgba(120, 208, 255, .56), transparent 38%),
    linear-gradient(180deg, #1783ee, #045cc8 46%, #1375df);
}

.tv-board-v5 .tv-cell-letter.revealed {
  background: linear-gradient(180deg, #ffffff, #f2f5f8 85%);
  color: #04162f;
}

.tv-board-v5 .tv-cell-empty,
.tv-board-v5 .tv-cell-side {
  display: none;
}

@media (max-width: 768px) {
  .board-center-wide { min-height: 260px; }
  .tv-board-v5 .tv-cell {
    width: clamp(28px, 6vw, 40px);
    height: clamp(38px, 8vw, 56px);
  }
}
