/* ==========================================================================
   Neo-Arcade / Cyber-Toon Chess IQ Styling
   High-contrast dark mode first, glassmorphism, glowing accents, tactile micro-interactions
   ========================================================================== */

:root {
  --arcade-bg: #f8fafc;
  --arcade-surface: #ffffff;
  --arcade-card: #ffffff;
  --arcade-card-hover: #f1f5f9;
  --arcade-border: #e2e8f0;
  --arcade-text: #0f172a;
  --arcade-text-muted: #64748b;
  --arcade-gold: #fbbf24;
  --arcade-gold-hover: #f59e0b;
  --arcade-emerald: #10b981;
  --arcade-rose: #f43f5e;
  --arcade-purple: #8b5cf6;
  --arcade-cyan: #06b6d4;
  --arcade-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.06), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
  /* Pretty Scrollbar Tokens (Light Mode) */
  --scrollbar-track: transparent;
  --scrollbar-thumb: rgba(100, 116, 139, 0.28);
  --scrollbar-thumb-hover: rgba(245, 158, 11, 0.85);
  --scrollbar-thumb-active: #f59e0b;
}

[data-bs-theme="dark"] {
  --arcade-bg: #0b0e14;
  --arcade-surface: #131722;
  --arcade-card: #131722;
  --arcade-card-hover: #1c2232;
  --arcade-border: #232a3b;
  --arcade-text: #f8fafc;
  --arcade-text-muted: #94a3b8;
  --arcade-gold: #fbbf24;
  --arcade-gold-hover: #f59e0b;
  --arcade-emerald: #10b981;
  --arcade-rose: #f43f5e;
  --arcade-purple: #8b5cf6;
  --arcade-cyan: #06b6d4;
  --arcade-shadow: 0 15px 35px -5px rgba(0, 0, 0, 0.5);
  /* Pretty Scrollbar Tokens (Dark Mode) */
  --scrollbar-track: transparent;
  --scrollbar-thumb: rgba(255, 255, 255, 0.22);
  --scrollbar-thumb-hover: rgba(251, 191, 36, 0.75);
  --scrollbar-thumb-active: #fbbf24;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 76px;
}

body {
  background-color: var(--arcade-bg);
  color: var(--arcade-text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
  transition: background-color 0.25s ease, color 0.25s ease;
  -webkit-font-smoothing: antialiased;
}

body:not(.modal-open) {
  overflow-y: auto !important;
}

/* Glassmorphic Navbar */
.glass-nav {
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-color: var(--arcade-border) !important;
}

[data-bs-theme="dark"] .glass-nav {
  background: rgba(11, 14, 20, 0.85);
  border-color: rgba(255, 255, 255, 0.08) !important;
}

/* Brand Logo */
.arcade-badge-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  color: #0b0e14;
  font-size: 1rem;
  font-weight: 900;
  border-radius: 0.65rem;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.35);
}

.logo-hover:hover .arcade-badge-logo {
  transform: rotate(-8deg) scale(1.08);
  transition: transform 0.2s ease;
}

/* Segmented Mode Pill Switcher */
.arcade-mode-pills {
  display: flex;
  background: rgba(0, 0, 0, 0.05);
  padding: 3px;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

[data-bs-theme="dark"] .arcade-mode-pills {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.1);
}

.arcade-pill {
  padding: 0.35rem 1rem;
  font-size: 0.82rem;
  font-weight: 700;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--arcade-text-muted);
  transition: all 0.2s ease;
  cursor: pointer;
}

.arcade-pill:hover {
  color: var(--arcade-text);
}

.arcade-pill.active {
  background: #fbbf24;
  color: #0b0e14;
  box-shadow: 0 2px 8px rgba(251, 191, 36, 0.35);
}

/* Collapsible review details */
.review-details-summary {
  cursor: pointer;
  list-style: none;
  letter-spacing: 0.5px;
}

.review-details-summary::-webkit-details-marker {
  display: none;
}

.review-details[open] > .review-details-summary {
  margin-bottom: 0.5rem;
}

/* Arcade Buttons */
.arcade-btn-primary {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  color: #0b0e14;
  font-weight: 800;
  font-size: 0.85rem;
  border: none;
  border-radius: 0.75rem;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.3);
  transition: all 0.18s ease;
  cursor: pointer;
}

.arcade-btn-primary:hover {
  transform: translateY(-1.5px);
  box-shadow: 0 6px 18px rgba(245, 158, 11, 0.45);
}

.arcade-btn-primary:active {
  transform: translateY(0.5px);
}

.arcade-btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 0.75rem;
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.08);
  color: inherit;
  transition: all 0.18s ease;
  cursor: pointer;
}

[data-bs-theme="dark"] .arcade-btn-icon {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.1);
}

.arcade-btn-icon:hover {
  background: rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}

[data-bs-theme="dark"] .arcade-btn-icon:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* Responsive navbar adjustments for mobile screens */
@media (max-width: 575.98px) {
  .glass-nav {
    padding-left: 0.45rem !important;
    padding-right: 0.45rem !important;
  }
  .arcade-badge-logo {
    width: 28px;
    height: 28px;
    font-size: 0.85rem;
    border-radius: 0.5rem;
  }
  .arcade-mode-pills {
    padding: 2px;
  }
  .arcade-mode-pills .arcade-pill {
    padding: 0.32rem 0.58rem;
    font-size: 0.75rem;
    line-height: 1.1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .arcade-btn-icon {
    width: 32px;
    height: 32px;
    border-radius: 0.55rem;
    font-size: 0.92rem;
  }
  #nav-btn-import {
    height: 32px;
    padding: 0.25rem 0.6rem !important;
    font-size: 0.75rem;
    border-radius: 0.55rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
  }
}

/* Glass Card & Cards */
.comic-card, .glass-card {
  background: var(--arcade-card);
  border: 1px solid var(--arcade-border);
  border-radius: 1.25rem;
  box-shadow: var(--arcade-shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.comic-card-sm {
  background: var(--arcade-card);
  border: 1px solid var(--arcade-border);
  border-radius: 0.95rem;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.04);
}

/* Tactile Buttons */
.comic-btn {
  font-weight: 700;
  font-size: 0.85rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(0, 0, 0, 0.12);
  transition: all 0.18s ease;
}

[data-bs-theme="dark"] .comic-btn {
  border-color: rgba(255, 255, 255, 0.12);
}

.comic-btn:hover {
  transform: translateY(-1px);
}

.comic-btn:active {
  transform: translateY(1px);
}

/* Bot Character Speech Bubble */
.comic-bubble {
  position: relative;
  background: #1e2433;
  color: #f8fafc;
  border: 1px solid #334155;
  border-radius: 1rem;
  padding: 0.5rem 0.9rem;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
  font-weight: 700;
  font-size: 0.85rem;
  display: inline-block;
  max-width: 90%;
  animation: popIn 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

[data-bs-theme="light"] .comic-bubble {
  background: #ffffff;
  color: #0f172a;
  border-color: #e2e8f0;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

@keyframes popIn {
  from {
    transform: scale(0.8);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* Chessboard Container */
.board-container {
  width: 100%;
  max-width: 520px;
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  position: relative;
  border-radius: 1rem;
  overflow: hidden;
  border: 3px solid #1e2433;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.35);
  user-select: none;
  touch-action: none;
}

@media (min-width: 992px) {
  .board-container {
    max-width: min(680px, calc(100vh - 210px));
  }
}

@media (min-width: 1400px) {
  .board-container {
    max-width: min(720px, calc(100vh - 190px));
  }
}

[data-bs-theme="light"] .board-container {
  border-color: #334155;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
}

.board-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  width: 100%;
  height: 100%;
}

.board-square {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease;
  cursor: pointer;
}

.board-square.selected {
  background-color: rgba(251, 191, 36, 0.65) !important;
  box-shadow: inset 0 0 0 2.5px #fbbf24;
}

.board-square.in-check {
  background: radial-gradient(ellipse at center, rgba(239, 68, 68, 0.95) 0%, rgba(239, 68, 68, 0.65) 45%, rgba(220, 38, 38, 0.2) 70%, transparent 100%) !important;
  animation: checkPulse 1.2s infinite ease-in-out;
}

@keyframes checkPulse {
  0%, 100% { box-shadow: inset 0 0 12px 3px rgba(239, 68, 68, 0.85); }
  50% { box-shadow: inset 0 0 20px 6px rgba(220, 38, 38, 0.95); }
}

.board-square.drag-over {
  background-color: rgba(251, 191, 36, 0.45) !important;
  box-shadow: inset 0 0 0 3px #fbbf24;
}

.board-container.is-interactive .board-square.has-movable-piece {
  cursor: grab;
}

.board-container.is-interactive .board-square.has-movable-piece:active,
body.board-is-dragging,
body.board-is-dragging * {
  cursor: grabbing !important;
}

.piece-img.is-dragging {
  opacity: 0.22;
}

.board-floating-piece {
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 99999;
  will-change: transform;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.board-floating-piece img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.5));
  transform: scale(1.12);
  transition: transform 0.08s ease-out;
}

.board-player-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 520px;
  padding: 0.35rem 0.65rem;
  margin: 0.25rem 0;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--arcade-text);
  background: var(--arcade-card);
  border: 1px solid var(--arcade-border);
  border-radius: 0.7rem;
  min-height: 36px;
}

@media (min-width: 992px) {
  .board-player-bar {
    max-width: min(680px, calc(100vh - 210px));
  }
}

@media (min-width: 1400px) {
  .board-player-bar {
    max-width: min(720px, calc(100vh - 190px));
  }
}

/* ==========================================================================
   Review Mode Dedicated Chessboard & Controls Sizing
   Makes the board compact enough on desktop/laptop viewports so the move
   notation strip, step navigation buttons, eval bar, and board are all
   100% visible on screen without requiring vertical scrolling.
   ========================================================================== */
.review-board-column-inner {
  --review-board-size: min(440px, calc(100vw - 56px), calc(100vh - 280px));
  --eval-bar-width: 26px;
  --board-gap: 8px;
  width: 100%;
  max-width: calc(var(--review-board-size) + var(--eval-bar-width) + var(--board-gap));
  margin: 0 auto;
}

#review-board-mount {
  width: 100%;
}

#review-board-mount .board-container {
  width: 100%;
  max-width: var(--review-board-size) !important;
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.28);
}

#review-board-mount .board-player-bar {
  width: 100%;
  max-width: var(--review-board-size) !important;
  margin: 0.15rem auto;
  padding: 0.22rem 0.55rem;
  min-height: 32px;
  font-size: 0.8rem;
}

#review-board-mount .captured-piece-img {
  width: 18px;
  height: 18px;
}

.review-board-column-inner #eval-bar.eval-bar-wrapper {
  width: var(--eval-bar-width);
  min-width: var(--eval-bar-width);
  min-height: 0;
  height: auto;
  align-self: stretch;
}

.review-board-column-inner .arcade-step-btn-lg {
  height: 38px;
  font-size: 0.85rem;
}

.review-board-column-inner .arcade-step-btn-sm {
  height: 38px;
  width: 38px;
}

#review-move-strip,
#review-nav-controls {
  min-height: 44px;
}

@media (min-width: 768px) {
  .review-board-column-inner {
    --review-board-size: min(480px, calc(100vh - 260px));
    --eval-bar-width: 30px;
    --board-gap: 10px;
  }
}

@media (min-width: 992px) {
  .review-board-column-inner {
    --review-board-size: min(560px, calc(100vh - 230px));
    --eval-bar-width: 32px;
    --board-gap: 12px;
  }
}

@media (min-width: 1200px) {
  .review-board-column-inner {
    --review-board-size: min(600px, calc(100vh - 220px));
    --eval-bar-width: 34px;
    --board-gap: 12px;
  }
}

@media (min-width: 1400px) {
  .review-board-column-inner {
    --review-board-size: min(640px, calc(100vh - 210px));
    --eval-bar-width: 34px;
    --board-gap: 12px;
  }
}

.board-captured-pieces {
  display: flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.22);
  border: 1px solid rgba(148, 163, 184, 0.35);
}

[data-bs-theme="dark"] .board-captured-pieces {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.22);
}

.captured-piece-img {
  width: 22px;
  height: 22px;
  margin-left: -2px;
  filter: drop-shadow(0 0 1px rgba(255, 255, 255, 0.9)) drop-shadow(0 1px 2px rgba(0, 0, 0, 0.75));
  pointer-events: none;
}

.captured-piece-img:first-child {
  margin-left: 0;
}

.material-diff-badge {
  font-size: 12px;
  font-weight: 900;
  font-family: var(--bs-font-monospace, monospace);
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  background: #fbbf24;
  color: #0b0e14;
  border: 1.5px solid #0b0e14;
  box-shadow: 0 2px 6px rgba(251, 191, 36, 0.35);
  line-height: 1.2;
}

.board-square.last-move-light {
  background-color: #ced856 !important;
}

.board-square.last-move-dark {
  background-color: #aaa23a !important;
}

.board-square .square-coord-file {
  position: absolute;
  bottom: 2px;
  right: 4px;
  font-size: 10px;
  font-weight: 800;
  pointer-events: none;
  line-height: 1;
}

.board-square .square-coord-rank {
  position: absolute;
  top: 2px;
  left: 4px;
  font-size: 10px;
  font-weight: 800;
  pointer-events: none;
  line-height: 1;
}

/* Move Dot Indicator */
.move-dot {
  width: 26%;
  height: 26%;
  background-color: rgba(0, 0, 0, 0.25);
  border-radius: 50%;
  pointer-events: none;
  transition: transform 0.15s ease;
}

[data-bs-theme="dark"] .move-dot {
  background-color: rgba(255, 255, 255, 0.38);
}

/* Clean Red Border around target opponent pieces */
.board-square.capture-target {
  box-shadow: inset 0 0 0 3.5px #ef4444 !important;
  border-radius: 6px;
  position: relative;
  z-index: 5;
}

.board-square.capture-target img {
  filter: drop-shadow(0 0 4px rgba(239, 68, 68, 0.65));
}

@keyframes pieceLandingPop {
  0% { transform: scale(1); }
  50% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

.piece-landing-pop {
  animation: pieceLandingPop 0.18s cubic-bezier(0.2, 0, 0.2, 1);
}

/* Comic Sticker Badges on Board Squares */
.comic-square-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  border-radius: 6px;
  border: 1.5px solid #000000;
  font-weight: 900;
  font-size: 10px;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  box-shadow: 2px 2px 0px rgba(0, 0, 0, 0.5);
  transform: rotate(-6deg);
  pointer-events: none;
  animation: badgePop 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.comic-square-badge.badge-edge-top {
  top: 3px !important;
}

.comic-square-badge.badge-edge-right {
  right: 3px !important;
}

.board-square:has(.comic-square-badge) {
  z-index: auto;
}

@keyframes badgePop {
  0% { transform: scale(0.5) rotate(-15deg); opacity: 0; }
  100% { transform: scale(1) rotate(-6deg); opacity: 1; }
}

/* Eval Bar */
.eval-bar-wrapper {
  position: relative;
  width: 32px;
  min-height: 0;
  height: 100%;
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  border-radius: 0.75rem;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  user-select: none;
  background-color: #0f172a;
}

.eval-white-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  background-color: #f8fafc;
  transition: height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1;
}

.eval-score-badge {
  position: absolute;
  left: 0;
  width: 100%;
  font-size: 10.5px;
  font-weight: 900;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  text-align: center;
  z-index: 2;
  pointer-events: none;
  transition: top 0.35s ease, bottom 0.35s ease, color 0.25s ease;
  line-height: 1.2;
}

/* Advantage Chart */
.advantage-chart-canvas {
  position: relative;
  width: 100%;
  height: 96px;
  background-color: #0b1120;
  border-radius: 0.5rem;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  cursor: crosshair;
}

/* Piece Image */
.piece-img {
  width: 88%;
  height: 88%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.45));
  will-change: transform;
}

/* Move History Scrollable Container - Compact on Desktop */
.move-history-container {
  max-height: 180px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

@media (min-width: 992px) {
  .move-history-container {
    max-height: 185px;
    min-height: 120px;
  }
}

@media (max-width: 991.98px) {
  .move-history-container {
    max-height: 220px;
  }
}

.move-history-container table td {
  padding: 0.22rem 0.45rem !important;
  font-size: 12.5px;
}

.mini-move-badge {
  width: 19px !important;
  height: 19px !important;
  min-width: 19px !important;
  min-height: 19px !important;
  aspect-ratio: 1 / 1 !important;
  border-radius: 50% !important;
  box-sizing: border-box !important;
  flex-shrink: 0 !important;
  font-size: 10px !important;
  line-height: 1 !important;
  padding: 0 !important;
}

.mini-move-badge.multi-char {
  font-size: 8.5px !important;
  letter-spacing: -0.6px !important;
}

/* Secondary Information Arcade Accordion */
.arcade-accordion .accordion-item {
  background-color: var(--arcade-card);
  border: 1px solid var(--arcade-border);
  border-radius: 0.75rem !important;
  margin-bottom: 0.5rem;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.arcade-accordion .accordion-header {
  margin-bottom: 0;
}

.arcade-accordion .accordion-button {
  background-color: var(--arcade-card);
  color: var(--arcade-text);
  font-weight: 800;
  font-size: 12px;
  padding: 0.55rem 0.85rem;
  box-shadow: none !important;
  border: none;
}

.arcade-accordion .accordion-button:not(.collapsed) {
  background-color: rgba(251, 191, 36, 0.08);
  color: var(--arcade-gold);
  border-bottom: 1px solid var(--arcade-border);
}

[data-bs-theme="light"] .arcade-accordion .accordion-button:not(.collapsed) {
  background-color: rgba(245, 158, 11, 0.1);
  color: #b45309;
}

.arcade-accordion .accordion-button::after {
  background-size: 0.85rem;
  transition: transform 0.2s ease-in-out;
}

[data-bs-theme="dark"] .arcade-accordion .accordion-button::after {
  filter: invert(1) brightness(1.5);
}

.arcade-accordion .accordion-body {
  background-color: var(--arcade-card);
  color: var(--arcade-text);
  padding: 0.65rem;
}

/* Glanceable Stats & Chips */
.glance-chip {
  padding: 0.25rem 0.55rem;
  font-size: 11px;
  font-weight: 800;
  border-radius: 999px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  user-select: none;
}

.glance-chip.cursor-pointer:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
}

.glance-phase-pill {
  font-size: 11px;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  font-weight: 700;
  background: var(--arcade-card-hover, rgba(0, 0, 0, 0.04));
  border: 1px solid var(--arcade-border);
}

/* Collapsible Chevron Animation & Hint Text */
.collapse-chevron {
  transition: transform 0.2s ease-in-out;
  display: inline-block;
}

[data-bs-toggle="collapse"]:not(.collapsed) .collapse-chevron {
  transform: rotate(180deg);
}

[data-bs-toggle="collapse"].collapsed .collapse-chevron {
  transform: rotate(0deg);
}

.collapse-hint-text::before {
  content: "(Click to expand)";
}

[data-bs-toggle="collapse"]:not(.collapsed) .collapse-hint-text::before {
  content: "(Click to collapse)";
}

/* Ensure Bootstrap Collapse and Accordion Content is Always Visible When Expanded */
.collapse,
.accordion-collapse,
.collapsing,
.collapse.show,
.arcade-accordion .accordion-collapse,
.arcade-accordion .accordion-body,
#collapse-moves-history,
#collapse-coach-insights,
#collapse-positional-pillars,
#collapse-detailed-performance {
  visibility: visible !important;
}

.collapse:not(.show) {
  display: none;
}

.collapsing {
  height: 0;
  overflow: hidden;
  transition: height 0.35s ease;
}

.collapse.show {
  display: block;
}

/* Coach Insights & Callouts Scrollable Container on Desktop */
.review-coach-insights-scroll {
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
}

@media (min-width: 992px) {
  .review-coach-insights-scroll {
    max-height: 280px;
  }
}

/* Desktop Full Width Layout (Zero Vertical Scroll) */
@media (min-width: 992px) {
  .app-main-container {
    max-width: 100% !important;
    width: 100% !important;
  }
}

/* Mobile Board Column (Flows naturally without overlapping sticky header) */
@media (max-width: 991.98px) {
  .mobile-sticky-top {
    position: relative;
    padding-top: 4px;
    padding-bottom: 4px;
  }
}

/* Step Navigation Arcade Controller Buttons */
.arcade-step-btn-lg {
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.75rem;
  font-weight: 800;
  border: 1px solid var(--arcade-border);
  touch-action: manipulation;
  transition: all 0.15s ease;
}

.arcade-step-btn-lg:hover {
  background-color: var(--arcade-card-hover);
  border-color: #fbbf24;
}

.arcade-step-btn-sm {
  width: 42px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.75rem;
  border: 1px solid var(--arcade-border);
  flex-shrink: 0;
  touch-action: manipulation;
  transition: all 0.15s ease;
}

.arcade-step-btn-sm:hover {
  background-color: var(--arcade-card-hover);
}

/* Bootstrap 5 Modal Styling */
.modal-dialog {
  margin: clamp(1rem, 3.5vh, 2.25rem) auto !important;
  max-height: calc(100dvh - clamp(2rem, 7vh, 4.5rem)) !important;
}

.modal-dialog-centered {
  min-height: calc(100% - clamp(2rem, 7vh, 4.5rem)) !important;
}

.modal-dialog:not(.modal-dialog-scrollable) .modal-content {
  max-height: calc(100dvh - clamp(2.5rem, 7vh, 5rem)) !important;
  overflow-y: auto;
}

.modal-dialog-scrollable .modal-content {
  max-height: calc(100dvh - clamp(2.5rem, 7vh, 5rem)) !important;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
}

.modal-dialog-scrollable .modal-body {
  overflow-y: auto !important;
  flex: 1 1 auto !important;
  -webkit-overflow-scrolling: touch;
}

/* Full viewport height modal on mobile screens (< 576px) */
@media (max-width: 576px) {
  .modal-dialog.modal-fullscreen-sm-down,
  #import-modal .modal-dialog {
    margin: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    height: 100dvh !important;
    min-height: 100dvh !important;
    max-height: 100dvh !important;
  }

  .modal-dialog.modal-fullscreen-sm-down .modal-content,
  #import-modal .modal-content {
    height: 100dvh !important;
    max-height: 100dvh !important;
    border-radius: 0 !important;
    border: none !important;
    display: flex !important;
    flex-direction: column !important;
  }

  #import-modal .modal-body {
    flex: 1 1 auto !important;
    overflow-y: auto !important;
    max-height: none !important;
    padding: 0.75rem 1rem !important;
    -webkit-overflow-scrolling: touch;
  }
}

.modal-content.comic-card {
  border: 1px solid var(--arcade-border);
  border-radius: 1.25rem;
  box-shadow: 0 25px 60px -12px rgba(0, 0, 0, 0.55);
  background-color: var(--arcade-card);
  overflow: hidden;
}

[data-bs-theme="light"] .modal-content.comic-card {
  background-color: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.12);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.22);
}

[data-bs-theme="dark"] .modal-content.comic-card {
  background-color: #131722;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.65);
}

.modal-backdrop.show {
  opacity: 0.7;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* Dropdown Menu Styling */
.dropdown-menu {
  background: var(--arcade-card);
  border: 1px solid var(--arcade-border);
  border-radius: 1rem;
  box-shadow: 0 16px 36px -6px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(16px);
  padding: 0.5rem;
}

[data-bs-theme="light"] .dropdown-menu {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.12);
  box-shadow: 0 16px 36px -6px rgba(0, 0, 0, 0.15);
}

.dropdown-item {
  border-radius: 0.6rem;
  font-size: 0.875rem;
  font-weight: 700;
  color: inherit;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.dropdown-item:hover, .dropdown-item:focus {
  background: var(--arcade-card-hover);
  color: inherit;
}

.dropdown-item.active {
  background: rgba(245, 158, 11, 0.18);
  color: #f59e0b;
}

/* Button & Foreground Theme Tokens */
.btn-solid.theme-warning {
  background-color: var(--bs-warning, #f59e0b);
  color: #0b0e14;
  border: 1px solid transparent;
  font-weight: 800;
}

.fg-secondary { color: var(--bs-secondary, #94a3b8) !important; }
.fg-warning { color: var(--bs-warning, #f59e0b) !important; }

/* Custom Bootstrap Grid Decimal Gutters */
.g-1\.5, .row.g-1\.5 {
  --bs-gutter-x: 0.375rem;
  --bs-gutter-y: 0.375rem;
}
.gx-1\.5, .row.gx-1\.5 {
  --bs-gutter-x: 0.375rem;
}
.gy-1\.5, .row.gy-1\.5 {
  --bs-gutter-y: 0.375rem;
}

.g-2\.5, .row.g-2\.5 {
  --bs-gutter-x: 0.75rem;
  --bs-gutter-y: 0.75rem;
}
.gx-2\.5, .row.gx-2\.5 {
  --bs-gutter-x: 0.75rem;
}
.gy-2\.5, .row.gy-2\.5 {
  --bs-gutter-y: 0.75rem;
}

.g-3\.5, .row.g-3\.5 {
  --bs-gutter-x: 1.25rem;
  --bs-gutter-y: 1.25rem;
}
.gx-3\.5, .row.gx-3\.5 {
  --bs-gutter-x: 1.25rem;
}
.gy-3\.5, .row.gy-3\.5 {
  --bs-gutter-y: 1.25rem;
}

/* Bootstrap 6 Placeholder Wave Animation */
.placeholder-wave {
  mask-image: linear-gradient(130deg, #000 55%, rgba(0, 0, 0, 0.8) 75%, #000 95%);
  mask-size: 200% 100%;
  animation: placeholder-wave 1.75s linear infinite;
}

@keyframes placeholder-wave {
  100% {
    mask-position: -200% 0%;
  }
}

/* Game Over Blurred Modal Backdrop */
.game-over-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1060;
  background-color: rgba(10, 12, 18, 0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1rem, 3.5vh, 2.25rem) 0.75rem !important;
  overflow-x: hidden;
  animation: fadeIn 0.25s ease-out;
}

.game-over-dialog {
  max-width: 460px;
  width: 100%;
  max-height: calc(100dvh - clamp(2.5rem, 7vh, 5rem)) !important;
  margin: auto;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  border-radius: 1.5rem !important;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
  animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.why-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1060;
  background-color: rgba(10, 12, 18, 0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1rem, 3.5vh, 2.25rem) 0.75rem !important;
  overflow-x: hidden;
  animation: fadeIn 0.25s ease-out;
}

.why-dialog {
  animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  max-height: calc(100dvh - clamp(2.5rem, 7vh, 5rem)) !important;
  margin: auto;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
}

/* Touch swiping animations for mobile modal dismiss */
.modal-swiping {
  transition: transform 0.05s linear !important;
  user-select: none;
}
.modal-swipe-closing {
  transition: transform 0.22s ease-out, opacity 0.2s ease-out !important;
  transform: translateX(100%) !important;
  opacity: 0 !important;
}

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

/* ==========================================================================
   Pretty & Clean Scrollbars (Modals, Dialogs, and Global)
   ========================================================================== */

/* Prevent double scrollbars & background scrolling when ANY modal is open */
body.modal-open {
  overflow: hidden !important;
}

/* Clean, modern scrollbars for all modals, dialogs, and their scrollable children */
.why-dialog,
.game-over-dialog,
.modal,
.modal-dialog,
.modal-content,
.modal-body,
.why-modal-backdrop,
.game-over-modal-backdrop,
.pretty-scrollbar,
.custom-scrollbar,
.move-history-container,
.review-coach-insights-scroll {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
  overscroll-behavior: contain;
}

/* Any scrollable container inside any modal */
.why-dialog *,
.modal-content *,
.game-over-dialog * {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

/* Chromium / WebKit custom scrollbars */
.why-dialog::-webkit-scrollbar,
.game-over-dialog::-webkit-scrollbar,
.modal::-webkit-scrollbar,
.modal-dialog::-webkit-scrollbar,
.modal-content::-webkit-scrollbar,
.modal-body::-webkit-scrollbar,
.why-modal-backdrop::-webkit-scrollbar,
.game-over-modal-backdrop::-webkit-scrollbar,
.pretty-scrollbar::-webkit-scrollbar,
.custom-scrollbar::-webkit-scrollbar,
.move-history-container::-webkit-scrollbar,
.review-coach-insights-scroll::-webkit-scrollbar,
.why-dialog *::-webkit-scrollbar,
.modal-content *::-webkit-scrollbar,
.game-over-dialog *::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.why-dialog::-webkit-scrollbar-track,
.game-over-dialog::-webkit-scrollbar-track,
.modal::-webkit-scrollbar-track,
.modal-dialog::-webkit-scrollbar-track,
.modal-content::-webkit-scrollbar-track,
.modal-body::-webkit-scrollbar-track,
.why-modal-backdrop::-webkit-scrollbar-track,
.game-over-modal-backdrop::-webkit-scrollbar-track,
.pretty-scrollbar::-webkit-scrollbar-track,
.custom-scrollbar::-webkit-scrollbar-track,
.move-history-container::-webkit-scrollbar-track,
.review-coach-insights-scroll::-webkit-scrollbar-track,
.why-dialog *::-webkit-scrollbar-track,
.modal-content *::-webkit-scrollbar-track,
.game-over-dialog *::-webkit-scrollbar-track {
  background: transparent;
}

.why-dialog::-webkit-scrollbar-thumb,
.game-over-dialog::-webkit-scrollbar-thumb,
.modal::-webkit-scrollbar-thumb,
.modal-dialog::-webkit-scrollbar-thumb,
.modal-content::-webkit-scrollbar-thumb,
.modal-body::-webkit-scrollbar-thumb,
.why-modal-backdrop::-webkit-scrollbar-thumb,
.game-over-modal-backdrop::-webkit-scrollbar-thumb,
.pretty-scrollbar::-webkit-scrollbar-thumb,
.custom-scrollbar::-webkit-scrollbar-thumb,
.move-history-container::-webkit-scrollbar-thumb,
.review-coach-insights-scroll::-webkit-scrollbar-thumb,
.why-dialog *::-webkit-scrollbar-thumb,
.modal-content *::-webkit-scrollbar-thumb,
.game-over-dialog *::-webkit-scrollbar-thumb {
  background-color: var(--scrollbar-thumb);
  border-radius: 9999px;
  border: 1px solid transparent;
  background-clip: padding-box;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.why-dialog::-webkit-scrollbar-thumb:hover,
.game-over-dialog::-webkit-scrollbar-thumb:hover,
.modal::-webkit-scrollbar-thumb:hover,
.modal-dialog::-webkit-scrollbar-thumb:hover,
.modal-content::-webkit-scrollbar-thumb:hover,
.modal-body::-webkit-scrollbar-thumb:hover,
.why-modal-backdrop::-webkit-scrollbar-thumb:hover,
.game-over-modal-backdrop::-webkit-scrollbar-thumb:hover,
.pretty-scrollbar::-webkit-scrollbar-thumb:hover,
.custom-scrollbar::-webkit-scrollbar-thumb:hover,
.move-history-container::-webkit-scrollbar-thumb:hover,
.review-coach-insights-scroll::-webkit-scrollbar-thumb:hover,
.why-dialog *::-webkit-scrollbar-thumb:hover,
.modal-content *::-webkit-scrollbar-thumb:hover,
.game-over-dialog *::-webkit-scrollbar-thumb:hover {
  background-color: var(--scrollbar-thumb-hover);
}

.why-dialog::-webkit-scrollbar-thumb:active,
.game-over-dialog::-webkit-scrollbar-thumb:active,
.modal::-webkit-scrollbar-thumb:active,
.pretty-scrollbar::-webkit-scrollbar-thumb:active,
.why-dialog *::-webkit-scrollbar-thumb:active,
.modal-content *::-webkit-scrollbar-thumb:active {
  background-color: var(--scrollbar-thumb-active);
}

/* Eliminate arrows and buttons */
.why-dialog::-webkit-scrollbar-button,
.game-over-dialog::-webkit-scrollbar-button,
.modal::-webkit-scrollbar-button,
.modal-dialog::-webkit-scrollbar-button,
.modal-content::-webkit-scrollbar-button,
.modal-body::-webkit-scrollbar-button,
.why-modal-backdrop::-webkit-scrollbar-button,
.game-over-modal-backdrop::-webkit-scrollbar-button,
.pretty-scrollbar::-webkit-scrollbar-button,
.custom-scrollbar::-webkit-scrollbar-button,
.move-history-container::-webkit-scrollbar-button,
.review-coach-insights-scroll::-webkit-scrollbar-button,
.why-dialog *::-webkit-scrollbar-button,
.modal-content *::-webkit-scrollbar-button,
.game-over-dialog *::-webkit-scrollbar-button {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

.why-dialog::-webkit-scrollbar-corner,
.game-over-dialog::-webkit-scrollbar-corner,
.modal::-webkit-scrollbar-corner,
.modal-content::-webkit-scrollbar-corner,
.modal-body::-webkit-scrollbar-corner,
.why-modal-backdrop::-webkit-scrollbar-corner,
.game-over-modal-backdrop::-webkit-scrollbar-corner {
  background: transparent;
}

/* Zero Scrollbar utility ("or none") - completely hides scrollbars while retaining full scroll functionality */
.scrollbar-none,
.no-scrollbar,
[data-scrollbar="none"] {
  -ms-overflow-style: none !important;
  scrollbar-width: none !important;
}

.scrollbar-none::-webkit-scrollbar,
.no-scrollbar::-webkit-scrollbar,
[data-scrollbar="none"]::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

/* Global App Scrollbars */
body {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) transparent;
}

body::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

body::-webkit-scrollbar-track {
  background: transparent;
}

body::-webkit-scrollbar-thumb {
  background-color: var(--scrollbar-thumb);
  border-radius: 9999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

body::-webkit-scrollbar-thumb:hover {
  background-color: var(--scrollbar-thumb-hover);
}

body::-webkit-scrollbar-button {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

/* Modernized Imported Game Cards */
.imported-game-card {
  transition: transform 0.18s cubic-bezier(0.2, 0, 0.2, 1), box-shadow 0.18s ease, border-color 0.18s ease;
  border: 1px solid var(--arcade-border);
  background: var(--arcade-card);
  border-radius: 0.85rem;
  width: 100%;
  box-sizing: border-box;
}

.imported-game-card:hover {
  transform: translateY(-2px);
  border-color: rgba(251, 191, 36, 0.6);
  background: var(--arcade-card-hover);
  box-shadow: 0 10px 24px -5px rgba(0, 0, 0, 0.12);
}

.imported-game-card.card-win {
  border-left: 4px solid #10b981;
}

.imported-game-card.card-loss {
  border-left: 4px solid #f43f5e;
}

.imported-game-card.card-draw {
  border-left: 4px solid #94a3b8;
}

/* Saved Games List Cards */
.saved-game-card {
  transition: transform 0.18s cubic-bezier(0.2, 0, 0.2, 1), box-shadow 0.18s ease, border-color 0.18s ease;
}

.saved-game-card:hover {
  transform: translateY(-2px);
  border-color: rgba(251, 191, 36, 0.6) !important;
  box-shadow: 0 10px 24px -5px rgba(0, 0, 0, 0.18);
}

.saved-game-card .btn-delete-saved-game {
  opacity: 0.85;
  transition: all 0.15s ease;
}

.saved-game-card:hover .btn-delete-saved-game {
  opacity: 1;
}

.saved-game-card.card-bot-match:hover {
  border-color: rgba(139, 92, 246, 0.6) !important;
}

.saved-game-card .comic-btn,
.saved-game-card .btn,
.saved-game-card .badge {
  white-space: nowrap;
}

@media (max-width: 575.98px) {
  .saved-game-card .btn {
    min-width: 32px;
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
  }
}

/* ==========================================================================
   Collectible Bot Cards & Arena Controls
   ========================================================================== */
.arcade-bot-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 98px;
  min-height: 110px;
  padding: 0.65rem 0.5rem;
  border-radius: 1rem;
  background: var(--arcade-card);
  border: 1.5px solid var(--arcade-border);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.04);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.arcade-bot-card:hover {
  transform: translateY(-3px) scale(1.02);
  border-color: #fbbf24;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
}

.arcade-bot-card.active {
  border-color: #fbbf24;
  background: linear-gradient(180deg, rgba(251, 191, 36, 0.12) 0%, var(--arcade-card) 100%);
  box-shadow: 0 0 0 2px #fbbf24, 0 8px 24px rgba(251, 191, 36, 0.28);
  transform: translateY(-2px) scale(1.04);
}

.arcade-bot-avatar {
  font-size: 2.2rem;
  line-height: 1;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.25));
  transition: transform 0.2s ease;
}

.arcade-bot-card:hover .arcade-bot-avatar {
  transform: scale(1.15) rotate(3deg);
}

.arcade-bot-card.active .arcade-bot-avatar {
  animation: botAvatarPulse 2s infinite ease-in-out;
}

@keyframes botAvatarPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08) translateY(-2px); }
}

.arcade-bot-name {
  font-size: 0.76rem;
  font-weight: 800;
  max-width: 86px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 0.35rem;
}

.arcade-bot-elo {
  font-size: 0.68rem;
  font-weight: 800;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: rgba(251, 191, 36, 0.2);
  color: #d97706;
  border: 1px solid rgba(251, 191, 36, 0.4);
  margin-top: 0.2rem;
}

[data-bs-theme="dark"] .arcade-bot-elo {
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.15);
}

.arcade-bot-win-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 0.65rem;
  font-weight: 800;
  line-height: 1;
  padding: 0.15rem 0.35rem;
  border-radius: 999px;
  background: rgba(251, 191, 36, 0.2);
  color: #d97706;
  border: 1px solid rgba(251, 191, 36, 0.4);
  pointer-events: none;
}

[data-bs-theme="dark"] .arcade-bot-win-badge {
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.15);
}

/* Tier Switcher Pills */
.arcade-tier-tab {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: 999px;
  border: 1px solid var(--arcade-border);
  background: transparent;
  color: var(--arcade-text-muted);
  transition: all 0.18s ease;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.arcade-tier-tab:hover {
  color: var(--arcade-text);
  border-color: rgba(251, 191, 36, 0.6);
  transform: translateY(-1px);
}

.arcade-tier-tab.active {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  color: #0b0e14 !important;
  border-color: #fbbf24;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.35);
  font-weight: 800;
}

/* Elo Range Slider */
input[type="range"].arcade-range {
  accent-color: #fbbf24;
  height: 6px;
  border-radius: 999px;
  cursor: pointer;
}

/* Match Status Banner */
.arcade-match-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.85rem;
  border-radius: 0.9rem;
  background: var(--arcade-card);
  border: 1px solid var(--arcade-border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  background-color: #10b981;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulseDotAnim 1.6s infinite cubic-bezier(0.66, 0, 0, 1);
}

/* All-Bots Tier Grid Cards & Scrolling Enhancements */
[id^="tier-sec-"] {
  scroll-margin-top: 116px;
}

#bot-view {
  width: 100%;
  min-height: 100%;
}

.bot-tier-sticky-bar {
  background: rgba(248, 250, 252, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-radius: 999px;
  max-width: fit-content;
  margin: 0 auto;
  border: 1px solid var(--arcade-border);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  transition: all 0.2s ease;
}

[data-bs-theme="dark"] .bot-tier-sticky-bar {
  background: rgba(19, 23, 34, 0.92);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.bot-tier-nav-btn {
  border: 1px solid var(--arcade-border);
  background: transparent;
  color: var(--arcade-text-muted);
  cursor: pointer;
  transition: all 0.18s ease;
  user-select: none;
}

.bot-tier-nav-btn:hover {
  color: var(--arcade-text);
  border-color: #fbbf24;
}

.bot-tier-nav-btn.active {
  background: #fbbf24 !important;
  color: #0b0e14 !important;
  border-color: #f59e0b !important;
  box-shadow: 0 2px 8px rgba(251, 191, 36, 0.35);
}

.bot-select-card {
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  border: 1px solid var(--arcade-border);
  touch-action: pan-y;
  user-select: none;
  cursor: pointer;
}

.bot-select-card:hover {
  transform: translateY(-3px) scale(1.02);
  border-color: #fbbf24 !important;
  box-shadow: 0 8px 24px rgba(251, 191, 36, 0.22);
}

.bot-select-card:focus-visible {
  outline: none;
  border-color: #fbbf24 !important;
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.45);
}

.bot-select-card:active {
  transform: translateY(0px) scale(0.99);
}

.bot-select-card .bot-avatar-emoji {
  display: inline-block;
  transition: transform 0.2s ease;
}

.bot-select-card:hover .bot-avatar-emoji {
  transform: scale(1.18) rotate(5deg);
}

@keyframes pulseDotAnim {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Phase Elo Stat Chip */
.arcade-stat-chip {
  padding: 0.65rem 0.5rem;
  border-radius: 0.85rem;
  background: var(--arcade-card);
  border: 1px solid var(--arcade-border);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
  text-align: center;
  transition: transform 0.18s ease;
}

.arcade-stat-chip:hover {
  transform: translateY(-2px);
}

/* ==========================================================================
   Coaching Callouts, Clock Discipline Badges & Move Filter Pills
   ========================================================================== */
.clock-discipline-badge {
  background: rgba(148, 163, 184, 0.16);
  color: var(--arcade-text);
  border: 1px solid var(--arcade-border);
  font-size: 11px;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
}

.impulsive-move-badge {
  background: rgba(244, 63, 94, 0.16);
  color: #f43f5e;
  border: 1px solid rgba(244, 63, 94, 0.45);
  font-size: 11px;
  font-weight: 800;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
}

.time-trouble-badge {
  background: rgba(245, 158, 11, 0.18);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.5);
  font-size: 11px;
  font-weight: 800;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
}

.coaching-callout-card {
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.coaching-callout-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.move-filter-pill {
  font-size: 11px;
  font-weight: 800;
  padding: 0.15rem 0.55rem;
  border: 1px solid var(--arcade-border);
  background: transparent;
  color: var(--arcade-text-muted);
  transition: all 0.15s ease;
}

.move-filter-pill:hover {
  color: var(--arcade-text);
  border-color: rgba(245, 158, 11, 0.5);
}

.move-filter-pill.active {
  background: #f59e0b;
  color: #0b0e14 !important;
  border-color: #f59e0b;
}

/* ==========================================================================
   Tactical Motif Pills, Board Vision X-Ray Overlays & Positional Pillars
   ========================================================================== */
.motif-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 10.5px;
  font-weight: 800;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  border: 1.5px solid currentColor;
  line-height: 1.2;
}

.xray-toggle-btn {
  font-size: 10.5px;
  font-weight: 800;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--arcade-border);
  background: transparent;
  color: var(--arcade-text-muted);
  transition: all 0.15s ease;
}

.xray-toggle-btn:hover {
  color: var(--arcade-text);
  border-color: #06b6d4;
}

.xray-toggle-btn.active {
  background: #06b6d4;
  color: #0b0e14 !important;
  border-color: #06b6d4;
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.4);
}

.xray-toggle-btn.active-best {
  background: #10b981;
  color: #ffffff !important;
  border-color: #10b981;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
}

.xray-hanging-ring {
  position: absolute;
  inset: 2px;
  border-radius: 0.4rem;
  border: 3px solid #ef4444;
  box-shadow: inset 0 0 12px rgba(239, 68, 68, 0.55), 0 0 8px rgba(239, 68, 68, 0.6);
  pointer-events: none;
  z-index: 25;
  animation: xrayPulseRed 1.4s infinite ease-in-out;
}

.xray-loose-ring {
  position: absolute;
  inset: 3px;
  border-radius: 0.4rem;
  border: 2.5px dashed #f59e0b;
  box-shadow: inset 0 0 8px rgba(245, 158, 11, 0.35);
  pointer-events: none;
  z-index: 25;
}

.xray-hanging-tag,
.xray-loose-tag {
  position: absolute;
  bottom: 1px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 7.5px;
  font-weight: 900;
  padding: 1px 4px;
  border-radius: 4px;
  white-space: nowrap;
  letter-spacing: 0.2px;
  line-height: 1.1;
  pointer-events: auto;
  cursor: help;
  z-index: 30;
  transition: transform 0.12s ease;
}

.xray-hanging-tag:hover,
.xray-loose-tag:hover {
  transform: translateX(-50%) scale(1.18);
}

.xray-hanging-tag {
  background: #ef4444;
  color: #ffffff;
  border: 1px solid #000000;
}

.xray-loose-tag {
  background: #f59e0b;
  color: #0b0e14;
  border: 1px solid #000000;
}

.xray-heatmap-cell {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  transition: background-color 0.2s ease;
}

@keyframes xrayPulseRed {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.78; transform: scale(0.97); }
}

.positional-pillar-track {
  width: 100%;
  height: 7px;
  border-radius: 999px;
  background: #334155;
  border: 1px solid rgba(0, 0, 0, 0.45);
  overflow: hidden;
  display: flex;
}

.positional-pillar-white {
  height: 100%;
  background: linear-gradient(90deg, #f8fafc 0%, #38bdf8 100%);
  transition: width 0.25s ease;
}

.positional-pillar-card {
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease;
  user-select: none;
}

.positional-pillar-card:hover {
  transform: translateY(-1.5px);
  border-color: rgba(56, 189, 248, 0.5) !important;
  background: var(--arcade-card-hover) !important;
  box-shadow: 0 4px 14px -3px rgba(0, 0, 0, 0.25);
}

.positional-pillar-card:active {
  transform: translateY(0);
}

.pillar-guide-highlight {
  border-color: #38bdf8 !important;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.35), 0 8px 24px -4px rgba(0, 0, 0, 0.3) !important;
}


/* ==========================================================================
   Chess IQ Global Floating Tooltip & Info Popups
   ========================================================================== */
#iq-global-tooltip {
  position: absolute;
  z-index: 99999;
  max-width: 320px;
  width: max-content;
  pointer-events: none;
  background: var(--arcade-card, #131722);
  border: 1.5px solid var(--arcade-border, #2d3748);
  border-radius: 0.85rem;
  padding: 0.65rem 0.8rem;
  box-shadow: 0 16px 36px -6px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(251, 191, 36, 0.15);
  animation: iqTooltipFadeIn 0.14s ease-out;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

[data-bs-theme="light"] #iq-global-tooltip {
  background: #ffffff;
  border-color: #cbd5e1;
  box-shadow: 0 16px 32px -4px rgba(15, 23, 42, 0.15), 0 0 0 1px rgba(245, 158, 11, 0.2);
}

@keyframes iqTooltipFadeIn {
  from { opacity: 0; transform: translateY(4px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.iq-tooltip-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--arcade-border, rgba(255, 255, 255, 0.1));
}

.iq-tooltip-badge {
  font-size: 8.5px;
  font-weight: 900;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(251, 191, 36, 0.16);
  color: #f59e0b;
  border: 1px solid rgba(251, 191, 36, 0.3);
  flex-shrink: 0;
}

.iq-tooltip-title {
  font-size: 12px;
  font-weight: 800;
  color: inherit;
}

.iq-tooltip-shortcut {
  font-size: 9px;
  font-family: var(--bs-font-monospace);
  color: #94a3b8;
  background: rgba(148, 163, 184, 0.15);
  padding: 1px 4px;
  border-radius: 4px;
  white-space: nowrap;
}

.iq-tooltip-body {
  font-size: 11px;
  line-height: 1.4;
  color: inherit;
}

.iq-tooltip-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.iq-tooltip-label {
  font-size: 9.5px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.iq-tooltip-text {
  font-weight: 500;
  color: var(--bs-body-color, #e2e8f0);
}

[data-bs-theme="light"] .iq-tooltip-text {
  color: #1e293b;
}

.iq-tooltip-arrow {
  position: absolute;
  width: 10px;
  height: 10px;
  background: inherit;
  border: 1.5px solid var(--arcade-border, #2d3748);
  transform: rotate(45deg);
  pointer-events: none;
}

.iq-tooltip-arrow.arrow-bottom {
  bottom: -6px;
  border-top: none;
  border-left: none;
}

.iq-tooltip-arrow.arrow-top {
  top: -6px;
  border-bottom: none;
  border-right: none;
}

/* Info Icon Button on Data Cards */
.iq-info-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  font-size: 10.5px;
  color: #94a3b8;
  background: rgba(148, 163, 184, 0.12);
  border: 1px solid rgba(148, 163, 184, 0.25);
  cursor: pointer;
  padding: 0;
  margin-left: 0.35rem;
  transition: all 0.15s ease;
  vertical-align: middle;
  line-height: 1;
}

.iq-info-icon-btn:hover,
.iq-info-icon-btn:focus-visible {
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.18);
  border-color: #f59e0b;
  transform: scale(1.12);
  outline: none;
}

/* ==========================================================================
   High-Contrast Typography, Badges, Elo Ratings & Match Overview
   ========================================================================== */

/* Universal High-Contrast Color Utility Overrides */
.text-cyan {
  color: #38bdf8 !important;
}
[data-bs-theme="light"] .text-cyan {
  color: #0284c7 !important;
}

.text-emerald {
  color: #10b981 !important;
}
[data-bs-theme="light"] .text-emerald {
  color: #059669 !important;
}

/* Match Overview Section Header */
.match-overview-pill {
  display: inline-flex;
  align-items: center;
  background: rgba(251, 191, 36, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.4);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  border-radius: 999px;
}
[data-bs-theme="light"] .match-overview-pill {
  background: #fef3c7;
  color: #b45309;
  border-color: #fde68a;
}

/* Player PVP Card in Match Overview */
.player-pvp-card {
  background: var(--arcade-card-hover, rgba(0,0,0,0.03));
  border: 1px solid var(--arcade-border);
  border-radius: 0.75rem;
  padding: 0.65rem 0.75rem;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.player-pvp-card:hover {
  border-color: rgba(251, 191, 36, 0.4);
}
.player-pvp-card.is-user {
  border-color: rgba(251, 191, 36, 0.35);
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.06) 0%, transparent 100%);
}

/* Match Stat Badges (Elo, Perf, Acc) */
.match-stat-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 700;
  padding: 2.5px 7px;
  border-radius: 6px;
  font-family: var(--bs-font-monospace);
  white-space: nowrap;
  line-height: 1.25;
  transition: transform 0.15s ease;
}
.match-stat-badge .stat-num {
  font-weight: 900;
}
.match-stat-badge .stat-lbl {
  font-weight: 600;
  opacity: 0.85;
  font-size: 10px;
  text-transform: uppercase;
}

/* Official Elo Badge */
.match-elo-badge {
  background: rgba(148, 163, 184, 0.16);
  color: #e2e8f0;
  border: 1px solid rgba(148, 163, 184, 0.35);
}
[data-bs-theme="light"] .match-elo-badge {
  background: #f1f5f9;
  color: #1e293b;
  border-color: #cbd5e1;
}

/* Performance Elo Badge */
.match-perf-badge {
  background: rgba(56, 189, 248, 0.18);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.45);
}
[data-bs-theme="light"] .match-perf-badge {
  background: #e0f2fe;
  color: #0369a1;
  border-color: #7dd3fc;
}

/* Accuracy Badge */
.match-acc-badge {
  background: rgba(52, 211, 153, 0.18);
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.45);
}
[data-bs-theme="light"] .match-acc-badge {
  background: #dcfce7;
  color: #15803d;
  border-color: #86efac;
}

/* Match Result Badge in Center */
.match-result-badge {
  font-family: var(--bs-font-monospace);
  font-size: 13px;
  font-weight: 900;
  padding: 4px 10px;
  border-radius: 8px;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}
.match-result-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.75px;
  color: var(--arcade-text-muted);
  background: rgba(148, 163, 184, 0.15);
  padding: 1.5px 6px;
  border-radius: 4px;
}

/* Phase Elo Rating Chip (Opening, Middle, Endgame) */
.phase-elo-chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 6px;
  font-family: var(--bs-font-monospace);
  background: rgba(255, 255, 255, 0.08);
  color: #f1f5f9;
  border: 1px solid rgba(255, 255, 255, 0.18);
  line-height: 1.2;
}
[data-bs-theme="light"] .phase-elo-chip {
  background: #f1f5f9;
  color: #0f172a;
  border-color: #cbd5e1;
}

/* Move Quality Breakdown Rows & Badges */
.move-quality-row {
  transition: background-color 0.15s ease;
  border-radius: 8px;
}
.move-quality-row.has-moves {
  background: rgba(255, 255, 255, 0.04);
}
[data-bs-theme="light"] .move-quality-row.has-moves {
  background: rgba(0, 0, 0, 0.03);
}
.move-quality-row.no-moves {
  background: transparent;
  opacity: 0.85;
}
.move-quality-row:hover {
  background: var(--arcade-card-hover) !important;
}

.move-quality-badge {
  font-size: 12px;
  font-weight: 800;
  min-width: 130px;
  height: 26px;
  padding: 3px 10px;
  justify-content: center;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(0, 0, 0, 0.18);
  letter-spacing: -0.01em;
}
[data-bs-theme="dark"] .move-quality-badge {
  border: 1px solid rgba(255, 255, 255, 0.22);
}

.move-count-zero {
  color: var(--arcade-text-muted) !important;
  opacity: 0.5;
}

/* Active Move Strip Badges */
.eval-chip-badge {
  background: rgba(148, 163, 184, 0.18);
  color: var(--arcade-text);
  border: 1px solid var(--arcade-border);
  font-size: 12px;
  font-weight: 800;
  padding: 4px 8px;
  border-radius: 6px;
}

.best-move-chip {
  background: #059669;
  color: #ffffff !important;
  border: 1px solid #047857;
  font-size: 11.5px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(5, 150, 105, 0.3);
}

.second-move-chip {
  background: rgba(56, 189, 248, 0.18);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.4);
  font-size: 11.5px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
}
[data-bs-theme="light"] .second-move-chip {
  background: #e0f2fe;
  color: #0369a1;
  border-color: #7dd3fc;
}

.eval-gap-badge {
  background: var(--arcade-surface, rgba(255, 255, 255, 0.05));
  border: 1px solid var(--arcade-border);
  font-size: 11px;
  font-weight: 700;
  border-radius: 6px;
  padding: 3px 6px;
}

.eval-drop-badge {
  font-size: 11px;
  font-weight: 800;
  border-radius: 6px;
  padding: 3px 6px;
}

/* Move Table Mini Badge */
.mini-move-badge {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(0, 0, 0, 0.25);
}
[data-bs-theme="dark"] .mini-move-badge {
  border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Saved Game Elo Badge */
.saved-game-elo-badge {
  background: rgba(148, 163, 184, 0.16);
  color: var(--arcade-text);
  border: 1px solid var(--arcade-border);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 6px;
}

/* Comprehensive Game Report Modal & Print Styles */
.full-report-dialog {
  max-width: 980px !important;
  width: 100% !important;
  max-height: calc(100dvh - clamp(2.5rem, 7vh, 5rem)) !important;
  margin: auto !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
}

.report-metric-card {
  background: var(--arcade-card);
  border: 1px solid var(--arcade-border);
  border-radius: 0.85rem;
  padding: 0.85rem;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.report-metric-card:hover {
  border-color: rgba(251, 191, 36, 0.4);
}

.report-phase-card {
  background: var(--arcade-card);
  border: 1px solid var(--arcade-border);
  border-radius: 0.85rem;
  padding: 0.75rem;
  height: 100%;
}

.report-blunder-row {
  background: var(--arcade-card);
  border: 1px solid var(--arcade-border);
  border-radius: 0.65rem;
  padding: 0.6rem 0.85rem;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.report-blunder-row:hover {
  background-color: var(--arcade-card-hover, rgba(0, 0, 0, 0.04));
  border-color: rgba(244, 63, 94, 0.4);
}

.report-dual-bar-track {
  height: 8px;
  background: var(--arcade-border, rgba(0, 0, 0, 0.1));
  border-radius: 999px;
  overflow: hidden;
  display: flex;
}

.report-dual-bar-white {
  background: #fbbf24;
  height: 100%;
  transition: width 0.3s ease;
}

.report-dual-bar-black {
  background: #06b6d4;
  height: 100%;
  transition: width 0.3s ease;
}

@media print {
  body * {
    visibility: hidden !important;
  }
  #review-detailed-modal, #review-detailed-modal * {
    visibility: visible !important;
  }
  #review-detailed-modal {
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    max-height: none !important;
    background: #ffffff !important;
    color: #000000 !important;
    padding: 0 !important;
    backdrop-filter: none !important;
  }
  .full-report-dialog, .why-dialog {
    max-height: none !important;
    overflow: visible !important;
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    background: #ffffff !important;
    color: #000000 !important;
  }
  .no-print {
    display: none !important;
  }
}

/* ==========================================================
   Hero Full Game Report Button & Opening Explorer Modal
   ========================================================== */

.report-hero-btn {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%) !important;
  color: #0f172a !important;
  border: 2px solid #b45309 !important;
  font-weight: 900 !important;
  font-size: 13px !important;
  letter-spacing: 0.3px;
  box-shadow: 0 3px 10px rgba(245, 158, 11, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.3) !important;
  transition: all 0.15s ease-in-out !important;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.3);
}

.report-hero-btn:hover {
  background: linear-gradient(135deg, #fcd34d 0%, #fbbf24 100%) !important;
  color: #000000 !important;
  transform: translateY(-1px) scale(1.02);
  box-shadow: 0 6px 16px rgba(245, 158, 11, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.4) !important;
}

.report-hero-btn:active {
  transform: translateY(1px) scale(0.99);
  box-shadow: 0 2px 6px rgba(245, 158, 11, 0.4) !important;
}

.report-cta-banner {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.12) 0%, rgba(245, 158, 11, 0.06) 100%);
  border: 2px dashed rgba(245, 158, 11, 0.45);
  border-radius: 0.75rem;
  transition: all 0.2s ease;
}

.report-cta-banner:hover {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.2) 0%, rgba(245, 158, 11, 0.12) 100%);
  border-color: #f59e0b;
  transform: translateY(-1px);
}

.eco-interactive-btn {
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  text-decoration: none;
  transition: opacity 0.15s ease;
}

.eco-interactive-btn:hover .eco-code-badge {
  filter: brightness(1.1);
  transform: scale(1.05);
}

.eco-interactive-btn:hover .eco-name-label {
  color: var(--arcade-text-highlight, #f59e0b) !important;
  text-decoration: underline;
}

.eco-code-badge {
  transition: transform 0.15s ease, filter 0.15s ease;
}

.opening-explorer-dialog {
  max-width: 620px !important;
  width: 100% !important;
}

/* ==========================================================================
   Zero-Build Native Utilities (Fractional Spacing, Typography & Layout)
   Replaces external Tailwind runtime with native, performant CSS rules.
   ========================================================================== */

/* Typography */
.fw-black { font-weight: 900 !important; }
.font-medium { font-weight: 500 !important; }
.font-italic { font-style: italic !important; }
.font-sans { font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important; }
.tracking-tight { letter-spacing: -0.025em !important; }
.leading-relaxed { line-height: 1.625 !important; }

/* Dimensions & Overflow */
.min-w-0 { min-width: 0 !important; }
.overflow-y-auto { overflow-y: auto !important; }
.overflow-x-hidden { overflow-x: hidden !important; }
.cursor-help { cursor: help !important; }
.max-w-sm { max-width: 22rem !important; }
.max-w-md { max-width: 28rem !important; }
.max-w-xl { max-width: 36rem !important; }
.max-w-2xl { max-width: 42rem !important; }

/* Extra-small & Ghost Button Utilities */
.btn-xs {
  padding: 0.15rem 0.5rem;
  font-size: 0.7rem;
  line-height: 1.25;
  border-radius: 0.4rem;
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
}

.btn-ghost:hover {
  background: rgba(148, 163, 184, 0.12);
}

/* Move Table Cells, Classification Dots & Active Selection */
.move-cell {
  border-radius: 0.4rem;
  transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
  user-select: none;
}

.move-cell:hover {
  background-color: rgba(245, 158, 11, 0.12) !important;
}

.move-cell.active-cell {
  background-color: rgba(245, 158, 11, 0.24) !important;
  box-shadow: inset 0 0 0 1.5px #f59e0b;
  font-weight: 900 !important;
}

[data-bs-theme="light"] .move-cell.active-cell {
  background-color: rgba(245, 158, 11, 0.28) !important;
  color: #0f172a !important;
}

.table-row-selected {
  background-color: rgba(245, 158, 11, 0.06);
}

.classification-dot {
  display: inline-block;
  width: 8px !important;
  height: 8px !important;
  min-width: 8px !important;
  min-height: 8px !important;
  border-radius: 50% !important;
  aspect-ratio: 1 / 1 !important;
  padding: 0 !important;
  flex-shrink: 0 !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.move-cell-clock {
  font-size: 9.5px;
  color: var(--bs-secondary-color);
  opacity: 0.85;
}

/* Modal Board Responsive Sizing (Desktop vs Mobile Portrait) */
.modal-board-container {
  width: 100%;
  max-width: min(370px, 46vh);
}

@media (min-width: 768px) {
  .modal-board-container {
    max-width: min(440px, 54vh);
  }
}

@media (min-width: 1200px) {
  .modal-board-container {
    max-width: min(480px, 58vh);
  }
}

.modal-board-container .board-container {
  width: 100%;
  max-width: 100% !important;
  aspect-ratio: 1 / 1;
}

.modal-board-container .board-player-bar {
  width: 100%;
  max-width: 100% !important;
  margin: 0.15rem 0;
  padding: 0.22rem 0.5rem;
  min-height: 30px;
  font-size: 0.78rem;
}

.modal-board-container .captured-piece-img {
  width: 17px;
  height: 17px;
}

@media (max-width: 767.98px) {
  .modal-board-container {
    max-width: min(350px, 82vw);
  }
}

/* Shadows & Opacity */
.shadow-2xl { box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.45) !important; }
.border-opacity-25 { border-color: rgba(var(--bs-border-color-rgb, 226, 232, 240), 0.25) !important; }
.border-opacity-10 { border-color: rgba(var(--bs-border-color-rgb, 226, 232, 240), 0.10) !important; }

/* Fractional Padding */
.p-0\.5, .p-0\.2 { padding: 0.125rem !important; }
.p-1\.5  { padding: 0.375rem !important; }
.p-2\.5  { padding: 0.625rem !important; }
.px-1\.5 { padding-left: 0.375rem !important; padding-right: 0.375rem !important; }
.px-2\.5 { padding-left: 0.625rem !important; padding-right: 0.625rem !important; }
.px-3\.5 { padding-left: 0.875rem !important; padding-right: 0.875rem !important; }
.py-0\.2 { padding-top: 0.05rem !important; padding-bottom: 0.05rem !important; }
.py-0\.5 { padding-top: 0.125rem !important; padding-bottom: 0.125rem !important; }
.py-1\.5 { padding-top: 0.375rem !important; padding-bottom: 0.375rem !important; }
.py-2\.5 { padding-top: 0.625rem !important; padding-bottom: 0.625rem !important; }
.pt-1\.5 { padding-top: 0.375rem !important; }
.pb-1\.5 { padding-bottom: 0.375rem !important; }
.pb-2\.5 { padding-bottom: 0.625rem !important; }
.pe-1\.5 { padding-right: 0.375rem !important; }

/* Fractional Margins */
.m-2\.5  { margin: 0.625rem !important; }
.mt-0\.5 { margin-top: 0.125rem !important; }
.mt-1\.5 { margin-top: 0.375rem !important; }
.mt-2\.5 { margin-top: 0.625rem !important; }
.mb-0\.5 { margin-bottom: 0.125rem !important; }
.mb-1\.5 { margin-bottom: 0.375rem !important; }
.mb-2\.5 { margin-bottom: 0.625rem !important; }
.me-0\.5 { margin-right: 0.125rem !important; }
.me-1\.5 { margin-right: 0.375rem !important; }
.ms-0\.5 { margin-left: 0.125rem !important; }

/* Fractional Gaps */
.gap-1\.5 { gap: 0.375rem !important; }
.gap-2\.5 { gap: 0.625rem !important; }
.g-1\.5   { --bs-gutter-x: 0.375rem; --bs-gutter-y: 0.375rem; }
.g-2\.5   { --bs-gutter-x: 0.625rem; --bs-gutter-y: 0.625rem; }

/* Responsive Utility Extensions & Fallbacks */
@media (min-width: 576px) {
  .gap-sm-1\.5 { gap: 0.375rem !important; }
  .gap-sm-2\.5 { gap: 0.625rem !important; }
  .px-sm-3\.5  { padding-left: 0.875rem !important; padding-right: 0.875rem !important; }
  .py-sm-2\.5  { padding-top: 0.625rem !important; padding-bottom: 0.625rem !important; }
  .fs-sm-5     { font-size: 1.25rem !important; }

  /* Tailwind compatibility fallback classes */
  .\sm\:gap-2   { gap: 0.5rem !important; }
  .\sm\:gap-3   { gap: 1rem !important; }
  .\sm\:px-3   { padding-left: 1rem !important; padding-right: 1rem !important; }
  .\sm\:px-3\.5 { padding-left: 0.875rem !important; padding-right: 0.875rem !important; }
  .\sm\:py-2\.5 { padding-top: 0.625rem !important; padding-bottom: 0.625rem !important; }
  .\sm\:p-5     { padding: 3rem !important; }
  .\sm\:fs-5    { font-size: 1.25rem !important; }
  .\sm\:inline  { display: inline !important; }
}

@media (min-width: 768px) {
  .p-md-3\.5 { padding: 0.875rem !important; }
}

@media (min-width: 992px) {
  .\lg\:px-4 { padding-left: 1.5rem !important; padding-right: 1.5rem !important; }
}

/* Feature 1: Plain-English Coach Explanation Strip */
.review-coach-strip {
  border-left: 4px solid var(--bs-secondary, #6c757d);
  background: var(--arcade-card-hover, rgba(0, 0, 0, 0.03));
  transition: border-color 0.2s ease, background-color 0.2s ease;
  min-height: 44px;
}
.review-coach-strip.coach-blunder {
  border-left-color: #ef4444 !important;
  background: rgba(239, 68, 68, 0.08) !important;
}
.review-coach-strip.coach-mistake {
  border-left-color: #f97316 !important;
  background: rgba(249, 115, 22, 0.08) !important;
}
.review-coach-strip.coach-inaccuracy {
  border-left-color: #eab308 !important;
  background: rgba(234, 179, 8, 0.08) !important;
}
.review-coach-strip.coach-brilliant {
  border-left-color: #06b6d4 !important;
  background: rgba(6, 182, 212, 0.08) !important;
}
.review-coach-strip.coach-best {
  border-left-color: #10b981 !important;
  background: rgba(16, 185, 129, 0.08) !important;
}

/* Feature 3: Advantage Chart Milestone Pins */
.chart-milestone-pin {
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
}
.chart-milestone-pin:hover {
  transform: translateY(-2px) scale(1.1);
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.35));
}
.chart-milestone-pin text {
  user-select: none;
}

/* Feature 6: Danger Square Spotlight on Blundered/Threatened Square */
.square-danger-spotlight {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle, rgba(239, 68, 68, 0.42) 0%, rgba(239, 68, 68, 0.12) 75%, transparent 100%);
  border: 2.5px solid rgba(239, 68, 68, 0.85);
  box-shadow: inset 0 0 12px rgba(239, 68, 68, 0.35);
  z-index: 15;
  animation: dangerPulse 1.8s infinite ease-in-out;
}
@keyframes dangerPulse {
  0%, 100% { opacity: 0.75; transform: scale(0.98); }
  50% { opacity: 1; transform: scale(1.02); }
}

/* Feature 6: Mobile Thumb-Friendly Sticky Step Navigation */
@media (max-width: 767.98px) {
  .review-mobile-nav-sticky {
    position: sticky;
    bottom: 0;
    z-index: 1020;
    background: var(--arcade-card, #ffffff);
    box-shadow: 0 -4px 18px rgba(0, 0, 0, 0.18);
    border-top: 2px solid var(--arcade-border, #000);
    padding: 0.4rem 0.6rem;
    margin-bottom: 0 !important;
  }
}



/* Mobile Bot Card Optimization (Compact 2-column view to minimize scrolling) */
@media (max-width: 768px) {
  .bot-select-card {
    padding: 0.45rem 0.6rem !important;
    border-radius: 0.75rem !important;
  }

  .bot-select-card .bot-avatar-emoji {
    font-size: 1.5rem !important;
  }

  .bot-select-card .bot-name {
    font-size: 0.85rem !important;
    line-height: 1.2 !important;
  }

  .bot-select-card .bot-elo-badge {
    font-size: 10px !important;
    padding: 0.15rem 0.35rem !important;
  }

  .bot-select-card .bot-title {
    font-size: 10px !important;
  }
}
