:root {
  color-scheme: dark;
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --bg: #060d0a;
  --gold: #ffd75e;
  --gold-2: #f0b23c;
  --ink: #eefaf3;
  --muted: #9db8aa;
  --line: rgb(148 214 184 / 15%);
  --glass: rgb(12 30 22 / 70%);
  --glass-2: rgb(17 42 32 / 55%);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1100px 640px at 10% -8%, #1c4a33 0%, transparent 55%),
    radial-gradient(900px 600px at 106% 0%, #143a2b 0%, transparent 50%),
    radial-gradient(900px 700px at 50% 120%, #0c2a1e 0%, transparent 55%),
    var(--bg);
  color: var(--ink);
  overflow-x: hidden;
}

button, input { font: inherit; }

button {
  border: 1px solid #3c5a4c;
  background: linear-gradient(180deg, #1c352a, #12241c);
  color: var(--ink);
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .2s ease, filter .2s ease;
}
button:hover { filter: brightness(1.15); transform: translateY(-1px); }
button:active { transform: translateY(0); }
button:disabled { opacity: .45; cursor: not-allowed; filter: none; transform: none; }

button.primary {
  background: linear-gradient(180deg, #ffe08a, #e5a43c);
  color: #171f15;
  border-color: #ffd866;
  font-weight: 800;
  box-shadow: 0 6px 22px rgb(255 216 102 / 28%);
}
button.primary:hover { box-shadow: 0 8px 28px rgb(255 216 102 / 45%); }

button.small { padding: 7px 10px; font-size: 13px; }

input {
  width: 100%;
  border: 1px solid #365549;
  background: rgb(7 18 13 / 75%);
  color: #fff;
  border-radius: 12px;
  padding: 11px 12px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgb(229 197 92 / 15%);
}

.shell { width: min(1340px, calc(100% - 24px)); margin: 0 auto; padding: 28px 0 50px; }

.card {
  border: 1px solid var(--line);
  background: var(--glass);
  box-shadow: 0 24px 70px rgb(0 0 0 / 40%), inset 0 1px 0 rgb(255 255 255 / 4%);
  border-radius: 20px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.lobby {
  max-width: 520px;
  margin: 8vh auto 0;
  padding: 34px;
  display: grid;
  gap: 24px;
  position: relative;
  overflow: hidden;
}
.lobby::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(600px 240px at 50% -10%, rgb(255 216 102 / 10%), transparent 60%);
}

h1 {
  font-size: clamp(36px, 8vw, 64px);
  margin: 4px 0 12px;
  line-height: .95;
  background: linear-gradient(180deg, #fff, #bfd9c9);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
h2, h3, p { margin-top: 0; }

.eyebrow {
  font-size: 12px;
  letter-spacing: .22em;
  color: var(--gold);
  font-weight: 800;
  margin-bottom: 8px;
  text-transform: uppercase;
}
.muted { color: var(--muted); }

label { display: grid; gap: 8px; font-weight: 700; }
.lobby-actions { display: grid; gap: 10px; }
.join-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.error { color: #ff9090; min-height: 1.2em; margin: 0; }
.hidden { display: none !important; }

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

.topbar {
  min-height: 110px;
  padding: 20px 22px;
  display: grid;
  grid-template-columns: 1fr 1.2fr auto;
  align-items: center;
  gap: 18px;
}
.room-code-row { display: flex; align-items: center; gap: 10px; }
.room-code-row h2 {
  margin: 0;
  letter-spacing: .18em;
  font-size: 26px;
  background: linear-gradient(180deg, #ffe8a0, #d9a52f);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.status-block { text-align: center; }
.status-block p { margin: 8px 0 0; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid #3a5c4b;
  background: rgb(30 66 50 / 50%);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.badge::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 10px var(--gold);
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

.admin-controls { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }

.playback-info {
  margin: 8px 0 0;
  font-size: 12px;
  font-weight: 800;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: .1em;
}

.speed-ctl {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid #365549;
  background: rgb(7 18 13 / 60%);
  border-radius: 12px;
  padding: 7px 10px;
}
.speed-ctl input[type="range"] {
  width: 90px;
  height: 6px;
  border: 0;
  padding: 0;
  background: linear-gradient(90deg, #e5a43c, #ffd75e);
  border-radius: 999px;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  box-shadow: none;
}
.speed-ctl input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: linear-gradient(180deg, #fff, #d8d0b8);
  border: 2px solid #e5a43c;
  box-shadow: 0 2px 8px rgb(0 0 0 / 45%);
  cursor: grab;
}
.speed-ctl input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: linear-gradient(180deg, #fff, #d8d0b8);
  border: 2px solid #e5a43c;
  box-shadow: 0 2px 8px rgb(0 0 0 / 45%);
  cursor: grab;
}

.viewer-tag {
  color: #7fd6ff;
  background: rgb(127 214 255 / 12%);
  border-color: rgb(127 214 255 / 25%);
}

.layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 14px; align-items: start; }
.role-player .layout, .role-spectator .layout { grid-template-columns: minmax(0, 1fr) 360px; }

.table-card { padding: 14px; overflow: hidden; }
.table-wrap { border-radius: 16px; overflow: hidden; box-shadow: 0 18px 50px rgb(0 0 0 / 45%); }
#table {
  display: block;
  width: 100%;
  height: auto;
  background: #174f36;
  cursor: crosshair;
}

.strike-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 8px 2px;
  flex-wrap: wrap;
}
.strike-label {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
}
.strike-btns { display: flex; gap: 8px; flex-wrap: wrap; }

.power-ctl {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  padding-left: 16px;
  border-left: 1px solid rgb(255 255 255 / 8%);
  flex-wrap: wrap;
}
.power-ctl input[type="range"] {
  width: 150px;
  height: 6px;
  border: 0;
  padding: 0;
  background: linear-gradient(90deg, #e5a43c, #ffd75e);
  border-radius: 999px;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  box-shadow: none;
}
.power-ctl input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(180deg, #fff, #d8d0b8);
  border: 2px solid #e5a43c;
  box-shadow: 0 2px 8px rgb(0 0 0 / 45%);
  cursor: grab;
}
.power-ctl input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(180deg, #fff, #d8d0b8);
  border: 2px solid #e5a43c;
  box-shadow: 0 2px 8px rgb(0 0 0 / 45%);
  cursor: grab;
}
button.power-max {
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 800;
  color: #ffe08a;
  border-color: #6b5226;
  background: linear-gradient(180deg, #3a2c14, #241c0b);
}
button.power-max:hover { filter: brightness(1.2); }
.power-value {
  min-width: 40px;
  text-align: center;
  font-weight: 800;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

.strike-btn {
  padding: 8px 13px;
  font-size: 13px;
  font-weight: 700;
  border-radius: 999px;
  border: 1px solid #3a594b;
  background: linear-gradient(180deg, #1a3328, #10231a);
  color: #cfe0d6;
  transition: transform .12s ease, box-shadow .2s ease, background .2s ease, color .2s ease;
}
.strike-btn:hover { transform: translateY(-2px); filter: brightness(1.18); }
.strike-btn.active {
  background: linear-gradient(180deg, #ffe08a, #e5a43c);
  color: #171f15;
  border-color: #ffd866;
  font-weight: 800;
  box-shadow: 0 4px 18px rgb(255 216 102 / 35%);
}
.strike-btn.active:hover { filter: brightness(1.06); }

.hint { margin: 10px 6px 0; color: var(--muted); font-size: 13px; line-height: 1.5; }

.sidebar { padding: 20px; }
.sidebar-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.sidebar-title h3 { margin: 0; }

.sidebar .room-code-row { flex-wrap: wrap; }
.sidebar .room-code-row h2 { font-size: 21px; letter-spacing: .14em; }
.sidebar .room-name { max-width: 100%; }
.sidebar .badge { margin: 0; }
.sidebar .status-block { text-align: left; }
.sidebar .status-block p { margin: 8px 0 0; }
.sidebar-room-info { display: grid; gap: 10px; margin-bottom: 6px; }
.sidebar-room-info .room-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.sidebar-room-info .room-code-row { flex: 1 1 auto; }

.player {
  padding: 13px 0;
  border-top: 1px solid rgb(255 255 255 / 7%);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}
.player:first-child { border-top: 0; }
.player-name { font-weight: 800; }
.player-meta { color: var(--muted); font-size: 12px; margin-top: 3px; }
.player.turn .player-name { color: var(--gold); }
.player.turn .player-name::before { content: "▶ "; color: var(--gold); }
.admin-tag {
  color: var(--gold);
  background: rgb(255 215 94 / 12%);
  border: 1px solid rgb(255 215 94 / 25%);
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10px;
  letter-spacing: .06em;
}
.score {
  font-size: 22px;
  font-weight: 900;
  background: linear-gradient(180deg, #fff, #a8c4b4);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.kick {
  margin-top: 7px;
  padding: 5px 9px;
  font-size: 11px;
  color: #ffb3b3;
  border-color: #743d3d;
  background: linear-gradient(180deg, #3a1f1f, #241313);
}

.legend {
  border-top: 1px solid rgb(255 255 255 / 8%);
  margin-top: 14px;
  padding-top: 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}
.legend p { margin-bottom: 8px; }
.legend strong { color: var(--ink); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: #4a1f1f;
  border: 1px solid #a55a5a;
  color: #ffdcdc;
  padding: 12px 16px;
  border-radius: 12px;
  z-index: 10;
  box-shadow: 0 14px 40px rgb(0 0 0 / 45%);
}

@media (max-width: 900px) {
  .topbar { grid-template-columns: 1fr; text-align: left; }
  .status-block { text-align: left; }
  .admin-controls { justify-content: flex-start; }
  .layout { grid-template-columns: 1fr; }
  .strike-bar { flex-direction: column; align-items: flex-start; }
  .power-ctl { margin-left: 0; padding-left: 0; border-left: 0; }
}

/* Landing / role selection */
.landing { max-width: 720px; }
.role-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.role-card {
  display: grid;
  gap: 8px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, rgb(20 46 35 / 70%), rgb(9 24 18 / 70%));
  color: var(--ink);
  text-decoration: none;
  transition: transform .12s ease, box-shadow .2s ease, border-color .2s ease;
}
.role-card:hover { transform: translateY(-2px); border-color: rgb(255 215 94 / 40%); box-shadow: 0 14px 40px rgb(0 0 0 / 40%); }
.role-card strong { font-size: 20px; }
.role-card p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.role-port {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--gold);
}

/* Room name chip in the topbar */
.room-name {
  font-size: 13px;
  font-weight: 800;
  background: rgb(255 215 94 / 10%);
  border: 1px solid rgb(255 215 94 / 22%);
  color: var(--gold);
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

/* Admin console extras */
#adminLogin { display: grid; gap: 10px; }
#adminCreate { display: grid; gap: 10px; }

.sessions { margin-top: 14px; padding: 20px; }
.sessions .sidebar-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.sessions .sidebar-title h3 { margin: 0; }

.session-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid rgb(255 255 255 / 7%);
}
.session-item:first-child { border-top: 0; }

/* Review overlay */
.review-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: rgb(3 8 6 / 78%);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 16px;
}
.review-card {
  width: min(1100px, 100%);
  padding: 20px;
  display: grid;
  gap: 14px;
}
.review-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.review-header h3 { margin: 0; font-size: 20px; }
.review-header p { margin: 6px 0 0; }
.review-canvas-wrap {
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 18px 50px rgb(0 0 0 / 50%);
}
#reviewCanvas { display: block; width: 100%; height: auto; background: #174f36; }
.review-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.review-controls select {
  border: 1px solid #365549;
  background: rgb(7 18 13 / 75%);
  color: #fff;
  border-radius: 12px;
  padding: 8px 10px;
  max-width: 220px;
}
.review-progress { margin-left: auto; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }

/* Voice & camera panel */
.media-panel { margin-top: 18px; border-top: 1px solid rgb(255 255 255 / 7%); padding-top: 14px; display: grid; gap: 10px; }
.media-panel .sidebar-title { display: flex; align-items: center; margin: 0; }
.media-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.media-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
  border: 1px solid #365549;
  background: rgb(7 18 13 / 60%);
  color: #dfe;
  border-radius: 12px;
  padding: 9px 10px;
  cursor: pointer;
  font-size: 13px;
  transition: border-color .15s ease, background .15s ease, opacity .15s ease;
}
.media-btn:hover:not(:disabled) { border-color: var(--gold); }
.media-btn:disabled { opacity: .45; cursor: not-allowed; }
.media-btn.on { border-color: #59d98a; background: rgb(38 130 78 / 25%); }
.mp3-controls { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.mp3-file {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  border: 1px dashed #365549;
  border-radius: 12px;
  padding: 8px 10px;
  cursor: pointer;
  flex: 1;
}
.mp3-file input { max-width: 150px; }
.mp3-status { font-size: 12px; margin: 0; color: var(--gold); min-height: 16px; }
.remote-videos { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.role-player .remote-videos, .role-spectator .remote-videos { grid-template-columns: 1fr; }
.remote-video { position: relative; border-radius: 10px; overflow: hidden; background: #000; aspect-ratio: 4/3; }
.remote-video video { width: 100%; height: 100%; object-fit: cover; display: block; }
.remote-label {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  font-size: 11px;
  padding: 3px 6px;
  background: rgb(0 0 0 / 55%);
  color: #fff;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}
.media-dot { font-size: 12px; margin-left: 3px; opacity: .45; }
.media-dot.mic-on, .media-dot.cam-on { opacity: 1; }
.media-dot.media-locked { opacity: .25; }
.perm-row { display: flex; gap: 6px; margin: 6px 0 0 8px; flex-wrap: wrap; }
.perm-btn {
  border: 1px solid #365549;
  background: rgb(7 18 13 / 60%);
  color: #dfe;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 11px;
  cursor: pointer;
}
.perm-btn:hover { border-color: var(--gold); }
.perm-btn.on { border-color: #59d98a; color: #b9f5cd; }

