/* FiveQ static export — light grey / white cards / red primary */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #F3F4F6; --card: #ffffff; --text: #111827; --muted: #6B7280;
  --border: #E5E7EB; --red: #E63B2E; --red-dark: #C92F24;
  --gold: #F5B301; --green: #22A06B; --wrong: #DC2626;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 12px rgba(0,0,0,.05);
}
html[data-theme="dark"] {
  --bg: #111827; --card: #1F2937; --text: #F9FAFB; --muted: #9CA3AF;
  --border: #374151; --shadow: 0 1px 3px rgba(0,0,0,.4), 0 4px 12px rgba(0,0,0,.3);
}
html[data-contrast="high"] { --green: #F97316; --wrong: #2563EB; }
body {
  font-family: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg); color: var(--text); min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
#app { max-width: 560px; margin: 0 auto; padding: 16px 16px 48px; width: 100%; }
header.top { display: flex; align-items: center; justify-content: space-between; padding: 4px 2px 12px; }
header.top .wordmark { font-family: "Archivo Black", "Archivo", sans-serif; font-size: 26px; letter-spacing: -1px; }
header.top .wordmark .dot { color: var(--red); }
.icon-btn { background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  width: 40px; height: 40px; font-size: 19px; cursor: pointer; color: var(--text); }
.icon-btn:hover { border-color: var(--red); }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: var(--shadow); padding: 20px; margin-bottom: 14px; }
h1, h2, h3 { font-family: "Archivo Black", "Archivo", sans-serif; letter-spacing: -0.5px; }
p, li { font-size: 15px; line-height: 1.5; }
.small { font-size: 13px; color: var(--muted); }
.center { text-align: center; }
.hidden { display: none !important; }

/* Landing */
.landing { text-align: center; padding: 28px 20px 24px; }
.landing img.logo { width: 200px; max-width: 70%; height: auto; display: block; margin: 8px auto 4px; }
.landing .name { font-family: "Archivo Black", "Archivo", sans-serif; font-size: 44px; letter-spacing: -2px; }
.landing .name .dot { color: var(--red); }
.landing .tag { font-size: 16px; color: var(--muted); margin: 6px 0 20px; }
.btn { display: inline-block; background: var(--red); color: #fff; border: none; border-radius: 12px;
  font-family: "Archivo", sans-serif; font-weight: 700; font-size: 18px; padding: 14px 28px;
  cursor: pointer; width: 100%; }
.btn:hover { background: var(--red-dark); }
.btn.secondary { background: var(--card); color: var(--text); border: 1px solid var(--border); font-size: 15px; padding: 11px 18px; width: auto; }
.btn.small { font-size: 15px; padding: 10px 20px; width: auto; }
.btn:disabled { opacity: .55; cursor: default; }
.date-pill { display: inline-block; background: var(--bg); border: 1px solid var(--border);
  border-radius: 999px; padding: 5px 12px; font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 12px 0; }
.pill { background: var(--bg); border: 1px solid var(--border); border-radius: 999px; padding: 4px 10px; font-size: 12px; }
.countdown { font-size: 13px; color: var(--muted); margin-top: 14px; }
.challenge-note { background: #FEF3C7; border: 1px solid #FDE68A; color: #92400E;
  border-radius: 10px; padding: 10px 12px; font-size: 14px; margin: 12px 0; }
html[data-theme="dark"] .challenge-note { background: #451A03; border-color: #78350F; color: #FDE68A; }

/* Game */
.progress { display: flex; gap: 6px; margin: 10px 0 16px; }
.progress .seg { flex: 1; height: 6px; border-radius: 3px; background: var(--border); }
.progress .seg.done-correct { background: var(--green); }
.progress .seg.done-wrong { background: var(--wrong); }
.progress .seg.current { background: var(--gold); }
.q-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.q-meta .genre { font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .5px; color: var(--red); }
.timer { font-family: "Archivo Black", "Archivo", sans-serif; font-size: 20px; }
.timer.low { color: var(--red); }
.q-text { font-weight: 700; font-size: 19px; line-height: 1.35; margin: 14px 0 16px; }
.options { display: flex; flex-direction: column; gap: 10px; }
.opt { text-align: left; background: var(--bg); border: 2px solid var(--border); border-radius: 12px;
  padding: 13px 14px; font-family: "Archivo", sans-serif; font-weight: 700; font-size: 15px;
  color: var(--text); cursor: pointer; width: 100%; }
.opt:hover:not(:disabled) { border-color: var(--red); }
.opt:disabled { cursor: default; }
.opt.correct { background: var(--green); border-color: var(--green); color: #fff; }
.opt.wrong { background: var(--wrong); border-color: var(--wrong); color: #fff; }
.opt.dim { opacity: .55; }

/* Results */
.score-big { font-family: "Archivo Black", "Archivo", sans-serif; font-size: 52px; line-height: 1; }
.score-big .star { color: var(--gold); }
.share-card { background: #111827; color: #F9FAFB; border-radius: 14px; padding: 16px; margin: 14px 0; }
html[data-theme="dark"] .share-card { background: #000; border: 1px solid var(--border); }
.share-card .squares { font-size: 20px; letter-spacing: 2px; line-height: 1.6; word-break: break-all; }
.share-card .sc-line { font-size: 14px; color: #D1D5DB; margin-top: 8px; }
.support { text-align: center; font-size: 14px; margin: 16px 0 4px; }
.support a { color: var(--red); font-weight: 700; text-decoration: none; }
.row-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 14px; }
.breakdown { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.bd-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.bd-row .bd-q { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.bd-row .bd-sq { flex: 0 0 auto; font-size: 14px; }
.bd-row .bd-pts { flex: 0 0 auto; font-weight: 700; font-size: 13px; }

/* Stats / archive / history rows — must never clip at 390px */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; text-align: center; margin: 12px 0; }
.stat-grid .num { font-family: "Archivo Black", "Archivo", sans-serif; font-size: 24px; }
.stat-grid .lbl { font-size: 11px; color: var(--muted); }
.dist { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; }
.dist-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.dist-row .d-num { flex: 0 0 12px; font-size: 13px; font-weight: 700; }
.dist-row .d-bar { height: 16px; border-radius: 4px; background: var(--border); min-width: 14px;
  color: #fff; font-size: 11px; font-weight: 700; text-align: right; padding-right: 5px; line-height: 16px; }
.dist-row .d-bar.hot { background: var(--red); }
.list-row { display: flex; align-items: center; gap: 8px; padding: 10px 2px; border-bottom: 1px solid var(--border); min-width: 0; }
.list-row:last-child { border-bottom: none; }
.list-row .lr-main { flex: 1 1 auto; min-width: 0; }
.list-row .lr-title { font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row .lr-sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row .lr-score { flex: 0 0 auto; font-family: "Archivo Black", "Archivo", sans-serif; font-size: 16px; white-space: nowrap; }
.list-row .lr-sq { flex: 0 0 auto; font-size: 13px; letter-spacing: 1px; white-space: nowrap; }
.list-row .btn.small { flex: 0 0 auto; }

/* Settings modal */
.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: flex; align-items: flex-end; justify-content: center; z-index: 50; }
.modal { background: var(--card); color: var(--text); border-radius: 16px 16px 0 0; width: 100%; max-width: 560px; padding: 20px; }
.modal h2 { margin-bottom: 12px; }
.set-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.set-row:last-of-type { border-bottom: none; }
.set-row .set-label { font-weight: 700; font-size: 15px; }
.set-row .set-desc { font-size: 13px; color: var(--muted); }
select, .toggle { font-family: "Archivo", sans-serif; font-size: 15px; padding: 8px 10px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text); }
.howto ol { padding-left: 20px; display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #111827; color: #fff;
  padding: 10px 18px; border-radius: 999px; font-size: 14px; z-index: 60; box-shadow: var(--shadow); }
footer.foot { text-align: center; font-size: 12px; color: var(--muted); padding: 12px 0; }
footer.foot a { color: var(--muted); }
@media (max-width: 400px) {
  .landing .name { font-size: 38px; }
  .score-big { font-size: 44px; }
  .stat-grid .num { font-size: 20px; }
}
