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

html, body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f5f5f7;
  color: #111827;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

.hidden { display: none !important; }
.muted { color: #6b7280; font-size: 14px; }

header {
  background: #ffffff;
  padding: 12px 16px;
  border-bottom: 1px solid #e5e7eb;
  position: sticky; top: 0; z-index: 10;
}

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

header h1 {
  font-family: "Caveat", "Marker Felt", cursive;
  font-size: 32px;
  font-weight: 700;
  color: #2563eb;
  line-height: 1;
  letter-spacing: 0.3px;
}

.app-title-small {
  font-size: 24px !important;
}

@media (max-width: 520px) {
  header h1 { font-size: 26px; }
  .app-title-small { font-size: 20px !important; }
}

.admin-link {
  color: #6b7280;
  text-decoration: none;
  font-size: 20px;
  padding: 4px 8px;
}

#session-stats {
  display: flex;
  gap: 16px;
  margin-top: 8px;
  font-size: 14px;
  color: #4b5563;
}

#stat-tier.perfect { color: #059669; }
#stat-tier.good { color: #2563eb; }
#stat-tier.acceptable { color: #d97706; }
#stat-tier.wrong { color: #dc2626; }

#stat-pct { margin-left: auto; font-weight: 600; color: #111827; }

main {
  max-width: 600px;
  margin: 0 auto;
  padding: 16px;
}

/* HOME */
.intro {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
}

.big-prompt {
  font-size: 16px;
  line-height: 1.5;
  color: #111827;
}

.big-prompt strong {
  color: #2563eb;
}

.home-heading {
  font-size: 14px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.drill-cards {
  display: grid;
  gap: 12px;
  margin-bottom: 24px;
}

@media (min-width: 700px) {
  .drill-cards { grid-template-columns: 1fr 1fr; }
}

.drill-card {
  text-align: left;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 18px;
  color: #111827;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.drill-card:hover {
  background: #f9fafb;
  border-color: #2563eb;
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.08);
}

.drill-card-title {
  font-size: 18px;
  font-weight: 700;
  color: #2563eb;
  margin-bottom: 6px;
}

.drill-card-sub {
  font-size: 13px;
  color: #6b7280;
  line-height: 1.4;
  margin-bottom: 12px;
}

.drill-card-cta {
  font-size: 13px;
  font-weight: 600;
  color: #2563eb;
}

#review-section { margin-bottom: 24px; }

.review-cards {
  display: grid;
  gap: 10px;
}

@media (min-width: 700px) {
  .review-cards { grid-template-columns: 1fr 1fr; }
}

.review-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  text-align: left;
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: 10px;
  padding: 12px 14px;
  color: #92400e;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
}

.review-card:hover {
  background: #fef3c7;
  border-color: #d97706;
}

.review-card-title {
  font-size: 14px;
  font-weight: 600;
}

.review-card-count {
  font-size: 13px;
  font-weight: 700;
  color: #b45309;
  font-family: "SF Mono", Menlo, Consolas, monospace;
}

.lifetime-card {
  background: #ffffff;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 20px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.lifetime-drill + .lifetime-drill {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #e5e7eb;
}

.lifetime-drill-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #6b7280;
  margin-bottom: 8px;
}

.lifetime-row {
  display: flex;
  justify-content: space-around;
  gap: 8px;
}

.lifetime-stat { text-align: center; flex: 1; }

.lifetime-num {
  font-size: 24px;
  font-weight: 700;
  color: #2563eb;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  line-height: 1.2;
}

.lifetime-lbl {
  font-size: 12px;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

/* Drill 2 blunder-check gate */
.drill2-gate {
  background: #fff7ed;
  border: 2px solid #f59e0b;
  border-radius: 12px;
  padding: 18px 16px;
  margin-top: 14px;
  text-align: center;
}
.gate-title {
  font-size: 16px;
  color: #374151;
  margin-bottom: 10px;
}
.gate-subtitle {
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 6px;
}
.gate-blunder-line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  padding: 10px 14px;
  background: #fff;
  border: 1px solid #fde68a;
  border-radius: 8px;
  margin: 6px 0 14px;
}
.gate-blunder-line .continuation-move {
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 15px;
  font-weight: 600;
}
.gate-question {
  font-size: 14px;
  color: #374151;
  margin-bottom: 12px;
  font-weight: 600;
}
.gate-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}
.gate-actions button { min-width: 140px; }

/* Skill points pill on feedback */
.points-pill {
  display: inline-block;
  background: #eef2ff;
  color: #4338ca;
  border: 1px solid #c7d2fe;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 13px;
  font-weight: 700;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  margin: 4px 6px 6px 0;
  animation: points-pop 0.5s ease;
}
.points-pill.big {
  background: #fef3c7;
  color: #92400e;
  border-color: #fde68a;
  font-size: 15px;
  box-shadow: 0 2px 6px rgba(245, 158, 11, 0.25);
}
@keyframes points-pop {
  0%   { transform: scale(0.4); opacity: 0; }
  60%  { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); }
}

/* Skill number on lifetime card gets a warmer accent so the eye lands on it */
.lifetime-skill .lifetime-num { color: #b45309; }

/* Thoughtful badge on feedback */
.thoughtful-badge {
  display: inline-block;
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
  margin: 4px 0 8px;
}

/* Variable-ratio celebration overlay */
.celebration {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 9999;
  opacity: 0;
  transform: scale(0.7);
  transition: opacity 0.25s ease, transform 0.35s cubic-bezier(.2,.9,.3,1.4);
}
.celebration.show { opacity: 1; transform: scale(1); }
.celebration-emoji {
  font-size: 120px;
  line-height: 1;
  filter: drop-shadow(0 6px 12px rgba(0,0,0,0.15));
  animation: celebrate-bounce 0.8s ease;
}
.celebration-text {
  margin-top: 8px;
  font-family: "Caveat", cursive;
  font-size: 52px;
  font-weight: 700;
  color: #111827;
  background: rgba(255, 255, 255, 0.85);
  padding: 2px 18px;
  border-radius: 12px;
}
@keyframes celebrate-bounce {
  0%   { transform: scale(0.5) rotate(-8deg); }
  40%  { transform: scale(1.2) rotate(6deg); }
  70%  { transform: scale(0.95) rotate(-3deg); }
  100% { transform: scale(1) rotate(0); }
}

.goal-row {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.goal-bar {
  flex: 1;
  height: 8px;
  background: #f3f4f6;
  border-radius: 4px;
  overflow: hidden;
}
.goal-bar-fill {
  height: 100%;
  background: #2563eb;
  transition: width 0.4s ease;
  border-radius: 4px;
}
.goal-bar-fill.complete { background: #16a34a; }
.goal-text {
  font-size: 12px;
  color: #6b7280;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  white-space: nowrap;
}

.activity-periods {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 4px;
  margin-bottom: 12px;
}
.activity-period {
  text-align: center;
  padding: 8px 4px;
  background: #f9fafb;
  border-radius: 8px;
}
.activity-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #6b7280;
}
.activity-num {
  font-size: 22px;
  font-weight: 700;
  color: #2563eb;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  line-height: 1.2;
  margin-top: 2px;
}
.activity-split {
  font-size: 11px;
  color: #6b7280;
  font-family: "SF Mono", Menlo, Consolas, monospace;
}
.activity-legend {
  font-size: 11px;
  color: #6b7280;
  margin: 4px 0 10px;
  text-align: center;
}
.legend-dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  vertical-align: middle;
  margin: 0 4px 2px 8px;
}
.legend-dot.d1 { background: #2563eb; }
.legend-dot.d2 { background: #f59e0b; }

.activity-daily {
  max-height: 320px;
  overflow-y: auto;
  border-top: 1px solid #e5e7eb;
  padding-top: 8px;
}
.activity-row {
  display: grid;
  grid-template-columns: 90px 1fr 40px;
  gap: 8px;
  align-items: center;
  padding: 3px 0;
  font-size: 12px;
}
.activity-row.zero { opacity: 0.45; }
.activity-day { color: #374151; }
.activity-bar-wrap {
  display: flex;
  height: 14px;
  gap: 1px;
  background: #f3f4f6;
  border-radius: 3px;
  overflow: hidden;
}
.activity-bar { height: 100%; }
.activity-bar.d1 { background: #2563eb; }
.activity-bar.d2 { background: #f59e0b; }
.activity-count {
  text-align: right;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  color: #6b7280;
}

.settings-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 16px;
  display: grid;
  gap: 12px;
  margin-bottom: 20px;
}

.settings-card label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: #4b5563;
}

.settings-card input,
.settings-card select {
  background: #ffffff;
  border: 1px solid #d1d5db;
  color: #111827;
  padding: 10px;
  border-radius: 6px;
  font-size: 16px;
  font-family: inherit;
}

button.primary {
  width: 100%;
  background: #2563eb;
  color: white;
  border: none;
  padding: 14px;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

button.primary.big {
  padding: 16px;
  font-size: 18px;
}

button.primary:hover { background: #1d4ed8; }
button.primary:active { background: #1e40af; }

button.secondary {
  background: #ffffff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  display: inline-block;
}

button.secondary:hover { background: #eff6ff; border-color: #2563eb; }

#puzzles-available {
  text-align: center;
  margin-top: 12px;
}

/* DRILL SCREEN */
#drill-columns {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

#drill-left { min-width: 0; }
#drill-right { min-width: 0; }

@media (min-width: 960px) {
  #screen-drill { max-width: none; }
  #drill-columns {
    flex-direction: row;
    align-items: flex-start;
    gap: 24px;
  }
  #drill-left { flex: 0 0 560px; }
  #drill-right { flex: 1; position: sticky; top: 80px; }
  #drill-right #feedback { margin-top: 0; }
}

#board-cue {
  max-width: 520px;
  margin: 0 auto 12px;
  text-align: center;
  padding: 10px 14px;
  font-size: 17px;
  font-weight: 600;
  color: #b45309;
  background: #fef3c7;
  border: 1px solid #fcd34d;
  border-radius: 10px;
  letter-spacing: 0.2px;
}

@media (min-width: 700px) {
  #board-cue { max-width: 560px; }
}

#board-wrap {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  aspect-ratio: 1;
  position: relative;
}

#board {
  width: 100% !important;
  height: 100% !important;
}

#drill-prompt {
  text-align: center;
  padding: 14px 14px 4px;
  font-size: 16px;
  color: #374151;
}

#drill-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 14px 12px;
  font-size: 14px;
  color: #6b7280;
  font-family: "SF Mono", Menlo, Consolas, monospace;
}

#puzzle-counter { color: #4b5563; }

#timer { color: #4b5563; font-variant-numeric: tabular-nums; }
#timer.low { color: #d97706; }
#timer.out { color: #dc2626; }

#end-session-link {
  color: #6b7280;
  text-decoration: none;
  font-size: 13px;
  border: 1px solid #d1d5db;
  background: #ffffff;
  padding: 3px 10px;
  border-radius: 6px;
}
#end-session-link:hover { color: #dc2626; border-color: #dc2626; }

#feedback-eval {
  font-size: 14px;
  color: #374151;
  margin-bottom: 10px;
  font-family: "SF Mono", Menlo, Consolas, monospace;
}

#feedback-best-eval {
  margin-left: 6px;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 13px;
}

#retry-hint {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  padding: 18px;
  border-radius: 12px;
  margin-top: 12px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.retry-title {
  font-size: 18px;
  font-weight: 700;
  color: #b45309;
  margin-bottom: 4px;
}

.retry-subtitle {
  font-size: 13px;
  color: #92400e;
  margin-bottom: 10px;
}

#retry-moves {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 14px;
  margin-bottom: 14px;
}

.retry-cta {
  font-size: 14px;
  font-weight: 600;
  color: #111827;
}

#feedback {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  padding: 18px;
  border-radius: 12px;
  margin-top: 12px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

#feedback.perfect { background: linear-gradient(180deg, #d1fae5 0%, #ffffff 100%); border: 1px solid #6ee7b7; }
#feedback.good { background: linear-gradient(180deg, #dbeafe 0%, #ffffff 100%); border: 1px solid #93c5fd; }
#feedback.acceptable { background: linear-gradient(180deg, #fef3c7 0%, #ffffff 100%); border: 1px solid #fcd34d; }
#feedback.wrong { background: linear-gradient(180deg, #fee2e2 0%, #ffffff 100%); border: 1px solid #fca5a5; }

#feedback-tier {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 6px;
}

#feedback-tier.perfect { color: #059669; }
#feedback-tier.good { color: #2563eb; }
#feedback-tier.acceptable { color: #b45309; }
#feedback-tier.wrong { color: #dc2626; }

#feedback-move {
  font-size: 14px;
  color: #374151;
  margin-bottom: 10px;
}

.move-pill {
  display: inline-block;
  background: #2563eb;
  color: white;
  padding: 2px 10px;
  border-radius: 6px;
  font-weight: 600;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 14px;
}

#feedback-best {
  font-size: 14px;
  color: #4b5563;
  margin-bottom: 12px;
}

#feedback-threat-line,
#feedback-refutation {
  margin-top: 14px;
  padding: 12px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

#feedback-refutation { margin-top: 8px; margin-bottom: 10px; }

#refutation-moves {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 14px;
}

.continuation-heading {
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 8px;
}

#threat-line-moves {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 14px;
}

.continuation-move {
  padding: 3px 8px;
  background: #e5e7eb;
  color: #374151;
  border-radius: 4px;
}

.continuation-move.opp { background: #fef3c7; color: #b45309; }

#threat-replay {
  margin-top: 14px;
  padding: 12px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

.threat-heading {
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 8px;
}

#threat-moves {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.threat-move {
  padding: 3px 8px;
  background: #e5e7eb;
  color: #374151;
  border-radius: 4px;
  font-size: 13px;
  font-family: "SF Mono", Menlo, Consolas, monospace;
}

#feedback-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  align-items: center;
}

#feedback-actions .primary {
  flex: 1;
}

/* DRILL 2 SCREEN */
#drill2-columns {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

#drill2-left, #drill2-right { min-width: 0; }

@media (min-width: 960px) {
  #screen-drill2 { max-width: none; }
  #drill2-columns {
    flex-direction: row;
    align-items: flex-start;
    gap: 24px;
  }
  #drill2-left { flex: 0 0 560px; }
  #drill2-right { flex: 1; }
}

#drill2-cue {
  max-width: 520px;
  margin: 0 auto 12px;
  text-align: center;
  padding: 10px 14px;
  font-size: 17px;
  font-weight: 600;
  color: #b45309;
  background: #fef3c7;
  border: 1px solid #fcd34d;
  border-radius: 10px;
}

@media (min-width: 700px) {
  #drill2-cue { max-width: 560px; }
}

#drill2-board-wrap {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  aspect-ratio: 1;
}
#drill2-board { width: 100% !important; height: 100% !important; }

@media (min-width: 700px) { #drill2-board-wrap { max-width: 560px; } }

#drill2-prompt {
  text-align: center;
  padding: 14px 14px 4px;
  font-size: 16px;
  color: #374151;
}

#drill2-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 14px 12px;
  font-size: 14px;
  color: #6b7280;
  font-family: "SF Mono", Menlo, Consolas, monospace;
}

#drill2-counter { color: #4b5563; }

#drill2-timer {
  color: #4b5563;
  font-variant-numeric: tabular-nums;
  transition: color 0.2s ease;
}
#drill2-timer.thoughtful { color: #059669; }

#drill2-end-link {
  color: #6b7280;
  text-decoration: none;
  font-size: 13px;
  border: 1px solid #d1d5db;
  background: #ffffff;
  padding: 3px 10px;
  border-radius: 6px;
}
#drill2-end-link:hover { color: #dc2626; border-color: #dc2626; }

#drill2-candidates {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.candidate-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  background: #ffffff;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  color: #111827;
  font-family: inherit;
  font-size: 18px;
  text-align: left;
  cursor: pointer;
  transition: all 0.1s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.candidate-btn:hover:not(:disabled) {
  background: #f9fafb;
  border-color: #2563eb;
}

.candidate-btn:disabled { cursor: default; opacity: 0.75; }

.candidate-label {
  font-size: 22px;
  font-weight: 800;
  color: #2563eb;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  flex: 0 0 32px;
}

.candidate-san {
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-weight: 600;
  font-size: 20px;
}

.candidate-btn.chosen { border-color: #d97706; background: #fef3c7; }
.candidate-btn.correct { border-color: #059669; background: #d1fae5; }
.candidate-btn.wrong { border-color: #dc2626; background: #fee2e2; }

.candidate-wrap { display: flex; flex-direction: column; gap: 4px; }

.candidate-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 6px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 13px;
}

.candidate-line.kind-good { border-left: 3px solid #059669; background: #ecfdf5; }
.candidate-line.kind-distractor { border-left: 3px solid #d97706; background: #fffbeb; }
.candidate-line.kind-blunder { border-left: 3px solid #dc2626; background: #fef2f2; }

.line-kind {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex: 0 0 auto;
}

.candidate-line.kind-good .line-kind { color: #059669; }
.candidate-line.kind-distractor .line-kind { color: #b45309; }
.candidate-line.kind-blunder .line-kind { color: #dc2626; }

.line-eval {
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  padding: 1px 6px;
  border-radius: 4px;
  flex: 0 0 auto;
}

.candidate-line.kind-good .line-eval { color: #065f46; background: #a7f3d0; }
.candidate-line.kind-distractor .line-eval { color: #92400e; background: #fde68a; }
.candidate-line.kind-blunder .line-eval { color: #991b1b; background: #fecaca; }

.line-plies {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.line-ply {
  padding: 2px 6px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  color: #374151;
}

.line-ply.ply-first { font-weight: 700; color: #111827; background: #f3f4f6; }

#drill2-feedback {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  padding: 18px;
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}
#drill2-feedback.correct { background: linear-gradient(180deg, #d1fae5 0%, #ffffff 100%); border: 1px solid #6ee7b7; }
#drill2-feedback.wrong { background: linear-gradient(180deg, #fee2e2 0%, #ffffff 100%); border: 1px solid #fca5a5; }

#drill2-feedback-tier {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 6px;
}
#drill2-feedback-tier.correct { color: #059669; }
#drill2-feedback-tier.wrong { color: #dc2626; }

#drill2-feedback-thoughtful {
  font-size: 13px;
  color: #059669;
  margin-bottom: 10px;
}
#drill2-feedback-thoughtful.not-thoughtful { color: #b45309; }

#drill2-feedback-body {
  font-size: 14px;
  color: #374151;
  line-height: 1.5;
  margin-bottom: 14px;
}

#drill2-feedback-body .move-pill { margin: 0 2px; }

#drill2-feedback-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  align-items: center;
}
#drill2-feedback-actions .primary { flex: 1; }

/* ANALYSIS PANEL */
#analysis-panel {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  padding: 14px 16px;
  margin-top: 12px;
}

.analysis-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.analysis-label {
  color: #2563eb;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.analysis-eval-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 10px;
}

#analysis-eval {
  font-size: 24px;
  font-weight: 700;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  color: #111827;
  font-variant-numeric: tabular-nums;
}

#analysis-eval.white { color: #111827; }
#analysis-eval.black { color: #6b7280; }
#analysis-eval.mate { color: #d97706; }

#analysis-turn { font-size: 12px; color: #6b7280; }

.analysis-line-heading {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

#analysis-line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 14px;
  min-height: 24px;
}

#analysis-line .continuation-move { background: #ffffff; border: 1px solid #bfdbfe; color: #1e3a8a; }

/* DONE SCREEN */
#screen-done, #screen-done2 {
  text-align: center;
  padding-top: 32px;
}

#screen-done h2, #screen-done2 h2 {
  font-size: 24px;
  margin-bottom: 16px;
  color: #111827;
}

.score-big {
  font-size: 52px;
  font-weight: 700;
  color: #2563eb;
  margin: 20px 0;
  font-family: "SF Mono", Menlo, Consolas, monospace;
}

.tier-breakdown {
  text-align: left;
  display: inline-block;
  margin: 10px 0 30px;
}

.tier-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 6px 0;
  font-size: 15px;
  color: #374151;
}

.tier-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: inline-block;
}

.tier-dot.perfect { background: #059669; }
.tier-dot.good { background: #2563eb; }
.tier-dot.acceptable { background: #d97706; }
.tier-dot.wrong { background: #dc2626; }

#done-message, #done2-message {
  margin-bottom: 24px;
}

/* LOADING */
#loading {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.spinner {
  width: 42px;
  height: 42px;
  border: 4px solid #e5e7eb;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ADMIN */
main.admin {
  max-width: 900px;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
}

thead {
  background: #f9fafb;
}

th, td {
  padding: 10px 12px;
  text-align: left;
  font-size: 14px;
  border-bottom: 1px solid #e5e7eb;
  color: #111827;
}

th { font-weight: 600; color: #4b5563; }

tbody tr:hover { background: #f3f4f6; cursor: pointer; }

#session-detail {
  margin-top: 24px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  padding: 18px;
  border-radius: 12px;
}

#session-detail h2 { margin-bottom: 10px; color: #111827; }

.detail-answer {
  padding: 10px;
  margin: 8px 0;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}

.detail-answer .tier-badge {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  color: #ffffff;
}

.detail-answer .tier-badge.perfect { background: #059669; }
.detail-answer .tier-badge.good { background: #2563eb; }
.detail-answer .tier-badge.acceptable { background: #d97706; }
.detail-answer .tier-badge.wrong { background: #dc2626; }

.detail-answer a {
  color: #2563eb;
  text-decoration: none;
  margin-left: auto;
  font-size: 13px;
}

/* Tablet/desktop */
@media (min-width: 700px) {
  main { max-width: 700px; }
  #board-wrap { max-width: 560px; }
}

/* Wide desktop: two-column drill layout */
@media (min-width: 960px) {
  main { max-width: 1120px; }
}
