/* ── Reset & base ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: #0d1117;
  color: #e6edf3;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Header ─────────────────────────────────────────────────────────── */
header {
  background: linear-gradient(135deg, #1a7f37 0%, #0d5c27 100%);
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 12px rgba(0,0,0,0.4);
}

header h1 {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 10px;
}

header h1 .emoji { font-size: 1.6rem; }

#score-display {
  background: rgba(255,255,255,0.15);
  border-radius: 20px;
  padding: 6px 16px;
  font-size: 0.95rem;
  font-weight: 600;
}

/* ── Main layout ─────────────────────────────────────────────────────── */
main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 16px 120px;
}

/* ── Progress bar ────────────────────────────────────────────────────── */
#progress-container {
  width: 100%;
  max-width: 680px;
  margin-bottom: 28px;
}

#progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  color: #8b949e;
  margin-bottom: 8px;
}

#progress-bar-track {
  height: 6px;
  background: #21262d;
  border-radius: 3px;
  overflow: hidden;
}

#progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #1a7f37, #3fb950);
  border-radius: 3px;
  transition: width 0.4s ease;
  width: 0%;
}

/* ── Question card ───────────────────────────────────────────────────── */
#question-card {
  width: 100%;
  max-width: 680px;
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 16px;
  padding: 36px 32px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

#question-card.fade-out {
  opacity: 0;
  transform: translateY(-8px);
}

#question-meta {
  font-size: 0.78rem;
  color: #3fb950;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
  font-weight: 600;
}

#question-text {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.5;
  margin-bottom: 28px;
  color: #e6edf3;
}

/* ── Options grid ────────────────────────────────────────────────────── */
#options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 520px) {
  #options-grid { grid-template-columns: 1fr; }
}

.option-btn {
  background: #21262d;
  border: 2px solid #30363d;
  border-radius: 10px;
  color: #e6edf3;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 500;
  padding: 14px 18px;
  text-align: left;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

.option-btn:hover:not(:disabled) {
  background: #2d333b;
  border-color: #3fb950;
  transform: translateY(-1px);
}

.option-btn.correct {
  background: #1a7f37;
  border-color: #3fb950;
  color: #fff;
}

.option-btn.wrong {
  background: #6e2233;
  border-color: #da3633;
  color: #fff;
}

.option-btn.reveal-correct {
  background: #1a7f37;
  border-color: #3fb950;
  color: #fff;
  opacity: 0.7;
}

.option-btn:disabled { cursor: not-allowed; }

/* ── Text input area ─────────────────────────────────────────────────── */
#text-input-area {
  display: flex;
  gap: 10px;
}

#text-answer {
  flex: 1;
  background: #21262d;
  border: 2px solid #30363d;
  border-radius: 10px;
  color: #e6edf3;
  font-size: 1rem;
  padding: 12px 16px;
  outline: none;
  transition: border-color 0.15s;
}

#text-answer:focus { border-color: #3fb950; }

#submit-text-btn {
  background: #1a7f37;
  border: none;
  border-radius: 10px;
  color: #fff;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 12px 22px;
  transition: background 0.15s, transform 0.1s;
}

#submit-text-btn:hover { background: #2ea043; transform: translateY(-1px); }

/* ── Feedback banner ─────────────────────────────────────────────────── */
#feedback {
  margin-top: 20px;
  padding: 14px 18px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.95rem;
  display: none;
}

#feedback.correct { background: #1a7f37; border: 1px solid #3fb950; display: block; }
#feedback.wrong   { background: #6e2233; border: 1px solid #da3633; display: block; }

/* ── Major leagues checkbox ───────────────────────────────────────────── */
#major-leagues-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: #8b949e;
  cursor: pointer;
  margin-bottom: 4px;
}

#major-leagues-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: #1f6feb;
}

/* ── Next / start / results buttons ──────────────────────────────────── */
#next-btn, #start-btn, #restart-btn {
  margin-top: 22px;
  background: #1f6feb;
  border: none;
  border-radius: 10px;
  color: #fff;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  padding: 13px 28px;
  transition: background 0.15s, transform 0.1s;
  display: none;
}

#next-btn:hover, #start-btn:hover, #restart-btn:hover {
  background: #388bfd;
  transform: translateY(-1px);
}

/* ── Start / results screens ─────────────────────────────────────────── */
#start-screen, #results-screen, #loading-screen {
  width: 100%;
  max-width: 680px;
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 16px;
  padding: 48px 32px;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

#start-screen h2, #results-screen h2 {
  font-size: 1.8rem;
  margin-bottom: 12px;
}

#start-screen p, #results-screen p {
  color: #8b949e;
  margin-bottom: 24px;
  line-height: 1.6;
}

#results-score {
  font-size: 4rem;
  font-weight: 700;
  color: #3fb950;
  margin: 16px 0;
}

#results-breakdown {
  font-size: 0.9rem;
  color: #8b949e;
  margin-bottom: 24px;
}

#match-info {
  background: #21262d;
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 24px;
  font-size: 0.88rem;
  color: #8b949e;
  line-height: 1.8;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid #30363d;
  border-top-color: #3fb950;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 20px;
}

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

/* ── Difficulty bar (fixed bottom) ──────────────────────────────────── */
#difficulty-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #161b22;
  border-top: 1px solid #30363d;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  z-index: 100;
  box-shadow: 0 -4px 16px rgba(0,0,0,0.3);
}

#difficulty-bar label {
  font-size: 0.85rem;
  color: #8b949e;
  white-space: nowrap;
  flex-shrink: 0;
}

#difficulty-slider {
  flex: 1;
  accent-color: #3fb950;
  cursor: pointer;
  height: 6px;
}

#difficulty-label {
  font-size: 0.9rem;
  font-weight: 700;
  min-width: 90px;
  text-align: right;
  flex-shrink: 0;
}

.diff-easy   { color: #3fb950; }
.diff-medium { color: #f0b429; }
.diff-hard   { color: #f85149; }
.diff-expert { color: #bc8cff; }

/* ── Responsive tweaks ───────────────────────────────────────────────── */
@media (max-width: 400px) {
  #question-card { padding: 24px 18px; }
  #question-text { font-size: 1.05rem; }
}
