/* =========================================================
   BZF Trainer – Design System
   Freundlich · Modern · Flächig · Großzügig
   ========================================================= */

:root {
  --primary:       #0d7ec5;
  --primary-d:     #0b6ca9;
  --primary-l:     #e7f3fb;
  --success:       #10B981;
  --success-l:     #ECFDF5;
  --danger:        #EF4444;
  --danger-l:      #FEF2F2;
  --warning:       #F59E0B;
  --bg:            #F2F3F8;
  --surface:       #FFFFFF;
  --text:          #1A1B2E;
  --muted:         #7B7F9E;
  --border:        #E4E5F0;
  --radius:        5px;
  --radius-sm:     7px;
  --shadow:        0 1px 4px rgba(26,27,46,.06), 0 1px 2px rgba(26,27,46,.04);
  --shadow-md:     0 4px 20px rgba(26,27,46,.09);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
html, body {
  width: 100%;
  overflow-x: hidden;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}
.ui-icon {
  display: inline-block;
  width: 1em;
  height: 1em;
  flex-shrink: 0;
  background-color: currentColor;
  -webkit-mask-image: var(--icon-url);
  mask-image: var(--icon-url);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}

/* ── Splash ── */
.splash {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.splash-logo {
  width: 52px;
  height: 52px;
  color: var(--primary);
  animation: pulse 1.4s ease-in-out infinite;
}
.splash-logo svg { width: 100%; height: 100%; display: block; }
.splash-name {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.4px;
}
@keyframes pulse { 0%,100%{transform:scale(1)} 50%{transform:scale(1.12)} }

/* ── Layout ── */
.container {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: 0;
}

/* =========================================================
   AUTH
   ========================================================= */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 40px 36px;
  box-shadow: var(--shadow-md);
}

.auth-brand {
  text-align: center;
  margin-bottom: 36px;
}
.auth-logomark {
  width: 60px;
  height: 60px;
  background: var(--primary);
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}
.auth-logomark .ui-icon { width: 28px; height: 28px; color: #fff; }
.auth-brand h1 {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -.5px;
}
.auth-brand p {
  font-size: 14px;
  color: var(--muted);
  margin-top: 4px;
}

.tab-row {
  display: flex;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 28px;
}
.tab-btn {
  flex: 1;
  padding: 9px 12px;
  border: none;
  border-radius: 5px;
  background: transparent;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  color: var(--muted);
  cursor: pointer;
  transition: all .15s;
}
.tab-btn.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

/* ── Forms ── */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}
.form-input {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color .15s;
}
.form-input:focus { border-color: var(--primary); }
.form-input::placeholder { color: #C4C8DC; }

.error-msg {
  display: none;
  font-size: 13px;
  color: var(--danger);
  margin-top: 10px;
}
.error-msg.show { display: block; }
.success-msg {
  display: none;
  font-size: 13px;
  color: var(--success);
  margin-top: 10px;
}
.success-msg.show { display: block; }
.auth-note {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 14px;
}
.auth-note.danger { color: var(--danger); }
.btn-link-like {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 6px;
  padding: 0;
}
.btn-link-like:hover { text-decoration: underline; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 13px 22px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all .15s;
  text-decoration: none;
}
.btn-full { width: 100%; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover  { background: var(--primary-d); }
.btn-primary:active { transform: scale(.98); }

.btn-ghost  { background: var(--bg); color: var(--text); }
.btn-ghost:hover { background: var(--border); }

.btn-outline {
  background: var(--surface);
  color: var(--text);
  border: 1.5px solid var(--border);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-outline:disabled { opacity: .45; pointer-events: none; }

.mt-20 { margin-top: 20px; }

/* =========================================================
   TOP BAR
   ========================================================= */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-inner {
  max-width: 680px;
  margin: 0 auto;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.topbar-logo { font-size: 18px; font-weight: 800; letter-spacing: -.4px; }
.topbar-logo span { color: var(--primary); }
.topbar-logo-btn {
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
  cursor: pointer;
  color: inherit;
}
.topbar-logo-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 4px;
  border-radius: 6px;
}

.topbar-right { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary-l);
  color: var(--primary);
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.username-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  padding: 6px;
  border-radius: 8px;
  font-size: 16px;
  display: flex;
  align-items: center;
  transition: color .15s, background .15s;
}
.icon-btn:hover { color: var(--text); background: var(--bg); }

/* =========================================================
   DASHBOARD
   ========================================================= */
.page { flex: 1; padding: 28px 0 60px; }

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px 14px;
  text-align: center;
}
.stat-card.stat-link {
  cursor: pointer;
  border: 1px solid var(--border);
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.stat-card.stat-link:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}
.stat-card.stat-link:active {
  transform: scale(.98);
}
.stat-card.stat-link.disabled {
  opacity: .45;
  pointer-events: none;
}
.stat-val {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -1.5px;
  line-height: 1;
  margin-bottom: 5px;
}
.stat-lbl { font-size: 12px; color: var(--muted); font-weight: 500; }
.stat-card.c-primary .stat-val { color: var(--primary); }
.stat-card.c-danger  .stat-val { color: var(--danger); }
.stat-card.c-success .stat-val { color: var(--success); }
.stat-card.c-warning .stat-val { color: var(--warning); }

.progress-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}
.progress-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 12px;
}
.progress-head-title { font-size: 15px; font-weight: 600; }
.progress-head-pct   { font-size: 14px; font-weight: 700; color: var(--primary); }

.prog-bar {
  height: 8px;
  background: var(--bg);
  border-radius: 99px;
  overflow: hidden;
}
.prog-fill {
  height: 100%;
  border-radius: 99px;
  background: var(--primary);
  transition: width .6s cubic-bezier(.4,0,.2,1);
}

/* ── Section heading ── */
.section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .7px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
}

/* ── Mode cards ── */
.mode-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 28px;
}
.mode-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px 16px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all .15s;
  text-align: left;
  position: relative;
  overflow: hidden;
}
.mode-card:hover  { border-color: var(--primary); }
.mode-card:active { transform: scale(.97); }
.mode-card.featured { background: var(--primary); }
.mode-card.disabled { opacity: .45; pointer-events: none; }

.mode-icon { margin-bottom: 10px; display: inline-flex; color: var(--primary); }
.mode-icon .ui-icon { width: 24px; height: 24px; display: block; }
.mode-name  { font-size: 14px; font-weight: 700; margin-bottom: 3px; }
.mode-desc  { font-size: 12px; color: var(--muted); line-height: 1.4; }
.mode-card.featured .mode-name,
.mode-card.featured .mode-desc { color: rgba(255,255,255,.9); }
.mode-card.featured .mode-desc { color: rgba(255,255,255,.72); }
.mode-card.featured .mode-icon { color: #fff; }
.resume-card { padding-right: 90px; }
.resume-meta { margin-top: 4px; font-size: 11px; }
.resume-discard {
  position: absolute;
  top: 10px;
  right: 10px;
  border: 1px solid rgba(255,255,255,.45);
  background: rgba(255,255,255,.08);
  color: #fff;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}
.resume-discard:hover { background: rgba(255,255,255,.2); }

/* ── Category list ── */
.cat-list { display: flex; flex-direction: column; gap: 8px; }
.cat-item {
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: all .15s;
  border: 2px solid transparent;
}
.cat-item:hover { border-color: var(--primary); }
.cat-item:active { transform: scale(.98); }

.cat-ico {
  width: 40px;
  height: 40px;
  background: transparent;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.cat-ico .ui-icon {
  width: 28px;
  height: 28px;
  color: var(--primary);
}
.cat-body { flex: 1; min-width: 0; }
.cat-name { font-size: 14px; font-weight: 600; }
.cat-sub  { font-size: 12px; color: var(--muted); margin-top: 1px; }
.cat-right { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.cat-pct  { font-size: 12px; font-weight: 700; color: var(--primary); }
.cat-bar  { width: 56px; height: 4px; background: var(--bg); border-radius: 99px; overflow: hidden; }
.cat-fill { height: 100%; background: var(--primary); border-radius: 99px; }

/* ── Test history ── */
.history-list { display: flex; flex-direction: column; gap: 10px; }
.history-item {
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  border: 1px solid var(--border);
}
.history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}
.history-mode {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.history-pill {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .45px;
  border-radius: 999px;
  padding: 3px 9px;
  white-space: nowrap;
}
.history-pill.pass { color: var(--success); background: var(--success-l); }
.history-pill.fail { color: var(--danger); background: var(--danger-l); }
.history-meta {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}
.history-score {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 7px;
}
.history-bar {
  height: 6px;
  border-radius: 999px;
  background: var(--bg);
  overflow: hidden;
}
.history-fill {
  height: 100%;
  border-radius: 999px;
}
.history-fill.pass { background: var(--success); }
.history-fill.fail { background: var(--danger); }
.history-actions {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
}
.history-retry {
  border: 1px solid var(--danger);
  color: var(--danger);
  background: rgba(220, 38, 38, 0.06);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 12px;
  cursor: pointer;
}
.history-retry:hover { background: rgba(220, 38, 38, 0.12); }
.history-retry.fallback {
  border-color: var(--warning);
  color: #b45309;
  background: rgba(245, 158, 11, 0.12);
}
.history-retry.fallback:hover { background: rgba(245, 158, 11, 0.2); }
.history-empty {
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 18px 16px;
  font-size: 13px;
  color: var(--muted);
}

/* ── Bookmark button ── */
.q-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.q-header .q-tag { margin-bottom: 0; }

.bookmark-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  transition: color .15s, background .15s;
  flex-shrink: 0;
}
.bookmark-btn:hover  { color: var(--warning); background: var(--bg); }
.bookmark-btn.active { color: var(--warning); }

/* =========================================================
   QUIZ
   ========================================================= */
.quiz-topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 20px;
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 14px;
}
.quiz-back {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  display: flex;
  align-items: center;
  padding: 4px;
  border-radius: 8px;
  transition: color .15s, background .15s;
  flex-shrink: 0;
}
.quiz-back:hover { color: var(--text); background: var(--bg); }

.quiz-prog-wrap { flex: 1; }
.quiz-counter {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
  margin-bottom: 6px;
}
.quiz-bar {
  height: 5px;
  background: var(--bg);
  border-radius: 99px;
  overflow: hidden;
}
.quiz-bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 99px;
  transition: width .3s ease;
}
.quiz-score-badge {
  font-size: 13px;
  font-weight: 700;
  color: var(--success);
  white-space: nowrap;
  flex-shrink: 0;
}
.quiz-pause {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.quiz-pause:hover { border-color: var(--primary); color: var(--primary); }

/* ── Question area ── */
.quiz-body {
  flex: 1;
  padding: 28px 20px 120px;
  max-width: 680px;
  margin: 0 auto;
  width: 100%;
}

.q-tag {
  display: inline-flex;
  align-items: center;
  background: var(--primary-l);
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  padding: 4px 11px;
  border-radius: 20px;
}
.q-text {
  font-size: 19px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--text);
  margin-bottom: 32px;
}

/* ── Answer buttons ── */
.answers { display: flex; flex-direction: column; gap: 10px; }
.ans-btn {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  width: 100%;
  transition: all .15s;
}
.ans-btn:hover:not(:disabled) {
  border-color: var(--primary);
  background: var(--primary-l);
}
.ans-btn:disabled { cursor: default; }

.ans-letter {
  width: 30px;
  height: 30px;
  min-width: 30px;
  border-radius: 8px;
  background: var(--bg);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
}
.ans-text {
  font-size: 14px;
  color: var(--text);
  line-height: 1.55;
  padding-top: 4px;
}

/* States after answering */
.ans-btn.state-correct {
  border-color: var(--success);
  background: var(--success-l);
}
.ans-btn.state-correct .ans-letter {
  background: var(--success);
  color: #fff;
}
.ans-btn.state-wrong {
  border-color: var(--danger);
  background: var(--danger-l);
}
.ans-btn.state-wrong .ans-letter {
  background: var(--danger);
  color: #fff;
}
.ans-btn.state-selected {
  border-color: var(--primary);
  background: var(--primary-l);
}
.ans-btn.state-selected .ans-letter {
  background: var(--primary);
  color: #fff;
}
.ans-btn.state-show {
  border-color: var(--success);
  background: var(--success-l);
  opacity: .75;
}
.ans-btn.state-show .ans-letter {
  background: var(--success);
  color: #fff;
}
.ans-btn.state-dim {
  opacity: .4;
}
.answer-feedback {
  margin-top: 12px;
  font-size: 13px;
  font-weight: 600;
}
.answer-feedback.ok { color: var(--success); }
.answer-feedback.bad { color: var(--danger); }

/* ── Next button (fixed bottom) ── */
.next-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 14px 20px;
  padding-bottom: calc(14px + env(safe-area-inset-bottom));
  z-index: 60;
  display: none;
}
.next-bar.show { display: block; }
.next-bar .container { max-width: 680px; }

.btn-next {
  width: 100%;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 15px 24px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background .15s;
}
.btn-next:hover { background: var(--primary-d); }
.next-hint {
  margin-top: 7px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

.all-correct-msg {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  padding: 28px;
  color: var(--success);
  font-weight: 600;
  font-size: 15px;
}
.all-correct-icon {
  width: 18px;
  height: 18px;
}

/* =========================================================
   RESULTS
   ========================================================= */
.results-wrap {
  max-width: 680px;
  margin: 0 auto;
  padding: 32px 20px 60px;
}

.score-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 40px 24px;
  text-align: center;
  margin-bottom: 20px;
}
.score-ring { width: 128px; height: 128px; margin: 0 auto 22px; position: relative; }
.score-ring svg { width: 128px; height: 128px; transform: rotate(-90deg); }
.ring-track { stroke: var(--bg); fill: none; stroke-width: 11; }
.ring-fill  { fill: none; stroke-width: 11; stroke-linecap: round; transition: stroke-dashoffset 1.1s cubic-bezier(.4,0,.2,1); }
.ring-center {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  text-align: center;
}
.ring-pct       { font-size: 28px; font-weight: 800; line-height: 1; letter-spacing: -1px; }
.ring-pct-label { font-size: 11px; color: var(--muted); }

.result-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 18px;
  border-radius: 99px;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 14px;
}
.result-pill.pass { background: var(--success-l); color: var(--success); }
.result-pill.fail { background: var(--danger-l);  color: var(--danger); }

.result-title { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.result-sub   { font-size: 14px; color: var(--muted); }

.results-btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 28px;
}
.results-btns .btn-full { grid-column: 1 / -1; }

/* ── Wrong answers review ── */
.review-title { font-size: 15px; font-weight: 700; margin-bottom: 12px; }
.review-all   { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.review-item {
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 8px;
  border-left: 3px solid var(--danger);
}
.review-q    { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.review-q strong { color: var(--text); }
.review-ans  { font-size: 13px; font-weight: 600; color: var(--success); }

/* =========================================================
   UTILITIES
   ========================================================= */
.hidden { display: none !important; }

.loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 220px;
  color: var(--muted);
  font-size: 14px;
}
.spinner {
  width: 20px; height: 20px;
  border: 2.5px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Toast */
.toast {
  position: fixed;
  bottom: 28px; left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--text);
  color: #fff;
  padding: 12px 22px;
  border-radius: 99px;
  font-size: 14px;
  font-weight: 500;
  z-index: 200;
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  white-space: normal;
  text-align: center;
  width: max-content;
  max-width: calc(100vw - 24px);
  pointer-events: none;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 480px) {
  .container {
    padding-left: max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
  }
  .auth-card { padding: 28px 20px; }
  .stats-row { gap: 8px; }
  .stat-card { padding: 16px 10px; }
  .stat-val  { font-size: 24px; }
  .mode-grid { gap: 8px; }
  .mode-card { padding: 16px 13px; }
  .q-text    { font-size: 17px; }
  .results-btns { grid-template-columns: 1fr; }
  .results-btns .btn-full { grid-column: 1; }
  .toast {
    left: 12px;
    right: 12px;
    transform: translateY(80px);
    width: auto;
    max-width: none;
    border-radius: 14px;
    padding: 12px 14px;
  }
  .toast.show { transform: translateY(0); }
}
@media (min-width: 481px) and (max-width: 768px) {
  .container {
    padding-left: max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
  }
}
@media (min-width: 600px) {
  .username-label { display: block; }
}
@media (max-width: 599px) {
  .username-label { display: none; }
}
