:root{
  --bg: #0b1220;
  --panel: #101a33;
  --panel2:#0f1830;
  --text: #e7ecff;
  --muted:#aab4df;
  --accent:#4da3ff;

  --red:#ff3b3b;
  --yellow:#ffd400;

  --board-bg:#0a1330;
  --cell:#0f1c45;
  --cell-hole:#08102b;

  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --radius: 16px;
}

*{ box-sizing: border-box; }
html, body{ height: 100%; }
body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: radial-gradient(1200px 600px at 20% 0%, #1a2b63 0%, var(--bg) 55%);
  color: var(--text);
}

.app-header{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap: 16px;
  padding: 18px 18px 0;
  max-width: 1100px;
  margin: 0 auto;
}
.title h1{ margin:0; font-size: 22px; letter-spacing:.2px; }
.subtitle{ margin: 4px 0 0; color: var(--muted); font-size: 13px; }

.top-actions{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  justify-content:flex-end;
}

.btn{
  appearance:none;
  border: 1px solid rgba(255,255,255,.15);
  background: rgba(255,255,255,.06);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 12px;
  cursor:pointer;
  font-weight: 650;
  letter-spacing:.2px;
  box-shadow: 0 4px 14px rgba(0,0,0,.18);
}
.btn:hover{ border-color: rgba(255,255,255,.28); }
.btn:focus-visible{ outline: 3px solid rgba(77,163,255,.6); outline-offset: 2px; }
.btn.btn-secondary{
  background: rgba(255,255,255,.03);
  font-weight: 600;
}
.hidden{ display:none !important; }

.layout{
  max-width: 1100px;
  margin: 18px auto 0;
  padding: 0 18px 24px;
  display:grid;
  grid-template-columns: 360px 1fr;
  gap: 18px;
}
@media (max-width: 920px){
  .layout{ grid-template-columns: 1fr; }
  .top-actions{ justify-content:flex-start; }
}

.panel{
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.03));
  border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.status-row{
  display:flex;
  gap: 12px;
  align-items:flex-start;
}

.turn-indicator{ padding-top: 2px; }
.dot{
  display:inline-block;
  width: 14px; height: 14px;
  border-radius: 999px;
  box-shadow: 0 0 0 4px rgba(255,255,255,.08);
}
.dot-red{ background: var(--red); }
.dot-yellow{ background: var(--yellow); }

.turn-text{
  font-weight: 750;
  font-size: 16px;
  margin-bottom: 4px;
}
.message{ color: var(--muted); font-size: 13px; min-height: 18px; }

.score{
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 14px;
}
.score-card{
  background: rgba(0,0,0,.15);
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 14px;
  padding: 10px;
}
.score-card .label{
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}
.score-card .value{
  font-size: 20px;
  font-weight: 800;
}

.help{
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,.10);
}
.help h2{
  font-size: 14px;
  margin: 0 0 8px;
  color: var(--text);
}
.help ul{
  margin:0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}
kbd{
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(0,0,0,.22);
  color: var(--text);
}

.game{
  display:flex;
  align-items:flex-start;
  justify-content:center;
}

.board-wrap{
  width: min(620px, 100%);
}

.column-hint{
  margin: 4px 0 10px;
  color: var(--muted);
  font-size: 13px;
}

.board{
  background: linear-gradient(180deg, rgba(255,255,255,.07), rgba(255,255,255,.03));
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 18px;
  padding: 14px;
  box-shadow: var(--shadow);
  user-select:none;
  -webkit-tap-highlight-color: transparent;
}

.grid{
  display:grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
}

.cell-btn{
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 999px;
  border: 0;
  background: radial-gradient(circle at 35% 30%, rgba(255,255,255,.12) 0%, rgba(255,255,255,.03) 35%, rgba(0,0,0,.25) 70%),
              linear-gradient(180deg, var(--cell), var(--cell-hole));
  box-shadow: inset 0 8px 18px rgba(0,0,0,.35);
  cursor:pointer;
  position:relative;
}

.cell-btn:focus-visible{
  outline: 3px solid rgba(77,163,255,.7);
  outline-offset: 3px;
}

.cell-btn[data-col-selected="true"]{
  box-shadow:
    inset 0 8px 18px rgba(0,0,0,.35),
    0 0 0 3px rgba(77,163,255,.45);
}

/* Disc styles */
.disc{
  position:absolute;
  inset: 10%;
  border-radius:999px;
  transform: translateY(-140%);
  opacity:0;
  transition: transform 160ms ease-out, opacity 120ms linear;
}
.disc.show{
  transform: translateY(0);
  opacity:1;
}
.disc.red{
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,.35), rgba(255,255,255,0) 45%),
              radial-gradient(circle at 60% 70%, rgba(0,0,0,.25), rgba(0,0,0,0) 55%),
              var(--red);
  box-shadow: inset 0 10px 18px rgba(255,255,255,.15), 0 8px 14px rgba(0,0,0,.25);
}
.disc.yellow{
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,.35), rgba(255,255,255,0) 45%),
              radial-gradient(circle at 60% 70%, rgba(0,0,0,.25), rgba(0,0,0,0) 55%),
              var(--yellow);
  box-shadow: inset 0 10px 18px rgba(255,255,255,.15), 0 8px 14px rgba(0,0,0,.25);
}

/* Winning highlight */
.cell-btn.win{
  box-shadow:
    inset 0 8px 18px rgba(0,0,0,.35),
    0 0 0 3px rgba(255,255,255,.35),
    0 0 24px rgba(255,255,255,.25);
}

.legend{
  margin-top: 12px;
  display:flex;
  gap: 14px;
  color: var(--muted);
  font-size: 13px;
}
.legend-item{ display:flex; align-items:center; gap:8px; }
.chip{
  width: 12px; height: 12px; border-radius: 999px;
  box-shadow: 0 0 0 3px rgba(255,255,255,.08);
}
.chip-red{ background: var(--red); }
.chip-yellow{ background: var(--yellow); }

.app-footer{
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 18px 18px;
  color: rgba(255,255,255,.55);
}

.sr-only{
  position:absolute !important;
  width:1px; height:1px;
  padding:0; margin:-1px;
  overflow:hidden; clip:rect(0,0,0,0);
  white-space:nowrap; border:0;
}