@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0a0a1a;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

#app {
  width: 100%;
  height: 100%;
  position: relative;
}

#game-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* ── Overlay ── */
#ui-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* ── Top Bar ── */
#top-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 16px;
  pointer-events: auto;
  flex-wrap: wrap;
}

/* ── Turn Indicator ── */
#turn-indicator {
  background: rgba(15, 15, 35, 0.75);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: #e0e0e0;
  padding: 10px 24px;
  border-radius: 28px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.6px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  text-align: center;
  min-width: 170px;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

#turn-indicator.white-turn {
  background: rgba(255, 255, 255, 0.9);
  color: #1a1a2e;
  border-color: rgba(255, 255, 255, 0.6);
  box-shadow: 0 4px 24px rgba(255, 255, 255, 0.15), 0 0 40px rgba(255, 255, 255, 0.05);
}

#turn-indicator.black-turn {
  background: rgba(15, 15, 35, 0.9);
  color: #d0d0e0;
  border-color: rgba(100, 100, 200, 0.2);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4), 0 0 40px rgba(80, 80, 180, 0.05);
}

#turn-indicator.check {
  animation: pulse-check 1.2s ease infinite;
  border-color: rgba(255, 60, 60, 0.4) !important;
}

#turn-indicator.game-over {
  background: linear-gradient(135deg, rgba(255, 170, 50, 0.2), rgba(255, 80, 80, 0.2));
  border-color: rgba(255, 170, 50, 0.4);
  color: #ffd700;
  font-size: 17px;
  box-shadow: 0 4px 30px rgba(255, 170, 50, 0.2);
}

@keyframes pulse-check {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 50, 50, 0.4), 0 4px 24px rgba(0, 0, 0, 0.3); }
  50% { box-shadow: 0 0 0 10px rgba(255, 50, 50, 0), 0 4px 24px rgba(0, 0, 0, 0.3); }
}

/* ── AI Controls ── */
#ai-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(15, 15, 35, 0.75);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 28px;
  padding: 6px 14px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.toggle-label input { display: none; }

.toggle-slider {
  width: 38px;
  height: 20px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  position: relative;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.toggle-slider::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  top: 2px;
  left: 2px;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.toggle-label input:checked + .toggle-slider {
  background: linear-gradient(135deg, #4488ff, #6644ee);
  box-shadow: 0 0 12px rgba(68, 136, 255, 0.3);
}

.toggle-label input:checked + .toggle-slider::after {
  transform: translateX(18px);
}

#ai-difficulty {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #ccc;
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
  padding: 4px 8px;
  border-radius: 8px;
  cursor: pointer;
  outline: none;
  transition: all 0.2s;
}

#ai-difficulty:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.2);
}

#ai-difficulty option {
  background: #1a1a3e;
  color: #e0e0e0;
}

/* ── Buttons ── */
#btn-reset {
  background: rgba(15, 15, 35, 0.75);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.7);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

#btn-reset:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  transform: rotate(180deg);
  border-color: rgba(255, 255, 255, 0.2);
}

#btn-reset:active {
  transform: rotate(180deg) scale(0.9);
}

/* ── Status Bar ── */
#status-bar {
  text-align: center;
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  padding: 8px;
  opacity: 0;
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  letter-spacing: 1px;
}

#status-bar.visible {
  opacity: 1;
}

#status-bar.checkmate {
  color: #ff6b6b;
  font-size: 28px;
  text-shadow: 0 0 30px rgba(255, 107, 107, 0.6), 0 0 60px rgba(255, 107, 107, 0.2);
}

#status-bar.stalemate {
  color: #ffd93d;
  font-size: 28px;
  text-shadow: 0 0 30px rgba(255, 217, 61, 0.6), 0 0 60px rgba(255, 217, 61, 0.2);
}

/* ── Captured Pieces ── */
#captured-pieces {
  position: absolute;
  bottom: 14px;
  left: 14px;
  right: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.captured-row {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  font-size: 20px;
  min-height: 24px;
  padding: 6px 12px;
  background: rgba(15, 15, 35, 0.6);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  letter-spacing: 2px;
}

.captured-row:empty {
  display: none;
}

/* ── AI Thinking Indicator ── */
#ai-thinking {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(10, 10, 30, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: #b0b0e0;
  padding: 14px 28px;
  border-radius: 16px;
  font-size: 15px;
  font-weight: 600;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
  z-index: 50;
  border: 1px solid rgba(100, 100, 200, 0.15);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  letter-spacing: 0.5px;
}

#ai-thinking.visible {
  opacity: 1;
}

#ai-thinking .dots::after {
  content: '';
  animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
  0%   { content: ''; }
  25%  { content: '.'; }
  50%  { content: '..'; }
  75%  { content: '...'; }
}

/* ── Promotion Modal ── */
#promotion-modal {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  z-index: 100;
}

#promotion-modal.hidden {
  display: none;
}

.modal-content {
  background: linear-gradient(145deg, rgba(25, 25, 55, 0.95), rgba(15, 15, 40, 0.95));
  border-radius: 20px;
  padding: 28px;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6), 0 0 40px rgba(80, 80, 200, 0.1);
}

.modal-content h3 {
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 18px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
}

#promotion-choices {
  display: flex;
  gap: 14px;
}

.promo-btn {
  width: 64px;
  height: 64px;
  font-size: 38px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  cursor: pointer;
  color: #fff;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
}

.promo-btn:hover {
  background: rgba(68, 136, 255, 0.2);
  transform: translateY(-4px);
  border-color: rgba(68, 136, 255, 0.4);
  box-shadow: 0 8px 24px rgba(68, 136, 255, 0.2);
}

.promo-btn:active {
  transform: translateY(-1px) scale(0.96);
}

/* ── Mobile Adjustments ── */
@media (max-width: 600px) {
  #top-bar {
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 12px;
  }

  #turn-indicator {
    font-size: 13px;
    padding: 8px 18px;
    min-width: 140px;
    order: 1;
  }

  #ai-controls {
    padding: 4px 10px;
    gap: 6px;
    order: 2;
  }

  #btn-reset {
    width: 38px;
    height: 38px;
    font-size: 18px;
    order: 3;
  }

  .captured-row {
    font-size: 16px;
    padding: 4px 8px;
  }

  .promo-btn {
    width: 52px;
    height: 52px;
    font-size: 32px;
  }

  .modal-content {
    padding: 20px;
  }
}

@media (max-width: 380px) {
  #turn-indicator {
    font-size: 11px;
    padding: 6px 14px;
    min-width: 120px;
  }

  .toggle-label {
    font-size: 10px;
  }

  .toggle-slider {
    width: 32px;
    height: 18px;
  }

  .toggle-slider::after {
    width: 14px;
    height: 14px;
  }

  .toggle-label input:checked + .toggle-slider::after {
    transform: translateX(14px);
  }
}

/* ── Learn Mode Button ── */
#btn-learn {
  background: rgba(15, 15, 35, 0.75);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.7);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

#btn-learn:hover {
  background: rgba(68, 136, 255, 0.25);
  color: #fff;
  border-color: rgba(68, 136, 255, 0.4);
}

#btn-learn.active {
  background: linear-gradient(135deg, rgba(68, 136, 255, 0.3), rgba(102, 68, 238, 0.3));
  border-color: rgba(68, 136, 255, 0.5);
  color: #fff;
  box-shadow: 0 4px 24px rgba(68, 136, 255, 0.2), 0 0 12px rgba(68, 136, 255, 0.15);
}

/* ── Coach Panel ── */
#coach-panel {
  position: absolute;
  top: 60px;
  right: 0;
  width: 320px;
  bottom: 80px;
  background: rgba(10, 10, 30, 0.92);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  border-top-left-radius: 16px;
  border-bottom-left-radius: 16px;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
  z-index: 40;
  box-shadow: -4px 0 30px rgba(0, 0, 0, 0.4);
  overflow: hidden;
}

#coach-panel.coach-closed {
  transform: translateX(100%);
  opacity: 0;
  pointer-events: none;
}

/* ── Coach Tabs ── */
#coach-tabs {
  display: flex;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.coach-tab {
  flex: 1;
  padding: 12px 8px;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.45);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
}

.coach-tab:hover {
  color: rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.03);
}

.coach-tab.active {
  color: #6ea8fe;
}

.coach-tab.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 20%;
  width: 60%;
  height: 2px;
  background: linear-gradient(90deg, #4488ff, #6644ee);
  border-radius: 2px;
}

/* ── Tab Content ── */
.coach-tab-content {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.coach-tab-content::-webkit-scrollbar {
  width: 4px;
}

.coach-tab-content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
}

.coach-tab-content.active {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ── Eval Bar ── */
#eval-bar-container {
  flex-shrink: 0;
}

#eval-bar {
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 6px;
}

#eval-fill {
  height: 100%;
  width: 50%;
  background: linear-gradient(90deg, #4caf50, #81c784);
  border-radius: 4px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1), background 0.4s ease;
}

#eval-fill.losing {
  background: linear-gradient(90deg, #f44336, #e57373);
}

#eval-label {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
  text-align: center;
  font-weight: 500;
}

/* ── Coach Messages ── */
#coach-messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.coach-msg {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  padding: 12px 14px;
  border-left: 3px solid #9e9e9e;
  animation: msgSlideIn 0.3s ease-out;
}

.coach-msg .msg-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 6px;
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
}

.coach-msg .msg-text {
  font-size: 13px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.8);
}

.coach-msg.brilliant { border-left-color: #00e5ff; }
.coach-msg.brilliant .msg-badge { color: #00e5ff; }
.coach-msg.good { border-left-color: #4caf50; }
.coach-msg.good .msg-badge { color: #4caf50; }
.coach-msg.neutral { border-left-color: #9e9e9e; }
.coach-msg.neutral .msg-badge { color: #9e9e9e; }
.coach-msg.inaccuracy { border-left-color: #ff9800; }
.coach-msg.inaccuracy .msg-badge { color: #ff9800; }
.coach-msg.mistake { border-left-color: #f44336; }
.coach-msg.mistake .msg-badge { color: #f44336; }
.coach-msg.blunder { border-left-color: #d50000; }
.coach-msg.blunder .msg-badge { color: #d50000; }
.coach-msg.great { border-left-color: #2196f3; }
.coach-msg.great .msg-badge { color: #2196f3; }
.coach-msg.ai-move {
  border-left-color: #b388ff;
  background: rgba(179, 136, 255, 0.06);
}
.coach-msg.ai-move .msg-badge { color: #b388ff; }

.coach-msg .msg-text strong {
  color: rgba(255, 255, 255, 0.95);
  font-weight: 600;
}

.coach-msg .msg-text em {
  color: rgba(255, 255, 255, 0.5);
  font-style: italic;
  font-size: 12px;
}

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

/* ── Tactics ── */
#coach-tactics {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tactic-tip {
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.75);
  animation: msgSlideIn 0.3s ease-out;
}

.tactic-tip.danger {
  background: rgba(244, 67, 54, 0.1);
  border: 1px solid rgba(244, 67, 54, 0.2);
}

.tactic-tip.opportunity {
  background: rgba(76, 175, 80, 0.1);
  border: 1px solid rgba(76, 175, 80, 0.2);
}

.tactic-tip.tip {
  background: rgba(68, 136, 255, 0.08);
  border: 1px solid rgba(68, 136, 255, 0.15);
}

.tactic-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.tactic-tip.danger .tactic-label { color: #f44336; }
.tactic-tip.opportunity .tactic-label { color: #4caf50; }
.tactic-tip.tip .tactic-label { color: #4488ff; }

/* ── Hint Tab ── */
#hint-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding-top: 10px;
}

.hint-intro {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.55);
  text-align: center;
  line-height: 1.5;
}

.coach-btn {
  background: linear-gradient(135deg, #4488ff, #6644ee);
  border: none;
  color: #fff;
  padding: 12px 32px;
  border-radius: 12px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 4px 16px rgba(68, 136, 255, 0.3);
}

.coach-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(68, 136, 255, 0.4);
}

.coach-btn:active {
  transform: translateY(0);
}

.coach-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

#hint-result {
  width: 100%;
  min-height: 20px;
}

#hint-result .hint-text {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  padding: 14px;
  font-size: 14px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.85);
  text-align: center;
  border: 1px solid rgba(68, 136, 255, 0.15);
  animation: msgSlideIn 0.3s ease-out;
}

#hint-level-indicator {
  display: flex;
  gap: 6px;
  justify-content: center;
}

.hint-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  transition: background 0.3s ease;
}

.hint-dot.active {
  background: #4488ff;
}

/* ── Rules Tab ── */
#rules-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rule-card {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: border-color 0.2s ease;
}

.rule-card:hover {
  border-color: rgba(255, 255, 255, 0.1);
}

.rule-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  cursor: pointer;
  user-select: none;
}

.rule-icon {
  font-size: 22px;
  width: 32px;
  text-align: center;
}

.rule-title {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.8);
  flex: 1;
}

.rule-arrow {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.3);
  transition: transform 0.25s ease;
}

.rule-card.open .rule-arrow {
  transform: rotate(90deg);
}

.rule-body {
  display: none;
  padding: 0 14px 12px;
}

.rule-card.open .rule-body {
  display: block;
}

.rule-body li {
  font-size: 12px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 6px;
  list-style: none;
  padding-left: 12px;
  position: relative;
}

.rule-body li strong {
  color: rgba(255, 255, 255, 0.85);
  font-weight: 600;
}

.rule-body li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(68, 136, 255, 0.5);
}

/* ── Strategy Section ── */
.strategy-title {
  color: rgba(255, 255, 255, 0.5);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 12px;
  margin-bottom: 8px;
}

#strategy-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.strategy-card {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 10px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.strategy-card h5 {
  font-size: 12px;
  font-weight: 600;
  color: #6ea8fe;
  margin-bottom: 6px;
}

.strategy-card p {
  font-size: 11px;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.55);
  margin: 0;
}

/* Landscape mobile */
@media (max-height: 500px) {
  #top-bar {
    padding: 6px 10px;
  }

  #captured-pieces {
    bottom: 4px;
  }

  #status-bar {
    font-size: 16px;
  }
}

/* ── Coach Panel Mobile ── */
@media (max-width: 600px) {
  #coach-panel {
    width: 100%;
    top: 54px;
    bottom: 70px;
    border-radius: 0;
    border-left: none;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
  }

  #btn-learn {
    width: 38px;
    height: 38px;
    font-size: 16px;
  }
}

/* ── Language Selector ── */
.lang-select {
  background: rgba(15, 15, 35, 0.7);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  color: #ccc;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 6px 10px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  pointer-events: auto;
}

.lang-select option {
  background: #1a1a2e;
  color: #ccc;
}

/* ── Game Nav Links ── */
.game-nav {
  display: flex;
  gap: 8px;
  pointer-events: auto;
}

.game-nav-link {
  color: #8888cc;
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 12px;
  background: rgba(15, 15, 35, 0.5);
  border: 1px solid rgba(100, 100, 200, 0.15);
  transition: all 0.3s;
}

.game-nav-link:hover {
  color: #aaaaff;
  border-color: rgba(100, 100, 200, 0.4);
  background: rgba(30, 30, 60, 0.6);
}

/* ── Enhanced Mobile ── */
@media (max-width: 480px) {
  #top-bar {
    gap: 5px;
    padding: 8px 8px;
  }
  #turn-indicator {
    font-size: 12px;
    padding: 6px 12px;
    min-width: auto;
    border-radius: 16px;
  }
  #ai-controls {
    padding: 3px 8px;
    gap: 4px;
    border-radius: 16px;
  }
  .toggle-text { font-size: 10px; }
  .toggle-slider { width: 28px; height: 16px; }
  .toggle-slider::after { width: 12px; height: 12px; }
  .toggle-label input:checked + .toggle-slider::after { transform: translateX(12px); }
  #ai-difficulty { font-size: 10px; padding: 3px 6px; }
  #btn-reset, #btn-learn { width: 34px; height: 34px; font-size: 16px; }
  #captured-pieces { bottom: 8px; left: 8px; right: 8px; }
  .captured-row { font-size: 14px; padding: 3px 6px; border-radius: 8px; }
  #status-bar.checkmate, #status-bar.stalemate { font-size: 22px; }
  .promo-btn { width: 48px; height: 48px; font-size: 28px; border-radius: 12px; }
  .modal-content { padding: 16px; border-radius: 14px; }
  #coach-panel { top: 48px; bottom: 56px; }
  .game-nav-link { font-size: 9px; padding: 3px 6px; }
}
@media (max-height: 500px) and (orientation: landscape) {
  #top-bar { padding: 4px 8px; }
  #turn-indicator { padding: 4px 10px; font-size: 11px; }
  #btn-reset, #btn-learn { width: 30px; height: 30px; font-size: 14px; }
  #captured-pieces { bottom: 4px; }
  .captured-row { font-size: 12px; }
}
