/* Carrom overlays on top of chess.css + fit-viewport */
:root {
  --carrom-felt: #c4a35a;
  --carrom-ink: #f4efe6;
}

.dot.white { background: #f2efe8; }
.dot.black { background: #222; }
.dot.queen { background: #c62828; }

.board-chrome {
  position: absolute;
  top: 10px;
  left: 10px;
  right: calc(10px + 72px);
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  pointer-events: none;
  max-height: min(42%, 280px);
  overflow: hidden;
}
.in-game-info {
  width: 100%;
  max-width: 720px;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.igi-top {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: center;
}
.igi-block {
  min-width: 4.5rem;
  padding: 0.35rem 0.6rem;
  border-radius: 12px;
  background: rgba(18, 12, 8, 0.92);
  border: 1px solid rgba(255, 236, 210, 0.16);
  color: var(--carrom-ink);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.35);
}
.igi-block.igi-status { flex: 1 1 12rem; min-width: min(100%, 12rem); }
.igi-label {
  display: block;
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted, #a89880);
  margin-bottom: 0.1rem;
}
.igi-block strong {
  font-size: 0.88rem;
  font-weight: 800;
  line-height: 1.2;
}
.igi-copy {
  pointer-events: auto;
  align-self: center;
  padding: 0.45rem 0.75rem !important;
  font-size: 0.78rem !important;
  background: rgba(18, 12, 8, 0.92) !important;
}
.igi-players {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  justify-content: center;
}
.igi-seat {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  background: rgba(18, 12, 8, 0.88);
  border: 1px solid rgba(255, 236, 210, 0.14);
  color: #f2ebe0;
  font-size: 0.74rem;
  font-weight: 700;
}
.igi-seat.you { border-color: var(--accent, #d4a24c); }
.igi-seat.empty { opacity: 0.55; }

.score-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: center;
  width: 100%;
  max-width: 720px;
}
.score-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: rgba(18, 12, 8, 0.88);
  border: 1px solid rgba(255, 236, 210, 0.16);
  color: #f2ebe0;
  font-size: 0.78rem;
  font-weight: 700;
}
.score-chip.lead { border-color: var(--accent, #d4a24c); }

.aim-hint {
  margin: 0;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  background: rgba(18, 12, 8, 0.78);
  color: #e8d9c0;
  font-size: 0.72rem;
  font-weight: 600;
}

.btn-game-menu {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 22;
  padding: 0.45rem 0.8rem !important;
  font-size: 0.8rem !important;
  background: rgba(18, 12, 8, 0.92) !important;
  color: #f2ebe0 !important;
  border: 1px solid rgba(255, 236, 210, 0.2) !important;
}
.game-menu {
  position: absolute;
  top: 48px;
  right: 10px;
  z-index: 25;
  width: min(300px, calc(100% - 20px));
  max-height: min(70vh, 520px);
  overflow: auto;
  padding: 0.75rem;
  border-radius: 14px;
  background: #14100c;
  border: 1px solid rgba(255, 236, 210, 0.18);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  color: #f2ebe0;
}
.game-menu[hidden] { display: none !important; }
.game-menu-title {
  margin: 0 0 0.45rem;
  font-size: 0.78rem;
  font-weight: 800;
}
.game-menu-title span { color: var(--muted, #a89880); font-weight: 600; }
.game-menu-styles {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.5rem;
}
.game-menu-styles .cpu-pick,
.game-menu-styles button {
  pointer-events: auto;
  padding: 0.35rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 236, 210, 0.2);
  background: #1c1610;
  color: #f2ebe0;
  font-size: 0.72rem;
  cursor: pointer;
}
.game-menu-styles .cpu-pick.on,
.game-menu-styles button.on {
  border-color: var(--accent, #d4a24c);
  background: #2a2014;
}
.game-menu-sep {
  height: 1px;
  background: rgba(255, 236, 210, 0.12);
  margin: 0.45rem 0;
}
.game-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.45rem 0.5rem;
  border: 0;
  background: transparent;
  color: #f2ebe0;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  border-radius: 8px;
}
.game-menu-item:hover { background: rgba(255, 236, 210, 0.08); }
.game-menu-room,
.game-menu-analytics,
.game-menu-hint {
  margin: 0.35rem 0 0;
  font-size: 0.72rem;
  color: var(--muted, #a89880);
}
.game-menu-room { color: #f2ebe0; font-weight: 800; font-size: 0.8rem; }
.game-menu-hints {
  margin: 0 0 0.35rem;
  padding: 0 0 0 1.05rem;
  display: grid;
  gap: 0.35rem;
  font-size: 0.72rem;
  line-height: 1.35;
  color: #d8cbb6;
}
.game-menu-hints b { color: #f2ebe0; }
.lobby-hints {
  margin: 0.85rem 0 0;
  padding: 0.65rem 0.8rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 236, 210, 0.14);
  background: rgba(20, 16, 12, 0.55);
  color: #d8cbb6;
  font-size: 0.84rem;
}
.lobby-hints summary {
  cursor: pointer;
  font-weight: 800;
  color: #f2ebe0;
}
.lobby-hints ul {
  margin: 0.55rem 0 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.35rem;
  line-height: 1.4;
}
.lobby-hints b { color: #fff; }

.analytics-chip {
  position: absolute;
  left: 10px;
  bottom: 64px;
  z-index: 16;
  padding: 0.35rem 0.65rem;
  border-radius: 12px;
  background: rgba(18, 12, 8, 0.88);
  border: 1px solid rgba(255, 236, 210, 0.14);
  color: #e8d9c0;
  font-size: 0.72rem;
  pointer-events: none;
}
.analytics-chip .analytics-kicker {
  display: block;
  font-size: 0.6rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted, #a89880);
}
.analytics-chip strong { color: #fff; }

.board-actions {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  z-index: 18;
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  justify-content: center;
  pointer-events: none;
}
.board-actions .btn {
  pointer-events: auto;
  background: rgba(18, 12, 8, 0.92) !important;
  color: #f2ebe0 !important;
  border: 1px solid rgba(255, 236, 210, 0.2) !important;
}
.board-actions .btn.primary {
  background: #8b5a2b !important;
  border-color: #d4a24c !important;
}

.game-over {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(8, 5, 3, 0.55);
  backdrop-filter: blur(4px);
}
.game-over[hidden] { display: none !important; }
.game-over-card {
  width: min(420px, 94%);
  background: #14100c;
  border: 1px solid rgba(255, 236, 210, 0.18);
  border-radius: 18px;
  padding: 1.15rem 1.2rem 1.25rem;
  text-align: center;
  color: #f2ebe0;
}
.game-over-kicker {
  margin: 0 0 0.25rem;
  color: var(--muted, #a89880);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.game-over-card h2 {
  margin: 0 0 0.35rem;
  font-family: "Bebas Neue", sans-serif;
  font-size: clamp(2rem, 5vw, 2.6rem);
  color: var(--accent, #d4a24c);
}
.game-over-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 0.85rem;
}

html.fit-viewport body.is-playing .hud,
html.fit-viewport body.is-playing .players,
html.fit-viewport body.is-playing .share,
html.fit-viewport body.is-playing .turn {
  display: none !important;
}

.strike-power {
  position: absolute;
  left: 50%;
  bottom: 58px;
  transform: translateX(-50%);
  z-index: 17;
  width: min(220px, 50%);
  height: 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
  overflow: hidden;
  pointer-events: none;
}
.strike-power > i {
  display: block;
  height: 100%;
  width: 55%;
  background: linear-gradient(90deg, #8b5a2b, #d4a24c);
}

@media (max-width: 900px) {
  .board-chrome { right: 10px; }
  .analytics-chip { bottom: 110px; }
}

/* 4-seat table + bar TVs on both ends */
.carrom-stage { max-width: none !important; width: 100% !important; }
.carrom-play-grid {
  display: grid;
  grid-template-columns: minmax(160px, 22%) minmax(0, 1fr) minmax(180px, 24%);
  gap: 0.45rem;
  align-items: stretch;
  width: 100%;
  min-height: 0;
  height: 100%;
}
html.fit-viewport body.is-playing .carrom-play-grid {
  height: 100%;
  min-height: 0;
}
html.fit-viewport body.is-playing .carrom-stage {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
html.fit-viewport body.is-playing .carrom-play-grid .chess-canvas-wrap {
  height: 100% !important;
  max-height: none !important;
  aspect-ratio: auto !important;
}
.jukebox {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
  min-height: 0;
  padding: 0.45rem;
  border-radius: 14px;
  background: rgba(10, 8, 6, 0.92);
  border: 1px solid rgba(255, 236, 210, 0.12);
  overflow: hidden;
}
.jukebox-kicker {
  margin: 0;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #a89880;
  font-weight: 800;
}
.jukebox-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  overflow: hidden;
  background: #000;
  flex: 0 0 auto;
}
.jukebox-frame-sm { aspect-ratio: 16 / 10; max-height: 140px; }
.yt-host, .yt-host iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.jukebox-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 0.5rem;
  color: #a89880;
  font-size: 0.78rem;
  text-align: center;
  pointer-events: none;
}
.jukebox-now {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  color: #f2ebe0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.jukebox-form {
  display: flex;
  gap: 0.3rem;
}
.jukebox-form input {
  flex: 1;
  min-width: 0;
  padding: 0.4rem 0.5rem;
  border-radius: 8px;
  border: 1px solid rgba(255,236,210,0.18);
  background: #1c1610;
  color: #f2ebe0;
  font-size: 0.72rem;
}
.jukebox-actions { display: flex; gap: 0.3rem; }
.jukebox-queue {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 7rem;
  overflow: auto;
  font-size: 0.7rem;
  color: #e8d9c0;
}
.jukebox-queue li {
  padding: 0.25rem 0;
  border-bottom: 1px solid rgba(255,236,210,0.08);
}
.jukebox-log { flex: 1 1 auto; min-height: 0; overflow: hidden; display: flex; flex-direction: column; }
.jukebox-log .moves { flex: 1; min-height: 0; overflow: auto; max-height: 5.5rem; }
.jukebox .chat-log { max-height: 5rem; }
.jukebox-analytics {
  position: static !important;
  margin-top: auto;
}
@media (max-width: 900px) {
  .carrom-play-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto;
  }
  .jukebox-left { order: 2; max-height: 28vh; }
  .chess-canvas-wrap { order: 1; min-height: 42vh; }
  .jukebox-right { order: 3; max-height: 34vh; }
}
