/* ============================================================
   main.css — Layout, nav, shared styles
   ============================================================ */

/* --- Auth modal --- */
.auth-modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.auth-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.auth-modal-logo {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--accent);
  text-align: center;
  letter-spacing: 0.02em;
}

.auth-modal-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  text-align: center;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.auth-field label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.auth-field input {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.9rem;
  padding: 0.55rem 0.75rem;
  width: 100%;
  outline: none;
  transition: border-color 0.15s;
}

.auth-field input:focus {
  border-color: var(--accent);
}

.auth-error {
  font-size: 0.82rem;
  color: #f87171;
  background: rgba(248, 113, 113, 0.08);
  border: 1px solid rgba(248, 113, 113, 0.25);
  border-radius: 5px;
  padding: 0.5rem 0.75rem;
}

.auth-submit-btn {
  width: 100%;
  margin-top: 0.25rem;
}

.auth-forgot-row {
  font-size: 0.82rem;
  text-align: center;
  margin: 0;
}

.auth-forgot-row a {
  color: var(--text-muted);
  text-decoration: none;
}

.auth-forgot-row a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.auth-switch {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: center;
}

.auth-switch a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.auth-switch a:hover {
  text-decoration: underline;
}

.auth-verify-hint {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0 0 0.75rem;
  line-height: 1.5;
}

/* --- Header user info (shown after login) --- */
.header-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: auto;
}

.header-email {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.header-plan-badge {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  background: rgba(122,148,168,0.15);
  color: var(--text-muted);
}

.header-plan-badge--premium {
  background: rgba(86,199,255,0.15);
  color: var(--accent);
}

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

:root {
  --bg:          #030d14;
  --surface:     #051923;
  --surface-2:   #0a2535;
  --accent:      #56c7ff;
  --accent-dim:  #3db8f5;
  --text:        #dce8f0;
  --text-muted:  #7a94a8;
  --border:      #133048;
  --success:     #4caf50;
  --warning:     #ff9800;
  --danger:      #f44336;
  --radius:      8px;
}

body {
  font-family: "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* --- Header --- */
.app-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.mode-nav {
  display: flex;
  gap: 0.5rem;
}

.nav-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0.45rem 1rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.9rem;
  transition: border-color 0.15s, color 0.15s, background 0.15s, transform 0.1s;
}

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

.nav-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

/* --- Main Layout --- */
.app-main {
  display: flex;
  flex: 1;
  gap: 1.5rem;
  padding: 1.5rem;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

/* --- Side column --- */
.side-column {
  flex: 1;
  min-width: 300px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-y: auto;
}

.mode-ui {
  flex: 1;
}

/* --- Shared form elements --- */
.setup-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.setup-form h2 {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
}

.form-row {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.form-row label {
  color: var(--text-muted);
  min-width: 160px;
  font-size: 0.9rem;
}

.form-row--checkbox {
  align-items: flex-start;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
  min-width: unset;
}

.checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

.checkbox-label .hint-text {
  color: var(--text-muted);
  font-size: 0.8rem;
}

select {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  cursor: pointer;
}

textarea {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.75rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  resize: vertical;
  font-family: inherit;
  line-height: 1.5;
}

textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
}

/* --- Buttons --- */
.primary-btn {
  background: var(--accent);
  border: none;
  color: #051923;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
  box-shadow: 0 2px 8px rgba(86, 199, 255, 0.25);
}

.primary-btn:hover {
  background: var(--accent-dim);
  box-shadow: 0 4px 14px rgba(86, 199, 255, 0.35);
}
.primary-btn:active { transform: scale(0.97); box-shadow: none; }
.primary-btn:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }

.secondary-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s, transform 0.1s;
}

.secondary-btn:hover { border-color: var(--accent); color: var(--accent); background: rgba(86, 199, 255, 0.06); }
.secondary-btn:active { transform: scale(0.97); }
.secondary-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.danger-btn {
  background: transparent;
  border: 1px solid var(--danger);
  color: var(--danger);
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.1s;
}

.danger-btn:hover { background: var(--danger); color: #fff; }
.danger-btn:active { transform: scale(0.97); }

/* --- Game status --- */
.game-status {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.game-actions {
  display: flex;
  gap: 0.5rem;
}

.hint-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 0.5rem;
}

/* --- PGN input section --- */
.pgn-input-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.pgn-input-section h2 { font-size: 1.2rem; }
.pgn-input-section p { color: var(--text-muted); font-size: 0.9rem; }

#pgn-input {
  font-family: "Courier New", monospace;
  font-size: 0.8rem;
  min-height: 150px;
}

/* --- Side picker --- */
.side-picker {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.9rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.85rem;
  color: var(--text-muted);
}

.side-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.15s;
}

.side-btn:hover {
  border-color: var(--accent);
  color: var(--text);
}

.side-btn.active-side {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

/* Flip button in review controls */
.flip-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  transition: all 0.15s;
  margin-left: auto;
}

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

/* --- Review header --- */
.review-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  flex-wrap: wrap;
}

.review-player {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.review-player-icon { font-size: 1rem; }
.player-name { font-weight: 600; font-size: 0.95rem; }
.player-color-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  background: var(--surface-2, rgba(255,255,255,0.07));
  border-radius: 3px;
  padding: 1px 5px;
}
.player-elo {
  font-size: 0.8rem;
  color: var(--accent);
  font-weight: 600;
}
.vs-text { color: var(--text-muted); font-size: 0.8rem; }
.result-badge {
  margin-left: auto;
  font-weight: 700;
  color: var(--accent);
}

/* --- Review controls --- */
.review-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0;
}

.review-controls button {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.15s;
}

.review-controls button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

#rev-ply-display {
  flex: 1;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.review-status {
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: 0.25rem 0;
}

.analysis-loading {
  margin-top: 1rem;
}

.analysis-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.analysis-progress-track {
  width: 100%;
  height: 10px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.analysis-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.2s ease;
  position: relative;
  overflow: hidden;
  will-change: width;
}

/* Shimmer rides on the compositor via transform — never conflicts with width changes */
.analysis-progress-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 200, 120, 0.65) 50%,
    transparent 100%
  );
  animation: shimmer-sweep 1.5s linear infinite;
  will-change: transform;
}

@keyframes shimmer-sweep {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* --- Annotation panel --- */
.review-annotation-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.annotation-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.move-san {
  font-size: 1.1rem;
  font-weight: 700;
}

.classification-badge {
  font-weight: 600;
  font-size: 0.9rem;
}

.eval-delta {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.best-move-hint {
  font-size: 0.8rem;
  color: var(--success);
  margin-left: auto;
}

.explanation-text {
  font-size: 0.9rem;
  line-height: 1.8;
  color: var(--text);
  word-break: break-word;
}

/* --- Takeaways panel --- */
.takeaways-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.takeaways-header {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.takeaways-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.takeaways-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.82rem;
}

.ts-sep { color: var(--text-muted); }
.ts-item { font-weight: 500; }
.ts-blunder    { color: #ef5350; }
.ts-mistake    { color: #ff9800; }
.ts-inaccuracy { color: #ffd54f; }
.ts-accuracy   { color: var(--accent); font-weight: 600; }

.takeaways-btn { align-self: flex-start; }

.takeaways-text {
  font-size: 0.88rem;
  line-height: 1.75;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

/* --- Clickable move references in explanations --- */
.move-ref {
  display: inline-block;
  font-family: "Courier New", monospace;
  font-size: 0.88rem;
  font-weight: 700;
  padding: 0.05rem 0.35rem;
  border-radius: 4px;
  cursor: pointer;
  transition: filter 0.12s, transform 0.1s;
  white-space: nowrap;
  user-select: none;
}

.move-ref:hover {
  filter: brightness(1.25);
  transform: translateY(-1px);
}

/* Orange = continuation / opponent response (what actually happened) */
.move-ref.continuation-move {
  background: rgba(255, 152, 0, 0.18);
  color: #ffb74d;
  border: 1px solid rgba(255, 152, 0, 0.35);
}

/* Green = engine recommendation / better alternative */
.move-ref.best-move {
  background: rgba(76, 175, 80, 0.18);
  color: #81c784;
  border: 1px solid rgba(76, 175, 80, 0.35);
}

/* Blue = move reference in takeaways/game summary */
.move-ref.takeaway-move {
  background: rgba(100, 181, 246, 0.15);
  color: #64b5f6;
  border: 1px solid rgba(100, 181, 246, 0.3);
}

/* --- Review panel grid --- */
.review-panels-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
  margin-top: 0.6rem;
  position: relative;
}

/* Dot-grid overlay — visible only while dragging */
.review-panels-grid.dragging-active::before {
  content: "";
  position: absolute;
  inset: -4px;
  pointer-events: none;
  z-index: 10;
  border-radius: var(--radius);
  background-image: radial-gradient(circle, rgba(255,255,255,0.18) 1.5px, transparent 1.5px);
  background-size: 22px 22px;
  background-position: 11px 11px;
  animation: dot-grid-in 0.12s ease both;
}

@keyframes dot-grid-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Column placement handled via inline style: grid-column: colStart / span cols */

.review-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
  position: relative; /* for resize handle */
}

.review-panel:not(.dragging):not(.resizing):hover {
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  transform: translateY(-2px);
}

.review-panel.drag-over,
.review-panel.resizing {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(86, 199, 255, 0.2);
}

.review-panel.dragging {
  opacity: 0.45;
}

/* Resize handle — bottom-right corner */
.panel-resize-handle {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 18px;
  height: 18px;
  cursor: ew-resize;
  opacity: 0;
  transition: opacity 0.15s;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 3px;
}

.panel-resize-handle::after {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  border-radius: 1px;
}

.review-panel:hover .panel-resize-handle {
  opacity: 0.7;
}

.panel-resize-handle:hover {
  opacity: 1 !important;
}

.panel-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.6rem;
  background: rgba(255,255,255,0.04);
  border-bottom: 1px solid var(--border);
  min-height: 32px;
  flex-shrink: 0;
}

.panel-drag-handle {
  cursor: grab;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1;
  user-select: none;
  flex-shrink: 0;
  opacity: 0.5;
  transition: opacity 0.15s;
}

.panel-drag-handle:hover { opacity: 1; }
.panel-drag-handle:active { cursor: grabbing; }

.panel-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  flex: 1;
}

/* Stats in the summary panel header */
.panel-header-stats {
  font-size: 0.72rem;
  flex-wrap: wrap;
  gap: 0.2rem;
}

.panel-body {
  padding: 0.6rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  overflow-y: auto;
}

.panel-body-moves {
  max-height: 190px;
}

/* --- Settings panel --- */
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  cursor: pointer;
  user-select: none;
}

.setting-label {
  font-size: 0.88rem;
  color: var(--text);
}

.toggle-switch {
  position: relative;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 20px;
  transition: background 0.2s;
}

.toggle-slider::before {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  left: 3px;
  top: 3px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--accent);
}

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

/* --- Variation banner (above the board) --- */
.variation-banner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(86, 199, 255, 0.08);
  border: 1px solid rgba(86, 199, 255, 0.3);
  border-radius: var(--radius);
  padding: 0.5rem 0.9rem;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  width: 100%;
}

#variation-label {
  flex: 1;
  font-weight: 600;
  font-family: "Courier New", monospace;
  color: var(--accent);
}

/* --- Opening trainer — subtab bar --- */
.opening-subtabs {
  display: flex;
  gap: 0.2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.2rem;
  margin-bottom: 1rem;
}

.opening-subtab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.5rem 0.75rem;
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.15s;
}

.opening-subtab-btn:hover {
  color: var(--text);
  background: var(--surface-2);
}

.opening-subtab-btn.active {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

.opening-subtab-btn.subtab-locked {
  opacity: 0.35;
  cursor: not-allowed;
}

.opening-subtab-btn.subtab-locked:hover {
  color: var(--text-muted);
  background: transparent;
}

/* Shake animation for the "Choose an Opening" heading */
@keyframes opening-locked-shake {
  0%,  100% { transform: translateX(0); }
  18%        { transform: translateX(-9px); }
  36%        { transform: translateX(8px); }
  54%        { transform: translateX(-6px); }
  72%        { transform: translateX(4px); }
  88%        { transform: translateX(-2px); }
}

#opening-list-heading {
  transition: color 0.35s;
  display: inline-block; /* needed for translateX to work */
}

#opening-list-heading.shake-hint {
  animation: opening-locked-shake 0.45s ease;
  color: var(--accent);
}

/* --- Opening trainer — Learn tab --- */
.learn-nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

#learn-progress {
  flex: 1;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.learn-move-info {
  margin-bottom: 0.5rem;
  min-height: 1.6rem;
}

.learn-move-badge {
  font-weight: 700;
  font-family: "Courier New", monospace;
  color: var(--accent);
  font-size: 1.05rem;
  margin-right: 0.4rem;
}

.learn-move-side {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.learn-explanation {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  min-height: 5rem;
  line-height: 1.7;
}

/* --- Opening trainer — Explore tab --- */
.explore-movelist-header {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}

.explore-movelist {
  max-height: 160px;
}

/* --- Opening columns (Openings | Defenses side by side) --- */
.opening-columns {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
}

.opening-column {
  flex: 1;
  min-width: 0;
}

/* --- Opening grid --- */
.opening-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.opening-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
}

.opening-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(86, 199, 255, 0.18);
}

.eco-badge {
  font-size: 0.7rem;
  font-weight: 700;
  background: var(--surface-2);
  color: var(--accent);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  letter-spacing: 0.05em;
}

.opening-card h3 {
  font-size: 0.95rem;
  margin: 0.5rem 0 0.25rem;
}

.opening-card p {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* --- Opening trainer --- */
.opening-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.opening-header h2 {
  flex: 1;
  font-size: 1rem;
}

.progress-text {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.opening-status {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
  margin-bottom: 0.75rem;
}

.opening-actions {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.opening-feedback {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  line-height: 1.6;
  min-height: 2rem;
  transition: all 0.2s;
}

.opening-feedback.wrong {
  background: rgba(244, 67, 54, 0.1);
  border: 1px solid rgba(244, 67, 54, 0.3);
  color: #ff8a80;
}

.opening-feedback.hint {
  background: rgba(255, 152, 0, 0.1);
  border: 1px solid rgba(255, 152, 0, 0.3);
  color: #ffcc80;
}

#explain-container {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

/* --- Opening trainer — advisor tab --- */
.advisor-intro {
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 0.5rem 0 0.75rem;
  line-height: 1.5;
}

.advisor-movelist {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.15rem;
  min-height: 1.8rem;
  padding: 0.4rem 0;
  font-size: 0.9rem;
}

.advisor-response {
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.advisor-move-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
}

.advisor-move-label strong {
  color: var(--accent);
  font-size: 1rem;
  letter-spacing: 0.03em;
}

.completion-panel {
  background: var(--surface);
  border: 1px solid var(--success);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-top: 1rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.completion-panel h3 {
  color: var(--success);
}

/* --- Move list container --- */
.move-list-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  max-height: 200px;
  overflow-y: auto;
}

.move-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 0.1rem;
  align-items: baseline;
  font-size: 0.9rem;
  line-height: 1.8;
}

.move-number {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-right: 0.15rem;
}

.move-token {
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.1s;
  white-space: nowrap;
}

.move-token:hover {
  background: var(--surface-2);
}

.move-token.active {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

.move-token sup {
  color: var(--class-color, #ccc);
  font-size: 0.75em;
  font-weight: 700;
  margin-left: 1px;
}

/* --- Opening trainer — section headers (Openings / Defenses) --- */
.opening-section-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 1rem 0 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
}

.opening-section-header::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.opening-section-header .section-badge {
  font-size: 0.7rem;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-weight: 600;
}

.opening-section-header .section-badge.white-badge {
  background: rgba(255,255,255,0.1);
  color: #eee;
}

.opening-section-header .section-badge.black-badge {
  background: rgba(0,0,0,0.4);
  color: #aaa;
  border: 1px solid #444;
}

/* --- Opening trainer — Quiz tab --- */
.opening-quiz-wrapper {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.opening-quiz-info {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.opening-quiz-info p {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.opening-quiz-moves {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
  min-height: 1.2rem;
}

.quiz-choices-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.opening-quiz-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.quiz-choice-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.85rem;
  text-align: left;
  line-height: 1.3;
  transition: all 0.15s;
}

.quiz-choice-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.quiz-choice-btn.correct {
  background: rgba(76, 175, 80, 0.2);
  border-color: var(--success);
  color: #81c784;
  font-weight: 600;
}

.quiz-choice-btn.wrong {
  background: rgba(244, 67, 54, 0.15);
  border-color: var(--danger);
  color: #ef9a9a;
}

.quiz-choice-btn:disabled {
  cursor: not-allowed;
  opacity: 0.8;
}

.opening-quiz-result {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  line-height: 1.6;
  min-height: 1.5rem;
  display: none;
}

.opening-quiz-result.correct {
  display: block;
  background: rgba(76, 175, 80, 0.1);
  border: 1px solid rgba(76, 175, 80, 0.3);
  color: #81c784;
}

.opening-quiz-result.wrong {
  display: block;
  background: rgba(244, 67, 54, 0.1);
  border: 1px solid rgba(244, 67, 54, 0.3);
  color: #ef9a9a;
}

.opening-quiz-actions {
  display: flex;
  gap: 0.5rem;
}

.quiz-animating-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
  padding: 0.5rem 0;
}

/* --- Arrow color legend (review mode) --- */
.arrow-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  padding: 0.45rem 0.6rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-top: 0.4rem;
}

.arrow-legend-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.arrow-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* --- Board controls (flip / undo / redo) below the board --- */
.board-controls {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.5rem;
  justify-content: center;
}

.board-ctrl-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.15s;
}

.board-ctrl-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.board-ctrl-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* --- Feedback tools panel --- */
.feedback-panel {
  margin-top: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
}

.feedback-section + .feedback-section {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.feedback-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.eval-graph {
  display: block;
  width: 100%;
  height: 90px;
  border-radius: 4px;
  background: #030d14;
}

.top-moves-list {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.top-move-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.4rem;
  border-radius: 4px;
  font-size: 0.82rem;
  transition: background 0.15s;
}

.top-move-item.is-played {
  background: rgba(86, 199, 255, 0.1);
  border: 1px solid rgba(86, 199, 255, 0.25);
}

.top-move-rank {
  width: 1.1rem;
  color: var(--text-muted);
  font-size: 0.72rem;
  flex-shrink: 0;
}

.top-move-san {
  flex: 1;
  font-family: monospace;
  font-weight: 500;
  color: var(--text);
}

.top-move-san.best {
  color: rgba(52, 211, 153, 0.95);
}

.top-move-eval {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: monospace;
  flex-shrink: 0;
}

.top-move-badge {
  font-size: 0.65rem;
  color: var(--accent);
  background: rgba(86, 199, 255, 0.12);
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  flex-shrink: 0;
}

/* --- Coach panel (I'm Stuck) --- */
.coach-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.75rem;
  animation: coach-slide-in 0.15s ease;
}

@keyframes coach-slide-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* --- Mode transition --- */
@keyframes mode-enter {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.mode-ui.mode-entering {
  animation: mode-enter 0.24s cubic-bezier(0.22, 1, 0.36, 1) both;
}

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

.coach-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--accent);
}

.coach-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  line-height: 1;
  transition: all 0.12s;
}

.coach-close-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

.coach-question {
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.55;
  padding: 0.5rem 0.75rem;
  background: var(--surface-2);
  border-radius: var(--radius);
  border-left: 3px solid var(--accent);
}

.coach-textarea {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  resize: vertical;
  font-family: inherit;
  line-height: 1.5;
}

.coach-textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.coach-response {
  font-size: 0.9rem;
  line-height: 1.75;
  color: var(--text);
  padding: 0.75rem;
  background: var(--surface-2);
  border-radius: var(--radius);
  border-left: 3px solid var(--accent);
  white-space: pre-wrap;
}

.coach-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.75rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.coach-legend-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.coach-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* --- Scrollbar styling --- */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* --- Opening card: smoother transition --- */
.opening-card {
  transition: border-color 0.18s, transform 0.18s, box-shadow 0.18s;
}

/* --- Premium-locked feature styles --- */
.premium-locked {
  opacity: 0.55;
  cursor: not-allowed !important;
  position: relative;
}

.premium-locked:hover {
  opacity: 0.65;
}

.premium-lock-icon {
  font-size: 0.8em;
  margin-left: 0.25em;
  vertical-align: middle;
}

/* Premium-required placeholder (opening tabs) */
.premium-required-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3rem 2rem;
  gap: 0.75rem;
  color: var(--text-muted);
}

.premium-required-placeholder h3 {
  font-size: 1.1rem;
  color: var(--text);
  margin: 0;
}

.premium-required-placeholder p {
  font-size: 0.9rem;
  max-width: 320px;
  margin: 0;
}

.premium-lock-big {
  font-size: 2.5rem;
  margin-bottom: 0.25rem;
}

/* --- Top moves: alt rows + divider --- */
.top-move-alt {
  opacity: 0.5;
}

.top-move-divider {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  padding: 0.1rem 0;
}

/* ============================================================
   Mobile layout (≤768px)
   ============================================================ */
@media (max-width: 768px) {

  /* --- Header --- */
  .app-header {
    padding: 0.5rem 0.75rem;
    gap: 0.5rem;
    flex-wrap: wrap;
  }

  .logo { font-size: 1rem; }

  .mode-nav { gap: 0.25rem; flex-wrap: wrap; }

  .nav-btn {
    padding: 0.3rem 0.55rem;
    font-size: 0.78rem;
  }

  /* Hide email + plan badge — only show buttons */
  .header-email,
  .header-plan-badge { display: none; }

  .header-user { gap: 0.4rem; }

  /* --- Main layout: board first, side panel below --- */
  .app-main {
    flex-direction: column;
    padding: 0.75rem;
    gap: 1rem;
  }

  .board-column {
    width: 100%;
    align-items: flex-start;
  }

  .side-column {
    width: 100%;
    min-width: unset;
    overflow-y: visible;
  }

  /* --- Setup form: stack labels + inputs --- */
  .form-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }

  .form-row label { min-width: unset; }

  select { width: 100%; }

  /* --- Review panels: single column stack, no drag/resize --- */
  .review-panels-grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.75rem;
  }

  .review-panel {
    grid-column: unset !important;
    width: 100% !important;
    transform: none !important; /* disable hover lift */
  }

  .review-panel:not(.dragging):not(.resizing):hover {
    transform: none;
    box-shadow: none;
  }

  .panel-drag-handle,
  .panel-resize-handle {
    display: none !important;
  }

  /* --- Opening subtabs: scroll horizontally --- */
  .opening-subtabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    padding-bottom: 2px;
  }

  .opening-subtab-btn {
    white-space: nowrap;
    flex-shrink: 0;
    flex: unset;
    padding: 0.35rem 0.75rem;
    font-size: 0.82rem;
  }

  /* --- Move list shorter on mobile --- */
  .move-list-container { max-height: 180px; }

  /* --- Feedback panel full width --- */
  .feedback-panel { width: 100%; }

  /* --- Arrow legend wrap --- */
  .arrow-legend {
    flex-wrap: wrap;
    gap: 0.4rem 0.75rem;
  }

  /* --- Board controls wrap --- */
  .board-controls { flex-wrap: wrap; gap: 0.4rem; }

  /* --- Setup form above board on mobile --- */
  .live-setup-active .side-column { order: -1; }
  .live-setup-active .board-column { order: 1; }
}

/* ============================================================
   Live setup: form above board (all screen sizes)
   ============================================================ */
.live-setup-active .app-main {
  flex-direction: column;
}

.live-setup-active .side-column {
  order: -1;
  width: 100%;
  min-width: unset;
  max-width: 520px;
  align-self: center;
}

.live-setup-active .board-column {
  order: 1;
  align-self: center;
}

/* ============================================================
   Onboarding overlay — shown to new users after first login
   ============================================================ */
.onboarding-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 1rem;
}

.onboarding-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  max-width: 480px;
  width: 100%;
  text-align: center;
}

.onboarding-logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 1rem;
}

.onboarding-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 0.4rem;
}

.onboarding-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0 0 1.5rem;
}

.onboarding-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.onboarding-option {
  display: grid;
  grid-template-columns: 2.5rem 1fr;
  grid-template-rows: auto auto;
  gap: 0 0.75rem;
  align-items: center;
  padding: 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
}

.onboarding-option:hover {
  border-color: var(--accent);
  background: rgba(233, 69, 96, 0.06);
}

.onboarding-option-icon {
  grid-row: 1 / 3;
  font-size: 1.8rem;
  text-align: center;
  line-height: 1;
}

.onboarding-option-label {
  font-weight: 600;
  color: var(--text);
  font-size: 0.95rem;
}

.onboarding-option-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* ============================================================
   Learn mode — lesson browser & player
   ============================================================ */

/* Browser */
.learn-browser {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 0.25rem 0;
}

.learn-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.learn-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.learn-progress-summary {
  font-size: 0.82rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.learn-progress-bar-outer {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.learn-progress-bar-inner {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.4s ease;
}

.learn-category {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.learn-category-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.learn-category-icon {
  font-size: 1.4rem;
  line-height: 1;
}

.learn-category-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
}

.learn-category-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.learn-lesson-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.learn-lesson-card {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
  font-size: 0.85rem;
  color: var(--text);
  transition: border-color 0.15s, background 0.15s;
  position: relative;
}

.learn-lesson-card:hover {
  border-color: var(--accent);
  background: rgba(233, 69, 96, 0.06);
}

.learn-lesson-card--done {
  border-color: rgba(52, 211, 153, 0.5);
  background: rgba(52, 211, 153, 0.06);
}

.learn-lesson-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}

.learn-lesson-name {
  flex: 1;
  font-weight: 500;
}

.learn-lesson-check {
  font-size: 0.8rem;
  color: #34d399;
  font-weight: 700;
}

/* Lesson player */
.lesson-player {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  height: 100%;
}

.lesson-player-top {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.lesson-back-btn {
  padding: 0.3rem 0.7rem;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.lesson-breadcrumb {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.lesson-slide-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.lesson-icon {
  font-size: 1.6rem;
  line-height: 1;
  flex-shrink: 0;
}

.lesson-name {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.lesson-slide-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.lesson-progress-pips {
  display: flex;
  gap: 0.35rem;
  align-items: center;
}

.lesson-pip {
  height: 4px;
  flex: 1;
  background: var(--border);
  border-radius: 2px;
  transition: background 0.2s;
}

.lesson-pip--done { background: #34d399; }
.lesson-pip--active { background: var(--accent); }

.lesson-text {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  border-left: 3px solid var(--accent);
  padding: 0.75rem 1rem;
  border-radius: 0 var(--radius) var(--radius) 0;
}

.lesson-interactive-hint {
  font-size: 0.85rem;
  color: var(--accent);
  font-style: italic;
  text-align: center;
  padding: 0.4rem;
  border: 1px dashed var(--accent);
  border-radius: var(--radius);
}

.lesson-feedback {
  font-size: 0.88rem;
  padding: 0.6rem 0.9rem;
  border-radius: var(--radius);
  font-weight: 500;
}

.lesson-feedback--correct {
  background: rgba(52, 211, 153, 0.12);
  border: 1px solid rgba(52, 211, 153, 0.4);
  color: #34d399;
}

.lesson-feedback--wrong {
  background: rgba(233, 69, 96, 0.1);
  border: 1px solid rgba(233, 69, 96, 0.3);
  color: var(--accent);
}

.lesson-nav {
  display: flex;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 0.5rem;
}

.lesson-nav button {
  flex: 1;
}

/* Lesson complete screen */
.lesson-complete {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.75rem;
  padding: 2rem 1rem;
  height: 100%;
}

.lesson-complete-icon { font-size: 3rem; }

.lesson-complete-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.lesson-complete-subtitle {
  font-size: 1rem;
  color: var(--text-muted);
  margin: 0;
}

.lesson-complete-category-done {
  font-size: 0.85rem;
  color: #34d399;
  background: rgba(52, 211, 153, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.3);
  border-radius: var(--radius);
  padding: 0.5rem 0.9rem;
  margin: 0;
}

.lesson-complete-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 0.5rem;
}
