@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

html {
  scrollbar-gutter: stable;
}

:root {
  --bg-primary: #0b0f19;
  --bg-secondary: #131b2e;
  --bg-glass: rgba(20, 30, 55, 0.6);
  --border-glass: rgba(255, 255, 255, 0.06);
  --accent-cyan: #06b6d4;
  --accent-blue: #3b82f6;
  --accent-gradient: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --color-win: #10b981;
  --color-loss: #ef4444;
  --color-draw: #f59e0b;
  --square-light: #eae9d2;
  --square-dark: #4b7399;
  --square-highlight-from: rgba(6, 182, 212, 0.3);
  --square-highlight-to: rgba(59, 130, 246, 0.4);
  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  background-image: 
    radial-gradient(at 0% 0%, rgba(6, 182, 212, 0.15) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(59, 130, 246, 0.15) 0px, transparent 50%);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

header {
  padding: 1rem 2rem;
  background: rgba(11, 15, 25, 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-glass);
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 10;
  position: sticky;
  top: 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  font-size: 1.5rem;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.5px;
}

.logo svg {
  stroke: url(#cyan-blue-grad);
  fill: none;
}

.nav-links {
  display: flex;
  gap: 1.5rem;
}

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
  font-size: 0.95rem;
}

.nav-link:hover, .nav-link.active {
  color: var(--text-primary);
  text-shadow: 0 0 10px rgba(6, 182, 212, 0.3);
}

.main-content {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem 2rem;
  gap: 2rem;
}

/* Chess Board Area Layout */
.board-section {
  display: flex;
  flex-direction: column;
  flex: 0 1 auto;
  width: calc(100vh - 220px);
  max-width: 700px;
  gap: 0.5rem;
}

.player-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  padding: 0.55rem 1rem;
  border-radius: 12px;
  backdrop-filter: blur(8px);
}

.player-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.player-avatar {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-glass);
}

.player-name {
  font-weight: 600;
  font-size: 1rem;
}

.player-title {
  font-size: 0.75rem;
  background: rgba(255, 255, 255, 0.1);
  padding: 1px 4px;
  border-radius: 4px;
  color: var(--text-secondary);
  margin-left: 0.5rem;
}

.captured-pieces {
  display: flex;
  gap: 2px;
  min-height: 20px;
  margin-top: 4px;
}

.captured-piece {
  font-size: 14px;
  color: var(--text-secondary);
  opacity: 0.75;
}

.captured-diff {
  font-size: 0.75rem;
  color: var(--accent-cyan);
  font-weight: bold;
  margin-left: 4px;
  align-self: center;
}

.timer {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 600;
  background: rgba(0, 0, 0, 0.3);
  padding: 0.25rem 0.75rem;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  transition: all 0.3s ease;
}

.timer.active {
  color: #fff;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.2);
  background: rgba(6, 182, 212, 0.1);
}

.timer.danger {
  color: var(--color-loss);
  animation: pulse-danger 1s infinite alternate;
}

@keyframes pulse-danger {
  from { box-shadow: 0 0 5px rgba(239, 68, 68, 0.2); background: rgba(239, 68, 68, 0.05); }
  to { box-shadow: 0 0 15px rgba(239, 68, 68, 0.5); background: rgba(239, 68, 68, 0.2); }
}

.board-container-wrapper {
  display: flex;
  gap: 1rem;
  align-items: stretch;
  width: 100%;
}

/* Evaluation Bar */
.eval-bar-container {
  width: 24px;
  background: #27272a;
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  border: 1px solid var(--border-glass);
}

.eval-bar-black {
  background: #18181b;
  flex: 1;
  transition: flex-grow 0.5s ease-out;
}

.eval-bar-white {
  background: #f4f4f5;
  height: 50%;
  transition: height 0.5s ease-out;
}

.eval-text {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  pointer-events: none;
  mix-blend-mode: difference;
  color: #fff;
  z-index: 2;
}

.eval-text.top {
  top: 6px;
}

.eval-text.bottom {
  bottom: 6px;
}

/* Customizing cm-chessboard styles */
.board-container {
  width: 100%;
  aspect-ratio: 1;
  max-height: calc(100vh - 220px);
  max-width: calc(100vh - 220px);
  margin: 0 auto;
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border-glass);
}

.cm-chessboard .square.white {
  /* Controlled by theme classes (chessboard-js, blue, green, default) in cm-chessboard.css */
}

.cm-chessboard .square.black {
  /* Controlled by theme classes (chessboard-js, blue, green, default) in cm-chessboard.css */
}

/* Move Marker Highlights */
.cm-chessboard .marker-frame {
  stroke: var(--accent-cyan) !important;
  stroke-width: 2.5px !important;
}

.cm-chessboard .marker-square {
  fill: rgba(6, 182, 212, 0.2) !important;
}

.cm-chessboard .marker-checkmate {
  fill: rgba(239, 68, 68, 0.55) !important; /* Soft Red for checkmated King */
}

.cm-chessboard .marker-draw {
  fill: rgba(148, 163, 184, 0.45) !important; /* Slate Gray for draw */
}

.cm-chessboard .marker-wrong {
  fill: rgba(239, 68, 68, 0.45) !important; /* Semi-transparent red for wrong moves */
}

.cm-chessboard .marker-correct {
  fill: rgba(16, 185, 129, 0.35) !important; /* Semi-transparent green for correct moves */
}

/* Sidebar / Controls Panel */
.control-section {
  flex: 1;
  max-width: 540px;
  min-width: 320px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-height: calc(100vh - 90px);
}

.card {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: 16px;
  padding: 1.5rem;
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
}

.card-title {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Settings Form */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.options-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.option-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-glass);
  color: var(--text-secondary);
  padding: 0.6rem 0.5rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.option-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--text-primary);
}

.option-btn.selected {
  background: var(--accent-gradient);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 12px rgba(6, 182, 212, 0.3);
}

/* Level Slider */
.level-slider-wrapper {
  background: rgba(0, 0, 0, 0.2);
  padding: 1rem;
  border-radius: 10px;
  border: 1px solid var(--border-glass);
}

.level-info {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.level-name {
  font-weight: 700;
  color: var(--accent-cyan);
}

.level-rating {
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

.slider {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: #1e293b;
  outline: none;
  cursor: pointer;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-cyan);
  cursor: pointer;
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.5);
  transition: transform 0.1s ease;
}

.slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.start-btn {
  background: var(--accent-gradient);
  color: #fff;
  border: none;
  padding: 0.85rem;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(6, 182, 212, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.start-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(6, 182, 212, 0.4);
}

.promotion-btn:hover {
  background: rgba(255, 255, 255, 0.15) !important;
  border-color: rgba(255, 255, 255, 0.3) !important;
  transform: translateY(-2px);
}

/* Moves List Card */
.moves-card {
  flex: 1;
  min-height: 250px;
}

.moves-list {
  flex: 1;
  overflow-y: auto;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  padding-right: 0.5rem;
  max-height: 220px;
  display: grid;
  grid-template-columns: 35px 1fr 1fr;
  row-gap: 0.4rem;
  align-content: start;
}

.move-row-num {
  color: var(--text-muted);
  font-weight: 500;
}

.move-cell {
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.15s ease;
}

.move-cell:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.move-cell.active {
  background: rgba(6, 182, 212, 0.15);
  color: var(--accent-cyan);
  font-weight: 600;
}

/* Game Actions list */
.game-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  border-top: 1px solid var(--border-glass);
  padding-top: 1rem;
}

.action-btn {
  flex: 1;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-glass);
  color: var(--text-secondary);
  padding: 0.5rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.2s ease;
}

.action-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.15);
}

.action-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.action-btn.btn-highlight {
  color: #ffffff !important;
  font-weight: 700;
  border-color: rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.12);
}

.action-btn.btn-highlight:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.6);
}

/* Status / Alert Bar */
.game-status-banner {
  background: rgba(6, 182, 212, 0.08);
  border: 1px solid rgba(6, 182, 212, 0.2);
  color: var(--accent-cyan);
  padding: 0.75rem 1rem;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  animation: fadeIn 0.3s ease;
}

.game-status-banner.thinking {
  background: rgba(59, 130, 246, 0.08);
  border-color: rgba(59, 130, 246, 0.2);
  color: var(--accent-blue);
}

.game-status-banner.game-over {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.2);
  color: var(--color-win);
}

.game-status-banner.error {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.2);
  color: var(--color-loss);
}

/* Engine Console Log */
.console-card {
  margin-top: auto;
}

.console-log {
  background: rgba(0, 0, 0, 0.3);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: #22c55e;
  padding: 0.75rem;
  border-radius: 8px;
  height: 120px;
  overflow-y: auto;
  border: 1px solid var(--border-glass);
}

.connection-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 2px 8px;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 9999px;
  border: 1px solid transparent;
  transition: all 0.2s ease-in-out;
}

.connection-status-pill .status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.connection-status-pill.connected {
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.3);
  color: #4ade80;
}
.connection-status-pill.connected .status-dot {
  background: #22c55e;
  box-shadow: 0 0 6px #22c55e;
}

.connection-status-pill.connecting {
  background: rgba(234, 179, 8, 0.12);
  border-color: rgba(234, 179, 8, 0.3);
  color: #facc15;
}
.connection-status-pill.connecting .status-dot {
  background: #eab308;
  animation: pulse-dot 1.2s infinite ease-in-out;
}

.connection-status-pill.disconnected {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.3);
  color: #f87171;
}
.connection-status-pill.disconnected .status-dot {
  background: #ef4444;
  box-shadow: 0 0 4px #ef4444;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 0.3; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.2); }
}

/* Modal dialogs */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.1s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: 20px;
  padding: 2rem;
  max-width: 480px;
  width: 90%;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
  transform: translateY(20px);
  transition: transform 0.1s ease;
}

.modal-overlay.active .modal-content {
  transform: translateY(0);
}

.modal-header {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  text-align: center;
}

.modal-body {
  margin-bottom: 1.5rem;
}

.modal-footer {
  display: flex;
  justify-content: center;
}

.confirm-modal-content {
  max-width: 420px;
}

.confirm-modal-body {
  color: var(--text-secondary);
  font-size: 1rem;
  text-align: center;
}

.confirm-modal-actions {
  gap: 0.75rem;
}

.confirm-modal-actions .action-btn {
  max-width: 150px;
  padding: 0.7rem 1rem;
  font-weight: 700;
}

.confirm-cancel-btn {
  color: var(--text-primary);
}

.confirm-danger-btn {
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(239, 68, 68, 0.45);
  color: var(--color-loss);
}

.confirm-danger-btn:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.22);
  border-color: rgba(239, 68, 68, 0.65);
  color: #fff;
}

/* Pawn Promotion dialog */
.promotion-dialog {
  position: absolute;
  background: var(--bg-secondary);
  border: 2px solid var(--accent-cyan);
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  z-index: 50;
  display: flex;
  flex-direction: row;
  gap: 8px;
  padding: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.promotion-dialog.active {
  opacity: 1;
  pointer-events: auto;
}

.promotion-option {
  width: 60px;
  height: 60px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: background-color 0.15s, transform 0.15s;
  font-size: 2.5rem;
  color: var(--text-primary);
}

.promotion-option:hover {
  background-color: rgba(255,255,255,0.15);
  transform: translateY(-2px);
}



/* Loading spinner */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,0.1);
  border-top-color: var(--accent-cyan);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Responsive adjustments for mobile/tablets */
@media (max-width: 860px) {
  .main-content {
    flex-direction: column;
    align-items: center;
    padding: 0.75rem;
  }
  .board-section {
    width: 100%;
    max-width: min(700px, calc(100vh - 180px));
  }
  .control-section {
    width: 100%;
    max-width: 100%;
    flex: none;
  }
}

/* Header Auth */
.header-auth {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.auth-btn {
  background: transparent;
  border: 1px solid var(--border-glass);
  color: var(--text-secondary);
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.auth-btn:hover {
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--text-primary);
}

.auth-btn.primary {
  background: var(--accent-gradient);
  border-color: transparent;
  color: #fff;
}

.auth-btn.primary:hover {
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.4);
}

.username-display {
  font-size: 0.95rem;
  color: var(--accent-cyan);
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Auth Modal Specifics */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-input {
  width: 100%;
  padding: 0.65rem 0.8rem;
  border-radius: 8px;
  border: 1px solid var(--border-glass);
  background: rgba(0, 0, 0, 0.3);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}

.form-input:focus {
  border-color: var(--accent-cyan);
}

.auth-toggle-link {
  color: var(--accent-cyan);
  text-decoration: none;
  cursor: pointer;
  font-weight: 500;
}

.auth-toggle-link:hover {
  text-decoration: underline;
}

/* Matchmaking Lobby styling */
.lobby-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}

.lobby-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 200px;
  overflow-y: auto;
  margin-top: 0.5rem;
  border: 1px solid var(--border-glass);
  border-radius: 8px;
  padding: 0.5rem;
  background: rgba(0, 0, 0, 0.15);
}

.lobby-empty {
  color: var(--text-muted);
  text-align: center;
  font-size: 0.85rem;
  padding: 1.5rem 0;
}

.lobby-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0.75rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-glass);
  border-radius: 6px;
  font-size: 0.85rem;
  transition: background 0.2s;
}

.lobby-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.lobby-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.lobby-item-players {
  font-weight: 600;
  color: var(--text-primary);
}

.lobby-item-time {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.join-game-btn {
  background: var(--accent-cyan);
  color: #fff;
  border: none;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
  font-size: 0.8rem;
}

.join-game-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.decline-game-btn {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  font-size: 0.8rem;
}

.decline-game-btn:hover {
  background: rgba(239, 68, 68, 0.35);
  color: #fff;
}

.incoming-challenge-item {
  border-color: rgba(6, 182, 212, 0.4);
  background: rgba(6, 182, 212, 0.05);
}

.incoming-challenge-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.target-search-item {
  padding: 0.5rem 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: background 0.15s;
}

.target-search-item:last-child {
  border-bottom: none;
}

.target-search-item:hover {
  background: rgba(6, 182, 212, 0.15);
}

.target-search-item-name {
  font-weight: 600;
  color: #fff;
  font-size: 0.85rem;
}

.target-search-item-rating {
  font-size: 0.75rem;
  color: var(--accent-cyan);
  font-weight: 600;
}

.game-link-box {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-glass);
  border-radius: 10px;
  padding: 0.85rem;
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.game-link-input-wrapper {
  display: flex;
  gap: 0.5rem;
}

.game-link-input {
  flex: 1;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-glass);
  color: var(--text-secondary);
  padding: 0.45rem 0.6rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copy-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  color: #fff;
  padding: 0.45rem 0.85rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 600;
  transition: background 0.2s;
}

.copy-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Opening Explorer Styles */
#explorer-card {
  display: flex;
  flex-direction: column;
}

.explorer-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.explorer-header-row {
  border-bottom: 1px solid var(--border-glass);
  color: var(--text-muted);
  font-weight: 600;
  text-align: left;
}

.explorer-header-cell {
  padding: 0.4rem 0.5rem;
}

.explorer-row {
  border-bottom: 1px solid rgba(255, 255, 255, 0.02);
  cursor: pointer;
  transition: background 0.15s ease;
}

.explorer-row:hover {
  background: rgba(6, 182, 212, 0.08);
}

.explorer-cell {
  padding: 0.5rem 0.5rem;
  vertical-align: middle;
}

.explorer-move-san {
  font-weight: 700;
  color: var(--accent-cyan);
  font-family: var(--font-mono);
}

.explorer-games-count {
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

.explorer-bar-container {
  min-width: 120px;
  max-width: 180px;
}

.explorer-bar {
  display: flex;
  height: 16px;
  border-radius: 3px;
  overflow: hidden;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}

.explorer-bar-win {
  background-color: #e2e8f0;
  color: #0f172a;
}

.explorer-bar-draw {
  background-color: #64748b;
  color: #f8fafc;
}

.explorer-bar-loss {
  background-color: #1e293b;
  color: #f8fafc;
}

.explorer-empty {
  text-align: center;
  padding: 1.5rem;
  color: var(--text-muted);
  font-style: italic;
}

/* Top / Recent Games List */
.explorer-games-section {
  margin-top: 0.75rem;
  border-top: 1px solid var(--border-glass);
  padding-top: 0.5rem;
}

.explorer-games-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.explorer-game-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.35rem 0.5rem;
  border-radius: 4px;
  margin-bottom: 0.25rem;
  background: rgba(255, 255, 255, 0.01);
  font-size: 0.75rem;
}

.explorer-game-item:hover {
  background: rgba(255, 255, 255, 0.03);
}

.explorer-game-players {
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 220px;
}

.explorer-game-result {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 0.05rem 0.25rem;
  border-radius: 3px;
  font-weight: 600;
}

.explorer-result-white {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.explorer-result-black {
  background: rgba(0, 0, 0, 0.4);
  color: #ccc;
  border: 1px solid rgba(255,255,255,0.1);
}

.explorer-result-draw {
  background: rgba(245, 158, 11, 0.2);
  color: var(--color-draw);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
}

.toast-notification {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  padding: 12px 24px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.95rem;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  gap: 8px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  opacity: 0;
  transform: translateY(-20px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.toast-notification.active {
  opacity: 1;
  transform: translateY(0);
}

/* =============================================
   Spectator Page Styles
   ============================================= */

/* Spectate Layout */
.spectate-layout {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem;
  gap: 1.5rem;
  flex: 1;
}

/* Game List Card */
.spectate-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: 16px;
  padding: 1.5rem;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  width: 100%;
  max-width: 700px;
}

.spectate-card h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.spectate-card h2 .subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 400;
}

/* Live Games List */
#live-games-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.spectate-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 2rem;
  font-size: 0.95rem;
}

.spectate-live-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  transition: background 0.15s ease;
}

.spectate-live-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.spectate-live-item-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.spectate-live-item-players {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
}

.spectate-player-white {
  color: var(--text-primary);
  font-weight: 500;
}

.spectate-player-black {
  color: var(--text-primary);
  font-weight: 500;
}

.spectate-vs {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.spectate-live-item-time {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.spectate-watch-btn {
  background: var(--accent-gradient);
  border: none;
  color: white;
  padding: 0.5rem 1.25rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.1s ease;
  font-family: var(--font-sans);
}

.spectate-watch-btn:hover {
  opacity: 0.9;
  transform: scale(1.02);
}

.spectate-watch-btn:active {
  transform: scale(0.98);
}

/* Spectate Board Section */
#spectate-board-section {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  width: 100%;
  max-width: 1200px;
}

.spectate-board-wrapper {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  width: 100%;
  justify-content: center;
}

.spectate-board-container {
  position: relative;
  flex-shrink: 0;
}

.spectate-board-container #board {
  width: min(70vw, 500px);
  height: min(70vw, 500px);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

/* Evaluation Bar */
.spectate-eval-bar {
  display: flex;
  flex-direction: column;
  width: 28px;
  height: min(70vw, 500px);
  background: #1a1a2e;
  border-radius: 6px;
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
}

.eval-bar-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  background: linear-gradient(to top, #ffffff 0%, #d4d4d4 50%, #555555 100%);
  transition: height 0.3s ease;
}

.eval-bar-text {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.7rem;
  font-weight: 700;
  font-family: var(--font-mono);
  pointer-events: none;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

.eval-bar-text-white {
  top: 4px;
  color: #fff;
}

.eval-bar-text-black {
  bottom: 4px;
  color: #fff;
}

/* Spectate Info Card (right sidebar) */
#spectate-info-card {
  display: none;
  flex-direction: column;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: 16px;
  padding: 1.25rem;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  width: 280px;
  flex-shrink: 0;
  gap: 0.75rem;
}

.spectate-info-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.spectate-info-header h3 {
  font-size: 1rem;
  font-weight: 600;
}

.spectate-info-actions {
  display: flex;
  gap: 0.5rem;
}

.spectate-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.15s ease;
  font-family: var(--font-sans);
}

.spectate-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

.spectate-btn-exit {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
  color: var(--color-loss);
}

.spectate-btn-exit:hover {
  background: rgba(239, 68, 68, 0.25);
}

/* Player Display */
.spectate-player-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  border: 1px solid var(--border-glass);
}

.spectate-player-name {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  font-weight: 500;
}

.player-title {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 400;
}

.spectate-player-clock {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* Status Banner */
.game-status-banner {
  text-align: center;
  padding: 0.5rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
}

.game-status-banner.thinking {
  background: rgba(6, 182, 212, 0.1);
  color: var(--accent-cyan);
  border: 1px solid rgba(6, 182, 212, 0.2);
}

.game-status-banner.game-over {
  background: rgba(245, 158, 11, 0.1);
  color: var(--color-draw);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

/* Moves Log */
.spectate-moves-log {
  display: grid;
  grid-template-columns: auto 1fr 1fr;
  gap: 0.25rem 0.5rem;
  max-height: 200px;
  overflow-y: auto;
  font-size: 0.85rem;
  font-family: var(--font-mono);
  padding: 0.25rem;
}

.spectate-moves-log .move-row-num {
  color: var(--text-muted);
  text-align: right;
  padding: 0.1rem 0.25rem;
}

.spectate-moves-log .move-cell {
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  cursor: default;
}

.spectate-moves-log .move-cell.active {
  background: rgba(6, 182, 212, 0.15);
  color: var(--accent-cyan);
}

/* Console Log */
.spectate-console-log {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-glass);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  max-height: 100px;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.5;
}

/* Marker styles for end game indicators */
.marker-checkmate .markerSquare {
  fill: rgba(239, 68, 68, 0.5);
}

.marker-draw .markerSquare {
  fill: rgba(245, 158, 11, 0.4);
}

/* Responsive */
@media (max-width: 900px) {
  .spectate-board-wrapper {
    flex-direction: column;
    align-items: center;
  }

  #spectate-info-card {
    width: 100%;
    max-width: 500px;
  }

  .spectate-board-container #board {
    width: min(90vw, 500px);
    height: min(90vw, 500px);
  }

  .spectate-eval-bar {
    height: min(90vw, 500px);
  }
}

/* Board Theme Selector */
.board-theme-selector {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.board-theme-selector select {
  background: rgba(19, 27, 46, 0.8);
  color: var(--text-primary);
  border: 1px solid var(--border-glass);
  border-radius: 6px;
  padding: 0.35rem 0.6rem;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}

.board-theme-selector select:hover {
  flex-shrink: 0;
  gap: 0.75rem;
}

.spectate-info-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.spectate-info-header h3 {
  font-size: 1rem;
  font-weight: 600;
}

.spectate-info-actions {
  display: flex;
  gap: 0.5rem;
}

.spectate-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.15s ease;
  font-family: var(--font-sans);
}

.spectate-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

.spectate-btn-exit {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
  color: var(--color-loss);
}

.spectate-btn-exit:hover {
  background: rgba(239, 68, 68, 0.25);
}

/* Player Display */
.spectate-player-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  border: 1px solid var(--border-glass);
}

.spectate-player-name {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  font-weight: 500;
}

.player-title {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 400;
}

.spectate-player-clock {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* Status Banner */
.game-status-banner {
  text-align: center;
  padding: 0.5rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
}

.game-status-banner.thinking {
  background: rgba(6, 182, 212, 0.1);
  color: var(--accent-cyan);
  border: 1px solid rgba(6, 182, 212, 0.2);
}

.game-status-banner.game-over {
  background: rgba(245, 158, 11, 0.1);
  color: var(--color-draw);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

/* Moves Log */
.spectate-moves-log {
  display: grid;
  grid-template-columns: auto 1fr 1fr;
  gap: 0.25rem 0.5rem;
  max-height: 200px;
  overflow-y: auto;
  font-size: 0.85rem;
  font-family: var(--font-mono);
  padding: 0.25rem;
}

.spectate-moves-log .move-row-num {
  color: var(--text-muted);
  text-align: right;
  padding: 0.1rem 0.25rem;
}

.spectate-moves-log .move-cell {
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  cursor: default;
}

.spectate-moves-log .move-cell.active {
  background: rgba(6, 182, 212, 0.15);
  color: var(--accent-cyan);
}

/* Console Log */
.spectate-console-log {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-glass);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  max-height: 100px;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.5;
}

/* Marker styles for end game indicators */
.marker-checkmate .markerSquare {
  fill: rgba(239, 68, 68, 0.5);
}

.marker-draw .markerSquare {
  fill: rgba(245, 158, 11, 0.4);
}

/* Responsive */
@media (max-width: 900px) {
  .spectate-board-wrapper {
    flex-direction: column;
    align-items: center;
  }

  #spectate-info-card {
    width: 100%;
    max-width: 500px;
  }

  .spectate-board-container #board {
    width: min(90vw, 500px);
    height: min(90vw, 500px);
  }

  .spectate-eval-bar {
    height: min(90vw, 500px);
  }
}

/* Board Theme Selector */
.board-theme-selector {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.board-theme-selector select {
  background: rgba(19, 27, 46, 0.8);
  color: var(--text-primary);
  border: 1px solid var(--border-glass);
  border-radius: 6px;
  padding: 0.35rem 0.6rem;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}

.board-theme-selector select:hover {
  border-color: var(--accent-cyan);
}

/* Language Flags styling for crawlability and premium aesthetic */
.language-flags {
  position: fixed;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  z-index: 9999;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 0.6rem 0.4rem;
  border-radius: 1.5rem;
  border: 1px solid rgba(6, 182, 212, 0.3);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 15px rgba(6, 182, 212, 0.15);
  transition: background 0.3s ease, border-color 0.3s ease;
}

.language-flags:hover {
  background: rgba(15, 23, 42, 0.95);
  border-color: rgba(6, 182, 212, 0.5);
}

.flag-link {
  position: relative;
  text-decoration: none;
  cursor: pointer;
  opacity: 0.8;
  transition: opacity 0.2s ease, transform 0.2s ease, filter 0.2s ease;
  user-select: none;
  display: inline-flex;
  padding: 0.2rem;
  border-radius: 4px;
}

/* Instant Custom Tooltip Hint on Hover */
.flag-link::after {
  content: attr(data-tooltip);
  position: absolute;
  right: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%) scale(0.9);
  background: rgba(15, 23, 42, 0.96);
  color: #f8fafc;
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  font-family: var(--font-sans);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
  border: 1px solid rgba(6, 182, 212, 0.4);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5), 0 0 10px rgba(6, 182, 212, 0.15);
  z-index: 10000;
}

.flag-link::before {
  content: '';
  position: absolute;
  right: calc(100% + 4px);
  top: 50%;
  transform: translateY(-50%) scale(0.9);
  border-width: 5px 0 5px 6px;
  border-style: solid;
  border-color: transparent transparent transparent rgba(6, 182, 212, 0.4);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
  z-index: 10000;
}

.flag-link:hover::after,
.flag-link:hover::before {
  opacity: 1;
  visibility: visible;
  transform: translateY(-50%) scale(1);
}

.flag-img, .flag-svg {
  width: 22px;
  height: 15px;
  border-radius: 3px;
  display: block;
  object-fit: cover;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.flag-link:hover {
  opacity: 1;
  transform: scale(1.25);
}

.flag-link.active {
  opacity: 1;
  transform: scale(1.2);
  outline: 1.5px solid var(--accent-cyan);
  outline-offset: 1px;
  filter: drop-shadow(0 0 6px var(--accent-cyan));
}

@media (max-width: 768px) {
  .language-flags {
    display: none;
  }
}

/* Original Slate Blue Board Theme */
.cm-chessboard.original .board .square.white,
.cm-chessboard:not(.blue):not(.chessboard-js):not(.default):not(.green):not(.chess-club):not(.black-and-white) .board .square.white {
  fill: #dee7f0 !important;
}
.cm-chessboard.original .board .square.black,
.cm-chessboard:not(.blue):not(.chessboard-js):not(.default):not(.green):not(.chess-club):not(.black-and-white) .board .square.black {
  fill: #476072 !important;
}
.cm-chessboard.original.border-type-thin .board .border {
  stroke: #476072;
  stroke-width: 0.7%;
  fill: transparent;
}
.cm-chessboard.original.border-type-frame .board .border {
  fill: #dee7f0;
  stroke: none;
}
.cm-chessboard.original.border-type-frame .board .border-inner {
  fill: transparent;
  stroke: #476072;
  stroke-width: 0.7%;
}
.cm-chessboard.original .coordinates {
  pointer-events: none;
  user-select: none;
}
.cm-chessboard.original .coordinates .coordinate {
  fill: #476072;
  font-size: 7px;
  cursor: default;
}
.cm-chessboard.original .coordinates .coordinate.black {
  fill: #dee7f0;
}
.cm-chessboard.original .coordinates .coordinate.white {
  fill: #476072;
}

/* Automatic Viewport Height Responsiveness for Laptops and Short Screens */
@media (min-width: 769px) and (max-height: 900px) {
  header {
    padding: 0.35rem 1.25rem;
  }
  .main-content {
    padding: 0.35rem 1.25rem;
    gap: 1rem;
  }
  .board-section {
    width: calc(100vh - 210px) !important;
    max-width: calc(100vh - 210px) !important;
    flex: 0 1 auto;
    gap: 0.25rem;
  }
  .board-container {
    width: 100%;
    aspect-ratio: 1;
    max-height: calc(100vh - 210px) !important;
    max-width: calc(100vh - 210px) !important;
  }
  .player-bar {
    padding: 0.25rem 0.65rem;
    border-radius: 6px;
  }
  .player-avatar {
    width: 22px;
    height: 22px;
    font-size: 0.75rem;
  }
  .player-name {
    font-size: 0.8rem;
  }
  .timer {
    font-size: 1rem;
    padding: 0.1rem 0.35rem;
  }
  .control-section {
    gap: 0.5rem;
    max-height: calc(100vh - 60px);
    overflow-y: auto;
    padding-right: 0.25rem;
  }
  .card {
    padding: 0.65rem 0.85rem;
    border-radius: 10px;
  }
  .card-title {
    font-size: 0.9rem;
    margin-bottom: 0.35rem;
  }
  .form-group {
    margin-bottom: 0.4rem;
  }
  .moves-card {
    min-height: 100px;
  }
  .moves-list {
    max-height: calc(100vh - 270px);
    font-size: 0.78rem;
  }
  .game-status-banner {
    padding: 0.35rem 0.5rem;
    font-size: 0.8rem;
    margin-bottom: 0.4rem;
  }
  .game-actions {
    margin-top: 0.4rem;
    padding-top: 0.4rem;
  }
  .action-btn {
    padding: 0.3rem;
    font-size: 0.75rem;
  }
  .site-footer,
  .blog-footer {
    padding: 0.35rem 0.75rem !important;
    font-size: 0.72rem !important;
    margin-top: 0.25rem !important;
  }
}

.site-footer,
.blog-footer {
  text-align: center;
  padding: 0.65rem 1rem;
  color: #94a3b8;
  font-size: 0.82rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin-top: auto;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  width: 100%;
  box-sizing: border-box;
  z-index: 10;
}

/* Desktop / Laptop: Universal Viewport Auto-Fitting */
@media (min-width: 769px) {
  #board,
  .board-container {
    width: 100% !important;
    max-width: min(700px, calc(100vh - 270px)) !important;
    max-height: min(700px, calc(100vh - 270px)) !important;
    aspect-ratio: 1 !important;
  }

  #board svg,
  .board-container svg,
  .cm-chessboard {
    max-width: min(700px, calc(100vh - 270px)) !important;
    max-height: min(700px, calc(100vh - 270px)) !important;
  }

  .board-section {
    width: min(700px, calc(100vh - 270px)) !important;
    max-width: min(700px, calc(100vh - 270px)) !important;
    flex: 0 1 auto !important;
  }

  .control-section {
    max-width: min(500px, calc(100vh - 250px)) !important;
    max-height: calc(100vh - 150px) !important;
    overflow-y: auto !important;
  }

  .mobile-nav-toggle,
  .mobile-drawer-footer {
    display: none !important;
  }
}

/* ==========================================================================
   Mobile Phone Responsive Optimization (Screens <= 768px)
   ========================================================================== */
@media (max-width: 768px) {
  html, body {
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
    position: relative !important;
  }

  /* Compact Mobile Header */
  header {
    padding: 0.5rem 0.85rem !important;
    min-height: 56px !important;
    max-height: 56px !important;
    width: 100% !important;
    max-width: 100vw !important;
    box-sizing: border-box !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 1000 !important;
    background: rgba(11, 15, 25, 0.92) !important;
    backdrop-filter: blur(16px) !important;
  }

  header .logo {
    gap: 0.45rem !important;
    font-size: 1.05rem !important;
  }

  header .logo img {
    width: 28px !important;
    height: 28px !important;
  }

  header .logo-title-container {
    font-size: 1.05rem !important;
    font-weight: 700 !important;
  }

  header .header-right {
    display: flex !important;
    align-items: center !important;
    gap: 0.4rem !important;
  }

  /* Hide desktop theme selector from header bar on mobile (moved to drawer) */
  header .board-theme-selector {
    display: none !important;
  }

  header .header-auth {
    display: flex !important;
    align-items: center !important;
    gap: 0.35rem !important;
  }

  header .auth-btn {
    padding: 0.28rem 0.6rem !important;
    font-size: 0.78rem !important;
    border-radius: 6px !important;
  }

  header .username-display {
    font-size: 0.8rem !important;
    max-width: 100px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  header .header-auth:has(#signin-btn) .username-display {
    display: none !important;
  }

  /* Animated Hamburger Menu Button */
  .mobile-nav-toggle {
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    width: 36px !important;
    height: 32px !important;
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    padding: 7px 8px !important;
    box-sizing: border-box !important;
    transition: all 0.25s ease !important;
    margin-left: 0.2rem !important;
  }

  .mobile-nav-toggle:active {
    background: rgba(255, 255, 255, 0.12) !important;
  }

  .mobile-nav-toggle .hamburger-line {
    display: block !important;
    width: 100% !important;
    height: 2px !important;
    background: #f8fafc !important;
    border-radius: 2px !important;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
  }

  header.mobile-menu-open .mobile-nav-toggle .hamburger-line:nth-child(1) {
    transform: translateY(7px) rotate(45deg) !important;
  }
  header.mobile-menu-open .mobile-nav-toggle .hamburger-line:nth-child(2) {
    opacity: 0 !important;
    transform: scaleX(0) !important;
  }
  header.mobile-menu-open .mobile-nav-toggle .hamburger-line:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg) !important;
  }

  /* Mobile Slide-Down Navigation Drawer */
  .nav-links {
    display: none !important;
  }

  header.mobile-menu-open .nav-links {
    display: flex !important;
    position: fixed !important;
    top: 56px !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    height: calc(100dvh - 56px) !important;
    background: rgba(11, 15, 25, 0.98) !important;
    backdrop-filter: blur(24px) !important;
    -webkit-backdrop-filter: blur(24px) !important;
    flex-direction: column !important;
    align-items: stretch !important;
    padding: 1rem 1.25rem 2.5rem !important;
    gap: 0.45rem !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    box-sizing: border-box !important;
    z-index: 9999 !important;
    border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.8) !important;
    animation: mobileDrawerFadeIn 0.2s ease-out !important;
  }

  @keyframes mobileDrawerFadeIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
  }

  .nav-link {
    padding: 0.7rem 1rem !important;
    font-size: 0.98rem !important;
    font-weight: 500 !important;
    border-radius: 10px !important;
    background: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid rgba(255, 255, 255, 0.06) !important;
    color: var(--text-primary) !important;
    display: flex !important;
    align-items: center !important;
    gap: 0.75rem !important;
    text-decoration: none !important;
  }

  .nav-link.active {
    background: rgba(6, 182, 212, 0.15) !important;
    border-color: var(--accent-cyan) !important;
    color: var(--accent-cyan) !important;
    font-weight: 600 !important;
  }

  /* Unfold 'More' items directly inside drawer */
  .nav-dropdown {
    width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
  }

  .nav-dropdown .dropdown-toggle {
    display: none !important;
  }

  .nav-dropdown-menu {
    position: static !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 0.45rem !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .nav-dropdown-item {
    padding: 0.7rem 1rem !important;
    font-size: 0.98rem !important;
    font-weight: 500 !important;
    border-radius: 10px !important;
    background: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid rgba(255, 255, 255, 0.06) !important;
    color: var(--text-primary) !important;
    display: flex !important;
    align-items: center !important;
    gap: 0.75rem !important;
    text-decoration: none !important;
  }

  .nav-dropdown-item.active {
    background: rgba(6, 182, 212, 0.15) !important;
    border-color: var(--accent-cyan) !important;
    color: var(--accent-cyan) !important;
  }

  /* Mobile Drawer Footer Controls */
  .mobile-drawer-footer {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.75rem !important;
    margin-top: 0.75rem !important;
    padding-top: 0.85rem !important;
    border-top: 1px solid var(--border-glass) !important;
  }

  .mobile-theme-row {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    color: var(--text-secondary) !important;
    font-size: 0.9rem !important;
  }

  .mobile-theme-row select {
    background: #1e293b !important;
    color: #f8fafc !important;
    border: 1px solid var(--border-glass) !important;
    border-radius: 8px !important;
    padding: 0.4rem 0.6rem !important;
    font-size: 0.85rem !important;
    outline: none !important;
  }

  .mobile-lang-row {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 0.4rem !important;
    justify-content: center !important;
    padding: 0.25rem 0 !important;
  }

  .mobile-lang-row .flag-link {
    padding: 0.35rem 0.65rem !important;
    background: rgba(255, 255, 255, 0.05) !important;
    border-radius: 6px !important;
    font-size: 0.8rem !important;
    color: var(--text-secondary) !important;
    text-decoration: none !important;
    display: flex !important;
    align-items: center !important;
    gap: 0.35rem !important;
  }

  .mobile-lang-row .flag-link.active {
    background: rgba(6, 182, 212, 0.2) !important;
    color: var(--accent-cyan) !important;
    font-weight: 700 !important;
  }

  /* --- Mobile Board & Content Full-Width Fitting --- */
  .main-content {
    flex-direction: column !important;
    align-items: center !important;
    padding: 0.5rem 0.5rem 1.5rem !important;
    gap: 0.65rem !important;
    width: 100% !important;
    max-width: 100vw !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
  }

  .board-section {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    flex: none !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
  }

  .board-container-wrapper {
    width: 100% !important;
    max-width: 100% !important;
    display: flex !important;
    flex-direction: row !important;
    justify-content: center !important;
    align-items: stretch !important;
    gap: 0.35rem !important;
    box-sizing: border-box !important;
  }

  .eval-bar-container {
    width: 12px !important;
    border-radius: 4px !important;
    flex-shrink: 0 !important;
  }

  #board,
  .board-container {
    flex: 1 1 auto !important;
    width: calc(100vw - 20px) !important;
    max-width: calc(100vw - 20px) !important;
    height: calc(100vw - 20px) !important;
    max-height: calc(100vw - 20px) !important;
    aspect-ratio: 1 / 1 !important;
    margin: 0 auto !important;
    box-sizing: border-box !important;
    touch-action: manipulation !important;
  }

  .board-container-wrapper:has(.eval-bar-container) #board,
  .board-container-wrapper:has(.eval-bar-container) .board-container,
  .eval-bar-container + #board,
  .eval-bar-container + .board-container {
    width: calc(100vw - 36px) !important;
    max-width: calc(100vw - 36px) !important;
    height: calc(100vw - 36px) !important;
    max-height: calc(100vw - 36px) !important;
  }

  #board svg,
  .board-container svg,
  .cm-chessboard {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
  }

  .board-resize-handle {
    display: none !important;
  }

  .player-bar {
    width: 100% !important;
    max-width: calc(100vw - 20px) !important;
    box-sizing: border-box !important;
    padding: 0.35rem 0.6rem !important;
    font-size: 0.82rem !important;
    border-radius: 8px !important;
  }

  .player-avatar {
    width: 26px !important;
    height: 26px !important;
    border-radius: 6px !important;
  }

  .timer {
    font-size: 0.95rem !important;
    padding: 0.15rem 0.45rem !important;
  }

  .control-section {
    width: 100% !important;
    max-width: calc(100vw - 20px) !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    max-height: none !important;
    overflow-y: visible !important;
    flex: none !important;
  }

  .card {
    padding: 0.75rem !important;
    border-radius: 12px !important;
  }

  .home-videos-section {
    width: 100% !important;
    max-width: 100vw !important;
    box-sizing: border-box !important;
    margin: 1.5rem auto !important;
    padding: 0 0.75rem !important;
  }

  .site-footer,
  .blog-footer {
    padding: 0.5rem 0.75rem !important;
    font-size: 0.75rem !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
  }
}

/* Interactive Board Resize Handle */
.board-resize-handle {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 24px;
  height: 24px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--border-glass);
  border-top-left-radius: 8px;
  border-bottom-right-radius: 10px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: se-resize;
  z-index: 90;
  opacity: 0.65;
  transition: opacity 0.2s ease, background 0.2s ease, color 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
  user-select: none;
  backdrop-filter: blur(4px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.board-container:hover .board-resize-handle,
.board-resize-handle:hover,
.board-resize-handle.active {
  opacity: 1;
  color: #38bdf8;
  background: rgba(15, 23, 42, 0.95);
  border-color: rgba(56, 189, 248, 0.5);
}

.board-resize-handle:active,
.board-resize-handle.active {
  transform: scale(1.1);
  color: #38bdf8;
}

/* ==========================================================================
   YouTube Videos Showcase & Transcript Player Styles
   ========================================================================== */

.home-videos-section {
  width: 100%;
  max-width: 1400px;
  margin: 3.5rem auto 5rem;
  padding: 0 1.5rem;
}

.home-videos-container {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.home-videos-section .section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1.5rem;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border-glass);
  padding-bottom: 1.25rem;
}

.section-title-wrap h2 {
  font-size: 1.75rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.section-title-wrap p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.section-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.video-search-wrap input {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-glass);
  border-radius: 8px;
  padding: 0.5rem 1rem;
  color: #fff;
  font-size: 0.9rem;
  width: 260px;
  transition: all 0.2s ease;
}

.video-search-wrap input:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.3);
}

.view-all-link {
  color: var(--accent-cyan);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: transform 0.15s ease, color 0.15s ease;
}

.view-all-link:hover {
  transform: translateX(4px);
  color: #38bdf8;
}

/* Videos Grid */
.videos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

.videos-loading, .videos-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-secondary);
  font-size: 1rem;
  background: var(--bg-glass);
  border-radius: 12px;
  border: 1px dashed var(--border-glass);
}

/* Videos Search & Filter Bar */
.search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.search-input-wrap .search-icon {
  position: absolute;
  left: 1.25rem;
  font-size: 1.1rem;
  color: var(--text-secondary);
  pointer-events: none;
}

.search-input-wrap input {
  width: 100%;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  padding: 0.85rem 3rem 0.85rem 3.25rem;
  color: #fff;
  font-size: 1rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(10px);
}

.search-input-wrap input:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 20px rgba(6, 182, 212, 0.35);
  background: rgba(15, 23, 42, 0.95);
}

.search-clear-btn {
  position: absolute;
  right: 1rem;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #94a3b8;
  font-size: 0.85rem;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.search-clear-btn:hover {
  background: rgba(239, 68, 68, 0.3);
  color: #fff;
}

.videos-filters-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin: 1.25rem auto 1.5rem;
  max-width: 900px;
}

.video-filter-pill {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  color: #94a3b8;
  padding: 0.4rem 0.9rem;
  border-radius: 20px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.video-filter-pill:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}

.video-filter-pill.active {
  background: var(--accent-gradient);
  color: #fff;
  border-color: transparent;
  font-weight: 600;
  box-shadow: 0 2px 10px rgba(6, 182, 212, 0.3);
}

.videos-status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 0.5rem 0 1.25rem;
  padding: 0 0.25rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.videos-count-badge {
  font-weight: 500;
  color: #cbd5e1;
}

.videos-pagination-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  margin: 3.5rem 0 2rem;
  width: 100%;
}

.videos-pagination {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.75rem;
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.75) 0%, rgba(15, 23, 42, 0.9) 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 9999px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 16px 36px -8px rgba(0, 0, 0, 0.65), 
              0 0 0 1px rgba(255, 255, 255, 0.05),
              inset 0 1px 0 rgba(255, 255, 255, 0.15);
  user-select: none;
}

.pagination-divider {
  width: 1px;
  height: 22px;
  background: rgba(255, 255, 255, 0.12);
  margin: 0 0.25rem;
}

.page-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  height: 38px;
  min-width: 38px;
  border-radius: 9999px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  line-height: 1;
}

.page-btn-num {
  width: 38px;
  padding: 0;
  border-radius: 50%;
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid transparent;
}

.page-btn-num:hover:not(:disabled):not(.active) {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.page-btn-nav {
  padding: 0 1.15rem;
  gap: 0.5rem;
  font-size: 0.88rem;
  letter-spacing: 0.02em;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
}

.page-nav-icon {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.prev-btn:hover:not(:disabled) .page-nav-icon {
  transform: translateX(-3px);
}

.next-btn:hover:not(:disabled) .page-nav-icon {
  transform: translateX(3px);
}

.page-btn-nav:hover:not(:disabled) {
  background: rgba(6, 182, 212, 0.16);
  border-color: rgba(6, 182, 212, 0.5);
  color: #38bdf8;
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(6, 182, 212, 0.25);
}

.page-btn:active:not(:disabled) {
  transform: translateY(0) scale(0.96);
}

.page-btn-num.active {
  background: linear-gradient(135deg, #06b6d4 0%, #2563eb 100%);
  color: #ffffff;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 0 18px rgba(6, 182, 212, 0.55), 0 4px 12px rgba(37, 99, 235, 0.4);
  transform: scale(1.08);
}

.page-btn:disabled {
  opacity: 0.25;
  background: transparent;
  border-color: transparent;
  color: #475569;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.page-ellipsis {
  color: #64748b;
  width: 26px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  letter-spacing: 2px;
  font-weight: 700;
  user-select: none;
}

.pagination-quick-info {
  font-size: 0.84rem;
  color: var(--text-secondary);
  font-weight: 500;
  letter-spacing: 0.02em;
  opacity: 0.85;
}

@media (max-width: 640px) {
  .videos-pagination {
    gap: 0.2rem;
    padding: 0.35rem 0.45rem;
  }
  .pagination-divider {
    display: none;
  }
  .page-btn {
    height: 34px;
    min-width: 34px;
    font-size: 0.84rem;
  }
  .page-btn-num {
    width: 34px;
  }
  .page-btn-nav {
    padding: 0 0.75rem;
  }
  .page-nav-text {
    display: none;
  }
  .page-ellipsis {
    width: 20px;
    font-size: 1rem;
  }
}

/* Video Card */
.video-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s ease;
  position: relative;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
}

.video-card:hover {
  transform: translateY(-5px);
  border-color: rgba(6, 182, 212, 0.5);
  box-shadow: 0 20px 35px rgba(0, 0, 0, 0.4), 0 0 20px rgba(6, 182, 212, 0.15);
}

.video-thumbnail-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #0b0f19;
  overflow: hidden;
}

.video-thumbnail {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.video-card:hover .video-thumbnail {
  transform: scale(1.04);
}

.video-fallback-banner {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem;
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.3), rgba(59, 130, 246, 0.35)), #0b0f19;
  text-align: center;
  border-bottom: 1px solid var(--border-glass);
}

.video-fallback-banner .fallback-chess-icon {
  font-size: 2.2rem;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.5));
}

.video-fallback-banner .fallback-chess-title {
  font-size: 0.85rem;
  color: #e2e8f0;
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.video-play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.25);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.video-card:hover .video-play-overlay {
  opacity: 1;
}

.play-btn-circle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(6, 182, 212, 0.9);
  color: #0b0f19;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  padding-left: 3px;
  box-shadow: 0 4px 15px rgba(6, 182, 212, 0.5);
  transform: scale(0.9);
  transition: transform 0.2s ease;
}

.video-card:hover .play-btn-circle {
  transform: scale(1);
}

.video-duration-badge {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
}

.video-lang-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(6, 182, 212, 0.85);
  color: #0b0f19;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

.video-card-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.video-badges-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.video-eco-badge {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.15);
  border: 1px solid rgba(6, 182, 212, 0.3);
  padding: 2px 6px;
  border-radius: 4px;
}

.video-channel-name {
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 500;
}

.video-title {
  color: #fff;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: 0.5rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.video-desc {
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.4;
  margin-bottom: 1rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.video-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 0.75rem;
}

.video-transcript-indicator {
  color: #38bdf8;
  font-weight: 500;
}

.video-watch-action {
  color: var(--accent-cyan);
  font-weight: 600;
}

/* Video Modal Dialog */
.video-modal-content {
  max-width: 1100px;
  width: 95%;
  max-height: 90vh;
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #0f172a;
  border: 1px solid var(--border-glass);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.6);
}

.video-modal-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 80%;
}

.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 0.2rem 0.6rem;
  transition: color 0.15s;
}

.modal-close-btn:hover {
  color: #fff;
}

.video-modal-body {
  display: grid;
  grid-template-columns: 1.8fr 1.2fr;
  height: 600px;
  overflow: hidden;
}

.video-player-container {
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.yt-iframe-wrap {
  width: 100%;
  height: 100%;
}

.yt-iframe-wrap iframe {
  width: 100%;
  height: 100%;
}

/* Transcript Sidebar */
.video-transcript-sidebar {
  display: flex;
  flex-direction: column;
  background: #0b0f19;
  border-left: 1px solid var(--border-glass);
  height: 100%;
  overflow: hidden;
}

.transcript-header {
  padding: 1rem;
  border-bottom: 1px solid var(--border-glass);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.transcript-search-box {
  width: 100%;
  padding: 0.4rem 0.8rem;
  background: #1e293b;
  border: 1px solid var(--border-glass);
  border-radius: 6px;
  color: #fff;
  font-size: 0.85rem;
}

.transcript-search-box:focus {
  outline: none;
  border-color: var(--accent-cyan);
}

.transcript-segments-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.transcript-item {
  display: flex;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease;
  font-size: 0.85rem;
  line-height: 1.4;
}

.transcript-item:hover {
  background: rgba(6, 182, 212, 0.12);
}

.transcript-timestamp {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent-cyan);
  white-space: nowrap;
  font-size: 0.75rem;
  margin-top: 1px;
}

.transcript-text {
  color: #e2e8f0;
}

.transcript-empty, .transcript-loading {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.transcript-fulltext {
  padding: 1rem;
  color: #cbd5e1;
  font-size: 0.9rem;
  line-height: 1.6;
  white-space: pre-wrap;
}

/* Responsive adjustments */
@media (max-width: 900px) {
  .video-modal-body {
    grid-template-columns: 1fr;
    height: auto;
    max-height: 75vh;
    overflow-y: auto;
  }
  .yt-iframe-wrap {
    aspect-ratio: 16 / 9;
    height: auto;
  }
  .video-transcript-sidebar {
    height: 300px;
    border-left: none;
    border-top: 1px solid var(--border-glass);
  }
}

/* Opening Page Video Fallback & YouTube Search Pill */
.opening-video-yt-fallback {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  padding: 1.25rem 1.5rem;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  grid-column: 1 / -1;
  transition: all 0.2s ease;
  backdrop-filter: blur(8px);
}

.opening-video-yt-fallback:hover {
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(20, 30, 55, 0.75);
}

.yt-fallback-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 10px;
  background: rgba(239, 68, 68, 0.15);
  flex-shrink: 0;
}

.yt-fallback-text {
  flex: 1;
}

.yt-fallback-title {
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 0.25rem;
}

.yt-fallback-sub {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.yt-fallback-action {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.2rem;
  background: #dc2626;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 8px;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.2s ease, transform 0.15s ease;
}

.yt-fallback-action:hover {
  background: #ef4444;
  transform: translateY(-1px);
}

.opening-yt-more-link {
  grid-column: 1 / -1;
  margin-top: 1rem;
  display: flex;
  justify-content: flex-end;
}

.yt-search-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  border-radius: 20px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.2s ease;
}

.yt-search-pill:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}

@media (max-width: 640px) {
  .opening-video-yt-fallback {
    flex-direction: column;
    align-items: flex-start;
  }
  .yt-fallback-action {
    width: 100%;
    justify-content: center;
  }
}

/* ==========================================================================
   NAVIGATION DROPDOWN ("More ▾")
   ========================================================================== */
.nav-dropdown {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.dropdown-toggle {
  background: none;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text-secondary);
  font-weight: 500;
  padding: 0;
  transition: color 0.2s ease;
}

.dropdown-toggle:hover,
.dropdown-toggle.active {
  color: var(--text-primary);
  text-shadow: 0 0 10px rgba(6, 182, 212, 0.3);
}

.dropdown-caret {
  font-size: 0.7rem;
  transition: transform 0.2s ease;
}

.nav-dropdown.open .dropdown-caret {
  transform: rotate(180deg);
}

.nav-dropdown-menu {
  position: absolute;
  top: calc(100% + 0.85rem);
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
  background: rgba(15, 23, 42, 0.96);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.6), 0 0 1px rgba(6, 182, 212, 0.3);
  border-radius: 12px;
  padding: 0.45rem;
  min-width: 195px;
  display: none;
  flex-direction: column;
  gap: 0.25rem;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown.open .nav-dropdown-menu {
  display: flex;
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.nav-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.85rem;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 8px;
  transition: all 0.15s ease;
}

.nav-dropdown-item:hover,
.nav-dropdown-item.active {
  color: var(--text-primary);
  background: rgba(6, 182, 212, 0.14);
}

.dropdown-item-icon {
  font-size: 1.1rem;
}

/* ==========================================================================
   BLOG & COMMUNITY SYSTEM STYLES
   ========================================================================== */
.blog-main-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
  width: 100%;
}

.blog-hero {
  text-align: center;
  padding: 3rem 1rem 2.5rem;
  background: radial-gradient(circle at center, rgba(6, 182, 212, 0.1) 0%, transparent 70%);
  border-radius: 20px;
  margin-bottom: 2.5rem;
}

.blog-hero-content {
  max-width: 800px;
  margin: 0 auto;
}

.blog-badge-pill {
  display: inline-block;
  background: rgba(6, 182, 212, 0.15);
  border: 1px solid var(--accent-cyan);
  color: var(--accent-cyan);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.3rem 0.85rem;
  border-radius: 20px;
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.blog-hero h1 {
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1.2;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 1rem;
}

.blog-hero p {
  color: var(--text-secondary);
  font-size: 1.1rem;
  line-height: 1.6;
  margin-bottom: 1.75rem;
}

.blog-hero-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

/* Search & Categories */
.blog-controls-section {
  margin-bottom: 2rem;
}

.blog-search-bar {
  position: relative;
  max-width: 650px;
  margin: 0 auto 1.5rem;
}

.blog-search-bar input {
  width: 100%;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  padding: 0.85rem 2.5rem 0.85rem 2.75rem;
  color: #fff;
  font-size: 1rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  transition: all 0.2s ease;
}

.blog-search-bar input:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 16px rgba(6, 182, 212, 0.35);
}

.blog-search-bar .search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  opacity: 0.6;
}

.clear-search-btn {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
}

.blog-categories-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.blog-category-pills {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.blog-pill {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  color: var(--text-secondary);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.blog-pill:hover,
.blog-pill.active {
  background: rgba(6, 182, 212, 0.18);
  border-color: var(--accent-cyan);
  color: #fff;
}

.write-btn-desktop {
  text-decoration: none;
}

/* Featured Hero Card */
.blog-featured-section {
  margin-bottom: 2.5rem;
}

.featured-hero-card {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.7), rgba(15, 23, 42, 0.9));
  border: 1px solid rgba(6, 182, 212, 0.4);
  border-radius: 16px;
  padding: 2rem;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.featured-hero-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-cyan);
}

.featured-hero-badge {
  display: inline-block;
  background: var(--accent-gradient);
  color: #0f172a;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  text-transform: uppercase;
}

.featured-hero-grid {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 2rem;
  align-items: center;
}

@media (max-width: 850px) {
  .featured-hero-grid {
    grid-template-columns: 1fr;
  }
}

.featured-hero-text h2 {
  font-size: 1.85rem;
  color: #fff;
  margin-bottom: 0.75rem;
  line-height: 1.3;
}

.featured-excerpt {
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: 1.25rem;
}

.featured-meta-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 1.25rem;
}

.featured-stats-row {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.read-article-link {
  color: var(--accent-cyan);
  text-decoration: none;
  font-weight: 700;
  margin-left: auto;
}

.featured-hero-diagram {
  width: 100%;
  max-width: 280px;
  aspect-ratio: 1/1;
  margin: 0 auto;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

/* Post Feed Grid */
.blog-status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-glass);
}

.blog-count-badge {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.blog-sort-select {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  color: #fff;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  font-size: 0.85rem;
  cursor: pointer;
}

.blog-posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

.blog-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.blog-card:hover {
  transform: translateY(-3px);
  border-color: rgba(6, 182, 212, 0.5);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
}

.card-preview-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16/10;
  background: #1e293b;
  overflow: hidden;
}

.card-cover-img,
.featured-cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-preview-overlay {
  position: absolute;
  inset: 0;
  background: rgba(11, 15, 25, 0.6);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 5;
}

.card-preview-overlay span {
  background: var(--accent-cyan);
  color: #0f172a;
  font-weight: 700;
  padding: 0.45rem 1rem;
  border-radius: 20px;
  font-size: 0.85rem;
}

.blog-card:hover .card-preview-overlay {
  opacity: 1;
}

.card-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.card-tags-row {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 0.65rem;
  flex-wrap: wrap;
}

.card-eco-pill {
  background: rgba(59, 130, 246, 0.2);
  color: var(--accent-blue);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

.card-tag-pill {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

.card-title {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 0.5rem;
}

.card-title a {
  color: #fff;
  text-decoration: none;
  transition: color 0.15s ease;
}

.card-title a:hover {
  color: var(--accent-cyan);
}

.card-excerpt {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.5;
  margin-bottom: 1.25rem;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-glass);
}

.card-author {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-secondary);
}

.card-rating {
  color: var(--accent-cyan);
  font-weight: 600;
}

.card-stats {
  display: flex;
  gap: 0.65rem;
  color: var(--text-muted);
}

.blog-pagination-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-top: 2.5rem;
}

.pagination-btn {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  color: #fff;
  padding: 0.5rem 1.25rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.pagination-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pagination-btn:not(:disabled):hover {
  border-color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.1);
}

/* ==========================================================================
   BLOG READER VIEW
   ========================================================================== */
.blog-reader-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 5rem;
  width: 100%;
}

.blog-reader-nav {
  margin-bottom: 1.5rem;
}

.back-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: color 0.2s ease;
}

.back-link:hover {
  color: var(--accent-cyan);
}

.blog-article {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: 18px;
  padding: 2.5rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
  margin-bottom: 3rem;
}

@media (max-width: 640px) {
  .blog-article {
    padding: 1.5rem;
  }
}

.article-header {
  position: static !important;
  display: flex !important;
  flex-direction: column !important;
  top: auto !important;
  background: transparent !important;
  backdrop-filter: none !important;
  padding: 0 0 1.25rem 0 !important;
  margin-bottom: 1.5rem !important;
  border-bottom: 1px solid var(--border-glass) !important;
  z-index: 1 !important;
  width: 100%;
}

.article-meta-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.85rem;
  width: 100%;
}

.article-meta-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.article-meta-dot {
  color: var(--text-muted);
  opacity: 0.45;
  font-size: 0.75rem;
}

.article-eco-badge {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.35);
  font-weight: 700;
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  letter-spacing: 0.03em;
}

.article-reading-time {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.article-date {
  color: var(--text-muted);
}

.article-title {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.25;
  color: #ffffff;
  letter-spacing: -0.02em;
  margin: 0 0 1rem 0;
}

@media (max-width: 640px) {
  .article-title {
    font-size: 1.5rem;
  }
}

.article-author-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  width: 100%;
}

.article-author-info {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.author-avatar-circle {
  width: 36px;
  height: 36px;
  background: rgba(6, 182, 212, 0.12);
  border: 1px solid rgba(6, 182, 212, 0.3);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.author-details-inline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.author-name {
  font-weight: 600;
  color: #f1f5f9;
  font-size: 0.95rem;
}

.author-rating-badge {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
}

.author-separator {
  color: var(--text-muted);
  opacity: 0.45;
  font-size: 0.75rem;
}

.author-subtext {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.article-actions-top {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.action-btn-sm {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-glass);
  color: var(--text-secondary);
  padding: 0.35rem 0.7rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.2s ease;
}

.action-btn-sm:hover,
.action-btn-sm.active {
  background: rgba(6, 182, 212, 0.12);
  color: #fff;
  border-color: var(--accent-cyan);
}

.article-tags-wrap {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  align-items: center;
}

.article-tag-pill {
  color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.08);
  border: 1px solid rgba(6, 182, 212, 0.2);
  padding: 0.15rem 0.5rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  transition: all 0.2s;
}

.article-tag-pill:hover {
  background: rgba(6, 182, 212, 0.15);
  border-color: var(--accent-cyan);
}

/* Markdown Body */
.markdown-body {
  font-size: 1.05rem;
  line-height: 1.75;
  color: #cbd5e1;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
  color: #fff;
  margin: 1.75rem 0 0.85rem;
  line-height: 1.3;
}

.markdown-body h1 { font-size: 1.8rem; }
.markdown-body h2 { font-size: 1.45rem; }
.markdown-body h3 { font-size: 1.25rem; }

.markdown-body p {
  margin-bottom: 1.25rem;
}

.markdown-body .md-quote {
  border-left: 3px solid var(--accent-cyan);
  padding-left: 1rem;
  margin: 1.25rem 0;
  color: var(--text-secondary);
  font-style: italic;
}

.markdown-body .md-hr {
  border: none;
  border-top: 1px solid var(--border-glass);
  margin: 2rem 0;
}

.markdown-body .md-list {
  padding-left: 1.5rem;
  margin-bottom: 1.25rem;
}

.markdown-body .md-link {
  color: var(--accent-cyan);
  text-decoration: underline;
}

/* Interactive Chess Block Components */
.chess-block-game-viewer {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 1.5rem;
  background: #0f172a;
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  padding: 1.25rem;
  margin: 1.75rem 0;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

@media (max-width: 768px) {
  .chess-block-game-viewer {
    grid-template-columns: 1fr;
  }
}

.board-frame {
  width: 100%;
  aspect-ratio: 1/1;
  border-radius: 6px;
  overflow: hidden;
}

.game-viewer-controls {
  display: flex;
  gap: 0.35rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

.viewer-ctrl-btn {
  flex: 1;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  color: #fff;
  padding: 0.4rem 0.5rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s ease;
}

.viewer-ctrl-btn:hover {
  background: rgba(6, 182, 212, 0.2);
  border-color: var(--accent-cyan);
}

.viewer-ctrl-btn.analyze-link {
  flex: 1.5;
  text-decoration: none;
  background: rgba(6, 182, 212, 0.15);
  color: var(--accent-cyan);
  border-color: var(--accent-cyan);
}

.game-viewer-notation-col {
  display: flex;
  flex-direction: column;
  background: rgba(11, 15, 25, 0.6);
  border-radius: 8px;
  padding: 0.75rem;
  max-height: 420px;
}

.notation-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-glass);
  margin-bottom: 0.5rem;
}

.notation-moves-list {
  flex: 1;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.notation-row {
  display: grid;
  grid-template-columns: 45px 1fr 1fr;
  align-items: center;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
}

.move-num {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.notation-move {
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
  cursor: pointer;
}

.notation-move:hover {
  background: rgba(255, 255, 255, 0.08);
}

.notation-move.active {
  background: rgba(6, 182, 212, 0.25);
  color: var(--accent-cyan);
  font-weight: 700;
}

/* Position Diagram */
.chess-block-position-diagram {
  max-width: 450px;
  margin: 1.75rem auto;
  background: #0f172a;
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

.diagram-footer {
  padding: 0.85rem 1rem;
  background: rgba(11, 15, 25, 0.6);
}

.diagram-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 0.65rem;
}

.diagram-actions {
  display: flex;
  gap: 0.5rem;
}

.diagram-analyze-btn {
  flex: 1;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  color: var(--accent-cyan);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.4rem 0.5rem;
  border-radius: 6px;
  text-align: center;
  transition: all 0.15s ease;
}

.diagram-analyze-btn:hover {
  background: rgba(6, 182, 212, 0.2);
  border-color: var(--accent-cyan);
}

/* Puzzle Widget */
.chess-block-puzzle-solver {
  max-width: 480px;
  margin: 2rem auto;
  background: #0f172a;
  border: 1px solid rgba(6, 182, 212, 0.3);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

.puzzle-widget-header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.85rem 1rem;
  background: rgba(11, 15, 25, 0.6);
}

.puzzle-pill {
  background: rgba(6, 182, 212, 0.2);
  color: var(--accent-cyan);
  font-size: 0.75rem;
  font-weight: 800;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

.puzzle-prompt {
  font-size: 0.9rem;
  color: #fff;
  font-weight: 500;
}

.puzzle-status-bar {
  text-align: center;
  padding: 0.55rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.03);
  transition: all 0.2s ease;
}

.puzzle-status-bar.solved {
  background: rgba(16, 185, 129, 0.2);
  color: var(--color-win);
}

.puzzle-status-bar.failed {
  background: rgba(239, 68, 68, 0.2);
  color: var(--color-loss);
}

.puzzle-status-bar.solution {
  background: rgba(59, 130, 246, 0.2);
  color: var(--accent-blue);
}

.puzzle-widget-footer {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: rgba(11, 15, 25, 0.6);
}

/* Video Block */
.chess-block-video-embed {
  margin: 2rem 0;
  background: #0f172a;
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  overflow: hidden;
}

.video-embed-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: rgba(11, 15, 25, 0.6);
}

.video-pill {
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
}

.video-iframe-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
}

.video-iframe-wrap iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* Bottom Actions & Author Footer */
.article-bottom-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 0;
  margin-top: 2rem;
  border-top: 1px solid var(--border-glass);
  border-bottom: 1px solid var(--border-glass);
}

.article-reaction-btn {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  color: var(--text-secondary);
  padding: 0.6rem 1.25rem;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  transition: all 0.2s ease;
}

.article-reaction-btn:hover,
.article-reaction-btn.active {
  background: rgba(6, 182, 212, 0.15);
  border-color: var(--accent-cyan);
  color: #fff;
}

.article-author-footer {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  background: rgba(15, 23, 42, 0.6);
  border-radius: 14px;
  padding: 1.5rem;
  margin-top: 2rem;
}

.author-footer-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(6, 182, 212, 0.15);
  border: 2px solid var(--accent-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
}

.author-footer-details h3 {
  color: #fff;
  font-size: 1.1rem;
  margin-bottom: 0.25rem;
}

.author-footer-details p {
  color: var(--text-secondary);
  font-size: 0.88rem;
  line-height: 1.4;
}

.author-footer-actions {
  margin-left: auto;
}

/* Discussion / Comments Section */
.blog-discussion-section {
  max-width: 900px;
  margin: 0 auto;
}

.discussion-header h2 {
  font-size: 1.5rem;
  color: #fff;
  margin-bottom: 0.35rem;
}

.discussion-header p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
}

.comment-compose-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: 14px;
  padding: 1.25rem;
  margin-bottom: 2rem;
}

.comment-compose-card textarea {
  width: 100%;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-glass);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  color: #fff;
  font-family: inherit;
  font-size: 0.95rem;
  resize: vertical;
  margin-bottom: 0.75rem;
}

.comment-compose-card textarea:focus {
  outline: none;
  border-color: var(--accent-cyan);
}

.comment-position-attacher {
  background: rgba(15, 23, 42, 0.9);
  border: 1px dashed var(--accent-cyan);
  border-radius: 8px;
  padding: 0.85rem;
  margin-bottom: 0.75rem;
}

.position-attacher-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent-cyan);
  margin-bottom: 0.65rem;
}

.close-attacher-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
}

.position-attacher-body {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.comment-form-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.attach-board-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  color: var(--accent-cyan);
  padding: 0.5rem 0.85rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.attach-board-btn:hover {
  background: rgba(6, 182, 212, 0.15);
  border-color: var(--accent-cyan);
}

.comments-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.comment-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  padding: 1.25rem;
}

.comment-author-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.65rem;
}

.comment-author-info {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.9rem;
}

.comment-author-name {
  font-weight: 700;
  color: #fff;
}

.comment-author-rating {
  color: var(--accent-cyan);
  font-size: 0.8rem;
  font-weight: 600;
}

.comment-date {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.comment-body-text {
  font-size: 0.95rem;
  line-height: 1.6;
  color: #cbd5e1;
}

.comment-moves-line {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  font-family: var(--font-mono);
  color: var(--accent-cyan);
}

.comment-attached-board-wrap {
  margin-top: 0.85rem;
  max-width: 280px;
}

.comment-mini-board {
  width: 100%;
  aspect-ratio: 1/1;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 0.35rem;
}

.comment-analyze-link {
  font-size: 0.75rem;
  color: var(--accent-cyan);
  text-decoration: none;
}

/* ==========================================================================
   BLOG CREATOR STUDIO / EDITOR
   ========================================================================== */
.editor-page-body {
  height: 100vh;
  overflow: hidden;
}

.editor-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.editor-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.5rem;
  background: rgba(11, 15, 25, 0.9);
  border-bottom: 1px solid var(--border-glass);
}

.editor-top-left {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 1;
}

.post-title-input {
  flex: 1;
  max-width: 700px;
  background: none;
  border: none;
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  outline: none;
}

.post-title-input::placeholder {
  color: var(--text-muted);
}

.editor-top-right {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.editor-toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1.5rem;
  background: #111827;
  border-bottom: 1px solid var(--border-glass);
  overflow-x: auto;
}

.toolbar-group {
  display: flex;
  gap: 0.35rem;
}

.toolbar-divider {
  width: 1px;
  height: 20px;
  background: var(--border-glass);
  margin: 0 0.5rem;
}

.toolbar-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  color: #fff;
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.toolbar-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
}

.toolbar-btn.primary-tool {
  background: rgba(6, 182, 212, 0.15);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  font-weight: 600;
}

.toolbar-btn.primary-tool:hover {
  background: rgba(6, 182, 212, 0.25);
  color: #fff;
}

.editor-workspace {
  display: grid;
  grid-template-columns: 1fr 1fr;
  flex: 1;
  overflow: hidden;
}

@media (max-width: 800px) {
  .editor-workspace {
    grid-template-columns: 1fr;
  }
  .preview-pane {
    display: none;
  }
  .preview-pane.active {
    display: flex;
  }
}

.editor-pane {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.input-pane {
  border-right: 1px solid var(--border-glass);
}

.input-pane textarea {
  flex: 1;
  background: #0b0f19;
  border: none;
  padding: 1.5rem;
  color: #f8fafc;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  line-height: 1.6;
  resize: none;
  outline: none;
}

.preview-pane {
  background: #0f172a;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 1.5rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-glass);
}

.preview-content {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
}

.preview-empty {
  color: var(--text-muted);
  font-style: italic;
}

/* Modals */
.modal-large {
  max-width: 650px;
  width: 95%;
}

.modal-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border-glass);
  padding-bottom: 0.5rem;
}

.modal-tab {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 0.4rem 0.85rem;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  border-radius: 6px;
}

.modal-tab.active {
  background: rgba(6, 182, 212, 0.15);
  color: var(--accent-cyan);
}

.recent-games-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 280px;
  overflow-y: auto;
}

.recent-game-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.65rem 0.85rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-glass);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.recent-game-item:hover {
  background: rgba(6, 182, 212, 0.12);
  border-color: var(--accent-cyan);
}

.recent-game-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.game-players {
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
}

.game-meta {
  color: var(--text-muted);
  font-size: 0.78rem;
}

/* Header More Navigation Dropdown */
.nav-dropdown {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.nav-dropdown .dropdown-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: transparent;
  border: none;
  cursor: pointer;
  font: inherit;
  font-size: 0.95rem;
  color: var(--text-secondary);
  padding: 0.45rem 0.75rem;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.nav-dropdown .dropdown-toggle:hover,
.nav-dropdown.open .dropdown-toggle,
.nav-dropdown .dropdown-toggle.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.dropdown-caret {
  font-size: 0.75rem;
  transition: transform 0.2s ease;
}

.nav-dropdown.open .dropdown-caret {
  transform: rotate(180deg);
}

.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 190px;
  background: rgba(15, 23, 42, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.5), 0 0 12px rgba(6, 182, 212, 0.15);
  padding: 0.45rem;
  flex-direction: column;
  gap: 0.2rem;
  z-index: 1000;
  animation: fadeInDown 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav-dropdown.open .nav-dropdown-menu {
  display: flex;
}

.nav-dropdown-menu .nav-link,
.nav-dropdown-menu .nav-dropdown-item {
  display: flex !important;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.85rem;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  border-radius: 8px;
  transition: all 0.15s ease;
}

.nav-dropdown-menu .nav-link:hover,
.nav-dropdown-menu .nav-dropdown-item:hover {
  background: rgba(6, 182, 212, 0.14);
  color: #fff;
}

.nav-dropdown-menu .nav-link.active,
.nav-dropdown-menu .nav-dropdown-item.active {
  background: rgba(6, 182, 212, 0.22);
  color: var(--accent-cyan);
  font-weight: 600;
}

.dropdown-item-icon {
  font-size: 1.05rem;
  line-height: 1;
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Blog Creator Studio Builder Modals */
.modal-builder {
  max-width: 820px !important;
  width: 95% !important;
  max-height: 92vh;
  overflow-y: auto;
}

.modal-medium {
  max-width: 560px !important;
  width: 92% !important;
}

.modal-content .modal-header {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  font-size: 1.25rem !important;
  font-weight: 700 !important;
  margin-bottom: 1.25rem !important;
  text-align: left !important;
  border-bottom: 1px solid var(--border-glass);
  padding-bottom: 0.75rem;
}

.modal-close {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  line-height: 1;
}

.modal-close:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.4);
}

.modal-tabs {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border-glass);
  margin-bottom: 1.25rem;
  padding-bottom: 0.5rem;
  flex-wrap: wrap;
}

.modal-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.5rem 0.85rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.modal-tab:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.modal-tab.active {
  color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.14);
}

/* Puzzle Stepper Bar */
.puzzle-stepper-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-glass);
  border-radius: 10px;
  padding: 0.5rem 0.85rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.puzzle-step-btn {
  background: transparent;
  border: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.puzzle-step-btn .step-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  transition: all 0.2s ease;
}

.puzzle-step-btn.active {
  color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.12);
}

.puzzle-step-btn.active .step-num {
  background: var(--accent-cyan);
  color: #0b0f19;
  font-weight: 700;
}

.step-arrow {
  color: var(--text-muted);
  font-size: 0.8rem;
  opacity: 0.6;
}

.palette-btn[draggable="true"] {
  cursor: grab;
}

.palette-btn[draggable="true"]:active {
  cursor: grabbing;
}

.builder-board-wrap.drag-over {
  box-shadow: 0 0 20px rgba(6, 182, 212, 0.5);
  outline: 2px dashed var(--accent-cyan);
}

.modal-builder-body {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 768px) {
  .modal-builder-body {
    grid-template-columns: 1fr;
  }
}

.builder-board-col {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.builder-board-wrap {
  width: 320px;
  max-width: 100%;
  aspect-ratio: 1;
  margin: 0 auto;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  background: #1e293b;
}

.builder-board-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
  width: 100%;
}

.builder-tip {
  margin-top: 0.75rem;
  background: rgba(6, 182, 212, 0.08);
  border: 1px solid rgba(6, 182, 212, 0.2);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
  width: 100%;
}

.builder-controls-col {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.piece-palette-wrap {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-glass);
  border-radius: 10px;
  padding: 0.75rem;
}

.piece-palette-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.piece-palette-row {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 0.35rem;
}

.piece-palette-row:last-child {
  margin-bottom: 0;
}

.palette-btn {
  flex: 1;
  height: 38px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  font-size: 1.35rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff;
  transition: all 0.15s ease;
  user-select: none;
}

.palette-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--accent-cyan);
}

.palette-btn.active {
  background: rgba(6, 182, 212, 0.25);
  border-color: var(--accent-cyan);
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.3);
}

.castling-checkboxes {
  display: flex;
  gap: 0.85rem;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

.castling-checkboxes label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
}

.builder-moves-box {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-glass);
  border-radius: 8px;
  padding: 0.75rem;
  min-height: 85px;
  max-height: 140px;
  overflow-y: auto;
  font-family: monospace;
  font-size: 0.88rem;
  line-height: 1.6;
  color: #e2e8f0;
}

.builder-moves-box .placeholder-text {
  color: var(--text-muted);
  font-family: inherit;
  font-style: italic;
  font-size: 0.82rem;
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

@media (max-width: 500px) {
  .form-row-2 {
    grid-template-columns: 1fr;
  }
}

.video-preview-box {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-glass);
  border-radius: 10px;
  padding: 0.75rem;
  display: flex;
  gap: 0.85rem;
  align-items: center;
}

.video-thumb-container {
  position: relative;
  width: 140px;
  height: 80px;
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
  background: #000;
}

.video-thumb-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-thumb-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(220, 38, 38, 0.9);
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
}

.video-thumb-timestamp {
  position: absolute;
  bottom: 4px;
  right: 4px;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  font-size: 0.65rem;
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  font-family: monospace;
}

.video-preview-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.video-preview-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
}

.video-preview-id {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: monospace;
}

/* ==========================================================================
   User Profile Page Styles
   ========================================================================== */

.author-name-link {
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s ease;
}

.author-name-link:hover {
  color: var(--accent-cyan);
  text-decoration: underline;
}

.profile-main-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem 5rem;
  min-height: calc(100vh - 140px);
}

.profile-hero-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: 20px;
  overflow: hidden;
  position: relative;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.4);
  margin-bottom: 2.5rem;
}

.profile-hero-banner {
  height: 120px;
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.3) 0%, rgba(59, 130, 246, 0.3) 50%, rgba(147, 51, 234, 0.2) 100%);
  border-bottom: 1px solid var(--border-glass);
}

.profile-hero-content {
  padding: 0 2rem 2rem;
  display: flex;
  align-items: flex-end;
  gap: 1.75rem;
  margin-top: -50px;
  flex-wrap: wrap;
}

.profile-avatar-wrap {
  position: relative;
  flex-shrink: 0;
}

.profile-avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border: 4px solid #0f172a;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--accent-cyan);
}

.profile-hero-details {
  flex: 1;
  min-width: 250px;
}

.profile-title-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
  margin-bottom: 0.35rem;
}

.profile-username {
  font-size: 1.85rem;
  font-weight: 800;
  color: #fff;
  margin: 0;
  letter-spacing: -0.5px;
}

.profile-rating-badge {
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.4);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
}

.profile-role-badge {
  background: rgba(59, 130, 246, 0.2);
  color: var(--accent-blue);
  border: 1px solid rgba(59, 130, 246, 0.4);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
}

.profile-meta-row {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.profile-stats-shelf {
  display: flex;
  gap: 1.25rem;
  flex-shrink: 0;
}

.profile-stat-box {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  padding: 0.75rem 1.25rem;
  text-align: center;
  min-width: 90px;
}

.profile-stat-box .stat-number {
  display: block;
  font-size: 1.4rem;
  font-weight: 800;
  color: #fff;
}

.profile-stat-box .stat-label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 0.2rem;
}

/* Tabs Section */
.profile-tabs-section {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.profile-tabs-nav {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border-glass);
  padding-bottom: 0.5rem;
}

.profile-tab {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.65rem 1.25rem;
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
}

.profile-tab:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.profile-tab.active {
  color: #fff;
  background: var(--bg-glass);
  border-color: var(--border-glass);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.tab-count-badge {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 12px;
  font-weight: 700;
}

.profile-tab.active .tab-count-badge {
  background: var(--accent-cyan);
  color: #0f172a;
}

/* Tab Pane Controls */
.profile-pane-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.profile-search-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: 10px;
  padding: 0.55rem 1rem;
  flex: 1;
  max-width: 480px;
}

.profile-search-bar input {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 0.9rem;
  width: 100%;
  outline: none;
}

.drafts-info-notice {
  background: rgba(234, 179, 8, 0.15);
  border: 1px solid rgba(234, 179, 8, 0.35);
  color: #fef08a;
  padding: 0.75rem 1.25rem;
  border-radius: 10px;
  font-size: 0.85rem;
  flex: 1;
}

/* Games History Rows */
.profile-games-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.profile-game-row {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.profile-game-row:hover {
  transform: translateX(4px);
  border-color: rgba(6, 182, 212, 0.4);
}

.game-outcome-badge {
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  min-width: 65px;
  text-align: center;
}

.game-outcome-badge.outcome-win {
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.game-outcome-badge.outcome-loss {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.game-outcome-badge.outcome-draw {
  background: rgba(148, 163, 184, 0.2);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.4);
}

.game-matchup {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.95rem;
  min-width: 220px;
}

.game-matchup .game-vs {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.game-opening-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex: 1;
}

.game-eco-code {
  background: rgba(59, 130, 246, 0.2);
  color: var(--accent-blue);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

.game-opening-title {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.game-stats-col {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.2rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  min-width: 90px;
}

.game-actions-col {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Ensure mobile navigation drawer unfolds all items cleanly */
@media (max-width: 768px) {
  header.mobile-menu-open .nav-dropdown {
    width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
  }

  header.mobile-menu-open .nav-dropdown .dropdown-toggle {
    display: none !important;
  }

  header.mobile-menu-open .nav-dropdown-menu {
    display: flex !important;
    position: static !important;
    flex-direction: column !important;
    gap: 0.45rem !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    transform: none !important;
  }

  header.mobile-menu-open .nav-dropdown-menu .nav-link,
  header.mobile-menu-open .nav-dropdown-menu .nav-dropdown-item {
    display: flex !important;
    align-items: center !important;
    gap: 0.75rem !important;
    padding: 0.7rem 1rem !important;
    font-size: 0.98rem !important;
    font-weight: 500 !important;
    border-radius: 10px !important;
    background: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid rgba(255, 255, 255, 0.06) !important;
    color: var(--text-primary) !important;
    text-decoration: none !important;
  }

  header.mobile-menu-open .nav-dropdown-menu .nav-link.active,
  header.mobile-menu-open .nav-dropdown-menu .nav-dropdown-item.active {
    background: rgba(6, 182, 212, 0.15) !important;
    border-color: var(--accent-cyan) !important;
    color: var(--accent-cyan) !important;
    font-weight: 600 !important;
  }
}






