/* 파티게임 공통 화면 — 밝고 경쾌한 톤, 큰 글씨, 한 손 조작. 다크 모드는 prefers-color-scheme 으로. */
:root {
  --bg: #fff6df; --bg2: #ffe9b8; --ink: #2a2150; --muted: #6a6190; --card: #ffffff; --line: #2a2150;
  --pink: #ff5c8a; --blue: #2eb8f0; --yellow: #ffcf33; --green: #2fd18f; --purple: #8a63ff; --orange: #ff8a3d;
  --on-color: #2a2150; --danger: #ff3b4e;
  --font: system-ui, -apple-system, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1a1533; --bg2: #261e4a; --ink: #fff3d6; --muted: #b9b0e0; --card: #2c2455; --line: #0d0a1e;
    --pink: #ff6f9a; --blue: #43c4f5; --yellow: #ffd54a; --green: #3be0a0; --purple: #9b7bff; --orange: #ff9a52;
    --on-color: #1a1533;
  }
}
:root[data-theme="dark"] {
  --bg: #1a1533; --bg2: #261e4a; --ink: #fff3d6; --muted: #b9b0e0; --card: #2c2455; --line: #0d0a1e;
  --pink: #ff6f9a; --blue: #43c4f5; --yellow: #ffd54a; --green: #3be0a0; --purple: #9b7bff; --orange: #ff9a52;
  --on-color: #1a1533;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh; font-family: var(--font); font-size: 18px; line-height: 1.5; color: var(--ink); background-color: var(--bg);
  background-image: radial-gradient(var(--bg2) 18%, transparent 20%), radial-gradient(var(--bg2) 18%, transparent 20%);
  background-size: 44px 44px; background-position: 0 0, 22px 22px;
  padding-bottom: env(safe-area-inset-bottom);
}
a { color: inherit; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .4em; }
h1 { font-size: 2rem; font-weight: 900; }
h2 { font-size: 1.35rem; font-weight: 900; }
p { margin: 0 0 .7em; }
.muted { color: var(--muted); font-size: .9rem; }

/* 위 띠: 주소는 가운데에 작게, 늘 보인다 */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: calc(6px + env(safe-area-inset-top)) 12px 6px; background: var(--bg); border-bottom: 2px dashed var(--bg2); min-height: 46px; }
.topbar .home-link { font-weight: 800; text-decoration: none; padding: 6px 10px; border-radius: 12px; background: var(--card); border: 2px solid var(--line); font-size: .9rem; white-space: nowrap; }
.topbar .addr { font-size: .74rem; color: var(--muted); letter-spacing: .02em; text-align: center; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .lang-switch { font-size: .82rem; font-weight: 700; white-space: nowrap; }
.topbar .lang-switch a { color: inherit; }
.sound-btn { font-size: 1.3rem; width: 44px; height: 44px; border-radius: 14px; border: 2px solid var(--line); background: var(--card); cursor: pointer; line-height: 1; }

main#app { max-width: 520px; margin: 0 auto; padding: 14px 16px 36px; }
.screen { display: flex; flex-direction: column; gap: 14px; animation: pop .22s ease-out; }
@keyframes pop { from { transform: translateY(8px); opacity: .0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .screen { animation: none; } }

.panel { background: var(--card); border: 3px solid var(--line); border-radius: 20px; padding: 16px; box-shadow: 0 5px 0 var(--line); }
.center { text-align: center; }
.big { font-size: 2.4rem; font-weight: 900; line-height: 1.15; word-break: keep-all; }
.huge { font-size: 3.4rem; font-weight: 900; line-height: 1.1; word-break: keep-all; }
.cho { font-size: 4rem; font-weight: 900; letter-spacing: .08em; color: var(--purple); }
.tag { display: inline-block; padding: 2px 12px; border-radius: 999px; border: 2px solid var(--line); background: var(--yellow); color: var(--on-color); font-weight: 800; font-size: .9rem; }

/* 단추: 두꺼운 테두리와 눌리는 그림자 */
.btn { appearance: none; display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 60px; padding: 12px 18px; font: inherit; font-size: 1.2rem; font-weight: 900; color: var(--on-color); background: var(--yellow); border: 3px solid var(--line); border-radius: 18px; box-shadow: 0 5px 0 var(--line); cursor: pointer; text-decoration: none; text-align: center; transition: transform .06s, box-shadow .06s; user-select: none; -webkit-user-select: none; }
.btn:active, .btn.held { transform: translateY(4px); box-shadow: 0 1px 0 var(--line); }
.btn.pink { background: var(--pink); } .btn.blue { background: var(--blue); } .btn.green { background: var(--green); } .btn.purple { background: var(--purple); } .btn.orange { background: var(--orange); }
.btn.ghost { background: var(--card); color: var(--ink); }
.btn.small { min-height: 44px; font-size: 1rem; padding: 8px 14px; width: auto; border-radius: 14px; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn:focus-visible, .chip:focus-visible, input:focus-visible, .step:focus-visible { outline: 4px solid var(--blue); outline-offset: 2px; }
.row { display: flex; gap: 10px; } .row > * { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 12px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { appearance: none; font: inherit; font-weight: 800; font-size: 1rem; min-height: 44px; padding: 6px 14px; border-radius: 999px; border: 3px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--pink); color: var(--on-color); box-shadow: 0 3px 0 var(--line); }
.chip.more { border-style: dashed; color: var(--muted, var(--ink)); }
.chip[hidden] { display: none; }

.stepper { display: flex; align-items: center; justify-content: center; gap: 18px; margin-bottom: 10px; }
.step { appearance: none; width: 56px; height: 56px; border-radius: 18px; font: inherit; font-size: 1.8rem; font-weight: 900; border: 3px solid var(--line); background: var(--blue); color: var(--on-color); box-shadow: 0 4px 0 var(--line); cursor: pointer; }
.step:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--line); }
.count { font-size: 2rem; min-width: 3.4em; text-align: center; }
.name-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.name-list li { display: flex; align-items: center; gap: 6px; }
.name-list .no { width: 26px; height: 26px; border-radius: 50%; background: var(--purple); color: var(--on-color); font-weight: 900; font-size: .85rem; display: grid; place-items: center; flex: none; border: 2px solid var(--line); }
input[type="text"], input[type="search"] { font: inherit; font-size: 1.05rem; width: 100%; min-width: 0; min-height: 46px; padding: 6px 12px; border-radius: 14px; border: 3px solid var(--line); background: var(--card); color: var(--ink); }

/* 이름 단추 모음 */
.name-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.name-grid .btn { font-size: 1.15rem; min-height: 56px; word-break: keep-all; }
.name-grid .btn[aria-pressed="true"] { background: var(--pink); }

/* 누르고 있는 동안만 보기 */
.hold { min-height: 200px; font-size: 1.6rem; touch-action: none; -webkit-touch-callout: none; }
.hold .secret { font-size: 2.4rem; }
.secret-box { min-height: 130px; display: grid; place-items: center; text-align: center; }
.liar-badge { color: var(--danger); }

/* 폭탄 */
.bomb-art { width: 150px; height: 150px; margin: 0 auto; display: block; }
.fuse { animation: fuse .5s steps(2) infinite; }
@keyframes fuse { 50% { transform: translateY(-2px); } }
.shake { animation: shake .6s linear 1; }
@keyframes shake { 0%, 100% { transform: none; } 10% { transform: translate(-12px, 6px) rotate(-1deg); } 20% { transform: translate(12px, -8px) rotate(1deg); } 30% { transform: translate(-10px, -6px); } 40% { transform: translate(10px, 8px); } 50% { transform: translate(-8px, 4px); } 60% { transform: translate(8px, -4px); } 80% { transform: translate(-4px, 2px); } }
.boom-wash { position: fixed; inset: 0; background: radial-gradient(circle, #ffe14d 0%, #ff7a2f 50%, transparent 75%); opacity: 0; pointer-events: none; z-index: 30; }
.boom-wash.on { animation: wash 1.2s ease-out 1; }
@keyframes wash { 0% { opacity: .0; } 12% { opacity: .85; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .shake, .fuse { animation: none; } .boom-wash.on { animation: none; opacity: .35; } }
.pass-btn { min-height: 160px; font-size: 1.7rem; }

/* 룰렛 */
.wheel-wrap { position: relative; width: min(86vw, 340px); aspect-ratio: 1; margin: 6px auto; }
.wheel { width: 100%; height: 100%; image-rendering: pixelated; border-radius: 50%; display: block; }
.pointer { position: absolute; left: 50%; top: -8px; transform: translateX(-50%); width: 0; height: 0; border-left: 14px solid transparent; border-right: 14px solid transparent; border-top: 28px solid var(--danger); filter: drop-shadow(0 2px 0 var(--line)); z-index: 2; }
.legend { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.legend li { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 12px; border: 2px solid var(--line); background: var(--card); font-weight: 700; font-size: .95rem; }
.legend li[data-hit="1"] { background: var(--yellow); color: var(--on-color); }
.legend .sw { width: 18px; height: 18px; border-radius: 5px; border: 2px solid var(--line); flex: none; }
.legend .del { margin-left: auto; appearance: none; border: 2px solid var(--line); background: var(--card); color: var(--ink); border-radius: 10px; width: 36px; height: 36px; font-size: 1.1rem; font-weight: 900; cursor: pointer; flex: none; }
.result-card { text-align: center; }

/* 첫 화면 */
.hero { text-align: center; padding-top: 6px; }
.hero .logo { width: 120px; height: 120px; }
.hero h1 { font-size: 2.6rem; margin-bottom: .1em; }
.cards { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.gcard { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; text-decoration: none; padding: 14px 8px 12px; border-radius: 22px; border: 3px solid var(--line); box-shadow: 0 5px 0 var(--line); color: var(--on-color); min-height: 170px; transition: transform .06s, box-shadow .06s; }
.gcard:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--line); }
.gcard img { width: 84px; height: 84px; }
.gcard b { font-size: 1.25rem; font-weight: 900; line-height: 1.2; }
.gcard small { font-size: .85rem; font-weight: 700; opacity: .85; line-height: 1.3; }
.c-liar { background: var(--purple); } .c-bomb { background: var(--orange); } .c-chosung { background: var(--green); } .c-roulette { background: var(--pink); } .c-tower { background: var(--blue); }
.notice { text-align: center; font-weight: 800; }
.linkrow { display: flex; flex-wrap: wrap; gap: 6px 14px; justify-content: center; font-size: .92rem; }
.doc { background: var(--card); border: 3px solid var(--line); border-radius: 20px; padding: 14px 16px; font-size: .95rem; }
.doc h2 { font-size: 1.15rem; } .doc h3 { font-size: 1rem; margin-top: .9em; } .doc ul { padding-left: 1.2em; margin: .3em 0; } .doc li { margin: .25em 0; }

.ad-slot { display: none; min-height: 90px; }
.ad-slot[data-on] { display: block; }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-weight: 800; font-size: .95rem; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 40; max-width: 92vw; text-align: center; }
.toast[data-on="1"] { opacity: 1; transform: translate(-50%, 0); }
.timer { font-size: 5rem; font-weight: 900; text-align: center; font-variant-numeric: tabular-nums; color: var(--pink); }
.qr { background: #fff; padding: 10px; border-radius: 14px; border: 3px solid var(--line); display: block; margin: 0 auto; width: min(66vw, 240px); height: auto; image-rendering: pixelated; }
.qr.dense { width: min(86vw, 300px); padding: 8px; }
.code { font-size: 2.6rem; font-weight: 900; letter-spacing: .18em; text-align: center; font-variant-numeric: tabular-nums; }
.num-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.num-grid .btn { min-height: 64px; font-size: 1.5rem; }

/* 제시어 모음(정적 페이지) */
.page { max-width: 720px; margin: 0 auto; padding: 14px 16px 40px; }
.page .words { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; }
.page .words li { padding: 4px 12px; border-radius: 999px; border: 2px solid var(--line); background: var(--card); font-weight: 700; font-size: .98rem; }
.page nav.crumbs { font-size: .9rem; margin-bottom: 8px; }
.page .btn { max-width: 360px; margin: 14px auto; }
.cards li { display: flex; } .gcard { flex: 1; } .gcard b { word-break: keep-all; }
.name-list { grid-template-columns: 1fr; }
.name-list li input { font-weight: 800; }
.name-list li input::placeholder { color: var(--muted); opacity: .9; font-weight: 700; }
.reroll { appearance: none; flex: none; width: 46px; height: 46px; border-radius: 14px; border: 3px solid var(--line); background: var(--yellow); font-size: 1.2rem; cursor: pointer; box-shadow: 0 3px 0 var(--line); }
.reroll:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--line); }
.name-grid .btn small { display: block; font-size: .8rem; font-weight: 700; opacity: .8; }
.name-grid .btn.two { flex-direction: column; gap: 0; line-height: 1.2; }
.center.muted { text-align: center; }

/* 초성 게임: 큰 초성·시간 막대·예시 낱말 */
.cho-big { font-size: clamp(4.5rem, 30vw, 7rem); line-height: 1.05; margin: 6px 0; }
.tbar { height: 22px; border: 3px solid var(--line); border-radius: 999px; background: var(--bg2); overflow: hidden; margin: 12px 0 4px; }
.tbar-fill { height: 100%; width: 100%; background: var(--green); border-radius: 999px; transition: width .1s linear; }
.tbar-fill[data-low="1"] { background: var(--danger); }
.tsec { font-size: 1.1rem; margin: 0 0 4px; font-variant-numeric: tabular-nums; } .tsec b { font-size: 1.8rem; }
.ex-words { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; list-style: none; padding: 0; margin: 8px 0; }
.ex-words li { padding: 4px 12px; border-radius: 999px; border: 2px solid var(--line); background: var(--bg2); font-weight: 800; font-size: 1.05rem; }
.howto { margin: 0; padding-left: 1.3em; font-size: .98rem; } .howto li { margin: .2em 0; }
.btn small { font-size: .8rem; font-weight: 700; opacity: .85; }
@media (prefers-reduced-motion: reduce) { .tbar-fill { transition: none; } }
.play-card .cho-big { font-size: clamp(4rem, 24vw, 6rem); margin: 0; }
html[lang="vi"] .cho-big { font-size: clamp(3rem, 17vw, 5rem); letter-spacing: 0; white-space: nowrap; }
.play-card p { margin: 0 0 .3em; }
.play-card .tbar { margin-top: 8px; }
[data-name="play"] .pass-btn { min-height: 130px; }

/* 마피아 게임: 밤 화면(누르는 동안 보기 안 글자)·직업 목록·밤 기록 */
.c-mafia { background: var(--yellow); }
.game-art { width: 96px; height: 96px; display: block; margin: 0 auto 6px; }
.secret-box { gap: 6px; }
.secret-box .tag { font-size: .95rem; }
.secret-box .sub { display: block; font-size: 1rem; font-weight: 700; line-height: 1.35; word-break: keep-all; }
.hold .secret-box .secret { font-size: 2rem; line-height: 1.2; word-break: keep-all; }
.night-card .huge, .morning-card .huge { margin: 4px 0; }
.quit { margin-top: 8px; display: flex; justify-content: center; }
.quit .panel { width: 100%; }
.role-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.role-list li { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 12px; border: 2px solid var(--line); background: var(--card); font-weight: 700; }
.role-list li b { margin-left: auto; }
.role-list li[data-role="mafia"] { background: var(--pink); color: var(--on-color); }
.role-list li[data-dead="1"] span { text-decoration: line-through; opacity: .75; }
.role-list li small { font-size: .78rem; opacity: .8; }
.night-log { margin: 8px 0 0; padding-left: 1.2em; font-size: .95rem; display: grid; gap: 8px; }

/* 라이어 게임: 이야기 시작 한 화면 · 길게 눌러 정답 공개 */
.talk-card .huge { margin: 6px 0; font-size: clamp(2.2rem, 12vw, 3.4rem); white-space: nowrap; }
.talk-first { font-size: 1.35rem; font-weight: 800; line-height: 1.35; margin: 6px 0; word-break: keep-all; }
.talk-first b { font-size: 1.7rem; color: var(--pink); }
.talk-rule { font-size: 1rem; font-weight: 700; line-height: 1.45; margin: 8px 0; word-break: keep-all; }
.first-note { margin: 0; font-size: .95rem; }
.reveal-hold { position: relative; overflow: hidden; min-height: 72px; touch-action: none; -webkit-touch-callout: none; }
.reveal-fill { position: absolute; inset: 0; background: var(--blue); opacity: .55; transform: scaleX(0); transform-origin: left center; pointer-events: none; }
.reveal-label { position: relative; }
.answer-word { font-size: 1.3rem; word-break: keep-all; } .answer-word b { font-size: 1.8rem; }

/* 한 폰 가운데 눕혀 두고 동시에 누르기 (다섯 개 땡!·먼저 누르기): 모서리 단추·가운데 판 */
.c-ddaeng { background: linear-gradient(160deg, var(--yellow), var(--orange)); } .c-quick { background: linear-gradient(160deg, var(--green), var(--blue)); }
body[data-screen="arena"] { overflow: hidden; overscroll-behavior: none; }
.screen[data-name="arena"] { animation: none; } /* transform 이 있으면 fixed 판이 화면이 아니라 .screen 에 붙는다 */
.arena { --m: 10px; --sh: 24%; position: fixed; inset: 0; z-index: 25; background: var(--bg); touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; overflow: hidden; transition: background-color .2s linear; }
.arena * { touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.seat { position: absolute; display: grid; place-items: center; height: var(--sh); border: 4px solid var(--line); border-radius: 26px; color: var(--on-color); box-shadow: inset 0 -7px 0 rgba(0, 0, 0, .18); cursor: pointer; overflow: hidden; }
.seat.c-pink { background: var(--pink); } .seat.c-blue { background: var(--blue); } .seat.c-green { background: var(--green); } .seat.c-purple { background: var(--purple); }
.seat[data-pos="b"], .seat[data-pos="bl"], .seat[data-pos="br"] { bottom: calc(var(--m) + env(safe-area-inset-bottom)); }
.seat[data-pos="t"], .seat[data-pos="tl"], .seat[data-pos="tr"] { top: calc(var(--m) + env(safe-area-inset-top)); }
.seat[data-pos="b"], .seat[data-pos="t"] { left: var(--m); right: var(--m); }
.seat[data-pos="bl"], .seat[data-pos="tl"] { left: var(--m); width: 43%; }
.seat[data-pos="br"], .seat[data-pos="tr"] { right: var(--m); width: 43%; }
.seat.down { filter: brightness(.9); box-shadow: inset 0 3px 0 rgba(0, 0, 0, .25); }
.seat[data-state="wrong"], .seat[data-state="frozen"] { background: repeating-linear-gradient(45deg, var(--card) 0 12px, var(--bg2) 12px 24px); color: var(--ink); }
.seat[data-state="win"] { outline: 7px solid var(--yellow); outline-offset: -11px; }
.seat[data-state="out"] { filter: grayscale(.85) brightness(.85); }
.seat-in { display: flex; flex-direction: column; align-items: center; gap: 0; text-align: center; line-height: 1.15; padding: 4px 8px; }
.flip { transform: rotate(180deg); }
.seat-name { font-size: 1.15rem; font-weight: 900; word-break: keep-all; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat-score { font-size: clamp(2.2rem, 9vmin, 4.2rem); font-weight: 900; font-variant-numeric: tabular-nums; }
.seat-msg { min-height: 1.3em; font-size: 1.05rem; font-weight: 900; }
.table { position: absolute; left: var(--m); right: var(--m); top: calc(var(--sh) + 2 * var(--m) + env(safe-area-inset-top)); bottom: calc(var(--sh) + 2 * var(--m) + env(safe-area-inset-bottom)); display: grid; place-items: center; }
.say { position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; align-items: center; gap: 10px; pointer-events: none; z-index: 3; }
.say-in { background: var(--card); color: var(--ink); border: 3px solid var(--line); border-radius: 16px; padding: 6px 16px; font-weight: 900; font-size: 1.3rem; text-align: center; box-shadow: 0 4px 0 var(--line); max-width: 92%; word-break: keep-all; }
.pause-btn { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 4; width: 46px; height: 46px; border-radius: 50%; border: 3px solid var(--line); background: var(--card); color: var(--ink); font: inherit; font-weight: 900; font-size: 1.1rem; cursor: pointer; opacity: .85; }
.arena[data-pause="side"] .pause-btn { left: calc(var(--m) + 26px); }
.pause-wrap { position: fixed; inset: 0; z-index: 35; background: rgba(20, 14, 40, .55); display: grid; place-items: center; padding: 16px; }
.pause-wrap .panel { width: min(100%, 420px); display: flex; flex-direction: column; gap: 12px; }
/* 다섯 개 땡!: 자리마다 카드 한 칸(그 사람 쪽) */
.slots { width: 100%; height: 100%; display: grid; gap: 10px; place-items: center; }
.slots[data-n="4"] { column-gap: 60px; } .slots[data-n="2"], .slots[data-n="3"] { row-gap: 60px; }
.slots[data-n="2"] { grid-template-areas: "t" "b"; grid-template-rows: 1fr 1fr; }
.slots[data-n="3"] { grid-template-areas: "t t" "bl br"; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.slots[data-n="4"] { grid-template-areas: "tl tr" "bl br"; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.slot { width: var(--slot, 120px); height: var(--slot, 120px); border: 3px dashed var(--muted); border-radius: 16px; display: grid; place-items: center; position: relative; }
.slot[data-turn="1"] { border-color: var(--ink); border-style: solid; }
.slot .fcard { width: 100%; height: 100%; display: block; filter: drop-shadow(0 4px 0 var(--line)); }
.slot.top .fcard { transform: rotate(180deg); }
.slot.new .fcard { animation: deal .18s ease-out; }
@keyframes deal { from { transform: scale(.7) rotate(-8deg); opacity: .3; } to { transform: none; opacity: 1; } }
.slot.top.new .fcard { animation: deal-top .18s ease-out; }
@keyframes deal-top { from { transform: rotate(172deg) scale(.7); opacity: .3; } to { transform: rotate(180deg); opacity: 1; } }
.ficon { width: 2em; height: 2em; vertical-align: middle; }
.fruit-row { display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; font-weight: 800; }
.fruit-row span { display: flex; align-items: center; gap: 4px; }
.demo-cards { display: flex; justify-content: center; gap: 8px; align-items: center; font-weight: 900; font-size: 1.3rem; }
.demo-cards .fcard { width: 74px; height: 74px; }
/* 먼저 누르기: 기다려(빨강·팔각) → 지금!(초록·동그라미). 색과 글자·모양을 함께 바꾼다 */
.arena { --wait: #c9303e; --go: #33d17a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .arena { --wait: #9e2230; --go: #2cc06e; } }
:root[data-theme="dark"] .arena { --wait: #9e2230; --go: #2cc06e; }
.arena[data-light="wait"] { background: var(--wait); }
.arena[data-light="go"] { background: var(--go); }
.sign { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; width: min(66vw, 44vh, 360px); aspect-ratio: 1; color: #fff; font-weight: 900; text-align: center; }
.sign b { font-size: clamp(1.8rem, 9vmin, 3.2rem); line-height: 1.1; }
.sign i { font-style: normal; font-size: clamp(2.4rem, 13vmin, 4.6rem); line-height: 1; }
.sign[data-k="wait"] { background: #5a0d16; clip-path: polygon(30% 0, 70% 0, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0 70%, 0 30%); }
.sign[data-k="go"] { background: #fff; color: #0d5a2f; border-radius: 50%; border: 8px solid #0d5a2f; }
.sign[data-k="rest"] { background: var(--card); color: var(--ink); border: 4px dashed var(--line); border-radius: 26px; }
.sign[data-k="go"] b { font-size: clamp(2.4rem, 12vmin, 4.2rem); }
@media (prefers-reduced-motion: reduce) { .arena { transition: none; } .slot.new .fcard { animation: none; } }

/* 밸런스 게임: 큰 「A vs B」 카드(누르면 손 든 사람 +1)·사람 수 막대 */
.c-balance { background: linear-gradient(160deg, var(--purple), var(--pink)); } .c-namematch { background: linear-gradient(160deg, var(--pink), var(--yellow)); }
.btn[hidden] { display: none; }
.bal-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.bal { display: flex; flex-direction: column; align-items: stretch; gap: 6px; }
.bal-card { appearance: none; font: inherit; color: var(--on-color); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 150px; padding: 14px 16px; border: 3px solid var(--line); border-radius: 22px; box-shadow: 0 5px 0 var(--line); cursor: pointer; text-align: center; user-select: none; -webkit-user-select: none; transition: transform .06s, box-shadow .06s; }
.bal-card:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--line); }
.bal-card.a { background: var(--blue); } .bal-card.b { background: var(--orange); }
.bal-letter { font-size: 1rem; font-weight: 900; padding: 0 12px; border-radius: 999px; border: 2px solid var(--line); background: var(--card); color: var(--ink); }
.bal-text { font-size: clamp(1.5rem, 7vw, 2.1rem); font-weight: 900; line-height: 1.25; word-break: keep-all; overflow-wrap: anywhere; }
.bal-count { font-size: .95rem; font-weight: 800; opacity: .9; }
.bal-vs { align-self: center; font-size: 1.6rem; font-weight: 900; color: var(--pink); letter-spacing: .06em; margin: -2px 0; }
.bal-tally p { margin: 6px 0 8px; }
.bal-bar { display: flex; height: 16px; border: 3px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--bg2); }
.bal-bar i { display: block; height: 100%; transition: width .2s; } .bal-bar i.a { background: var(--blue); } .bal-bar i.b { background: var(--orange); }
.bal-tally:not([data-counted="1"]) .bal-bar { opacity: .35; }
.bal-tally .row .btn { width: auto; }
body:not([data-screen="start"]) .seo-doc { display: none; }
.seo-doc { max-width: 488px; margin: 0 auto 36px; }
main#app + .seo-doc { margin-top: -18px; }
@media (max-width: 520px) { .seo-doc { margin-left: 16px; margin-right: 16px; } }
@media (prefers-reduced-motion: reduce) { .bal-bar i { transition: none; } }

/* 이름 궁합: 입력·계산 피라미드·점수 */
.fun-note { margin: 0; text-align: center; word-break: keep-all; font-size: .9rem; font-weight: 800; padding: 6px 10px; border-radius: 12px; border: 2px dashed var(--line); background: var(--card); }
.nm-form { display: flex; flex-direction: column; gap: 6px; }
.nm-form label { font-weight: 800; }
.nm-form input { font-size: 1.4rem; font-weight: 800; text-align: center; }
.nm-heart, .nm-amp { color: var(--pink); font-weight: 900; text-align: center; font-size: 1.5rem; line-height: 1; }
.nm-pyr { display: flex; flex-direction: column; align-items: center; gap: 4px; margin: 10px 0 4px; font-variant-numeric: tabular-nums; }
.nm-row { display: flex; gap: 3px; justify-content: center; width: 100%; transition: opacity .25s, transform .25s; }
.nm-row span { display: grid; place-items: center; flex: 0 1 2.2em; min-width: 0; height: 2em; border-radius: 9px; border: 2px solid var(--line); background: var(--bg2); font-weight: 900; font-size: clamp(.85rem, 4vw, 1.1rem); overflow: hidden; }
.nm-row.nm-letters span { background: var(--yellow); color: var(--on-color); }
.nm-row[data-hide="1"] { opacity: 0; transform: translateY(-6px); }
.nm-row:last-child span { background: var(--pink); color: var(--on-color); }
.nm-row[data-hide="1"]:last-child span { background: var(--bg2); }
.nm-score { color: var(--pink); margin: 4px 0; } .nm-score small { font-size: 1.4rem; margin-left: 2px; }
.big-msg { font-size: 1.2rem; font-weight: 800; word-break: keep-all; }
.nm-check { display: flex; align-items: center; gap: 10px; font-weight: 800; margin-bottom: 6px; cursor: pointer; }
.nm-check input { width: 24px; height: 24px; accent-color: var(--pink); }
@media (prefers-reduced-motion: reduce) { .nm-row { transition: none; } }
/* 밸런스 게임 질문 모음(정적 페이지) */
.page .qs { padding-left: 1.6em; margin: .4em 0 1em; display: grid; gap: 6px; }
.page .qs li { padding: 6px 10px; border-radius: 12px; border: 2px solid var(--line); background: var(--card); font-weight: 700; word-break: keep-all; }
.page .qs b { color: var(--pink); margin: 0 2px; }

/* 뽑기 도구(핀볼 뽑기·돌림판·당첨자 추첨·랜덤 숫자): 첫 화면 한 줄 묶음 · 쪽마다 쓰는 법 본문 · 판·원판·결과 */
.tools-head { font-size: 1.15rem; margin: 4px 0 -4px; text-align: center; }
.tools { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.tools li { display: flex; }
.tcard { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; text-decoration: none; padding: 10px 4px 8px; border-radius: 18px; border: 3px solid var(--line); box-shadow: 0 4px 0 var(--line); background: var(--card); color: var(--ink); min-height: 112px; transition: transform .06s, box-shadow .06s; }
.tcard:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--line); }
.tcard img { width: 52px; height: 52px; }
.tcard b { font-size: .92rem; font-weight: 900; line-height: 1.2; word-break: keep-all; }
.guide { max-width: 520px; margin: 0 auto 36px; padding: 0 16px; }
.guide .doc p { margin: .3em 0 .7em; }
body:not([data-screen="start"]):not([data-screen="result"]) .guide { display: none; }
textarea { font: inherit; font-size: 1.05rem; width: 100%; min-height: 150px; padding: 8px 12px; border-radius: 14px; border: 3px solid var(--line); background: var(--card); color: var(--ink); resize: vertical; }
textarea:focus-visible, input[type="number"]:focus-visible, details summary:focus-visible { outline: 4px solid var(--blue); outline-offset: 2px; }
input[type="number"] { font: inherit; font-size: 1.3rem; font-weight: 800; width: 100%; min-width: 0; min-height: 52px; padding: 6px 12px; border-radius: 14px; border: 3px solid var(--line); background: var(--card); color: var(--ink); text-align: center; font-variant-numeric: tabular-nums; }
.field { display: flex; flex-direction: column; gap: 4px; font-weight: 800; font-size: .95rem; flex: 1; min-width: 0; }
.warn { color: var(--danger); font-weight: 800; min-height: 1.5em; margin: 0; }
.chip.tog[aria-pressed="true"] { background: var(--green); }
details.more summary { cursor: pointer; font-weight: 800; padding: 4px 0; }
.seedline { font-size: .9rem; color: var(--muted); word-break: break-all; }
.seedline code { font-size: 1rem; font-weight: 800; color: var(--ink); letter-spacing: .06em; }
/* 핀볼 판 */
.pb-board { display: block; margin: 0 auto; aspect-ratio: 360 / 600; width: min(100%, calc((100vh - 200px) * .6)); width: min(100%, calc((100dvh - 200px) * .6)); min-width: 200px; border: 3px solid var(--line); border-radius: 18px; background: var(--card); touch-action: manipulation; }
.pb-status { text-align: center; font-weight: 900; font-size: 1.15rem; margin: 0; min-height: 1.6em; }
.pb-legend { grid-template-columns: 1fr 1fr; }
.pb-legend li { font-size: .9rem; padding: 4px 8px; }
.pb-legend li[data-rank]::after { content: attr(data-rank); margin-left: auto; font-size: .8rem; color: var(--muted); }
.ball-dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); flex: none; display: grid; place-items: center; font-size: .72rem; font-weight: 900; color: #2a2150; }
.rank-list { margin: 6px 0 0; padding-left: 1.6em; text-align: left; display: grid; gap: 2px; font-weight: 700; }
/* 돌림판(글자 있는 원판) */
.wheel-wrap.big { width: min(88vw, 360px); }
.wheel.vec { image-rendering: auto; }
.legend.compact li { font-size: .9rem; padding: 4px 8px; }
.legend.compact { max-height: 340px; overflow: auto; }
/* 당첨자 추첨·숫자 결과 */
.win-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.win-list li { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: 3px solid var(--line); border-radius: 16px; background: var(--card); font-weight: 900; font-size: 1.3rem; word-break: break-all; animation: pop .3s ease-out; }
.win-list li .no { flex: none; min-width: 2.2em; height: 2.2em; border-radius: 999px; display: grid; place-items: center; background: var(--yellow); color: var(--on-color); border: 2px solid var(--line); font-size: .9rem; }
.win-list li.wait { color: var(--muted); border-style: dashed; animation: none; }
.num-out { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; list-style: none; padding: 0; margin: 6px 0; }
.num-out li { min-width: 3.2em; padding: 6px 12px; border-radius: 999px; border: 3px solid var(--line); background: var(--yellow); color: var(--on-color); font-weight: 900; font-size: 1.5rem; text-align: center; font-variant-numeric: tabular-nums; box-shadow: 0 3px 0 var(--line); animation: pop .25s ease-out both; }
.num-out.one li { font-size: 3.4rem; padding: 10px 28px; }
@media (prefers-reduced-motion: reduce) { .win-list li, .num-out li { animation: none; } }
