* { box-sizing: border-box; }
:root { --bg: #2a1545; --bg2: #3b1f5e; --ink: #1d1530; --muted: #6b6480; --accent: #ffcf4a; --pink: #ff6b8b; --good: #2fb36d; --soft: #d9cdf0; }
html, body { margin: 0; background: linear-gradient(160deg, var(--bg2), var(--bg)) fixed; color: #fff; font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
main { max-width: 640px; margin: 0 auto; padding: 10px 12px calc(20px + env(safe-area-inset-bottom)); min-height: 100vh; }
button { font: inherit; border: 0; border-radius: 12px; padding: 10px 14px; background: #ece6f7; color: var(--ink); cursor: pointer; }
button.primary { background: var(--accent); font-weight: 700; width: 100%; padding: 14px; margin-top: 12px; }
button.primary.inline { width: auto; margin: 0; padding: 10px 16px; }
button.ghost { background: rgba(255,255,255,.12); color: #fff; display: block; margin: 8px auto 0; }
button:disabled { opacity: .5; cursor: default; }
button.link { background: none; color: var(--soft); padding: 4px 6px; text-decoration: underline; }
input, select, textarea { font: inherit; padding: 11px; border-radius: 12px; border: 1px solid #ccc; width: 100%; margin-top: 4px; background: #fff; color: var(--ink); }
textarea { resize: vertical; }
label { display: block; margin: 12px 0 4px; }
label.check { display: flex; gap: 10px; align-items: center; }
label.check input { width: 22px; height: 22px; margin: 0; flex: none; }
h1 { margin: 8px 0 4px; font-size: 34px; }
h2 { font-size: 18px; margin: 18px 0 6px; }
.sub, .hint { color: var(--soft); font-size: 14px; }
.small { font-size: 12px; opacity: .7; }
.center { text-align: center; }
.row { display: flex; gap: 8px; align-items: center; }
.row input { flex: 1; margin: 0; }
.or { text-align: center; margin: 18px 0 8px; color: var(--soft); }
.start { text-align: left; padding-top: 18px; }
.logo { width: 72px; height: 72px; border-radius: 20px; background: var(--accent); color: var(--bg2); font-size: 52px; font-weight: 900; display: flex; align-items: center; justify-content: center; transform: rotate(-8deg); box-shadow: 6px 6px 0 var(--pink); }
.rules { margin-top: 24px; background: rgba(0,0,0,.2); padding: 10px 12px; border-radius: 12px; }
.rules summary, .mini summary { cursor: pointer; font-weight: 600; }
.guide h3 { font-size: 16px; margin: 14px 0 4px; color: var(--accent); }
.guide p { margin: 4px 0; }
.guide ul { padding-left: 18px; margin: 4px 0; }

.top { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 4px 0 8px; }
.codebox { background: rgba(0,0,0,.25); padding: 12px; border-radius: 12px; display: flex; align-items: center; gap: 10px; }
.codebox b { font-size: 28px; letter-spacing: 4px; flex: 1; color: var(--accent); }
.plist { list-style: none; padding: 0; margin: 0 0 8px; }
.plist li { padding: 8px 4px; border-bottom: 1px solid rgba(255,255,255,.12); display: flex; align-items: center; gap: 6px; }
.plist .rm { margin-left: auto; }
.tag { font-size: 11px; background: rgba(255,255,255,.18); padding: 1px 6px; border-radius: 6px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #888; margin-right: 6px; flex: none; }
.dot.on { background: #4ade80; }

.qcard { background: #fff; color: var(--ink); border-radius: 16px; padding: 16px; margin: 4px 0 14px; box-shadow: 0 6px 0 var(--pink); }
.qcard small { color: var(--muted); text-transform: uppercase; font-size: 11px; letter-spacing: .5px; }
.qcard .q { font-size: 21px; font-weight: 700; margin-top: 4px; }
.lbl { font-size: 14px; color: var(--soft); }
.box { background: rgba(0,0,0,.22); border-radius: 12px; padding: 10px 12px; }
.box small { color: var(--soft); }
.box p { margin: 4px 0; }
.status { text-align: center; font-weight: 600; margin: 12px 0; }
.status.good { color: #7cf0aa; }

.opts { display: flex; flex-direction: column; gap: 8px; }
.opt { display: flex; gap: 10px; align-items: flex-start; text-align: left; background: #fff; color: var(--ink); border-radius: 14px; padding: 12px; width: 100%; }
.opt .let { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--bg2); color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.opt em { display: block; font-size: 12px; color: var(--muted); font-style: normal; margin-top: 3px; }
.opt.mine { opacity: .6; }
.opt.chosen { box-shadow: 0 0 0 3px var(--accent); background: #fff8dc; }
.opt.chosen .let { background: var(--accent); color: var(--ink); }
.opt.res.truth { box-shadow: 0 0 0 3px var(--good); background: #e9fbf0; }
.opt.res.truth .let { background: var(--good); }
.opt.res.truth em { color: #15803d; font-weight: 700; }
.opt small { display: block; font-size: 12px; margin-top: 3px; }
.opt .orig { color: var(--muted); font-style: italic; }
.opt .voters { color: #7a3fb0; font-weight: 600; }

table.score { width: 100%; border-collapse: collapse; margin-top: 14px; background: rgba(0,0,0,.22); border-radius: 12px; overflow: hidden; }
.score td { padding: 7px 10px; border-bottom: 1px solid rgba(255,255,255,.08); }
.score tr.me td { font-weight: 700; color: var(--accent); }
.score .pts { text-align: right; font-weight: 700; width: 50px; }
.score .gain { text-align: right; color: #7cf0aa; width: 50px; }
.mini { margin-top: 18px; background: rgba(0,0,0,.18); border-radius: 12px; padding: 8px 12px; }
.mini table.score { margin-top: 8px; background: none; }

.spinner { width: 46px; height: 46px; margin: 26px auto 0; border-radius: 50%; border: 5px solid rgba(255,255,255,.2); border-top-color: var(--accent); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.end { text-align: center; }
.trophy { font-size: 64px; margin-top: 12px; }
.hist { text-align: left; padding-left: 20px; }
.hist li { margin: 8px 0; }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #111; color: #fff; padding: 10px 14px; border-radius: 10px; max-width: 90vw; z-index: 30; box-shadow: 0 4px 14px rgba(0,0,0,.4); }
