:root {
  --bg: #1d1124;
  --bg2: #2a1834;
  --card: #34203f;
  --line: #4a3157;
  --text: #f6eef8;
  --muted: #bca8c6;
  --accent: #ff6f61;
  --accent2: #ffb38a;
  --ok: #6fd6a2;
  --bad: #ff8a8a;
  --radius: 18px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(120% 60% at 50% 0%, #3a1f47 0%, var(--bg) 60%);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
main { max-width: 560px; margin: 0 auto; padding: calc(16px + env(safe-area-inset-top)) 16px calc(96px + env(safe-area-inset-bottom)); }

h1 { font-size: 28px; margin: 8px 0 4px; letter-spacing: -0.02em; }
h2 { font-size: 20px; margin: 20px 0 10px; }
p.muted, .muted { color: var(--muted); }
.logo { font-size: 40px; font-weight: 800; letter-spacing: -0.03em;
  background: linear-gradient(90deg, var(--accent), var(--accent2)); -webkit-background-clip: text; background-clip: text; color: transparent; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 12px 0; }
.stack > * + * { margin-top: 10px; }

button, .btn {
  appearance: none; border: 0; border-radius: 14px; padding: 14px 18px; width: 100%;
  font: inherit; font-weight: 650; color: #2a0f12; background: linear-gradient(90deg, var(--accent), var(--accent2));
  cursor: pointer; min-height: 48px;
}
button.secondary { background: var(--bg2); color: var(--text); border: 1px solid var(--line); }
button.danger { background: transparent; color: var(--bad); border: 1px solid #6b3340; }
button:disabled { opacity: .5; }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid var(--accent2); outline-offset: 2px; }

input, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--bg2); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 14px;
}
textarea { min-height: 120px; resize: vertical; }
label { display: block; font-weight: 600; margin-bottom: 6px; }
.row { display: flex; gap: 10px; align-items: center; }
.row > * { flex: 1; }

.code { font: 700 34px/1 ui-monospace, Consolas, monospace; letter-spacing: .25em; text-align: center; padding: 18px; background: var(--bg2); border-radius: 14px; }

/* tabs */
nav.tabs { position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; gap: 4px;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); background: rgba(29,17,36,.92); backdrop-filter: blur(10px); border-top: 1px solid var(--line); }
nav.tabs button { width: auto; flex: 1; max-width: 180px; background: transparent; color: var(--muted); font-weight: 600; min-height: 44px; }
nav.tabs button[aria-current="page"] { color: var(--text); background: var(--card); }

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.chip { width: auto; flex: none; padding: 8px 14px; min-height: 36px; border-radius: 999px; background: var(--bg2); color: var(--muted); border: 1px solid var(--line); }
.chip[aria-pressed="true"] { background: var(--text); color: var(--bg); }

.pack { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; background: var(--card); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin: 10px 0; }
.pack .meta { flex: 1; }
.pack .title { font-weight: 700; }
.pack .status { font-size: 14px; color: var(--muted); }
.pack .status.go { color: var(--accent2); }
.bar { height: 6px; background: var(--bg2); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); }
.badge { font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 99px; background: var(--bg2); color: var(--muted); }

/* question */
.qhead { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 14px; }
.question { font-size: 22px; font-weight: 700; line-height: 1.3; padding: 26px 20px; margin: 14px 0 18px;
  background: linear-gradient(160deg, #47295a, #34203f); border: 1px solid var(--line); border-radius: 24px; }
.question small { display: block; font-size: 14px; font-weight: 600; color: var(--accent2); margin-bottom: 8px; }
.answers button { background: var(--bg2); color: var(--text); border: 1px solid var(--line); text-align: left; font-weight: 600; margin-bottom: 10px; }
.answers button.picked { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset; }

.result { padding: 14px 16px; }
.result .q { font-weight: 700; margin-bottom: 8px; }
.result .line { font-size: 14px; display: flex; gap: 6px; }
.result .ok { color: var(--ok); } .result .no { color: var(--bad); }
.score { display: flex; justify-content: space-around; text-align: center; }
.score b { display: block; font-size: 36px; }

.coupon { border: 2px dashed var(--accent2); }
.coupon .prize { font-size: 20px; font-weight: 800; margin: 6px 0; }

.back { width: auto; background: transparent; color: var(--muted); padding: 8px 0; min-height: 40px; }
#toast { position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%); max-width: 90%;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-weight: 600; z-index: 10; }
.center { text-align: center; }
.spacer { height: 12px; }
