/* =========================================================
   Double Move Chess - Chess.com Authentic Design System
   Matches exact Chess.com homepage navigation and layout
   ========================================================= */

:root {
  --bg-page: #262522;
  --bg-sidebar: #1e1d1b;
  --bg-panel: #21201d;
  --bg-card: #21201d;
  --bg-btn-dark: #2b2926;
  --bg-hover: #363431;
  --bg-active: #2b2926;

  --text-main: #ffffff;
  --text-secondary: #c3c2bf;
  --text-muted: #8b8987;
  --text-dim: #5c5a57;

  --accent-green: #81b64c;
  --accent-green-hover: #90c559;
  --accent-green-dark: #537a2e;
  --accent-green-shadow: #537a2e;
  --accent-cyan: #30b3e6;
  --accent-orange: #f59e0b;
  --accent-red: #fa412d;
  --accent-red-hover: #e0321f;

  /* Board squares (Chess.com classic exact palette) */
  --board-light: #ebecd0;
  --board-dark: #739552;
  --board-highlight: rgba(247, 236, 116, 0.5);
  --board-selected: rgba(247, 236, 116, 0.7);

  /* Preview Wood & Neon board themes */
  --wood-light: #c5a059;
  --wood-dark: #8a5a2b;
  --neon-light: #9ec9db;
  --neon-dark: #3b6e8c;

  --border-subtle: #2b2926;
  --border-light: #363431;

  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'SF Pro Mono', 'Segoe UI Mono', 'Courier New', Courier, monospace;

  --nav-width: 140px;
  --board-size: min(calc(100vw - var(--nav-width) - 430px), 73vh, 590px);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

.hidden {
  display: none !important;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow-x: hidden;
}

body.chess-dark-theme {
  font-family: var(--font-sans);
  background-color: var(--bg-page);
  color: var(--text-main);
  display: flex;
}

/* Global App Container */
.chess-layout {
  display: flex;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* =========================================================
   Left Navigation Bar (Identical to Chess.com screenshot)
   ========================================================= */
.chess-nav {
  width: var(--nav-width);
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding: 12px 8px;
  flex-shrink: 0;
  user-select: none;
  z-index: 50;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.35);
}

/* Brand Logo (Chess.com style) */
.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px 12px 6px;
  cursor: pointer;
  text-decoration: none;
}

.brand-logo-icon {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-text {
  font-size: 1.22rem;
  font-weight: 800;
  letter-spacing: -0.4px;
  color: #ffffff;
  line-height: 1;
  white-space: nowrap;
}

.brand-sub {
  color: #9e9c98;
  font-weight: 700;
}

/* Nav Menu */
.nav-menu {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  border-radius: 6px;
  transition: background-color 0.15s ease;
}

.nav-item:hover {
  background-color: var(--bg-hover);
}

.nav-item.active {
  background-color: var(--bg-card);
  position: relative;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 5px;
  bottom: 5px;
  width: 3px;
  background-color: var(--accent-green);
  border-radius: 0 3px 3px 0;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.94rem;
  font-weight: 600;
  white-space: nowrap;
}

.nav-item.active .nav-link {
  color: #ffffff;
}

.nav-icon {
  font-size: 1.15rem;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}

.puzzle-icon {
  color: var(--accent-orange);
}

.training-icon {
  color: #4ade80;
}

.watch-icon {
  color: #60a5fa;
}

.more-icon {
  font-weight: 900;
  letter-spacing: 1px;
}

.nav-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Free Trial Subscription item (screenshot style) */
.nav-item-trial {
  margin-top: 6px;
  border-radius: 6px;
  background-color: rgba(48, 179, 230, 0.08);
  border: 1px solid rgba(48, 179, 230, 0.2);
  transition: background-color 0.15s;
}

.nav-item-trial:hover {
  background-color: rgba(48, 179, 230, 0.15);
}

.nav-link-trial {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  text-decoration: none;
  color: var(--accent-cyan);
}

.trial-diamond {
  font-size: 1.05rem;
}

.trial-text {
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.25;
}

/* Bottom Profile & Tools (screenshot style) */
.nav-bottom {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
}

.nav-search-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 6px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 600;
  transition: all 0.15s;
}

.nav-search-btn:hover {
  background-color: var(--bg-hover);
  color: #ffffff;
}

.search-icon {
  font-size: 0.95rem;
}

/* User chip (screenshot style) */
.nav-user-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 6px;
  border-radius: 6px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
}

.nav-user-avatar {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  background-color: #3b82f6;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.avatar-mini-img {
  width: 20px;
  height: 20px;
}

.nav-user-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
}

/* Quick Tool Icons bar */
.nav-tools-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2px;
  padding-top: 4px;
}

.tool-btn {
  position: relative;
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.95rem;
  transition: all 0.15s;
}

.tool-btn:hover {
  background-color: var(--bg-hover);
  color: #ffffff;
}

.tool-badge {
  position: absolute;
  top: 1px;
  right: 1px;
  background-color: var(--accent-red);
  color: #ffffff;
  font-size: 9px;
  font-weight: 800;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--bg-sidebar);
}

.tool-lang-dropdown {
  width: 44px;
}

.chess-lang-select {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 2px;
  width: 100%;
  cursor: pointer;
  outline: none;
}

/* =========================================================
   Workspace Wrapper (Top Status Header + Board Area)
   ========================================================= */
.workspace-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background-color: var(--bg-page);
}

/* Top Status Header (as seen in screenshot) */
.chess-top-header {
  height: 48px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 32px;
  background-color: var(--bg-panel);
  border-bottom: 1px solid var(--border-subtle);
  user-select: none;
}

.top-user-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: var(--bg-btn-dark);
  padding: 4px 12px 4px 6px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
}

.top-avatar {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background-color: #3b82f6;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.top-user-name {
  font-size: 0.92rem;
  font-weight: 700;
  color: #ffffff;
}

.top-user-flag {
  font-size: 0.95rem;
}

.top-user-knight {
  font-size: 0.88rem;
  font-weight: 700;
  color: #c3c2bf;
  margin-left: 2px;
}

.top-streak-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background-color: var(--bg-btn-dark);
  padding: 5px 14px;
  border-radius: 20px;
  border: 1px solid var(--border-subtle);
}

.streak-flame {
  font-size: 1.05rem;
}

.streak-text {
  font-size: 0.9rem;
  font-weight: 700;
  color: #ffffff;
}

/* =========================================================
   HOME VIEW DASHBOARD (Exact Chess.com homepage from screenshot)
   ========================================================= */
.chess-home-dashboard {
  flex: 1;
  overflow-y: auto;
  padding: 24px 32px 36px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.chess-home-dashboard.hidden {
  display: none !important;
}

.home-grid {
  display: grid;
  grid-template-columns: 256px repeat(3, minmax(200px, 1fr));
  gap: 12px;
  max-width: 1180px;
  width: 100%;
}

/* Left Play Card */
.home-play-card {
  background-color: var(--bg-panel);
  border: none;
  border-radius: 8px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.home-card-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.3px;
}

/* Quick Time Pills */
.home-time-pills {
  display: flex;
  gap: 6px;
}

.home-pill {
  flex: 1;
  padding: 8px 4px;
  background-color: var(--bg-btn-dark);
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
}

.home-pill:hover {
  background-color: var(--bg-hover);
  color: #ffffff;
}

.home-pill.active {
  border: 2px solid var(--accent-green);
  background-color: var(--bg-panel);
  color: #ffffff;
}

/* Big Green Play Button (Chess.com signature 3D button) */
.home-btn-play {
  background-color: var(--accent-green);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 13px 12px;
  font-size: 1.05rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 0 var(--accent-green-shadow);
  transition: all 0.15s ease;
  text-align: center;
  letter-spacing: -0.2px;
  white-space: nowrap;
  width: 100%;
}

.home-btn-play:hover {
  background-color: var(--accent-green-hover);
  transform: translateY(-1px);
  box-shadow: 0 5px 0 var(--accent-green-shadow);
}

.home-btn-play:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--accent-green-shadow);
}

/* Option Buttons list */
.home-options-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 2px;
}

.home-option-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  background-color: var(--bg-btn-dark);
  border: none;
  border-radius: 8px;
  color: #ffffff;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.1s ease;
  text-align: left;
  width: 100%;
}

.flag-icon {
  width: 20px;
  height: 13px;
  border-radius: 2px;
  vertical-align: middle;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  display: inline-block;
}

.home-option-btn:hover {
  background-color: var(--bg-hover);
}

.home-option-btn:active {
  transform: scale(0.99);
}

.home-option-btn.active {
  background-color: var(--bg-hover);
}

.opt-icon {
  font-size: 1.15rem;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}

.opt-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Feature Cards (Middle/Right: Puzzles, Lessons, Bots) */
.home-feature-card {
  background-color: var(--bg-panel);
  border: none;
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.feature-board-preview {
  width: 100%;
  flex: 1;
}

.mini-board-mock {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  width: 100%;
  aspect-ratio: 1/1;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
}

.mini-sq.s-l {
  background-color: var(--board-light);
  display: flex;
  align-items: center;
  justify-content: center;
}

.mini-sq.s-d {
  background-color: var(--board-dark);
  display: flex;
  align-items: center;
  justify-content: center;
}

.mini-p {
  width: 100%;
  height: 100%;
  background-size: 100% 100%;
  background-repeat: no-repeat;
  background-position: center;
}

/* Action button at bottom of feature cards (dark rounded button) */
.feature-action-btn {
  background-color: var(--bg-btn-dark);
  border: none;
  color: #ffffff;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.1s ease;
  text-align: center;
  width: 100%;
}

.feature-action-btn:hover {
  background-color: var(--bg-hover);
}

.feature-action-btn:active {
  transform: scale(0.99);
}

/* Puzzle meta row */
.puzzle-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  padding: 2px 0;
}

.puzzle-badge {
  background-color: #c86a27;
  color: #ffffff;
  font-weight: 800;
  font-size: 0.78rem;
  border-radius: 4px;
  padding: 2px 7px;
  min-width: 24px;
  text-align: center;
}

.puzzle-rating {
  color: #ffffff;
  font-weight: 800;
  font-size: 0.92rem;
}

.puzzle-streak {
  color: #ffffff;
  font-weight: 700;
  font-size: 0.88rem;
  margin-left: auto;
}

.puzzle-progress-bar {
  height: 6px;
  background-color: var(--bg-btn-dark);
  border-radius: 3px;
  position: relative;
  overflow: visible;
}

.puzzle-progress-fill {
  height: 100%;
  width: 48%;
  background-color: #c86a27;
  border-radius: 3px;
  position: relative;
}

.puzzle-progress-thumb {
  position: absolute;
  right: -5px;
  top: -3px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: #c86a27;
  border: 2px solid var(--bg-panel);
}

/* Lesson meta row */
.lesson-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 0;
}

.lesson-cap-icon {
  font-size: 1.25rem;
  color: #38bdf8;
}

.lesson-title {
  color: #ffffff;
  font-weight: 700;
  font-size: 0.92rem;
}

/* Bot meta row (Card 4) */
.bot-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 0;
}

.bot-home-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  overflow: hidden;
  background-color: var(--bg-btn-dark);
  flex-shrink: 0;
  border: 1px solid var(--border-light);
}

.bot-home-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.bot-home-name {
  color: #ffffff;
  font-weight: 700;
  font-size: 0.92rem;
}

/* =========================================================
   Home Review Card (Empty & Active States)
   ========================================================= */
.home-review-card {
  display: flex;
  flex-direction: column;
}

.review-empty-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  flex: 1;
  padding: 16px 12px;
  gap: 12px;
  background-color: rgba(255, 255, 255, 0.02);
  border-radius: 6px;
  border: 1px dashed var(--border-light);
}

.review-empty-icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background-color: var(--bg-btn-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--text-muted);
}

.review-empty-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: #ffffff;
}

.review-empty-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin-bottom: auto;
}

.btn-empty-state {
  background-color: var(--bg-btn-dark) !important;
  color: var(--text-dim) !important;
  cursor: not-allowed !important;
  opacity: 0.6;
}

.review-active-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100%;
}

.review-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 0;
}

.review-avatar {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  overflow: hidden;
  background-color: var(--bg-btn-dark);
  border: 1px solid var(--border-light);
  flex-shrink: 0;
}

.review-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.review-meta-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
  flex: 1;
}

.review-opponent {
  color: #ffffff;
  font-weight: 700;
  font-size: 0.88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.review-result-badge {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 3px;
  align-self: flex-start;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.review-result-badge.win {
  background-color: rgba(129, 182, 76, 0.25);
  color: var(--accent-green);
}

.review-result-badge.loss {
  background-color: rgba(250, 65, 45, 0.25);
  color: var(--accent-red);
}

.review-result-badge.draw {
  background-color: rgba(255, 255, 255, 0.15);
  color: var(--text-secondary);
}

/* Feature Rules Card */
.feature-rules-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 6px 2px;
}

.feature-rules-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.05rem;
  font-weight: 800;
  color: #ffffff;
}

.home-rules-bullets {
  padding-left: 18px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.home-rules-bullets li {
  margin-bottom: 6px;
}

/* Return Home tab button */
.tab-return-home {
  color: var(--accent-orange) !important;
}

.tab-return-home:hover {
  background-color: rgba(245, 158, 11, 0.15) !important;
}

/* Main Board + Sidebar Layout */
.chess-main {
  flex: 1;
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  padding: 10px 24px;
  gap: 24px;
  overflow-y: auto;
}

.chess-main.hidden {
  display: none !important;
}

/* Board Column */
.board-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: var(--board-size);
  flex-shrink: 0;
}

/* Player Bar Strip */
.chess-player-strip {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 8px;
  border-radius: 6px;
  margin: 3px 0;
  transition: all 0.2s ease;
}

.chess-player-strip.active-turn {
  background-color: rgba(255, 255, 255, 0.05);
}

.player-profile {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chess-avatar {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
}

.avatar-white {
  background: #ffffff;
  color: #1a1917;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.avatar-black {
  background: #21201d;
  color: #ffffff;
  border: 1px solid #4d4b47;
}

.player-meta {
  display: flex;
  flex-direction: column;
}

.player-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.player-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: #ffffff;
}

.player-rating {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
}

.player-flag {
  font-size: 0.88rem;
}

.captured-pieces {
  display: flex;
  align-items: center;
  gap: 2px;
  min-height: 14px;
  margin-top: 1px;
}

.mini-captured-piece {
  width: 14px;
  height: 14px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  opacity: 0.85;
}

.captured-diff {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-left: 4px;
}

/* Digital Clock */
.chess-clock {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 700;
  background-color: var(--bg-card);
  color: var(--text-secondary);
  padding: 5px 12px;
  border-radius: 5px;
  border: 1px solid var(--border-subtle);
  min-width: 80px;
  text-align: center;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.4);
  transition: all 0.2s;
}

.chess-player-strip.active-turn .chess-clock {
  background-color: #ffffff;
  color: #1a1917;
  border-color: #ffffff;
  font-weight: 800;
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.25);
}

.chess-clock.clock-hidden {
  display: none;
}

/* =========================================================
   Chessboard Viewport & Grid
   ========================================================= */
.board-viewport {
  position: relative;
  width: var(--board-size);
  height: var(--board-size);
  user-select: none;
  -webkit-user-select: none;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.65);
}

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

/* Square */
.square {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.square.light {
  background-color: var(--board-light);
}

.square.dark {
  background-color: var(--board-dark);
}

.square.last-move-highlight {
  background-color: var(--board-highlight) !important;
}

.square.selected-square {
  background-color: var(--board-selected) !important;
}

/* King in Check & Mated Square (Chess.com exact red radial glow) */
.square.in-check,
.square.mated-king {
  background: radial-gradient(circle at center, rgb(255, 30, 30) 0%, rgb(240, 20, 20) 45%, rgba(225, 20, 20, 0.75) 70%, rgba(210, 15, 15, 0.25) 90%, rgba(200, 10, 10, 0) 100%) !important;
  box-shadow: 0 0 24px 6px rgba(240, 25, 25, 0.75) !important;
  z-index: 4;
}

/* King End Status Badges (Chess.com Star for winner, Fallen King for loser) */
.king-end-badge {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.65), inset 0 1px 1px rgba(255, 255, 255, 0.4);
  animation: king-badge-pop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.king-end-badge.badge-winner {
  background: linear-gradient(135deg, #81b64c 0%, #5d8e30 100%);
}

.king-end-badge.badge-loser {
  background: linear-gradient(135deg, #fa412d 0%, #c62828 100%);
}

.king-end-badge svg {
  display: block;
}

@keyframes king-badge-pop {
  0% {
    opacity: 0;
    transform: scale(0) rotate(-35deg);
  }

  70% {
    opacity: 1;
    transform: scale(1.22) rotate(6deg);
  }

  100% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

/* Coordinates in Square Corner (Chess.com exact style) */
.coord {
  position: absolute;
  font-family: var(--font-sans);
  font-size: clamp(10px, 1.5vw, 12px);
  font-weight: 700;
  pointer-events: none;
  user-select: none;
  line-height: 1;
  z-index: 2;
}

.coord-file {
  bottom: 3px;
  right: 4px;
}

.coord-rank {
  top: 3px;
  left: 4px;
}

.square.light .coord {
  color: var(--board-dark);
}

.square.dark .coord {
  color: var(--board-light);
}

/* Legal Move Hints (Chess.com dot & capture ring) */
.move-hint-dot {
  position: absolute;
  width: 30%;
  height: 30%;
  background-color: rgba(0, 0, 0, 0.15);
  border-radius: 50%;
  pointer-events: none;
  z-index: 3;
}

.move-hint-capture {
  position: absolute;
  width: 90%;
  height: 90%;
  border-radius: 50%;
  box-shadow: inset 0 0 0 7px rgba(0, 0, 0, 0.16);
  pointer-events: none;
  z-index: 3;
}

/* Piece - 100% square coverage with Chess.com Neo assets */
.piece {
  width: 100%;
  height: 100%;
  background-size: 100% 100%;
  background-repeat: no-repeat;
  background-position: center;
  pointer-events: auto;
  cursor: grab;
  z-index: 5;
}

.piece.dragging {
  opacity: 0.2;
}

/* Floating drag avatar */
.floating-drag-piece {
  position: fixed;
  pointer-events: none;
  z-index: 1000;
  width: calc(var(--board-size) / 8 * 0.95);
  height: calc(var(--board-size) / 8 * 0.95);
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  transform: translate(-50%, -50%);
  cursor: grabbing;
}

/* In-board Floating Promotion Picker */
.promotion-picker {
  position: absolute;
  display: flex;
  flex-direction: column;
  background-color: #ffffff;
  border-radius: 4px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.75);
  z-index: 100;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.25);
}

.promotion-picker.hidden {
  display: none;
}

.promo-picker-piece {
  width: calc(var(--board-size) / 8);
  height: calc(var(--board-size) / 8);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background-color: #ffffff;
  transition: background-color 0.15s;
}

.promo-picker-piece:hover {
  background-color: #d1d1d1;
}

.promo-img {
  width: 80%;
  height: 80%;
}

/* =========================================================
   Right Sidebar Panel (Chess.com Play Panel)
   ========================================================= */
.sidebar-panel {
  width: 350px;
  background-color: var(--bg-panel);
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  height: calc(var(--board-size) + 68px);
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

/* Top Tabs */
.sidebar-tabs {
  display: flex;
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-subtle);
}

.sidebar-tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 9px 12px;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s;
  border-bottom: 2px solid transparent;
}

.sidebar-tab-btn:hover {
  color: var(--text-main);
  background-color: rgba(255, 255, 255, 0.03);
}

.sidebar-tab-btn.active {
  color: #ffffff;
  background-color: var(--bg-panel);
  border-bottom: 2px solid var(--accent-green);
}

.tab-content {
  display: none;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
}

.tab-content.active {
  display: flex;
}

/* Meta Badge: Double Move + Clock */
.game-meta-badge {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background-color: rgba(0, 0, 0, 0.25);
  border-bottom: 1px solid var(--border-subtle);
}

.meta-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.variant-tag {
  background-color: var(--accent-green-dark);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.time-control-pill {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.turn-indicator-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.turn-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--accent-green);
  box-shadow: 0 0 6px var(--accent-green);
}

/* Inline Alert Banner (NO POPUPS) */
.inline-alert-banner {
  margin: 10px 12px 0 12px;
  padding: 10px 12px;
  background-color: #1f1e1b;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: slideDown 0.2s ease-out;
}

.inline-alert-banner.hidden {
  display: none;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.inline-alert-banner.banner-game-over {
  border-color: var(--accent-green);
  background: linear-gradient(180deg, #2a2e22 0%, #1f2119 100%);
}

.inline-alert-banner.banner-game-over .alert-title {
  color: #c5f088;
  font-size: 1.1rem;
}

.alert-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: #ffffff;
}

.alert-sub {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.35;
}

.alert-actions {
  display: flex;
  gap: 8px;
  margin-top: 2px;
}

.alert-btn {
  flex: 1;
  padding: 6px 10px;
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: 5px;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.alert-btn-primary {
  background-color: var(--accent-green);
  color: #ffffff;
}

.alert-btn-primary:hover {
  background-color: var(--accent-green-hover);
}

.alert-btn-secondary {
  background-color: var(--bg-hover);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.alert-btn-secondary:hover {
  background-color: #4a4742;
  color: #ffffff;
}

.alert-btn-danger {
  background-color: var(--accent-red);
  color: #ffffff;
}

.alert-btn-danger:hover {
  background-color: var(--accent-red-hover);
}

/* Move History Table */
.history-table-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin: 10px 12px;
  background-color: var(--bg-card);
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
}

.history-table-header {
  display: grid;
  grid-template-columns: 42px 1fr 1fr;
  padding: 6px 10px;
  background-color: rgba(0, 0, 0, 0.3);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  border-bottom: 1px solid var(--border-subtle);
}

.history-table-body {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.history-empty {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.82rem;
  padding: 24px 10px;
  font-style: italic;
}

.history-row {
  display: grid;
  grid-template-columns: 42px 1fr 1fr;
  padding: 4px 10px;
  font-size: 0.85rem;
  align-items: center;
}

.history-row:nth-child(even) {
  background-color: rgba(255, 255, 255, 0.02);
}

.col-num {
  font-weight: 700;
  color: var(--text-muted);
}

.col-moves-group {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.san-move-pill {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.san-move-pill:hover {
  background-color: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.san-move-pill.active-view-move {
  background-color: #48532f !important;
  color: #c5f088 !important;
  font-weight: 800;
  box-shadow: 0 0 0 1px rgba(129, 182, 76, 0.45);
}

.san-move-pill.latest-move:not(.active-view-move) {
  background-color: rgba(129, 182, 76, 0.2);
  color: #c5f088;
}

/* History Navigation Toolbar */
.history-nav-toolbar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background-color: var(--bg-panel);
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
}

.history-nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 28px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.history-nav-btn:hover:not(:disabled) {
  background-color: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.25);
}

.history-nav-btn:active:not(:disabled) {
  transform: scale(0.96);
}

.history-nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.history-nav-btn svg {
  display: block;
}

/* Badge in turn indicator for jumping back to live game */
.badge-live-return {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  padding: 2px 8px;
  background-color: var(--accent-green);
  color: #ffffff;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s ease;
  vertical-align: middle;
}

.badge-live-return:hover {
  background-color: var(--accent-green-hover);
}

/* Bottom Action Toolbar */
.action-toolbar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 8px 10px;
  background-color: var(--bg-card);
  border-top: 1px solid var(--border-subtle);
}

.toolbar-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background-color: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  color: var(--text-secondary);
  padding: 7px 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.toolbar-btn:hover:not(:disabled) {
  background-color: var(--bg-hover);
  color: #ffffff;
  border-color: var(--border-light);
}

.toolbar-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.toolbar-icon {
  font-size: 1.05rem;
  line-height: 1;
}

.toolbar-text {
  font-size: 0.7rem;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
}

.btn-danger-action:hover:not(:disabled) {
  background-color: rgba(250, 65, 45, 0.2);
  border-color: var(--accent-red);
  color: #ff7b6b;
}

/* Settings Tab Content */
.settings-box {
  padding: 12px;
  background-color: var(--bg-card);
  margin: 10px 12px 0 12px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
}

.settings-heading {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.clock-toggle-row {
  display: flex;
  border-radius: 5px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}

.toggle-pill {
  flex: 1;
  padding: 7px 10px;
  font-size: 0.8rem;
  font-weight: 700;
  background-color: var(--bg-panel);
  color: var(--text-muted);
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}

.toggle-pill.selected {
  background-color: var(--accent-green);
  color: #ffffff;
}

.rules-box {
  margin-top: 10px;
  background-color: rgba(0, 0, 0, 0.15);
}

.rules-list {
  padding-left: 16px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.rules-list li {
  margin-bottom: 4px;
}

/* =========================================================
   Responsive Design
   ========================================================= */
@media (max-width: 960px) {
  .chess-layout {
    flex-direction: column;
    height: 100vh;
    overflow-y: auto;
  }

  .chess-nav {
    width: 100%;
    height: 48px;
    flex-direction: row;
    align-items: center;
    padding: 4px 12px;
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
  }

  .nav-menu {
    flex-direction: row;
    gap: 6px;
  }

  .nav-label,
  .nav-item-trial,
  .nav-bottom {
    display: none;
  }

  .chess-top-header {
    display: none;
  }

  .chess-main {
    flex-direction: column;
    padding: 10px;
    gap: 14px;
    height: auto;
  }

  .sidebar-panel {
    width: var(--board-size);
    height: 360px;
  }
}

/* =========================================================
   Bot Selection Modal & Bot Cards
   ========================================================= */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.75);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  backdrop-filter: blur(4px);
}

.modal-backdrop.hidden {
  display: none !important;
}

.bot-modal-content {
  background-color: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  width: 90%;
  max-width: 580px;
  padding: 24px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
  animation: modalPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPop {
  from {
    opacity: 0;
    transform: scale(0.92);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.bot-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.bot-modal-title {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text-main);
}

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

.modal-close-btn:hover {
  color: var(--text-main);
}

.bot-cards-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 260px;
  overflow-y: auto;
  padding-right: 4px;
  margin-bottom: 18px;
}

.bot-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  background-color: var(--bg-panel);
  border: 2px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.bot-card:hover {
  background-color: #312e2b;
  transform: translateX(2px);
}

.bot-card.active {
  border-color: var(--accent-green);
  background-color: #272d21;
}

.bot-card-avatar {
  width: 46px;
  height: 46px;
  border-radius: 8px;
  flex-shrink: 0;
}

.bot-card-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.bot-card-name {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-main);
}

.bot-elo {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-left: 4px;
}

.bot-card-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.3;
}

.bot-modal-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
}

.modal-opt-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-opt-label {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.color-picker-row {
  display: flex;
  gap: 6px;
}

.color-btn {
  background-color: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 6px 12px;
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}

.color-btn:hover {
  background-color: #363431;
}

.color-btn.active {
  background-color: #3b4231;
  border-color: var(--accent-green);
  color: #fff;
}

.bot-time-pills {
  display: flex;
  gap: 6px;
}

.bot-time-pill {
  background-color: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 6px 10px;
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.bot-time-pill:hover {
  background-color: #363431;
}

.bot-time-pill.active {
  background-color: #3b4231;
  border-color: var(--accent-green);
  color: #fff;
}

.btn-start-bot-match {
  width: 100%;
  padding: 13px;
  background-color: var(--accent-green);
  color: #fff;
  font-size: 1.05rem;
  font-weight: 800;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 4px 0 #588a2b;
  transition: all 0.1s;
}

.btn-start-bot-match:hover {
  background-color: #92cd59;
}

.btn-start-bot-match:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #588a2b;
}

/* =========================================================
   Bot In-Game Indicator & Thinking Animation
   ========================================================= */
.avatar-bot-img {
  width: 100%;
  height: 100%;
  border-radius: 6px;
  object-fit: cover;
}

.thinking-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
  padding: 2px 8px;
  background-color: rgba(129, 182, 76, 0.2);
  border: 1px solid var(--accent-green);
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent-green);
  animation: pulse 1.5s infinite;
}

.thinking-chip.hidden {
  display: none !important;
}

.thinking-spinner {
  width: 8px;
  height: 8px;
  border: 2px solid var(--accent-green);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.6;
  }
}

/* =========================================================
   Evaluation Bar & Arrows Overlay
   ========================================================= */
.eval-bar-wrapper {
  position: absolute;
  left: -28px;
  top: 0;
  width: 20px;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 10;
}

.eval-bar-wrapper.hidden {
  display: none !important;
}

.eval-bar-track {
  width: 100%;
  height: 100%;
  background-color: #262421;
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  flex-direction: column-reverse;
  border: 1px solid var(--border-light);
}

.eval-bar-fill {
  width: 100%;
  height: 50%;
  background-color: #ffffff;
  transition: height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.eval-bar-score {
  position: absolute;
  top: 4px;
  font-size: 0.65rem;
  font-weight: 800;
  color: #222;
  pointer-events: none;
}

.board-arrows-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 25;
}

/* =========================================================
   Review Tab & Analysis Interface
   ========================================================= */
.review-header-card {
  padding: 12px;
  background-color: rgba(0, 0, 0, 0.25);
  border-bottom: 1px solid var(--border-subtle);
}

.review-accuracies {
  display: flex;
  justify-content: space-around;
  align-items: center;
}

.acc-box {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.acc-val {
  font-size: 1.4rem;
  font-weight: 900;
}

.acc-white .acc-val {
  color: #f0f0f0;
}

.acc-black .acc-val {
  color: #797672;
}

.acc-lbl {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}

.acc-divider {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--text-muted);
}

.review-stats-summary {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.stats-table {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.78rem;
}

.stats-row {
  display: flex;
  justify-content: space-between;
  padding: 2px 4px;
}

.stats-head {
  font-weight: 800;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 4px;
}

.stat-count {
  font-weight: 700;
  width: 32px;
  text-align: right;
  color: var(--text-secondary);
}

.eval-graph-card {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.eval-graph-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.eval-current-score {
  color: var(--text-main);
  font-weight: 800;
}

.eval-graph-svg-wrapper {
  background-color: #1a1917;
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  overflow: hidden;
  height: 60px;
}

.eval-graph-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.review-moves-container {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}

.review-move-item {
  display: flex;
  align-items: center;
  padding: 6px 12px;
  font-size: 0.82rem;
  cursor: pointer;
  border-radius: 4px;
  margin: 0 4px;
  transition: background-color 0.1s;
}

.review-move-item:hover {
  background-color: #312e2b;
}

.review-move-item.active {
  background-color: #3e4434;
  font-weight: 800;
}

.rm-num {
  width: 28px;
  color: var(--text-muted);
}

.rm-san {
  flex: 1;
  font-weight: 700;
}

.rm-badge {
  font-size: 0.85rem;
  margin-right: 8px;
}

.rm-eval {
  font-size: 0.75rem;
  color: var(--text-secondary);
  width: 38px;
  text-align: right;
}

.review-toolbar {
  display: flex;
  gap: 8px;
  padding: 8px 12px;
  background-color: var(--bg-panel);
  border-top: 1px solid var(--border-subtle);
}

.review-tool-btn {
  flex: 1;
  padding: 6px 10px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}

.review-tool-btn:hover {
  background-color: #383531;
  color: var(--text-main);
}

/* =========================================================
   Full Page Views (NO MODALS / NO POPUPS - 100% Page Layout)
   ========================================================= */
.chess-page-view {
  display: flex;
  flex-direction: column;
  padding: 24px 32px;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  min-height: calc(100vh - 80px);
  animation: fadeInPageView 0.22s ease-out;
}

.chess-page-view.hidden {
  display: none !important;
}

@keyframes fadeInPageView {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.page-top-bar {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.btn-page-back {
  background-color: var(--bg-card);
  border: 1px solid var(--border-light);
  color: var(--text-main);
  font-size: 0.9rem;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s ease;
}

.btn-page-back:hover {
  background-color: #363431;
  border-color: var(--text-secondary);
  transform: translateX(-3px);
}

.page-header-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.page-main-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-main);
  margin: 0;
}

.page-subtitle {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin: 0;
}

/* Bots Page 2-column Layout */
.bots-page-layout {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 28px;
  align-items: start;
}

@media (max-width: 900px) {
  .bots-page-layout {
    grid-template-columns: 1fr;
  }
}

.bots-roster-column {
  background-color: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 20px;
}

.roster-section-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 14px;
}

.bots-config-column {
  background-color: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.selected-bot-hero-card {
  display: flex;
  align-items: center;
  gap: 18px;
  background-color: var(--bg-panel);
  border: 2px solid var(--accent-green);
  border-radius: 10px;
  padding: 16px;
}

.hero-avatar-wrap {
  width: 72px;
  height: 72px;
  border-radius: 10px;
  overflow: hidden;
  flex-shrink: 0;
  background-color: #1f1e1b;
}

.hero-bot-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-bot-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hero-bot-name-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hero-bot-name {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
}

.hero-bot-elo {
  background-color: var(--accent-green-dark);
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
}

.hero-bot-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.35;
  margin: 0;
}

.bot-page-options {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px 0;
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
}

.page-opt-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.page-opt-label {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-secondary);
}

/* Feature Page Cards (Puzzles, Training, Watch, Community) */
.feature-page-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 600px;
}

.puzzle-hero-header {
  display: flex;
  gap: 24px;
  align-items: center;
}

.puzzle-hero-rating,
.puzzle-hero-streak {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.puzzle-rating-val {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text-main);
}

.puzzle-rating-lbl,
.streak-lbl {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.puzzle-desc-box {
  background-color: var(--bg-panel);
  border-radius: 8px;
  padding: 16px;
}

.puzzle-desc-box h3 {
  font-size: 1.1rem;
  color: var(--text-main);
  margin-bottom: 6px;
}

.puzzle-desc-box p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.4;
  margin: 0;
}

.lesson-cards-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.lesson-course-card {
  display: flex;
  align-items: center;
  gap: 20px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 20px;
}

.lesson-card-icon {
  font-size: 2.2rem;
  background-color: var(--bg-panel);
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  flex-shrink: 0;
}

.lesson-card-body {
  flex: 1;
}

.lesson-card-body h3 {
  font-size: 1.05rem;
  color: var(--text-main);
  margin-bottom: 4px;
}

.lesson-card-body p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.35;
}

.lesson-start-btn {
  padding: 8px 16px;
  background-color: var(--accent-green);
  color: #ffffff;
  border: none;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.lesson-start-btn:hover {
  background-color: #6da339;
}

.stream-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background-color: #7d1c1c;
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 4px;
  width: fit-content;
}