/* MCQ Master for Pi — mobile-first styles.
   Palette: deep teal + amber. Deliberately NOT Pi's purple/gold, so the
   app has its own identity (Pi listing rules forbid copying Pi's logo). */
:root {
  --teal: #0d5c63;
  --teal-dark: #094349;
  --teal-light: #e6f2f3;
  --amber: #f2a900;
  --amber-dark: #c98a00;
  --ink: #1c2b2d;
  --muted: #5a6b6d;
  --line: #dce6e7;
  --bg: #f7fafa;
  --card: #ffffff;
  --green: #1e7d46;
  --green-bg: #e5f6ec;
  --red: #b3261e;
  --red-bg: #fdecea;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(13, 92, 99, 0.08);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--teal); }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 10px 14px;
  background: var(--teal); color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
.brand { display: flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; }
.brand-logo { border-radius: 8px; }
.brand-name { font-weight: 700; font-size: 1.05rem; letter-spacing: -0.01em; }
.brand-pi { font-weight: 400; opacity: 0.85; font-size: 0.85rem; }
.auth-area { display: flex; align-items: center; gap: 8px; }
.username { font-size: 0.9rem; font-weight: 600; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pro-badge {
  background: var(--amber); color: #3d2c00; font-size: 0.7rem; font-weight: 800;
  padding: 2px 8px; border-radius: 20px; letter-spacing: 0.04em;
}

/* Layout */
.app { max-width: 640px; margin: 0 auto; padding: 16px 14px 40px; }
.loading, .error { text-align: center; padding: 40px 16px; color: var(--muted); }
.error { color: var(--red); }
h1 { font-size: 1.4rem; margin: 4px 0 12px; }
h2 { font-size: 1.1rem; margin: 20px 0 10px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 14px; box-shadow: var(--shadow);
}
.muted { color: var(--muted); font-size: 0.9rem; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; border-radius: 10px; padding: 12px 18px; font-size: 1rem; font-weight: 600;
  cursor: pointer; text-decoration: none; min-height: 46px;
}
.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:active { background: var(--teal-dark); }
.btn-amber { background: var(--amber); color: #3d2c00; }
.btn-amber:active { background: var(--amber-dark); }
.btn-ghost { background: transparent; color: var(--teal); border: 1.5px solid var(--teal); }
.btn-small { padding: 8px 12px; font-size: 0.9rem; min-height: 36px; }
.btn-block { display: flex; width: 100%; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-white { background: #fff; color: var(--teal); }

/* Home */
.streak-row { display: flex; gap: 10px; margin-bottom: 14px; }
.stat {
  flex: 1; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 8px; text-align: center; box-shadow: var(--shadow);
}
.stat-num { font-size: 1.5rem; font-weight: 800; color: var(--teal); line-height: 1.1; }
.stat-label { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.subject-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.subject-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 12px; text-align: left; cursor: pointer; box-shadow: var(--shadow);
  font-family: inherit; color: var(--ink);
}
.subject-card:active { border-color: var(--teal); }
.subject-icon { font-size: 1.4rem; }
.subject-name { font-weight: 700; font-size: 0.95rem; margin-top: 4px; }
.subject-count { font-size: 0.8rem; color: var(--muted); }
.mock-row { display: flex; gap: 10px; flex-wrap: wrap; }
.mock-row .btn { flex: 1; min-width: 140px; }
.pro-banner {
  background: linear-gradient(135deg, var(--teal), #12808a); color: #fff;
  border-radius: var(--radius); padding: 16px; margin-bottom: 14px;
}
.pro-banner h2 { margin: 0 0 6px; color: #fff; }
.pro-banner p { margin: 0 0 12px; opacity: 0.9; font-size: 0.92rem; }
.resume-banner {
  background: #fff7e0; border: 1px solid var(--amber); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 14px; display: flex; align-items: center;
  justify-content: space-between; gap: 10px; flex-wrap: wrap;
}

/* Quiz */
.progress-bar { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; margin-bottom: 14px; }
.progress-fill { height: 100%; background: var(--teal); transition: width 0.25s ease; }
.quiz-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; color: var(--muted); font-size: 0.88rem; }
.timer { font-weight: 800; font-size: 1.15rem; color: var(--teal); font-variant-numeric: tabular-nums; }
.timer.danger { color: var(--red); }
.question-text { font-size: 1.08rem; font-weight: 600; margin: 0 0 16px; }
.question-text[dir="rtl"] { text-align: right; }
.options { display: flex; flex-direction: column; gap: 10px; }
.option {
  display: flex; align-items: flex-start; gap: 10px; width: 100%; text-align: left;
  background: var(--card); border: 1.5px solid var(--line); border-radius: 12px;
  padding: 13px 14px; font-size: 1rem; cursor: pointer; font-family: inherit; color: var(--ink);
}
.option:active { border-color: var(--teal); }
.option-letter {
  flex: 0 0 auto; width: 28px; height: 28px; border-radius: 50%;
  background: var(--teal-light); color: var(--teal); font-weight: 700; font-size: 0.85rem;
  display: flex; align-items: center; justify-content: center;
}
.option.selected { border-color: var(--teal); background: var(--teal-light); }
.option.correct { border-color: var(--green); background: var(--green-bg); }
.option.wrong { border-color: var(--red); background: var(--red-bg); }
.option:disabled { cursor: default; opacity: 1; }
.feedback { margin-top: 14px; padding: 12px 14px; border-radius: 10px; font-size: 0.95rem; }
.feedback.correct { background: var(--green-bg); color: var(--green); }
.feedback.wrong { background: var(--red-bg); color: var(--red); }
.feedback .explanation { margin-top: 8px; color: var(--ink); }
.feedback .locked { margin-top: 8px; color: var(--muted); font-size: 0.88rem; }
.quiz-nav { display: flex; gap: 10px; margin-top: 16px; }
.quiz-nav .btn { flex: 1; }

/* Mock navigator */
.nav-grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 6px; margin-bottom: 14px; }
.nav-btn {
  aspect-ratio: 1; border: 1px solid var(--line); background: var(--card); border-radius: 8px;
  font-size: 0.8rem; font-weight: 600; cursor: pointer; color: var(--ink); padding: 0;
  font-variant-numeric: tabular-nums;
}
.nav-btn.answered { background: var(--teal-light); border-color: var(--teal); color: var(--teal); }
.nav-btn.current { background: var(--teal); color: #fff; border-color: var(--teal); }

/* Results */
.score-hero { text-align: center; padding: 8px 0 4px; }
.score-big { font-size: 2.6rem; font-weight: 800; color: var(--teal); line-height: 1; }
.score-sub { color: var(--muted); margin-top: 4px; }
.review-item { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; background: var(--card); }
.review-item.correct { border-left: 4px solid var(--green); }
.review-item.wrong { border-left: 4px solid var(--red); }
.review-item.skipped { border-left: 4px solid var(--muted); }
.review-q { font-weight: 600; font-size: 0.95rem; margin-bottom: 6px; }
.review-line { font-size: 0.9rem; }
.review-line .ok { color: var(--green); font-weight: 600; }
.review-line .bad { color: var(--red); font-weight: 600; }
.review-expl { font-size: 0.88rem; color: var(--muted); margin-top: 6px; }
.review-toggle { background: none; border: none; color: var(--teal); font-weight: 600; cursor: pointer; padding: 6px 0; font-size: 0.9rem; }

/* Pro page */
.feature-list { list-style: none; padding: 0; margin: 0 0 16px; }
.feature-list li { padding: 8px 0 8px 28px; position: relative; border-bottom: 1px solid var(--line); }
.feature-list li:last-child { border-bottom: none; }
.feature-list li::before { content: "✓"; position: absolute; left: 4px; color: var(--green); font-weight: 800; }
.price { font-size: 2rem; font-weight: 800; color: var(--teal); }
.price-note { color: var(--muted); font-size: 0.9rem; }

/* Privacy */
.privacy h2 { margin-top: 24px; }
.privacy p, .privacy li { font-size: 0.95rem; color: #33484a; }

.footer {
  max-width: 640px; margin: 0 auto; padding: 16px 14px 32px; text-align: center;
  color: var(--muted); font-size: 0.85rem;
}
.footer-dot { margin: 0 6px; }
.notice {
  background: var(--teal-light); border: 1px solid var(--teal); border-radius: 10px;
  padding: 12px 14px; margin-bottom: 14px; font-size: 0.92rem;
}
.notice.warn { background: #fff7e0; border-color: var(--amber); }
