/* ═══════════════════════════════════════════════════════════
   PPL Met Quiz – Aviation Dark Theme
   ═══════════════════════════════════════════════════════════ */

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

:root {
  --bg:          #0d1b2a;
  --surface:     #132235;
  --card:        #1a2f47;
  --border:      #253d5b;
  --accent:      #1e6fff;
  --accent-dim:  #1455cc;
  --text:        #e8f0f8;
  --text-muted:  #7a9bb8;
  --correct:     #16a34a;
  --correct-bg:  #052e16;
  --wrong:       #dc2626;
  --wrong-bg:    #2d0a0a;
  --note-color:  #d97706;
  --note-bg:     #2d1a00;
  --radius:      12px;
  --radius-sm:   8px;
  --font:        -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ──────────────── SCREENS ──────────────── */

.screen {
  display: none;
  min-height: 100dvh;
}

.screen.active {
  display: flex;
  flex-direction: column;
}

.hidden {
  display: none !important;
}

/* ──────────────── LOCK ──────────────── */

.lock-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 2rem 1.5rem;
  gap: 1.5rem;
}

.lock-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
  max-width: 320px;
}

.lock-input {
  width: 100%;
  padding: 0.9rem 1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 1rem;
  text-align: center;
  letter-spacing: 0.1em;
  outline: none;
  transition: border-color 0.15s;
}

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

.lock-input.error {
  border-color: var(--wrong);
}

.lock-error {
  color: #f87171;
  font-size: 0.85rem;
  text-align: center;
}

/* ──────────────── HOME ──────────────── */

.home-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 2rem 1.5rem;
  gap: 1.5rem;
}

.home-logo {
  font-size: 3.5rem;
  line-height: 1;
  filter: drop-shadow(0 0 20px rgba(30, 111, 255, 0.5));
}

.home-title {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-align: center;
}

.home-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
  margin-top: -1rem;
}

.exam-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  width: 100%;
  max-width: 480px;
}

.exam-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  color: var(--text);
}

.exam-card:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
  transform: translateY(-2px);
}

.exam-card:active {
  transform: translateY(0);
}

.exam-label {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}

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

.pass-info {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  width: 100%;
  max-width: 480px;
}

.pass-info-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.pass-badge {
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  white-space: nowrap;
}

.badge-school {
  background: #1e3a5f;
  color: #60a5fa;
}

.badge-auth {
  background: #1a3020;
  color: #4ade80;
}

/* ──────────────── QUIZ HEADER ──────────────── */

.quiz-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
  gap: 0.5rem;
}

.btn-back {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  transition: color 0.15s;
  flex-shrink: 0;
}

.btn-back:hover {
  color: var(--text);
}

.quiz-header-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  flex: 1;
}

.quiz-header-center #exam-label-display {
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  color: var(--accent);
  text-transform: uppercase;
}

#progress-text {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.score-chip {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.2rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  flex-shrink: 0;
}

#score-display {
  color: var(--correct);
}

/* ──────────────── PROGRESS BAR ──────────────── */

.progress-track {
  height: 3px;
  background: var(--border);
  width: 100%;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.4s ease;
  width: 0%;
}

/* ──────────────── QUIZ MAIN ──────────────── */

.quiz-main {
  flex: 1;
  padding: 1.25rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
}

/* Hint box (existing note shown before answering) */
.hint-box {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  background: var(--note-bg);
  border: 1px solid var(--note-color);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  color: #fbbf24;
}

.hint-icon {
  flex-shrink: 0;
  font-size: 1rem;
}

/* Question card */
.question-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.25rem;
}

#question-text {
  font-size: 1rem;
  line-height: 1.6;
  font-family: 'Courier New', Courier, monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Options */
#options-container {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.option-btn {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  cursor: pointer;
  text-align: left;
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.5;
  transition: background 0.12s, border-color 0.12s;
  width: 100%;
}

.option-btn:hover:not(:disabled) {
  background: #1e3a5f;
  border-color: var(--accent);
}

.option-btn.selected {
  background: #1e3a5f;
  border-color: var(--accent);
}

.option-btn.correct {
  background: var(--correct-bg);
  border-color: var(--correct);
}

.option-btn.wrong {
  background: var(--wrong-bg);
  border-color: var(--wrong);
}

.option-btn:disabled {
  cursor: default;
  opacity: 1;
}

.option-letter {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: var(--border);
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
  transition: background 0.12s;
  text-transform: uppercase;
}

.option-btn.selected .option-letter {
  background: var(--accent);
}

.option-btn.correct .option-letter {
  background: var(--correct);
}

.option-btn.wrong .option-letter {
  background: var(--wrong);
}

/* Feedback banner */
#feedback-area {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

#feedback-banner {
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  font-weight: 600;
  font-size: 0.95rem;
  text-align: center;
}

#feedback-banner.correct {
  background: var(--correct-bg);
  border: 1px solid var(--correct);
  color: #4ade80;
}

#feedback-banner.wrong {
  background: var(--wrong-bg);
  border: 1px solid var(--wrong);
  color: #f87171;
}

/* Note area */
.note-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--note-color);
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.note-textarea {
  width: 100%;
  background: var(--note-bg);
  border: 1px solid var(--note-color);
  border-radius: var(--radius-sm);
  color: #fbbf24;
  font-family: var(--font);
  font-size: 0.9rem;
  padding: 0.75rem;
  resize: vertical;
  min-height: 72px;
  line-height: 1.5;
}

.note-textarea:focus {
  outline: none;
  border-color: #f59e0b;
}

.note-textarea::placeholder {
  color: #92580a;
}

/* ──────────────── QUIZ FOOTER ──────────────── */

.quiz-footer {
  padding: 1rem;
  background: var(--surface);
  border-top: 1px solid var(--border);
  position: sticky;
  bottom: 0;
}

/* ──────────────── BUTTONS ──────────────── */

.btn-primary {
  width: 100%;
  padding: 0.9rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-dim);
}

.btn-primary:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn-secondary {
  width: 100%;
  padding: 0.9rem;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.btn-secondary:hover {
  background: var(--card);
  color: var(--text);
}

/* ──────────────── RESULTS ──────────────── */

.results-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  padding: 2rem 1.5rem;
  max-width: 480px;
  margin: 0 auto;
  width: 100%;
  min-height: 100dvh;
  justify-content: center;
}

.results-icon {
  font-size: 3rem;
  line-height: 1;
}

.results-title {
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
}

.results-exam-label {
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
  margin-top: -0.75rem;
}

.score-circle {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 50%;
  width: 160px;
  height: 160px;
  justify-content: center;
  gap: 0.25rem;
}

.score-percent {
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1;
}

.score-fraction {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  padding: 0 0.5rem;
}

.pass-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
}

.pass-table th,
.pass-table td {
  padding: 0.65rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.pass-table th {
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.pass-table tr:last-child td {
  border-bottom: none;
}

.pass-table td {
  background: var(--card);
}

.cell-pass {
  color: #4ade80;
  font-weight: 700;
}

.cell-fail {
  color: #f87171;
  font-weight: 700;
}

.results-message {
  text-align: center;
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 360px;
}

.results-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
}

/* ──────────────── RESPONSIVE ──────────────── */

@media (max-width: 380px) {
  .exam-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.6rem;
  }

  .exam-label {
    font-size: 1.1rem;
  }

  #question-text {
    font-size: 0.92rem;
  }

  .option-btn {
    font-size: 0.88rem;
    padding: 0.75rem 0.85rem;
  }
}
