/* ============================================
   Chess Coach — Dark Theme Stylesheet
   ============================================ */

:root {
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-tertiary: #1c2333;
  --bg-hover: #21262d;
  --border: #30363d;
  --border-light: #3d444d;

  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --text-muted: #656d76;

  --accent: #d4a843;
  --accent-hover: #e0b84e;
  --accent-dim: rgba(212, 168, 67, 0.15);

  --win: #3fb950;
  --loss: #f85149;
  --draw: #8b949e;

  --board-light: #e8dcc8;
  --board-dark: #7d945d;
  --board-hl-light: #f6f683;
  --board-hl-dark: #bbcc44;

  --radius: 8px;
  --radius-sm: 4px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'SF Mono', SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace;
}

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; -webkit-font-smoothing: antialiased; }

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

img { max-width: 100%; display: block; }

/* ---- Typography ---- */
h1 { font-size: 2.5rem; font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: 1.5rem; font-weight: 600; }
h3 { font-size: 1.125rem; font-weight: 600; }

/* ---- Utility ---- */
.hidden { display: none !important; }

/* ---- Navbar ---- */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: rgba(13, 17, 23, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  z-index: 100;
  gap: 1.5rem;
}

.nav-home {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, #6C63FF, #FF6584);
  color: white;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-decoration: none;
  flex-shrink: 0;
  transition: transform 0.2s, box-shadow 0.2s;
}
.nav-home:hover {
  transform: scale(1.1);
  box-shadow: 0 2px 12px rgba(108, 99, 255, 0.4);
  color: white;
}

.nav-brand {
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--accent);
  white-space: nowrap;
  cursor: pointer;
}

.nav-tabs {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-tabs::-webkit-scrollbar { display: none; }

.nav-tab {
  padding: 0.375rem 0.625rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.nav-tab:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-tab.active { background: var(--accent-dim); color: var(--accent); }

.nav-tab-sep {
  width: 1px;
  background: var(--border);
  margin: 6px 4px;
  flex-shrink: 0;
}

.nav-tab-accent {
  color: #d4a843;
  font-weight: 600;
}
.nav-tab-accent.active {
  background: rgba(212, 168, 67, 0.12);
  color: #d4a843;
}

.nav-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.nav-player {
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: nowrap;
}
.nav-player img {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-block;
  vertical-align: middle;
  margin-right: 0.25rem;
}

/* ---- Auth ---- */
.nav-auth {
  display: flex;
  align-items: center;
}

.nav-icon-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #656d76;
  font-size: 0.8rem;
  font-weight: 700;
  background: transparent;
  border: 1px solid transparent;
  transition: all 0.15s;
  flex-shrink: 0;
  text-decoration: none;
}
.nav-icon-btn:hover { color: #e6edf3; background: rgba(255,255,255,0.08); border-color: var(--border); }
.nav-icon-btn.active { color: #d4a843; background: rgba(212,168,67,0.1); border-color: rgba(212,168,67,0.3); }
.auth-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.auth-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}
.auth-name {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.auth-logout-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.auth-signin-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  white-space: nowrap;
}
.auth-signin-btn:hover {
  border-color: var(--text-muted);
  background: var(--bg-secondary);
}
.auth-signin-btn svg { flex-shrink: 0; }
.auth-logout-btn:hover, .auth-account-btn:hover {
  color: var(--text-primary);
  border-color: var(--text-muted);
}
.auth-account-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

/* Account Panel */
.account-panel {
  position: fixed;
  top: 56px;
  right: 1rem;
  width: 320px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md, 8px);
  padding: 1rem;
  z-index: 1000;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.account-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}
.account-panel-header h3 { margin: 0; font-size: 0.9375rem; }
.account-panel-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  cursor: pointer;
  line-height: 1;
}
.account-link-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0;
  border-top: 1px solid var(--border);
}
.account-platform {
  font-size: 0.8125rem;
  font-weight: 600;
  min-width: 70px;
}
.account-username {
  font-size: 0.8125rem;
  color: var(--accent);
  flex: 1;
}
.account-input {
  flex: 1;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.5rem;
  font-size: 0.8125rem;
}
/* Session Summary Banner */
.session-summary {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md, 8px);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.session-summary-text {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.account-link-btn, .account-unlink-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
}
.account-link-btn:hover { color: var(--accent); border-color: var(--accent); }
.account-unlink-btn:hover { color: var(--loss); border-color: var(--loss); }

/* Cache Status (dashboard) */
.cache-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8125rem;
  color: var(--text-muted);
  padding: 0.625rem 0.875rem;
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  margin-bottom: 1.25rem;
}
.cache-status-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.cache-status-info svg { opacity: 0.5; flex-shrink: 0; }
.cache-status-stats {
  display: flex;
  gap: 1rem;
}
.cache-stat {
  display: flex;
  align-items: baseline;
  gap: 0.25rem;
}
.cache-stat-value {
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.875rem;
}
.cache-stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.cache-hit-rate {
  font-size: 0.75rem;
  color: var(--accent);
  opacity: 0.8;
}
.cache-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.cache-action-link, .cache-clear-link {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.75rem;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 2px;
  padding: 0;
}
.cache-action-link:hover { color: var(--accent); text-decoration-style: solid; }
.cache-clear-link:hover { color: var(--loss); text-decoration-style: solid; }

.eco-badge {
  display: inline-block;
  background: var(--bg-tertiary);
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.1rem 0.35rem;
  border-radius: var(--radius-sm);
  vertical-align: middle;
  margin-right: 0.25rem;
  letter-spacing: 0.03em;
}

/* ---- Main ---- */
main {
  padding-top: 56px;
  min-height: 100vh;
}

.view {
  display: none;
  padding: 2rem 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
}
.view.active { display: block; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--accent);
  color: #0d1117;
}
.btn-primary:hover { background: var(--accent-hover); }

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.btn-outline:hover { border-color: var(--border-light); color: var(--text-primary); }

.btn-small { padding: 0.375rem 0.75rem; font-size: 0.8125rem; }

.btn-full { width: 100%; justify-content: center; }

/* ---- Inputs ---- */
.search-input {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
}
.search-input:focus { border-color: var(--accent); }
.search-input::placeholder { color: var(--text-muted); }

.filter-select {
  padding: 0.375rem 0.625rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 0.8125rem;
  outline: none;
  cursor: pointer;
}
.filter-select:focus { border-color: var(--accent); }

/* ---- Loading ---- */
.loading-spinner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
  padding: 1rem 0;
}
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Error ---- */
.error-msg {
  color: var(--loss);
  font-size: 0.875rem;
  padding: 0.5rem 0;
}

/* ============================================
   Search / Hero View
   ============================================ */
.hero {
  text-align: center;
  padding: 4rem 0 3rem;
  max-width: 600px;
  margin: 0 auto;
}
.hero-icon { margin-bottom: 1.5rem; opacity: 0.85; }
.hero h1 { margin-bottom: 0.75rem; }
.hero-subtitle {
  color: var(--text-secondary);
  font-size: 1.125rem;
  margin-bottom: 2rem;
}

.search-container {
  display: flex;
  gap: 0.5rem;
  max-width: 420px;
  margin: 0 auto;
}
.search-container .search-input { flex: 1; }

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
  max-width: 900px;
  margin: 0 auto;
  padding-top: 1rem;
}

.feature-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}
.feature-icon {
  color: var(--accent);
  margin-bottom: 0.75rem;
}
.feature-card h3 { margin-bottom: 0.5rem; }
.feature-card p { color: var(--text-secondary); font-size: 0.875rem; line-height: 1.6; }

/* ============================================
   Dashboard View
   ============================================ */
.dashboard-header {
  margin-bottom: 1.5rem;
}

.player-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.player-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  flex-shrink: 0;
}

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

.player-name-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.player-name-row h2 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.title-badge {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 700;
  background: #d4a843;
  color: #1a1200;
  flex-shrink: 0;
}

.player-meta {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}
.meta-sep { margin: 0 0.375rem; }

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
}
.stat-card .stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.375rem;
}
.stat-card .stat-rating {
  font-size: 1.75rem;
  font-weight: 700;
}
.stat-card .stat-peak {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 0.125rem;
}
.stat-card .stat-record {
  font-size: 0.8125rem;
  margin-top: 0.5rem;
  display: flex;
  gap: 0.75rem;
}
.stat-record .win { color: var(--win); }
.stat-record .loss { color: var(--loss); }
.stat-record .draw { color: var(--draw); }

.stat-winrate-bar {
  height: 4px;
  border-radius: 2px;
  margin-top: 0.5rem;
  display: flex;
  overflow: hidden;
  background: var(--bg-tertiary);
}
.stat-winrate-bar .wr-win { background: var(--win); }
.stat-winrate-bar .wr-draw { background: var(--draw); }
.stat-winrate-bar .wr-loss { background: var(--loss); }

/* Coaching */
.coaching-section { margin-bottom: 1.5rem; }
.coaching-section h3 { margin-bottom: 0.75rem; }
.coaching-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.coach-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  border-left: 3px solid var(--border);
}
.coach-card-high { border-left-color: #f85149; }
.coach-card-medium { border-left-color: #d4a843; }
.coach-card-low { border-left-color: #8b949e; }
.coach-card-positive { border-left-color: #3fb950; }
.coach-card-info { border-left-color: #58a6ff; }

.coach-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.coach-card-type {
  font-size: 0.65rem;
  color: #656d76;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.coach-card-prio {
  font-size: 0.6rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 3px;
  letter-spacing: 0.05em;
}
.coach-prio-high { background: rgba(248,81,73,0.15); color: #f85149; }
.coach-prio-medium { background: rgba(212,168,67,0.15); color: #d4a843; }
.coach-prio-low { background: rgba(139,148,158,0.15); color: #8b949e; }
.coach-prio-positive { background: rgba(63,185,80,0.15); color: #3fb950; }
.coach-prio-info { background: rgba(88,166,255,0.15); color: #58a6ff; }

.coach-card-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #e6edf3;
  margin-bottom: 4px;
}
.coach-card-detail {
  font-size: 0.8rem;
  color: #8b949e;
  margin-bottom: 8px;
  font-family: var(--font-mono);
}
.coach-card-advice {
  font-size: 0.8rem;
  color: #b1bac4;
  line-height: 1.4;
  font-style: italic;
}
.coach-action-btn {
  display: inline-block;
  margin-top: 10px;
  padding: 6px 14px;
  background: rgba(212, 168, 67, 0.1);
  border: 1px solid rgba(212, 168, 67, 0.3);
  color: #d4a843;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.coach-action-btn:hover {
  background: rgba(212, 168, 67, 0.2);
  border-color: #d4a843;
}
.coach-card-positive .coach-action-btn {
  background: rgba(63, 185, 80, 0.1);
  border-color: rgba(63, 185, 80, 0.3);
  color: #3fb950;
}
.coach-card-positive .coach-action-btn:hover {
  background: rgba(63, 185, 80, 0.2);
  border-color: #3fb950;
}

/* Chart */
.chart-container {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}
.chart-container h3 { margin-bottom: 1rem; }
.chart-canvas-wrap { position: relative; height: 250px; }

/* Section Header */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.filters { display: flex; gap: 0.5rem; }

/* Games List */
.games-list {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.game-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.game-row:hover {
  background: var(--bg-tertiary);
  border-color: var(--border-light);
}

.game-result-badge {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8125rem;
  flex-shrink: 0;
}
.game-result-badge.win { background: rgba(63,185,80,0.15); color: var(--win); }
.game-result-badge.loss { background: rgba(248,81,73,0.15); color: var(--loss); }
.game-result-badge.draw { background: rgba(139,148,158,0.1); color: var(--draw); }

.game-main { flex: 1; min-width: 0; }

.game-players {
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.game-players .you { color: var(--text-primary); }
.game-players .opponent { color: var(--text-secondary); }
.game-players .rating { color: var(--text-muted); font-weight: 400; }
.game-players .vs { color: var(--text-muted); margin: 0 0.375rem; }
.game-players .color-indicator {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-right: 0.375rem;
  vertical-align: middle;
}
.game-players .color-indicator.white { background: #eee; border: 1px solid #999; }
.game-players .color-indicator.black { background: #333; border: 1px solid #666; }

.game-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.125rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.game-meta .sep { color: var(--border); }

.game-time-badge {
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.125rem 0.5rem;
  border-radius: 10px;
  text-transform: uppercase;
  flex-shrink: 0;
}
.game-time-badge.rapid { background: rgba(63,185,80,0.12); color: #3fb950; }
.game-time-badge.blitz { background: rgba(210,153,34,0.12); color: #d29922; }
.game-time-badge.bullet { background: rgba(248,81,73,0.12); color: #f85149; }
.game-time-badge.daily { background: rgba(139,148,158,0.1); color: #8b949e; }

.game-analyzed-badge {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  flex-shrink: 0;
}
.indicator-check {
  color: var(--win);
  font-size: 0.875rem;
  font-weight: 700;
}
.indicator-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.blunder-dot {
  background: var(--loss);
}

.load-more {
  width: 100%;
  margin-top: 0.75rem;
  justify-content: center;
}

/* Batch Analysis */
.batch-progress {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
}
.batch-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
}
.batch-detail {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.375rem;
}

/* ============================================
   Analysis View
   ============================================ */
.back-btn {
  margin-bottom: 1rem;
}

.analysis-layout {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1.5rem;
  align-items: start;
}

.board-panel {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.player-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0;
  font-size: 0.875rem;
  min-height: 28px;
}
.player-bar .bar-name { font-weight: 600; }
.player-bar .bar-rating { color: var(--text-muted); font-size: 0.8125rem; }
.player-bar .bar-clock {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-secondary);
  transition: color 0.2s;
}
.player-bar .bar-clock.clock-warning { color: #d29922; }
.player-bar .bar-clock.clock-danger { color: var(--loss); font-weight: 700; }

.board-wrapper {
  display: flex;
  gap: 6px;
}

/* Eval Bar */
.eval-bar {
  width: 24px;
  border-radius: var(--radius-sm);
  background: #333;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}
.eval-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: #e8e8e8;
  transition: height 0.3s ease;
}
.eval-label {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) rotate(-90deg);
  font-size: 0.625rem;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
  pointer-events: none;
}

/* Chess Board */
.chess-board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  width: 480px;
  height: 480px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
}

.square {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}
.square.light { background: var(--board-light); }
.square.dark { background: var(--board-dark); }
.square.light.highlight { background: var(--board-hl-light); }
.square.dark.highlight { background: var(--board-hl-dark); }

.piece {
  font-size: 3.25rem;
  line-height: 1;
  cursor: default;
}
.piece.white-piece {
  color: #c8b58a;
  text-shadow:
    -1px -1px 0 #4a4540,
     1px -1px 0 #4a4540,
    -1px  1px 0 #4a4540,
     1px  1px 0 #4a4540,
     0    2px 3px rgba(0,0,0,0.25);
}
.piece.black-piece {
  color: #3a3428;
  text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.coord {
  position: absolute;
  font-size: 0.625rem;
  font-weight: 700;
  pointer-events: none;
  line-height: 1;
}
.coord.rank-label {
  top: 2px;
  left: 3px;
}
.coord.file-label {
  bottom: 2px;
  right: 3px;
}
.square.light .coord { color: var(--board-dark); }
.square.dark .coord { color: var(--board-light); }

/* Board Controls */
.board-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.25rem 0;
}

.ctrl-group {
  display: flex;
  gap: 0.25rem;
}

.ctrl-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.ctrl-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}
.ctrl-btn.active {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: var(--accent);
}

/* Analysis Sidebar */
.analysis-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}

.game-info-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  font-size: 0.8125rem;
  line-height: 1.7;
}
.game-info-card .info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.game-info-card .info-label { color: var(--text-muted); }
.game-info-card .info-value { color: var(--text-primary); font-weight: 500; }
.game-info-card .info-result {
  font-weight: 700;
  padding: 0.125rem 0.5rem;
  border-radius: var(--radius-sm);
}
.game-info-card .info-result.win { background: rgba(63,185,80,0.15); color: var(--win); }
.game-info-card .info-result.loss { background: rgba(248,81,73,0.15); color: var(--loss); }
.game-info-card .info-result.draw { background: rgba(139,148,158,0.1); color: var(--draw); }

/* Move List */
.move-list-container {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-height: 400px;
  overflow-y: auto;
}

.move-list {
  padding: 0.5rem;
}

.move-row {
  display: flex;
  align-items: center;
  padding: 0;
  min-height: 28px;
}

.move-number {
  width: 36px;
  text-align: right;
  padding-right: 8px;
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-family: var(--font-mono);
  flex-shrink: 0;
}

.move {
  padding: 2px 6px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  cursor: pointer;
  transition: background 0.1s;
  width: 70px;
}
.move:hover { background: var(--bg-hover); }
.move.current {
  background: var(--accent);
  color: #0d1117;
  font-weight: 600;
}

.move.blunder { color: var(--loss); }
.move.mistake { color: #e09040; }
.move.inaccuracy { color: #d4a843; }
.move.good { color: var(--text-primary); }
.move.brilliant { color: #56b4e9; }

/* Engine Section */
.engine-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}

.engine-output {
  margin-top: 0.75rem;
  padding: 0.75rem;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.6;
}
.engine-output .engine-line {
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
}
.engine-output .engine-eval {
  font-weight: 700;
  min-width: 48px;
}
.engine-output .engine-moves {
  color: var(--text-secondary);
}

/* Move Explanation */
.explanation-container {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
}
.explanation-text {
  font-size: 0.8125rem;
  line-height: 1.6;
  color: var(--text-secondary);
}
.expl-badge {
  display: inline-block;
  padding: 0.0625rem 0.375rem;
  border-radius: var(--radius-sm);
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  vertical-align: middle;
  margin-right: 0.25rem;
}
.expl-badge.blunder { background: rgba(248,81,73,0.15); color: var(--loss); }
.expl-badge.mistake { background: rgba(224,144,64,0.15); color: #e09040; }
.fb-explain {
  font-style: italic;
  margin-top: 0.375rem;
  color: var(--text-secondary);
}
.fb-eval {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: #8b949e;
  margin-top: 0.25rem;
}
.fb-next-btn {
  display: inline-block;
  margin-top: 0.75rem;
  padding: 8px 20px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #e6edf3;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.fb-next-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}
.fb-toggle-row {
  display: flex;
  gap: 6px;
  margin-top: 0.75rem;
}
.fb-toggle-btn {
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #8b949e;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.fb-toggle-btn:hover { background: rgba(255, 255, 255, 0.1); }
.fb-toggle-active {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.3);
  color: #e6edf3;
}

/* Candidate Moves */
.candidates-container {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
}
.candidates-container h4 {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}
.candidates-list {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}
.candidate-line {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 0.8125rem;
  font-family: var(--font-mono);
  padding: 0.25rem 0.375rem;
  border-radius: var(--radius-sm);
}
.candidate-line:first-child {
  background: var(--accent-dim);
}
.candidate-line .cand-rank {
  color: var(--text-muted);
  font-size: 0.6875rem;
  width: 1.25rem;
  flex-shrink: 0;
}
.candidate-line .cand-eval {
  font-weight: 700;
  min-width: 3rem;
  flex-shrink: 0;
}
.candidate-line .cand-move {
  font-weight: 600;
  color: var(--text-primary);
  min-width: 3rem;
  flex-shrink: 0;
}
.candidate-line .cand-pv {
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Clickable PV moves */
.pv-move {
  cursor: pointer;
  border-radius: 2px;
  padding: 0 2px;
  transition: background 0.1s, color 0.1s;
}
.pv-move:hover {
  background: var(--accent-dim);
  color: var(--accent);
}
.pv-move.pv-active {
  background: var(--accent);
  color: #0d1117;
  font-weight: 600;
}

/* Board preview mode */
.chess-board.preview-mode {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  opacity: 0.92;
}

/* Eval Graph */
.eval-graph-container {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
}
.eval-graph-container h4 {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}
.eval-graph-container canvas {
  max-height: 120px;
}

/* Phase Stats */
.phase-stats {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}
.phase-card {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.625rem;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  flex: 1;
  min-width: 100px;
}
.phase-indicator {
  width: 4px;
  height: 28px;
  border-radius: 2px;
  flex-shrink: 0;
}
.phase-info { flex: 1; min-width: 0; }
.phase-name { font-size: 0.75rem; font-weight: 600; }
.phase-range { font-size: 0.625rem; color: var(--text-muted); }
.phase-acpl { font-size: 1.125rem; font-weight: 700; }
.phase-acpl-label { font-size: 0.5625rem; color: var(--text-muted); text-transform: uppercase; }
.phase-acpl-good { color: var(--win); }
.phase-acpl-ok { color: var(--accent); }
.phase-acpl-bad { color: var(--loss); }

.analysis-progress {
  margin-top: 0.75rem;
}
.progress-bar {
  height: 4px;
  background: var(--bg-tertiary);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 0.375rem;
}
.progress-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.3s;
  width: 0%;
}

/* ============================================
   Report View
   ============================================ */
.report-section { margin-bottom: 1.5rem; }
.report-section h3 { margin-bottom: 0.75rem; }

.report-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
}
.report-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}
.rc-title {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}
.rc-value { font-size: 1.5rem; font-weight: 700; }
.rc-sub { font-size: 0.75rem; color: var(--text-secondary); margin-top: 0.25rem; }

.mini-bar {
  display: flex;
  height: 4px;
  border-radius: 2px;
  overflow: hidden;
  margin-top: 0.375rem;
  background: var(--bg-tertiary);
}
.mb-w { background: var(--win); }
.mb-d { background: var(--draw); }
.mb-l { background: var(--loss); }

.report-table-wrap { overflow-x: auto; }
.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}
.report-table th {
  text-align: left;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
}
.report-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
}
.report-table tr:hover td { background: var(--bg-secondary); }
.report-table .win { color: var(--win); }
.report-table .loss { color: var(--loss); }
.report-wld { color: var(--text-secondary); }

/* Opening Tree */
.opening-tree { font-size: 0.8125rem; }
.otree-node {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0;
}
.otree-move {
  font-family: var(--font-mono);
  font-weight: 600;
  min-width: 4.5rem;
}
.otree-count {
  color: var(--text-muted);
  font-size: 0.75rem;
  min-width: 4rem;
}
.otree-wr {
  font-weight: 600;
  min-width: 2.5rem;
  text-align: right;
}
.otree-bar {
  display: flex;
  height: 4px;
  width: 60px;
  border-radius: 2px;
  overflow: hidden;
  background: var(--bg-tertiary);
}

.insights-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.insight-col {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}
.insight-col h4 { margin-bottom: 0.5rem; font-size: 0.875rem; }
.insight-good { color: var(--win); }
.insight-bad { color: var(--loss); }
.insight-col ul {
  list-style: none;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.8;
}
.insight-col li::before { content: "\2022 "; color: var(--text-muted); margin-right: 0.25rem; }

/* Error Patterns */
.error-patterns {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.ep-row {
  display: grid;
  grid-template-columns: 160px 1fr 1fr;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.8125rem;
}
.ep-label {
  font-weight: 600;
  color: var(--text-primary);
}
.ep-stats {
  color: var(--text-secondary);
  font-size: 0.75rem;
  text-align: right;
}
.ep-bar-track {
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: 4px;
  overflow: hidden;
}
.ep-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
}
.ep-tactical    { background: var(--loss); }
.ep-positional  { background: #6e7ff3; }
.ep-opening     { background: var(--accent); }
.ep-endgame     { background: #8b5cf6; }

@media (max-width: 768px) {
  .ep-row {
    grid-template-columns: 1fr auto;
    gap: 0.25rem;
  }
  .ep-bar-track {
    grid-column: 1 / -1;
  }
}

/* Benchmark Comparison */
.benchmark-comparison {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}
.bench-row {
  display: grid;
  grid-template-columns: 140px 1fr 1fr 1fr;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.8125rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
}
.bench-label {
  font-weight: 600;
  color: var(--text-primary);
}
.bench-player {
  color: var(--text-secondary);
}
.bench-typical {
  color: var(--text-muted);
}
.bench-verdict {
  font-weight: 600;
  font-size: 0.75rem;
  text-align: right;
}
.bench-better {
  color: var(--win);
}
.bench-worse {
  color: var(--loss);
}

@media (max-width: 768px) {
  .bench-row {
    grid-template-columns: 1fr 1fr;
    gap: 0.25rem;
  }
  .bench-label {
    grid-column: 1 / -1;
  }
}

/* ============================================
   Training View
   ============================================ */
.training-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.5rem;
}
.training-header h2 { margin-bottom: 0.25rem; }
.training-sub { color: var(--text-secondary); font-size: 0.875rem; }
.training-scoreboard { text-align: right; }
.score-label { display: block; font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
.score-value { font-size: 1.75rem; font-weight: 700; color: var(--accent); }

.training-layout {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1.5rem;
  align-items: start;
}

.training-board-panel { display: flex; flex-direction: column; gap: 0.5rem; }
.training-ctx {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
}
.train-badge {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
}
.train-badge.blunder { background: rgba(248,81,73,0.15); color: var(--loss); }
.train-badge.mistake { background: rgba(224,144,64,0.15); color: #e09040; }
.train-badge.inaccuracy { background: rgba(212,168,67,0.15); color: var(--accent); }
.train-meta { color: var(--text-muted); }
.srs-badge {
  font-size: 0.6875rem;
  padding: 0.125rem 0.375rem;
  border-radius: var(--radius-sm);
  background: rgba(63,185,80,0.12);
  color: var(--win);
  font-weight: 600;
}
.srs-due { color: var(--accent); font-weight: 600; }
.playlist-bar {
  display: flex;
  gap: 0.375rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.playlist-btn {
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.playlist-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}
.playlist-btn-themed {
  border-color: rgba(212, 168, 67, 0.3);
  color: #d4a843;
}
.playlist-btn-themed:hover { border-color: #d4a843; }
.playlist-btn.active {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: var(--accent);
}

/* Theme picker */
.theme-picker { margin-bottom: 1rem; }
.theme-picker-loading, .theme-picker-empty {
  color: #8b949e;
  font-size: 0.85rem;
  padding: 12px;
}
.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
}
.theme-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 10px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
}
.theme-btn:hover { border-color: #d4a843; background: rgba(212,168,67,0.06); }
.theme-name { font-size: 0.85rem; font-weight: 600; color: #e6edf3; text-transform: capitalize; }
.theme-meta { font-size: 0.7rem; color: #656d76; margin-top: 2px;
}
.srs-stats { margin-top: 0.25rem; }
.srs-mastery {
  font-size: 0.75rem;
  color: var(--text-secondary);
}
.tc-srs {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  line-height: 1.8;
}

/* Interactive board */
.chess-board.interactive .square.clickable { cursor: pointer; }
.chess-board.interactive .square.selected {
  box-shadow: inset 0 0 0 3px rgba(212, 168, 67, 0.65);
}
.move-dot {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 28%;
  height: 28%;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.14);
  pointer-events: none;
}
.move-dot.capture {
  width: 85%;
  height: 85%;
  background: transparent;
  border: 5px solid rgba(0, 0, 0, 0.14);
  box-sizing: border-box;
}

.training-progress-bar {
  height: 4px;
  background: var(--bg-tertiary);
  border-radius: 2px;
  overflow: hidden;
}
.training-progress-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.3s;
}

.training-info {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.train-prompt {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
}
.train-played { margin-bottom: 1rem; font-size: 0.9375rem; }
.train-label { color: var(--text-muted); font-size: 0.8125rem; }
.train-bad {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--loss);
  font-size: 1.125rem;
}
.train-good {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--win);
  font-size: 1.125rem;
}
.train-cploss { color: var(--text-muted); font-size: 0.8125rem; }
.train-eval-change {
  margin-top: 0.375rem;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}
.training-answer { margin-top: 1rem; }

/* Feedback flash */
.training-feedback {
  padding: 1rem;
  border-radius: var(--radius);
  margin-top: 1rem;
  text-align: center;
  animation: fbIn 0.15s ease;
}
@keyframes fbIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.training-feedback.correct {
  background: rgba(63, 185, 80, 0.1);
  border: 1px solid rgba(63, 185, 80, 0.25);
}
.training-feedback.wrong {
  background: rgba(248, 81, 73, 0.1);
  border: 1px solid rgba(248, 81, 73, 0.25);
}
.fb-result { font-size: 1.25rem; font-weight: 700; }
.training-feedback.correct .fb-result { color: var(--win); }
.training-feedback.wrong .fb-result { color: var(--loss); }
.fb-detail { font-size: 0.875rem; color: var(--text-secondary); margin-top: 0.25rem; }
.fb-context { margin-top: 0.5rem; font-size: 0.8125rem; }
.fb-dim { color: var(--text-muted); }

/* Training complete */
.training-complete {
  text-align: center;
  padding: 4rem 2rem;
  max-width: 400px;
  margin: 0 auto;
}
.training-complete h2 { margin-bottom: 1rem; }
.tc-score { font-size: 3rem; font-weight: 700; }
.tc-pct { font-size: 1.25rem; color: var(--text-secondary); margin-bottom: 0.5rem; }
.tc-grade { font-size: 1rem; font-weight: 600; margin-bottom: 1.5rem; }
.tc-grade.win { color: var(--win); }
.tc-grade.accent { color: var(--accent); }
.tc-grade.loss { color: var(--loss); }

/* ============================================
   Placeholder Views
   ============================================ */
.placeholder-view {
  text-align: center;
  padding: 6rem 2rem;
  max-width: 400px;
  margin: 0 auto;
}
.placeholder-view svg { margin: 0 auto 1.5rem; display: block; color: var(--text-muted); }
.placeholder-view h2 { margin-bottom: 0.75rem; }
.placeholder-view p { color: var(--text-secondary); font-size: 0.9375rem; }
.placeholder-hint { margin-top: 0.5rem; font-size: 0.8125rem !important; color: var(--text-muted) !important; }

/* ============================================
   Insight Feed
   ============================================ */

/* Feed container */
.feed { display: flex; flex-direction: column; gap: 1rem; max-width: 540px; margin: 0 auto; padding: 1rem 0; }
.feed-empty { text-align: center; padding: 2rem; color: var(--text-muted); font-size: 0.9375rem; }

/* Feed/Games toggle */
.feed-toggle { display: flex; gap: 0; margin-bottom: 0.5rem; }
.feed-toggle-btn {
  flex: 1; padding: 0.5rem; text-align: center; font-size: 0.8125rem; font-weight: 600;
  background: none; border: 1px solid var(--border); color: var(--text-muted); cursor: pointer;
}
.feed-toggle-btn:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.feed-toggle-btn:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.feed-toggle-btn.active { background: var(--bg-tertiary); color: var(--text-primary); border-color: var(--text-muted); }

/* Card base */
.feed-card {
  background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 12px;
  overflow: hidden; cursor: pointer; transition: border-color 0.15s, transform 0.1s;
  opacity: 0; transform: translateY(12px); animation: feedCardIn 0.35s ease forwards;
}
.feed-card:hover { border-color: rgba(255,255,255,0.15); transform: translateY(-1px); }
@keyframes feedCardIn { to { opacity: 1; transform: none; } }

/* Category accent border */
.feed-card[data-card-category="pride"]     { border-left: 3px solid var(--accent); }
.feed-card[data-card-category="challenge"] { border-left: 3px solid var(--loss); }
.feed-card[data-card-category="progress"]  { border-left: 3px solid var(--win); }
.feed-card[data-card-category="insight"]   { border-left: 3px solid #58a6ff; }
.feed-card[data-card-category="story"]     { border-left: 3px solid #d2a8ff; }

/* Card header */
.feed-card-header {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.75rem 1rem 0; font-size: 0.6875rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted);
}
.feed-card-category-icon { font-size: 0.875rem; }
.feed-card[data-card-category="pride"] .feed-card-category-icon { color: var(--accent); }
.feed-card[data-card-category="challenge"] .feed-card-category-icon { color: var(--loss); }
.feed-card[data-card-category="progress"] .feed-card-category-icon { color: var(--win); }
.feed-card[data-card-category="insight"] .feed-card-category-icon { color: #58a6ff; }
.feed-card[data-card-category="story"] .feed-card-category-icon { color: #d2a8ff; }
.feed-card-time { margin-left: auto; font-weight: 400; }

/* Card title */
.feed-card-title { padding: 0.375rem 1rem 0.5rem; font-size: 1.125rem; font-weight: 700; line-height: 1.3; }

/* Card body */
.feed-card-body { padding: 0 1rem 0.75rem; }

/* Card footer */
.feed-card-footer {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.625rem 1rem; border-top: 1px solid var(--border); font-size: 0.75rem; color: var(--text-muted);
}
.feed-card-action { color: var(--accent); font-weight: 500; cursor: pointer; }
.feed-card:hover .feed-card-action { text-decoration: underline; }

/* Load more */
.feed-load-more {
  display: block; width: 100%; padding: 0.75rem; background: var(--bg-tertiary);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-secondary); font-size: 0.875rem; cursor: pointer; text-align: center;
}
.feed-load-more:hover { border-color: var(--text-muted); }

/* --- Card-specific styles --- */

/* Giant Killer */
.gk-matchup { display: flex; align-items: center; justify-content: center; gap: 1.5rem; padding: 0.5rem 0; text-align: center; }
.gk-rating { font-size: 2rem; font-weight: 700; }
.gk-you { color: var(--win); }
.gk-opp { color: var(--text-secondary); }
.gk-name { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.125rem; }
.gk-vs { display: flex; flex-direction: column; align-items: center; gap: 0.25rem; }
.gk-result-badge { width: 2rem; height: 2rem; display: flex; align-items: center; justify-content: center; border-radius: 50%; font-weight: 700; font-size: 0.875rem; }
.gk-result-badge.win { background: rgba(63,185,80,0.15); color: var(--win); }
.gk-diff { font-size: 0.75rem; font-weight: 600; color: var(--accent); }

/* Clean Game */
.clean-game-layout { display: flex; gap: 1.25rem; align-items: center; }
.clean-game-shield {
  width: 80px; height: 80px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, rgba(212,168,67,0.2), rgba(212,168,67,0.05));
  border: 2px solid var(--accent); display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.clean-game-acpl { font-size: 1.75rem; font-weight: 700; color: var(--accent); }
.clean-game-acpl-label { font-size: 0.5625rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); }
.clean-game-details { flex: 1; }
.clean-game-row { display: flex; justify-content: space-between; padding: 0.2rem 0; font-size: 0.8125rem; }
.cg-label { color: var(--text-muted); }
.cg-value { font-weight: 600; }
.cg-value.win { color: var(--win); }
.cg-value.loss { color: var(--loss); }

/* Best Move Streak */
.streak-dots { display: flex; gap: 0.25rem; flex-wrap: wrap; margin-bottom: 0.5rem; }
.streak-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--win); }
.streak-label { font-size: 0.8125rem; color: var(--text-muted); }

/* Puzzle Card */
.puzzle-card-layout { display: flex; gap: 1rem; align-items: flex-start; }
.puzzle-card-info { flex: 1; font-size: 0.8125rem; }
.puzzle-card-side { font-weight: 600; margin-bottom: 0.25rem; }
.puzzle-card-opening { color: var(--text-muted); font-size: 0.75rem; }
.puzzle-card-eval { margin-top: 0.5rem; line-height: 1.6; }
.eval-before { color: var(--win); font-weight: 600; }
.eval-after { color: var(--loss); font-weight: 600; }
.feed-badge { display: inline-block; padding: 0.1rem 0.4rem; border-radius: var(--radius-sm); font-size: 0.6875rem; font-weight: 600; }
.feed-badge.blunder { background: rgba(248,81,73,0.15); color: var(--loss); }
.feed-badge.mistake { background: rgba(255,189,46,0.15); color: #FFBD2E; }
.feed-badge.cat { background: rgba(88,166,255,0.15); color: #58a6ff; }
.puzzle-card-badge { margin-top: 0.5rem; display: flex; gap: 0.375rem; }

/* Win Streak */
.ws-count { font-size: 3rem; font-weight: 700; text-align: center; color: var(--win); line-height: 1; }
.ws-label { text-align: center; font-size: 0.8125rem; color: var(--text-muted); margin-bottom: 0.75rem; }
.ws-games { display: flex; flex-direction: column; gap: 0.25rem; }
.ws-game { display: flex; align-items: center; gap: 0.5rem; font-size: 0.8125rem; }
.ws-badge { width: 1.25rem; height: 1.25rem; display: flex; align-items: center; justify-content: center; border-radius: 50%; font-size: 0.625rem; font-weight: 700; }
.ws-badge.win { background: rgba(63,185,80,0.15); color: var(--win); }
.ws-opp { flex: 1; }
.ws-rating { color: var(--text-muted); font-size: 0.75rem; }

/* Game of the Week / Story */
.story-eval-sparkline { height: 60px; border-radius: var(--radius-sm); background: var(--bg-tertiary); overflow: hidden; margin-bottom: 0.75rem; }
.feed-sparkline { width: 100%; height: 100%; }
.story-narrative { font-size: 0.875rem; line-height: 1.6; color: var(--text-secondary); }
.story-narrative .eval-loss { color: var(--loss); font-weight: 600; }
.story-narrative .eval-win { color: var(--win); font-weight: 600; }

/* Opening Spotlight */
.opening-card { text-align: center; }
.opening-card.opening-bad .opening-wr { color: var(--loss); }
.opening-wr { font-size: 2.5rem; font-weight: 700; color: var(--win); line-height: 1; }
.opening-detail { font-size: 0.8125rem; color: var(--text-muted); margin: 0.25rem 0 0.5rem; }
.opening-win-bar { display: flex; height: 6px; border-radius: 3px; overflow: hidden; }
.owb-win { background: var(--win); }
.owb-draw { background: var(--text-muted); }
.owb-loss { background: var(--loss); }

/* Benchmark */
.bench-summary { font-size: 0.9375rem; color: var(--text-secondary); margin-bottom: 0.75rem; line-height: 1.5; }
.bench-summary strong { color: var(--win); }
.bench-rows { display: flex; flex-direction: column; gap: 0.375rem; }
.bench-row { display: flex; align-items: center; gap: 0.5rem; font-size: 0.8125rem; padding: 0.375rem 0.5rem; background: var(--bg-tertiary); border-radius: var(--radius-sm); }
.bench-label { flex: 1; color: var(--text-muted); }
.bench-you { font-weight: 600; min-width: 2rem; text-align: right; }
.bench-vs { color: var(--text-muted); font-size: 0.6875rem; }
.bench-typical { color: var(--text-secondary); min-width: 2rem; text-align: right; }
.bench-verdict { font-weight: 700; min-width: 1.25rem; text-align: center; }
.bench-verdict.better { color: var(--win); }
.bench-verdict.worse { color: var(--loss); }

/* Time Pressure */
.tp-compare { display: flex; align-items: center; justify-content: center; gap: 1.5rem; text-align: center; }
.tp-col-label { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 0.25rem; }
.tp-col-value { font-size: 2rem; font-weight: 700; }
.tp-calm .tp-col-value { color: var(--win); }
.tp-press .tp-col-value { color: var(--loss); }
.tp-col-sub { font-size: 0.6875rem; color: var(--text-muted); }
.tp-arrow { font-size: 1.5rem; color: var(--text-muted); }

/* ACPL Trend */
.acpl-trend-compare { display: flex; align-items: center; justify-content: center; gap: 1.5rem; text-align: center; }
.acpl-trend-label { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 0.25rem; }
.acpl-trend-value { font-size: 2rem; font-weight: 700; }
.acpl-trend-value.improving { color: var(--win); }
.acpl-trend-value.declining { color: var(--loss); }
.acpl-trend-arrow { font-size: 1.5rem; }
.acpl-trend-arrow.improving { color: var(--win); }
.acpl-trend-arrow.declining { color: var(--loss); }

/* Session Recap */
.recap-summary { font-size: 1.25rem; font-weight: 700; margin-bottom: 0.5rem; }
.recap-games { display: flex; flex-direction: column; gap: 0.25rem; }
.recap-game { display: flex; align-items: center; gap: 0.5rem; font-size: 0.8125rem; }
.recap-badge { width: 1.25rem; height: 1.25rem; display: flex; align-items: center; justify-content: center; border-radius: 50%; font-size: 0.625rem; font-weight: 700; flex-shrink: 0; }
.recap-badge.win { background: rgba(63,185,80,0.15); color: var(--win); }
.recap-badge.loss { background: rgba(248,81,73,0.15); color: var(--loss); }
.recap-badge.draw { background: rgba(255,255,255,0.1); color: var(--text-muted); }
.recap-opp { flex: 1; }
.recap-opening { color: var(--text-muted); font-size: 0.75rem; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Rating Milestone */
.milestone-rating { font-size: 3rem; font-weight: 700; text-align: center; color: var(--accent); line-height: 1; }
.milestone-label { text-align: center; font-size: 0.8125rem; color: var(--text-muted); margin-top: 0.25rem; }
.milestone-current { text-align: center; font-size: 0.75rem; color: var(--text-secondary); margin-top: 0.375rem; }

/* Weakness Drill */
.weakness-bar-row { display: flex; align-items: center; gap: 0.5rem; padding: 0.25rem 0; font-size: 0.8125rem; }
.weakness-bar-row.active { font-weight: 600; }
.weakness-bar-row.active .weakness-cat { color: var(--loss); }
.weakness-cat { min-width: 70px; color: var(--text-muted); text-transform: capitalize; }
.weakness-bar-track { flex: 1; height: 8px; background: var(--bg-tertiary); border-radius: 4px; overflow: hidden; }
.weakness-bar-fill { height: 100%; background: var(--accent); border-radius: 4px; transition: width 0.3s; }
.weakness-bar-row.active .weakness-bar-fill { background: var(--loss); }
.weakness-count { min-width: 1.5rem; text-align: right; color: var(--text-muted); font-size: 0.75rem; }

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 1024px) {
  .analysis-layout, .training-layout {
    grid-template-columns: 1fr;
  }
  .chess-board {
    width: 100%;
    height: auto;
    aspect-ratio: 1;
    max-width: 480px;
  }
  .board-panel { align-items: center; }
  .player-bar { width: 100%; max-width: 510px; }
  .board-wrapper { max-width: 510px; width: 100%; }
  .board-controls { justify-content: center; }
}

@media (max-width: 768px) {
  .navbar { padding: 0 1rem; gap: 1rem; }
  .nav-tabs { gap: 0; }
  .nav-tab { padding: 0.375rem 0.5rem; font-size: 0.8125rem; }
  .nav-player { display: none; }
  .nav-auth .auth-name { display: none; }
  .cache-status-stats { flex-wrap: wrap; gap: 0.5rem; }
  .view { padding: 1.5rem 1rem; }
  .hero { padding: 2.5rem 0 2rem; }
  .hero h1 { font-size: 2rem; }
  .features-grid { grid-template-columns: 1fr; }
  .player-card { flex-wrap: wrap; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .section-header { flex-direction: column; align-items: flex-start; }
  .insights-grid { grid-template-columns: 1fr; }
  .piece { font-size: 2.5rem; }
}

@media (max-width: 480px) {
  .search-container { flex-direction: column; }
  .stats-grid { grid-template-columns: 1fr; }
  .game-row { padding: 0.625rem 0.75rem; }
  .piece { font-size: 2rem; }
}

/* ---- Shortcut Help Overlay ---- */
.shortcut-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}
.shortcut-modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  min-width: 320px;
  max-width: 400px;
}
.shortcut-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}
.shortcut-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0 0.25rem;
}
.shortcut-close:hover { color: var(--text-primary); }
.shortcut-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.shortcut-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.875rem;
}
.shortcut-row kbd {
  display: inline-block;
  min-width: 2.5rem;
  text-align: center;
  padding: 0.25rem 0.5rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-primary);
}
.shortcut-row span { color: var(--text-secondary); }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* ============================================
   REELS MODE — Full-screen mobile-first
   ============================================ */

/* ---- Reels Mode Body State ---- */
body.reels-mode {
  overflow: hidden;
  position: fixed;
  width: 100%;
  height: 100%;
}
body.reels-mode .navbar,
body.reels-mode main > .view {
  display: none !important;
}
body.reels-mode #view-reels {
  display: block !important;
}

/* ---- Viewport ---- */
.reels-viewport {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #000;
  z-index: 200;
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
}

/* ---- Track (vertical scroll) ---- */
.reels-track {
  transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  will-change: transform;
}

/* ---- Individual Reel Card ---- */
.reel-card {
  width: 100vw;
  height: 100vh;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.reel-bg {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px 80px;
  position: relative;
  overflow: hidden;
}

/* ---- Progress Bar (top) ---- */
.reels-progress-bar {
  position: fixed;
  top: 12px;
  left: 12px;
  right: 12px;
  z-index: 210;
  display: flex;
  gap: 4px;
}

.reels-progress-dot {
  flex: 1;
  height: 3px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
  overflow: hidden;
}

.reels-progress-dot.active .reels-progress-fill,
.reels-progress-dot.past .reels-progress-fill {
  display: block;
}

.reels-progress-fill {
  display: none;
  height: 100%;
  background: #fff;
  border-radius: 2px;
  width: 0%;
}

.reels-progress-dot.past .reels-progress-fill {
  width: 100% !important;
  transition: none !important;
}

/* ---- Close Button ---- */
.reels-close-btn {
  position: fixed;
  top: 24px;
  right: 16px;
  z-index: 220;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1.25rem;
  cursor: pointer;
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.reels-close-btn:hover { background: rgba(255, 255, 255, 0.3); }

/* ---- Counter ---- */
.reels-counter {
  position: fixed;
  top: 26px;
  left: 16px;
  z-index: 220;
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.05em;
}

/* ---- Nav Hints ---- */
.reels-nav-hint {
  position: fixed;
  z-index: 210;
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.8rem;
  text-align: center;
  width: 100%;
  pointer-events: none;
  animation: reelPulse 2s ease-in-out infinite;
}
.reels-nav-up { top: 48px; }
.reels-nav-down { bottom: 24px; }

/* ---- Floating Emoji ---- */
.reel-floating-emoji {
  position: absolute;
  top: 15%;
  right: 10%;
  font-size: 4rem;
  opacity: 0.15;
  animation: reelFloat 6s ease-in-out infinite;
  pointer-events: none;
}

/* ---- Header ---- */
.reel-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  align-self: flex-start;
}

.reel-category-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
}
.reel-cat-hype { background: rgba(63, 185, 80, 0.2); color: #3fb950; }
.reel-cat-insight { background: rgba(212, 168, 67, 0.2); color: #d4a843; }
.reel-cat-interactive { background: rgba(88, 166, 255, 0.2); color: #58a6ff; }

.reel-subtitle {
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.8rem;
}

/* ---- Title ---- */
.reel-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.3;
  text-align: center;
  margin-bottom: 24px;
  max-width: 340px;
  animation: reelSlideUp 0.5s ease-out both;
}

/* ---- Body ---- */
.reel-body {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  width: 100%;
  max-width: 360px;
  animation: reelFadeIn 0.6s ease-out 0.2s both;
}

/* ---- Actions ---- */
.reel-actions {
  margin-top: 20px;
  text-align: center;
  animation: reelFadeIn 0.8s ease-out 0.4s both;
}

.reel-action-text {
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* ---- Swipe Hint ---- */
.reel-swipe-hint {
  position: absolute;
  bottom: 30px;
  width: 100%;
  text-align: center;
  color: rgba(255, 255, 255, 0.35);
  font-size: 0.8rem;
  animation: reelBounce 2s ease-in-out infinite;
}

/* ---- Hidden utility ---- */
.reel-hidden { display: none !important; }

/* ============================================
   REEL BODY STYLES
   ============================================ */

/* ---- Mini Board ---- */
.reel-board {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  margin: 0 auto;
}

.reel-sq {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
}

.reel-piece {
  display: block;
  text-align: center;
  color: #f0e6d2;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.5)) drop-shadow(0 0 1px rgba(0,0,0,0.4));
}

.reel-piece-black {
  color: #2c2c2c;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.3)) drop-shadow(0 0 1px rgba(255,255,255,0.25));
}

.reel-arrow-svg {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
}

.reel-arrow-anim {
  animation: reelArrowDraw 0.6s ease-out both;
}

/* ---- Puzzle ---- */
.reel-puzzle-wrap {
  text-align: center;
}

.reel-puzzle-info {
  margin-top: 20px;
}

.reel-label {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.5);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-right: 6px;
}

.reel-move-bad {
  font-size: 1.2rem;
  font-weight: 700;
  color: #f85149;
  font-family: var(--font-mono);
}

.reel-move-good {
  font-size: 1.2rem;
  font-weight: 700;
  color: #3fb950;
  font-family: var(--font-mono);
}

.reel-eval-swing {
  margin-top: 6px;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.6);
  font-family: var(--font-mono);
}

.reel-reveal-btn {
  margin-top: 16px;
  padding: 10px 28px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-radius: 24px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.reel-reveal-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.5);
}

/* ---- Giant Killer ---- */
.reel-gk-wrap { text-align: center; width: 100%; }

.reel-gk-matchup {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.reel-gk-side { text-align: center; }

.reel-gk-rating-num {
  font-size: 2.8rem;
  font-weight: 800;
  font-family: var(--font-mono);
  line-height: 1;
}

.reel-gk-you .reel-gk-rating-num { color: #3fb950; }
.reel-gk-opp .reel-gk-rating-num { color: #f85149; }

.reel-gk-label {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.5);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 4px;
}

.reel-gk-vs {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.reel-gk-vs-text {
  font-size: 1rem;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.3);
  letter-spacing: 0.2em;
}

.reel-gk-diff-badge {
  background: linear-gradient(135deg, #d4a843, #e0b84e);
  color: #000;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 700;
  animation: reelPulse 1.5s ease-in-out infinite;
}

.reel-gk-result {
  margin-top: 32px;
  font-size: 3rem;
  font-weight: 900;
  letter-spacing: 0.5em;
  color: #3fb950;
  text-shadow: 0 0 30px rgba(63, 185, 80, 0.5);
  animation: reelScaleIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.8s both;
}

/* ---- Clean Game Ring ---- */
.reel-clean-wrap { text-align: center; width: 100%; }

.reel-clean-ring {
  position: relative;
  width: 160px;
  height: 160px;
  margin: 0 auto 24px;
}

.reel-ring-svg {
  width: 100%;
  height: 100%;
}

.reel-ring-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.reel-ring-num {
  font-size: 2.5rem;
  font-weight: 800;
  color: #3fb950;
  font-family: var(--font-mono);
  line-height: 1;
}

.reel-ring-label {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.4);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.reel-clean-stats {
  display: flex;
  justify-content: center;
  gap: 32px;
}

.reel-clean-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.reel-stat-num {
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  font-family: var(--font-mono);
}

.reel-stat-label {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.4);
  text-transform: uppercase;
}

/* ---- Streak ---- */
.reel-streak-wrap { text-align: center; width: 100%; }

.reel-streak-num {
  font-size: 5rem;
  font-weight: 900;
  color: #fff;
  line-height: 1;
  text-shadow: 0 0 40px rgba(255, 165, 0, 0.4);
  animation: reelScaleIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.reel-streak-label {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 8px;
}

.reel-streak-flames {
  margin-top: 24px;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px;
}

.reel-flame {
  display: inline-block;
  font-size: 1.5rem;
  animation: reelFlame 0.4s ease-out both;
}

/* ---- Opening Roast ---- */
.reel-roast-wrap {
  text-align: center;
  width: 100%;
}

.reel-roast-board-row {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 12px;
  margin: 0 auto 16px;
}

.reel-board-anim-wrap {
  flex-shrink: 0;
}

.reel-roast-movelist {
  width: 110px;
  max-height: 220px;
  overflow-y: auto;
  text-align: left;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.6;
  color: #e6edf3;
  scrollbar-width: none;
}

.reel-roast-movelist::-webkit-scrollbar { display: none; }

.reel-move-entry {
  display: block;
  white-space: nowrap;
}

.reel-move-num {
  color: #8b949e;
  font-weight: 400;
}

.reel-move-black {
  color: #c9d1d9;
}

.reel-move-blunder {
  color: #f85149;
  font-weight: 700;
}

.reel-move-postbook {
  color: #8b949e;
}

.reel-move-separator {
  display: block;
  color: #484f58;
  font-size: 0.7rem;
  font-style: italic;
  font-family: inherit;
  letter-spacing: 0.02em;
  margin: 4px 0 2px;
}

.reel-roast-opening {
  font-size: 1.1rem;
  font-weight: 600;
  color: #d4a843;
  margin-bottom: 20px;
}

.reel-roast-bar-container {
  max-width: 280px;
  margin: 0 auto;
}

.reel-roast-bar {
  height: 28px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  position: relative;
}

.reel-roast-fill-win {
  background: #3fb950;
  height: 100%;
  border-radius: 14px 0 0 14px;
  transition: width 1s ease-out;
}

.reel-roast-fill-loss {
  background: #f85149;
  height: 100%;
  border-radius: 0 14px 14px 0;
  transition: width 1s ease-out;
}

.reel-roast-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 0.8rem;
  font-weight: 600;
}

.reel-roast-w { color: #3fb950; }
.reel-roast-l { color: #f85149; }

.reel-roast-verdict {
  margin-top: 20px;
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.7);
}

.reel-roast-tip {
  margin-top: 12px;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.4);
  font-style: italic;
}

/* ---- Time Trouble ---- */
.reel-time-wrap { text-align: center; width: 100%; }

.reel-time-clock {
  position: relative;
  width: 120px;
  height: 120px;
  margin: 0 auto 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.reel-time-display {
  font-size: 2rem;
  font-weight: 800;
  color: #f85149;
  font-family: var(--font-mono);
  z-index: 1;
}

.reel-time-pulse {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  border-radius: 50%;
  border: 3px solid #f85149;
  animation: reelTimePulse 1s ease-in-out infinite;
}

.reel-time-stat {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
}

.reel-time-num {
  font-size: 3rem;
  font-weight: 900;
  color: #f85149;
  font-family: var(--font-mono);
}

.reel-time-label {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.5);
}

.reel-time-tip {
  margin-top: 24px;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.5);
  max-width: 300px;
  line-height: 1.5;
}

/* ---- Win Streak ---- */
.reel-winstreak-wrap { text-align: center; width: 100%; }

.reel-winstreak-num {
  font-size: 6rem;
  font-weight: 900;
  color: #d4a843;
  line-height: 1;
  text-shadow: 0 0 40px rgba(212, 168, 67, 0.4);
  animation: reelScaleIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.reel-winstreak-label {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 8px;
}

.reel-winstreak-crowns {
  margin-top: 24px;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
}

.reel-trophy {
  display: inline-block;
  font-size: 2rem;
  animation: reelFlame 0.4s ease-out both;
}

/* ---- Stats Wrapped ---- */
.reel-stats-wrap { text-align: center; width: 100%; }

.reel-stats-rating {
  margin-bottom: 20px;
}

.reel-stats-rating-num {
  font-size: 3rem;
  font-weight: 900;
  color: #d4a843;
  font-family: var(--font-mono);
}

.reel-stats-rating-type {
  display: block;
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.4);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.reel-stats-donut {
  position: relative;
  width: 140px;
  height: 140px;
  margin: 0 auto 20px;
}

.reel-donut-svg { width: 100%; height: 100%; }

.reel-donut-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.8rem;
  font-weight: 800;
  color: #fff;
}

.reel-stats-row {
  display: flex;
  justify-content: center;
  gap: 28px;
}

.reel-stats-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.reel-stats-num {
  font-size: 1.4rem;
  font-weight: 700;
  font-family: var(--font-mono);
}
.reel-stats-win { color: #3fb950; }
.reel-stats-loss { color: #f85149; }
.reel-stats-draw { color: #8b949e; }

.reel-stats-item span:last-child {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.4);
  text-transform: uppercase;
}

/* ---- Rating Milestone ---- */
.reel-milestone-wrap { text-align: center; width: 100%; }

.reel-milestone-badge {
  position: relative;
  width: 160px;
  height: 160px;
  margin: 0 auto 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  animation: reelScaleIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.3s both;
}

.reel-milestone-glow {
  position: absolute;
  top: -20px; left: -20px; right: -20px; bottom: -20px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(212, 168, 67, 0.3) 0%, transparent 70%);
  animation: reelPulse 2s ease-in-out infinite;
}

.reel-milestone-num {
  font-size: 3rem;
  font-weight: 900;
  color: #d4a843;
  font-family: var(--font-mono);
  z-index: 1;
  text-shadow: 0 0 20px rgba(212, 168, 67, 0.5);
}

.reel-milestone-type {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.5);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  z-index: 1;
}

.reel-milestone-bar {
  max-width: 260px;
  margin: 0 auto;
}

.reel-milestone-bar > div:first-child {
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
}

.reel-milestone-fill {
  height: 100%;
  background: linear-gradient(90deg, #d4a843, #e0b84e);
  border-radius: 4px;
  transition: width 1.2s ease-out;
}

.reel-milestone-markers {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.3);
  font-family: var(--font-mono);
}

/* ---- Guess Eval ---- */
.reel-guess-wrap { text-align: center; width: 100%; }

.reel-guess-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
  max-width: 280px;
  margin-left: auto;
  margin-right: auto;
}

.reel-guess-btn {
  padding: 12px 20px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.reel-guess-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.4);
}

.reel-guess-btn.reel-guess-correct {
  border-color: #3fb950;
  background: rgba(63, 185, 80, 0.2);
}

.reel-guess-btn.reel-guess-wrong {
  border-color: #f85149;
  background: rgba(248, 81, 73, 0.2);
}

.reel-guess-btn.reel-guess-disabled {
  opacity: 0.5;
  cursor: default;
}

.reel-guess-result {
  margin-top: 16px;
  padding: 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.reel-guess-eval-text {
  color: #fff;
  font-size: 1rem;
}

.reel-guess-eval-bar {
  height: 8px;
  background: #333;
  border-radius: 4px;
  margin-bottom: 8px;
  overflow: hidden;
}

.reel-guess-eval-fill {
  height: 100%;
  background: #e6edf3;
  border-radius: 4px;
}

/* ---- Confetti ---- */
.reels-confetti-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
  z-index: 50;
}

.reels-confetti-piece {
  position: absolute;
  top: -10px;
  border-radius: 2px;
  animation: reelConfettiFall linear forwards;
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes reelSlideUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

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

@keyframes reelScaleIn {
  from { opacity: 0; transform: scale(0.5); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes reelPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.05); }
}

@keyframes reelBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@keyframes reelFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  33% { transform: translateY(-15px) rotate(5deg); }
  66% { transform: translateY(10px) rotate(-3deg); }
}

@keyframes reelFlame {
  from { opacity: 0; transform: scale(0) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes reelTimePulse {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.15); opacity: 0.5; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes reelConfettiFall {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}

@keyframes reelArrowDraw {
  from { opacity: 0; transform: scale(0.5); }
  to { opacity: 1; transform: scale(1); }
}

/* ============================================
   MOBILE OPTIMIZATIONS
   ============================================ */

@media (max-width: 480px) {
  .reel-bg { padding: 50px 16px 60px; }
  .reel-title { font-size: 1.3rem; max-width: 300px; }
  .reel-board { width: 240px !important; height: 240px !important; }
  .reel-gk-rating-num { font-size: 2.2rem; }
  .reel-gk-matchup { gap: 14px; }
  .reel-streak-num { font-size: 4rem; }
  .reel-winstreak-num { font-size: 4.5rem; }
  .reel-stats-rating-num { font-size: 2.5rem; }
}

@media (min-width: 768px) {
  .reel-title { font-size: 2rem; }
  .reel-body { max-width: 440px; }
  .reel-gk-rating-num { font-size: 3.5rem; }
  .reel-gk-result { font-size: 3.5rem; }
}

/* ---- Reels Entry Button (on dashboard) ---- */
.reels-entry-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: linear-gradient(135deg, #d4a843 0%, #e0b84e 100%);
  color: #000;
  border: none;
  border-radius: 24px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 16px rgba(212, 168, 67, 0.3);
}
.reels-entry-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(212, 168, 67, 0.4);
}
.reels-entry-btn svg { width: 18px; height: 18px; }

/* (Reels tab styling moved to .nav-tab-accent in navbar section) */

/* ============================================
   GAME FILM — Full-screen game replay
   ============================================ */

body.gamefilm-mode {
  overflow: hidden;
  position: fixed;
  width: 100%;
  height: 100%;
}
body.gamefilm-mode .navbar,
body.gamefilm-mode main > .view {
  display: none !important;
}
body.gamefilm-mode #view-gamefilm {
  display: block !important;
}

.gf-viewport {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #0d1117;
  z-index: 200;
  display: flex;
  flex-direction: column;
  -webkit-user-select: none;
  user-select: none;
}

/* Filters */
.gf-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 56px 8px 16px;
  flex-shrink: 0;
}

.gf-filter-select {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: #e6edf3;
  padding: 5px 8px;
  border-radius: 8px;
  font-size: 0.75rem;
  cursor: pointer;
  max-width: 160px;
}
.gf-filter-select option { background: #1c2333; }

.gf-count {
  color: rgba(255,255,255,0.4);
  font-size: 0.75rem;
  margin-left: auto;
}

/* Close / Counter */
.gf-close-btn {
  position: fixed;
  top: 12px;
  right: 16px;
  z-index: 220;
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1.25rem;
  cursor: pointer;
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.gf-close-btn:hover { background: rgba(255,255,255,0.3); }

.gf-counter {
  position: fixed;
  bottom: 16px;
  left: 16px;
  z-index: 210;
  color: rgba(255,255,255,0.4);
  font-size: 0.75rem;
  font-weight: 500;
}

/* Main content */
.gf-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  overflow: hidden;
}

/* Game header */
.gf-game-header {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 16px;
}

.gf-result {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  padding: 2px 8px;
  border-radius: 4px;
}
.gf-result-win { background: rgba(63,185,80,0.2); color: #3fb950; }
.gf-result-loss { background: rgba(248,81,73,0.2); color: #f85149; }
.gf-result-draw { background: rgba(139,148,158,0.2); color: #8b949e; }

.gf-matchup {
  color: #e6edf3;
  font-size: 0.85rem;
  font-weight: 600;
}

.gf-opening-tag {
  color: #d4a843;
  font-size: 0.75rem;
}

.gf-time-tag {
  color: #8b949e;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
}

/* Board + move list row */
.gf-board-row {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  max-width: 600px;
}

.gf-board-wrap {
  flex-shrink: 0;
  cursor: pointer;
}

/* Move list */
.gf-movelist {
  width: 160px;
  max-height: 280px;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.15) transparent;
}
.gf-movelist::-webkit-scrollbar { width: 4px; }
.gf-movelist::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }

.gf-move-line {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 4px;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
}
.gf-move-line:hover { background: rgba(255,255,255,0.06); }
.gf-move-active { background: rgba(255,255,255,0.1); }

.gf-move-num {
  color: #484f58;
  font-weight: 400;
  min-width: 2em;
}

.gf-san {
  color: #e6edf3;
}
.gf-san-black {
  color: #c9d1d9;
  margin-left: 4px;
}
.gf-san-blunder { color: #f85149; font-weight: 700; }
.gf-san-mistake { color: #e09b3d; }

/* Analysis badges */
.gf-badge {
  font-size: 0.65rem;
  font-weight: 800;
  padding: 0 3px;
  border-radius: 3px;
  margin-left: 2px;
}
.gf-badge-blunder { background: rgba(248,81,73,0.2); color: #f85149; }
.gf-badge-mistake { background: rgba(224,155,61,0.2); color: #e09b3d; }
.gf-badge-inaccuracy { background: rgba(212,168,67,0.2); color: #d4a843; }
.gf-badge-best { background: rgba(63,185,80,0.15); color: #3fb950; }

/* Nav hint */
.gf-nav-hint {
  position: fixed;
  bottom: 24px;
  width: 100%;
  text-align: center;
  color: rgba(255,255,255,0.3);
  font-size: 0.8rem;
  pointer-events: none;
  animation: reelBounce 2s ease-in-out infinite;
  z-index: 210;
}

/* Mobile */
@media (max-width: 480px) {
  .gf-board-row { flex-direction: column; align-items: center; }
  .gf-movelist { width: 100%; max-height: 120px; }
  .gf-filters { flex-wrap: wrap; padding-right: 48px; }
  .nav-icon-feedback { display: none; }
}

/* ============================================
   DOCS
   ============================================ */

.docs-layout {
  display: flex;
  gap: 2rem;
  max-width: 900px;
  margin: 0 auto;
}

.docs-nav {
  position: sticky;
  top: 80px;
  width: 160px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-self: flex-start;
}

.docs-nav-link {
  color: #8b949e;
  text-decoration: none;
  font-size: 0.8rem;
  padding: 6px 10px;
  border-radius: 6px;
  border-left: 2px solid transparent;
  transition: all 0.15s;
}
.docs-nav-link:hover { color: #e6edf3; background: rgba(255,255,255,0.04); }
.docs-nav-link.active {
  color: #e6edf3;
  border-left-color: #d4a843;
  background: rgba(255,255,255,0.04);
}

.docs-content { flex: 1; min-width: 0; }

.docs-section {
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}
.docs-section:last-child { border-bottom: none; }
.docs-section h2 { font-size: 1.3rem; margin-bottom: 0.75rem; color: #e6edf3; }
.docs-section h4 { font-size: 0.95rem; margin: 1rem 0 0.4rem; color: #c9d1d9; }
.docs-section p { font-size: 0.88rem; line-height: 1.65; color: #b1bac4; margin-bottom: 0.5rem; }
.docs-section ul, .docs-section ol { font-size: 0.88rem; line-height: 1.65; color: #b1bac4; padding-left: 1.25rem; margin-bottom: 0.75rem; }
.docs-section li { margin-bottom: 0.25rem; }

.docs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin: 0.5rem 0 1rem;
}
.docs-table td {
  padding: 6px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  color: #b1bac4;
}
.docs-table td:first-child { color: #e6edf3; font-weight: 500; white-space: nowrap; width: 40%; }
.docs-table tr:last-child td { border-bottom: none; }

.docs-section kbd {
  display: inline-block;
  padding: 2px 7px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: #e6edf3;
}

.docs-section a { color: #58a6ff; text-decoration: none; }
.docs-section a:hover { text-decoration: underline; }

@media (max-width: 640px) {
  .docs-layout { flex-direction: column; gap: 1rem; }
  .docs-nav { position: static; width: 100%; flex-direction: row; flex-wrap: wrap; gap: 4px; }
  .docs-nav-link { border-left: none; border-bottom: 2px solid transparent; }
  .docs-nav-link.active { border-left: none; border-bottom-color: #d4a843; }
}

/* ============================================
   DEBUG LOGGER PANEL (Ctrl+Shift+L)
   ============================================ */

#logger-panel {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 40vh;
  background: #0d1117;
  border-top: 2px solid #30363d;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.logger-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: #161b22;
  border-bottom: 1px solid #21262d;
  flex-shrink: 0;
  color: #8b949e;
  font-weight: 600;
}

.logger-actions { display: flex; gap: 6px; align-items: center; }

.logger-select {
  background: #21262d;
  border: 1px solid #30363d;
  color: #e6edf3;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.7rem;
}

.logger-btn {
  background: #21262d;
  border: 1px solid #30363d;
  color: #e6edf3;
  padding: 2px 10px;
  border-radius: 4px;
  font-size: 0.7rem;
  cursor: pointer;
}
.logger-btn:hover { background: #30363d; }

.logger-output {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
  scrollbar-width: thin;
  scrollbar-color: #30363d transparent;
}

.logger-line {
  padding: 1px 12px;
  display: flex;
  gap: 8px;
  white-space: nowrap;
}
.logger-line:hover { background: rgba(255,255,255,0.03); }

.logger-ts { color: #484f58; min-width: 10ch; }
.logger-lvl { min-width: 4ch; font-weight: 700; }
.logger-mod { color: #58a6ff; min-width: 10ch; }
.logger-msg { color: #e6edf3; }
.logger-data { color: #656d76; font-size: 0.7rem; }

.logger-info .logger-lvl { color: #58a6ff; }
.logger-warn .logger-lvl { color: #d4a843; }
.logger-error .logger-lvl { color: #f85149; }
.logger-error .logger-msg { color: #f85149; }
.logger-debug .logger-lvl { color: #8b949e; }
.logger-debug .logger-msg { color: #8b949e; }
