/* ============================================================
   zDolnyQuiz — design system
   ============================================================ */

:root {
  --bg: #f7f5ff;
  --bg-alt: #ffffff;
  --surface: #ffffff;
  --surface-2: #f1eefc;
  --border: #e6e1f7;
  --text: #201a3d;
  --text-muted: #6b6485;
  --text-faint: #9891b0;

  --brand: #7c5cff;
  --brand-dark: #5b3df0;
  --brand-light: #ede9fe;
  --accent: #ff7a59;

  --success: #22c55e;
  --success-light: #dcfce7;
  --success-dark: #15803d;
  --error: #ef4444;
  --error-light: #fee2e2;
  --error-dark: #b91c1c;
  --warn: #f59e0b;
  --warn-light: #fef3c7;

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(32, 26, 61, 0.06);
  --shadow: 0 4px 16px rgba(32, 26, 61, 0.08);
  --shadow-lg: 0 12px 32px rgba(32, 26, 61, 0.14);
  --shadow-brand: 0 8px 24px rgba(124, 92, 255, 0.28);

  --font-sans: 'Baloo 2', 'Nunito', 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Consolas', monospace;

  /* per-subject colors */
  --c-biologia: #22c55e;
  --c-biologia-bg: #e8faf0;
  --c-chemia: #a855f7;
  --c-chemia-bg: #f6edfe;
  --c-fizyka: #3b82f6;
  --c-fizyka-bg: #eaf2fe;
  --c-geografia: #14b8a6;
  --c-geografia-bg: #e4faf7;
  --c-historia: #d97706;
  --c-historia-bg: #fdf1de;
  --c-matematyka: #6366f1;
  --c-matematyka-bg: #ecebfe;
  --c-jezyk-angielski: #ef4444;
  --c-jezyk-angielski-bg: #fdeaea;
  --c-jezyk-niemiecki: #eab308;
  --c-jezyk-niemiecki-bg: #fdf7de;
  --c-jezyk-polski: #ec4899;
  --c-jezyk-polski-bg: #fdeaf3;
  --c-informatyka: #0ea5e9;
  --c-informatyka-bg: #e4f5fd;
  --c-default: #7c5cff;
  --c-default-bg: #ede9fe;

  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #14101f;
  --bg-alt: #1b1530;
  --surface: #201a38;
  --surface-2: #241d40;
  --border: #332a54;
  --text: #f1eefc;
  --text-muted: #b3a9d6;
  --text-faint: #8579aa;

  --brand: #9b81ff;
  --brand-dark: #7c5cff;
  --brand-light: #2c2352;
  --accent: #ff9270;

  --success: #4ade80;
  --success-light: #123422;
  --success-dark: #86efac;
  --error: #f87171;
  --error-light: #3a1620;
  --error-dark: #fca5a5;
  --warn: #fbbf24;
  --warn-light: #3a2c0f;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5);
  --shadow-brand: 0 8px 28px rgba(155, 129, 255, 0.35);

  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14101f;
    --bg-alt: #1b1530;
    --surface: #201a38;
    --surface-2: #241d40;
    --border: #332a54;
    --text: #f1eefc;
    --text-muted: #b3a9d6;
    --text-faint: #8579aa;
    --brand: #9b81ff;
    --brand-dark: #7c5cff;
    --brand-light: #2c2352;
    --accent: #ff9270;
    --success: #4ade80;
    --success-light: #123422;
    --success-dark: #86efac;
    --error: #f87171;
    --error-light: #3a1620;
    --error-dark: #fca5a5;
    --warn: #fbbf24;
    --warn-light: #3a2c0f;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5);
    --shadow-brand: 0 8px 28px rgba(155, 129, 255, 0.35);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3 { margin: 0; font-weight: 800; letter-spacing: -0.01em; }
h1 { font-size: 2rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.05rem; }
p { margin: 0; color: var(--text-muted); }
a { color: inherit; }
button { font-family: inherit; }

.hidden { display: none !important; }

.app-container {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 20px 64px;
}

/* ============================================================
   BACKGROUND DECORATION
   ============================================================ */
.bg-blobs {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
.bg-blobs svg { position: absolute; opacity: 0.5; }
@media (prefers-color-scheme: dark) { .bg-blobs svg { opacity: 0.25; } }
:root[data-theme="dark"] .bg-blobs svg { opacity: 0.25; }
:root[data-theme="light"] .bg-blobs svg { opacity: 0.5; }

/* ============================================================
   HEADER
   ============================================================ */
.header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--bg-alt) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 760px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.logo { display: flex; align-items: center; gap: 8px; text-decoration: none; cursor: pointer; }
.logo-icon {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-brand);
}
.logo-text { font-weight: 800; font-size: 1.15rem; color: var(--text); }
.logo-text span { color: var(--brand); }
.header-actions { display: flex; align-items: center; gap: 10px; }
.stats-bar { font-size: 0.8rem; color: var(--text-muted); display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.stats-bar strong { color: var(--text); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; cursor: pointer;
  font-family: inherit; font-weight: 700; font-size: 0.95rem;
  padding: 12px 20px; border-radius: var(--radius-pill);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, opacity 0.15s ease;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.btn-primary { background: linear-gradient(135deg, var(--brand), var(--brand-dark)); color: #fff; box-shadow: var(--shadow-brand); }
.btn-primary:not(:disabled):hover { box-shadow: 0 10px 28px rgba(124, 92, 255, 0.38); transform: translateY(-1px); }

.btn-secondary { background: var(--brand-light); color: var(--brand-dark); }
.btn-secondary:hover { background: color-mix(in srgb, var(--brand-light) 70%, var(--brand)); }

.btn-success { background: linear-gradient(135deg, #34d399, var(--success)); color: #fff; box-shadow: 0 8px 20px rgba(34, 197, 94, 0.3); }

.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

.btn-icon { padding: 10px; width: 42px; height: 42px; border-radius: var(--radius-pill); }

.btn-block { width: 100%; }

/* ============================================================
   HOME — HERO
   ============================================================ */
.hero {
  text-align: center;
  padding: 40px 0 20px;
}
.hero-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--brand-light); color: var(--brand-dark);
  font-size: 0.8rem; font-weight: 700;
  padding: 6px 14px; border-radius: var(--radius-pill);
  margin-bottom: 14px;
}
.hero h1 { margin-bottom: 10px; }
.hero h1 .accent { color: var(--brand); }
.hero p { font-size: 1.02rem; max-width: 460px; margin: 0 auto; }
.hero-mascot { width: 108px; height: auto; margin: 4px auto 10px; display: block; }

.section-title {
  font-weight: 800; font-size: 1rem; color: var(--text);
  margin: 28px 0 12px; display: flex; align-items: center; gap: 8px;
}
.section-hint { font-size: 0.85rem; color: var(--text-faint); font-weight: 500; margin-top: -6px; margin-bottom: 12px; }

/* ============================================================
   SUBJECT CARDS
   ============================================================ */
.subject-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.subject-card {
  position: relative;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 14px;
  cursor: pointer;
  text-align: left;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  display: flex; flex-direction: column; gap: 10px;
}
.subject-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.subject-card.selected { border-color: var(--card-color, var(--brand)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--card-color, var(--brand)) 22%, transparent); }
.subject-card .icon-badge {
  width: 40px; height: 40px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  background: var(--card-bg, var(--brand-light));
}
.subject-card .name { font-weight: 800; font-size: 0.92rem; color: var(--text); }
.subject-card .count { font-size: 0.76rem; color: var(--text-faint); font-weight: 600; }
.subject-card .check {
  position: absolute; top: 10px; right: 10px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--card-color, var(--brand)); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; opacity: 0; transform: scale(0.5);
  transition: all 0.15s ease;
}
.subject-card.selected .check { opacity: 1; transform: scale(1); }
.subject-card.disabled { opacity: 0.4; cursor: not-allowed; }

/* ============================================================
   MODE CARDS
   ============================================================ */
.mode-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.mode-card {
  background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius);
  padding: 16px; cursor: pointer; text-align: left;
  transition: transform 0.15s ease, border-color 0.15s ease;
  display: flex; flex-direction: column; gap: 6px;
}
.mode-card:hover { transform: translateY(-2px); }
.mode-card.selected { border-color: var(--brand); background: var(--brand-light); }
.mode-card .mode-icon { font-size: 1.6rem; }
.mode-card h3 { font-size: 0.95rem; }
.mode-card p { font-size: 0.78rem; }

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 9px 16px; border-radius: var(--radius-pill);
  background: var(--surface); border: 2px solid var(--border);
  font-size: 0.85rem; font-weight: 700; cursor: pointer; color: var(--text-muted);
  transition: all 0.15s ease;
}
.chip.selected { background: var(--brand); border-color: var(--brand); color: #fff; }

.start-section { margin-top: 28px; text-align: center; }
.start-section .btn { min-width: 260px; padding: 15px 24px; font-size: 1.02rem; }

.info-card {
  margin-top: 24px; text-align: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; font-size: 0.85rem; color: var(--text-muted);
  display: flex; flex-direction: column; gap: 6px;
}

/* ============================================================
   QUIZ HEADER / PROGRESS
   ============================================================ */
.quiz-header {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--bg-alt) 92%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.quiz-header-inner {
  max-width: 760px; margin: 0 auto; padding: 12px 20px;
  display: flex; align-items: center; gap: 12px;
}
.quiz-subject-label { display: flex; align-items: center; gap: 8px; font-size: 1rem; white-space: nowrap; }
.quiz-progress-wrap { flex: 1; min-width: 0; }
.quiz-progress-bar { height: 8px; background: var(--surface-2); border-radius: var(--radius-pill); overflow: hidden; }
.quiz-progress-fill { height: 100%; background: linear-gradient(90deg, var(--brand), var(--accent)); border-radius: var(--radius-pill); transition: width 0.35s ease; }
.quiz-progress-text { font-size: 0.72rem; color: var(--text-faint); margin-top: 4px; font-weight: 600; }
.timer { font-family: var(--font-mono); font-weight: 700; font-size: 0.95rem; color: var(--text); }
.timer.low { color: var(--error); }

/* ============================================================
   QUESTION
   ============================================================ */
.question-container { max-width: 680px; margin: 0 auto; padding: 24px 20px 80px; }
.question-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 0.72rem; font-weight: 700;
  padding: 4px 10px; border-radius: var(--radius-pill);
  background: var(--surface-2); color: var(--text-muted);
}
.badge-points { background: var(--brand-light); color: var(--brand-dark); }
.badge-study { background: var(--warn-light); color: var(--warn); }

.question-image {
  max-width: 100%; max-height: 320px; object-fit: contain;
  border-radius: var(--radius); margin-bottom: 16px; display: block;
  border: 1px solid var(--border); background: #fff;
}

.question-text {
  font-size: 1.15rem; font-weight: 700; line-height: 1.45;
  margin-bottom: 20px; white-space: pre-wrap;
}

.options-list { display: flex; flex-direction: column; gap: 10px; }
.option-btn {
  display: flex; align-items: flex-start; gap: 12px;
  text-align: left; padding: 14px 16px; width: 100%;
  background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius);
  cursor: pointer; font-size: 0.96rem; color: var(--text);
  transition: all 0.12s ease;
}
.option-btn:hover:not(:disabled) { border-color: var(--brand); background: var(--brand-light); }
.option-letter {
  flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%;
  background: var(--surface-2); color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 0.82rem;
}
.option-btn.correct { border-color: var(--success); background: var(--success-light); }
.option-btn.correct .option-letter { background: var(--success); color: #fff; }
.option-btn.incorrect { border-color: var(--error); background: var(--error-light); }
.option-btn.incorrect .option-letter { background: var(--error); color: #fff; }
.option-btn:disabled { cursor: default; }
.option-btn:disabled:not(.correct):not(.incorrect) { opacity: 0.55; }

.statement-list { display: flex; flex-direction: column; gap: 10px; }
.statement-row {
  padding: 14px 16px; border-radius: var(--radius);
  background: var(--surface); border: 2px solid var(--border);
}
.statement-row.ok { border-color: var(--success); background: var(--success-light); }
.statement-row.bad { border-color: var(--error); background: var(--error-light); }
.statement-text { font-size: 0.94rem; font-weight: 600; margin-bottom: 10px; }
.statement-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.statement-btn {
  padding: 8px 18px; border-radius: var(--radius-pill);
  border: 2px solid var(--border); background: var(--surface);
  color: var(--text-muted); font-weight: 700; font-size: 0.85rem; cursor: pointer;
  transition: all 0.12s ease;
}
.statement-btn:hover:not(:disabled) { border-color: var(--brand); }
.statement-btn.selected { border-color: var(--brand); background: var(--brand-light); color: var(--brand-dark); }
.statement-btn.correct { border-color: var(--success); background: var(--success-light); color: var(--success-dark); }
.statement-btn.incorrect { border-color: var(--error); background: var(--error-light); color: var(--error-dark); }
.statement-btn:disabled { cursor: default; }

.text-answer-row { display: flex; gap: 10px; margin-bottom: 4px; }
.text-input {
  flex: 1; padding: 13px 16px; border-radius: var(--radius);
  border: 2px solid var(--border); background: var(--surface); color: var(--text);
  font-family: inherit; font-size: 0.96rem;
}
.text-input:focus { outline: none; border-color: var(--brand); }

.feedback-box {
  margin-top: 16px; padding: 14px 16px; border-radius: var(--radius);
  font-size: 0.9rem; display: flex; flex-direction: column; gap: 4px;
  animation: pop-in 0.2s ease;
}
.feedback-box.ok { background: var(--success-light); color: var(--success-dark); }
.feedback-box.bad { background: var(--error-light); color: var(--error-dark); }
.feedback-box.neutral { background: var(--surface-2); color: var(--text); }
.feedback-box .fb-title { font-weight: 800; display: flex; align-items: center; gap: 6px; }

.self-grade-row { display: flex; gap: 10px; margin-top: 12px; }
.self-grade-row .btn { flex: 1; }

.study-hint {
  margin-top: 16px; padding: 14px 16px; border-radius: var(--radius);
  background: var(--surface-2); color: var(--text-muted); font-size: 0.85rem;
}

.question-nav { margin-top: 24px; display: flex; justify-content: flex-end; }

@keyframes pop-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* ============================================================
   RESULTS
   ============================================================ */
.results-container { max-width: 480px; margin: 0 auto; padding: 40px 20px 60px; text-align: center; }
.score-ring { position: relative; width: 180px; height: 180px; margin: 0 auto 16px; }
.score-ring svg { transform: rotate(-90deg); }
.score-ring circle { fill: none; stroke-width: 12; }
.score-ring .bg { stroke: var(--surface-2); }
.score-ring .fill { stroke: var(--brand); stroke-linecap: round; transition: stroke-dashoffset 0.8s cubic-bezier(.22,1,.36,1); }
.score-ring .label { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.score-ring .num { font-size: 2rem; font-weight: 800; }
.score-ring .den { font-size: 0.85rem; color: var(--text-muted); font-weight: 700; }

.results-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 24px 0; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 6px; }
.stat-card .val { font-size: 1.3rem; font-weight: 800; }
.stat-card .lbl { font-size: 0.68rem; color: var(--text-faint); font-weight: 700; text-transform: uppercase; letter-spacing: 0.02em; }
.stat-card.correct .val { color: var(--success); }
.stat-card.incorrect .val { color: var(--error); }

.results-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }

/* ============================================================
   REVIEW
   ============================================================ */
.review-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; text-align: left; }
.review-item-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; gap: 8px; }
.review-item .q-text { font-weight: 700; margin-bottom: 10px; }
.review-status { font-size: 0.75rem; font-weight: 800; padding: 3px 10px; border-radius: var(--radius-pill); white-space: nowrap; }
.review-status.ok { background: var(--success-light); color: var(--success-dark); }
.review-status.bad { background: var(--error-light); color: var(--error-dark); }
.review-answer-line { font-size: 0.85rem; margin-top: 4px; color: var(--text-muted); }
.review-answer-line b { font-weight: 700; color: var(--text); }

/* ============================================================
   FLASHCARDS
   ============================================================ */
.flashcard-area { perspective: 1400px; margin: 24px 0; }
.flashcard {
  position: relative; width: 100%; min-height: 320px;
  transform-style: preserve-3d; transition: transform 0.5s cubic-bezier(.4,.2,.2,1);
  cursor: pointer;
}
.flashcard.flipped { transform: rotateY(180deg); }
.flashcard-face {
  position: absolute; inset: 0; backface-visibility: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); padding: 28px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 14px;
  overflow-y: auto;
}
.flashcard-back { transform: rotateY(180deg); background: var(--brand-light); }
.flashcard-content { font-size: 1.1rem; font-weight: 700; white-space: pre-wrap; }
.flashcard-hint { font-size: 0.78rem; color: var(--text-faint); font-weight: 700; }
.flashcard-img { max-width: 100%; max-height: 140px; border-radius: var(--radius-sm); background: #fff; }

.flashcard-actions { display: flex; gap: 10px; margin-top: 16px; }
.flashcard-actions .btn { flex: 1; }

.dots-row { display: flex; justify-content: center; gap: 5px; margin-top: 20px; flex-wrap: wrap; max-width: 320px; margin-inline: auto; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--border); }
.dot.done { background: var(--brand); }
.dot.current { background: var(--accent); transform: scale(1.4); }

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(20, 16, 31, 0.55);
  display: flex; align-items: center; justify-content: center; z-index: 100;
  padding: 20px; backdrop-filter: blur(2px);
}
.modal {
  background: var(--surface); border-radius: var(--radius-lg);
  padding: 24px; max-width: 420px; width: 100%;
  box-shadow: var(--shadow-lg); max-height: 88vh; overflow-y: auto;
}
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.setting-row:last-of-type { border-bottom: none; }
.setting-info h3 { margin-bottom: 2px; font-size: 0.92rem; }
.setting-info p { font-size: 0.78rem; }

.toggle { position: relative; display: inline-block; width: 46px; height: 26px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0; background: var(--border); border-radius: var(--radius-pill);
  cursor: pointer; transition: background 0.2s ease;
}
.toggle-slider::before {
  content: ""; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: transform 0.2s ease; box-shadow: var(--shadow-sm);
}
.toggle input:checked + .toggle-slider { background: var(--brand); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

.theme-switch { display: flex; gap: 6px; background: var(--surface-2); padding: 4px; border-radius: var(--radius-pill); }
.theme-switch button {
  border: none; background: transparent; padding: 7px 12px; border-radius: var(--radius-pill);
  cursor: pointer; font-size: 0.85rem; color: var(--text-muted); font-weight: 700;
}
.theme-switch button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ============================================================
   TOAST / CONFETTI
   ============================================================ */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--bg-alt); padding: 12px 20px; border-radius: var(--radius-pill);
  font-size: 0.85rem; font-weight: 700; z-index: 200; box-shadow: var(--shadow-lg);
  animation: toast-in 0.25s ease;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }

.confetti-piece {
  position: fixed; top: -20px; z-index: 150; border-radius: 2px; pointer-events: none;
  animation: confetti-fall linear forwards;
}
@keyframes confetti-fall {
  to { transform: translateY(110vh) rotate(540deg); opacity: 0.2; }
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state .icon { font-size: 2.6rem; margin-bottom: 10px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 640px) {
  .app-container { padding: 0 14px 48px; }
  h1 { font-size: 1.6rem; }
  .hero { padding: 24px 0 16px; }
  .results-stats { grid-template-columns: repeat(2, 1fr); }
  .quiz-header-inner { padding: 10px 14px; }
  .question-container { padding: 18px 14px 70px; }
  .subject-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 380px) {
  .subject-grid { grid-template-columns: 1fr 1fr; }
  .results-actions .btn { padding: 13px 16px; }
}
