/* =============================================================================
   TACTICAL PUZZLE TRAINING ARENA DEDICATED STYLESHEET (puzzles.css)
   Clean, streamlined Lidraughts.org training theme
   Completely isolated to puzzles.php — Zero conflict with game.php or other pages
   ============================================================================= */

:root {
  --lid-bg: #edebe8;
  --lid-card-bg: #ffffff;
  --lid-border: #d5d3ce;
  --lid-text: #222222;
  --lid-text-muted: #666666;
  --lid-blue: #1b78d6;
  --lid-blue-hover: #1565c0;
  --lid-orange: #e67e22;
  --lid-green: #10b981;
  --lid-red: #ef4444;

  /* Natural Draughts Board Wood Colors (Matching authentic Lidraughts warm wood finish) */
  --lid-sq-dark: #a66a38;
  --lid-sq-dark-grain: #8a5327;
  --lid-sq-light: #d9b48f;
  --lid-sq-light-edge: #c89f76;
}

body.puzzle-trainer-body {
  background: var(--lid-bg) !important;
  color: var(--lid-text) !important;
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
}

/* App Wrapper Reset for Puzzle Trainer - Prevents 48px horizontal overflow from style.css */
.puzzle-trainer-body .app-wrapper {
  width: 100% !important;
  max-width: 100vw !important;
  padding: 0 !important;
  margin: 0 !important;
  box-sizing: border-box !important;
  overflow-x: hidden !important;
}

/* Make top header fit the clean theme nicely */
.puzzle-trainer-body .app-header {
  background: #1e293b;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  border-radius: 0 !important;
  margin: 0 !important;
  width: 100% !important;
  max-width: 100vw !important;
  box-sizing: border-box !important;
  padding: 10px 20px !important;
}

/* ==================== 3-COLUMN LIDRAUGHTS CONTAINER ==================== */
.puzzle-training-arena {
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px 16px 50px;
  box-sizing: border-box;
}

.lid-puzzle-container {
  display: grid;
  grid-template-columns: 240px minmax(460px, 580px) 310px;
  gap: 20px;
  align-items: start;
  justify-content: center;
}

@media (max-width: 1160px) {
  .lid-puzzle-container {
    grid-template-columns: 220px 1fr 290px;
    gap: 14px;
  }
}

@media (max-width: 980px) {
  .lid-puzzle-container {
    display: flex;
    flex-direction: column;
    max-width: 580px;
    margin: 0 auto;
    gap: 14px;
  }

  /* Optimal mobile gameplay hierarchy: Board first, Action Controls second, Secondary drawer third */
  .lid-board-center {
    order: 1;
    width: 100%;
  }

  .lid-sidebar-right {
    order: 2;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  /* Inside right sidebar on mobile: Turn prompt & feedback immediately below board */
  .lid-feedback-box {
    order: 1;
  }

  .lid-btn-continue {
    order: 2;
  }

  .lid-aux-toolbar {
    order: 3;
  }

  .lid-step-controls {
    order: 4;
  }

  .lid-notation-card {
    order: 5;
  }

  .lid-engine-header {
    order: 6;
  }

  .lid-sidebar-left {
    order: 3;
    width: 100%;
  }
}

/* Base White Cards */
.lid-card {
  background: var(--lid-card-bg);
  border: 1px solid var(--lid-border);
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  box-sizing: border-box;
}

/* ==================== COLUMN 1: LEFT SIDEBAR ==================== */
.lid-sidebar-left {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Mode Dropdown */
.lid-mode-dropdown-wrap {
  width: 100%;
}

.lid-mode-dropdown {
  width: 100%;
  background: #ffffff;
  border: 1px solid #cccccc;
  border-radius: 4px;
  padding: 8px 12px;
  font-size: 0.92rem;
  font-weight: 600;
  color: #333333;
  cursor: pointer;
  outline: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.lid-mode-dropdown:focus {
  border-color: var(--lid-blue);
}

/* Puzzle Info Card (Bullseye, ID, Rating, Played Count) */
.lid-puzzle-info-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
}

.lid-target-icon-wrap {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #f1f3f5;
  color: #64748b;
  flex-shrink: 0;
}

.lid-info-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.lid-puzzle-link {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--lid-blue);
  text-decoration: none;
}

.lid-puzzle-link:hover {
  text-decoration: underline;
}

.lid-info-rating {
  font-size: 0.88rem;
  color: #444444;
  font-weight: 500;
}

.lid-info-played {
  font-size: 0.8rem;
  color: #777777;
}

/* User Rating Card with Area Chart */
.lid-rating-graph-card {
  padding: 12px 14px 10px;
}

.lid-rating-header {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 0.88rem;
  color: #444;
  margin-bottom: 8px;
}

.lid-rating-val {
  font-size: 1.05rem;
  font-weight: 800;
  color: #111;
}

.lid-rating-delta {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--lid-red);
}

.lid-rating-delta.gain {
  color: var(--lid-green);
}

.lid-chart-container {
  width: 100%;
  height: 70px;
  overflow: hidden;
}

.lid-rating-svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* Tactical Meta Details */
.lid-meta-details-card {
  padding: 12px 14px;
  font-size: 0.84rem;
}

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

.lid-meta-lbl {
  color: #666;
  font-weight: 600;
  font-size: 0.8rem;
  min-width: 58px;
}

.puzzle-theme-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.puzzle-tag {
  background: #f1f3f5;
  border: 1px solid #e2e8f0;
  color: #334155;
  font-size: 0.72rem;
  padding: 2px 6px;
  border-radius: 3px;
  font-weight: 600;
}

.puzzle-difficulty-tag {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
}

.puzzle-difficulty-tag.beginner { background: #dcfce7; color: #15803d; border: 1px solid #86efac; }
.puzzle-difficulty-tag.intermediate { background: #fef9c3; color: #a16207; border: 1px solid #fde047; }
.puzzle-difficulty-tag.advanced { background: #ffedd5; color: #c2410c; border: 1px solid #fdba74; }
.puzzle-difficulty-tag.expert { background: #f3e8ff; color: #7e22ce; border: 1px solid #d8b4fe; }
.puzzle-difficulty-tag.master { background: #f1f5f9; color: #334155; border: 1px solid #cbd5e1; }
.puzzle-difficulty-tag.grandmaster { background: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5; }

.lid-meta-actions {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #f0f0f0;
}

.lid-meta-actions .btn {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  color: #334155;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 4px;
  cursor: pointer;
  width: 100%;
}

.lid-meta-actions .btn:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

/* Collapsible Filters & Chips Drawer */
.lid-filters-details {
  background: #ffffff;
  border: 1px solid var(--lid-border);
  border-radius: 4px;
  font-size: 0.85rem;
}

.lid-filters-summary {
  padding: 10px 14px;
  font-weight: 700;
  color: #444;
  cursor: pointer;
  user-select: none;
}

.lid-filters-content {
  padding: 12px 14px 16px;
  border-top: 1px solid #e5e5e5;
  background: #fafaf9;
}

.puzzle-filter-section .section-label {
  display: block;
  font-size: 0.76rem;
  font-weight: 700;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 4px;
}

.puzzle-filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 10px;
}

.filter-btn {
  background: #ffffff;
  border: 1px solid #d1d5db;
  color: #374151;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.filter-btn:hover {
  background: #f3f4f6;
  border-color: #9ca3af;
}

.filter-btn.active {
  background: var(--lid-blue);
  border-color: var(--lid-blue);
  color: #ffffff;
  font-weight: 700;
}

.puzzle-theme-select, .puzzle-search-input {
  width: 100%;
  background: #ffffff;
  border: 1px solid #d1d5db;
  color: #1f2937;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 0.82rem;
  box-sizing: border-box;
}

.puzzle-chips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 6px;
  max-height: 180px;
  overflow-y: auto;
  margin-top: 8px;
}

.puzzle-chip {
  background: #ffffff;
  border: 1px solid #d1d5db;
  color: #374151;
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 0.72rem;
  cursor: pointer;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.puzzle-chip.active {
  border-color: var(--lid-blue);
  background: #eff6ff;
  color: var(--lid-blue);
  font-weight: 700;
}

.puzzle-chip.solved {
  border-color: #86efac;
  background: #f0fdf4;
  color: #15803d;
}

/* ==================== COLUMN 2: CENTER BOARD ==================== */
.lid-board-center {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lid-board-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.puzzle-variant-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #ffffff;
  border: 1px solid var(--lid-border);
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #334155;
}

.lid-board-tools {
  display: flex;
  gap: 6px;
  align-items: center;
}

.lid-board-theme-select {
  background: #ffffff !important;
  border: 1px solid var(--lid-border) !important;
  color: #333333 !important;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  transition: all 0.15s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.lid-board-theme-select:focus {
  border-color: var(--lid-blue) !important;
}

.lid-board-tools .btn {
  background: #ffffff;
  border: 1px solid var(--lid-border);
  color: #444;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.lid-board-tools .btn:hover {
  background: #f1f3f5;
  color: #111;
  border-color: #bbb;
}

/* The Board Frame & Coordinates */
.lid-board-outer {
  position: relative;
  width: calc(100% - 24px);
  margin-right: 24px;
  margin-bottom: 24px;
  aspect-ratio: 1 / 1;
  box-sizing: border-box;
}

.puzzle-trainer-body .board-wood-frame {
  width: 100% !important;
  height: 100% !important;
  padding: 0 !important;
  margin: 0 !important;
  box-sizing: border-box !important;
  border: 1px solid #7c4d29 !important;
  border-radius: 2px !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.14) !important;
  position: relative !important;
  background: #a66a38 !important;
}

.puzzle-trainer-body .board-wood-frame::before,
.puzzle-trainer-body .board-wood-frame::after {
  display: none !important;
  content: none !important;
}

.board-tactical-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 50;
}

.tactical-arrow-anim {
  stroke-dashoffset: 0;
  animation: dashFlow 1.2s linear infinite;
}

@keyframes dashFlow {
  from { stroke-dashoffset: 24; }
  to { stroke-dashoffset: 0; }
}

.board-inner {
  display: grid !important;
  grid-template-columns: repeat(10, 1fr) !important;
  grid-template-rows: repeat(10, 1fr) !important;
  width: 100% !important;
  height: 100% !important;
  aspect-ratio: 1 / 1 !important;
  border-radius: 4px;
  overflow: hidden;
  background-image: url('images/board/wood-1024_100.jpg') !important;
  background-size: 100% 100% !important;
  background-repeat: no-repeat !important;
}

.puzzle-trainer-body .board-wood-frame.rules-nigerian .board-inner,
.puzzle-trainer-body .board-inner.rules-nigerian {
  background-image: url('images/board/wood-1024_100_mirrored.jpg') !important;
}

/* Theme: Default Classic */
.puzzle-trainer-body .board-wood-frame.theme-default {
  border-color: #7c4d29 !important;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.75), 0 0 20px rgba(245, 166, 35, 0.12) !important;
}
.puzzle-trainer-body .board-wood-frame.theme-default .board-inner {
  background-image: url('images/board/wood-1024_100.jpg') !important;
}
.puzzle-trainer-body .board-wood-frame.theme-default.rules-nigerian .board-inner,
.puzzle-trainer-body .board-wood-frame.theme-default .board-inner.rules-nigerian {
  background-image: url('images/board/wood-1024_100_mirrored.jpg') !important;
}

/* Theme: Eco Giant */
.puzzle-trainer-body .board-wood-frame.theme-eco-giant {
  border-color: #1e5a32 !important;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.75), 0 0 24px rgba(16, 185, 129, 0.25) !important;
}
.puzzle-trainer-body .board-wood-frame.theme-eco-giant .board-inner {
  background-image: url('images/board/wood-1024_eco_giant.jpg') !important;
}
.puzzle-trainer-body .board-wood-frame.theme-eco-giant.rules-nigerian .board-inner,
.puzzle-trainer-body .board-wood-frame.theme-eco-giant .board-inner.rules-nigerian {
  background-image: url('images/board/wood-1024_eco_giant_mirrored.jpg') !important;
}

/* Theme: Golden State */
.puzzle-trainer-body .board-wood-frame.theme-golden-state {
  border-color: #b47a18 !important;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.75), 0 0 26px rgba(245, 158, 11, 0.28) !important;
}
.puzzle-trainer-body .board-wood-frame.theme-golden-state .board-inner {
  background-image: url('images/board/wood-1024_golden_state.jpg') !important;
}
.puzzle-trainer-body .board-wood-frame.theme-golden-state.rules-nigerian .board-inner,
.puzzle-trainer-body .board-wood-frame.theme-golden-state .board-inner.rules-nigerian {
  background-image: url('images/board/wood-1024_golden_state_mirrored.jpg') !important;
}

/* Theme: Safari Land */
.puzzle-trainer-body .board-wood-frame.theme-safari-land {
  border-color: #944a1e !important;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.75), 0 0 24px rgba(217, 119, 6, 0.24) !important;
}
.puzzle-trainer-body .board-wood-frame.theme-safari-land .board-inner {
  background-image: url('images/board/wood-1024_safari_land.jpg') !important;
}
.puzzle-trainer-body .board-wood-frame.theme-safari-land.rules-nigerian .board-inner,
.puzzle-trainer-body .board-wood-frame.theme-safari-land .board-inner.rules-nigerian {
  background-image: url('images/board/wood-1024_safari_land_mirrored.jpg') !important;
}

/* Theme: Mineral Grove */
.puzzle-trainer-body .board-wood-frame.theme-mineral-grove {
  border-color: #0f6158 !important;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.75), 0 0 25px rgba(20, 184, 166, 0.26) !important;
}
.puzzle-trainer-body .board-wood-frame.theme-mineral-grove .board-inner {
  background-image: url('images/board/wood-1024_mineral_grove.jpg') !important;
}
.puzzle-trainer-body .board-wood-frame.theme-mineral-grove.rules-nigerian .board-inner,
.puzzle-trainer-body .board-wood-frame.theme-mineral-grove .board-inner.rules-nigerian {
  background-image: url('images/board/wood-1024_mineral_grove_mirrored.jpg') !important;
}

/* Theme: Diamond Coast */
.puzzle-trainer-body .board-wood-frame.theme-diamond-coast {
  border-color: #1a568c !important;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.75), 0 0 28px rgba(14, 165, 233, 0.28) !important;
}
.puzzle-trainer-body .board-wood-frame.theme-diamond-coast .board-inner {
  background-image: url('images/board/wood-1024_diamond_coast.jpg') !important;
}
.puzzle-trainer-body .board-wood-frame.theme-diamond-coast.rules-nigerian .board-inner,
.puzzle-trainer-body .board-wood-frame.theme-diamond-coast .board-inner.rules-nigerian {
  background-image: url('images/board/wood-1024_diamond_coast_mirrored.jpg') !important;
}

/* Lidraughts Board Squares */
.square {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  user-select: none;
  background: transparent !important;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.square.light,
.square.dark {
  background: transparent !important;
  background-image: none !important;
}

/* 1-50 Notation Numbers */
.sq-draughts-num {
  position: absolute;
  top: 3px;
  right: 4px;
  font-size: 0.72rem;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95), 0 0 4px rgba(0, 0, 0, 0.8);
  pointer-events: none;
  font-family: monospace;
  z-index: 2;
}

/* Last Move Highlight: Exact Lidraughts Olive-Yellow */
.square.sq-last-from, .square.sq-last-to {
  background: rgba(205, 210, 106, 0.45) !important;
  box-shadow: inset 0 0 0 2px rgba(205, 210, 106, 0.85) !important;
}

.square.sq-selected {
  background: rgba(20, 130, 200, 0.35) !important;
  box-shadow: inset 0 0 0 2px #0284c7, 0 0 16px rgba(2, 132, 199, 0.4) !important;
}

.square.valid-target::after {
  content: '';
  position: absolute;
  width: 24%;
  height: 24%;
  background: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.8);
  pointer-events: none;
}

.square.valid-capture-target::after {
  content: '';
  position: absolute;
  width: 30%;
  height: 30%;
  background: #f59e0b;
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.9);
  pointer-events: none;
}

.square.sq-error-shake {
  background: rgba(239, 68, 68, 0.5) !important;
  animation: puzShake 0.4s ease;
}

@keyframes puzShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-4px); }
  40%, 80% { transform: translateX(4px); }
}

/* Authentic 3D Draughts Pieces */
.piece {
  width: 90% !important;
  height: 90% !important;
  border-radius: 0 !important;
  border: none !important;
  background-color: transparent !important;
  background-repeat: no-repeat !important;
  background-position: center bottom !important;
  background-size: contain !important;
  position: relative !important;
  cursor: grab !important;
  user-select: none !important;
  touch-action: none !important;
  -webkit-tap-highlight-color: transparent !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  z-index: 10 !important;
  filter: drop-shadow(0 6px 5px rgba(0, 0, 0, 0.45)) !important;
  transition: transform 0.15s ease, filter 0.15s ease !important;
}

.piece::before {
  display: none !important;
  content: none !important;
}

.piece.white, .piece.p1 {
  background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyMTAgMjEwIiB3aWR0aD0iMjEwIiBoZWlnaHQ9IjIxMCI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJsZ3ciIHgxPSIwIiB5MT0iMCIgeDI9IjAiIHkyPSIxIj48c3RvcCBvZmZzZXQ9IjAiIHN0b3AtY29sb3I9IiM3ZjdmN2YiIHN0b3At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UgxMHoiIGZpbGw9InVybCgjbGdiaykiIHN0cm9rZT0iI2RmZGZkZiIgc3Ryb2tlLXdpZHRoPSIzIiBzdHJva2Utb3BhY2l0eT0iMC41Ii8+PHBhdGggZD0iTTEwIDEwNWMwIDYwIDE5MCA2MCAxOTAgMFY3MEgxMHoiIGZpbGw9InVybCgjbGdiaykiIHN0cm9rZT0iI2RmZGZkZiIgc3Ryb2tlLXdpZHRoPSIzIiBzdHJva2Utb3BhY2l0eT0iMC41Ii8+PHBhdGggZD0iTTEwIDcwYzAgNjAgMTkwIDYwIDE5MCAwIDAtNjAtMTkwLTYwLTE5MCAweiIgZmlsbD0iIzAwMDAwMCIgc3Ryb2tlPSIjZGZkZmRmIiBzdHJva2Utd2lkdGg9IjMiIHN0cm9rZS1vcGFjaXR5PSIwLjUiLz48cGF0aCBkPSJNNTggNDUgNzEgODVoNThsMTMtNDAtMjUgMjUtMjItMzVMODMgNzB6IiBmaWxsPSIjYmY4YzE2Ii8+PHBhdGggZD0iTTc0IDk2IDcxLjYgODdIMTM4LjRMMTM2IDk2eiIgZmlsbD0iI2JmOGMxNiIvPmVsbGlwc2UgZmlsbD0iIzAwMDAwMCIgY3g9IjEwNSIgY3k9IjY4IiByeD0iNSIgcnk9IjEwIi8+PC9zdmc+') !important;
}

.piece.selected {
  transform: translateY(-4px) scale(1.1) !important;
  filter: drop-shadow(0 10px 14px rgba(0, 0, 0, 0.6)) drop-shadow(0 0 10px rgba(16, 185, 129, 0.8)) !important;
  cursor: grabbing !important;
  z-index: 99 !important;
}

.piece.dragging {
  cursor: grabbing;
  transform: scale(1.16);
  filter: drop-shadow(0 14px 22px rgba(0, 0, 0, 0.75)) !important;
  z-index: 999;
}

/* Hide legacy emoji crown as the 3D king SVG has the golden crown crest embedded */
.piece .crown-icon,
.piece.king .crown-icon,
.piece.king::after {
  display: none !important;
  content: none !important;
}

.piece.animating-move {
  transition: transform 0.22s cubic-bezier(0.25, 1, 0.5, 1) !important;
  z-index: 100;
}

.piece.piece-hint-pulse {
  animation: piecePulse 1.2s infinite alternate !important;
}

@keyframes piecePulse {
  from { box-shadow: 0 0 0 2px #f59e0b, 0 0 8px #f59e0b; }
  to { box-shadow: 0 0 0 5px #f59e0b, 0 0 20px #f59e0b; }
}

/* Lidraughts Board Rim Coordinates: Right (46, 36, 26, 16, 6) & Bottom (5, 4, 3, 2, 1) */
.lid-coords-right {
  position: absolute;
  right: -20px;
  top: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  font-size: 0.72rem;
  font-weight: 700;
  color: #555555;
  pointer-events: none;
  user-select: none;
}

.lid-coords-bottom {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -20px;
  display: flex;
  justify-content: space-around;
  font-size: 0.72rem;
  font-weight: 700;
  color: #555555;
  pointer-events: none;
  user-select: none;
}

.lid-board-resize-handle {
  position: absolute;
  right: 3px;
  bottom: 3px;
  font-size: 0.65rem;
  color: rgba(0, 0, 0, 0.5);
  pointer-events: none;
  user-select: none;
  line-height: 1;
  font-family: monospace;
  font-weight: bold;
  z-index: 10;
}

/* Horizontal Move Evaluation Strip Below Board (Matches Lidraughts) */
.lid-eval-strip {
  width: 100%;
  height: 24px;
  background: #b55448;
  border-radius: 2px;
  display: flex;
  align-items: center;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  margin-top: 14px;
}

.lid-eval-scores {
  display: flex;
  flex: 1;
  height: 100%;
}

.lid-eval-cell {
  flex: 1;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: #ffffff;
  border-right: 1px solid rgba(255, 255, 255, 0.14);
}

.lid-eval-cell.active-eval {
  background: #c59b27;
  color: #ffffff;
  font-weight: 800;
}

/* Performance Strip & Shortcuts */
.puzzle-session-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: #ffffff;
  border: 1px solid var(--lid-border);
  border-radius: 4px;
  overflow-x: auto;
}

.session-strip-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  white-space: nowrap;
}

.session-pills-wrap {
  display: flex;
  align-items: center;
  gap: 5px;
}

.session-pill {
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.72rem;
  font-weight: 700;
  font-family: monospace;
}

.session-pill.gain { background: #dcfce7; color: #15803d; }
.session-pill.loss { background: #fee2e2; color: #b91c1c; }

.puzzle-highway-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.76rem;
  color: #64748b;
  padding: 2px 4px;
}

.puzzle-highway-status .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--lid-green);
}

.keyboard-shortcuts-hint {
  display: flex;
  gap: 8px;
  font-size: 0.72rem;
  color: #64748b;
  flex-wrap: wrap;
}

.keyboard-shortcuts-hint kbd {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  padding: 1px 4px;
  border-radius: 3px;
  font-family: monospace;
}

/* Board Center Wrong Move Sign / Badge */
.board-wrong-badge {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  background: rgba(185, 28, 28, 0.95);
  border: 2px solid #ef4444;
  color: #ffffff;
  padding: 10px 20px;
  border-radius: 24px;
  font-size: 0.9rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 200;
  pointer-events: none;
  animation: badgePop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes badgePop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.7); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* ==================== COLUMN 3: RIGHT SIDEBAR ==================== */
.lid-sidebar-right {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Top Engine WASM Header */
.lid-engine-header {
  background: #ffffff;
  border: 1px solid var(--lid-border);
  border-radius: 4px;
  padding: 8px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.lid-engine-meta {
  display: flex;
  flex-direction: column;
}

.lid-engine-name {
  font-size: 0.86rem;
  font-weight: 700;
  color: #333333;
}

.lid-wasm-tag {
  font-size: 0.72rem;
  color: #16a34a;
  font-weight: 800;
  margin-left: 2px;
}

.lid-engine-sub {
  font-size: 0.74rem;
  color: #777777;
}

.lid-engine-switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  cursor: pointer;
}

.lid-engine-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.lid-engine-slider {
  position: absolute;
  inset: 0;
  background-color: #cbd5e1;
  border-radius: 20px;
  transition: 0.2s;
}

.lid-engine-slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  border-radius: 50%;
  transition: 0.2s;
}

.lid-engine-switch input:checked + .lid-engine-slider {
  background-color: #10b981;
}

.lid-engine-switch input:checked + .lid-engine-slider:before {
  transform: translateX(16px);
}

/* Move Notation Table */
.lid-notation-card {
  background: #ffffff;
  border: 1px solid var(--lid-border);
  border-radius: 4px;
  overflow: hidden;
  min-height: 130px;
  max-height: 210px;
}

.lid-notation-scroll {
  max-height: 210px;
  overflow-y: auto;
}

.lid-notation-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.lid-notation-table tr {
  border-bottom: 1px solid #f1f1f1;
}

.lid-notation-table tr:hover {
  background: #fafaf9;
}

.lid-notation-table td {
  padding: 6px 10px;
  color: #222222;
  vertical-align: middle;
}

.lid-notation-table td.col-num {
  width: 22px;
  color: #888888;
  font-size: 0.82rem;
  padding-right: 2px;
}

.lid-notation-table td.notation-move-cell {
  cursor: pointer;
  font-weight: 500;
}

/* Active Step: Orange Rectangular Outline (Matching Lidraughts) */
.lid-notation-table td.notation-move-cell.active-step {
  border: 1.5px solid var(--lid-orange) !important;
  background: transparent !important;
  color: #111111 !important;
  font-weight: 700 !important;
  border-radius: 2px;
}

/* Completed Moves Green Checkmark */
.lid-check {
  color: #10b981;
  font-weight: 800;
  font-size: 1.05rem;
  margin-left: 6px;
}

/* Feedback Status Card */
.lid-feedback-box {
  background: #ffffff;
  border: 1px solid var(--lid-border);
  border-radius: 4px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: center;
}

.puzzle-trainer-body .puzzle-turn-card {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 10px !important;
  padding: 4px 0 !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

.turn-disc {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid #94a3b8;
}

.turn-disc.white {
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.turn-disc.dark {
  background: #1e293b;
}

.turn-tagline {
  font-size: 0.72rem;
  font-weight: 800;
  color: #64748b;
  letter-spacing: 0.4px;
}

.puzzle-trainer-body .turn-prompt {
  font-size: 0.92rem !important;
  font-weight: 700 !important;
  color: #1f2937 !important;
}

.turn-prompt {
  font-size: 0.88rem;
  font-weight: 700;
  color: #1f2937;
}

.feedback-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: #111827;
  margin: 2px 0 0;
}

.feedback-desc {
  font-size: 0.82rem;
  color: #64748b;
  margin: 0;
  line-height: 1.35;
}

.feedback-rewards {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
}

.reward-item {
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 800;
}

.reward-item.rating-gain {
  background: #dcfce7;
  color: #15803d;
}

.reward-item.coins-gain {
  background: #fef9c3;
  color: #a16207;
}

/* BIG PROMINENT BLUE ACTION BUTTON (Matches Lidraughts "▶ CONTINUE TRAINING") */
.lid-btn-continue {
  background: var(--lid-blue);
  color: #ffffff;
  font-size: 1.05rem;
  font-weight: 800;
  width: 100%;
  height: 52px;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 2px 5px rgba(27, 120, 214, 0.3);
  letter-spacing: 0.5px;
  transition: background 0.15s ease, transform 0.1s ease;
}

.lid-btn-continue:hover {
  background: var(--lid-blue-hover);
}

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

.lid-play-arrow {
  font-size: 1.35rem;
  line-height: 1;
}

/* Step Navigation Controls (|◀, ◀, ▶, ▶|) */
.lid-step-controls {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 2px;
}

.lid-step-btn {
  flex: 1;
  background: #ffffff;
  border: 1px solid var(--lid-border);
  border-radius: 4px;
  padding: 8px 0;
  font-size: 0.85rem;
  font-weight: 700;
  color: #555555;
  cursor: pointer;
  transition: all 0.15s ease;
}

.lid-step-btn:hover:not(:disabled) {
  background: #f1f3f5;
  color: #111111;
  border-color: #bbb;
}

.lid-step-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

/* Auxiliary Tools Toolbar (Hint, Solution, Retry) */
.lid-aux-toolbar {
  display: flex;
  gap: 6px;
  margin-top: 2px;
}

.lid-aux-btn {
  flex: 1;
  background: #ffffff;
  border: 1px solid var(--lid-border);
  border-radius: 4px;
  padding: 7px 4px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #444;
  cursor: pointer;
  transition: all 0.15s ease;
}

.lid-aux-btn:hover {
  background: #f1f3f5;
  color: #111;
  border-color: #bbb;
}

/* =============================================================================
   32 CLASSICAL COUPS ENCYCLOPEDIA MODAL
   ============================================================================= */

/* Modal Backdrop */
.coups-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
  animation: modalFadeIn 0.22s ease-out;
}

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

/* Modal Dialog */
.coups-modal-dialog {
  background: #ffffff;
  border: 1px solid var(--lid-border);
  border-radius: 8px;
  width: 100%;
  max-width: 1020px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  animation: modalSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* Modal Header */
.coups-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 20px 24px 14px;
  border-bottom: 1px solid #e5e5e5;
  background: #fafaf9;
}

.coups-modal-badge {
  display: inline-block;
  background: #fef3c7;
  border: 1px solid #fde047;
  color: #92400e;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 4px;
}

.coups-modal-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 800;
  color: #1e293b;
  font-family: 'Outfit', sans-serif;
}

.coups-modal-subtitle {
  margin: 4px 0 0;
  font-size: 0.85rem;
  color: #64748b;
}

.coups-modal-close {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #475569;
  font-size: 1.6rem;
  line-height: 1;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.coups-modal-close:hover {
  background: #fee2e2;
  border-color: #ef4444;
  color: #b91c1c;
  transform: rotate(90deg);
}

/* Modal Toolbar */
.coups-modal-toolbar {
  padding: 12px 24px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.coups-search-wrap {
  flex: 1;
  min-width: 240px;
}

.coups-search-input {
  width: 100%;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #1e293b;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.88rem;
  outline: none;
  transition: all 0.2s;
}

.coups-search-input:focus {
  border-color: var(--lid-blue);
  box-shadow: 0 0 0 3px rgba(27, 120, 214, 0.15);
}

.coups-star-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.coup-star-pill {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #475569;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.18s;
}

.coup-star-pill:hover {
  background: #f1f5f9;
  color: #1e293b;
}

.coup-star-pill.active {
  background: var(--lid-blue);
  border-color: var(--lid-blue);
  color: #ffffff;
  font-weight: 700;
}

/* 32 Coups Grid */
.coups-grid {
  padding: 20px 24px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  max-height: calc(90vh - 200px);
}

.coup-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.2s ease;
  position: relative;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.coup-card:hover {
  transform: translateY(-2px);
  border-color: var(--lid-blue);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

.coup-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 6px;
}

.coup-card-icon {
  font-size: 1.3rem;
  margin-right: 6px;
}

.coup-stars-badge {
  font-size: 0.75rem;
  font-weight: 700;
  color: #b45309;
  background: #fef3c7;
  padding: 2px 6px;
  border-radius: 8px;
  border: 1px solid #fde047;
}

.coup-card-title {
  margin: 0 0 4px;
  font-size: 1rem;
  font-weight: 800;
  color: #1e293b;
}

.coup-card-idea {
  font-size: 0.8rem;
  color: #64748b;
  line-height: 1.4;
  margin-bottom: 10px;
  flex-grow: 1;
}

.coup-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 8px;
  border-top: 1px solid #f1f5f9;
}

.coup-level-label {
  font-size: 0.72rem;
  color: #64748b;
  font-weight: 600;
}

.btn-practice-coup {
  background: var(--lid-blue);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-practice-coup:hover {
  background: var(--lid-blue-hover);
}

/* Theme Badge Interactive Popover */
.puzzle-tag.coup-tag {
  background: #fef3c7;
  border: 1px solid #fde047;
  color: #92400e;
  cursor: pointer;
  transition: all 0.18s;
}

.puzzle-tag.coup-tag:hover {
  background: #fde68a;
  transform: scale(1.03);
}

/* =============================================================================
   MOBILE VIEWPORT & TOUCHSCREEN OPTIMIZATION (puzzles.css)
   Tailored for smartphones (360px – 480px) and small tablets (600px – 768px)
   ============================================================================= */

/* Universal Touch & Tap Highlight Polish */
.filter-btn,
.puzzle-chip,
.btn,
.lid-step-btn,
.lid-aux-btn,
.lid-btn-continue,
.coup-star-pill,
.btn-practice-coup {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* Mobile Viewport Width Protection - Eliminates Any Horizontal Shift/Overflow */
html, body.puzzle-trainer-body {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden !important;
}

.puzzle-trainer-body .app-wrapper {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

/* Desktop Default: Hide mobile-only elements */
.lid-mobile-only,
.lid-mobile-drawer {
  display: none !important;
}

/* ==========================================================================
   LIDRAUGHTS MOBILE PHONE VIEW (MATCHING GAME.PHP VIEW EXACTLY)
   ========================================================================== */
@media (max-width: 1060px) {
  html,
  body.puzzle-trainer-body,
  .puzzle-trainer-body .app-wrapper {
    background-color: #161512 !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
  }

  /* Compact 48px Header */
  .puzzle-trainer-body .app-header {
    padding: 0 10px !important;
    height: 48px !important;
    min-height: 48px !important;
    max-height: 48px !important;
    background: #161512 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: space-between !important;
    box-sizing: border-box !important;
    position: static !important;
    gap: 0 !important;
  }

  .puzzle-trainer-body .main-nav {
    display: none !important;
  }

  .lid-mobile-menu-toggle {
    order: -1 !important;
    display: inline-flex !important;
    font-size: 1.4rem !important;
    padding: 6px !important;
    line-height: 1 !important;
    color: #888888 !important;
    background: transparent !important;
    border: none !important;
    cursor: pointer !important;
  }

  .puzzle-trainer-body .nav-brand-container {
    order: 0 !important;
    flex: 1 !important;
    margin-left: 6px !important;
    display: flex !important;
    align-items: center !important;
  }

  .puzzle-trainer-body .nav-brand-container .flag-stripes {
    display: none !important;
  }

  .puzzle-trainer-body .brand-text .game-title {
    font-size: 1.05rem !important;
    font-weight: 700 !important;
    color: #ffffff !important;
    line-height: 1.15 !important;
    letter-spacing: 0.3px !important;
  }

  .puzzle-trainer-body .brand-text .game-subtitle {
    font-size: 0.68rem !important;
    font-weight: 500 !important;
    color: #888888 !important;
    line-height: 1.15 !important;
    letter-spacing: 0.2px !important;
  }

  .puzzle-trainer-body .header-right-tools {
    order: 1 !important;
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
    position: static !important;
  }

  .puzzle-trainer-body .header-right-tools #auth-section,
  .puzzle-trainer-body .header-right-tools #btn-sound-toggle {
    display: none !important;
  }

  .lid-mobile-theme-btn {
    display: inline-flex !important;
    background: transparent !important;
    border: none !important;
    padding: 4px !important;
    cursor: pointer !important;
    color: #888888 !important;
  }

  /* Slide-in Mobile Drawer */
  .lid-mobile-drawer {
    position: fixed;
    top: 48px;
    left: 0;
    right: 0;
    background: rgba(16, 21, 18, 0.98);
    backdrop-filter: blur(18px);
    border-bottom: 2px solid #b58863;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.85);
    z-index: 1000;
    display: none !important;
    flex-direction: column;
    padding: 8px 0;
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    animation: lidDrawerSlide 0.22s ease-out;
  }

  .lid-mobile-drawer:not(.open) {
    display: none !important;
  }

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

  .lid-mobile-drawer.open {
    display: flex !important;
  }

  .lid-mobile-drawer .nav-link {
    padding: 12px 20px !important;
    font-size: 0.9rem !important;
    font-weight: 700 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    color: #cbd5e1 !important;
    text-align: left !important;
    width: 100% !important;
    box-sizing: border-box !important;
    background: transparent !important;
    border-radius: 0 !important;
    cursor: pointer !important;
  }

  .lid-mobile-drawer .nav-link:hover {
    background: rgba(245, 166, 35, 0.12) !important;
    color: #f5a623 !important;
  }

  .lid-mobile-drawer .nav-link .nav-icon {
    display: inline-block !important;
    font-size: 1.15rem;
  }

  /* Single Column Stack with Board Priority */
  .puzzle-training-arena {
    display: flex !important;
    flex-direction: column !important;
    width: 100vw !important;
    max-width: 100vw !important;
    padding: 0 !important;
    margin: 0 !important;
    gap: 0 !important;
    align-items: center !important;
    box-sizing: border-box !important;
    background: #161512 !important;
  }

  .lid-puzzle-container {
    display: flex !important;
    flex-direction: column !important;
    width: 100vw !important;
    max-width: 100vw !important;
    padding: 0 !important;
    margin: 0 !important;
    gap: 0 !important;
    align-items: center !important;
    box-sizing: border-box !important;
    background: #161512 !important;
  }

  /* Order 1: Board Center (Ribbon + Top Puzzle Bar + Board + Bottom Solver Bar + Bottom Toolbar) */
  .lid-board-center {
    order: 1 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    margin: 0 !important;
    padding: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    box-sizing: border-box !important;
    background: #161512 !important;
  }

  /* Hide pre-board bulky controls & eval on mobile phone */
  .lid-board-header {
    display: none !important;
  }

  .lid-eval-strip {
    display: none !important;
  }

  .puzzle-session-strip {
    display: none !important;
  }

  .puzzle-highway-status {
    display: none !important;
  }

  .keyboard-shortcuts-hint {
    display: none !important;
  }

  /* Show Mobile-Only Elements */
  .lid-mobile-only {
    display: flex !important;
  }

  /* Moves Ribbon (Single horizontal line) */
  .lid-mobile-moves-ribbon {
    width: 100vw !important;
    max-width: 100vw !important;
    height: 28px !important;
    min-height: 28px !important;
    padding: 0 12px !important;
    box-sizing: border-box !important;
    background: #161512 !important;
    display: flex !important;
    align-items: center !important;
    overflow-x: auto !important;
    white-space: nowrap !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04) !important;
  }

  .lid-mobile-moves-ribbon::-webkit-scrollbar {
    display: none !important;
  }

  .ribbon-scroll-track {
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    font-size: 0.82rem !important;
    font-family: monospace, sans-serif !important;
    color: #888888 !important;
  }

  .ribbon-scroll-track .ribbon-empty-text {
    color: #666666 !important;
    font-style: italic !important;
    font-size: 0.78rem !important;
  }

  .ribbon-scroll-track .ribbon-move-num {
    color: #777777 !important;
    font-weight: 600 !important;
  }

  .ribbon-scroll-track .ribbon-move-text {
    color: #cccccc !important;
    font-weight: 500 !important;
    cursor: pointer !important;
  }

  .ribbon-scroll-track .ribbon-move-text.current {
    color: #ffffff !important;
    font-weight: 800 !important;
    background: rgba(255, 255, 255, 0.12) !important;
    padding: 1px 4px !important;
    border-radius: 3px !important;
  }

  /* Mobile Player Bars (Puzzle top, Solver bottom) */
  .lid-mobile-player-bar {
    width: 100vw !important;
    max-width: 100vw !important;
    height: 48px !important;
    min-height: 48px !important;
    padding: 0 12px !important;
    box-sizing: border-box !important;
    background: #161512 !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    margin: 0 !important;
  }

  .lid-ctrl-player-left {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
  }

  .green-dot {
    width: 10px !important;
    height: 10px !important;
    border-radius: 50% !important;
    background: #629924 !important;
    display: inline-block !important;
    flex-shrink: 0 !important;
    margin: 0 !important;
  }

  .lid-mobile-name-col {
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    line-height: 1.15 !important;
  }

  .lid-mobile-player-name {
    font-weight: 700 !important;
    font-size: 0.95rem !important;
    color: #ffffff !important;
    letter-spacing: 0.2px !important;
  }

  .lid-player-rating-badge {
    font-size: 0.78rem !important;
    font-weight: 600 !important;
    color: #b58863 !important;
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
  }

  .lid-mobile-clock-wrap {
    display: flex !important;
    align-items: center !important;
  }

  /* Digital Clock Rating Card */
  .lid-mobile-clock {
    font-size: 1.45rem !important;
    padding: 3px 14px !important;
    min-width: 80px !important;
    border-radius: 4px !important;
    line-height: 1.1 !important;
    font-weight: 800 !important;
    font-family: monospace, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    box-sizing: border-box !important;
    background: #262421 !important;
    border: none !important;
    color: #ffffff !important;
    box-shadow: none !important;
    letter-spacing: 1px !important;
    text-align: center !important;
  }

  .lid-mobile-clock.active {
    background: #262421 !important;
    color: #ffffff !important;
    border: none !important;
    box-shadow: none !important;
  }

  /* EXACT 100vw FLUSH EDGE-TO-EDGE DRAUGHTS BOARD */
  .lid-board-outer {
    width: 100vw !important;
    height: 100vw !important;
    max-width: 100vw !important;
    max-height: 100vw !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    display: block !important;
    position: relative !important;
    box-sizing: border-box !important;
  }

  .lid-coords-right,
  .lid-coords-bottom {
    display: none !important;
  }

  .board-wood-frame {
    width: 100vw !important;
    height: 100vw !important;
    max-width: 100vw !important;
    max-height: 100vw !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    background: none !important;
    box-sizing: border-box !important;
  }

  .board-wood-frame::before,
  .board-wood-frame::after {
    display: none !important;
  }

  .lid-board-resize-handle {
    display: none !important;
  }

  .board-inner {
    width: 100vw !important;
    height: 100vw !important;
    max-width: 100vw !important;
    max-height: 100vw !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    display: grid !important;
    grid-template-columns: repeat(10, 10vw) !important;
    grid-template-rows: repeat(10, 10vw) !important;
    box-sizing: border-box !important;
  }

  /* Exact 10vw x 10vw Squares */
  .square {
    width: 10vw !important;
    height: 10vw !important;
    position: relative !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-sizing: border-box !important;
  }

  /* Hide default row/col letters and cluttered 1-50 numbers on mobile */
  .square-coord {
    display: none !important;
  }

  .sq-draughts-num {
    display: none !important;
  }

  /* Numbers on Edge Dark Squares (5..45 Right, 46..50 Bottom) */
  .sq-num-label {
    display: block !important;
    position: absolute !important;
    bottom: 2px !important;
    right: 3px !important;
    font-size: 0.65rem !important;
    font-weight: 700 !important;
    color: rgba(240, 217, 181, 0.65) !important;
    pointer-events: none !important;
    z-index: 1 !important;
    line-height: 1 !important;
    margin: 0 !important;
    padding: 0 !important;
    user-select: none !important;
  }

  /* UNIFORM SEEDS (PIECES) ACROSS ALL SQUARES */
  .piece {
    width: 84% !important;
    height: 84% !important;
    max-width: 84% !important;
    max-height: 84% !important;
    margin: auto !important;
    flex-shrink: 0 !important;
    z-index: 2 !important;
  }

  /* Soft Olive Last-Move Square Highlights */
  .square.sq-last-from,
  .square.sq-last-to {
    background-color: rgba(170, 162, 58, 0.45) !important;
  }

  /* Mobile Bottom 4-Icon Toolbar */
  .lid-mobile-bottom-toolbar {
    width: 100vw !important;
    max-width: 100vw !important;
    height: 48px !important;
    min-height: 48px !important;
    background: #161512 !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-around !important;
    padding: 0 10px !important;
    box-sizing: border-box !important;
    border-top: 1px solid rgba(255, 255, 255, 0.06) !important;
    margin: 0 !important;
  }

  .mob-tool-btn {
    background: transparent !important;
    border: none !important;
    color: #888888 !important;
    padding: 8px 16px !important;
    cursor: pointer !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: color 0.15s ease !important;
  }

  .mob-tool-btn:hover,
  .mob-tool-btn:active {
    color: #ffffff !important;
  }

  /* Order 2 & 3: Sidebar Controls Below Mobile Screen Fold */
  .lid-sidebar-right {
    order: 2 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    margin: 10px 0 0 !important;
    padding: 0 12px 10px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
    box-sizing: border-box !important;
  }

  .lid-sidebar-left {
    order: 3 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    margin: 0 !important;
    padding: 0 12px 24px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
    box-sizing: border-box !important;
  }

  /* Feedback box on mobile */
  .lid-feedback-box {
    padding: 10px 12px;
    gap: 6px;
    width: 100%;
    box-sizing: border-box;
  }

  .puzzle-trainer-body .turn-prompt {
    font-size: 0.88rem !important;
  }

  .feedback-title {
    font-size: 1.05rem;
  }

  .feedback-desc {
    font-size: 0.8rem;
    line-height: 1.35;
  }

  /* Prominent Big CTA Button */
  .lid-btn-continue {
    height: 48px;
    font-size: 0.98rem;
    letter-spacing: 0.3px;
    border-radius: 6px;
  }

  /* Step Controls & Auxiliary Tools */
  .lid-step-btn {
    padding: 10px 0;
    font-size: 0.92rem;
  }

  .lid-aux-btn {
    padding: 9px 4px;
    font-size: 0.82rem;
  }

  /* Move History Table */
  .lid-notation-card {
    min-height: 90px;
    max-height: 140px;
  }

  .lid-notation-scroll {
    max-height: 140px;
  }

  .lid-notation-table {
    font-size: 0.85rem;
  }

  .lid-notation-table td {
    padding: 4px 8px;
  }

  /* Left Sidebar Cards on mobile */
  .lid-puzzle-info-card {
    padding: 10px 12px;
    gap: 10px;
  }

  .lid-target-icon-wrap {
    width: 38px;
    height: 38px;
  }

  .lid-target-svg {
    width: 26px;
    height: 26px;
  }

  .lid-puzzle-link {
    font-size: 0.98rem;
  }

  .lid-info-rating {
    font-size: 0.82rem;
  }

  .lid-rating-graph-card {
    padding: 10px 12px 8px;
  }

  .lid-chart-container {
    height: 55px;
  }

  /* Filter Drawer & Chips */
  .lid-filters-content {
    padding: 10px 12px 14px;
  }

  .puzzle-chips-grid {
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 5px;
    max-height: 160px;
  }

  .filter-btn {
    padding: 5px 8px;
    font-size: 0.72rem;
  }

  /* Classical Coups Modal */
  .coups-modal-backdrop {
    padding: 8px;
  }

  .coups-modal-dialog {
    max-height: 95vh;
    border-radius: 6px;
  }

  .coups-modal-header {
    padding: 14px 16px 10px;
  }

  .coups-modal-title {
    font-size: 1.12rem;
  }

  .coups-modal-subtitle {
    font-size: 0.78rem;
  }

  .coups-modal-toolbar {
    padding: 10px 14px;
    gap: 8px;
  }

  .coups-search-wrap {
    min-width: 100%;
  }

  .coups-star-filters {
    gap: 4px;
  }

  .coup-star-pill {
    font-size: 0.72rem;
    padding: 3px 8px;
  }

  .coups-grid {
    grid-template-columns: 1fr;
    padding: 12px 14px;
    gap: 10px;
    max-height: calc(95vh - 210px);
  }
}

/* ==========================================================================
   TACTICAL PUZZLE CREATOR STUDIO & CONVERSION MODAL STYLES
   ========================================================================== */
.creator-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(4, 7, 15, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 16px;
  animation: modalFadeIn 0.22s ease-out;
}

.creator-modal-dialog {
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  width: 100%;
  max-width: 820px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.65), 0 0 24px rgba(16, 185, 129, 0.15);
  overflow: hidden;
  color: #e2e8f0;
  animation: modalSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.creator-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 18px 24px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(15, 23, 42, 0.95);
}

.creator-modal-header h3 {
  margin: 0;
  font-family: 'Cinzel', serif;
  font-size: 1.25rem;
  background: linear-gradient(135deg, #34d399, #fde047);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  align-items: center;
  gap: 8px;
}

.creator-modal-header p {
  margin: 4px 0 0;
  font-size: 0.82rem;
  color: #94a3b8;
}

.creator-modal-close {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 1.6rem;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
  transition: color 0.15s;
}

.creator-modal-close:hover {
  color: #f87171;
}

.creator-modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  max-height: calc(92vh - 140px);
}

.creator-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 14px 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(15, 23, 42, 0.95);
}

.form-group-creator {
  margin-bottom: 14px;
}

.form-group-creator label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #cbd5e1;
  margin-bottom: 5px;
}

.form-control-creator {
  width: 100%;
  padding: 9px 12px;
  font-size: 0.88rem;
  background: rgba(2, 6, 23, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  color: #f8fafc;
  outline: none;
  transition: all 0.2s;
  box-sizing: border-box;
}

.form-control-creator:focus {
  border-color: #10b981;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.25);
}

.creator-step-row {
  display: grid;
  grid-template-columns: 95px 1fr 1fr 1fr auto;
  gap: 8px;
  align-items: center;
}

.btn-del-step {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #f87171;
  border-radius: 6px;
  padding: 8px 10px;
  cursor: pointer;
  font-weight: bold;
  line-height: 1;
}

.btn-del-step:hover {
  background: rgba(239, 68, 68, 0.3);
}

.creator-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 14px 20px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  z-index: 99999;
  animation: modalSlideUp 0.3s ease-out;
  display: flex;
  align-items: center;
  gap: 10px;
}

.creator-toast.success {
  background: #064e3b;
  border: 1px solid #10b981;
  color: #d1fae5;
}

.creator-toast.error {
  background: #7f1d1d;
  border: 1px solid #f87171;
  color: #fee2e2;
}

