/* FiveQ static export — faithful to the in-chat artifact (daily-duel-trainer) */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #f3f4f6; --surface: #ffffff; --surface-alt: #eceef1;
  --text: #14161a; --dim: #5b6472; --border: #dfe3e8;
  --accent: #e63b2e; --accent-dark: #c62a1f; --accent-ink: #ffffff;
  --accent-shadow: rgba(230, 59, 46, 0.3);
  --gold: #f5b301; --gold-ink: #3a2a00;
  --green: #128a43; --green-bg: #e2f4e9;
  --red: #d92d20; --red-bg: #fbe7e4;
  --ok: #128a43; --bad: #d92d20;
  --card: #14161a; --card-ink: #f5f6f7; --card-muted: #a7adb8;
  --card-line: #3a3f49; --card-sq: #2a2e37;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(20, 22, 26, 0.1);
  --font-display: "Archivo Black", "Archivo", system-ui, sans-serif;
}
html[data-theme="dark"] {
  --bg: #0e1013; --surface: #1a1d23; --surface-alt: #24272f;
  --text: #f2f4f7; --dim: #9aa3b2; --border: #2c3038;
  --accent: #ff5142;
  --green: #2fbf71; --green-bg: #123324;
  --red: #ff6b5e; --red-bg: #3a1b17;
  --ok: #2fbf71; --bad: #ff6b5e;
  --card: #000000;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}
html[data-contrast="high"] { --ok: #d9480f; --bad: #1971c2; }
html[data-theme="dark"][data-contrast="high"] { --ok: #ffa94d; --bad: #74c0fc; }

body {
  font-family: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg); color: var(--text); min-height: 100vh;
  line-height: 1.45; -webkit-font-smoothing: antialiased;
}
#app { max-width: 560px; margin: 0 auto; padding: 20px 16px 56px; width: 100%; }
button { min-height: 44px; font-family: "Archivo", system-ui, sans-serif; }
button:active { transform: scale(0.985); }
h1, h2, h3 { font-family: var(--font-display); letter-spacing: -0.01em; }
p, li { font-size: 15px; line-height: 1.5; }
.small { font-size: 13px; color: var(--dim); }
.center { text-align: center; }
.hidden { display: none !important; }
strong { font-weight: 800; }
.flame { color: var(--gold); flex: 0 0 auto; }

/* ---------- top-right icon buttons ---------- */
.topbar { display: flex; justify-content: flex-end; gap: 6px; margin-bottom: 4px; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 999px; border: none;
  background: transparent; color: var(--dim); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; padding: 0;
}
.icon-btn:hover { color: var(--text); }
.icon-btn:active { transform: scale(0.95); }

/* ---------- landing ---------- */
.landing-inner {
  min-height: 72vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
  padding: 40px 8px;
}
.logo-wrap { width: 100%; max-width: 300px; }
.logo-wrap img { display: block; width: 100%; height: auto; }
.display {
  font-family: var(--font-display); text-transform: uppercase;
  font-size: clamp(46px, 13vw, 64px); line-height: 0.98;
  letter-spacing: -0.01em; margin-top: 32px; margin-bottom: 12px;
}
.display .dot { color: var(--accent); }
.tagline { max-width: 38ch; font-size: 17px; color: var(--dim); }
.tagline strong { color: var(--text); font-weight: 800; }
.challenge-pill {
  background: var(--gold); color: var(--gold-ink); border-radius: 999px;
  padding: 8px 16px; font-size: 14.5px; font-weight: 800; margin-top: 24px;
}
.btn-play {
  margin-top: 32px; min-height: 62px; width: 100%; max-width: 320px;
  border-radius: 999px; border: none; background: var(--accent); color: #fff;
  padding: 16px 32px; font-size: 20px; font-weight: 900; cursor: pointer;
  box-shadow: 0 8px 20px var(--accent-shadow);
}
.btn-play:active { transform: scale(0.985); }
.date-line { margin-top: 24px; font-size: 14px; font-weight: 600; color: var(--dim); }
.played-note { margin-top: 6px; font-size: 14px; font-weight: 600; color: var(--dim); }

/* ---------- home ---------- */
.date-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 6px; }
.date-pill {
  display: inline-flex; align-items: center; gap: 7px; border-radius: 999px;
  border: 1.5px solid var(--border); background: var(--surface);
  padding: 7px 13px; font-size: 13px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.pill-dot { width: 8px; height: 8px; border-radius: 999px; background: var(--green); flex: 0 0 auto; }
.date-note { font-size: 13px; font-weight: 700; color: var(--dim); }
.home-h { font-size: clamp(38px, 10vw, 52px); margin-top: 16px; margin-bottom: 10px; }
.intro { max-width: 44ch; font-size: 17px; color: var(--dim); margin-bottom: 22px; }
.intro strong { color: var(--text); }

.challenge-card {
  background: var(--gold); border-radius: var(--radius);
  padding: 16px 18px; margin-bottom: 16px;
}
.cc-title { font-family: var(--font-display); font-size: 18px; text-transform: uppercase; color: var(--gold-ink); }
.cc-line { font-size: 15px; font-weight: 700; color: var(--gold-ink); margin: 4px 0 12px; }
.btn-black {
  min-height: 48px; width: 100%; border-radius: 13px; border: none;
  background: var(--text); color: var(--bg); padding: 10px 18px;
  font-size: 15px; font-weight: 900; cursor: pointer;
}
.btn-black.small { width: auto; min-height: 44px; border-radius: 11px; padding: 8px 16px; font-size: 14px; }

.card {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: 24px; box-shadow: var(--shadow); padding: 22px;
}
.duel-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.duel-head h2 { font-size: 22px; font-weight: 900; }
.streak { display: inline-flex; align-items: center; gap: 4px; }
.streak b { font-size: 15px; font-weight: 800; }
.streak span { font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--dim); }
.duel-sub { font-size: 15px; color: var(--dim); margin: 4px 0 16px; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.pill {
  background: var(--surface-alt); border-radius: 999px;
  padding: 7px 12px; font-size: 13px; font-weight: 800;
}
.tiles { display: flex; gap: 8px; margin-bottom: 20px; }
.tile {
  flex: 1; background: var(--bg); border-radius: 14px;
  padding: 10px 6px; text-align: center; min-width: 0;
}
.tile .num { font-size: 19px; font-weight: 900; }
.tile .lbl { font-size: 11.5px; font-weight: 700; text-transform: uppercase; color: var(--dim); }
#duelActions { display: flex; flex-direction: column; gap: 12px; }
.btn-red {
  min-height: 60px; width: 100%; border-radius: 16px; border: none;
  background: var(--accent); color: #fff; padding: 14px 20px;
  font-size: 18px; font-weight: 900; cursor: pointer;
  box-shadow: 0 8px 20px var(--accent-shadow);
}
.btn-bordered {
  min-height: 60px; width: 100%; border-radius: 16px;
  background: var(--surface); color: var(--text);
  border: 2px solid var(--border); padding: 14px 20px;
  font-size: 18px; font-weight: 900; cursor: pointer;
}
.score-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 8px; }
.score-row .sr-lbl { font-size: 13px; font-weight: 700; text-transform: uppercase; color: var(--dim); }
.score-row .sr-score { font-size: 44px; font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; }
.score-row .sr-score small { font-size: 18px; font-weight: 800; color: var(--dim); }
.score-row .sr-right { font-size: 14px; font-weight: 600; color: var(--dim); text-align: right; }
.done-line { margin-top: 16px; font-size: 14px; font-weight: 600; color: var(--dim); }
.done-line strong { color: var(--text); }
#duelActions .btn-bordered { margin-top: 16px; }
#duelActions .result-bars { margin-top: 16px; }

.stats-row { display: flex; gap: 10px; margin-top: 16px; }
.stat-card {
  flex: 1; background: var(--surface); border: 1.5px solid var(--border);
  border-radius: 16px; padding: 14px 8px; text-align: center; min-width: 0;
}
.stat-card .val { font-size: 24px; font-weight: 900; display: flex; align-items: center; justify-content: center; gap: 4px; }
.stat-card .lbl { font-size: 11.5px; font-weight: 700; text-transform: uppercase; color: var(--dim); }

.block { margin-top: 30px; }
.block h3 { font-size: 19px; font-weight: 900; margin-bottom: 4px; }
.explainer { font-size: 14.5px; color: var(--dim); margin-bottom: 12px; }
.list { display: grid; gap: 10px; }
.list-row {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: 14px; padding: 13px 15px; min-width: 0;
}
.lr-main { flex: 1 1 auto; min-width: 0; }
.lr-title { font-size: 15px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lr-sub { font-size: 13.5px; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lr-score { flex: 0 0 auto; font-size: 15px; font-weight: 900; font-variant-numeric: tabular-nums; white-space: nowrap; }
.lr-sq { flex: 0 0 auto; letter-spacing: 1px; font-size: 13px; white-space: nowrap; }
.mini-bars { display: flex; gap: 3px; flex: 0 0 auto; width: 76px; }
.mini-bars span { flex: 1; height: 16px; border-radius: 3px; background: var(--surface-alt); }
.mini-bars span.hit { background: var(--ok); }
.mini-bars span.miss { background: var(--surface-alt); }

.howto-grid { display: grid; gap: 10px; }
.how-card {
  display: flex; gap: 14px; background: var(--surface);
  border: 1.5px solid var(--border); border-radius: 16px; padding: 15px 16px;
}
.how-num {
  width: 34px; height: 34px; flex: 0 0 auto; border-radius: 10px;
  background: var(--text); color: var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 900;
}
.how-title { font-size: 15.5px; font-weight: 800; }
.how-body { font-size: 14.5px; color: var(--dim); }
.note-box {
  background: var(--surface-alt); border-radius: 16px;
  padding: 14px 16px; font-size: 14.5px; color: var(--dim); margin-top: 12px;
}
.dim-line { font-size: 14px; color: var(--dim); margin-top: 10px; }

.code-row { display: flex; gap: 10px; }
.code-row input {
  min-height: 56px; flex: 1; min-width: 0; border-radius: 14px;
  border: 2px solid var(--border); background: var(--surface);
  padding: 12px 14px; font-size: 16px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--text);
}
.code-row input::placeholder { color: var(--dim); text-transform: none; letter-spacing: normal; font-weight: 600; }
.code-row .btn-black { width: auto; min-height: 48px; border-radius: 13px; padding: 10px 22px; }
.code-error { font-size: 14px; font-weight: 700; color: var(--red); margin-top: 8px; }

.foot { margin-top: 26px; text-align: center; font-size: 14px; font-weight: 600; color: var(--dim); }

/* ---------- game ---------- */
.game-top {
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px; margin-top: 4px; font-size: 15px; font-weight: 800;
}
.gt-item { display: flex; align-items: center; gap: 5px; min-width: 0; }
.gt-lbl { font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--dim); }
.gt-val { font-variant-numeric: tabular-nums; }
.quit {
  background: none; border: none; color: var(--dim);
  font-size: 14px; font-weight: 700; text-decoration: underline;
  text-underline-offset: 3px; cursor: pointer; min-height: 0; padding: 4px 2px;
}
.progress { display: flex; gap: 6px; margin: 14px 0 18px; }
.progress .seg { flex: 1; height: 8px; border-radius: 999px; background: var(--surface-alt); }
.progress .seg.done-correct { background: var(--ok); }
.progress .seg.done-wrong { background: var(--bad); }
.progress .seg.current { background: var(--text); }

.timer-row { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.timer-num {
  min-width: 64px; text-align: center; font-size: 44px; font-weight: 900;
  line-height: 1; font-variant-numeric: tabular-nums;
}
.timer-num.low { color: var(--red); }
.timer-bar {
  flex: 1; height: 16px; overflow: hidden; border-radius: 999px;
  background: var(--surface-alt);
}
.timer-fill { height: 100%; border-radius: 999px; width: 100%; transition: width 50ms linear; background: var(--green); }
.timer-fill.mid { background: var(--gold); }
.timer-fill.low { background: var(--red); }

.q-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.q-pill {
  border-radius: 999px; background: var(--text); color: var(--bg);
  padding: 6px 13px; font-size: 13px; font-weight: 800; text-transform: uppercase;
}
.q-pill.mode {
  background: var(--surface); color: var(--dim);
  border: 1.5px solid var(--border); padding: 5px 12px;
}
.q-pill.hard { background: var(--accent); color: #fff; }
.q-pill.target { background: var(--gold); color: var(--gold-ink); }
.q-text {
  font-size: clamp(23px, 6vw, 29px); font-weight: 800;
  line-height: 1.25; letter-spacing: -0.01em;
  margin-bottom: 22px; min-height: 2.5em;
}
.options { display: grid; gap: 12px; }
.opt {
  display: flex; align-items: center; gap: 14px; min-height: 64px; width: 100%;
  text-align: left; background: var(--surface); border: 2px solid var(--border);
  border-radius: 16px; padding: 14px 16px; font-size: 17.5px; font-weight: 700;
  line-height: 1.3; color: var(--text); cursor: pointer;
}
.opt:hover:not(:disabled) { border-color: var(--accent); }
.opt:disabled { cursor: default; }
.opt .letter {
  width: 36px; height: 36px; flex: 0 0 auto; border-radius: 10px;
  background: var(--surface-alt); display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 900;
}
.opt.correct { border-color: var(--ok); background: var(--green-bg); }
.opt.correct .letter { background: var(--ok); color: #fff; }
.opt.wrong { border-color: var(--bad); background: var(--red-bg); }
.opt.wrong .letter { background: var(--bad); color: #fff; }
.opt.dim { opacity: 0.45; }
.feedback { margin-top: 16px; min-height: 30px; text-align: center; font-size: 16.5px; font-weight: 800; }
.feedback .pts-pill {
  background: var(--gold); color: var(--gold-ink); border-radius: 999px;
  padding: 3px 10px; font-size: 14px; font-weight: 800; margin-left: 6px;
}
.feedback.bad { color: var(--bad); }

/* ---------- results ---------- */
.verdict {
  font-family: var(--font-display); text-transform: uppercase;
  font-size: clamp(30px, 8vw, 40px); line-height: 1;
  text-align: center; margin-top: 10px; margin-bottom: 4px;
}
.score-line { text-align: center; line-height: 1; }
.score-big { font-size: 76px; font-weight: 900; line-height: 1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.score-star { font-size: 40px; font-weight: 900; color: var(--gold); }
.score-max { font-size: 22px; font-weight: 800; color: var(--dim); }
.result-meta { text-align: center; font-size: 16px; color: var(--dim); margin-top: 6px; margin-bottom: 18px; }
.result-meta strong { color: var(--text); }
.result-bars { display: flex; gap: 7px; margin-bottom: 20px; }
.result-bars span { flex: 1; height: 38px; border-radius: 10px; background: var(--surface-alt); }
.result-bars span.hit { background: var(--ok); }
.result-bars span.miss { background: var(--bad); }

.share-card {
  background: var(--card); color: var(--card-ink); border-radius: 22px;
  box-shadow: var(--shadow); padding: 22px; margin-bottom: 16px;
}
.sc-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.sc-brand { font-family: var(--font-display); font-size: 19px; text-transform: uppercase; letter-spacing: 0.02em; }
.sc-brand .dot { color: var(--accent); }
.sc-date { font-size: 13px; font-weight: 700; text-transform: uppercase; color: var(--card-muted); }
.sc-bars { display: flex; gap: 6px; margin: 16px 0; }
.sc-bars span { flex: 1; height: 30px; border-radius: 8px; background: var(--card-sq); }
.sc-bars span.hit { background: var(--ok); }
.sc-bars span.miss { background: var(--accent); }
.sc-score { font-size: 46px; font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; }
.sc-score .sc-pts { font-size: 17px; font-weight: 800; color: var(--card-muted); margin-left: 4px; }
.sc-line { font-size: 14.5px; font-weight: 600; color: var(--card-muted); margin-top: 6px; }
.sc-code {
  margin-top: 14px; border: 1.5px dashed var(--card-line); border-radius: 12px;
  padding: 11px 14px; display: flex; justify-content: space-between; gap: 12px; align-items: center;
}
.sc-code-lbl { font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--card-muted); }
.sc-code-val { font-size: 16px; font-weight: 900; letter-spacing: 0.1em; }
.sc-code-note { font-size: 12px; font-weight: 600; color: var(--card-muted); text-align: right; max-width: 45%; }

.actions { display: flex; flex-direction: column; gap: 12px; }
.actions .btn-red, .actions .btn-bordered { font-size: 18px; }
.support { text-align: center; font-size: 14px; font-weight: 600; color: var(--dim); margin-top: 20px; }
.support a { color: var(--text); font-weight: 800; text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 3px; }

.bd-row { display: flex; gap: 12px; align-items: flex-start; }
.bd-mark {
  width: 30px; height: 30px; flex: 0 0 auto; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 900; color: #fff;
}
.bd-mark.hit { background: var(--ok); }
.bd-mark.miss { background: var(--bad); }
.bd-q { font-size: 15px; font-weight: 700; line-height: 1.35; }
.bd-sub { font-size: 13.5px; color: var(--dim); }
.bd-pts { flex: 0 0 auto; text-align: right; font-size: 15px; font-weight: 900; font-variant-numeric: tabular-nums; }
.bd-pts small { display: block; font-size: 11.5px; font-weight: 700; color: var(--dim); }

/* ---------- modals ---------- */
.modal-back {
  position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, 0.45);
  display: flex; align-items: flex-end; justify-content: center; padding: 12px;
}
@media (min-width: 640px) { .modal-back { align-items: center; } }
.modal {
  background: var(--surface); color: var(--text); border-radius: 22px;
  box-shadow: var(--shadow); width: 100%; max-width: 480px;
  max-height: 88vh; overflow-y: auto; padding: 22px;
}
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-head h2 { font-size: 21px; font-weight: 900; }
.modal-close {
  width: 40px; height: 40px; min-height: 40px; border-radius: 999px; border: none;
  background: var(--surface-alt); color: var(--text); font-size: 18px; font-weight: 900;
  cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0;
}
.set-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; }
.set-label { font-size: 15.5px; font-weight: 800; }
.set-desc { font-size: 14px; color: var(--dim); }
.toggle {
  width: 52px; height: 30px; min-height: 30px; border-radius: 999px; border: 2px solid var(--border);
  background: var(--surface); cursor: pointer; position: relative; padding: 0; flex: 0 0 auto;
}
.toggle .knob {
  position: absolute; top: 1px; left: 3px; width: 24px; height: 24px;
  border-radius: 999px; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  transition: left 150ms ease;
}
.toggle.on { background: var(--green); border-color: var(--green); }
.toggle.on .knob { left: 25px; }
.seg { display: flex; gap: 8px; margin: 10px 0 4px; }
.seg button {
  flex: 1; min-height: 48px; border-radius: 13px; padding: 10px 12px;
  font-size: 15px; font-weight: 900; cursor: pointer;
  background: var(--surface); color: var(--text); border: 2px solid var(--border);
}
.seg button.sel { background: var(--text); color: var(--bg); border-color: var(--text); }
.stats-note { font-size: 13px; font-weight: 600; color: var(--dim); margin-top: 10px; }
.sub-h { font-size: 16px; font-weight: 900; margin-top: 24px; margin-bottom: 10px; }
.stat-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stat-tiles.bottom { display: flex; gap: 8px; margin-top: 24px; }
.stat-tile { background: var(--bg); border-radius: 14px; padding: 12px 4px; text-align: center; min-width: 0; }
.stat-tiles.bottom .stat-tile { flex: 1; }
.stat-tile .val { font-size: 24px; font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; }
.stat-tiles.bottom .stat-tile .val { font-size: 20px; }
.stat-tile .lbl { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--dim); margin-top: 4px; }
.dist { display: flex; flex-direction: column; gap: 7px; }
.dist-row { display: flex; align-items: center; gap: 8px; }
.dist-row .d-num { width: 56px; flex: 0 0 auto; font-size: 13px; font-weight: 800; color: var(--dim); }
.dist-row .d-track { flex: 1; }
.dist-row .d-bar {
  height: 22px; border-radius: 6px; background: var(--ok);
  display: flex; align-items: center; justify-content: flex-end;
  padding-right: 8px; color: #fff; font-size: 13px; font-weight: 900;
  min-width: 9%;
}
.dist-row .d-bar.today { background: var(--accent); }
.dist-empty { font-size: 14.5px; color: var(--dim); }

.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%);
  z-index: 50; background: var(--text); color: var(--bg); border-radius: 999px;
  padding: 13px 22px; font-size: 15px; font-weight: 800; max-width: 92vw;
  text-align: center; box-shadow: var(--shadow);
}

@media (max-width: 400px) {
  .modal { padding: 18px; }
}
