:root {
  --bg: #fff8ee; --card: #ffffff; --ink: #2b2a33; --soft: #6b6877; --line: #eadfce;
  --a: #3567e8; --b: #e8602a; --accent: #2b2a33; --radius: 18px;
  --font: 'Pretendard', 'Apple SD Gothic Neo', 'Noto Sans KR', 'Malgun Gothic', system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #1d1b24; --card: #2a2733; --ink: #f4f1ea; --soft: #b3aec2; --line: #3b3748; --accent: #f4f1ea; --a: #4f7df0; --b: #ef7440; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.6 var(--font); word-break: keep-all; overflow-wrap: anywhere; -webkit-tap-highlight-color: transparent; }
.wrap { max-width: 520px; margin: 0 auto; padding: 18px 16px calc(40px + env(safe-area-inset-bottom)); }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
.brandlink { display: inline-block; font-size: .85rem; font-weight: 700; color: var(--soft); text-decoration: none; margin-bottom: 6px; }
h1 { font-size: 2rem; line-height: 1.2; margin: 4px 0 6px; letter-spacing: -.02em; }
h2 { font-size: 1.15rem; margin: 22px 0 8px; }
.lead { color: var(--soft); margin: 0 0 18px; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.back { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 14px; font-weight: 700; font-size: .9rem; }
.tag { font-size: .85rem; font-weight: 800; color: var(--soft); background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; }
.chip { border: 1.5px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 14px; font-weight: 700; font-size: .92rem; }
.chip[aria-pressed="true"] { background: var(--accent); color: var(--bg); border-color: var(--accent); }

.menu { display: grid; gap: 12px; }
.menu-btn { display: block; width: 100%; text-align: left; border: 2px solid var(--line); background: var(--card); border-radius: var(--radius); padding: 16px 18px; }
.menu-btn strong { display: block; font-size: 1.2rem; }
.menu-btn span { color: var(--soft); font-size: .92rem; }
.menu-btn.main { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.menu-btn.main span { color: inherit; opacity: .8; }

.versus { text-align: center; font-weight: 900; color: var(--soft); margin: 6px 0; letter-spacing: .1em; }
.choice { position: relative; overflow: hidden; display: block; width: 100%; min-height: 104px; border: 0; border-radius: var(--radius); padding: 18px 20px; color: #fff; text-align: left; font-size: 1.25rem; line-height: 1.4; font-weight: 800; }
.choice.a { background: var(--a); }
.choice.b { background: var(--b); }
.choice:not(:disabled):active { transform: scale(.985); }
.choice:disabled { cursor: default; }
.choice .fill { position: absolute; inset: 0 auto 0 0; width: 0; background: rgba(255, 255, 255, .26); transition: width .6s ease; }
.choice .txt { position: relative; display: block; }
.choice .res { position: relative; display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-top: 10px; font-size: 1rem; font-weight: 700; }
.choice .res b { font-size: 1.8rem; font-weight: 900; }
.choice.dim { opacity: .55; }
.choice .me { position: relative; display: inline-block; font-size: .8rem; font-weight: 800; background: rgba(255, 255, 255, .3); border-radius: 999px; padding: 1px 10px; margin-bottom: 6px; }
.note { min-height: 3em; margin: 14px 2px 4px; color: var(--soft); text-align: center; }
.note strong { color: var(--ink); }
.actions { display: grid; gap: 10px; margin-top: 12px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
.btn { border: 2px solid var(--line); background: var(--card); border-radius: 14px; padding: 13px 16px; font-weight: 800; text-align: center; }
.btn.primary { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.btn:disabled { opacity: .45; cursor: default; }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 0 0 14px; }
.panel h3 { margin: 0 0 8px; font-size: 1.05rem; }
.stepper { display: flex; align-items: center; justify-content: center; gap: 18px; margin: 6px 0 10px; }
.stepper button { width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--line); background: var(--card); font-size: 1.4rem; font-weight: 800; }
.stepper output { font-size: 1.6rem; font-weight: 900; min-width: 2.5em; text-align: center; }
.names { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.names input { width: 100%; border: 1.5px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 10px; padding: 9px 10px; font: inherit; }
.seg { display: flex; gap: 8px; }
.seg button { flex: 1; border: 1.5px solid var(--line); background: var(--card); border-radius: 12px; padding: 9px 0; font-weight: 800; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--bg); border-color: var(--accent); }

.handoff { text-align: center; padding: 34px 10px; }
.handoff .who { font-size: 2rem; font-weight: 900; margin: 6px 0 10px; }
.sides { display: grid; gap: 10px; margin: 12px 0; }
.side { border-radius: var(--radius); padding: 14px 16px; color: #fff; }
.side.a { background: var(--a); }
.side.b { background: var(--b); }
.side small { display: block; opacity: .85; font-weight: 700; }
.side .ppl { font-size: 1.15rem; font-weight: 900; }
.verdict { text-align: center; font-size: 1.15rem; font-weight: 900; margin: 14px 0 6px; }
.rank { list-style: none; padding: 0; margin: 0; }
.rank li { display: flex; justify-content: space-between; padding: 9px 2px; border-bottom: 1px solid var(--line); font-weight: 700; }
.rank li:last-child { border-bottom: 0; }

details { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 16px; margin: 18px 0 0; }
summary { cursor: pointer; font-weight: 800; padding: 10px 0; }
details ol { margin: 0 0 12px; padding-left: 20px; color: var(--soft); }
.foot { margin-top: 26px; text-align: center; font-size: .85rem; color: var(--soft); }
.foot a { margin: 0 8px; }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); background: #2b2a33; color: #fff; padding: 10px 18px; border-radius: 999px; font-weight: 700; font-size: .92rem; opacity: 0; pointer-events: none; transition: .25s; max-width: 90vw; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.endhead { text-align: center; color: var(--soft); font-weight: 700; margin: 14px 0 4px; }
.endtitle { text-align: center; font-size: 1.7rem; line-height: 1.35; margin: 6px 0 8px; text-wrap: balance; }
.endsub { text-align: center; color: var(--soft); margin: 0 0 16px; font-size: 1.05rem; }
.endlines { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 8px; }
.endlines li { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 11px 14px; font-weight: 700; }

.tags { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.invite { text-align: center; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 0 0 14px; }
.bigcode { font-size: 2.6rem; font-weight: 900; letter-spacing: .25em; padding-left: .25em; margin: 4px 0 12px; font-variant-numeric: tabular-nums; }
.members { list-style: none; margin: 0; padding: 0; }
.members li { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.members li:last-child { border-bottom: 0; }
.mname { flex: 1; font-weight: 700; min-width: 0; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--line); flex: none; }
.dot.on { background: #2fb36d; }
.mark { font-size: .82rem; color: var(--soft); font-weight: 700; }
.mini { border: 1.5px solid var(--line); background: var(--bg); border-radius: 999px; padding: 3px 10px; font-size: .8rem; font-weight: 700; }
.timer { min-width: 5.5em; text-align: center; font-variant-numeric: tabular-nums; }
.chat .chatlist { list-style: none; margin: 0 0 10px; padding: 0; max-height: 180px; overflow-y: auto; display: grid; gap: 6px; }
.chatlist li { background: var(--bg); border-radius: 12px; padding: 6px 10px; font-size: .95rem; }
.chatlist li.mine { background: var(--line); }
.chatlist li.empty { color: var(--soft); background: none; padding: 0; }
.chatrow { display: flex; gap: 8px; }
.chatrow input { flex: 1; min-width: 0; border: 1.5px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 10px; padding: 9px 10px; font: inherit; }
.chatrow .btn { padding: 9px 14px; }
.panel input[type=text] { width: 100%; border: 1.5px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 10px; padding: 10px 12px; font: inherit; }
.room-banner { position: fixed; left: 0; right: 0; top: 0; background: #2b2a33; color: #fff; text-align: center; padding: 8px 12px; font-weight: 700; font-size: .9rem; z-index: 20; }

.roomlist { display: grid; gap: 8px; }
.roomrow { display: grid; gap: 2px; width: 100%; text-align: left; border: 1.5px solid var(--line); background: var(--bg); border-radius: 14px; padding: 10px 14px; }
.roomrow .rt { font-weight: 800; }
.roomrow .rm { color: var(--soft); font-size: .86rem; }
.check { display: flex; align-items: center; gap: 8px; margin: 10px 0 0; font-weight: 700; font-size: .92rem; }
.check input { width: 20px; height: 20px; flex: none; }
