/* IELTS Battles on DOGE — design tokens from the build brief (prompt 1). Mobile-first. */
:root {
  --purple: #6559ff;
  --magenta: #b13bd6;
  --grad: linear-gradient(135deg, var(--purple), var(--magenta));
  --ink: #1a1a2e;
  --muted: #6b6b85;
  --bg: #eceaf6;
  --card: #ffffff;
  --card-2: #f6f5fc;
  --line: rgba(26, 26, 46, 0.09);
  --gold: #f2c94c;
  --gold-ink: #9a7408; /* gold text on light cards (legible); plain gold in dark mode */
  --ok: #22c55e;
  --ok-soft: rgba(34, 197, 94, 0.14);
  --bad: #ef4444;
  --bad-soft: rgba(239, 68, 68, 0.12);
  --accent-soft: rgba(101, 89, 255, 0.1);
  --shadow: 0 6px 24px rgba(26, 26, 46, 0.08), 0 1px 3px rgba(26, 26, 46, 0.06);
  --radius: 16px;
  --font: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
  --num: "Chakra Petch", ui-monospace, "SF Mono", monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #edebfa;
    --muted: #9c9ab8;
    --bg: #12121f;
    --card: #1e1e33;
    --card-2: #26263f;
    --line: rgba(255, 255, 255, 0.08);
    --gold-ink: #f2c94c;
    --accent-soft: rgba(101, 89, 255, 0.22);
    --shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  font-size: 16px;
}
a { color: var(--purple); }
@media (prefers-color-scheme: dark) { a { color: #a79fff; } }
h1, h2, h3 { line-height: 1.2; margin: 0 0 8px; }
h2 { font-size: 1.15rem; }
p { margin: 0 0 8px; }
button { font: inherit; color: inherit; }
.num { font-family: var(--num); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.doge { font-family: var(--num); font-weight: 700; color: var(--gold-ink); white-space: nowrap; }
.wrap { max-width: 720px; margin: 0 auto; padding: 0 16px; }
.wrap.wide { max-width: 1180px; }

/* ---------------------------------------------------------------- top strip + header */
.strip {
  display: flex; flex-wrap: wrap; gap: 4px 12px; justify-content: space-between; align-items: center;
  padding: 6px 16px; font-size: 0.78rem; background: var(--ink); color: var(--bg);
}
@media (prefers-color-scheme: dark) { .strip { background: #0a0a14; color: var(--muted); } }
.pill-status { display: inline-flex; align-items: center; gap: 6px; font-family: var(--num); }
.pill-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px rgba(34,197,94,.25); }
.pill-status.off::before { background: var(--bad); box-shadow: none; }

.header { background: var(--grad); color: #fff; box-shadow: 0 2px 12px rgba(101, 89, 255, 0.25); }
.header-in { max-width: 1180px; margin: 0 auto; padding: 10px 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.logo { display: flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; font-weight: 800; font-size: 1.1rem; margin-right: auto; }
.badge { font-size: 0.68rem; font-weight: 700; background: var(--gold); color: var(--ink); padding: 2px 7px; border-radius: 999px; letter-spacing: 0.02em; }
.nav { order: 3; width: 100%; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; margin: 0 -6px; }
.nav::-webkit-scrollbar { display: none; }
.nav a { color: rgba(255,255,255,.85); text-decoration: none; font-weight: 600; font-size: 0.9rem; padding: 6px 10px; border-radius: 10px; white-space: nowrap; }
.nav a.on, .nav a:hover { background: rgba(255,255,255,.18); color: #fff; }
@media (min-width: 860px) { .nav { order: 0; width: auto; margin: 0; } }
.wallet { display: flex; align-items: center; gap: 8px; }
.wallet .addr { background: rgba(255,255,255,.18); padding: 6px 10px; border-radius: 12px; font-family: var(--num); font-size: 0.85rem; display: flex; gap: 8px; align-items: center; }
.wallet .bal { color: var(--gold); font-weight: 700; }
.btn-ghost { background: #fff; color: var(--purple); border: 0; padding: 8px 14px; border-radius: 12px; font-weight: 700; cursor: pointer; }

/* ---------------------------------------------------------------- generic UI */
main.wrap { padding-top: 16px; padding-bottom: 24px; min-height: 60vh; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; }
.card.flat { box-shadow: none; border: 1px solid var(--line); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; cursor: pointer;
  border-radius: 14px; padding: 10px 16px; font-weight: 700; text-decoration: none; background: var(--card-2); color: var(--ink);
  transition: transform .08s ease, opacity .15s ease;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--grad); color: #fff; box-shadow: 0 6px 18px rgba(101, 89, 255, 0.3); }
.btn.gold { background: var(--gold); color: var(--ink); }
.btn.danger { background: var(--bad-soft); color: var(--bad); }
.btn.big { width: 100%; padding: 14px 18px; font-size: 1.05rem; }
.btn.sm { padding: 6px 12px; font-size: 0.88rem; border-radius: 10px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.err { color: var(--bad); font-size: 0.9rem; min-height: 0; margin: 8px 0 0; }
.err:empty { display: none; }
.note { background: var(--accent-soft); border-radius: 12px; padding: 10px 12px; font-size: 0.92rem; }
.note.warn { background: rgba(242, 201, 76, .22); }
.note.bad { background: var(--bad-soft); color: var(--bad); }
.chip-status { display: inline-block; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 2px 8px; border-radius: 999px; background: var(--card-2); color: var(--muted); }
.chip-status.open { background: var(--accent-soft); color: var(--purple); }
.chip-status.active { background: rgba(242,201,76,.25); color: var(--gold-ink); }
.chip-status.settled { background: var(--ok-soft); color: #15803d; }
.chip-status.refunded { background: var(--card-2); color: var(--muted); }
.chip-status.cancelled { background: var(--bad-soft); color: var(--bad); }
@media (prefers-color-scheme: dark) { .chip-status.settled { color: var(--ok); } }
.section-head { display: flex; align-items: center; justify-content: space-between; margin: 18px 0 10px; }
.section-head h2 { margin: 0; }
.live { font-size: .75rem; color: var(--ok); font-weight: 700; display: inline-flex; gap: 6px; align-items: center; }
.live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.center { text-align: center; }
.mono { font-family: var(--num); }
.link-btn { background: none; border: 0; color: var(--purple); font-weight: 600; cursor: pointer; padding: 0; }

/* skeletons + errors */
.skel, .skel-block { background: linear-gradient(90deg, var(--card) 0%, var(--card-2) 50%, var(--card) 100%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: var(--radius); }
.skel-block { height: 160px; margin-bottom: 14px; }
.skel { height: 56px; margin-bottom: 10px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.errbox { text-align: center; padding: 24px 16px; }
.errbox p { color: var(--muted); }

/* toast */
.toast { position: fixed; left: 50%; bottom: 20px; transform: translate(-50%, 120px); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: .9rem; transition: transform .25s ease; z-index: 50; max-width: calc(100% - 32px); }
.toast { visibility: hidden; }
.toast.show { transform: translate(-50%, 0); visibility: visible; }

/* banners */
#banners:empty { display: none; }
#banners { padding-top: 12px; }
.banner { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; justify-content: space-between; border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px; background: var(--card); box-shadow: var(--shadow); }
.banner.switch { border-left: 4px solid var(--bad); }
.banner.faucet { border-left: 4px solid var(--gold); }
.banner p { margin: 0; flex: 1 1 220px; font-size: .92rem; }

/* ---------------------------------------------------------------- lobby */
.hero { text-align: center; padding: 18px 4px 10px; }
.kicker { display: inline-block; font-size: .8rem; font-weight: 700; color: var(--purple); background: var(--accent-soft); padding: 4px 10px; border-radius: 999px; margin-bottom: 12px; }
.hero h1 { font-size: clamp(1.7rem, 7vw, 2.5rem); font-weight: 800; letter-spacing: -0.02em; }
.hero h1 em { font-style: normal; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero .sub { color: var(--muted); }
.pillars { list-style: none; padding: 0; margin: 16px 0 6px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pillars li { background: var(--card); border-radius: 14px; padding: 10px 6px; font-size: .8rem; font-weight: 600; display: flex; flex-direction: column; align-items: center; gap: 4px; box-shadow: var(--shadow); }
.pillars li span { font-size: 1.4rem; }
.chips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 12px 0; }
.chip { border: 2px solid var(--line); background: var(--card-2); border-radius: 14px; padding: 10px 4px; cursor: pointer; font-family: var(--num); font-weight: 700; font-size: 1.1rem; text-align: center; }
.chip small { display: block; font-family: var(--font); font-size: .7rem; color: var(--muted); font-weight: 600; }
.chip.on { border-color: var(--purple); background: var(--accent-soft); color: var(--purple); }
.create .winline { font-size: .9rem; color: var(--muted); margin-bottom: 12px; }
.list .row { display: flex; align-items: center; gap: 12px; background: var(--card); border-radius: 14px; padding: 12px 14px; margin-bottom: 8px; box-shadow: var(--shadow); }
.row .who { flex: 1; min-width: 0; }
.row .who .a { font-family: var(--num); font-weight: 600; }
.row .who .t { font-size: .8rem; color: var(--muted); }
.avatar { width: 36px; height: 36px; border-radius: 50%; flex: none; }
.empty { text-align: center; color: var(--muted); padding: 22px 12px; border: 2px dashed var(--line); border-radius: var(--radius); }

/* ---------------------------------------------------------------- duel */
.duelbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--card); box-shadow: var(--shadow); border-radius: 0 0 var(--radius) var(--radius); padding: 8px 14px; margin: -16px 0 12px;
}
.timer { font-family: var(--num); font-weight: 700; font-size: 2rem; line-height: 1; letter-spacing: .02em; }
.timer.low { color: var(--bad); animation: pulse 1s infinite; }
.qpos { font-weight: 600; font-size: .95rem; }
.qpos b { font-family: var(--num); }
.stakepill { background: var(--gold); color: var(--ink); font-family: var(--num); font-weight: 700; padding: 4px 10px; border-radius: 999px; font-size: .9rem; white-space: nowrap; }
.duel-grid { display: grid; gap: 12px; }
.duel-grid > * { min-width: 0; }
@media (min-width: 960px) {
  .duel-grid { grid-template-columns: 1.15fr 1fr; align-items: start; }
  .duel-grid .passage { position: sticky; top: 76px; }
  .duel-grid .passage .ptext { max-height: calc(100vh - 190px); }
}
.tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 10px; scrollbar-width: none; }
.tab { border: 0; background: var(--card-2); border-radius: 10px; padding: 7px 12px; font-weight: 600; font-size: .85rem; cursor: pointer; white-space: nowrap; color: var(--muted); }
.tab.on { background: var(--accent-soft); color: var(--purple); }
.ptext { max-height: 34vh; overflow-y: auto; padding-right: 6px; font-size: .95rem; line-height: 1.65; }
.ptext h3 { font-size: 1.05rem; }
.ptext p b { color: var(--purple); margin-right: 6px; font-family: var(--num); }
.qcard .instr { font-size: .8rem; color: var(--muted); margin-bottom: 8px; }
.qcard .qtext { font-size: 1.08rem; font-weight: 600; margin-bottom: 14px; }
.blank { display: inline-block; min-width: 64px; border-bottom: 2px solid var(--purple); }
.opts { display: grid; gap: 8px; }
.opts.tri { grid-template-columns: repeat(3, 1fr); }
.opt {
  display: flex; align-items: flex-start; gap: 12px; text-align: left; width: 100%; min-height: 52px; cursor: pointer;
  border: 2px solid var(--line); background: var(--card-2); border-radius: 14px; padding: 12px 14px; font-size: .97rem;
}
.opts.tri .opt { justify-content: center; text-align: center; font-weight: 700; font-size: .85rem; padding: 14px 6px; }
.opt .letter { font-family: var(--num); font-weight: 700; color: var(--purple); flex: none; width: 22px; height: 22px; display: grid; place-items: center; }
.opt .box { flex: none; width: 22px; height: 22px; border-radius: 6px; border: 2px solid var(--muted); display: grid; place-items: center; font-size: .8rem; color: #fff; }
.opt.on { border-color: var(--purple); background: var(--accent-soft); }
.opt.on .box { background: var(--purple); border-color: var(--purple); }
.qnav { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin: 4px 0 12px; }
.dots { display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; }
.dot { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--line); background: var(--card); font-family: var(--num); font-size: .75rem; font-weight: 700; cursor: pointer; color: var(--muted); padding: 0; }
.dot.done { background: var(--purple); border-color: var(--purple); color: #fff; }
.dot.cur { outline: 3px solid rgba(101, 89, 255, .35); outline-offset: 1px; }
.hint { text-align: center; font-size: .85rem; color: var(--muted); margin-top: 8px; }

/* waiting room */
.steps { list-style: none; padding: 0; margin: 0; }
.step { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.step:last-child { border-bottom: 0; }
.step .ico { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-family: var(--num); font-weight: 700; background: var(--card-2); color: var(--muted); }
.step.done .ico { background: var(--ok); color: #fff; }
.step.now .ico { background: var(--accent-soft); color: var(--purple); animation: pulse 1.4s infinite; }
.step .st { font-size: .85rem; color: var(--muted); }
.step.done .st { color: #15803d; }
@media (prefers-color-scheme: dark) { .step.done .st { color: var(--ok); } }
.reveal-box { border: 2px solid var(--gold); background: rgba(242, 201, 76, .14); border-radius: var(--radius); padding: 16px; margin: 12px 0; text-align: center; }
.reveal-box h3 { font-size: 1.1rem; }

/* result */
.result-hero { text-align: center; padding: 22px 16px; }
.result-hero .big { font-size: clamp(1.6rem, 7vw, 2.3rem); font-weight: 800; }
.result-hero.won .big { color: var(--ok); }
.result-hero.lost .big { color: var(--muted); }
.score { font-family: var(--num); font-size: 3rem; font-weight: 700; line-height: 1.1; margin: 8px 0; }
.vs { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; font-size: .85rem; }
.vs .side { background: var(--card-2); border-radius: 12px; padding: 8px; text-align: center; }
.vs .side.win { box-shadow: inset 0 0 0 2px var(--ok); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: .92rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; }
.txlist { list-style: none; padding: 0; margin: 0; font-size: .88rem; }
.txlist li { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.txlist li:last-child { border-bottom: 0; }

/* share card (1200x630 design, scaled to fit) */
.card-frame { position: relative; width: 100%; aspect-ratio: 1200 / 630; overflow: hidden; border-radius: 14px; box-shadow: var(--shadow); margin-bottom: 10px; }
.card-scale { position: absolute; top: 0; left: 0; transform-origin: 0 0; }
.share-card {
  width: 1200px; height: 630px; padding: 64px 72px; color: #fff; font-family: var(--font); position: relative; overflow: hidden;
  background: radial-gradient(circle at 85% 15%, rgba(242,201,76,.35), transparent 40%), linear-gradient(135deg, #6559ff, #b13bd6);
  display: flex; flex-direction: column; justify-content: space-between;
}
.share-card .sc-top { display: flex; align-items: center; gap: 16px; font-size: 34px; font-weight: 800; }
.share-card .sc-top .badge { font-size: 20px; padding: 4px 14px; }
.share-card .sc-score { font-family: var(--num); font-size: 150px; font-weight: 700; line-height: 1; }
.share-card .sc-line { font-size: 48px; font-weight: 800; }
.share-card .sc-line b { color: var(--gold); }
.share-card .sc-foot { display: flex; justify-content: space-between; font-size: 24px; opacity: .9; }
.share-card .sc-swords { position: absolute; right: 60px; bottom: 120px; font-size: 180px; opacity: .25; }

/* review */
.rq { margin-bottom: 12px; }
.rq .head { display: flex; gap: 8px; align-items: baseline; margin-bottom: 6px; }
.rq .n { font-family: var(--num); font-weight: 700; color: var(--purple); }
.rq .ok-mark { margin-left: auto; font-weight: 700; font-size: .85rem; }
.ropt { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: 10px; margin-bottom: 4px; font-size: .92rem; border: 1.5px solid transparent; }
.ropt.correct { background: var(--ok-soft); border-color: var(--ok); }
.ropt.wrong { background: var(--bad-soft); border-color: var(--bad); }
.ropt .letter { font-family: var(--num); font-weight: 700; flex: none; width: 18px; }
.ropt .tags { margin-left: auto; display: flex; gap: 4px; flex: none; }
.tag { font-size: .7rem; font-weight: 700; border-radius: 6px; padding: 1px 6px; background: var(--card); border: 1px solid var(--line); }
.picks { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .88rem; margin: 8px 0; }
.picks .good { color: #15803d; font-weight: 700; }
.picks .badc { color: var(--bad); font-weight: 700; }
@media (prefers-color-scheme: dark) { .picks .good { color: var(--ok); } }
.expl { font-size: .88rem; color: var(--muted); background: var(--card-2); border-radius: 10px; padding: 8px 10px; }

/* tables */
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 6px 8px; }
.table td { padding: 10px 8px; border-top: 1px solid var(--line); }
.table td.num, .table th { white-space: nowrap; }
.table tr.me td { background: var(--accent-soft); }
.table .r { text-align: right; }
.pos { color: #15803d; } .neg { color: var(--bad); }
@media (prefers-color-scheme: dark) { .pos { color: var(--ok); } }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
@media (min-width: 600px) { .stats.four { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; }
.stat .v { font-family: var(--num); font-size: 1.6rem; font-weight: 700; line-height: 1.2; }
.stat .l { font-size: .8rem; color: var(--muted); font-weight: 600; }

/* how it works */
.flow { counter-reset: s; list-style: none; padding: 0; display: grid; gap: 8px; }
.flow li { counter-increment: s; display: flex; gap: 12px; align-items: flex-start; background: var(--card); border-radius: 14px; padding: 12px 14px; box-shadow: var(--shadow); }
.flow li::before { content: counter(s); flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--grad); color: #fff; font-family: var(--num); font-weight: 700; display: grid; place-items: center; }
.trust { border-left: 4px solid var(--purple); }

.footer { padding: 24px 16px 40px; font-size: .78rem; color: var(--muted); text-align: center; }
