@import url('https://fonts.googleapis.com/css2?family=Hahmlet:wght@400;600;700;800&family=Gowun+Batang:wght@400;700&display=swap');

/* 어두운 펠트 아플리케: 밤색 펠트 판 위에 펠트 조각을 오려 붙이고 실로 꿰맨 느낌.
   조각 = 섬유 질감(--felt-*) + 바느질선(outline dashed) + 두께감 있는 그림자(--lift) */
:root {
  --bg: #2a2230;
  --piece: #3a2f42;
  --piece-2: #463950;
  --well: #1e1823;
  --cream: #efe3cc;
  --text: #f3e9da;
  --muted: #b0a0a6;
  --orange: #e0692a;
  --orange-edge: #92390e;
  --orange-2: #f08a3e;
  --purple: #a77ee0;
  --green: #9bd05a;
  --green-felt: #3f5c33;
  --red: #ef6a5f;
  --radius: 22px;

  --stitch: rgba(243, 233, 218, .42);
  --stitch-strong: rgba(255, 242, 220, .78);
  --stitch-dark: rgba(60, 38, 22, .5);

  --lift: 0 3px 0 rgba(0, 0, 0, .38), 0 10px 18px rgba(0, 0, 0, .38);
  --lift-sm: 0 2px 0 rgba(0, 0, 0, .38), 0 5px 9px rgba(0, 0, 0, .32);
  --well-shadow: inset 0 3px 7px rgba(0, 0, 0, .5), inset 0 -1px 0 rgba(255, 255, 255, .05);

  /* 섬유 질감: 어두운 얼룩 + 밝은 잔털 두 겹 */
  --felt-lo: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .5 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --felt-hi: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.7' numOctaves='2' seed='7' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .32 -.08'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --felt: var(--felt-hi), var(--felt-lo);

  /* 공개 무대(검은 펠트) */
  --stage: #17121a;
  --stage-piece: #2c232e;
  --stage-text: #f4ece2;
  --stage-muted: #a99a8f;

  --serif-display: 'Hahmlet', 'Nanum Myeongjo', serif;
  --serif: 'Gowun Batang', 'Hahmlet', serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background-color: var(--bg);
  background-image: radial-gradient(ellipse at 50% 20%, #3a2d40 0%, transparent 60%), radial-gradient(ellipse at 50% 120%, #120e15 0%, transparent 55%), var(--felt);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--serif);
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
  /* 앱 전체에서 글자 선택(파란 하이라이트)과 길게 누르기 메뉴를 막는다. 입력칸은 아래에서 다시 허용 */
  /* 한국어는 단어 중간에서 줄을 바꾸지 않는다 (아주 긴 단어만 예외) */
  word-break: keep-all;
  overflow-wrap: anywhere;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
input, textarea { -webkit-user-select: text; user-select: text; }
h1, h2, h3, .display, .title { font-family: var(--serif-display); font-weight: 700; margin: 0; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
.label { font-family: var(--serif-display); font-weight: 600; font-size: 14px; color: var(--muted); letter-spacing: .04em; margin-top: 6px; }

/* 펠트 조각 공통 */
.card, .option, .chip, .slot.filled, .score-row, .gain-card, .choice, .timer, .pill, .why, .art-frame,
button.secondary, .btn.secondary, button.ghost, .seg button.on {
  background-color: var(--piece);
  background-image: var(--felt);
}

/* ---------- 버튼 · 입력 ---------- */
button, .btn {
  font: inherit; font-family: var(--serif-display); font-weight: 700; border: 0; border-radius: 16px; cursor: pointer;
  padding: 15px 26px; color: #fff6ea; text-align: center; text-decoration: none; display: inline-block;
  background-color: var(--orange); background-image: var(--felt);
  outline: 1.6px dashed var(--stitch-strong); outline-offset: -6px;
  box-shadow: 0 4px 0 var(--orange-edge), 0 10px 16px rgba(0, 0, 0, .4);
  text-shadow: 0 1px 0 rgba(0, 0, 0, .25);
  transition: transform .08s, box-shadow .12s, filter .2s;
}
button:hover, .btn:hover { filter: brightness(1.06); }
button:active, .btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--orange-edge), 0 3px 6px rgba(0, 0, 0, .4); }
button:disabled {
  cursor: default; color: var(--muted); background-color: var(--well); box-shadow: var(--well-shadow);
  outline-color: var(--stitch); filter: none; transform: none; text-shadow: none;
}
button.secondary, .btn.secondary, button.ghost {
  color: var(--text); outline-color: var(--stitch); box-shadow: 0 4px 0 #1a141e, 0 10px 16px rgba(0, 0, 0, .35);
}
button.ghost { color: var(--muted); }
button.secondary:active, .btn.secondary:active, button.ghost:active { box-shadow: 0 1px 0 #1a141e, 0 3px 6px rgba(0, 0, 0, .35); }
input[type=text] {
  font: inherit; width: 100%; padding: 17px 20px; border-radius: 16px; border: 0;
  background-color: var(--well); background-image: var(--felt); color: var(--text); font-size: 18px;
  box-shadow: var(--well-shadow); outline: 1.5px dashed var(--stitch); outline-offset: -6px;
}
input[type=text]::placeholder { color: #7e6f78; }
input[type=text]:focus { outline: 2px dashed var(--orange-2); }
.card {
  border-radius: var(--radius); padding: 28px; box-shadow: var(--lift);
  outline: 1.6px dashed var(--stitch); outline-offset: -10px;
}
.error { color: var(--red); min-height: 1.4em; font-size: 14px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 16px; align-items: center; }
.toast { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 30; color: var(--red); }

/* ---------- 캐릭터 프로필: 둥근 펠트 패치에 꿰맨 캐릭터 ---------- */
.ava {
  --size: 44px;
  width: var(--size); height: var(--size); flex: none; border-radius: 50%; display: inline-grid; place-items: center;
  background-color: color-mix(in srgb, var(--c) 22%, #2e2534); background-image: var(--felt);
  outline: 1.5px dashed color-mix(in srgb, var(--c) 80%, white); outline-offset: -4px;
  box-shadow: 0 2px 0 rgba(0, 0, 0, .4), 0 5px 9px rgba(0, 0, 0, .35);
  vertical-align: middle;
}
.ava svg { width: 78%; height: 78%; overflow: visible; filter: url(#felt) drop-shadow(0 1.5px 0 rgba(0, 0, 0, .35)); }
.ava.xs { --size: 22px; outline: none; box-shadow: none; }
.ava.sm { --size: 30px; outline-offset: -3px; outline-width: 1px; }
.ava.md { --size: 48px; }
.ava.lg { --size: 66px; outline-offset: -5px; }
.ava.xl { --size: 94px; outline-offset: -6px; outline-width: 2px; }
.ava.xxl { --size: 130px; outline-offset: -8px; outline-width: 2px; box-shadow: var(--lift); }
.ava.bump { animation: bump .45s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes bump { 40% { transform: scale(1.28) rotate(-6deg); } }

/* ---------- 타이머 ---------- */
.timer {
  font-family: var(--serif-display); font-weight: 800; font-size: 26px; min-width: 80px; text-align: center;
  padding: 9px 18px; border-radius: 999px; box-shadow: var(--lift-sm); font-variant-numeric: tabular-nums;
  outline: 1.4px dashed var(--stitch); outline-offset: -5px;
}
.timer.urgent { color: #fff; background-color: #a3322c; animation: pulse 1s infinite; }
@keyframes pulse { 50% { transform: scale(1.08); } }

/* ---------- 플레이어 칩 ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.chip {
  display: flex; align-items: center; gap: 8px; padding: 5px 18px 5px 5px; border-radius: 999px;
  box-shadow: var(--lift-sm); font-weight: 700; transition: all .3s;
  outline: 1.3px dashed var(--stitch); outline-offset: -4px;
}
.chip.done { background-color: var(--green-felt); color: #e4f5cf; outline-color: rgba(220, 245, 190, .6); }
.chip.done::after { content: ''; width: 6px; height: 11px; margin: -3px 2px 0; border: solid var(--green); border-width: 0 3px 3px 0; transform: rotate(45deg); }
.chip.waiting { opacity: .65; }

/* ---------- 할로윈 장식 (Fluent Emoji + 펠트 필터) ---------- */
.ico { display: block; height: auto; user-select: none; -webkit-user-drag: none; }
.ico.lit, .deco-item.piece .ico, .flyer .ico, .burst-bat .ico, .wait-ico, .drop-ico, .crown .ico, .coin .ico, .hero-ico, .setup-hero .ico, .cauldron .ico {
  filter: url(#felt) drop-shadow(0 3px 0 rgba(0, 0, 0, .38)) drop-shadow(0 8px 12px rgba(0, 0, 0, .42));
}
.deco { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.deco-item { position: absolute; }
.deco-item .ico { width: 100%; }
.deco-item.piece { opacity: .9; }
.deco-item.thread { opacity: .32; }
.deco-item.thread.flip { transform: scaleX(-1); }
.swing { transform-origin: top center; animation: swing 5s ease-in-out infinite; }
.swing::before { content: ''; position: absolute; left: 50%; bottom: 80%; height: 40vh; border-left: 1.5px dashed rgba(243, 233, 218, .4); }
@keyframes swing { 50% { transform: rotate(6deg) translateY(10px); } }
.bob { animation: bob 3.2s ease-in-out infinite; }
.bob.slow { animation-duration: 4.6s; }
@keyframes bob { 50% { transform: translateY(-12px); } }
.flyer { position: absolute; top: var(--y); left: 0; width: calc(72px * var(--s)); animation: fly var(--dur) linear infinite; animation-delay: var(--delay); }
.flap { animation: flap .32s ease-in-out infinite alternate; }
@keyframes flap { to { transform: scaleY(.55) translateY(5px); } }
@keyframes fly {
  0% { transform: translate(-12vw, 0); }
  25% { transform: translate(25vw, 5vh); }
  50% { transform: translate(55vw, -2vh); }
  75% { transform: translate(85vw, 6vh); }
  100% { transform: translate(112vw, 0); }
}

/* ---------- 사회자 해골 ---------- */
.mc { display: flex; align-items: flex-start; gap: 12px; }
.mc-skull { flex: none; width: 74px; filter: url(#felt) drop-shadow(0 3px 0 rgba(0, 0, 0, .4)) drop-shadow(0 8px 12px rgba(0, 0, 0, .45)); }
.mc-svg { display: block; width: 100%; overflow: visible; }
.mc-svg .jaw { transition: transform .1s; }
.mc.talk .jaw { animation: chatter .16s ease-in-out infinite alternate; }
@keyframes chatter { to { transform: translateY(5px); } }
.mc .eye { animation: glow 2.4s ease-in-out infinite; }
@keyframes glow { 50% { opacity: .45; } }
.mc-skull { animation: tilt 4s ease-in-out infinite; transform-origin: 50% 90%; }
@keyframes tilt { 25% { transform: rotate(-4deg); } 75% { transform: rotate(4deg); } }
.mc-bubble {
  position: relative; margin-top: 18px; max-width: min(560px, 46vw); padding: 14px 20px; border-radius: 18px 18px 18px 6px;
  background-color: var(--cream); color: #241a1f;
  font-family: var(--serif-display); font-weight: 700; font-size: clamp(17px, 1.7vw, 22px); line-height: 1.45;
  outline: 1.5px dashed var(--stitch-dark); outline-offset: -6px; box-shadow: var(--lift);
}
.mc-bubble::before {
  content: ''; position: absolute; left: -10px; top: 18px; border: 8px solid transparent; border-right: 12px solid var(--cream); border-left: 0;
}
.mc-bubble.pop { animation: popIn .35s both; }
.mc-bubble b { font-weight: 800; }
/* 크림색 말풍선 위에서도 읽히도록 플레이어 색 이름을 진하게 */
.mc-bubble b[style] { filter: brightness(.5) saturate(1.6); }
.mc.silent .mc-bubble { opacity: 0; }
.mc-text:empty::after { content: '\2026'; }
.mc-text:has(.mc-size) { display: inline-grid; }
.mc-text > .mc-size, .mc-text > .mc-type { grid-area: 1 / 1; }
.mc-size { visibility: hidden; }
.mc-type { text-align: start; }
/* 공개 무대 위에서도 사회자가 보이도록 */
#mc { position: relative; z-index: 8; min-height: 92px; }
.mc-skull.big { width: 150px; }
.mc.stacked { flex-direction: column; align-items: center; gap: 4px; }
.mc.stacked .mc-bubble { margin-top: 6px; max-width: min(420px, 90vw); border-radius: 18px; text-align: center; font-size: 22px; }
.mc.stacked .mc-bubble::before { left: 50%; top: -14px; transform: translateX(-50%); border: 8px solid transparent; border-bottom: 12px solid var(--cream); border-top: 0; }
.mc-skull.mid { width: 96px; }

/* 로고: SKULLPT · 스컬프트 · by jojo */
.brand { display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; }
/* 로고는 절대 줄바꿈하지 않고, 좁은 화면에선 폭에 맞춰 글자가 작아진다 */
.brand-name { font-family: var(--serif-display); font-weight: 800; font-size: clamp(40px, min(12vw, 7vw + 24px), 92px); letter-spacing: .01em; line-height: 1.05; white-space: nowrap; }
.brand-ko { font-family: var(--serif-display); font-weight: 600; font-size: clamp(16px, 1.8vw, 22px); color: var(--cream); letter-spacing: .5em; padding-left: .5em; opacity: .85; }
.brand-by { font-family: var(--serif); font-style: italic; font-size: 14px; color: var(--muted); margin-top: 4px; }
.byline { position: fixed; right: 16px; bottom: 10px; z-index: 2; font-family: var(--serif); font-style: italic; font-size: 12px; color: var(--muted); opacity: .7; pointer-events: none; }
.host, .phone { position: relative; z-index: 1; }
@media (max-width: 700px) { .deco .wide { display: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01s !important; animation-iteration-count: 1 !important; } }

/* 펠트로 오린 글자 (로고, 방 코드) */
.felt-text, .room-code, .host header .logo, .brand-name {
  color: transparent; background-color: var(--orange); background-image: var(--felt);
  -webkit-background-clip: text; background-clip: text;
  filter: drop-shadow(0 3px 0 var(--orange-edge)) drop-shadow(0 8px 10px rgba(0, 0, 0, .45));
}

/* ================= 호스트(TV) ================= */
.host { min-height: 100vh; display: flex; flex-direction: column; padding: 24px 32px; gap: 20px; }
.host header { display: flex; justify-content: space-between; align-items: center; }
.host header .logo { font-size: 28px; font-weight: 800; }
.host main { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 26px; }
.host .title { font-size: clamp(32px, 5vw, 64px); text-align: center; font-weight: 800; text-shadow: 0 3px 0 rgba(0, 0, 0, .35); }
.host .subtitle { font-size: clamp(18px, 2vw, 26px); color: var(--muted); text-align: center; line-height: 1.55; }
.subtitle.small { font-size: 16px; }

.setup-hero { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.setup-hero .ico { width: 84px; }
.setup { width: min(540px, 100%); }
.seg {
  display: flex; gap: 6px; padding: 6px; border-radius: 18px;
  background-color: var(--well); background-image: var(--felt); box-shadow: var(--well-shadow);
}
.seg button {
  flex: 1; padding: 10px 8px; background: transparent; color: var(--muted); box-shadow: none; outline: none;
  font-size: 15px; border-radius: 13px; text-shadow: none;
}
.seg button:active { transform: none; box-shadow: none; }
.seg button.on { color: var(--orange-2); box-shadow: var(--lift-sm); outline: 1.3px dashed var(--stitch); outline-offset: -4px; }

.room-code { font-family: var(--serif-display); font-weight: 800; font-size: clamp(64px, 12vw, 160px); letter-spacing: .15em; line-height: 1.05; padding-left: .15em; white-space: nowrap; }
.lobby-slots { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 20px; width: min(960px, 100%); }
.slot {
  height: clamp(100px, 19vh, 150px); border-radius: var(--radius); display: flex; flex-direction: column; gap: 6px;
  align-items: center; justify-content: center; color: var(--muted); position: relative;
  background-color: var(--well); background-image: var(--felt); box-shadow: var(--well-shadow);
  outline: 1.5px dashed rgba(243, 233, 218, .18); outline-offset: -9px;
}
.slot-ghost { width: 46px; opacity: .16; filter: grayscale(1) brightness(2); }
.slot.filled { box-shadow: var(--lift); color: var(--text); outline-color: color-mix(in srgb, var(--c) 70%, white); animation: pop .4s cubic-bezier(.2, 1.4, .4, 1); }
.slot-name { font-family: var(--serif-display); font-weight: 700; font-size: 20px; }
.slot-char { font-size: 13px; color: var(--c); }
.slot .kick { position: absolute; top: 10px; right: 10px; padding: 4px 9px; font-size: 12px; opacity: 0; transition: opacity .2s; outline: none; }
.slot:hover .kick { opacity: 1; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } }

.cauldron .ico { width: 120px; }

/* 크림색 펠트 매트 + 압정으로 꽂은 사진 */
.art-frame {
  position: relative; background-color: var(--cream); border-radius: 18px; padding: 16px; box-shadow: var(--lift);
  outline: 1.6px dashed var(--stitch-dark); outline-offset: -7px; max-width: min(520px, 42vw); transform: rotate(-1.2deg);
}
.art-frame::before {
  content: ''; position: absolute; top: -9px; left: 50%; width: 22px; height: 22px; margin-left: -11px; border-radius: 50%; z-index: 1;
  background: radial-gradient(circle at 35% 30%, #ff8a7a, #b8322a 70%); box-shadow: 0 3px 4px rgba(0, 0, 0, .45);
}
.art-frame img { display: block; width: 100%; max-height: 60vh; object-fit: contain; border-radius: 6px; background: #fffaf0; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }
.art-by { font-size: 18px; display: flex; align-items: center; gap: 8px; }

.stage { display: grid; grid-template-columns: minmax(0, auto) 1fr; gap: 40px; align-items: center; width: 100%; max-width: 1300px; }
.options { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.option {
  border-radius: 20px; padding: 20px 24px; box-shadow: var(--lift); outline: 1.5px dashed var(--stitch); outline-offset: -8px;
  font-family: var(--serif-display); font-size: clamp(18px, 1.8vw, 26px); font-weight: 700; position: relative; transition: all .4s;
}
.option.dim { opacity: .35; filter: grayscale(.6); box-shadow: var(--lift-sm); }
.option.truth { background-color: var(--green-felt); color: #eaf8d6; outline-color: rgba(220, 245, 190, .7); transform: scale(1.04); }
.option.current { outline: 2px dashed var(--orange-2); transform: scale(1.04); }

.pill {
  display: inline-flex; align-items: center; gap: 6px; color: var(--text); padding: 3px 13px 3px 3px; border-radius: 999px;
  box-shadow: var(--lift-sm); font-family: var(--serif); font-weight: 700; font-size: 14px;
  animation: popIn .4s both;
}

/* ---------- 정답 공개 조명 (검은 펠트 무대) ---------- */
.spotlight, .finale {
  position: fixed; inset: 0; z-index: 4; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; padding: 24px; text-align: center; color: var(--stage-text);
  background-color: var(--stage);
  background-image: radial-gradient(ellipse 55% 50% at 50% 42%, #3b2c38 0%, transparent 70%), var(--felt);
  animation: fadeIn .35s;
}
.spotlight::before, .finale::before {
  content: ''; position: absolute; top: -10vh; left: 50%; width: 70vw; height: 75vh; transform: translateX(-50%);
  background: conic-gradient(from 180deg at 50% 0%, transparent 155deg, #ffe7b818 172deg, #ffe7b82c 180deg, #ffe7b818 188deg, transparent 205deg);
  pointer-events: none;
}
.spotlight > *, .finale > * { position: relative; }
.spotlight .muted, .finale .muted { color: var(--stage-muted); }
.spot-label { font-family: var(--serif-display); font-weight: 600; font-size: clamp(18px, 2.2vw, 28px); color: var(--stage-muted); letter-spacing: .06em; }
.spot-card {
  position: relative; font-family: var(--serif-display); font-weight: 800; font-size: clamp(34px, 5.5vw, 76px); line-height: 1.2;
  background-color: var(--stage-piece); background-image: var(--felt); border-radius: 28px; padding: 32px 52px; max-width: 90vw;
  outline: 2px dashed var(--stitch); outline-offset: -12px;
  box-shadow: 0 5px 0 rgba(0, 0, 0, .5), 0 18px 40px rgba(0, 0, 0, .6), 0 0 90px #f08a3e22;
  animation: spotIn .6s cubic-bezier(.2, 1.4, .4, 1);
}
.spotlight.is-truth .spot-card { background-color: var(--green-felt); outline-color: rgba(220, 245, 190, .7); box-shadow: 0 5px 0 rgba(0, 0, 0, .5), 0 18px 40px rgba(0, 0, 0, .6), 0 0 110px #9bd05a44; }
/* 펠트 도장(꿰맨 라벨) */
.stamp {
  position: absolute; right: -20px; top: -26px; font-size: 26px; padding: 8px 18px; border-radius: 12px;
  background-color: #b8322a; background-image: var(--felt); color: #fff1e6;
  outline: 1.5px dashed rgba(255, 235, 220, .8); outline-offset: -5px; box-shadow: 0 3px 0 #6e1a15, 0 8px 12px rgba(0, 0, 0, .5);
  transform: rotate(12deg) scale(0); opacity: 0;
}
.spotlight.is-truth .stamp { background-color: #4f8a2e; box-shadow: 0 3px 0 #2a4f17, 0 8px 12px rgba(0, 0, 0, .5); }
.spotlight.owned .stamp { animation: stampIn .35s forwards; }
.spot-line { font-size: clamp(20px, 2.4vw, 30px); font-weight: 700; opacity: 0; transform: translateY(14px); transition: all .4s; }
.spot-line.show { opacity: 1; transform: none; }
.spot-line .ok { color: var(--green); }
.spot-line .bad { color: var(--red); }
.spotlight .pill, .finale .pill { background-color: var(--stage-piece); color: var(--stage-text); font-size: clamp(16px, 1.8vw, 22px); }
.pill-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 8px; }
@keyframes spotIn { from { transform: scale(.4) translateY(40px); opacity: 0; } }
@keyframes stampIn { to { transform: rotate(12deg) scale(1); opacity: 1; } }

/* 모두 골랐어요 → 카운트다운 */
.intro-title { font-family: var(--serif-display); font-weight: 800; font-size: clamp(36px, 6vw, 84px); animation: spotIn .7s cubic-bezier(.2, 1.4, .4, 1); }
.intro-count {
  font-family: var(--serif-display); font-weight: 800; font-size: clamp(80px, 14vw, 180px); line-height: 1; color: #fff4e6;
  width: 1.6em; height: 1.6em; display: grid; place-items: center; border-radius: 50%;
  background-color: var(--orange); background-image: var(--felt);
  outline: 3px dashed var(--stitch-strong); outline-offset: -14px;
  box-shadow: 0 6px 0 var(--orange-edge), 0 20px 40px rgba(0, 0, 0, .6);
}
.intro-count.bump { animation: countIn .5s cubic-bezier(.2, 1.6, .4, 1); }
/* 배지 속 숫자의 세로 위치는 glyph.js의 centerGlyph()가 실제 글자 모양을 재서 맞춘다 */
.glyph { display: block; line-height: 1; }
@keyframes countIn { from { transform: scale(.3); opacity: 0; } }

/* 점수 이동: 아이콘 토큰 사이로 코인이 날아간다 */
.xfer { display: flex; align-items: center; justify-content: center; gap: 28px; flex-wrap: wrap; }
.xfer-side { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; }
.xfer-arrow { font-size: 40px; color: var(--stage-muted); }
.xfer-cap { font-size: 16px; font-weight: 400; color: var(--stage-muted); margin-top: 8px; }
.mult { color: var(--orange-2); font-weight: 700; }
.tok { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 80px; }
.tok-name { font-size: 16px; }
.tok-pts { font-family: var(--serif-display); font-weight: 800; font-size: 24px; color: var(--green); opacity: 0; transform: translateY(6px); transition: all .3s; }
.tok-pts.show { opacity: 1; transform: none; }
.tok.fooled .ava { animation: shake .5s 2; filter: saturate(.6); }
.tok.sad { opacity: .6; }
.tok.sad .tok-pts { display: none; }
@keyframes shake { 25% { transform: translateX(-5px) rotate(-6deg); } 75% { transform: translateX(5px) rotate(6deg); } }
.coin {
  position: fixed; z-index: 15; pointer-events: none; display: flex; align-items: center; gap: 4px;
  font-family: var(--serif-display); font-weight: 800; font-size: 22px; color: #ffe08a; text-shadow: 0 2px 8px #000a; white-space: nowrap;
}
.coin .ico { width: 30px; }

/* ---------- 작품별 점수 강조 ---------- */
.points-summary {
  position: fixed; inset: 0; background: rgba(15, 11, 17, .72); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 5; animation: fadeIn .3s;
}
/* 바깥 판은 없이, 흐린 배경 위에 점수 카드만 (카드가 두 겹으로 보이지 않게) */
.points-summary .card { width: min(880px, 100%); max-height: 90vh; overflow: auto; text-align: center; padding: 34px; background: none; box-shadow: none; outline: none; }
.gain-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 22px; padding: 4px 0 8px; }
.gain-card {
  width: 220px; padding: 26px 14px 22px; border-radius: var(--radius); background-color: var(--piece-2); box-shadow: var(--lift);
  outline: 1.5px dashed color-mix(in srgb, var(--c) 70%, white); outline-offset: -8px;
  display: flex; flex-direction: column; align-items: center; gap: 8px; animation: popIn .5s both;
}
.gain-card .name { font-family: var(--serif-display); font-size: 22px; font-weight: 700; color: var(--c); }
.gain-ava { position: relative; display: inline-block; }
.gain-float {
  position: absolute; left: 50%; top: 10%; transform: translate(-50%, 0); white-space: nowrap;
  font-family: var(--serif-display); font-weight: 800; font-size: 34px; color: var(--green); text-shadow: 0 3px 0 rgba(0, 0, 0, .45);
  animation: floatUp 1.1s cubic-bezier(.2, .9, .3, 1) both;
}
@keyframes floatUp { 0% { opacity: 0; transform: translate(-50%, 30px) scale(.4); } 60% { opacity: 1; transform: translate(-50%, -60px) scale(1.15); } 100% { opacity: 1; transform: translate(-50%, -52px) scale(1); } }
.gain-card .whys { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.why { font-size: 13px; border-radius: 999px; padding: 3px 10px; background-color: var(--well); box-shadow: var(--well-shadow); }
.gain-total { font-size: 16px; color: var(--muted); }
.gain-total b { font-family: var(--serif-display); font-size: 22px; color: var(--text); font-variant-numeric: tabular-nums; }
.zeros { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; align-items: center; color: var(--muted); }
.zeros span { display: inline-flex; align-items: center; gap: 4px; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes popIn { from { transform: scale(.7); opacity: 0; } 60% { transform: scale(1.05); } }

/* ---------- 점수판 ---------- */
.scoreboard { width: min(720px, 100%); display: flex; flex-direction: column; gap: 14px; }
.score-row {
  display: grid; grid-template-columns: 40px 1fr auto auto; gap: 16px; align-items: center;
  border-radius: 18px; padding: 10px 24px 10px 16px; font-size: 22px; font-weight: 700;
  box-shadow: var(--lift-sm), inset 10px 0 0 var(--c); animation: slideIn .4s both;
  outline: 1.3px dashed var(--stitch); outline-offset: -6px;
}
.score-row .rank { font-family: var(--serif-display); color: var(--muted); text-align: center; padding-left: 6px; }
.score-row .who-cell { display: flex; align-items: center; gap: 12px; }
.score-row .delta { color: var(--green); font-size: 16px; }
.score-row .total { font-family: var(--serif-display); font-variant-numeric: tabular-nums; }
.score-row.first { font-size: 28px; padding: 16px 24px 16px 16px; background-color: var(--piece-2); box-shadow: var(--lift), inset 10px 0 0 var(--c); }
.score-row.first .rank { color: var(--orange-2); }
/* 라운드 결과: 누적 점수 칸 없이 이번 라운드 점수를 크게 */
.round-only .score-row { grid-template-columns: 40px 1fr auto; }
.round-only .score-row .delta { font-family: var(--serif-display); font-size: 26px; font-variant-numeric: tabular-nums; }
@keyframes slideIn { from { transform: translateX(-30px); opacity: 0; } }

/* ---------- 최종 시상대 (펠트 블록) ---------- */
.podium { display: grid; grid-template-columns: repeat(3, minmax(150px, 220px)); align-items: end; gap: 22px; }
.podium-step { display: flex; flex-direction: column; align-items: center; gap: 8px; animation: popIn .6s both; position: relative; }
.podium-step.p1 { animation-delay: .5s; }
.podium-step.p2 { animation-delay: .25s; }
.podium-name { font-family: var(--serif-display); font-weight: 700; font-size: 22px; color: var(--c); }
.podium-score { color: var(--muted); }
.podium-block {
  width: 100%; border-radius: 18px 18px 6px 6px; display: grid; place-items: center;
  background-color: var(--piece-2); background-image: var(--felt); box-shadow: var(--lift);
  outline: 1.6px dashed var(--stitch); outline-offset: -8px;
  font-family: var(--serif-display); font-weight: 800; font-size: 46px; color: var(--text); text-shadow: 0 3px 0 rgba(0, 0, 0, .35);
}
.p1 .podium-block { height: 190px; background-color: var(--orange); outline-color: var(--stitch-strong); box-shadow: 0 4px 0 var(--orange-edge), 0 12px 20px rgba(0, 0, 0, .4); }
.p2 .podium-block { height: 130px; background-color: #8e8496; }
.p3 .podium-block { height: 90px; background-color: #8a5a3c; }
.crown .ico { width: 54px; }
.podium .crown { margin-bottom: -10px; animation: bob 2.4s ease-in-out infinite; }

/* ---------- 최종 공개: 점수 그래프 ---------- */
.finale { z-index: 6; justify-content: flex-start; padding-top: max(4vh, 116px); cursor: pointer; }
.spotlight { padding-top: 116px; }
.finale.closing { animation: fadeOut .6s forwards; }
@keyframes fadeOut { to { opacity: 0; } }
.finale-title { font-family: var(--serif-display); font-weight: 800; font-size: clamp(28px, 4vw, 54px); min-height: 1.3em; }
.chart {
  position: relative; width: min(1200px, 88vw); height: min(56vh, 520px); margin-top: 2vh;
  border-radius: 28px; background-color: #120e14; background-image: var(--felt);
  box-shadow: inset 0 4px 12px rgba(0, 0, 0, .7), 0 1px 0 rgba(255, 255, 255, .05);
  outline: 1.6px dashed rgba(243, 233, 218, .2); outline-offset: -10px;
}
.chart .plot { position: absolute; inset: 34px 44px 28px; }
.chart svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.chart .grid { stroke: #ffffff12; stroke-width: 1; stroke-dasharray: 2 6; vector-effect: non-scaling-stroke; }
.chart .divider { stroke: #f08a3e66; stroke-width: 1.5; stroke-dasharray: 6 6; vector-effect: non-scaling-stroke; }
/* 실로 꿰맨 듯한 굵은 선 */
/* 자수 실: 홈질처럼 끊어진 땀 + 실의 윤기 + 옅은 그림자 */
.chart .thread { transition: opacity .6s; }
.chart .stitch {
  fill: none; stroke: var(--c); stroke-width: 4.5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 9 5;
  vector-effect: non-scaling-stroke; filter: drop-shadow(0 1.5px 0 rgba(0, 0, 0, .55));
}
.chart .sheen {
  /* 각 땀(9px) 가운데에 짧은 윤기 — 땀과 같은 주기로 겹쳐 한 가닥 실처럼 */
  fill: none; stroke: #fff; stroke-opacity: .32; stroke-width: 1.2; stroke-linecap: round; stroke-dasharray: 4 10; stroke-dashoffset: -2.5;
  vector-effect: non-scaling-stroke;
}
.divider-label { position: absolute; top: -26px; transform: translateX(-50%); font-size: 13px; color: var(--orange-2); white-space: nowrap; }
.head { position: absolute; transform: translate(-50%, -50%); transition: opacity .6s, filter .6s; }
/* 그래프 끝: 1등만 아바타, 나머지는 실 매듭 */
.head .ava { display: none; }
.head.lead .ava, .head.champ .ava { display: inline-grid; animation: popIn .35s both; }
.head .knot {
  display: block; width: 14px; height: 14px; border-radius: 50%; background-color: var(--c); background-image: var(--felt-lo);
  box-shadow: 0 1.5px 0 rgba(0, 0, 0, .55), inset 0 0 0 1.5px rgba(255, 255, 255, .25);
}
.head.lead .knot, .head.champ .knot { display: none; }
.head-pop {
  position: absolute; left: calc(100% + 8px); top: 50%; transform: translateY(-50%); white-space: nowrap; opacity: 0;
  font-family: var(--serif-display); font-weight: 800; font-size: 14px; color: var(--green); text-shadow: 0 1px 4px #000c;
}
.head.lead .head-pop { font-size: 18px; }
.head-pop.bump { animation: popUp 1.3s ease-out; }
@keyframes popUp { 0% { opacity: 0; transform: translate(-6px, -50%); } 25% { opacity: 1; transform: translate(0, -50%); } 75% { opacity: 1; } 100% { opacity: 0; transform: translate(6px, -50%); } }
.finale.suspense .head .ava { animation: shake .35s infinite; }
.finale.suspense .finale-title { animation: pulse .7s infinite; color: var(--orange-2); }
.finale.winner .head.loser { opacity: .25; filter: grayscale(.7); }
.finale.winner .chart .thread { opacity: .35; }
.finale.winner .head.champ { z-index: 50 !important; }
.finale.winner .head.champ .ava { animation: bump .6s 2; }
.finale-winner { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 40px; pointer-events: none; }
.winner-card {
  display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 36px 58px 32px; border-radius: 34px;
  background-color: var(--stage-piece); background-image: var(--felt);
  outline: 2px dashed color-mix(in srgb, var(--c) 75%, white); outline-offset: -12px;
  box-shadow: 0 6px 0 rgba(0, 0, 0, .5), 0 24px 50px rgba(0, 0, 0, .6), 0 0 120px color-mix(in srgb, var(--c) 45%, transparent);
  animation: spotIn .8s cubic-bezier(.2, 1.4, .4, 1) both;
}
.winner-card .crown .ico { width: 80px; }
.winner-card .crown { margin-bottom: -18px; animation: bob 2s ease-in-out infinite; }
.winner-name { font-family: var(--serif-display); font-weight: 800; font-size: clamp(40px, 6vw, 80px); color: var(--c); text-shadow: 0 4px 0 rgba(0, 0, 0, .4); }
.winner-score { font-size: 26px; color: var(--stage-muted); }
.winner-score b { font-family: var(--serif-display); color: var(--stage-text); font-size: 36px; font-variant-numeric: tabular-nums; }
.finale-skip { position: absolute; bottom: 18px; right: 24px; font-size: 13px; color: #ffffff40; }

/* 펠트 색종이 + 박쥐 */
.burst { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 60; }
.burst i { position: absolute; top: -20px; left: var(--x); width: var(--w); height: calc(var(--w) * 1.4); border-radius: 40% 55% 45% 50%; background-image: var(--felt-lo); box-shadow: 0 2px 2px #0006; animation: fall var(--d) cubic-bezier(.25, .6, .4, 1) both; }
@keyframes fall { to { transform: translateY(110vh) rotate(var(--r)); } }
.burst-bat { position: absolute; left: 50%; top: 45%; width: 70px; animation: batOut 2.4s ease-in both; }
@keyframes batOut { from { transform: translate(-50%, -50%) scale(.3); opacity: 1; } to { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1.1); opacity: 0; } }


/* ================= 플레이어(휴대폰) ================= */
.phone { max-width: 480px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; padding: 16px; gap: 16px; }
.phone header { display: flex; justify-content: space-between; align-items: center; min-height: 52px; }
.phone .me { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.phone main { flex: 1; display: flex; flex-direction: column; gap: 16px; }
.phone .center { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 14px; }
.phone .big { font-size: 28px; font-weight: 800; text-shadow: 0 3px 0 rgba(0, 0, 0, .35); }
.phone .stack > .btn { display: block; }
.hero-ico { width: 96px; }
.wait-ico { width: 80px; }
.prompt-card {
  position: relative; overflow: hidden; color: #fff6ea; border-radius: var(--radius); padding: 20px 22px;
  background-color: var(--orange); background-image: var(--felt);
  outline: 1.6px dashed var(--stitch-strong); outline-offset: -8px;
  box-shadow: 0 4px 0 var(--orange-edge), 0 12px 20px rgba(0, 0, 0, .4);
}
.prompt-card small { font-weight: 700; opacity: .85; }
.prompt-card div { position: relative; font-family: var(--serif-display); font-weight: 800; font-size: 26px; margin-top: 4px; text-shadow: 0 2px 0 rgba(0, 0, 0, .25); }
.prompt-ico { position: absolute; right: -8px; bottom: -14px; width: 86px; opacity: .22; filter: brightness(0); }

.photo-drop {
  aspect-ratio: 1; border-radius: var(--radius); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px; color: var(--muted); overflow: hidden; cursor: pointer; text-align: center; padding: 16px;
  background-color: var(--well); background-image: var(--felt); box-shadow: var(--well-shadow);
  outline: 2px dashed rgba(243, 233, 218, .25); outline-offset: -12px;
}
.drop-ico { width: 64px; opacity: .9; }
.photo-drop img { width: 100%; height: 100%; object-fit: cover; border-radius: 14px; }

.choice {
  width: 100%; text-align: left; color: var(--text); font-size: 19px; padding: 18px 22px; text-shadow: none;
  outline: 1.4px dashed var(--stitch); outline-offset: -6px; box-shadow: 0 4px 0 #1a141e, 0 10px 16px rgba(0, 0, 0, .35);
}
.choice:active { box-shadow: 0 1px 0 #1a141e, 0 3px 6px rgba(0, 0, 0, .35); }
.choice:disabled { opacity: .45; }

.phone .gain-float { font-size: 44px; }
/* 점수 카드 안의 얻은 점수 한 줄 */
.gain-plus {
  font-family: var(--serif-display); font-weight: 800; font-size: 36px; line-height: 1.1; color: var(--green);
  text-shadow: 0 3px 0 rgba(0, 0, 0, .45); animation: popIn .5s cubic-bezier(.2, 1.6, .4, 1) both;
}

/* ================= 진행: 시작 안내 · 다음 버튼 · 자동 진행 ================= */
.host-foot { position: relative; z-index: 8; display: flex; justify-content: space-between; align-items: center; gap: 16px; min-height: 52px; }
.host-tools { display: flex; align-items: center; gap: 14px; }
#btn-next { padding: 14px 30px; font-size: 18px; }
#btn-next.waiting { animation: nudge 1.2s ease-in-out infinite; }
@keyframes nudge { 50% { transform: translateX(5px); filter: brightness(1.15); } }
.icon-btn { width: 52px; height: 52px; padding: 0; border-radius: 50%; display: inline-grid; place-items: center; outline-offset: -5px; }
.icon-btn svg { width: 22px; height: 22px; fill: var(--muted); transition: fill .2s; }
.icon-btn[aria-pressed="true"] { background-color: var(--orange); outline-color: var(--stitch-strong); box-shadow: 0 4px 0 var(--orange-edge), 0 10px 16px rgba(0, 0, 0, .4); }
.icon-btn[aria-pressed="true"] svg { fill: #fff6ea; animation: nudge 1.4s ease-in-out infinite; }
/* 자동 진행 중엔 "다음을 누르면" 안내를 숨긴다 */
.host:has(#btn-auto[aria-pressed="true"]) .next-cue { display: none; }

.next-cue { font-family: var(--serif-display); font-weight: 600; color: var(--orange-2); font-size: 18px; animation: pulse 1.6s ease-in-out infinite; }
.next-hint {
  position: absolute; bottom: 28px; right: 32px; padding: 8px 16px; border-radius: 999px; font-family: var(--serif-display); font-weight: 700;
  color: var(--orange-2); opacity: 0; transition: opacity .3s; outline: 1.3px dashed currentColor; outline-offset: -4px;
}
.next-hint.show { opacity: 1; animation: nudge 1.2s ease-in-out infinite; }

.ready-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 22px; }
.ready-tok { display: flex; flex-direction: column; align-items: center; gap: 6px; font-weight: 700; animation: popIn .45s both; position: relative; }
.ready-tok::after {
  content: ''; position: absolute; top: 2px; right: 2px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--green-felt) center / 12px no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2 6.5l2.5 2.5L10 3' stroke='%23e4f5cf' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  box-shadow: 0 2px 0 rgba(0, 0, 0, .4);
}
.ready-tok.missed { opacity: .4; filter: grayscale(.8); }
.ready-tok.missed::after { display: none; }
.ready-go { color: var(--orange-2); animation: spotIn .8s .6s cubic-bezier(.2, 1.4, .4, 1) both; }

/* 공개: 고른 사람 → 답의 주인을 한 줄로 */
/* 위쪽 여백 = 머리 위에서 점수 코인이 생겨날 허공 (답 카드와 겹치지 않게) */
.xfer { min-height: 150px; margin-top: 96px; }
.xfer .pickers-side .tok { animation: popIn .45s both; }
.xfer .xfer-arrow, .xfer .owner-side { opacity: 0; transform: translateX(-12px); transition: opacity .4s, transform .4s; }
.xfer.show-right .xfer-arrow, .xfer.show-right .owner-side { opacity: 1; transform: none; }
.xfer .owner-side .tok { animation: popIn .5s both; }
.tok-tag {
  font-family: var(--serif-display); font-weight: 700; font-size: 13px; padding: 2px 10px; border-radius: 999px;
  background-color: #b8322a; background-image: var(--felt); color: #fff1e6;
}
.tok.owner:not(.decoy) .tok-tag { background-color: #b8322a; }
.spotlight.is-truth .tok.owner .tok-tag { background-color: #4f8a2e; }
.tok.decoy .tok-tag { background-color: #4a3d52; }
.tok.decoy .ico { width: 62px; filter: url(#felt) drop-shadow(0 3px 0 rgba(0, 0, 0, .4)); }
.tok.right .ava { box-shadow: 0 0 0 3px var(--green), 0 0 24px #9bd05a66; }
.nobody { font-size: 20px; }
.coin { font-size: 24px; }
/* 점수가 허공에서 생겨나는 반짝임 */
.coin-spark {
  position: fixed; z-index: 14; width: 90px; height: 90px; transform: translate(-50%, -50%) scale(.2); pointer-events: none; border-radius: 50%;
  background: radial-gradient(circle, #ffe9a8 0%, #ffd46a88 30%, transparent 65%);
  animation: spark .8s ease-out forwards;
}
.coin-spark::before, .coin-spark::after {
  content: ''; position: absolute; inset: 0; margin: auto; width: 4px; height: 100%; border-radius: 2px;
  background: linear-gradient(transparent, #fff3c4, transparent);
}
.coin-spark::after { transform: rotate(90deg); }
@keyframes spark { 40% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(20deg); } 100% { opacity: 0; transform: translate(-50%, -50%) scale(1.3) rotate(45deg); } }

/* ================= 입장: 캐릭터 고르기 ================= */
.otp { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.otp input[type=text] {
  height: 72px; padding: 0; text-align: center; text-transform: uppercase; caret-color: var(--orange-2);
  font-family: var(--serif-display); font-weight: 800; font-size: 34px; outline-offset: -7px;
}
.otp input[type=text]:not(:placeholder-shown), .otp input[type=text]:valid:not([value=""]) { color: var(--text); }

/* 입장 전 화면(방 만들기 · 참가하기): 위쪽 막대 없이 작은 로고 머리 하나로 공간을 아낀다 */
.brand-head { display: flex; align-items: center; justify-content: center; gap: 12px; }
.brand-head .mc-skull.sm { width: 48px; }
.brand-head .brand-name { font-size: 36px; }
.host .brand-head .mc-skull.sm { width: 64px; }
.host .brand-head .brand-name { font-size: 48px; }
.entry > header, .entry > .host-foot { display: none; }
.phone.entry { gap: 12px; justify-content: center; }
.phone.entry main { flex: 0; gap: 18px; }
.host.entry { padding: 20px 32px; }
.host.entry main { gap: 18px; }
.entry-body { width: 100%; }
.entry-hint { text-align: center; font-size: 14px; }
.entry-room { display: flex; align-items: center; justify-content: center; gap: 10px; }
.entry-room b { font-size: 30px; letter-spacing: .15em; }
.entry-room .ghost { padding: 6px 12px; font-size: 14px; }
.back-btn { align-self: center; padding: 8px 16px; font-family: var(--serif-display); font-weight: 700; font-size: 15px; color: var(--muted); text-decoration: none; border-radius: 999px; }
.back-btn:hover { color: var(--text); }
.error:empty { display: none; }
.mc-skull.sm { width: 60px; }
.char-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.char-pick {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px 8px; border-radius: 16px;
  background-color: var(--piece); background-image: var(--felt); color: var(--muted); font-family: var(--serif); font-size: 12px; font-weight: 700;
  outline: 1.2px dashed var(--stitch); outline-offset: -4px; box-shadow: 0 3px 0 #1a141e, 0 6px 10px rgba(0, 0, 0, .3); text-shadow: none;
}
.char-pick .ava { --size: 52px; }
.char-pick.on { color: var(--c); background-color: color-mix(in srgb, var(--c) 18%, var(--piece)); outline: 2px dashed var(--c); transform: translateY(-2px); }
.char-pick.on .ava { animation: bump .45s cubic-bezier(.2, 1.6, .4, 1); }
.char-pick:disabled { opacity: .28; filter: grayscale(1); background-color: var(--well); box-shadow: var(--well-shadow); outline-color: transparent; }

/* ================= 시작 선택 · 규칙 설명 슬라이드쇼 ================= */
.start-choice {
  position: fixed; inset: 0; z-index: 7; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(15, 11, 17, .6); backdrop-filter: blur(6px); animation: fadeIn .25s;
}
.start-choice .card { width: min(560px, 100%); align-items: center; text-align: center; gap: 16px; animation: popIn .4s both; }
.start-choice .title { font-size: clamp(30px, 4vw, 44px); }
.choice-row { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; }
.choice-row button { min-width: 200px; font-size: 19px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; }
.choice-row .ico { width: 28px; }
.sc-cancel { padding: 8px 18px; font-size: 14px; outline: none; }

.brief {
  position: fixed; inset: 0; z-index: 6; display: flex; flex-direction: column; padding: 120px 32px 28px;
  background-color: var(--stage); background-image: radial-gradient(ellipse 60% 55% at 50% 45%, #3b2c38 0%, transparent 72%), var(--felt);
  color: var(--stage-text); animation: fadeIn .35s;
}
.brief.closing { animation: fadeOut .4s forwards; }
.brief-stage { flex: 1; display: flex; align-items: center; justify-content: center; }
.b-slide { display: flex; flex-direction: column; align-items: center; gap: 34px; width: min(1200px, 100%); animation: slideUp .5s cubic-bezier(.2, 1, .3, 1) both; }
@keyframes slideUp { from { opacity: 0; transform: translateY(30px); } }
.b-slide > *, .b-flow > *, .b-fakes > *, .b-points > * { animation: popIn .5s both; }
.b-title { font-family: var(--serif-display); font-weight: 800; font-size: clamp(40px, 6vw, 80px); display: flex; align-items: center; gap: 20px; text-shadow: 0 4px 0 rgba(0, 0, 0, .4); }
.b-num {
  width: 1.25em; height: 1.25em; border-radius: 50%; display: grid; place-items: center; font-size: .7em; line-height: 1;
  background-color: var(--orange); background-image: var(--felt); color: #fff6ea; box-shadow: 0 4px 0 var(--orange-edge);
  outline: 2px dashed var(--stitch-strong); outline-offset: -6px;
}
.brief-nav { position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.b-dots { display: flex; gap: 10px; }
.b-dots i { width: 12px; height: 12px; border-radius: 50%; background: var(--stage-piece); box-shadow: inset 0 2px 3px rgba(0, 0, 0, .6); transition: all .3s; }
.b-dots i.on { width: 34px; border-radius: 999px; background: var(--orange); box-shadow: 0 2px 0 var(--orange-edge); }
.brief .b-skip { outline: none; padding: 10px 18px; font-size: 14px; }
.brief button.secondary, .brief button.ghost { background-color: var(--stage-piece); }

/* 1장: 등장인물 */
.b-cast { display: flex; flex-wrap: wrap; justify-content: center; gap: 26px; }
.b-castmate { display: flex; flex-direction: column; align-items: center; gap: 8px; font-family: var(--serif-display); font-weight: 700; font-size: 20px; }
.b-castmate .ava { animation: bob 2.6s ease-in-out infinite; }
.b-castmate:nth-child(2n) .ava { animation-delay: -1.3s; }
.b-steps { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: center; font-family: var(--serif-display); font-size: clamp(20px, 2.4vw, 30px); font-weight: 700; }
.b-steps > span { display: inline-flex; align-items: center; gap: 8px; padding: 8px 20px 8px 8px; border-radius: 999px; background-color: var(--stage-piece); background-image: var(--felt); box-shadow: var(--lift-sm); outline: 1.3px dashed var(--stitch); outline-offset: -5px; animation: popIn .5s both; }
.b-steps > span > b { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--orange); color: #fff6ea; font-size: 18px; }
.b-steps i { color: var(--stage-muted); font-style: normal; }

/* 2장: 폰 → 찰흙 → 사진 */
.b-flow { display: flex; align-items: center; justify-content: center; gap: 28px; flex-wrap: wrap; }
.b-arrow { font-size: 48px; color: var(--stage-muted); }
.b-phone {
  width: 220px; height: 380px; border-radius: 34px; padding: 18px 14px; display: flex; align-items: center;
  background-color: #141016; background-image: var(--felt); box-shadow: 0 6px 0 #000, 0 20px 40px rgba(0, 0, 0, .6); outline: 2px dashed rgba(243, 233, 218, .25); outline-offset: -8px;
}
.b-screen { width: 100%; padding: 20px 16px; border-radius: 18px; background-color: var(--orange); background-image: var(--felt); color: #fff6ea; text-align: center; box-shadow: 0 4px 0 var(--orange-edge); animation: glowPulse 2s ease-in-out infinite; }
.b-screen small { opacity: .85; font-weight: 700; }
.b-screen div { font-family: var(--serif-display); font-weight: 800; font-size: 24px; margin-top: 6px; line-height: 1.3; }
@keyframes glowPulse { 50% { box-shadow: 0 4px 0 var(--orange-edge), 0 0 34px #f08a3e88; } }
.b-clay { display: flex; flex-direction: column; align-items: center; gap: 10px; font-family: var(--serif-display); font-weight: 700; font-size: 22px; }
.b-clay .ico { width: 130px; filter: url(#felt) drop-shadow(0 4px 0 rgba(0, 0, 0, .4)); animation: squish 1.6s ease-in-out infinite; }
@keyframes squish { 50% { transform: scale(1.08, .92); } }
.b-flash { position: absolute; inset: 0; z-index: 3; background: #fff; opacity: 0; pointer-events: none; }
/* 설명 중엔 하단 진행 도구를 숨긴다 (슬라이드쇼에 자체 버튼이 있음) */
.host:has(.brief) .host-foot { visibility: hidden; }
.brief, .b-slide { word-break: keep-all; }
.b-flash.go { animation: flash .6s ease-out; }
@keyframes flash { 10% { opacity: .85; } 100% { opacity: 0; } }

/* 3장: 작품 + 가짜 제목 타이핑 */
.b-art {
  display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 22px 26px 16px; border-radius: 18px; transform: rotate(-2deg);
  background-color: var(--cream); color: #2b2026; box-shadow: var(--lift); outline: 1.6px dashed var(--stitch-dark); outline-offset: -7px;
}
.b-art .ico { width: 170px; filter: url(#felt); }
.b-art span { display: flex; align-items: center; gap: 6px; font-weight: 700; }
.b-fakes { display: flex; flex-direction: column; gap: 18px; min-width: min(460px, 80vw); }
.b-fake {
  display: flex; align-items: center; gap: 12px; padding: 14px 22px 14px 12px; border-radius: 18px 18px 18px 6px; min-height: 64px;
  background-color: var(--stage-piece); background-image: var(--felt); box-shadow: var(--lift-sm); outline: 1.3px dashed var(--stitch); outline-offset: -5px;
  font-family: var(--serif-display); font-weight: 700; font-size: clamp(20px, 2.2vw, 28px);
}
.b-type::after { content: '|'; color: var(--orange-2); animation: blink .8s steps(1) infinite; margin-left: 2px; }
@keyframes blink { 50% { opacity: 0; } }

/* 4장: 고르기 */
.b-options { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; width: min(900px, 100%); }
.b-opt {
  padding: 22px 26px; border-radius: 20px; font-family: var(--serif-display); font-weight: 700; font-size: clamp(20px, 2.2vw, 30px);
  background-color: var(--stage-piece); background-image: var(--felt); box-shadow: var(--lift); outline: 1.5px dashed var(--stitch); outline-offset: -8px;
  transition: transform .2s, outline-color .2s; animation: popIn .45s both;
}
.b-opt.hover { transform: scale(1.04); outline: 2.5px dashed var(--orange-2); }
.b-opt.picked { background-color: var(--green-felt); outline-color: rgba(220, 245, 190, .8); transform: scale(1.08); }

/* 5장: 점수 */
.b-points { display: flex; flex-direction: column; gap: 18px; width: min(760px, 100%); }
.b-pt {
  position: relative; display: grid; grid-template-columns: auto auto 1fr; align-items: center; gap: 22px; padding: 14px 26px 14px 14px; border-radius: 22px;
  background-color: var(--stage-piece); background-image: var(--felt); box-shadow: var(--lift-sm); outline: 1.3px dashed var(--stitch); outline-offset: -6px;
}
.b-pt b { font-family: var(--serif-display); font-weight: 800; font-size: 38px; color: var(--green); min-width: 120px; }
.b-pt span { font-size: 20px; color: var(--stage-muted); }
/* 점수 코인이 허공에서 생겨나 아바타에 내려앉는다 */
.b-pt b::before {
  content: attr(data-coin); position: absolute; left: 30px; top: -10px; font-size: 22px; color: #ffe08a; text-shadow: 0 2px 8px #000a;
  animation: coinDrop 1.4s both; animation-delay: inherit;
}
@keyframes coinDrop { 0% { opacity: 0; transform: translateY(-40px) scale(.3); } 30% { opacity: 1; transform: translateY(-40px) scale(1.2); } 80% { opacity: 1; transform: translateY(18px) scale(.8); } 100% { opacity: 0; transform: translateY(24px) scale(.5); } }
.b-pt { animation-name: popIn; }

/* 6장: 준비 */
.b-ready .ico { width: 200px; filter: url(#felt) drop-shadow(0 6px 0 rgba(0, 0, 0, .45)); animation: bob 2s ease-in-out infinite; }
.b-go { font-family: var(--serif-display); font-weight: 700; font-size: 24px; color: var(--orange-2); animation: pulse 1.4s ease-in-out infinite; }

/* ================= 게임 방법 ================= */
.howto-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.howto-btn .ico { width: 24px; }
.howto {
  position: fixed; inset: 0; z-index: 12; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(15, 11, 17, .65); backdrop-filter: blur(6px); animation: fadeIn .25s;
}
.howto.closing { animation: fadeOut .25s forwards; }
.howto-card { position: relative; width: min(900px, 100%); max-height: 92vh; overflow: auto; display: flex; flex-direction: column; gap: 22px; animation: popIn .4s both; }
.howto-close { position: absolute; top: 14px; right: 14px; padding: 6px 12px; font-size: 14px; outline: none; }
.howto-mc .mc-bubble { max-width: min(560px, 70vw); }
.howto-need { display: flex; flex-wrap: wrap; gap: 10px; }
.howto-need span {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px 6px 8px; border-radius: 999px; font-size: 15px;
  background-color: var(--well); background-image: var(--felt); box-shadow: var(--well-shadow);
}
.howto-need .ico { width: 26px; }
.howto-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; counter-reset: step; }
.howto-steps li {
  counter-increment: step; position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px;
  padding: 22px 14px 18px; border-radius: 18px; background-color: var(--piece-2); background-image: var(--felt);
  outline: 1.4px dashed var(--stitch); outline-offset: -7px; box-shadow: var(--lift-sm);
  animation: popIn .45s both;
}
.howto-steps li:nth-child(2) { animation-delay: .08s; } .howto-steps li:nth-child(3) { animation-delay: .16s; } .howto-steps li:nth-child(4) { animation-delay: .24s; }
.howto-steps .step-num {
  position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-family: var(--serif-display); font-weight: 800; font-size: 15px;
  background-color: var(--orange); background-image: var(--felt); color: #fff6ea; box-shadow: 0 2px 0 var(--orange-edge);
}
.howto-steps .ico { width: 58px; filter: url(#felt) drop-shadow(0 3px 0 rgba(0, 0, 0, .35)); }
.howto-steps b { font-family: var(--serif-display); font-size: 21px; }
.howto-steps p { margin: 0; font-size: 15px; line-height: 1.55; color: var(--muted); }
.howto-steps em { font-style: normal; color: var(--orange-2); font-weight: 700; }
.howto-points { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.howto-points div {
  display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; font-size: 14px; color: var(--muted);
  padding: 12px 8px; border-radius: 14px; background-color: var(--well); background-image: var(--felt); box-shadow: var(--well-shadow);
}
.howto-points b { font-family: var(--serif-display); font-weight: 800; font-size: 26px; color: var(--green); }
.howto-ok { align-self: center; padding-left: 40px; padding-right: 40px; }
@media (max-width: 760px) {
  .howto-steps { grid-template-columns: 1fr 1fr; }
  .howto-points { grid-template-columns: 1fr; }
  .howto-card { padding: 20px; }
}

/* 휴대폰: 한 장씩 넘겨 보는 카드. 넘겨도 카드 크기는 그대로 */
.howto.paged .howto-card { height: min(620px, 88dvh); overflow: hidden; gap: 16px; padding: 22px 18px 18px; }
.howto.paged .howto-mc { min-height: 104px; padding-right: 36px; }
.howto.paged .howto-mc .mc-skull { width: 52px; }
.howto.paged .howto-mc .mc-bubble { font-size: 16px; max-width: none; }
.howto-page { flex: 1; min-height: 0; display: flex; flex-direction: column; justify-content: center; }
.howto-page.turn > * { animation: pageIn .35s cubic-bezier(.2, .9, .3, 1) both; }
.howto.paged .howto-need { flex-direction: column; align-items: stretch; gap: 12px; }
.howto.paged .howto-need span { font-size: 18px; padding: 12px 18px 12px 12px; }
.howto.paged .howto-need .ico { width: 34px; }
.howto-steps.one { grid-template-columns: 1fr; }
.howto-steps.one li { padding: 34px 20px 26px; gap: 10px; }
.howto-steps.one .ico { width: 92px; }
.howto-steps.one b { font-size: 28px; }
.howto-steps.one p { font-size: 17px; }
.howto-steps.one .step-num { width: 34px; height: 34px; top: -15px; font-size: 18px; }
.howto.paged .howto-points { grid-template-columns: 1fr; gap: 12px; }
.howto.paged .howto-points div { font-size: 15px; padding: 14px 10px; }
.howto-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.howto-nav button { padding: 12px 16px; font-size: 15px; white-space: nowrap; }
.howto-nav .b-dots i.on { width: 22px; }

/* ================= 개발용 미리보기 바 (?dev) ================= */
.pv-bar {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: 4px 4px 4px 16px; border-radius: 999px; background: #111827; color: #d1d5db; font: 12px system-ui, sans-serif;
  box-shadow: 0 8px 16px rgba(3, 7, 18, .12); white-space: nowrap; max-width: calc(100vw - 32px); overflow-x: auto;
}
.pv-dev { font-family: ui-monospace, monospace; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: #9ca3af; }
.pv-seg, .pv-actions { display: inline-flex; border-radius: 999px; background: #374151; padding: 2px; }
.pv-actions { background: none; gap: 2px; }
.pv-bar button {
  border: 0; background: none; box-shadow: none; outline: none; text-shadow: none; filter: none;
  color: #d1d5db; font: inherit; font-weight: 500; padding: 2px 12px; border-radius: 999px; cursor: pointer;
}
.pv-bar button:hover { color: #fff; filter: none; }
.pv-bar button:active { transform: none; box-shadow: none; }
.pv-bar button:disabled { background: none; box-shadow: none; opacity: .5; }
.pv-seg button[aria-pressed="true"] { background: #f9fafb; color: #111827; }
.pv-actions .pv-act { border: 1px solid #374151; }
.pv-kbd { font-family: ui-monospace, monospace; font-size: 11px; color: #9ca3af; padding-right: 8px; }

/* 좁은 화면에서도 작품과 선택지가 스크롤 없이 함께 보이게 */
@media (max-width: 900px) {
  .host { padding: 16px; }
  .stage { grid-template-columns: 1fr; gap: 16px; justify-items: center; }
  .stage .title { text-align: center !important; }
  .art-frame { max-width: 70vw; }
  .art-frame img { max-height: 32vh; }
  .options { grid-template-columns: 1fr 1fr; width: 100%; }
  .option { padding: 12px 14px; }
  .lobby-slots { grid-template-columns: repeat(2, 1fr); }
  .podium { grid-template-columns: repeat(3, 1fr); gap: 10px; }
}
.join-url { text-align: center; font-size: clamp(16px, 2vw, 24px); margin-top: -8px; }

/* 감점 (가짜 제목 미제출 → 함정에 속은 사람마다) */
.coin.neg, .tok-pts.neg, .gain-float.neg, .gain-plus.neg, .score-row .delta.neg { color: var(--red); }

/* 첫 화면 → 참가하기·방 만들기: 지금 화면은 흐려지고, 새 화면은 살짝 올라오며 나타난다.
*/
.page { display: contents; }
.page.leaving > * { animation: pageOut .18s ease-in forwards; }
.page.entering main > * { animation: pageIn .42s cubic-bezier(.2, .9, .3, 1) both; }
.page.entering main > :nth-child(2) { animation-delay: .05s; }
.page.entering main > :nth-child(3) { animation-delay: .1s; }
main.step-in > * { animation: pageIn .42s cubic-bezier(.2, .9, .3, 1) both; }
@keyframes pageOut { to { opacity: 0; } }
@keyframes pageIn { from { opacity: 0; transform: translateY(16px); } }
.setup #btn-create { margin-top: 10px; }

/* 연결 상태 띠 (TV·휴대폰 공통) */
.conn {
  position: fixed; left: 50%; top: 10px; z-index: 30; transform: translate(-50%, -16px); max-width: min(560px, calc(100vw - 32px));
  opacity: 0; visibility: hidden;
  padding: 10px 18px; border-radius: 14px; background: var(--red); color: #fff; font-weight: 700; font-size: 15px; line-height: 1.4; text-align: center;
  box-shadow: var(--lift); pointer-events: none;
  transition: transform .3s cubic-bezier(.2, 1, .3, 1), opacity .25s, visibility 0s .3s;
}
/* 숨김 상태에선 그림자까지 완전히 감춘다 (화면 위쪽에 빨간 띠가 비치지 않게) */
.conn.show { transform: translate(-50%, 0); opacity: 1; visibility: visible; transition: transform .3s cubic-bezier(.2, 1, .3, 1), opacity .25s; }

/* 로비: 참가 QR + 방 코드 */
.join-box { display: flex; align-items: center; justify-content: center; gap: clamp(20px, 3vw, 44px); }
.qr { flex: none; width: clamp(110px, min(15vw, 22vh), 200px); aspect-ratio: 1; padding: 10px; border-radius: 16px; background: #fffaf0; box-shadow: var(--lift); }
.qr svg { display: block; width: 100%; height: 100%; }
.join-info { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.join-box .room-code { font-size: clamp(52px, min(9vw, 14vh), 130px); }
.join-box .join-url { text-align: left; margin: 0; }
.join-url b { color: var(--text); }
@media (max-width: 640px) { .join-box { flex-direction: column; } .join-info { align-items: center; } .join-box .join-url { text-align: center; } }

/* TV 전체 화면 버튼 (오른쪽 위) */
/* 오른쪽 위 고정 버튼: 맨 오른쪽 소리, 그 왼쪽 전체 화면(TV) */
.mute-btn, .fs-btn { position: fixed; top: 14px; z-index: 11; width: 44px; height: 44px; color: var(--muted); }
.mute-btn { right: 14px; }
.fs-btn { right: 66px; }
.fs-btn[aria-pressed="true"] { color: #fff6ea; }
.mute-btn svg { overflow: visible; }
.mute-btn .cross, .mute-btn[aria-pressed="true"] .wave { display: none; }
.mute-btn[aria-pressed="true"] .cross { display: inline; }
/* 소리 끔은 강조하지 않는다 (자동 진행 버튼의 '켜짐' 주황색과 헷갈리지 않게) */
.mute-btn[aria-pressed="true"] { background-color: var(--piece); box-shadow: var(--lift-sm); outline-color: var(--stitch); color: var(--muted); }
/* 위쪽 막대 오른쪽(라운드·타이머·점수)이 고정 버튼과 겹치지 않게 */
.host header { padding-right: 56px; }
.phone header { padding-right: 52px; }
body:has(#btn-fs) .host header { padding-right: 108px; }
body:has(#btn-fs) .phone header { padding-right: 104px; }
.fs-btn .fs-off, .fs-btn[aria-pressed="true"] .fs-on { display: none; }
.fs-btn[aria-pressed="true"] .fs-off { display: block; }

/* 노트북처럼 세로가 짧은 화면: 로비가 스크롤 없이 한 화면에 들어오게 촘촘히 */
@media (max-height: 800px) {
  .host { padding-top: 16px; padding-bottom: 16px; gap: 12px; }
  .host main { gap: 16px; }
  .slot { height: clamp(84px, 15vh, 150px); }
  .qr { width: clamp(100px, min(15vw, 18vh), 200px); padding: 8px; }
  .join-box .room-code { font-size: clamp(48px, min(9vw, 11vh), 130px); }
}

/* 휴대폰: 대기실 버튼 줄, 사진 다시 찍기 */
.lobby-actions, .create-actions { display: flex; gap: 10px; }
.lobby-actions > *, .create-actions > * { flex: 1; }
.sent-photo { display: block; width: min(220px, 60%); aspect-ratio: 1; object-fit: cover; margin: 0 auto; border-radius: 16px; box-shadow: var(--lift); transform: rotate(-2deg); }
