/* TradePass — mobile-first styles. No frameworks, no build step. */

:root {
  --bg: #0f172a;
  --card: #1e293b;
  --card-2: #273449;
  --line: #334155;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --accent: #f97316;
  --accent-dark: #c2570b;
  --good: #22c55e;
  --good-bg: rgba(34, 197, 94, 0.14);
  --bad: #ef4444;
  --bad-bg: rgba(239, 68, 68, 0.14);
  --warn: #eab308;
  --radius: 14px;
}

/* Light theme — switched from Account & Settings (data-theme set by app.js) */
:root[data-theme="light"] {
  --bg: #f1f5f9;
  --card: #ffffff;
  --card-2: #e2e8f0;
  --line: #cbd5e1;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #ea580c;
  --accent-dark: #c2410c;
  --good: #16a34a;
  --good-bg: rgba(22, 163, 74, 0.12);
  --bad: #dc2626;
  --bad-bg: rgba(220, 38, 38, 0.10);
  --warn: #a16207;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
}

#app {
  max-width: 520px;
  margin: 0 auto;
  padding: 16px 16px calc(32px + env(safe-area-inset-bottom));
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- Shared bits ---------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0 14px;
}

.topbar h1 {
  font-size: 1.05rem;
  font-weight: 700;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.back-btn {
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 0.95rem;
  cursor: pointer;
  flex-shrink: 0;
}

.brand {
  font-weight: 800;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
}
.brand .pass { color: var(--accent); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}

.btn {
  display: block;
  width: 100%;
  border: none;
  border-radius: var(--radius);
  padding: 15px 16px;
  font-size: 1.02rem;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  color: var(--text);
  background: var(--card-2);
  border: 1px solid var(--line);
  margin-bottom: 10px;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.985); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #1a1005; }
.btn.good { background: var(--good); border-color: var(--good); color: #06240f; }
.btn.ghost { background: transparent; color: var(--muted); border-color: var(--line); font-weight: 600; }
.btn.small { padding: 10px 12px; font-size: 0.92rem; width: auto; display: inline-block; margin-bottom: 0; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.muted { color: var(--muted); font-size: 0.9rem; }
.center { text-align: center; }
.spacer { flex: 1; }

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  vertical-align: middle;
}
.badge.weak { background: var(--bad-bg); color: var(--bad); }
.badge.moderate { background: rgba(234, 179, 8, 0.15); color: var(--warn); }
.badge.strong { background: var(--good-bg); color: var(--good); }
.badge.none { background: var(--card-2); color: var(--muted); }
.badge.free { background: var(--good-bg); color: var(--good); }
.badge.pro { background: rgba(249, 115, 22, 0.15); color: var(--accent); }

input[type="text"], input[type="email"] {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  padding: 13px 14px;
  font-size: 1rem;
  margin-bottom: 10px;
}
input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

/* ---------- Welcome ---------- */

.welcome {
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex: 1;
  text-align: center;
  gap: 8px;
}
.welcome .hard-hat { font-size: 3.2rem; }
.welcome h2 { font-size: 1.25rem; font-weight: 700; margin: 6px 0 2px; }
.welcome .pitch { color: var(--muted); margin-bottom: 18px; }
.welcome form { text-align: left; }

/* ---------- Home ---------- */

.readiness {
  text-align: center;
  padding: 20px 16px;
}
.readiness .big-score { font-size: 2.6rem; font-weight: 800; line-height: 1.1; }
.readiness .big-score.pass { color: var(--good); }
.readiness .big-score.fail { color: var(--accent); }

.meter {
  position: relative;
  height: 10px;
  background: var(--card-2);
  border-radius: 999px;
  margin: 14px 0 6px;
  overflow: visible;
}
.meter .fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.4s ease;
}
.meter .fill.pass { background: var(--good); }
.meter .goal {
  position: absolute;
  top: -4px;
  bottom: -4px;
  width: 2px;
  background: var(--text);
  left: 70%;
}
.meter-caption { display: flex; justify-content: space-between; font-size: 0.78rem; color: var(--muted); }

.section-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.section-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  cursor: pointer;
  text-align: left;
  color: var(--text);
  font-family: inherit;
}
.section-card:active { transform: scale(0.985); }
.section-card .sec-name { font-weight: 700; font-size: 1rem; }
.section-card .sec-sub { color: var(--muted); font-size: 0.78rem; margin: 2px 0 10px; min-height: 2.3em; }
.section-card .sec-pct { font-size: 0.85rem; font-weight: 700; }
.mini-meter { height: 6px; background: var(--card-2); border-radius: 999px; margin-top: 6px; overflow: hidden; }
.mini-meter .fill { height: 100%; background: var(--accent); border-radius: 999px; }

/* ---------- Quiz ---------- */

.quiz-progress { font-size: 0.85rem; color: var(--muted); font-weight: 600; }

.q-topic { color: var(--accent); font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 8px; }
.q-text { font-size: 1.12rem; font-weight: 600; line-height: 1.45; margin-bottom: 16px; }

.option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  text-align: left;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  padding: 14px;
  font-size: 1rem;
  font-family: inherit;
  line-height: 1.4;
  cursor: pointer;
  margin-bottom: 10px;
  -webkit-tap-highlight-color: transparent;
}
.option:active { transform: scale(0.99); }
.option .letter {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--card-2);
  color: var(--muted);
  font-weight: 800;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.option.correct { border-color: var(--good); background: var(--good-bg); }
.option.correct .letter { background: var(--good); color: #06240f; }
.option.wrong { border-color: var(--bad); background: var(--bad-bg); }
.option.wrong .letter { background: var(--bad); color: #fff; }
.option.picked { border-color: var(--accent); }
.option.picked .letter { background: var(--accent); color: #1a1005; }
.option:disabled { cursor: default; opacity: 1; }
.option.dim { opacity: 0.55; }

.verdict { font-weight: 800; font-size: 1.05rem; margin-bottom: 6px; }
.verdict.good { color: var(--good); }
.verdict.bad { color: var(--bad); }

.explain {
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 14px;
  font-size: 0.95rem;
  color: var(--text);
  margin: 4px 0 14px;
}

/* ---------- Mock exam ---------- */

.timer {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  font-size: 1rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 7px 12px;
}
.timer.low { color: var(--bad); border-color: var(--bad); }

.mock-nav { display: flex; gap: 10px; margin-top: 6px; }
.mock-nav .btn { margin-bottom: 0; }

.dots { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 16px; }
.dot {
  width: 26px; height: 26px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-family: inherit;
}
.dot.answered { background: var(--card-2); color: var(--text); border-color: var(--muted); }
.dot.current { border-color: var(--accent); color: var(--accent); }

/* ---------- Results ---------- */

.result-hero { text-align: center; padding: 24px 16px; }
.result-hero .score { font-size: 3rem; font-weight: 800; line-height: 1; }
.result-hero .verdict-chip {
  display: inline-block;
  margin-top: 10px;
  padding: 6px 18px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 1rem;
}
.verdict-chip.pass { background: var(--good-bg); color: var(--good); }
.verdict-chip.fail { background: var(--bad-bg); color: var(--bad); }

.review-item { border-left: 4px solid var(--line); }
.review-item.right { border-left-color: var(--good); }
.review-item.wrong { border-left-color: var(--bad); }
.review-item .rq { font-weight: 600; margin-bottom: 8px; }
.review-item .ra { font-size: 0.9rem; margin-bottom: 4px; }
.review-item .ra.user-wrong { color: var(--bad); }
.review-item .ra.the-answer { color: var(--good); }
.review-item .rex { font-size: 0.88rem; color: var(--muted); margin-top: 8px; }

/* ---------- Progress ---------- */

.prog-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.prog-row:last-child { border-bottom: none; }
.prog-row .t-name { flex: 1; font-size: 0.93rem; }
.prog-row .t-stat { font-size: 0.82rem; color: var(--muted); white-space: nowrap; }

/* ---------- Upgrade ---------- */

.perk { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 12px; }
.perk .tick { color: var(--good); font-weight: 800; flex-shrink: 0; }
.price-line { text-align: center; margin: 14px 0 4px; }
.price-line .price { font-size: 2.4rem; font-weight: 800; }
.price-line .terms { color: var(--muted); font-size: 0.85rem; }

.footnote { color: var(--muted); font-size: 0.75rem; text-align: center; margin-top: 18px; line-height: 1.5; }
.footnote a { color: var(--muted); }

.lock-banner {
  background: rgba(249, 115, 22, 0.1);
  border: 1px solid rgba(249, 115, 22, 0.4);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 0.88rem;
  margin-bottom: 12px;
}
.lock-banner button {
  background: none; border: none; color: var(--accent);
  font-weight: 700; cursor: pointer; padding: 0; font-size: 0.88rem; font-family: inherit;
  text-decoration: underline;
}

.empty-state { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty-state .big { font-size: 2.4rem; margin-bottom: 8px; }

/* ---------- Account & Settings ---------- */

.theme-row { display: flex; gap: 8px; }
.theme-row .btn { flex: 1; }
