/* ========================================================
   Royal Chess 3D - Game Arena Styles
   3D Canvas, Controls, Move History, Timers & Overlays
   ======================================================== */

.game-body {
  overflow-x: hidden;
}

.game-main-layout {
  max-width: 1480px;
  margin: 1rem auto 2.5rem;
  padding: 0 1.25rem;
  display: grid;
  grid-template-columns: 280px minmax(540px, 740px) 360px;
  justify-content: center;
  gap: 1.75rem;
  align-items: start;
}

/* ================= Left Free Area Advertisement ================= */
.left-free-area {
  width: 100%;
  min-width: 0;
}

.left-ad-sticky {
  position: sticky;
  top: 5.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.left-free-area .ad-unit-wrapper {
  margin: 0;
  width: 100%;
}

.left-free-area .ad-unit-card {
  background: rgba(18, 22, 34, 0.88);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-lg);
  padding: 0.85rem 1rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), 0 0 14px rgba(212, 175, 55, 0.08);
  transition: all 0.3s ease;
}

.left-free-area .ad-unit-card:hover {
  border-color: rgba(212, 175, 55, 0.6);
  box-shadow: 0 6px 26px rgba(0, 0, 0, 0.65), 0 0 20px rgba(212, 175, 55, 0.16);
}

.left-free-area .adsense-visual-board {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  background: linear-gradient(135deg, rgba(22, 27, 44, 0.95) 0%, rgba(13, 16, 26, 0.95) 100%);
  border: 1px solid rgba(212, 175, 55, 0.2);
  border-radius: var(--radius-md);
  padding: 0.85rem;
}

.left-free-area .ad-board-inner {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.6rem;
  width: 100%;
}

.left-free-area .ad-board-header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.left-free-area .ad-board-icon {
  font-size: 1.6rem;
  color: var(--gold-bright);
  filter: drop-shadow(0 0 6px rgba(212, 175, 55, 0.4));
  flex-shrink: 0;
}

.left-free-area .ad-board-title {
  font-family: var(--font-serif);
  font-size: 0.92rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.4px;
  line-height: 1.25;
}

.left-free-area .ad-board-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin: 0;
}

.left-free-area .ad-board-btn {
  width: 100%;
  text-align: center;
  padding: 0.4rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 600;
  margin-top: 0.25rem;
}

/* ================= 3D Center Stage & Canvas ================= */
.stage-container {
  position: relative;
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.stage-container.center-stage {
  width: 100%;
}

.canvas-wrapper {
  position: relative;
  width: 100%;
  height: 680px; /* Big, commanding 3D board view in the center */
  max-height: 75vh;
  min-height: 480px;
  background: radial-gradient(circle at 50% 40%, #161b30 0%, #0a0e1c 55%, #05060d 100%);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 
    0 25px 60px rgba(0, 0, 0, 0.85),
    0 0 40px rgba(212, 175, 55, 0.15),
    inset 0 0 120px rgba(0, 0, 0, 0.7);
  user-select: none;
  cursor: grab;
  transition: box-shadow 0.4s ease, border-color 0.4s ease;
}

/* Dramatic Check Pulse on Stage */
.canvas-wrapper.in-check {
  border-color: rgba(239, 68, 68, 0.8);
  box-shadow: 
    0 25px 60px rgba(0, 0, 0, 0.9),
    0 0 50px rgba(239, 68, 68, 0.4),
    inset 0 0 120px rgba(239, 68, 68, 0.25);
  animation: canvasCheckPulse 1.2s infinite alternate ease-in-out;
}

@keyframes canvasCheckPulse {
  0% {
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.9), 0 0 30px rgba(239, 68, 68, 0.25), inset 0 0 100px rgba(239, 68, 68, 0.15);
  }
  100% {
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.9), 0 0 60px rgba(239, 68, 68, 0.5), inset 0 0 140px rgba(239, 68, 68, 0.35);
  }
}

/* Cinematic Lens Vignette */
.cinematic-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 50% 50%, transparent 40%, rgba(5, 7, 13, 0.35) 75%, rgba(3, 4, 8, 0.82) 100%);
  z-index: 5;
  box-shadow: inset 0 0 100px rgba(0, 0, 0, 0.75);
}

/* Cinematic Golden Viewfinder Framing Brackets */
.cinematic-bracket {
  position: absolute;
  width: 24px;
  height: 24px;
  border: 2px solid rgba(212, 175, 55, 0.5);
  pointer-events: none;
  z-index: 6;
  transition: all 0.3s ease;
}
.bracket-tl { top: 14px; left: 14px; border-right: none; border-bottom: none; border-top-left-radius: 4px; }
.bracket-tr { top: 14px; right: 14px; border-left: none; border-bottom: none; border-top-right-radius: 4px; }
.bracket-bl { bottom: 14px; left: 14px; border-right: none; border-top: none; border-bottom-left-radius: 4px; }
.bracket-br { bottom: 14px; right: 14px; border-left: none; border-top: none; border-bottom-right-radius: 4px; }

/* Anamorphic Golden Light Streak */
.cinematic-flare {
  position: absolute;
  top: 0;
  left: 20%;
  right: 20%;
  height: 1.5px;
  background: linear-gradient(90deg, transparent, rgba(212, 175, 55, 0.5), rgba(255, 235, 150, 0.9), rgba(212, 175, 55, 0.5), transparent);
  box-shadow: 0 0 18px rgba(212, 175, 55, 0.7);
  pointer-events: none;
  z-index: 6;
}

.canvas-wrapper:active {
  cursor: grabbing;
}

.canvas-wrapper canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

/* HUD Overlay: Top Toolbar (Status + Cameras, Zero Overlap) */
.hud-overlay-top {
  position: absolute;
  top: 0.75rem;
  left: 0.85rem;
  right: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
  z-index: 10;
}

.hud-status-badge {
  background: rgba(11, 13, 19, 0.88);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-gold);
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
  pointer-events: auto;
}

.status-indicator-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  box-shadow: 0 0 8px currentColor;
}

.status-indicator-dot.white {
  background-color: #fff;
  color: #fff;
}

.status-indicator-dot.black {
  background-color: #3b82f6;
  color: #3b82f6;
}

.status-indicator-dot.check {
  background-color: #ef4444;
  color: #ef4444;
  animation: pulseCheck 1s infinite alternate;
}

@keyframes pulseCheck {
  from { transform: scale(0.9); opacity: 0.7; }
  to { transform: scale(1.3); opacity: 1; }
}

.hud-cam-controls {
  display: flex;
  gap: 0.35rem;
  background: rgba(11, 13, 19, 0.88);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-color);
  padding: 0.25rem;
  border-radius: var(--radius-md);
  pointer-events: auto;
}

.cam-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.3rem 0.65rem;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.cam-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.cam-btn.active {
  background: var(--gold-primary);
  color: #000;
}

/* Unobstructed Clean Player Strips (Outside 3D Canvas) */
.player-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(18, 22, 34, 0.88);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.5rem 0.85rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.player-strip.black-strip {
  border-color: rgba(99, 102, 241, 0.35);
}

.player-strip.white-strip {
  border-color: rgba(212, 175, 55, 0.35);
}

.player-profile {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.player-avatar {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

.white-avatar {
  background: rgba(212, 175, 55, 0.2);
  border: 1px solid rgba(212, 175, 55, 0.4);
  color: var(--gold-bright);
}

.black-avatar {
  background: rgba(99, 102, 241, 0.2);
  border: 1px solid rgba(99, 102, 241, 0.4);
  color: #818cf8;
}

.player-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.player-title-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.player-name {
  font-size: 0.92rem;
  font-weight: 600;
  color: #fff;
}

.player-level-badge {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-sm);
  background: rgba(212, 175, 55, 0.15);
  color: var(--gold-bright);
  border: 1px solid rgba(212, 175, 55, 0.3);
}

.captured-pieces {
  display: flex;
  align-items: center;
  gap: 2px;
  font-size: 0.85rem;
  min-height: 16px;
  color: var(--gold-bright);
}

.score-diff {
  font-size: 0.72rem;
  font-weight: 700;
  margin-left: 4px;
  color: var(--gold-bright);
}

.player-clock {
  font-family: monospace;
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  background: rgba(10, 12, 18, 0.9);
  border: 1px solid var(--border-color);
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-md);
  letter-spacing: 1px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
  pointer-events: auto;
  transition: all 0.3s ease;
}

.player-clock.active {
  border-color: var(--gold-primary);
  color: var(--gold-bright);
  box-shadow: 0 0 12px var(--gold-glow);
}

.player-clock.low-time {
  border-color: var(--accent-red);
  color: #f87171;
  animation: pulseCheck 0.5s infinite alternate;
}

.hud-instructions-bar {
  text-align: center;
  font-size: 0.76rem;
  color: var(--text-dim);
  padding: 0.25rem 0.5rem;
}

.hud-instructions-bar kbd {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 3px;
  padding: 0.1rem 0.35rem;
  color: var(--text-muted);
  font-size: 0.72rem;
}
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-dim);
  pointer-events: none;
  z-index: 10;
}

.hud-instructions kbd {
  background: rgba(255, 255, 255, 0.08);
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  color: var(--text-muted);
}

/* ================= Game Side Panels ================= */
.game-side-panel,
.game-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  min-width: 0;
}

.panel-ad-wrapper {
  margin: 0;
  width: 100%;
}

.panel-ad-wrapper .ad-unit-wrapper {
  margin: 0;
  width: 100%;
}

.sidebar-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}

.sidebar-title {
  font-size: 1.1rem;
  color: #fff;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
}

.setup-row {
  margin-bottom: 0.85rem;
}

.setup-row label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}

.game-actions-bar {
  display: flex;
  gap: 0.5rem;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}

/* Move History Card */
.move-history-card {
  display: flex;
  flex-direction: column;
  height: 280px;
}

.move-history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.move-history-header h4 {
  font-size: 0.95rem;
  color: #fff;
}

.move-count-badge {
  font-size: 0.72rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  color: var(--text-muted);
}

.move-history-scroll {
  flex: 1;
  overflow-y: auto;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.5rem;
  font-family: monospace;
  font-size: 0.85rem;
}

.empty-history-msg {
  color: var(--text-dim);
  text-align: center;
  padding: 2rem 1rem;
  font-size: 0.8rem;
  font-style: italic;
}

.history-row {
  display: grid;
  grid-template-columns: 35px 1fr 1fr;
  padding: 0.25rem 0.4rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.history-row:hover {
  background: rgba(255, 255, 255, 0.05);
}

.history-row.active {
  background: rgba(212, 175, 55, 0.15);
  border-left: 2px solid var(--gold-primary);
}

.history-num {
  color: var(--text-dim);
}

.history-move {
  color: var(--text-main);
  padding: 0 4px;
  border-radius: 2px;
}

.history-move:hover {
  background: var(--gold-glow);
  color: var(--gold-bright);
}

.move-history-footer {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
  justify-content: flex-end;
}

.sidebar-ad-wrapper {
  margin-top: 0.5rem;
}

/* ================= Below Game Section ================= */
.below-game-section {
  padding: 2rem 0;
  border-top: 1px solid var(--border-color);
  background: rgba(11, 13, 19, 0.5);
}

.info-blocks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.info-block h3 {
  color: var(--gold-bright);
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

/* ================= Modals ================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 1.5rem;
  animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-lg);
  padding: 2rem;
  max-width: 460px;
  width: 100%;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 30px rgba(212, 175, 55, 0.2);
}

.promotion-card h3 {
  font-size: 1.35rem;
  margin-bottom: 0.35rem;
}

.promotion-pieces-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.promo-choice-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: var(--transition);
}

.promo-choice-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--gold-bright);
  transform: translateY(-2px);
  box-shadow: 0 6px 15px var(--gold-glow);
}

.promo-symbol {
  font-size: 2.2rem;
  color: var(--gold-bright);
}

.promo-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-main);
}

/* Game Over Modal Styling */
.game-over-card {
  max-width: 540px;
  width: 95%;
  background: linear-gradient(180deg, #161b2b 0%, #0d111d 100%);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-lg);
  padding: 1.75rem 1.85rem;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.85), 0 0 35px rgba(212, 175, 55, 0.25);
  animation: modalPopIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPopIn {
  from { opacity: 0; transform: scale(0.92) translateY(12px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.game-over-header {
  margin-bottom: 1.15rem;
}

.game-over-icon {
  font-size: 3.2rem;
  line-height: 1;
  margin-bottom: 0.35rem;
  filter: drop-shadow(0 4px 14px rgba(212, 175, 55, 0.45));
  animation: bounceIn 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes bounceIn {
  0% { transform: scale(0.3); opacity: 0; }
  60% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); }
}

.game-over-title {
  font-family: var(--font-cinzel, 'Cinzel', serif);
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--gold-bright);
  letter-spacing: 0.03em;
  margin: 0 0 0.25rem 0;
  text-shadow: 0 2px 10px rgba(212, 175, 55, 0.3);
}

.game-over-subtitle {
  font-size: 0.92rem;
  color: var(--text-muted);
  margin: 0;
}

.game-over-stats {
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
  text-align: left;
}

/* Opponent Banner */
.game-over-opponent-banner {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(212, 175, 55, 0.25);
  border-radius: var(--radius-md);
  margin-bottom: 0.75rem;
}

.opponent-avatar-box {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(212, 175, 55, 0.22) 0%, rgba(0, 0, 0, 0.4) 100%);
  border: 1px solid var(--border-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  flex-shrink: 0;
}

.opponent-info-box {
  flex: 1;
  min-width: 0;
}

.opponent-name-text {
  font-weight: 700;
  font-size: 0.98rem;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.opponent-meta-text {
  font-size: 0.75rem;
  color: var(--gold-light);
  letter-spacing: 0.03em;
  opacity: 0.85;
}

.match-outcome-badge {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  text-transform: uppercase;
  flex-shrink: 0;
}

.badge-win {
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.4);
  color: #4ade80;
  box-shadow: 0 0 12px rgba(34, 197, 94, 0.25);
}

.badge-loss {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #f87171;
}

.badge-draw {
  background: rgba(148, 163, 184, 0.15);
  border: 1px solid rgba(148, 163, 184, 0.4);
  color: #cbd5e1;
}

.badge-neutral {
  background: rgba(212, 175, 55, 0.15);
  border: 1px solid var(--border-gold);
  color: var(--gold-bright);
}

/* 3-Pill Stats Grid */
.game-over-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
  margin-bottom: 0.85rem;
}

.stat-pill-card {
  background: rgba(11, 15, 25, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.5rem;
  text-align: center;
}

.stat-pill-label {
  display: block;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.stat-pill-val {
  display: block;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--gold-light);
}

.stat-pill-sub {
  font-size: 0.72rem;
  font-weight: normal;
  color: var(--text-muted);
}

/* PGN Drawer */
.game-over-pgn-drawer {
  background: #090c15;
  border: 1px solid rgba(212, 175, 55, 0.2);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.pgn-drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.45rem 0.75rem;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.pgn-drawer-title {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.pgn-drawer-actions {
  display: flex;
  gap: 0.4rem;
}

.btn-pgn-action {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.6rem;
  background: rgba(212, 175, 55, 0.1);
  border: 1px solid rgba(212, 175, 55, 0.3);
  border-radius: 4px;
  color: var(--gold-bright);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-pgn-action:hover {
  background: rgba(212, 175, 55, 0.22);
  color: #ffffff;
  border-color: var(--gold-bright);
}

.btn-pgn-action.copied {
  background: rgba(34, 197, 94, 0.2);
  border-color: #22c55e;
  color: #4ade80;
}

.pgn-drawer-body {
  padding: 0.65rem 0.85rem;
  max-height: 95px;
  overflow-y: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.78rem;
  line-height: 1.6;
  color: #cbd5e1;
}

.pgn-moves-flow {
  word-break: break-word;
}

.move-entry {
  display: inline-block;
  margin-right: 0.55rem;
  white-space: nowrap;
}

.m-num {
  color: var(--gold-bright);
  font-weight: 600;
  opacity: 0.9;
}

.m-white {
  color: #f8fafc;
  font-weight: 500;
}

.m-black {
  color: #94a3b8;
}

.m-result {
  color: var(--gold-bright);
  font-weight: 700;
  margin-left: 0.2rem;
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* Responsive Layout */
@media (max-width: 1240px) {
  .game-main-layout {
    grid-template-columns: minmax(500px, 720px) 360px;
    max-width: 1120px;
  }
  .left-free-area {
    display: none;
  }
}

@media (max-width: 960px) {
  .game-main-layout {
    grid-template-columns: 1fr;
    max-width: 740px;
    gap: 1.5rem;
  }
  .left-free-area {
    display: block;
    order: 3;
    max-width: 740px;
  }
  .canvas-wrapper {
    height: 560px;
  }
}

@media (max-width: 640px) {
  .canvas-wrapper {
    height: 440px;
  }
  .hud-status-badge {
    font-size: 0.78rem;
    padding: 0.3rem 0.65rem;
  }
  .hud-cam-controls {
    display: none; /* Auto-cam on mobile to save space */
  }
  .player-name {
    font-size: 0.82rem;
  }
  .player-clock {
    font-size: 1.05rem;
    padding: 0.25rem 0.6rem;
  }
}

/* ================= AI Game Levels UI ================= */
.mode-tab-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  background: var(--bg-secondary);
  padding: 0.3rem;
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
  border: 1px solid var(--border-color);
}

.mode-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.5rem;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: var(--transition);
}

.mode-tab-btn:hover {
  color: #fff;
}

.mode-tab-btn.active {
  background: var(--bg-card);
  color: var(--gold-bright);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-gold);
}

.ai-level-control-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  margin-bottom: 0.75rem;
}

.level-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.level-header-row label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #fff;
  margin: 0;
}

.level-indicator-tag {
  font-size: 0.72rem;
  color: var(--gold-bright);
  font-weight: 700;
  letter-spacing: 0.5px;
}

.level-pills-row {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
  margin-bottom: 0.75rem;
}

.level-pill {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0;
  font-family: monospace;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}

.level-pill:hover {
  color: #fff;
  border-color: var(--gold-primary);
  background: var(--bg-card-hover);
}

.level-pill.active {
  background: var(--gold-primary);
  color: #000;
  border-color: var(--gold-bright);
  box-shadow: 0 0 8px var(--gold-glow);
}

.ai-bot-summary-card {
  display: flex;
  gap: 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  align-items: center;
}

.bot-avatar-badge {
  width: 42px;
  height: 42px;
  background: rgba(212, 175, 55, 0.15);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--gold-bright);
  flex-shrink: 0;
}

.bot-summary-details {
  flex: 1;
  min-width: 0;
}

.bot-name-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
}

.bot-name-row strong {
  font-size: 0.88rem;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.elo-badge {
  font-size: 0.7rem;
  background: rgba(212, 175, 55, 0.2);
  color: var(--gold-bright);
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-full);
  font-weight: 700;
  flex-shrink: 0;
  font-family: monospace;
}

.bot-title-text {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 1px;
}

.bot-desc-text {
  font-size: 0.74rem;
  color: var(--text-dim);
  margin-top: 3px;
  line-height: 1.3;
  margin-bottom: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.player-title-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.player-level-badge {
  font-size: 0.65rem;
  background: rgba(212, 175, 55, 0.2);
  color: var(--gold-bright);
  border: 1px solid rgba(212, 175, 55, 0.4);
  padding: 0.05rem 0.35rem;
  border-radius: var(--radius-sm);
  font-family: monospace;
  font-weight: 700;
}

.levels-modal-card {
  max-width: 820px !important;
  max-height: 88vh;
  overflow-y: auto;
}

.modal-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.4rem;
}

.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.8rem;
  cursor: pointer;
  line-height: 1;
  padding: 0;
}

.modal-close-btn:hover {
  color: #fff;
}

.levels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 0.85rem;
  margin-top: 1.25rem;
}

.level-card-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.9rem;
  text-align: left;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  position: relative;
  overflow: hidden;
}

.level-card-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--gold-bright);
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
}

.level-card-btn.active {
  border-color: var(--gold-bright);
  background: rgba(212, 175, 55, 0.08);
  box-shadow: 0 0 14px var(--gold-glow);
}

.level-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.level-badge-num {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--gold-bright);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.level-card-avatar {
  font-size: 1.75rem;
  line-height: 1;
  margin-top: 0.2rem;
}

.level-card-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
}

.level-card-title {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.level-card-desc {
  font-size: 0.75rem;
  color: var(--text-dim);
  line-height: 1.35;
  margin: 0;
}

.level-card-quote {
  font-size: 0.72rem;
  font-style: italic;
  color: var(--gold-primary);
  margin-top: auto;
  padding-top: 0.3rem;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
}
