:root {
  --bg-main: #FAF8F2;
  --bg-card: #FFFFFF;
  --bg-elevated: #F2F7F2;
  --border-subtle: #D1E7D2;
  --text-primary: #1B3B2B;
  --text-secondary: #2B5941;
  --accent: #5B9A59;
  --accent-strong: #1B3B2B;
  --success: #5B9A59;
  --warning: #d97706;
  --danger: #D98C96;

  --sq-light: #eeeed2;
  --sq-dark: #769656;
  --sq-highlight: rgba(250, 204, 21, 0.5);
  --sq-selected: rgba(46, 125, 71, 0.45);
  --sq-hint: rgba(22, 163, 74, 0.55);
}

.app-shell * {
  box-sizing: border-box;
}

body {
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
}

h1, h2, h3, .page-title {
  font-family: "Outfit", "Plus Jakarta Sans", sans-serif;
}

.dropdown-panel {
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.dropdown-group:hover .dropdown-panel,
.dropdown-group.open .dropdown-panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.page-intro {
  margin-bottom: 20px;
}

.page-intro-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.page-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.page-sub {
  font-size: 0.95rem;
  color: var(--text-secondary);
  opacity: 0.85;
  margin-top: 4px;
}

.app-shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px 20px 32px;
}

/* Header */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-badge {
  background: rgba(239, 68, 68, 0.16);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.4);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 4px 8px;
  border-radius: 6px;
}

.brand h1 {
  font-size: 1.25rem;
  font-weight: 700;
}

.topbar-actions {
  display: flex;
  gap: 8px;
}

/* Buttons */
.btn {
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.1s ease;
  color: var(--text-primary);
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--accent-strong);
  color: #fff;
}

.btn-primary:hover {
  background: #0369a1;
}

.btn-secondary {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
}

.btn-secondary:hover {
  background: #2d3646;
}

.btn-secondary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.btn-ghost:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
}

.btn-sm {
  padding: 4px 10px;
  font-size: 0.78rem;
}

/* Layout */
.study-layout {
  display: grid;
  grid-template-columns: minmax(320px, 560px) 1fr;
  gap: 24px;
  align-items: start;
}

@media (max-width: 940px) {
  .study-layout {
    grid-template-columns: 1fr;
  }
}

/* Board Stage */
.board-stage {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.player-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 8px 14px;
  flex-wrap: wrap;
}

.player-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 0.92rem;
}

.color-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #64748b;
  display: inline-block;
}

.color-dot.white {
  background: #f8fafc;
}

.color-dot.black {
  background: #0f172a;
}

.turn-pill {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--accent);
}

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

.board-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid var(--border-subtle);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  user-select: none;
}

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

.square {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.square.light {
  background-color: var(--sq-light);
  color: #7c5836;
}

.square.dark {
  background-color: var(--sq-dark);
  color: #f3e6cf;
}

.square.last-move::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--sq-highlight);
  pointer-events: none;
}

.square.selected::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--sq-selected);
  pointer-events: none;
}

.square.guide-from {
  box-shadow: inset 0 0 0 4px #0ea5e9;
}

.square.guide-from::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(14, 165, 233, 0.28);
  pointer-events: none;
}

.square.guide-to {
  box-shadow: inset 0 0 0 4px #16a34a;
}

.square.guide-to::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(22, 163, 74, 0.34);
  pointer-events: none;
}

.square.legal-target::before {
  content: "";
  position: absolute;
  width: 28%;
  height: 28%;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.3);
  z-index: 2;
  pointer-events: none;
}

.square.legal-capture::before {
  content: "";
  position: absolute;
  width: 82%;
  height: 82%;
  border-radius: 50%;
  border: 4px solid rgba(15, 23, 42, 0.35);
  background: transparent;
  z-index: 2;
  pointer-events: none;
}

.coord-rank {
  position: absolute;
  top: 2px;
  left: 4px;
  font-size: 0.65rem;
  font-weight: 700;
  pointer-events: none;
  z-index: 1;
}

.coord-file {
  position: absolute;
  bottom: 2px;
  right: 4px;
  font-size: 0.65rem;
  font-weight: 700;
  pointer-events: none;
  z-index: 1;
}

.piece-svg {
  width: 84%;
  height: 84%;
  z-index: 3;
  cursor: grab;
  transition: transform 0.1s ease;
}

.piece-svg:active {
  cursor: grabbing;
}

.board-arrows {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
}

/* Right Study Panel */
.study-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.opening-overview {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
  font-size: 0.86rem;
  color: #cbd5e1;
}

.opening-overview p {
  margin-bottom: 6px;
}

.opening-goals {
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  color: var(--text-secondary);
  font-size: 0.82rem;
}

.panel-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 16px;
}

/* Opening Selector */
.filter-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.filter-tab {
  flex: 1;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.filter-tab.active {
  background: var(--accent-strong);
  border-color: var(--accent);
  color: #fff;
}

.opening-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
}

.opening-item {
  text-align: left;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
  color: var(--text-primary);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.opening-item:hover {
  border-color: var(--accent);
}

.opening-item.active {
  border-color: var(--accent);
  background: rgba(56, 189, 248, 0.12);
}

.opening-item-title {
  font-size: 0.88rem;
  font-weight: 700;
  display: block;
}

.opening-item-meta {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Presenter Card */
.presenter-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}

.opening-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
  margin-bottom: 2px;
}

.presenter-header h2 {
  font-size: 1.2rem;
}

.step-counter {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-elevated);
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.progress-track {
  height: 6px;
  background: var(--bg-elevated);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 14px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-strong), var(--success));
  transition: width 0.25s ease;
}

.feedback-banner {
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.88rem;
  margin-bottom: 14px;
  border: 1px solid transparent;
}

.feedback-banner.info {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.35);
  color: #bae6fd;
}

.feedback-banner.success {
  background: rgba(34, 197, 94, 0.14);
  border-color: rgba(34, 197, 94, 0.4);
  color: #bbf7d0;
}

.feedback-banner.warning {
  background: rgba(245, 158, 11, 0.14);
  border-color: rgba(245, 158, 11, 0.4);
  color: #fde68a;
}

.explanation-box h3 {
  font-size: 1rem;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.explanation-box p {
  font-size: 0.94rem;
  color: #cbd5e1;
  margin-bottom: 10px;
}

.move-tip {
  background: var(--bg-elevated);
  border-left: 3px solid var(--accent);
  padding: 8px 12px;
  border-radius: 0 8px 8px 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.presenter-footer {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.move-history {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
}

.history-chip {
  font-size: 0.78rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--bg-elevated);
  padding: 3px 8px;
  border-radius: 6px;
  color: var(--text-secondary);
}

.history-chip.current {
  color: var(--text-primary);
  border: 1px solid var(--accent);
}

/* Lichess Explorer */
.lichess-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.lichess-title {
  display: flex;
  flex-direction: column;
}

.lichess-title span {
  font-weight: 700;
  font-size: 0.92rem;
}

.lichess-title small {
  color: var(--text-secondary);
  font-size: 0.76rem;
}

.lichess-body {
  margin-top: 12px;
  border-top: 1px solid var(--border-subtle);
  padding-top: 10px;
}

.lichess-status {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.lichess-moves {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.lichess-row {
  display: grid;
  grid-template-columns: 56px 64px 1fr;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
}

.lichess-san {
  font-weight: 700;
  font-family: ui-monospace, monospace;
}

.lichess-games {
  color: var(--text-secondary);
}

.lichess-bar {
  display: flex;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--bg-elevated);
}

.bar-w { background: #f8fafc; }
.bar-d { background: #64748b; }
.bar-b { background: #0f172a; }

.app-shell .hidden {
  display: none !important;
}

/* ==================== MAIN TOP NAVIGATION ==================== */
.main-nav {
  display: flex;
  gap: 8px;
  margin-left: 8px;
  flex-wrap: wrap;
}

.main-nav-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.main-nav-btn:hover {
  color: var(--text-primary);
  border-color: var(--accent);
}

.main-nav-btn.active {
  background: var(--accent-strong);
  border-color: var(--accent);
  color: #fff;
}

/* ==================== MANUAL PDF LAYOUT ==================== */
.manual-layout {
  display: grid;
  grid-template-columns: 290px 1fr;
  gap: 24px;
  align-items: start;
}

@media (max-width: 900px) {
  .manual-layout {
    grid-template-columns: 1fr;
  }
  .manual-sidebar-card {
    position: static;
  }
}

.manual-accordion-toggle {
  display: none;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
}

.manual-accordion-chevron {
  transition: transform 0.2s ease;
}

.manual-accordion-toggle[aria-expanded="true"] .manual-accordion-chevron {
  transform: rotate(180deg);
}

@media (max-width: 900px) {
  .manual-accordion-toggle {
    display: flex;
  }
  .manual-accordion-body {
    display: none;
    margin-top: 12px;
  }
  .manual-accordion-body.open {
    display: block;
  }
}

@media (max-width: 480px) {
  .board-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
  }
  .player-bar {
    flex-wrap: wrap;
    gap: 8px;
  }
}

.manual-sidebar-card {
  position: sticky;
  top: 16px;
}

.manual-source-meta {
  margin-bottom: 12px;
}

.manual-source-meta p {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.manual-search-box {
  margin-bottom: 12px;
}

.manual-search-box input {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.85rem;
  outline: none;
}

.manual-search-box input:focus {
  border-color: var(--accent);
}

.manual-blocks-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.manual-block-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  border-radius: 8px;
  padding: 9px 12px;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.manual-block-btn:hover {
  border-color: var(--accent);
}

.manual-block-btn.active {
  background: rgba(56, 189, 248, 0.14);
  border-color: var(--accent);
}

.block-num {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--bg-card);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.block-btn-text {
  display: flex;
  flex-direction: column;
}

.block-btn-title {
  font-size: 0.86rem;
  font-weight: 700;
}

.block-btn-sub {
  font-size: 0.73rem;
  color: var(--text-secondary);
}

.manual-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.manual-block-header h2 {
  font-size: 1.35rem;
  margin: 4px 0 6px;
}

.manual-block-header p {
  color: #cbd5e1;
  font-size: 0.94rem;
}

.manual-sections {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.manual-section-card h3 {
  font-size: 1.05rem;
  color: var(--accent);
  margin-bottom: 8px;
}

.manual-section-card p {
  font-size: 0.93rem;
  color: #cbd5e1;
  margin-bottom: 10px;
}

.manual-list {
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: #cbd5e1;
  font-size: 0.9rem;
  margin-bottom: 10px;
}

.manual-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  margin-top: 8px;
}

.manual-mini-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 10px 12px;
}

.manual-mini-card strong {
  display: block;
  font-size: 0.88rem;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.manual-mini-card span,
.manual-mini-card p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin: 0;
}

.manual-quote {
  background: var(--bg-elevated);
  border-left: 3px solid var(--warning);
  padding: 10px 14px;
  border-radius: 0 8px 8px 0;
  font-size: 0.9rem;
  color: #e2e8f0;
  margin: 8px 0;
}

.manual-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 8px;
}

/* Interactive Catalog inside Manual PDF (Openings Classification) */
.catalog-explorer {
  display: grid;
  grid-template-columns: 1fr 310px;
  gap: 16px;
  align-items: start;
  margin-top: 10px;
}

@media (max-width: 760px) {
  .catalog-explorer {
    grid-template-columns: 1fr;
  }
}

.catalog-groups {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.catalog-group h4 {
  font-size: 0.86rem;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.catalog-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.catalog-chip {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: #cbd5e1;
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.12s ease;
}

.catalog-chip:hover,
.catalog-chip.active {
  border-color: var(--accent);
  background: rgba(56, 189, 248, 0.16);
  color: #fff;
}

.mini-board-box {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 12px;
  position: sticky;
  top: 16px;
}

.mini-board-title {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 2px;
}

.mini-board-moves {
  font-size: 0.78rem;
  font-family: ui-monospace, monospace;
  color: var(--accent);
  margin-bottom: 10px;
}

.mini-chessboard {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}

.mini-chessboard .square {
  cursor: default;
}

.mini-chessboard .piece-svg {
  cursor: default;
  width: 86%;
  height: 86%;
}

/* ==================== INTERACTIVE MANUAL DIAGRAMS & STEPPER ==================== */
.mini-board-controls {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}

.mini-board-controls .btn {
  flex: 1;
  padding: 6px 8px;
  font-size: 0.78rem;
}

.mini-step-info {
  margin-top: 8px;
  font-size: 0.8rem;
  color: #cbd5e1;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 8px 10px;
  min-height: 44px;
}

.mini-lichess-box {
  margin-top: 8px;
  font-size: 0.76rem;
  color: var(--text-secondary);
}

.mini-lichess-moves {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.mini-lichess-pill {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 2px 6px;
  font-family: ui-monospace, monospace;
  color: var(--text-primary);
}

.mini-action-row {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.mini-action-row .btn,
.mini-action-row a.btn {
  flex: 1;
  text-align: center;
  text-decoration: none;
  font-size: 0.78rem;
  padding: 7px 8px;
}

.diagram-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(255px, 1fr));
  gap: 14px;
  margin-top: 10px;
}

.diagram-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
}

.diagram-card-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.diagram-card-sub {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.square.zone-center::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(34, 197, 94, 0.36);
  pointer-events: none;
}

.square.zone-extended::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(56, 189, 248, 0.22);
  pointer-events: none;
}

.square.zone-square::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(245, 158, 11, 0.32);
  pointer-events: none;
}

/* ==================== AI COACH STYLES ==================== */
.ai-settings-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 540px) {
  .ai-settings-row {
    grid-template-columns: 1fr;
  }
}

.ai-setting-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ai-setting-group label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.ai-select {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
}

.ai-select:focus {
  outline: none;
  border-color: var(--accent);
}

.feedback-banner.danger {
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(239, 68, 68, 0.45);
  color: #fecaca;
}

.ai-review-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 240px;
  overflow-y: auto;
}

.ai-review-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 0.82rem;
}

.ai-review-move {
  font-family: ui-monospace, monospace;
  font-weight: 700;
}

.ai-tag {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
}

.ai-tag.good {
  background: rgba(34, 197, 94, 0.18);
  color: #86efac;
}

.ai-tag.inaccuracy {
  background: rgba(245, 158, 11, 0.2);
  color: #fde68a;
}

.ai-tag.mistake {
  background: rgba(249, 115, 22, 0.22);
  color: #fdba74;
}

.ai-tag.blunder {
  background: rgba(239, 68, 68, 0.24);
  color: #fca5a5;
}

.ai-settings-3 {
  grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 720px) {
  .ai-settings-3 {
    grid-template-columns: 1fr;
  }
}

.ai-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: 8px;
}

.ai-summary-pill {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 8px 6px;
  text-align: center;
}

.ai-summary-pill strong {
  display: block;
  font-size: 1.05rem;
  color: var(--text-primary);
}

.ai-summary-pill span {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.ai-tag.excellent {
  background: rgba(56, 189, 248, 0.22);
  color: #bae6fd;
}

.ai-review-item.clickable {
  cursor: pointer;
  transition: border-color 0.12s ease, background-color 0.12s ease;
}

.ai-review-item.clickable:hover {
  border-color: var(--accent);
}

.ai-review-item.active-review {
  border-color: var(--accent);
  background: rgba(56, 189, 248, 0.14);
}

/* ==================== CHECK ALERT & USER ARROWS ==================== */
.square.in-check {
  background: radial-gradient(circle, rgba(239, 68, 68, 0.85) 0%, rgba(185, 28, 28, 0.55) 70%, transparent 100%) !important;
}

.square.user-circle::before {
  content: "";
  position: absolute;
  inset: 6%;
  border-radius: 50%;
  border: 4px solid rgba(245, 158, 11, 0.9);
  pointer-events: none;
  z-index: 4;
}

.check-alert-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.6);
  color: #fecaca;
  font-size: 0.78rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 999px;
  letter-spacing: 0.03em;
  animation: pulseCheck 1.3s ease-in-out infinite;
}

@keyframes pulseCheck {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

.replay-auto-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.replay-auto-row .btn {
  flex: 1;
}

/* ==================== SMOOTH PIECE ANIMATION & STOCKFISH BADGE ==================== */
.piece-svg.sliding {
  position: relative;
  z-index: 10;
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

.engine-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.74rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.engine-status-pill.stockfish {
  border-color: rgba(34, 197, 94, 0.45);
  color: #86efac;
}

/* ==================== FROGGYCHESS LIGHT CREAM & GREEN THEME OVERRIDES ==================== */
.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  background: #133a22;
  padding: 6px 16px 6px 8px;
  border-radius: 14px;
  border: 1px solid #265c3a;
  box-shadow: 0 4px 12px rgba(19, 58, 34, 0.22);
  flex-shrink: 0;
}

.brand-logo {
  width: 52px;
  height: 52px;
  aspect-ratio: 1 / 1;
  flex-shrink: 0;
  border-radius: 10px;
  object-fit: cover;
  display: block;
}

.brand-title {
  font-size: 1.38rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1;
  margin: 0;
}

.brand-froggy {
  color: #ffffff;
}

.brand-chess {
  color: #a3e635;
}

.panel-card,
.player-bar {
  box-shadow: 0 2px 8px rgba(23, 51, 34, 0.06);
}

.board-wrapper {
  box-shadow: 0 10px 26px rgba(23, 51, 34, 0.18);
}

.square.light {
  color: #5a7242;
}

.square.dark {
  color: #f4f4dc;
}

.btn-secondary:hover,
.btn-ghost:hover {
  background: #e1d8c2;
}

.btn-primary:hover {
  background: #174928;
}

.explanation-box p,
.opening-overview,
.manual-block-header p,
.manual-section-card p,
.manual-list,
.mini-step-info,
.catalog-chip {
  color: #294633;
}

.manual-quote {
  color: #173322;
  background: #eef5ea;
  border-left-color: var(--accent);
}

.feedback-banner.info {
  background: #e6f2e8;
  border-color: #9bc9a5;
  color: #174325;
}

.feedback-banner.success {
  background: #dcfce7;
  border-color: #86efac;
  color: #14532d;
}

.feedback-banner.warning {
  background: #fef3c7;
  border-color: #fcd34d;
  color: #78350f;
}

.feedback-banner.danger {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #7f1d1d;
}

.ai-tag.excellent {
  background: #d1fae5;
  color: #065f46;
}

.ai-tag.good {
  background: #dcfce7;
  color: #166534;
}

.ai-tag.inaccuracy {
  background: #fef3c7;
  color: #92400e;
}

.ai-tag.mistake {
  background: #ffedd5;
  color: #9a3412;
}

.ai-tag.blunder {
  background: #fee2e2;
  color: #991b1b;
}

.check-alert-badge {
  background: #fee2e2;
  border-color: #ef4444;
  color: #991b1b;
}

.engine-status-pill.stockfish {
  background: #dcfce7;
  border-color: #86efac;
  color: #166534;
}
