/* ═══════════════════════════════════════════════════════════════════════════
   CARROM BOARD — Premium Board Game Styles
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Shell ── */
.cr-shell {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  background:
    radial-gradient(circle at 18% 12%, rgba(250,204,21,0.14), transparent 30%),
    linear-gradient(135deg, #101416 0%, #0a0804 45%, #14100b 100%);
  font-family: "Space Grotesk", system-ui, sans-serif;
  overflow: hidden;
  position: relative;
}
.cr-shell, .cr-shell * { box-sizing: border-box; }

/* ── Header Bar ── */
.cr-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  background: rgba(8,10,12,0.72);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  gap: 12px;
  flex-wrap: wrap;
  position: relative;
  z-index: 10;
}
.cr-header-left { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.cr-game-title { font-size: 0.95rem; font-weight: 800; letter-spacing: 0.04em; color: #fff; }
.cr-phase-badge {
  font-size: 0.65rem; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; padding: 3px 10px; border-radius: 999px;
  background: rgba(255,255,255,0.07); color: rgba(255,255,255,0.6);
  border: 1px solid rgba(255,255,255,0.1);
}
.cr-phase-badge.active { background: rgba(250,204,21,0.15); color: #facc15; border-color: rgba(250,204,21,0.3); }

.cr-score-btn {
  display: flex; align-items: center; gap: 6px;
  font-size: 0.72rem; font-weight: 700; padding: 5px 12px;
  border-radius: 999px; border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.05); color: rgba(255,255,255,0.7);
  cursor: pointer; transition: background 0.15s, color 0.15s;
}
.cr-score-btn:hover { background: rgba(255,255,255,0.10); color: #fff; }

/* ── Arena ── */
.cr-arena {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  padding: 14px;
  gap: 12px;
  min-height: 0;
}

/* ── Board Container ── */
.cr-board-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cr-board-wrap {
  position: relative;
  width: 520px;
  height: 520px;
  border-radius: 18px;
  background: linear-gradient(145deg, #e3bd76 0%, #c4943f 45%, #8c5a27 100%);
  border: 10px solid #4d2f18;
  box-shadow:
    0 0 0 2px rgba(255,231,172,0.2),
    0 0 0 6px #211309,
    0 20px 60px rgba(0,0,0,0.7),
    inset 0 0 36px rgba(255,255,255,0.12),
    inset 0 0 60px rgba(0,0,0,0.2);
  overflow: hidden;
}

.cr-board-canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
}

/* ── Player Info Strip ── */
.cr-players-strip {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
  max-width: 560px;
}

.cr-player-pod {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: rgba(12,15,18,0.66);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 10px;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  transition: border-color 0.2s, box-shadow 0.2s;
  flex: 1;
  min-width: 140px;
  max-width: 260px;
}
.cr-player-pod.is-active {
  border-color: rgba(250,204,21,0.4);
  box-shadow: 0 0 20px rgba(250,204,21,0.1);
  animation: crTurnPulse 1.5s ease infinite;
}
.cr-player-pod.is-me {
  border-color: rgba(99,102,241,0.5);
  box-shadow: 0 0 20px rgba(99,102,241,0.12);
  background: rgba(99,102,241,0.06);
}
.cr-player-pod.is-ai { opacity: 0.85; }

@keyframes crTurnPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(250,204,21,0.3); }
  50% { box-shadow: 0 0 0 8px rgba(250,204,21,0); }
}

.cr-pod-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, #2a1a0a, #1a0f05);
  border: 2px solid rgba(255,255,255,0.12);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem; font-weight: 800; color: rgba(255,255,255,0.8);
  flex-shrink: 0;
}
.cr-pod-avatar.is-white { background: linear-gradient(135deg, #f5f0e8, #d4c9b8); color: #2a1a0a; border-color: rgba(212,169,99,0.5); }
.cr-pod-avatar.is-black { background: linear-gradient(135deg, #1a1a1a, #333); color: #fff; border-color: rgba(100,100,100,0.5); }

.cr-pod-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cr-pod-name {
  font-size: 0.75rem; font-weight: 700; color: rgba(255,255,255,0.85);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cr-pod-stats {
  display: flex; gap: 8px; font-size: 0.65rem; color: rgba(255,255,255,0.45);
}
.cr-pod-score { font-weight: 700; color: #facc15; }
.cr-pod-tag {
  font-size: 0.55rem; text-transform: uppercase; letter-spacing: 0.1em;
  color: rgba(255,255,255,0.3);
}
.cr-pod-tag.you { color: #818cf8; }
.cr-pod-tag.ai { color: rgba(255,255,255,0.25); }

/* ── Shot Controls ── */
.cr-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: rgba(10,12,14,0.74);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  width: 100%;
  max-width: 640px;
  flex-wrap: wrap;
  justify-content: center;
  box-shadow: 0 14px 34px rgba(0,0,0,0.24);
}

.cr-power-group {
  display: flex; align-items: center; gap: 10px; flex: 1; min-width: 180px;
}
.cr-power-label {
  font-size: 0.65rem; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: rgba(255,255,255,0.4); white-space: nowrap;
}
.cr-power-slider {
  flex: 1; -webkit-appearance: none; appearance: none;
  height: 8px; border-radius: 999px;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.9), rgba(255,255,255,0.9)) 0 / var(--cr-value, 42%) 100% no-repeat,
    linear-gradient(90deg, #16a34a 0%, #facc15 52%, #ef4444 100%);
  outline: none;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.45);
  transition: background-size 0.42s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.2s ease;
}
.cr-striker-slider {
  background:
    linear-gradient(90deg, rgba(129,140,248,0.95), rgba(129,140,248,0.95)) 0 / var(--cr-value, 50%) 100% no-repeat,
    rgba(255,255,255,0.12);
}
.cr-direction-slider {
  background:
    linear-gradient(90deg, rgba(250,204,21,0.96), rgba(250,204,21,0.96)) 0 / var(--cr-value, 50%) 100% no-repeat,
    linear-gradient(90deg, rgba(239,68,68,0.5), rgba(255,255,255,0.14) 50%, rgba(34,197,94,0.5));
}
.cr-power-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 20px; height: 20px;
  border-radius: 50%; background: #fff;
  border: 3px solid #111827;
  box-shadow: 0 2px 8px rgba(0,0,0,0.38), 0 0 0 2px rgba(255,255,255,0.18);
  cursor: pointer;
  transition: transform 0.26s ease, box-shadow 0.26s ease;
}
.cr-power-slider:active::-webkit-slider-thumb { transform: scale(1.16); }
.cr-power-slider::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%; background: #fff;
  border: 3px solid #111827; cursor: pointer;
  transition: transform 0.26s ease, box-shadow 0.26s ease;
}
.cr-power-slider:active::-moz-range-thumb { transform: scale(1.16); }
.cr-power-slider:disabled { opacity: 0.45; cursor: not-allowed; }
.cr-power-value {
  font-size: 1rem; font-weight: 900; color: #facc15;
  font-family: "Space Grotesk", sans-serif; min-width: 28px; text-align: center;
}
.cr-position-value { color: #a5b4fc; min-width: 42px; }
.cr-direction-value { color: #fde68a; min-width: 46px; }

.cr-shoot-btn {
  padding: 10px 26px; border-radius: 10px;
  background: linear-gradient(135deg, #4f46e5, #2563eb);
  color: #fff; font-size: 0.88rem; font-weight: 700;
  border: none; cursor: pointer;
  box-shadow: 0 4px 16px rgba(37,99,235,0.36);
  transition: transform 0.12s, box-shadow 0.12s;
}
.cr-shoot-btn:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(37,99,235,0.5); }
.cr-shoot-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.cr-turn-hint {
  font-size: 0.75rem; color: rgba(255,255,255,0.4); text-align: center; width: 100%;
}
.cr-turn-hint.is-my-turn {
  color: #facc15; font-weight: 700;
  animation: crTurnPulse 1.5s ease infinite;
}

/* ── Foul Banner ── */
.cr-foul-banner {
  background: rgba(239,68,68,0.15);
  border: 1px solid rgba(239,68,68,0.3);
  color: #f87171; font-size: 0.78rem; font-weight: 700;
  padding: 8px 18px; border-radius: 12px;
  text-align: center; width: 100%; max-width: 560px;
  animation: crFoulFlash 0.5s ease;
}
@keyframes crFoulFlash {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ── Waiting Panel ── */
.cr-waiting-panel {
  position: absolute; inset: 0; z-index: 20;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 20px; padding: 32px;
  background: rgba(5,6,7,0.66);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.cr-waiting-title { font-size: 1.6rem; font-weight: 900; color: #fff; text-align: center; }
.cr-waiting-sub {
  font-size: 0.85rem; color: rgba(255,255,255,0.5); text-align: center;
  max-width: 320px; line-height: 1.6;
}

.cr-start-btn {
  padding: 12px 32px; border-radius: 10px;
  background: linear-gradient(135deg, #4f46e5, #2563eb);
  color: #fff; font-size: 0.9rem; font-weight: 700;
  border: none; cursor: pointer;
  box-shadow: 0 6px 20px rgba(99,102,241,0.4);
  transition: transform 0.12s, box-shadow 0.12s;
}
.cr-start-btn:hover { transform: scale(1.04); box-shadow: 0 8px 28px rgba(99,102,241,0.55); }

.cr-reset-btn {
  padding: 10px 22px; border-radius: 10px;
  background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.6);
  font-size: 0.82rem; font-weight: 700; border: 1px solid rgba(255,255,255,0.1);
  cursor: pointer; transition: background 0.12s;
}
.cr-reset-btn:hover { background: rgba(255,255,255,0.1); color: #fff; }

/* ── Game Over Overlay ── */
.cr-game-over-overlay {
  position: absolute; inset: 0; z-index: 35;
  background: rgba(0,0,0,0.85);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.cr-game-over-panel {
  background: linear-gradient(135deg, #1a1208, #0d0904);
  border: 1px solid rgba(212,169,99,0.25);
  border-radius: 28px; padding: 36px 32px;
  width: 100%; max-width: 420px; text-align: center;
  display: flex; flex-direction: column; gap: 16px;
  box-shadow: 0 40px 100px rgba(0,0,0,0.9), 0 0 60px rgba(212,169,99,0.05);
  animation: crPanelPop 0.35s cubic-bezier(0.175,0.885,0.32,1.28) both;
}
@keyframes crPanelPop {
  from { transform: scale(0.88) translateY(16px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}
.cr-game-over-icon { font-size: 3rem; animation: crIconBounce 0.6s ease both 0.2s; }
@keyframes crIconBounce {
  0% { transform: scale(0.5); opacity: 0; }
  70% { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}
.cr-game-over-title { font-size: 1.8rem; font-weight: 900; color: #facc15; }
.cr-game-over-sub { font-size: 0.88rem; color: rgba(255,255,255,0.55); line-height: 1.5; }

/* ── Round Over Overlay ── */
.cr-round-over-overlay {
  position: absolute; inset: 0; z-index: 25;
  background: rgba(0,0,0,0.75);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.cr-round-over-panel {
  background: #0a0e12;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 24px; padding: 28px;
  width: 100%; max-width: 440px;
  display: flex; flex-direction: column; gap: 16px;
  box-shadow: 0 32px 80px rgba(0,0,0,0.8);
  animation: crPanelPop 0.28s cubic-bezier(0.175,0.885,0.32,1.28) both;
}
.cr-round-over-title { font-size: 1.2rem; font-weight: 800; color: #fff; text-align: center; }
.cr-round-scores {
  display: flex; flex-direction: column; gap: 8px;
}
.cr-round-score-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 14px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
  font-size: 0.82rem; color: rgba(255,255,255,0.7);
}
.cr-round-score-row strong { color: #facc15; font-weight: 800; }

/* ── Log ── */
.cr-log-panel { background: rgba(0,0,0,0.3); border-top: 1px solid rgba(255,255,255,0.05); width: 100%; }
.cr-log-toggle {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 18px; cursor: pointer;
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: rgba(255,255,255,0.35);
}
.cr-log-toggle:hover { color: rgba(255,255,255,0.55); }
.cr-log-list { max-height: 120px; overflow-y: auto; padding: 0 18px 10px; display: none; }
.cr-log-panel.is-open .cr-log-list { display: block; }
.cr-log-item {
  font-size: 0.75rem; color: rgba(255,255,255,0.5); padding: 4px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04); line-height: 1.4;
}
.cr-log-item:last-child { border-bottom: none; }

/* ── Responsive ── */
@media (max-width: 600px) {
  .cr-shell { min-height: 100dvh; }
  .cr-header { padding: 8px 10px; gap: 8px; }
  .cr-game-title { font-size: 0.82rem; }
  .cr-phase-badge, .cr-score-btn, .cr-reset-btn { font-size: 0.58rem; padding: 4px 8px !important; }
  .cr-arena { padding: 8px; gap: 8px; }

  .cr-board-wrap {
    width: min(92vw, 380px);
    height: min(92vw, 380px);
    border-width: 5px;
  }

  .cr-players-strip { gap: 6px; }
  .cr-player-pod {
    padding: 8px 10px; gap: 8px; border-radius: 12px;
    min-width: 110px;
  }
  .cr-pod-avatar { width: 28px; height: 28px; font-size: 0.7rem; }
  .cr-pod-name { font-size: 0.68rem; }
  .cr-pod-stats { font-size: 0.58rem; }

  .cr-controls {
    padding: 10px 14px; gap: 10px; border-radius: 14px;
  }
  .cr-shoot-btn { padding: 8px 20px; font-size: 0.8rem; }

  .cr-game-over-panel, .cr-round-over-panel { padding: 20px 16px; border-radius: 18px; }
}

@media (max-width: 380px) {
  .cr-board-wrap {
    width: min(96vw, 320px);
    height: min(96vw, 320px);
    border-width: 4px;
  }
}
