/* ==========================================================================
   CASE PLAY — "Noir Dossier" 디자인 시스템
   모바일 우선(390px), 데스크톱은 520px 중앙 카드. 다크 고정.
   ========================================================================== */
:root {
  --bg: #121417;
  --bg-deep: #0E1013;
  --bg-page: #08090b;
  --surface: #1C1F24;
  --surface-2: #232730;
  --line: #2A2E35;
  --line-2: #3A3E45;
  --amber: #E8A33D;
  --amber-2: #D98F2B;
  --amber-ink: #1A1408;
  --red: #B23A3A;
  --red-soft: #F0B0B0;
  --red-bg: #3A1414;
  --cyan: #5FC3D9;
  --text: #EDE8DF;
  --muted: #9A948A;
  --muted-2: #6B6F76;
  --beige: #C9B99A;
  --cream: #EDE6D6;
  --radius-card: 12px;
  --radius-tag: 4px;
  --font-display: "Noto Serif KR", "Apple SD Gothic Neo", "Nanum Myeongjo", Georgia, serif;
  --font-body: "Noto Sans KR", "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
  --font-hand: "Nanum Pen Script", "Caveat", cursive;
  --font-script: "Caveat", "Nanum Pen Script", cursive;
  --shadow-card: 0 10px 30px rgba(0, 0, 0, .45);
  --shadow-btn: 0 8px 22px rgba(232, 163, 61, .28), 0 2px 6px rgba(0, 0, 0, .5);
  --tabbar-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.4' numOctaves='1' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .12 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
  color-scheme: dark;
}

/* ---------- 기본 ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; height: 100%; }
@media (max-width: 520px) { html::-webkit-scrollbar { width: 0; height: 0; } html { scrollbar-width: none; } }
body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg-page);
  word-break: keep-all;
  overflow-wrap: anywhere;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: var(--noise); opacity: .55; mix-blend-mode: screen;
}
.app {
  position: relative; z-index: 1;
  max-width: 520px; margin: 0 auto; min-height: 100dvh;
  background: var(--bg);
  box-shadow: 0 0 0 1px #000, 0 0 80px rgba(0, 0, 0, .8);
  /* clip: hidden 과 같이 장식 이미지를 잘라내되 스크롤 컨테이너를 만들지 않는다 → 채팅 하단 도크·상단 '나 = 캐릭터' 의 sticky 가 창 스크롤 기준으로 동작한다 (미지원 브라우저는 hidden 유지) */
  overflow: hidden;
  overflow: clip;
}
.app::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(60% 40% at 50% 0, rgba(255, 240, 200, .07), transparent 70%);
}
.page { position: relative; padding: 18px 16px calc(var(--tabbar-h) + var(--safe-b) + 28px); }
.page.no-tabs { padding-bottom: 40px; }

a { color: var(--amber); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-family: var(--font-display); font-weight: 700; }
p { margin: 0 0 .8em; }
img { max-width: 100%; display: block; }
.pre { white-space: pre-wrap; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.hidden { display: none !important; }
.center { text-align: center; }
.mt { margin-top: 16px; }
.mb { margin-bottom: 16px; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.serif { font-family: var(--font-display); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
svg { vertical-align: middle; }

/* 라벨: 자간 넓은 영문 소제목 */
.eyebrow { font-family: var(--font-display); font-size: 12px; letter-spacing: .32em; text-transform: uppercase; color: var(--muted); }
.eyebrow.underline { border-bottom: 1px solid var(--muted-2); padding-bottom: 2px; }
/* 양옆 선이 있는 가운데 라벨 */
.rule { display: flex; align-items: center; gap: 14px; text-align: center; color: var(--muted); font-family: var(--font-display); letter-spacing: .28em; font-size: 13px; }
.rule::before, .rule::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--line-2)); }
.rule::after { background: linear-gradient(90deg, var(--line-2), transparent); }
.rule.text { color: var(--text); letter-spacing: .02em; font-size: 18px; }
.rule.big { font-size: 22px; letter-spacing: .24em; }
/* 손글씨 톤 */
.hand { font-family: var(--font-hand); color: var(--muted); font-size: 20px; letter-spacing: .02em; line-height: 1.2; opacity: .85; }
/* 옅은 장식 텍스트 */
.deco-text { font-family: var(--font-display); font-size: 9px; letter-spacing: .3em; line-height: 1.9; color: var(--muted-2); text-transform: uppercase; opacity: .8; }

/* ---------- 브랜드 헤더 (로비 / 대기실) ---------- */
.hdr { display: grid; grid-template-columns: auto 1px 1fr; gap: 14px; align-items: center; padding: 6px 0 10px; position: relative; }
.hdr .brand { text-align: center; color: var(--beige); text-decoration: none; display: block; }
.hdr .brand svg { width: 64px; height: 64px; }
.hdr .brand .name { font-family: var(--font-display); font-size: 15px; letter-spacing: .28em; margin-top: 2px; }
.hdr .brand .tag { font-size: 10px; letter-spacing: .18em; color: var(--muted); margin-top: 2px; }
.hdr .vline { width: 1px; height: 76px; background: linear-gradient(180deg, transparent, var(--line-2) 20%, var(--line-2) 80%, transparent); }
.hdr .title { position: relative; z-index: 1; }
.hdr .title h1 { font-size: clamp(24px, 6.6vw, 30px); font-weight: 700; letter-spacing: -.01em; white-space: nowrap; }
.hdr .title p { color: var(--muted); font-size: clamp(12px, 3.4vw, 14px); margin: 4px 0 0; }
@media (max-width: 420px) { .hdr .brand svg { width: 54px; height: 54px; } .hdr .brand .name { font-size: 13px; } .hdr .brand .tag { font-size: 9px; } .hdr { gap: 10px; } }
.hdr.centered .title { text-align: center; }
/* 우상단 찢긴 종이 스탬프 */
.torn {
  position: absolute; right: -28px; top: -26px; width: 140px; height: 90px; pointer-events: none;
  background: linear-gradient(160deg, #34322e, #1e1d1b); opacity: .95; box-shadow: 0 6px 16px rgba(0, 0, 0, .5);
  clip-path: polygon(18% 0, 100% 0, 100% 100%, 70% 92%, 44% 100%, 20% 78%, 0 50%, 10% 22%);
  transform: rotate(-8deg); z-index: 0;
}
@media (max-width: 420px) { .torn { right: -34px; top: -30px; width: 128px; height: 82px; } .torn span { font-size: 10px; right: 34px; top: 26px; } }
.torn span {
  position: absolute; right: 30px; top: 28px; transform: rotate(-4deg);
  font-family: var(--font-display); font-weight: 900; font-size: 11px; line-height: 1.25; letter-spacing: .08em; color: #7d7a72; text-align: right; opacity: .85; white-space: nowrap;
}
.hand-right { text-align: right; margin: 0 0 14px; transform: rotate(-2deg); transform-origin: right; }
/* 로비 우상단 KO / EN 언어 토글 (찢긴 종이 스탬프 위에 얹힌다) */
.lang-switch { display: flex; justify-content: flex-end; gap: 2px; margin: 0 0 -6px; position: relative; z-index: 2; }
.lang-switch button { border: 1px solid var(--line-2); background: rgba(18, 20, 23, .7); color: var(--muted); font-family: var(--font-mono); font-size: 11px; letter-spacing: .12em; padding: 4px 8px; border-radius: 6px; cursor: pointer; }
.lang-switch button.on { background: var(--beige); color: #121417; border-color: var(--beige); }
.lang-switch button:focus-visible { outline: 2px solid var(--amber); outline-offset: 1px; }
/* 영어 UI: 한글 전용 손글씨 대신 Caveat */
html[lang="en"] .hand, html[lang="en"] .hand-right { font-family: var(--font-script); font-size: 19px; }

/* ---------- 컴팩트 중앙 헤더 (라운드/채팅/투표/역할지) ---------- */
.hdr-c { position: relative; text-align: center; padding: 6px 0 12px; }
.hdr-c .ico { color: var(--beige); }
.hdr-c .ico svg { width: 42px; height: 42px; }
.hdr-c .rule { margin: 2px 40px 0; }
.hdr-c .rule.big { font-size: 22px; }
.hdr-c .sub { color: var(--text); font-size: 15px; margin-top: 4px; }
.hdr-c .sub.muted { color: var(--muted); font-size: 12px; letter-spacing: .12em; }
.hdr-c .deco-l, .hdr-c .deco-r { position: absolute; top: 46px; }
.hdr-c .deco-l { left: 0; text-align: left; }
.hdr-c .deco-r { right: 0; text-align: right; border-bottom: 1px solid var(--line-2); }
.hdr-c .deco-r.plain { border: 0; }

/* ---------- 버튼 ---------- */
.btn { appearance: none; border: 1px solid var(--line-2); background: transparent; color: var(--text); border-radius: 999px; padding: 12px 22px; min-height: 48px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: .45em; text-decoration: none; transition: transform .08s ease, opacity .15s, background .15s; }
.btn:active { transform: scale(.97); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .4; cursor: not-allowed; }
.btn.block { width: 100%; }
.btn.sm { min-height: 40px; padding: 8px 16px; font-size: 15px; }
.btn.amber { background: linear-gradient(180deg, var(--amber), var(--amber-2)); border: 0; color: var(--amber-ink); box-shadow: var(--shadow-btn); font-size: 18px; position: relative; overflow: hidden; }
.btn.amber::after { content: ""; position: absolute; inset: 0; background: var(--grain); opacity: .5; mix-blend-mode: multiply; pointer-events: none; }
.btn.amber.serif { font-family: var(--font-display); font-weight: 700; }
.btn.amber.big { min-height: 60px; border-radius: 18px; font-size: 22px; }
.btn.ghost { background: transparent; border-color: var(--line-2); color: var(--text); }
.btn.outline-amber { background: transparent; border: 1.5px solid var(--amber); color: var(--amber); }
.btn.gray { background: var(--surface-2); border-color: var(--line-2); color: var(--muted); box-shadow: none; }
.btn .chev { margin-left: .1em; }
.btn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.link-btn { background: none; border: 0; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; padding: 8px; font-size: 15px; }

/* ---------- 입력 ---------- */
.input { width: 100%; background: var(--bg-deep); border: 1px solid var(--line-2); border-radius: 14px; padding: 13px 16px; font-size: 17px; min-height: 52px; color: var(--text); }
.input::placeholder { color: var(--muted-2); }
.input:focus { outline: none; border-color: var(--amber); box-shadow: 0 0 0 3px rgba(232, 163, 61, .18); }
textarea.input { min-height: 110px; resize: vertical; line-height: 1.55; }
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 14px; color: var(--muted); margin-bottom: 6px; letter-spacing: .04em; }
.field-label { display: flex; align-items: center; gap: 14px; font-family: var(--font-display); font-size: 18px; margin: 18px 0 8px; }
.field-label::after { content: ""; flex: 1; height: 1px; background: var(--line-2); }

/* ---------- 카드 공통 ---------- */
.card { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); padding: 16px; margin-bottom: 14px; box-shadow: var(--shadow-card); }
.card::before { content: ""; position: absolute; inset: 0; border-radius: inherit; background: var(--noise); opacity: .35; pointer-events: none; mix-blend-mode: screen; }
.card > * { position: relative; }
.card.bar { padding-left: 20px; }
.card.bar::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; border-radius: var(--radius-card) 0 0 var(--radius-card); background: var(--bar, var(--muted-2)); }
.card.bar.red { --bar: var(--red); }
.card.bar.amber { --bar: var(--amber); }
.card.bar.cyan { --bar: var(--cyan); }
.card.outline-amber { border: 2px solid var(--amber); background: linear-gradient(180deg, rgba(232, 163, 61, .06), rgba(232, 163, 61, .02)), var(--surface); }
.card.outline-amber::before { opacity: .2; }
.sec-head { display: flex; align-items: center; gap: 12px; padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--line-2); }
.sec-head .ico { flex: 0 0 auto; display: grid; place-items: center; }
.sec-head .ico svg { width: 28px; height: 28px; }
.sec-head h3 { font-size: 19px; flex: 1; white-space: nowrap; }
.sec-head .eyebrow { font-size: 9px; letter-spacing: .22em; white-space: nowrap; }
.ico.red { color: var(--red); }
.ico.amber { color: var(--amber); }
.ico.cyan { color: var(--cyan); }
.bullets { list-style: none; margin: 0; padding: 0; }
.bullets li { position: relative; padding-left: 22px; margin-bottom: 10px; line-height: 1.6; }
.bullets li::before { content: ""; position: absolute; left: 2px; top: .62em; width: 8px; height: 8px; border-radius: 50%; background: var(--dot, var(--red)); }
.bullets.amber { --dot: var(--amber); }
.bullets.check li::before { display: none; }
.bullets.check li { padding-left: 30px; }
.bullets.check li > svg { position: absolute; left: 0; top: .2em; color: var(--amber); }

/* 배지 */
.badge { display: inline-flex; align-items: center; gap: .3em; font-size: 12px; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line-2); color: var(--muted); white-space: nowrap; font-weight: 700; }
.badge.amber { color: var(--amber); border-color: var(--amber); background: rgba(232, 163, 61, .1); }
.badge.amber.fill { background: var(--amber); color: var(--amber-ink); border-color: var(--amber); }
.badge.red { color: var(--red-soft); border-color: var(--red); background: rgba(178, 58, 58, .15); }
.badge.cyan { color: var(--cyan); border-color: var(--cyan); }
.badge.ok { color: #9fd6b3; border-color: #3f7a55; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line-2); background: rgba(18, 20, 23, .7); font-size: 14px; color: var(--text); backdrop-filter: blur(4px); }
.chip svg { width: 16px; height: 16px; color: var(--beige); }

/* ==========================================================================
   S1. 로비
   ========================================================================== */
.case-list { display: grid; gap: 22px; margin-top: 10px; }
.case-card {
  position: relative; overflow: hidden; border-radius: 14px; border: 1px solid var(--line); background: var(--surface);
  min-height: 250px; box-shadow: var(--shadow-card); cursor: pointer; isolation: isolate;
  transition: transform .2s ease, box-shadow .2s ease;
}
.case-card:hover { transform: translateY(-2px); box-shadow: 0 16px 40px rgba(0, 0, 0, .6); }
.case-card .art { position: absolute; inset: 0; z-index: -1; background-size: cover; background-position: right center; }
.case-card .art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, #1C1F24 35%, rgba(28, 31, 36, .6) 60%, transparent 100%), var(--noise); }
.case-card .accent-bar { position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: var(--accent, var(--muted-2)); }
.case-card .body { padding: 22px 22px 20px 26px; display: flex; flex-direction: column; min-height: 250px; }
.case-card .no { font-family: var(--font-mono); font-size: 11px; letter-spacing: .32em; color: var(--muted); }
.case-card h2 { font-size: clamp(28px, 8vw, 34px); font-weight: 700; margin: 6px 0 2px; text-shadow: 0 2px 12px rgba(0, 0, 0, .6); }
.case-card .sub { font-size: 16px; color: var(--text); opacity: .9; }
.case-card .sep { height: 1px; background: var(--line-2); margin: 12px 0 10px; width: 62%; }
.case-card .tagline { font-size: 15px; line-height: 1.55; color: var(--text); opacity: .92; white-space: pre-line; margin: 0 0 14px; }
.case-card .foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; margin-top: auto; flex-wrap: wrap; }
.case-card .chips { display: flex; gap: 6px; flex-wrap: wrap; }
.case-card .btn.amber { padding: 10px 18px; min-height: 44px; font-size: 17px; white-space: nowrap; margin-left: auto; }
.case-card.soon { cursor: default; }
.case-card.soon h2, .case-card.soon .sub, .case-card.soon .tagline { opacity: .8; }
.case-card.soon:hover { transform: none; }
/* 하단 고정 참가 바 */
.join-bar { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: min(100%, 520px); z-index: 30; background: rgba(14, 16, 19, .96); backdrop-filter: blur(10px); border-top: 1px solid var(--line); padding: 12px 14px calc(12px + var(--safe-b)); display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.join-bar .code-field { min-width: 0; }
.join-bar .deco-text { font-size: 8px; line-height: 1.6; width: 52px; }
.join-bar .code-field { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line-2); border-radius: 14px; padding: 0 12px; height: 52px; background: var(--bg-deep); }
.join-bar .code-field svg { color: var(--beige); flex: 0 0 auto; }
.join-bar .code-field i { width: 1px; height: 28px; background: var(--line-2); }
.join-bar .code-field input { flex: 1; min-width: 0; background: none; border: 0; outline: none; font-family: var(--font-mono); font-size: 18px; letter-spacing: .18em; text-transform: uppercase; color: var(--text); }
.join-bar .code-field input::placeholder { font-family: var(--font-body); letter-spacing: 0; color: var(--muted-2); text-transform: none; }
.join-bar .btn { min-height: 52px; padding: 0 20px; border-radius: 14px; white-space: nowrap; }
.join-bar .hand { display: none; }
@media (min-width: 440px) { .join-bar { grid-template-columns: auto minmax(0, 1fr) auto auto; } .join-bar .hand { display: block; font-size: 14px; width: 84px; text-align: center; } }
.page.lobby { padding-bottom: 120px; }
.recent { margin: 0 0 14px; }
/* 지금 열린 방 */
.open-section { margin: 4px 0 6px; }
.open-list { display: grid; gap: 10px; margin-top: 12px; }
.open-empty { color: var(--muted); font-size: 14px; text-align: center; padding: 14px 12px; border: 1px dashed var(--line-2); border-radius: 14px; margin: 0; }
.open-room { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 12px 10px 10px; border: 1px solid var(--line); border-left: 4px solid var(--accent, var(--muted-2)); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-card); animation: fadeUp .2s ease; }
.open-room .thumb { width: 56px; height: 56px; border-radius: 8px; background-size: cover; background-position: center; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06); }
.open-room .tt { font-family: var(--font-display); font-size: 17px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.open-room .sub { font-size: 13px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.open-room .btn { min-height: 40px; padding: 6px 16px; font-size: 15px; }

/* ==========================================================================
   S2. 대기실
   ========================================================================== */
.waiting { position: relative; }
.waiting .deco-img { position: absolute; z-index: 0; pointer-events: none; opacity: .9; }
.waiting .deco-img.l { left: 0; top: 150px; width: 26%; max-width: 140px; -webkit-mask-image: linear-gradient(90deg, #000 40%, transparent); mask-image: linear-gradient(90deg, #000 40%, transparent); }
.waiting .deco-img.r { right: 0; top: 190px; width: 26%; max-width: 140px; -webkit-mask-image: linear-gradient(270deg, #000 40%, transparent); mask-image: linear-gradient(270deg, #000 40%, transparent); }
@media (max-width: 430px) { .waiting .deco-img { opacity: .55; } }
.waiting > *:not(.deco-img) { position: relative; z-index: 1; }
.room-code { text-align: center; margin: 4px 0 2px; }
.room-code .code {
  font-family: var(--font-display); font-weight: 900; font-size: clamp(56px, 17vw, 72px); letter-spacing: .14em; line-height: 1.05; color: var(--text);
  text-shadow: 0 2px 0 #000, 0 6px 18px rgba(0, 0, 0, .8);
  -webkit-mask-image: var(--grain), linear-gradient(#000, #000); mask-image: var(--grain), linear-gradient(#000, #000);
  -webkit-mask-composite: source-over; mask-composite: add;
  cursor: pointer; user-select: all; padding-left: .14em;
}
/* 게스트: 방 코드는 한 줄로 작게 (초대는 방장 몫 — QR·공유 블록은 방장에게만) */
.room-code.compact { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 0 0 12px; }
.room-code.compact .lbl { font-family: var(--font-display); letter-spacing: .28em; font-size: 12px; color: var(--muted); }
.room-code.compact .code { font-size: 26px; letter-spacing: .2em; padding-left: .2em; line-height: 1.2; text-shadow: 0 2px 0 #000; -webkit-mask-image: none; mask-image: none; }
.invite-btns { margin: 6px 0 8px; }
/* 방장: QR 은 기본 접힘 — 참가자 카드가 스크롤 없이 보이게 */
.qr-details { text-align: center; margin: 0 0 14px; }
.qr-details summary { cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; padding: 6px 14px; border: 1px dashed var(--line-2); border-radius: 999px; }
.qr-details summary::-webkit-details-marker { display: none; }
.qr-details[open] summary { color: var(--amber); border-color: rgba(232, 163, 61, .5); }
.qr-details .qr-card { margin-top: 12px; }
.qr-details .caption { margin-bottom: 4px; font-size: 13px; }
.qr-card { width: 150px; margin: 8px auto 10px; background: var(--cream); border-radius: 12px; padding: 8px; box-shadow: 0 12px 30px rgba(0, 0, 0, .6), inset 0 0 0 1px rgba(0, 0, 0, .1); cursor: pointer; }
.qr-card img { width: 100%; height: auto; border-radius: 6px; }
.caption { text-align: center; color: var(--muted); font-size: 15px; margin-bottom: 18px; }
.lobby-chips { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.slots { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.slot { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; min-height: 150px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 14px 8px 12px; }
.slot .name { font-size: 17px; font-weight: 500; }
.slot.empty { border-style: solid; }
.slot.empty .dashed { width: 76px; height: 76px; border-radius: 50%; border: 2px dashed var(--line-2); display: grid; place-items: center; color: var(--muted-2); }
.slot.empty .name { color: var(--muted); }
.slot.off { opacity: .55; }
.slot .host-badge { position: absolute; left: 8px; top: 8px; font-size: 11px; padding: 2px 8px; }
.slot .kick { position: absolute; right: 6px; top: 6px; background: none; border: 0; color: var(--muted-2); padding: 6px; border-radius: 50%; }
.slot .kick:hover { color: var(--red-soft); }
.disc {
  width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; font-family: var(--font-display); font-size: 30px; color: var(--text); font-weight: 700;
  background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, .18), transparent 55%), radial-gradient(circle at 70% 80%, rgba(0, 0, 0, .35), transparent 60%), var(--disc, #5A1F1F);
  box-shadow: inset 0 0 0 3px #3a3a3a, inset 0 0 0 4px #111, 0 8px 20px #000; position: relative; overflow: hidden;
}
.disc::after { content: ""; position: absolute; inset: 0; background: var(--grain); opacity: .5; mix-blend-mode: overlay; }
.disc.c1 { --disc: #5A1F1F; } .disc.c2 { --disc: #1F3140; } .disc.c3 { --disc: #1F3A2A; } .disc.c4 { --disc: #4A3416; }
.counter { margin: 20px 0 14px; }
#lobby-foot { margin-bottom: 22px; }
.start-hint { text-align: center; color: var(--muted); padding: 16px; border: 1px dashed var(--line-2); border-radius: 18px; }
.intro-card summary { cursor: pointer; font-family: var(--font-display); font-size: 17px; list-style: none; display: flex; align-items: center; gap: 8px; }
.intro-card summary::-webkit-details-marker { display: none; }

/* ==========================================================================
   S3. 역할지 — 봉투
   ========================================================================== */
.envelope-view { position: relative; min-height: calc(100dvh - var(--tabbar-h) - var(--safe-b)); margin: -18px -16px 0; padding: 24px 16px 40px; background: var(--bg-deep); text-align: center; display: flex; flex-direction: column; align-items: center; }
.envelope-view::before { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(50% 30% at 50% 0, rgba(255, 240, 200, .10), transparent 70%), var(--noise); }
.envelope-view > * { position: relative; }
.envelope-view .brand { color: var(--beige); }
.envelope-view .brand svg { width: 72px; height: 72px; }
.envelope-view .brand .name { font-family: var(--font-display); font-size: 16px; letter-spacing: .3em; }
.envelope-view .brand .tag { font-size: 11px; letter-spacing: .18em; color: var(--muted); }
.envelope-view .title { font-family: var(--font-display); font-size: 30px; margin: 16px 0; padding: 10px 0; position: relative; width: 60%; }
.envelope-view .title::before, .envelope-view .title::after { content: ""; position: absolute; left: 0; right: 0; height: 1px; background: linear-gradient(90deg, transparent, var(--beige), transparent); opacity: .6; }
.envelope-view .title::before { top: 0; } .envelope-view .title::after { bottom: 0; }
.envelope { width: 90%; max-width: 420px; margin: 18px auto 30px; border: 0; background: none; padding: 0; cursor: pointer; transition: transform .2s ease, opacity .4s ease; filter: drop-shadow(0 30px 40px #000); border-radius: 6px; }
.envelope img { width: 100%; border-radius: 6px; }
.envelope:hover { transform: translateY(-4px); }
.envelope.lift { transform: translateY(-10px); }
.envelope-view.opening .envelope, .envelope-view.opening .tap, .envelope-view.opening .title, .envelope-view.opening .brand { opacity: 0; transition: opacity .4s ease; }
.tap { color: var(--amber); display: flex; flex-direction: column; align-items: center; gap: 6px; }
.tap .ripple { position: relative; width: 64px; height: 64px; display: grid; place-items: center; }
.tap .ripple::before, .tap .ripple::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--amber); opacity: 0; animation: ripple 2s ease-out infinite; }
.tap .ripple::after { animation-delay: 1s; }
.tap .ripple svg { width: 40px; height: 40px; position: relative; }
.tap .label { font-family: var(--font-display); font-size: 21px; color: var(--text); }
@keyframes ripple { 0% { transform: scale(.4); opacity: .9; } 100% { transform: scale(1.3); opacity: 0; } }
.diamond-rule { margin-top: auto; padding-top: 30px; color: var(--muted-2); font-size: 12px; letter-spacing: .4em; }

/* ==========================================================================
   S3. 역할지 — 도시에
   ========================================================================== */
.dossier-hdr { position: relative; text-align: center; padding: 4px 0 10px; }
.dossier-hdr .ico { color: var(--beige); }
.dossier-hdr .ico svg { width: 30px; height: 30px; }
.dossier-hdr .rule { margin: 0 60px; font-size: 20px; letter-spacing: .08em; color: var(--text); }
.dossier-hdr .rule::before, .dossier-hdr .rule::after { flex: 0 0 34px; }
.dossier-hdr .sub { font-size: 11px; letter-spacing: .18em; color: var(--muted); margin-top: 2px; }
.dossier-hdr .deco-r { position: absolute; right: 0; top: 24px; text-align: right; border-bottom: 1px solid var(--muted-2); font-size: 8px; line-height: 1.6; }
.dossier-hdr .env-icon { position: absolute; left: 0; top: 18px; color: var(--muted); background: none; border: 0; padding: 6px; }
.dossier-hdr .env-icon svg { width: 26px; height: 26px; }
.dossier-view.enter { animation: fadeUp .5s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.dossier-stack { position: relative; margin: 10px 0 22px; }
.dossier-stack .sheet { position: absolute; inset: 0; background: #17191d; border: 1px solid var(--line); border-radius: 10px; }
.dossier-stack .sheet.s1 { transform: rotate(-1.6deg) translate(-4px, 6px); }
.dossier-stack .sheet.s2 { transform: rotate(1.1deg) translate(6px, -4px); }
.char-card { position: relative; background: #1a1c20; border: 1px solid var(--line-2); border-radius: 10px; padding: 18px 16px 18px; display: grid; grid-template-columns: 124px 1fr; gap: 16px; align-items: center; box-shadow: var(--shadow-card); overflow: hidden; }
.char-card::before { content: ""; position: absolute; inset: 0; background: var(--noise); opacity: .5; mix-blend-mode: screen; pointer-events: none; }
.char-card::after { content: ""; position: absolute; right: -1px; top: -1px; width: 26px; height: 26px; background: linear-gradient(225deg, var(--bg) 50%, #2d3037 50%); border-bottom-left-radius: 4px; box-shadow: -2px 2px 4px rgba(0, 0, 0, .4); }
.char-card > * { position: relative; }
.char-card .culprit-band { grid-column: 1 / -1; margin: -18px -16px 4px; padding: 8px 16px; background: var(--red-bg); color: var(--red-soft); font-family: var(--font-display); font-size: 15px; letter-spacing: .06em; text-align: center; border-bottom: 1px solid rgba(178, 58, 58, .5); }
.polaroid { position: relative; width: 116px; padding: 8px 8px 22px; background: linear-gradient(180deg, #efe8d8, #e2d9c3); transform: rotate(-3deg); box-shadow: 0 10px 24px rgba(0, 0, 0, .6); border-radius: 2px; }
.polaroid .photo { width: 100px; height: 108px; background: radial-gradient(circle at 50% 35%, #3a3d42, #16181b 70%); overflow: hidden; display: grid; place-items: center; }
.polaroid .photo img { width: 100%; height: 100%; object-fit: cover; filter: contrast(1.1) sepia(.2); }
.polaroid .clip { position: absolute; left: 4px; top: -16px; color: #e2ddd0; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .7)); }
.polaroid .clip svg { width: 30px; height: 30px; }
.polaroid .name-en { position: absolute; left: 0; right: 0; bottom: 3px; text-align: center; font-family: var(--font-script); font-size: 15px; color: #4a4338; line-height: 1; }
.char-card .info .eyebrow { font-size: 10px; }
.char-card .info h2 { font-size: clamp(30px, 9vw, 36px); font-weight: 700; margin: 4px 0 6px; text-shadow: 0 2px 10px rgba(0, 0, 0, .7); letter-spacing: .04em; }
.char-card .info .sep { height: 1px; background: var(--line-2); position: relative; margin: 0 0 8px; }
.char-card .info .sep::after { content: ""; position: absolute; left: 50%; top: -2px; width: 5px; height: 5px; border-radius: 50%; background: var(--line-2); transform: translateX(-50%); }
.char-card .info .meta { font-size: 17px; }
.char-card .info .rel { font-size: 15px; color: var(--muted); margin-top: 2px; }
.char-card .deco-text.corner { grid-column: 1 / -1; text-align: right; font-size: 8px; opacity: .5; margin: -6px 0 -8px; line-height: 1.5; }
.reveal-row { display: grid; grid-template-columns: auto 1px minmax(0, 1fr) auto; grid-template-areas: "rn vl st st" "rn vl tx tx"; gap: 4px 12px; align-items: center; padding: 12px 12px; border: 1px solid var(--line-2); border-radius: 10px; margin-bottom: 8px; background: var(--bg-deep); }
.reveal-row .rn { grid-area: rn; font-family: var(--font-display); letter-spacing: .12em; font-size: 13px; color: var(--muted); white-space: nowrap; align-self: center; }
.reveal-row .vl { grid-area: vl; width: 1px; height: 100%; min-height: 28px; background: var(--line-2); }
.reveal-row .tx { grid-area: tx; font-size: 16px; line-height: 1.5; }
.reveal-row .st { grid-area: st; justify-self: end; }
.reveal-row .st:empty { display: none; }
.reveal-row:not(.now) { grid-template-areas: "rn vl tx st"; }
.reveal-row:not(.now) .st { align-self: center; }
.reveal-row .st { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--muted-2); display: grid; place-items: center; }
.reveal-row.now { border: 2px solid var(--amber); background: rgba(232, 163, 61, .08); }
.reveal-row.now .rn { color: var(--amber); }
.reveal-row.now .st { width: auto; height: auto; border: 0; }
.reveal-row.done { opacity: .6; }
.reveal-row.done .st { border-color: var(--amber); color: var(--amber); }
.reveal-row.future .tx { color: var(--muted); }
.note-row { margin-top: 10px; padding: 10px 12px; border-radius: 8px; background: rgba(154, 148, 138, .08); color: var(--muted); font-size: 15px; }
.note-row b { color: var(--text); font-weight: 500; }

/* ==========================================================================
   S4. 라운드 진행
   ========================================================================== */
.dots { display: flex; justify-content: center; gap: 10px; margin: 10px 0 12px; }
.dots i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--muted-2); }
.dots i.on { background: var(--amber); border-color: var(--amber); }
.banner .sec-head { border: 0; padding-bottom: 4px; margin-bottom: 4px; }
.banner .sec-head h3 { font-size: 19px; }
.banner .tx { font-size: 17px; padding-left: 40px; }
.banner .hint { margin-top: 8px; padding: 10px 12px; border-radius: 8px; background: rgba(95, 195, 217, .08); border: 1px solid rgba(95, 195, 217, .35); font-size: 15px; }
.banner .hint b { color: var(--cyan); font-weight: 500; }
/* 나레이션 플레이어 */
.player { display: grid; grid-template-columns: 60px 1fr; gap: 14px; align-items: center; }
.player .pbtn { width: 60px; height: 60px; border-radius: 50%; border: 2px solid var(--amber); background: transparent; color: var(--amber); display: grid; place-items: center; transition: background .15s; }
.player .pbtn svg { width: 30px; height: 30px; }
.player .pbtn:hover { background: rgba(232, 163, 61, .12); }
.player .pbtn.busy { animation: pulse 1.2s infinite; }
.player .pbtn.attn { animation: attn 1.3s infinite; background: rgba(232, 163, 61, .14); }
@keyframes attn { 0%, 100% { box-shadow: 0 0 0 0 rgba(232, 163, 61, .55); } 60% { box-shadow: 0 0 0 12px rgba(232, 163, 61, 0); } }
.player .meta { display: flex; align-items: center; gap: 10px; min-width: 0; }
.player .voice { font-family: var(--font-display); font-size: 17px; flex: 0 0 auto; }
.player .wave { flex: 1; height: 34px; min-width: 0; }
.player .wave rect { fill: var(--muted-2); }
.player .wave rect.on { fill: var(--amber); }
.player .time { font-family: var(--font-mono); font-size: 11px; color: var(--muted); flex: 0 0 auto; white-space: nowrap; }
.player .track { grid-column: 1 / -1; position: relative; height: 4px; border-radius: 2px; background: var(--line-2); margin: 4px 4px 2px; }
.player .track .fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--amber); border-radius: 2px; transition: width .25s linear; }
.player .track .knob { position: absolute; top: 50%; left: 0; width: 14px; height: 14px; border-radius: 50%; background: var(--amber); transform: translate(-50%, -50%); box-shadow: 0 0 8px rgba(232, 163, 61, .6); transition: left .25s linear; }
.player .state { grid-column: 1 / -1; font-size: 12px; color: var(--muted); margin-top: -2px; }
.player .state:empty { display: none; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .5; } }
/* 장면 한 줄 + 인용 */
.lead-line { margin: 18px 0 12px; font-size: 18px; }
.story-quote { border: 0; margin: 0 0 16px; padding: 4px 0; }
.story-quote summary { list-style: none; cursor: pointer; color: var(--muted); font-size: 13px; letter-spacing: .1em; text-align: center; }
.story-quote summary::-webkit-details-marker { display: none; }
.story-quote .q { font-family: var(--font-display); font-size: 16px; line-height: 1.8; color: var(--text); padding: 10px 14px; margin-top: 8px; border-left: 2px solid var(--line-2); opacity: .9; }
/* 단서 카드 */
.clues { display: grid; gap: 10px; margin-bottom: 14px; }
.clue { display: grid; grid-template-columns: 76px 30px 1px minmax(0, 1fr); gap: 10px; align-items: center; min-height: 84px; padding: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-card); }
.clue .thumb { width: 76px; height: 56px; border-radius: 6px; overflow: hidden; background: var(--bg-deep); display: grid; place-items: center; color: var(--muted-2); border: 1px solid var(--line); }
.clue .thumb img { width: 100%; height: 100%; object-fit: cover; filter: brightness(.85); }
.clue .thumb svg { width: 30px; height: 30px; }
.clue .no { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; font-size: 14px; color: #111; background: var(--amber); }
.clue.digital .no { background: var(--cyan); }
.clue.digital .thumb svg { color: var(--cyan); opacity: .7; }
.clue.physical .thumb svg { color: var(--amber); opacity: .6; }
.clue .vl { width: 1px; height: 44px; background: var(--line-2); }
.clue .tt { font-family: var(--font-display); font-size: 17px; margin-bottom: 2px; }
.clue .tx { font-size: 15px; color: var(--muted); line-height: 1.5; white-space: pre-wrap; }
.clue .tx .t { font-family: var(--font-mono); color: var(--text); font-size: 14px; }
.clue.notitle .tx { color: var(--text); font-size: 16px; }
.discuss .sec-head { border: 0; padding-bottom: 4px; margin-bottom: 4px; }
.discuss .tx { font-size: 17px; padding-left: 40px; white-space: pre-wrap; }
/* 하단 액션 (타이머 링 + 버튼) */
.action-bar { position: fixed; bottom: calc(var(--tabbar-h) + var(--safe-b)); left: 50%; transform: translateX(-50%); width: min(100%, 520px); z-index: 25; background: linear-gradient(180deg, rgba(18, 20, 23, 0), var(--bg) 22px); padding: 26px 16px 10px; display: grid; grid-template-columns: auto 1px 1fr; gap: 14px; align-items: center; }
.page.has-action { padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 128px); }
.action-bar .vl { width: 1px; height: 60px; background: var(--line-2); }
.ring { position: relative; width: 84px; height: 84px; display: grid; place-items: center; background: none; border: 0; padding: 0; color: inherit; border-radius: 50%; }
.ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 6; }
.ring .track { stroke: var(--line-2); }
.ring .prog { stroke: var(--amber); stroke-linecap: round; transition: stroke-dashoffset 1s linear; }
.ring .val { font-family: var(--font-mono); font-size: 19px; font-weight: 700; color: var(--text); letter-spacing: .02em; }
.ring .lbl { position: absolute; bottom: 14px; font-size: 9px; color: var(--muted); letter-spacing: .1em; }
.ring.low .prog { stroke: var(--red); }
.ring.low .val { color: var(--red-soft); animation: pulse 1s infinite; }
.ring.paused .prog { stroke: var(--muted-2); }
.ring.paused .val { color: var(--muted); }
.ring.expired .val { color: var(--red-soft); font-size: 13px; }
.ring.expired .prog { stroke: var(--red); }
.action-bar .btn.amber { min-height: 60px; border-radius: 16px; font-size: 20px; width: 100%; }
.action-bar .btn.amber.urge { animation: glow 1.4s infinite; }
@keyframes glow { 0%, 100% { box-shadow: var(--shadow-btn); } 50% { box-shadow: 0 0 0 6px rgba(232, 163, 61, .25), 0 8px 22px rgba(232, 163, 61, .4); } }
.action-bar .wait { text-align: center; color: var(--muted); font-size: 15px; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
/* 자동 진행 상태 + 방장 소형 버튼 */
.auto-ctl { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.auto-ctl.center { align-items: center; margin-top: 12px; }
.auto-status { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); padding: 8px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); line-height: 1.35; }
.auto-status > span { min-width: 0; }
.auto-status b { white-space: nowrap; }
.auto-status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted-2); flex: 0 0 auto; }
.auto-status.live { color: var(--text); border-color: rgba(232, 163, 61, .5); }
.auto-status.live .dot { background: var(--amber); animation: pulse 1.2s infinite; }
.auto-status b { font-family: var(--font-mono); color: var(--amber); font-weight: 700; }
.auto-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.btn.xs { min-height: 34px; padding: 4px 12px; font-size: 13px; font-weight: 700; border-radius: 999px; }
.mt-s { margin-top: 8px; }
/* 대기실: 준비 체크 / 자동 시작 카운트다운 */
.slot .ready-check { position: absolute; right: 8px; top: 8px; width: 22px; height: 22px; border-radius: 50%; background: var(--amber); color: var(--amber-ink); display: grid; place-items: center; box-shadow: 0 2px 8px rgba(0, 0, 0, .5); }
.slot.ready { border-color: rgba(232, 163, 61, .55); }
.slot.ready .disc { box-shadow: inset 0 0 0 3px #3a3a3a, inset 0 0 0 4px #111, 0 0 0 2px var(--amber), 0 8px 20px #000; }
.start-count { text-align: center; padding: 14px; margin-bottom: 12px; border: 1px solid var(--amber); border-radius: 16px; background: rgba(232, 163, 61, .08); animation: glow 1.4s infinite; }
.start-count b { display: block; font-family: var(--font-display); font-size: 22px; color: var(--amber); }
.start-count b span { font-family: var(--font-mono); }
.start-count small { color: var(--muted); font-size: 13px; }
#lobby-foot .btn + .btn { margin-top: 8px; }
.cast .p.left { opacity: .45; text-decoration: line-through; }
/* 게임 중 우상단 메뉴 */
.top-menu { position: fixed; top: calc(6px + var(--safe-t)); right: calc(50% - min(50%, 260px) + 6px); z-index: 45; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line-2); background: rgba(18, 20, 23, .85); color: var(--muted); display: grid; place-items: center; backdrop-filter: blur(6px); }
.top-menu:hover { color: var(--text); }
.host-menu.top { top: calc(50px + var(--safe-t)); bottom: auto; left: auto; right: calc(50% - min(50%, 260px) + 8px); transform: none; width: min(80%, 300px); }
.host-menu button.danger { color: var(--red-soft); }
.host-menu button.danger svg { color: var(--red); }
.host-menu { position: fixed; z-index: 60; left: 50%; bottom: calc(var(--tabbar-h) + var(--safe-b) + 120px); transform: translateX(-50%); width: min(92%, 380px); background: var(--surface); border: 1px solid var(--line-2); border-radius: 14px; box-shadow: 0 20px 60px #000; padding: 8px; display: grid; gap: 4px; animation: fadeUp .18s ease; }
.host-menu button { background: none; border: 0; color: var(--text); text-align: left; padding: 12px 14px; border-radius: 10px; font-size: 16px; display: flex; align-items: center; gap: 10px; }
.host-menu button:hover { background: var(--surface-2); }
.host-menu button svg { width: 20px; height: 20px; color: var(--amber); }
.host-menu .hd { font-size: 11px; letter-spacing: .2em; color: var(--muted); padding: 6px 14px 2px; }
.prev-rounds { margin-top: 6px; }
.prev-rounds details { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; background: var(--surface); }
.prev-rounds summary { cursor: pointer; padding: 12px 14px; font-family: var(--font-display); color: var(--muted); list-style: none; display: flex; align-items: center; gap: 8px; }
.prev-rounds summary::-webkit-details-marker { display: none; }
.prev-rounds summary svg { transition: transform .2s; margin-left: auto; }
.prev-rounds details[open] summary svg { transform: rotate(180deg); }
.prev-rounds .body { padding: 0 12px 12px; }
.prev-rounds .body .clues { margin-bottom: 8px; }
.prev-rounds .body .clue { box-shadow: none; }
/* 참가자 미니 */
.cast { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 14px; }
.cast .p { display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 14px; }
.cast .p img, .cast .p .av { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; background: var(--surface-2); display: grid; place-items: center; font-family: var(--font-display); font-size: 13px; }
.cast .p.off { opacity: .5; }
.cast .p .dot { width: 7px; height: 7px; border-radius: 50%; background: #4fb286; }
.cast .p.off .dot { background: var(--red); }

/* ==========================================================================
   S5. 채팅
   ========================================================================== */
.chat-view { display: flex; flex-direction: column; min-height: calc(100dvh - var(--tabbar-h) - var(--safe-b) - 36px); }
.chat-log { flex: 1; display: flex; flex-direction: column; gap: 14px; padding: 6px 0 14px; }
.msg { display: grid; grid-template-columns: 36px 1fr; gap: 10px; align-items: end; max-width: 92%; }
.msg .av { width: 36px; height: 36px; border-radius: 50%; background: var(--line); border: 1px solid var(--line-2); display: grid; place-items: center; font-family: var(--font-display); font-size: 15px; color: var(--text); align-self: start; overflow: hidden; }
.msg .av img { width: 100%; height: 100%; object-fit: cover; }
.msg .who { font-family: var(--font-display); font-size: 15px; margin-bottom: 4px; }
.msg .who .t { font-family: var(--font-mono); color: var(--muted); font-size: 12px; margin-left: 8px; font-weight: 400; }
.msg .bubble { display: inline-block; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; font-size: 17px; line-height: 1.5; white-space: pre-wrap; }
/* 대화 속 시각 → 눌러서 타임라인에 담기. 말풍선 안에서 튀지 않게 점선 밑줄로만 "누를 수 있음"을 알린다.
   display:inline 이라 넉넉한 세로 패딩(터치 영역)이 줄 간격을 밀지 않는다. */
.msg .bubble .t-pick { display: inline; font: inherit; font-family: var(--font-mono); font-size: .95em; color: inherit; background: none; border: 0; border-radius: 6px; padding: 6px 4px; margin: 0 -1px; cursor: pointer; text-decoration: underline; text-decoration-style: dotted; text-decoration-color: var(--muted); text-underline-offset: 3px; -webkit-tap-highlight-color: transparent; }
.msg .bubble .t-pick:hover { color: var(--amber); text-decoration-color: var(--amber); }
.msg .bubble .t-pick.on { color: var(--amber); background: rgba(232, 163, 61, .16); text-decoration-style: solid; text-decoration-color: var(--amber); }
.msg .bubble .t-pick.just { animation: tpick-in .9s ease-out; }
@keyframes tpick-in { from { background: rgba(232, 163, 61, .5); } to { background: rgba(232, 163, 61, .16); } }
@media (prefers-reduced-motion: reduce) { .msg .bubble .t-pick.just { animation: none; } }
.msg.me { grid-template-columns: 1fr 36px; align-self: flex-end; text-align: right; }
.msg.me .av { border-color: var(--amber); color: var(--amber); background: rgba(232, 163, 61, .08); order: 2; }
.msg.me .who { color: var(--amber); }
.msg.me .bubble { border: 1.5px solid var(--amber); background: rgba(232, 163, 61, .08); text-align: left; }
.msg.cont { margin-top: -8px; }
.msg.cont .av, .msg.cont .who { visibility: hidden; height: 0; margin: 0; }
.msg.cont .av { height: 0; }
.msg.system { grid-template-columns: 1fr; max-width: 100%; align-self: stretch; margin: -4px 0; }
.msg.system .rule { font-size: 11px; letter-spacing: .12em; line-height: 1.5; }
.msg.system + .msg.system { margin-top: -8px; }
.chat-empty { text-align: center; color: var(--muted-2); padding: 40px 0; font-family: var(--font-display); }
/* 입력창은 .chat-dock(스코프 탭·코치·칩·입력창을 묶은 sticky 컨테이너) 안에 있다 */
.chat-input { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 14px; padding: 6px 6px 6px 16px; box-shadow: 0 10px 30px rgba(0, 0, 0, .6); }
.chat-input input { flex: 1; min-width: 0; background: none; border: 0; outline: none; font-size: 17px; color: var(--text); min-height: 44px; }
.chat-input input::placeholder { color: var(--muted-2); font-size: 18px; }
.chat-input button { width: 44px; height: 44px; border-radius: 10px; border: 0; background: none; color: var(--amber); display: grid; place-items: center; }
.chat-input button svg { width: 26px; height: 26px; }
/* --dock-h: 채팅 하단 도크(코치·칩·입력창) 실제 높이 — room.js 가 ResizeObserver 로 갱신한다. 칩이 늘어나도 '새 메시지' 알림이 도크를 가리지 않는다 */
.new-msg { position: fixed; bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px + var(--dock-h, 64px)); left: 50%; transform: translateX(-50%); z-index: 26; }
.new-msg .btn { min-height: 36px; padding: 6px 14px; font-size: 14px; background: var(--amber); color: var(--amber-ink); border: 0; box-shadow: var(--shadow-btn); }

/* ==========================================================================
   S6. 최종 투표
   ========================================================================== */
.vote-timer { font-family: var(--font-mono); font-size: 30px; color: var(--amber); text-shadow: 0 0 18px rgba(232, 163, 61, .45); margin-top: 2px; letter-spacing: .04em; }
.vote-timer.low { color: var(--red-soft); text-shadow: 0 0 18px rgba(178, 58, 58, .6); animation: pulse 1s infinite; }
.vote-timer.expired { font-size: 18px; color: var(--red-soft); font-family: var(--font-display); }
.guide { text-align: center; color: var(--text); font-size: 15px; line-height: 1.65; margin: 10px 0 18px; white-space: pre-line; }
.suspects { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 14px 0 6px; }
.suspect { background: none; border: 0; padding: 4px 0; display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--text); position: relative; }
.suspect .ph { position: relative; width: 74px; height: 74px; border-radius: 50%; overflow: visible; }
.suspect .ph img, .suspect .ph .fallback { width: 74px; height: 74px; border-radius: 50%; object-fit: cover; border: 2px solid var(--line-2); background: radial-gradient(circle at 50% 30%, #3a3d42, #101214 75%); transition: transform .2s ease, border-color .2s; display: grid; place-items: center; font-family: var(--font-display); font-size: 26px; }
.suspect .nm { font-family: var(--font-display); font-size: 15px; }
.suspect .pin { position: absolute; right: -4px; top: -4px; width: 26px; height: 26px; border-radius: 50%; background: var(--red); color: #fff; display: none; place-items: center; box-shadow: 0 2px 8px #000; }
.suspect .pin svg { width: 15px; height: 15px; }
.suspect.selected .ph img, .suspect.selected .ph .fallback { border: 3px solid var(--red); transform: scale(1.06); box-shadow: 0 0 20px rgba(178, 58, 58, .4); }
.suspect.selected .pin { display: grid; }
.suspect.selected .nm { color: var(--red-soft); }
.suspect.me { opacity: .45; cursor: not-allowed; }
.suspect.me .badge { position: absolute; top: 52px; font-size: 10px; padding: 1px 8px; }
.suspect:disabled { cursor: not-allowed; }
.btn-seal { display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; min-height: 60px; border-radius: 16px; font-family: var(--font-display); font-size: 22px; margin-top: 22px; }
.btn-seal img { width: 34px; height: 32px; border-radius: 4px; mix-blend-mode: multiply; }
.btn-seal.sealed { background: var(--surface-2); color: var(--muted); box-shadow: none; }
.seals { display: flex; justify-content: center; gap: 14px; margin: 22px 0 6px; }
.seals img { width: 46px; height: 48px; transition: transform .3s; }
.seals img.on { filter: drop-shadow(0 0 6px rgba(178, 58, 58, .5)); }
.seals-count { text-align: center; font-family: var(--font-display); font-size: 17px; color: var(--text); }
.clue-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.clue-chips .clue-chip { cursor: pointer; font-family: inherit; }
.clue-chips .clue-chip.on { border-color: rgba(232, 163, 61, .7); color: var(--amber); background: rgba(232, 163, 61, .12); }
.clue-chips .hint { flex-basis: 100%; font-size: 11px; }
.ai-vote-note { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 6px 0 0; }
/* 역할 고정·버린 방 정리 안내 (브리핑·대기실 한 줄) */
.notice-line { display: flex; align-items: flex-start; gap: 6px; margin: 10px 0 0; line-height: 1.4; }
.notice-line.center { justify-content: center; text-align: center; margin: 10px 0 4px; }
.notice-line svg { width: 13px; height: 13px; flex: none; margin-top: 2px; color: var(--beige); }
.leave-sheet .btn { min-height: 48px; }
.leave-sheet .btn.danger { color: var(--red-soft); }
.ai-vote-note svg { width: 14px; height: 14px; color: var(--beige); }
.vote-form.locked .input { opacity: .6; }

/* 봉인 카드 플립 (투표 결과) */
.flip-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; perspective: 1200px; margin: 10px 0 18px; }
.flip-card { position: relative; display: grid; min-height: 190px; transform-style: preserve-3d; transition: transform .8s cubic-bezier(.2, .7, .2, 1); }
.flip-card:nth-child(2) { transition-delay: .1s; } .flip-card:nth-child(3) { transition-delay: .2s; } .flip-card:nth-child(4) { transition-delay: .3s; }
.flip-grid.flipped .flip-card { transform: rotateY(180deg); }
.flip-card .face { grid-area: 1 / 1; min-width: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 12px; border: 1px solid var(--line-2); padding: 14px 12px; }
.flip-card .front { background: linear-gradient(160deg, #2a241c, #1a1712); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; }
.flip-card .front img { width: 56px; }
.flip-card .front .nm { font-family: var(--font-display); font-size: 16px; }
.flip-card .front .lk { font-size: 11px; letter-spacing: .2em; color: var(--muted); }
.flip-card .back { transform: rotateY(180deg); background: var(--surface); position: relative; }
.flip-card .back .nm { font-family: var(--font-display); font-size: 15px; color: var(--muted); }
.flip-card .back .pick { font-family: var(--font-display); font-size: 20px; margin: 2px 0 6px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.flip-card .back .pick .arrow { color: var(--red); font-size: 16px; }
.flip-card .back dl { margin: 0; font-size: 13px; }
.flip-card .back dt { color: var(--muted); font-size: 11px; letter-spacing: .1em; margin-top: 4px; }
.flip-card .back dd { margin: 0; line-height: 1.45; white-space: pre-wrap; color: var(--text); }
.flip-card .back .none { color: var(--muted-2); font-size: 14px; margin-top: 30px; text-align: center; }
.flip-card .back .verdict { position: absolute; right: 8px; top: 8px; }

/* ==========================================================================
   S7-A. 정답 공개
   ========================================================================== */
.stamp-wrap { display: flex; justify-content: center; padding: 22px 0 6px; }
.stamp { display: inline-block; padding: 8px 20px; border: 3px solid var(--red); border-radius: 8px; box-shadow: inset 0 0 0 3px var(--bg), inset 0 0 0 5px var(--red); color: var(--red); font-family: var(--font-display); font-weight: 900; font-size: clamp(28px, 8vw, 34px); letter-spacing: .06em; transform: rotate(-6deg); text-transform: uppercase; opacity: .95; position: relative; -webkit-mask-image: var(--grain), linear-gradient(#000, #000); mask-image: var(--grain), linear-gradient(#000, #000); -webkit-mask-composite: source-over; mask-composite: add; }
.stamp.animate { animation: stampIn .6s cubic-bezier(.2, 1.4, .3, 1) both; }
@keyframes stampIn { 0% { transform: rotate(-6deg) scale(1.6); opacity: 0; } 55% { transform: rotate(-6deg) scale(.96); opacity: 1; } 70% { transform: rotate(-5deg) scale(1.03) translate(1px, 0); } 85% { transform: rotate(-6.5deg) scale(1) translate(-1px, 1px); } 100% { transform: rotate(-6deg) scale(1); opacity: .95; } }
.culprit-portrait { display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 8px 0 18px; }
.culprit-portrait img, .culprit-portrait .fallback { width: 104px; height: 104px; border-radius: 50%; object-fit: cover; border: 3px solid var(--red); box-shadow: 0 0 30px rgba(178, 58, 58, .4); background: radial-gradient(circle at 50% 30%, #3a3d42, #101214 75%); display: grid; place-items: center; font-family: var(--font-display); font-size: 36px; }
.culprit-portrait .nm { font-family: var(--font-display); font-size: 18px; }
.culprit-portrait .nick { font-size: 13px; color: var(--muted); }
.results { display: grid; gap: 10px; margin-bottom: 14px; }
.result { display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; align-items: start; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.result .av { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; border: 1px solid var(--line-2); background: radial-gradient(circle at 50% 30%, #3a3d42, #101214 75%); display: grid; place-items: center; font-family: var(--font-display); }
.result .nm { font-family: var(--font-display); font-size: 16px; }
.result .nm small { color: var(--muted); font-family: var(--font-body); font-size: 12px; margin-left: 6px; }
.result .pick { font-size: 15px; margin: 2px 0 4px; }
.result .pick b { font-family: var(--font-display); font-weight: 700; }
.result dl { margin: 0; font-size: 14px; color: var(--muted); }
.result dt { font-size: 11px; letter-spacing: .1em; margin-top: 4px; }
.result dd { margin: 0; color: var(--text); white-space: pre-wrap; }
.roles-all details { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; background: var(--surface); }
.roles-all summary { cursor: pointer; padding: 12px 14px; list-style: none; display: flex; align-items: center; gap: 10px; font-family: var(--font-display); }
.roles-all summary::-webkit-details-marker { display: none; }
.roles-all summary .av { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.roles-all summary small { color: var(--muted); font-family: var(--font-body); font-size: 13px; }
.roles-all summary svg.chev { margin-left: auto; transition: transform .2s; }
.roles-all details[open] summary svg.chev { transform: rotate(180deg); }
.roles-all .body { padding: 0 12px 12px; }
.role-plain h4 { font-family: var(--font-display); font-size: 15px; color: var(--amber); margin: 12px 0 4px; letter-spacing: .05em; }
.role-plain h4.red { color: var(--red-soft); }
.role-plain p, .role-plain li { font-size: 15px; }
.role-plain ul { margin: 0; padding-left: 18px; }
.ending-cta { margin: 14px 0 6px; }

/* ==========================================================================
   S7-B. 엔딩 (전체 화면)
   ========================================================================== */
.ending-view { position: fixed; inset: 0; z-index: 80; background: #0A0A0B; color: var(--text); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 28px 60px; text-align: center; animation: fadeIn .8s ease both; cursor: pointer; }
.ending-view::before { content: ""; position: absolute; inset: 0; pointer-events: none; background: var(--grain); opacity: .35; mix-blend-mode: screen; animation: grain .4s steps(2) infinite; }
@keyframes grain { 0% { transform: translate(0, 0); } 50% { transform: translate(-6px, 4px); } 100% { transform: translate(4px, -6px); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.ending-view .text { text-wrap: balance; font-family: var(--font-display); font-size: clamp(20px, 5.6vw, 26px); line-height: 1.75; letter-spacing: .04em; max-width: 520px; min-height: 3.5em; white-space: pre-wrap; position: relative; }
.ending-view .text .cursor { display: inline-block; width: 2px; height: 1em; background: var(--amber); vertical-align: -.15em; margin-left: 2px; animation: blink 1s steps(2) infinite; }
.ending-view .text.final { font-size: clamp(22px, 6vw, 28px); }
@keyframes blink { 50% { opacity: 0; } }
.ending-view .listen { margin-top: 28px; position: relative; }
.ending-view .listen .btn { font-size: 17px; padding: 8px 20px 8px 10px; }
.ending-view .listen .btn .pc { width: 30px; height: 30px; border-radius: 50%; border: 1.5px solid var(--amber); display: grid; place-items: center; }
.ending-view .listen .btn .pc svg { width: 16px; height: 16px; }
.ending-view .skip-hint { position: absolute; top: calc(18px + var(--safe-t)); right: 20px; font-size: 12px; color: var(--muted-2); letter-spacing: .1em; }
.ending-view .progress { position: absolute; left: 36px; right: 36px; bottom: calc(40px + var(--safe-b)); height: 2px; background: #2a2a2c; }
.ending-view .progress i { display: block; height: 100%; width: 0; background: var(--amber); transition: width .4s linear; box-shadow: 0 0 8px rgba(232, 163, 61, .6); }
.ending-view .after { position: absolute; bottom: calc(60px + var(--safe-b)); left: 16px; right: 16px; display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; opacity: 0; transition: opacity 1s ease; pointer-events: none; }
.ending-view .after .btn { min-height: 44px; padding: 8px 16px; font-size: 15px; }
.ending-view .after.show { opacity: 1; pointer-events: auto; }

/* ==========================================================================
   하단 탭 바
   ========================================================================== */
.tabbar { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: min(100%, 520px); height: calc(var(--tabbar-h) + var(--safe-b)); padding-bottom: var(--safe-b); z-index: 40; background: var(--bg-deep); border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(4, 1fr); }
.tabbar button { position: relative; background: none; border: 0; color: var(--muted); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 13px; padding: 4px 0 0; white-space: nowrap; }
.tabbar button + button::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 1px; background: var(--line); }
.tabbar button svg { width: 26px; height: 26px; }
.tabbar button.active { color: var(--amber); }
.tabbar button.active::after { content: ""; position: absolute; bottom: 0; width: min(60px, 70%); height: 3px; background: var(--amber); border-radius: 3px 3px 0 0; }
.tabbar .bdg { position: absolute; top: 6px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; font-family: var(--font-mono); }
.conn { position: fixed; top: calc(21px + var(--safe-t)); right: calc(50% - min(50%, 260px) + 52px); z-index: 45; width: 8px; height: 8px; border-radius: 50%; background: var(--amber); opacity: .6; transition: opacity .3s; }
.conn.on { opacity: 0; }
#join-view:not(.hidden) ~ .conn { display: none; }
.conn.off { background: var(--red); opacity: 1; box-shadow: 0 0 10px var(--red); animation: pulse 1s infinite; }

/* ---------- 참가 폼 (room.html 토큰 없음) ---------- */
.join-view { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; padding: 30px 20px; }
.join-view .brand { text-align: center; color: var(--beige); margin-bottom: 20px; }
.join-view .brand svg { width: 72px; height: 72px; }
.join-view .brand .name { font-family: var(--font-display); letter-spacing: .3em; font-size: 16px; }
.join-view .brand .tag { font-size: 11px; letter-spacing: .18em; color: var(--muted); }
.join-view .code { font-family: var(--font-display); font-size: 44px; letter-spacing: .14em; text-align: center; font-weight: 900; padding-left: .14em; }

/* ---------- 모달 / 토스트 ----------
   모바일 키보드 대응: 세로 중앙이 아니라 상단 정렬 + 컨테이너 100dvh 안에서 스크롤.
   --kb 는 JS(visualViewport)가 넣는 키보드 높이(iOS Safari 용, 그 외 0). */
.modal-bg {
  position: fixed; inset: 0; height: 100vh; height: 100dvh; z-index: 70;
  display: flex; align-items: flex-start; justify-content: center;
  padding: max(10vh, var(--safe-t)) 16px calc(24px + var(--safe-b) + var(--kb, 0px));
  overflow: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  background: rgba(0, 0, 0, .7); backdrop-filter: blur(4px);
}
.modal { flex: 0 0 auto; width: min(100%, 440px); background: var(--surface); border: 1px solid var(--line-2); border-radius: 20px; padding: 22px 20px 22px; box-shadow: 0 20px 60px #000; animation: sheetUp .28s cubic-bezier(.2, .8, .2, 1); position: relative; }
.modal h2 { font-size: 22px; margin: 0 0 4px; }
.modal .meta { color: var(--muted); font-size: 14px; margin-bottom: 14px; }
.modal .btn-grid { margin-top: 6px; }
.btn.danger { background: var(--red-bg); border-color: var(--red); color: var(--red-soft); }
@keyframes sheetUp { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
/* 옵션 토글 (자동 진행 등) */
.opt-toggle { display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin: 0 0 14px; border: 1px solid var(--line-2); border-radius: 14px; background: var(--bg-deep); cursor: pointer; user-select: none; }
.opt-toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.opt-toggle .sw { flex: 0 0 auto; width: 44px; height: 26px; border-radius: 13px; background: var(--line-2); position: relative; transition: background .15s; }
.opt-toggle .sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--muted); transition: transform .15s, background .15s; }
.opt-toggle input:checked + .sw { background: var(--amber); }
.opt-toggle input:checked + .sw::after { transform: translateX(18px); background: var(--amber-ink); }
.opt-toggle input:focus-visible + .sw { outline: 2px solid var(--amber); outline-offset: 2px; }
.opt-toggle .tx { display: flex; flex-direction: column; line-height: 1.3; }
.opt-toggle .tx b { font-size: 15px; font-weight: 700; }
.opt-toggle .tx small { font-size: 12px; color: var(--muted); }
.opt-toggle.mt { margin-top: 12px; margin-bottom: 0; }
.opt-toggle.mt-s { margin-top: 8px; margin-bottom: 0; }
#toast { position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + var(--safe-b) + 24px); transform: translateX(-50%); z-index: 100; display: grid; gap: 8px; pointer-events: none; width: min(92vw, 420px); }
.toast { background: rgba(28, 31, 36, .96); border: 1px solid var(--line-2); color: var(--text); padding: 10px 16px; border-radius: 12px; box-shadow: var(--shadow-card); font-size: 15px; animation: fadeUp .2s ease; text-align: center; backdrop-filter: blur(8px); }
.toast.error { border-color: var(--red); }
.toast.ok { border-color: var(--amber); }

/* ---------- 외부 브라우저 유도 오버레이 ---------- */
.ext-overlay { position: fixed; inset: 0; z-index: 200; background: rgba(10, 11, 13, .97); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 24px; text-align: center; color: var(--text); font-family: var(--font-body); }
.ext-overlay::before { content: ""; position: absolute; inset: 0; background: var(--noise); opacity: .5; mix-blend-mode: screen; pointer-events: none; }
.ext-overlay > * { position: relative; }
.ext-overlay .ico { color: var(--amber); margin-bottom: 8px; }
.ext-overlay h2 { font-family: var(--font-display); font-size: 24px; margin-bottom: 10px; }
.ext-overlay p { color: var(--muted); font-size: 16px; line-height: 1.6; max-width: 320px; margin: 0 auto 26px; }
.ext-overlay p b { color: var(--text); font-weight: 500; }
.ext-overlay .btn.amber { min-height: 58px; font-size: 19px; width: min(100%, 320px); border-radius: 16px; }
.ext-overlay .link-btn { margin-top: 16px; }

/* ---------- 모션 축소 ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .flip-card { transition: none; }
  .ending-view::before { animation: none; }
}

/* ---------- AI 참가자 ---------- */
.badge.ai { color: var(--cyan); border-color: rgba(95, 195, 217, .55); background: rgba(95, 195, 217, .1); font-family: var(--font-mono); letter-spacing: .08em; }
.badge.ai.xs { font-size: 10px; padding: 1px 6px; margin-left: 6px; vertical-align: middle; }
.slot.ai .disc { color: var(--cyan); background: radial-gradient(circle at 50% 30%, #253238, #101214 75%); }
.slot.ai .disc svg { width: 34px; height: 34px; }
.slot .host-badge.ai { left: 8px; right: auto; z-index: 2; }
.slot.ai-add { padding: 0; }
.slot .add-ai { width: 100%; height: 100%; min-height: 150px; background: none; border: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--cyan); cursor: pointer; border-radius: 12px; }
.slot .add-ai .dashed { width: 76px; height: 76px; border-radius: 50%; border: 2px dashed rgba(95, 195, 217, .6); display: grid; place-items: center; color: var(--cyan); transition: background .15s, transform .15s; }
.slot .add-ai:hover .dashed, .slot .add-ai:focus-visible .dashed { background: rgba(95, 195, 217, .12); transform: scale(1.04); }
.slot .add-ai .name { color: var(--cyan); font-weight: 700; }
.slot .add-ai:disabled { color: var(--muted-2); cursor: not-allowed; }
.slot .add-ai:disabled .dashed { border-color: var(--line-2); color: var(--muted-2); }
.slot .add-ai:disabled .name { color: var(--muted); }
.slot.ai-add small { position: absolute; bottom: 8px; font-size: 11px; }
.ai-level { padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 14px; background: var(--bg-deep); margin-bottom: 14px; }
.ai-level.mt { margin-top: 8px; margin-bottom: 0; }
.ai-level .lbl { font-size: 15px; font-weight: 700; margin-bottom: 8px; }
.ai-level .lbl small { font-weight: 400; font-size: 12px; }
.ai-level small.muted { display: block; margin-top: 6px; font-size: 12px; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 3px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line-2); }
.seg button { border: 0; background: none; color: var(--muted); padding: 9px 6px; border-radius: 9px; font-size: 15px; font-weight: 700; cursor: pointer; transition: background .15s, color .15s; }
.seg button.on { background: var(--amber); color: var(--amber-ink); }
.seg button:focus-visible { outline: 2px solid var(--amber); outline-offset: 1px; }
.open-room .ai-mark { color: var(--cyan); font-family: var(--font-mono); font-size: 12px; }
.msg.ai .av { border-color: rgba(95, 195, 217, .55); color: var(--cyan); background: rgba(95, 195, 217, .08); }
.msg.ai .bubble { border-color: rgba(95, 195, 217, .35); }
.typing { display: flex; align-items: center; gap: 8px; padding: 6px 14px 10px; font-size: 13px; color: var(--muted); }
.typing .dots { display: inline-flex; gap: 3px; }
.typing .dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--cyan); opacity: .35; animation: typingDot 1.2s infinite; }
.typing .dots i:nth-child(2) { animation-delay: .2s; }
.typing .dots i:nth-child(3) { animation-delay: .4s; }
@keyframes typingDot { 0%, 60%, 100% { opacity: .35; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .typing .dots i { animation: none; opacity: .8; } }

/* ==========================================================================
   S8. 진행 흐름 (역할 숙지 / 진술 순서 / 단계 안내 / 필수 공개 / 결산 / 해설 / 일시정지 / 이어하기)
   ========================================================================== */
/* 게임 중 상단: 대화 수단 칩 + 인물표 (우상단 ⋯ 버튼 자리를 비워 둔다) */
.game-head { display: flex; flex-direction: column; gap: 8px; padding: 2px 44px 10px 0; margin-bottom: 4px; border-bottom: 1px dashed var(--line); }
.game-head .chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip.sm { padding: 3px 10px; font-size: 12px; gap: 5px; }
.chip.sm svg { width: 14px; height: 14px; }
.chip.talk { color: var(--beige); border-color: rgba(201, 185, 154, .45); }
.chip.talk.voice { color: var(--cyan); border-color: rgba(95, 195, 217, .5); }
.chip.talk.voice svg { color: var(--cyan); }
.chip.npc { color: var(--muted); }
.castmap { display: flex; flex-wrap: wrap; gap: 6px; }
.castmap .cm { display: inline-flex; align-items: baseline; gap: 4px; padding: 3px 10px; border-radius: 6px; background: var(--surface); border: 1px solid var(--line); font-size: 13px; color: var(--text); }
.castmap .cm b { font-family: var(--font-display); color: var(--amber); font-size: 14px; }
.castmap .cm small { color: var(--muted-2); font-size: 11px; margin-left: 2px; }
.castmap .cm.me { border-color: rgba(232, 163, 61, .5); }
.castmap .cm.npc { opacity: .7; border-style: dashed; }
.amber-text { color: var(--amber); }
/* 진행 안내 카드 (대기실 / 역할 숙지) */
.guide-card summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; font-family: var(--font-display); font-size: 17px; }
.guide-card summary::-webkit-details-marker { display: none; }
.guide-card summary .eyebrow { font-size: 9px; letter-spacing: .22em; margin-left: 2px; }
.guide-card summary svg.chev { margin-left: auto; transition: transform .2s; }
.guide-card[open] summary svg.chev { transform: rotate(180deg); }
.guide-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 10px; }
.guide-list li { display: grid; gap: 2px; padding: 10px 12px; border-radius: 8px; background: var(--bg-deep); border: 1px solid var(--line); }
.guide-list li b { font-family: var(--font-display); color: var(--amber); font-size: 15px; }
.guide-list li span { font-size: 14px; color: var(--text); line-height: 1.5; }
.seg.two { grid-template-columns: repeat(2, 1fr); }
.talk-mode .seg button.on { background: var(--cyan); color: #0b1a1f; }
.slot .off-note { font-size: 11px; margin-top: -4px; }
/* 역할 숙지 */
.brief-list .p.done { border-color: rgba(232, 163, 61, .55); }
.brief-list .p .st { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--muted-2); display: grid; place-items: center; color: var(--amber-ink); flex: 0 0 auto; }
.brief-list .p.done .st { background: var(--amber); border-color: var(--amber); }
.brief-bar { position: fixed; bottom: calc(var(--tabbar-h) + var(--safe-b)); left: 50%; transform: translateX(-50%); width: min(100%, 520px); z-index: 25; background: linear-gradient(180deg, rgba(18, 20, 23, 0), var(--bg) 22px); padding: 26px 16px 10px; display: grid; grid-template-columns: auto 1px 1fr; gap: 14px; align-items: center; }
body.has-brief .page:not(#tab-chat) { padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 110px); }
.brief-bar .cnt { text-align: center; min-width: 64px; }
.brief-bar .cnt b { display: block; font-family: var(--font-display); font-size: 26px; color: var(--amber); line-height: 1; }
.brief-bar .cnt b .muted { font-size: 16px; }
.brief-bar .cnt small { display: block; font-family: var(--font-mono); font-size: 11px; color: var(--muted); margin-top: 4px; }
.brief-bar .vl { width: 1px; height: 52px; background: var(--line-2); }
.brief-bar .btn { width: 100%; min-height: 56px; border-radius: 16px; font-size: 19px; }
.brief-bar .wait { text-align: center; color: var(--text); font-size: 15px; padding: 10px 14px; border: 1px solid rgba(232, 163, 61, .5); border-radius: 16px; background: var(--surface); display: flex; flex-direction: column; align-items: center; gap: 2px; }
.brief-bar .wait small { color: var(--muted); font-size: 12px; }
.brief-bar .wait svg { color: var(--amber); vertical-align: -3px; }
/* 대기실 하단 고정 바 — brief-bar 와 같은 자리·패턴. 360px 폭에서 한 줄(상태 | 버튼) + 안내 한 줄 */
.lobby-bar { position: fixed; bottom: calc(var(--tabbar-h) + var(--safe-b)); left: 50%; transform: translateX(-50%); width: min(100%, 520px); z-index: 25; background: linear-gradient(180deg, rgba(18, 20, 23, 0), var(--bg) 22px); padding: 24px 16px 10px; }
body.has-lobby .page:not(#tab-chat) { padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 140px); }
.lobby-bar .row { display: grid; grid-template-columns: auto 1px minmax(0, 1fr); gap: 12px; align-items: center; }
.lobby-bar .cnt { text-align: center; min-width: 58px; max-width: 88px; }
.lobby-bar .cnt b { display: block; font-family: var(--font-display); font-size: 26px; color: var(--amber); line-height: 1; white-space: nowrap; }
.lobby-bar .cnt b .muted { font-size: 16px; }
.lobby-bar .cnt small { display: block; font-family: var(--font-mono); font-size: 11px; color: var(--muted); margin-top: 4px; line-height: 1.3; }
.lobby-bar .vl { width: 1px; height: 52px; background: var(--line-2); }
.lobby-bar .main { min-width: 0; }
.lobby-bar .btn { width: 100%; min-height: 56px; border-radius: 16px; font-size: 18px; padding: 8px 12px; white-space: nowrap; }
.lobby-bar .btn.serif { font-family: var(--font-display); font-weight: 700; }
.lobby-bar .btns { display: flex; gap: 8px; }
.lobby-bar .btns .btn { flex: 1 1 0; min-width: 0; font-size: 15px; padding: 8px 6px; gap: .25em; }
.lobby-bar .btns .btn svg { flex: 0 0 auto; }
/* 인원이 다 찼거나 전원 준비되면 시작 버튼에 가벼운 펄스 (모션 축소 설정 존중) */
.lobby-bar .btn.amber.urge { animation: glow 1.4s infinite; }
.lobby-bar .wait { text-align: center; color: var(--text); font-size: 15px; padding: 8px 12px; min-height: 56px; border: 1px dashed var(--line-2); border-radius: 16px; background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.lobby-bar .wait small { color: var(--muted); font-size: 12px; }
/* 자동 시작 카운트다운: 본문의 .start-count 를 바로 옮긴 것 */
.lobby-bar .count { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 56px; padding: 6px 8px 6px 12px; border: 1px solid var(--amber); border-radius: 16px; background: rgba(232, 163, 61, .08); animation: glow 1.4s infinite; }
.lobby-bar .count > span { min-width: 0; }
.lobby-bar .count b { display: block; font-family: var(--font-display); font-size: 19px; color: var(--amber); line-height: 1.1; white-space: nowrap; }
.lobby-bar .count b span { font-family: var(--font-mono); }
.lobby-bar .count small { display: block; color: var(--muted); font-size: 11px; }
.lobby-bar .count .btn { width: auto; min-height: 36px; font-size: 13px; padding: 4px 10px; border-radius: 999px; flex: 0 0 auto; }
.lobby-bar .note { margin: 8px 0 0; text-align: center; color: var(--muted); font-size: 12px; line-height: 1.45; }
.lobby-bar .note .link-btn { font-size: 12px; padding: 2px 4px; }
.lobby-bar .note .link-btn.ai { color: var(--cyan); }
.lobby-bar .note .link-btn svg { vertical-align: -3px; }
@media (prefers-reduced-motion: reduce) { .lobby-bar .btn.amber.urge, .lobby-bar .count { animation: none; } }
/* 진술 순서 칩 열 */
.speak-order { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 10px; }
.speak-order:empty { display: none; }
.speak-order .lbl { font-family: var(--font-display); font-size: 12px; letter-spacing: .2em; color: var(--muted); margin-right: 2px; }
.speak-order .so { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px 3px 4px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 13px; }
.speak-order .so b { width: 20px; height: 20px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--line-2); display: grid; place-items: center; font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
.speak-order .so.me { border-color: rgba(232, 163, 61, .55); }
.speak-order .so.me b { background: var(--amber); color: var(--amber-ink); border-color: var(--amber); }
.speak-order .arr { color: var(--muted-2); font-style: normal; font-size: 12px; }
.speak-order small { flex-basis: 100%; font-size: 11px; }
/* 라운드 단계 스텝바 (소프트 안내) */
.steps { list-style: none; margin: 0 0 14px; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.steps li { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg-deep); font-size: 11px; color: var(--muted-2); text-align: center; line-height: 1.25; transition: border-color .3s, color .3s, background .3s; }
.steps li i { font-style: normal; font-family: var(--font-display); font-size: 16px; color: var(--muted-2); }
.steps li.past { color: var(--muted); }
.steps li.past i { color: var(--muted); }
.steps li.on { border-color: var(--amber); background: rgba(232, 163, 61, .1); color: var(--text); }
.steps li.on i { color: var(--amber); }
/* 필수 공개 토글 */
.reveal-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 6px 40px; }
.reveal-row .reveal-actions { margin: 8px 0 0; }
.banner small.muted { display: block; padding-left: 40px; font-size: 12px; }
.banner.done { border-color: rgba(232, 163, 61, .45); }
.banner.done .tx { color: var(--muted); }
.reveal-row.completed { border-color: var(--amber); background: rgba(232, 163, 61, .04); }
.reveal-row.completed .tx { color: var(--muted); }
/* 액션 바: 다음 단계 라벨 + 공개 경고 행 */
.next-step { font-size: 12px; color: var(--muted); letter-spacing: .04em; padding-left: 2px; }
.next-step:empty { display: none; }
.action-bar .warn-row { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--red); background: var(--red-bg); color: var(--red-soft); font-size: 13px; line-height: 1.35; }
.action-bar .warn-row .ico { flex: 0 0 auto; display: grid; place-items: center; }
.action-bar .warn-row > span { min-width: 0; flex: 1; }
.action-bar .warn-row b { color: #fff; font-weight: 700; }
.action-bar .warn-row em { font-style: normal; color: var(--amber); }
.action-bar .warn-row .btn { flex: 0 0 auto; }
/* 일시정지 */
.paused-card .tx { font-size: 16px; }
.paused-card .btn.danger { border-color: var(--red); color: var(--red-soft); background: transparent; }
.pause-opts { display: grid; gap: 8px; margin-top: 8px; }
.pause-opts .btn { flex-direction: column; gap: 2px; min-height: 58px; padding: 10px 16px; line-height: 1.2; }
.pause-opts .btn small { font-weight: 400; font-size: 12px; opacity: .85; }
.pause-opts .btn.amber small { color: var(--amber-ink); }
/* 최종 투표 안내 */
.vote-rules { text-align: center; font-size: 13px; color: var(--muted); line-height: 1.55; margin: 4px 0 6px; padding: 8px 12px; border: 1px dashed var(--line-2); border-radius: 10px; }
.vote-rules b { color: var(--text); font-weight: 500; }
.suspect .nm b { color: var(--amber); font-weight: 700; }
.field-label small { font-weight: 400; font-size: 11px; margin-left: 6px; }
.skipped-card summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; font-family: var(--font-display); font-size: 16px; }
.skipped-card summary::-webkit-details-marker { display: none; }
.skipped-card summary svg.chev { margin-left: auto; transition: transform .2s; }
.skipped-card[open] summary svg.chev { transform: rotate(180deg); }
/* 결산 */
.verdict-banner { text-align: center; padding: 16px 12px 14px; margin: 22px 0 4px; border-radius: 14px; border: 2px solid var(--amber); background: linear-gradient(180deg, rgba(232, 163, 61, .14), rgba(232, 163, 61, .03)); }
.verdict-banner .eyebrow { font-size: 10px; letter-spacing: .3em; }
.verdict-banner .big { font-family: var(--font-display); font-weight: 900; font-size: clamp(26px, 7vw, 32px); letter-spacing: .08em; margin: 2px 0; color: var(--amber); text-shadow: 0 2px 12px rgba(0, 0, 0, .6); }
.verdict-banner .sub { font-size: 14px; color: var(--text); }
.verdict-banner.lose { border-color: var(--red); background: linear-gradient(180deg, rgba(178, 58, 58, .18), rgba(178, 58, 58, .04)); }
.verdict-banner.lose .big { color: var(--red-soft); }
.result.culprit { border-color: rgba(178, 58, 58, .5); }
.result dl dt.note { color: var(--muted-2); font-size: 10px; letter-spacing: .06em; margin-top: 6px; }
.badge.xs { font-size: 10px; padding: 1px 6px; margin-left: 6px; vertical-align: middle; }
.goal-self .seg { margin: 4px 0 10px; }
.goal-self .goal-list { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.goal-self .goal-list .chip b { color: var(--muted); font-weight: 700; }
.goal-self .goal-list .chip.kept { border-color: rgba(232, 163, 61, .55); }
.goal-self .goal-list .chip.kept b { color: var(--amber); }
.goal-self .goal-list .chip.missed { border-color: rgba(178, 58, 58, .55); }
.goal-self .goal-list .chip.missed b { color: var(--red-soft); }
.goal-self small.muted { display: block; font-size: 12px; }
/* 해설: 투표 매트릭스 */
.matrix-wrap { overflow-x: auto; }
.matrix { width: 100%; border-collapse: collapse; font-size: 13px; }
.matrix th, .matrix td { border: 1px solid var(--line-2); padding: 8px 6px; text-align: center; }
.matrix thead th { background: var(--bg-deep); font-family: var(--font-display); color: var(--muted); font-size: 12px; }
.matrix thead th small { display: block; font-family: var(--font-body); font-size: 10px; color: var(--muted-2); }
.matrix thead th.culprit { color: var(--red-soft); border-bottom: 2px solid var(--red); }
.matrix tbody th { text-align: left; font-weight: 500; white-space: nowrap; font-family: var(--font-display); }
.matrix td { font-size: 16px; }
.matrix td.self { color: var(--muted-2); background: rgba(154, 148, 138, .06); }
.matrix td.hit { color: var(--amber); background: rgba(232, 163, 61, .12); }
.matrix td.miss { color: var(--red-soft); }
.ending-cta .btn small { display: block; font-size: 12px; font-weight: 400; opacity: .8; }
.ending-cta .btn.amber.big { flex-direction: column; gap: 0; }
.ending-page .btn.block + .btn.block { margin-top: 8px; }
.ending-view .ending-kind { position: absolute; top: calc(18px + var(--safe-t)); left: 20px; font-size: 12px; color: var(--red-soft); letter-spacing: .1em; }
/* 채팅: 시스템 대행 공개 */
.msg.system.npc-reveal .rule { color: var(--amber); letter-spacing: .02em; font-size: 13px; }
.msg.system.npc-reveal .rule::before, .msg.system.npc-reveal .rule::after { background: linear-gradient(90deg, transparent, rgba(232, 163, 61, .5)); }
/* 참가 화면: 이어하기 */
.join-resume { margin-top: 6px; }
.join-resume .link-btn { margin-top: 6px; }
/* 로비: 방금 플레이한 사건 표시 */
.case-card.played { opacity: .75; }
.case-card .played-note { font-size: 11px; color: var(--amber); letter-spacing: .04em; margin-bottom: 4px; }

/* ==========================================================================
   음성 채팅 / 밀담 / 쿠폰  (docs/VOICE_WHISPER.md)
   ========================================================================== */
/* 진행 탭 상단 음성 바 */
.voice-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0 2px; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--surface); }
.voice-bar .btn { min-height: 38px; }
.voice-bar .vinfo { font-size: 13px; color: var(--muted); flex: 1; min-width: 0; }
.voice-bar .verr { flex-basis: 100%; font-size: 12px; color: var(--red-soft); line-height: 1.5; }
.voice-bar .vwarn { flex-basis: 100%; font-size: 12px; color: var(--muted-2); line-height: 1.5; }

/* 참가자 칩: 음성 상태 (연결 점 · 말하는 중 펄스 · 밀담 중) */
.cast .p { position: relative; }
.cast .p.in-voice .dot { background: #4fb286; }
.cast .p[data-rtc="connecting"] .dot, .cast .p[data-rtc="new"] .dot { background: var(--amber); }
.cast .p[data-rtc="failed"] .dot, .cast .p[data-rtc="disconnected"] .dot { background: var(--red); }
.cast .p.mic-off .dot { background: var(--muted-2); }
.cast .p.speaking { border-color: var(--amber); box-shadow: 0 0 0 1px var(--amber); animation: speakPulse 1.1s ease-in-out infinite; }
.cast .p.whispering { border-style: dashed; border-color: rgba(232, 163, 61, .7); }
@keyframes speakPulse { 0%, 100% { box-shadow: 0 0 0 1px var(--amber); } 50% { box-shadow: 0 0 0 3px rgba(232, 163, 61, .35); } }
.cast .p .ask-whisper { width: 26px; height: 26px; margin-left: 2px; border-radius: 50%; border: 1px solid var(--line-2); background: transparent; color: var(--muted); display: grid; place-items: center; flex: none; }
.cast .p .ask-whisper:hover, .cast .p .ask-whisper:focus-visible { color: var(--amber); border-color: var(--amber); }

/* 밀담 바 (화면 상단 고정) */
.whisper-bar { position: fixed; top: var(--safe-t); left: 50%; transform: translateX(-50%); width: min(100%, 520px); z-index: 44; display: flex; align-items: center; gap: 10px; padding: 8px 56px 8px 14px; background: linear-gradient(180deg, rgba(232, 163, 61, .16), rgba(232, 163, 61, .06)), var(--bg-deep); border-bottom: 1px solid var(--amber); animation: fadeUp .2s ease; }
.whisper-bar .ico { color: var(--amber); display: grid; place-items: center; flex: none; }
.whisper-bar .who { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.whisper-bar .who b { font-size: 14px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.whisper-bar .who small { font-size: 11px; color: var(--muted); letter-spacing: .04em; }
.whisper-bar .t { font-family: var(--font-mono); font-size: 16px; color: var(--amber); flex: none; }
.whisper-bar .t.low { color: var(--red-soft); animation: blink 1s steps(2) infinite; }
.whisper-bar .btn { min-height: 30px; padding: 4px 10px; font-size: 13px; flex: none; }
body.has-whisper .page { padding-top: calc(18px + 46px); }
body.has-whisper .top-menu { top: calc(52px + var(--safe-t)); }
body.has-whisper .conn { top: calc(67px + var(--safe-t)); }
body.has-whisper .chat-me { top: calc(52px + var(--safe-t)); }

/* 밀담 요청 모달: 상대 고르기 */
.whisper-picks { display: grid; gap: 8px; margin: 12px 0; }
.wh-pick { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 14px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--surface); color: var(--text); text-align: left; }
.wh-pick .nm { font-family: var(--font-display); font-size: 15px; }
.wh-pick .sub { font-size: 12px; color: var(--muted); }
.wh-pick.on { border-color: var(--amber); background: rgba(232, 163, 61, .1); }
.wh-pick.on .nm { color: var(--amber); }
.whisper-count { text-align: center; font-size: 13px; color: var(--muted); margin: 8px 0 2px; }
.whisper-count b { font-family: var(--font-mono); font-size: 18px; color: var(--amber); }

/* 채팅: 밀담 스코프 탭 + 밀담 말풍선 */
.chat-scope { display: flex; gap: 6px; }
.chat-scope button { flex: 1; min-height: 34px; display: inline-flex; align-items: center; justify-content: center; gap: 5px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); color: var(--muted); font-size: 13px; }
.chat-scope button.on { border-color: var(--amber); color: var(--amber); background: rgba(232, 163, 61, .12); }
.chat-scope button svg { width: 14px; height: 14px; }
.msg.whisper .bubble { border: 1.5px dashed var(--amber); background: rgba(232, 163, 61, .08); }
.msg.whisper .av { border-color: var(--amber); color: var(--amber); }

/* 로비: 쿠폰 게이트 */
.coupon-note { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 0 0 12px; padding: 8px 12px; border: 1px dashed var(--line-2); border-radius: 10px; font-size: 13px; color: var(--muted); }
.coupon-note svg { color: var(--amber); flex: none; }
.cap-note { margin: 0 0 12px; padding: 10px 12px; border: 1px solid var(--red); border-radius: 10px; background: rgba(178, 58, 58, .12); color: var(--red-soft); font-size: 13px; text-align: center; }
.coupon-field .input.mono { font-family: var(--font-mono); letter-spacing: .16em; text-transform: uppercase; }
.coupon-field small { display: block; margin-top: 6px; font-size: 12px; line-height: 1.5; }
.coupon-field small.err { color: var(--red-soft); }
/* 밀담에 끼지 못한 사람 화면의 안내 배너 */
.whisper-note { display: flex; align-items: center; gap: 8px; margin: 8px 0 2px; padding: 8px 12px; border: 1px dashed rgba(232, 163, 61, .6); border-radius: 12px; background: rgba(232, 163, 61, .07); font-size: 13px; color: var(--muted); line-height: 1.5; }
.whisper-note .ico { color: var(--amber); display: grid; place-items: center; flex: none; }
.whisper-note b { color: var(--amber); }

/* ---------- "이번에 할 일" 카드 · 막혔어요 · 이번 라운드 메모 앵커 ---------- */
.ask-tip { margin-top: 8px; padding: 10px 12px; border-radius: 8px; background: rgba(232, 163, 61, .08); border: 1px solid rgba(232, 163, 61, .35); font-size: 15px; line-height: 1.6; }
.ask-tip b { color: var(--amber); font-weight: 500; }
.todo-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.todo-links .btn { flex: 1 1 auto; justify-content: center; }
/* 막혔어요 시트: 볼 곳 → 비교할 것 → 질문 예시 (번호가 붙은 단계) */
.stuck-steps { list-style: none; margin: 14px 0 16px; padding: 0; display: grid; gap: 10px; counter-reset: stuck; }
.stuck-steps li { counter-increment: stuck; position: relative; display: grid; gap: 4px; padding: 10px 12px 10px 42px; border-radius: 8px; background: var(--bg-deep); border: 1px solid var(--line); text-align: left; }
.stuck-steps li::before { content: counter(stuck); position: absolute; left: 12px; top: 11px; width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--amber); color: var(--amber); font-family: var(--font-mono); font-size: 12px; display: grid; place-items: center; }
.stuck-steps li b { font-family: var(--font-display); color: var(--amber); font-size: 15px; }
.stuck-steps li span { font-size: 14px; color: var(--text); line-height: 1.6; }
.stuck-steps li .btn { justify-self: start; margin-top: 6px; }
/* 탭을 건너뛰어 찾아온 항목을 잠깐 강조 (기존 attn 링 애니메이션 재사용) */
.flash { border-radius: 8px; animation: attn 1.1s ease-out 2; }
/* 이번 라운드 메모: 앵커 + 아직 안 읽음 표시 (탭바 .bdg 와 같은 빨강을 쓴다) */
.note-row.cur { background: rgba(232, 163, 61, .08); border: 1px solid rgba(232, 163, 61, .35); color: var(--text); cursor: pointer; }
.note-row.cur b { color: var(--amber); }
.note-row.cur.unseen { border-color: var(--red); }
.new-dot { display: inline-block; width: 8px; height: 8px; margin-left: 6px; border-radius: 50%; background: var(--red); vertical-align: middle; box-shadow: 0 0 0 3px rgba(178, 58, 58, .22); }

/* ---------- 처음 플레이 안내 오버레이 (4단계) ---------- */
.tutor-view { position: fixed; inset: 0; z-index: 80; background: var(--bg-page); color: var(--text); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: calc(60px + var(--safe-t)) 24px calc(32px + var(--safe-b)); text-align: center; animation: fadeIn .3s ease both; }
.tutor-view::before { content: ""; position: absolute; inset: 0; pointer-events: none; background: var(--noise); opacity: .5; }
.tutor-view > * { position: relative; z-index: 1; }
.tutor-view .skip { position: absolute; top: calc(14px + var(--safe-t)); right: 16px; z-index: 2; background: none; border: 0; color: var(--muted); font-size: 14px; min-height: 40px; padding: 8px 8px; }
.tutor-card { width: min(100%, 380px); display: grid; justify-items: center; gap: 10px; }
.tutor-card.in { animation: fadeUp .26s ease both; }
.tutor-card .ico { width: 76px; height: 76px; border-radius: 50%; border: 1.5px solid var(--amber); color: var(--amber); background: rgba(232, 163, 61, .08); display: grid; place-items: center; }
.tutor-card .no { font-size: 13px; letter-spacing: .12em; color: var(--muted); }
.tutor-card h2 { font-family: var(--font-display); font-size: 26px; margin: 0; }
.tutor-card p { margin: 0; max-width: 320px; color: var(--muted); font-size: 16px; line-height: 1.7; }
.tutor-card .ex { margin-top: 2px; padding: 10px 16px; border-radius: 10px; border: 1px dashed rgba(232, 163, 61, .55); background: rgba(232, 163, 61, .07); color: var(--amber); font-family: var(--font-hand); font-size: 21px; }
.tutor-dots { display: flex; gap: 8px; }
.tutor-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--line-2); transition: width .2s, background .2s; }
.tutor-dots i.on { width: 22px; border-radius: 4px; background: var(--amber); }
.tutor-nav { display: flex; gap: 10px; width: min(100%, 380px); }
.tutor-nav .btn { flex: 1; min-height: 50px; font-size: 17px; }
.tutor-nav .btn svg.back { transform: rotate(180deg); }

/* ==========================================================================
   사건 자료 탭 (공간도 / 이동시간 / 타임라인)
   ========================================================================== */
.case-view .seg { margin: 14px 0; }
.case-body { margin-top: 14px; }

/* ---------- 공간도 (SVG, 이미지 없이 도형·글자만으로 성립) ---------- */
.case-map { padding: 10px 4px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); box-shadow: var(--shadow-card); overflow-x: auto; }
.casemap { display: block; max-width: 100%; height: auto; }
.casemap .lvband { fill: rgba(154, 148, 138, .05); stroke: var(--line); stroke-dasharray: 3 4; }
.casemap .lvlabel { font-family: var(--font-mono); font-size: 11px; fill: var(--muted); letter-spacing: .06em; }
.casemap .node rect { fill: var(--surface-2); stroke: var(--line-2); stroke-width: 1; }
.casemap .node text { font-family: var(--font-body); font-size: 13px; fill: var(--text); }
.casemap .rline { stroke: var(--cyan); stroke-width: 1.4; stroke-linecap: round; }
.casemap marker path { fill: var(--cyan); }
.casemap .rchip { fill: var(--bg-deep); stroke: var(--cyan); stroke-width: 1; opacity: .95; }
.casemap .rtime { font-family: var(--font-mono); font-size: 11px; fill: var(--cyan); }
.casemap .casemap-bg { opacity: .35; filter: saturate(.7); }
.case-map.has-bg { background: var(--bg-deep); }

/* ---------- 이동시간 목록 (SVG 를 못 보는 상황의 동등한 대체 수단) ---------- */
.route-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.route-row { padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--cyan); border-radius: 10px; box-shadow: var(--shadow-card); }
.route-row .rt-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.route-row .rt-head b { font-size: 16px; font-weight: 700; }
.route-row .rt-dir { font-size: 12px; color: var(--muted); border: 1px solid var(--line-2); border-radius: var(--radius-tag); padding: 1px 6px; }
.route-row .t { font-family: var(--font-mono); font-size: 15px; color: var(--cyan); margin-left: auto; }
.route-row .rt-src { margin-top: 6px; font-family: var(--font-mono); font-size: 11px; color: var(--muted-2); letter-spacing: .04em; }
.route-row .rt-note { margin: 6px 0 0; font-size: 14px; color: var(--muted); }
.loc-thumb { width: 28px; height: 28px; border-radius: 7px; object-fit: cover; border: 1px solid var(--line-2); flex: none; }

/* ---------- 타임라인 ---------- */
.tl-filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.tl-filters .chip { cursor: pointer; font-family: inherit; }
.tl-filters .chip.on { border-color: var(--amber); color: var(--amber); }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.tl-row { display: grid; grid-template-columns: 14px minmax(0, 1fr); gap: 10px; padding: 11px 13px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.tl-row .tl-mark { align-self: start; margin-top: 5px; width: 12px; height: 12px; }
/* 색만으로 구분하지 않는다: 라벨 + 모양(네모/동그라미/마름모)이 함께 다르다 */
.tl-row.ev-evidence { border-left: 4px solid var(--amber); }
.tl-row.ev-evidence .tl-mark { background: var(--amber); }
.tl-row.ev-claim { border-left: 4px dashed var(--beige); }
.tl-row.ev-claim .tl-mark { border-radius: 50%; background: var(--beige); }
.tl-row.ev-guess { border-left: 4px dotted var(--muted-2); }
.tl-row.ev-guess .tl-mark { background: var(--muted); transform: rotate(45deg); }
.tl-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.tl-top .t { font-family: var(--font-mono); font-size: 15px; color: var(--text); }
.tl-kind { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); }
.tl-kind svg { width: 14px; height: 14px; }
.tl-who { font-size: 12px; color: var(--text); border: 1px solid var(--line-2); border-radius: var(--radius-tag); padding: 1px 6px; }
.tl-place { font-size: 12px; color: var(--cyan); }
.tl-warn { font-size: 12px; color: var(--red-soft); background: var(--red-bg); border: 1px solid var(--red); border-radius: var(--radius-tag); padding: 1px 6px; }
/* "내가 확인함"은 플레이어 본인의 판단 표시다 — 종류(주장/추측) 자체는 그대로 둔 채 테두리만 살짝 밝힌다 */
.tl-checked { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; color: var(--cyan); border: 1px solid var(--cyan); border-radius: var(--radius-tag); padding: 1px 6px; }
.tl-checked svg { width: 12px; height: 12px; }
.tl-row.checked { border-color: rgba(95, 195, 217, .45); }
.tl-ops .tl-check { display: inline-flex; align-items: center; gap: 4px; }
.tl-ops .tl-check svg { width: 14px; height: 14px; }
.tl-ops .tl-check.on { color: var(--cyan); }
.tl-title { display: block; margin-top: 5px; font-size: 15px; }
.tl-text { margin: 4px 0 0; font-size: 15px; color: var(--muted); }
.tl-src { margin-top: 5px; font-family: var(--font-mono); font-size: 11px; color: var(--muted-2); letter-spacing: .04em; }
.tl-ops { margin-top: 2px; display: flex; gap: 2px; }
.tl-ops .link-btn { font-size: 13px; padding: 6px 6px 0; }
.tl-add { margin-top: 18px; }
.tl-add .rule { margin-bottom: 10px; }
.tl-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.tl-add .input { min-height: 44px; padding: 9px 12px; font-size: 15px; font-family: inherit; }
.tl-add select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 28px; }
.tl-actions { display: flex; gap: 8px; margin-top: 10px; }
.tl-add .muted { margin: 8px 0 0; }
@media (min-width: 520px) {
  .tl-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .tl-row { grid-template-columns: 14px minmax(0, 1fr); }
}

/* ==========================================================================
   채팅 온보딩: 하단 도크(코치·보내기 칩·입력창) · 나 = 캐릭터 · 나에게 온 말 · 솔로 라운드 카드
   ========================================================================== */
/* 도크: 스코프 탭 → 코치 한 줄 → 칩 행 → 입력창을 한 덩어리로 하단에 고정한다 (자식별 sticky 오프셋 계산 없음) */
.chat-dock { position: sticky; bottom: calc(var(--tabbar-h) + var(--safe-b) + 8px); z-index: 5; display: flex; flex-direction: column; gap: 6px; padding-top: 6px; background: linear-gradient(180deg, rgba(18, 20, 23, 0), var(--bg) 14px); }
/* 첫 턴 코치 한 줄 (라운드 1 · 아직 아무 말도 안 했을 때) */
.chat-coach { display: flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 10px; border: 1px dashed rgba(232, 163, 61, .6); background: rgba(232, 163, 61, .08); color: var(--amber); font-size: 14px; line-height: 1.4; }
.chat-coach svg { flex: none; }
/* 보내기 칩 행: 가로 스크롤, 360px 에서도 줄바꿈 없이 한 줄 */
.chat-chips { display: flex; gap: 8px; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; padding: 2px 2px 4px; margin: 0 -2px; -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity; }
.chat-chips::-webkit-scrollbar { display: none; }
.chat-chips .send-chip { flex: none; max-width: min(86vw, 440px); min-height: 40px; padding: 8px 14px; font-size: 14px; line-height: 1.35; white-space: nowrap; cursor: pointer; font-family: inherit; scroll-snap-align: start; background: var(--surface); border-color: var(--line-2); color: var(--text); transition: border-color .15s, background .15s; }
.chat-chips .send-chip:active { background: var(--surface-2); }
.chat-chips .send-chip:disabled { opacity: .5; cursor: progress; }
.chat-chips .send-chip svg { color: inherit; flex: none; }
.chat-chips .send-chip .lbl { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
/* [반드시 공개] 진술 칩은 강조색 — 먼저 눌러야 할 것이 한눈에 보이게 */
.chat-chips .send-chip.reveal { background: linear-gradient(180deg, var(--amber), var(--amber-2)); border-color: transparent; color: var(--amber-ink); font-weight: 700; box-shadow: 0 4px 14px rgba(232, 163, 61, .25); }
.chat-chips .send-chip.question { border-color: rgba(232, 163, 61, .5); color: var(--text); }
.chat-chips .send-chip.reply { border-color: var(--cyan); color: var(--cyan); background: rgba(95, 195, 217, .08); }
/* 나 = 캐릭터명 (채팅 탭 상단 고정) */
.chat-me { position: sticky; top: calc(4px + var(--safe-t)); z-index: 4; display: flex; align-items: center; gap: 8px; margin: 0 0 10px; padding: 8px 12px; padding-right: 52px; /* 우상단 ⋯ 메뉴(.top-menu) 자리 */ border-radius: 12px; border: 1px solid rgba(232, 163, 61, .45); background: var(--surface); box-shadow: var(--shadow-card); font-size: 15px; }
.chat-me .av { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; border: 1px solid var(--amber); flex: none; display: grid; place-items: center; background: var(--line); font-family: var(--font-display); font-size: 13px; }
.chat-me .lbl { color: var(--muted); font-size: 13px; letter-spacing: .06em; }
.chat-me b { font-family: var(--font-display); color: var(--amber); font-size: 17px; }
.chat-me .nick { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* 나에게 온 말: 배지 + 답하기 버튼 */
.msg .badge.tome { margin-left: 6px; vertical-align: 1px; }
.msg.to-me .bubble { border-color: rgba(232, 163, 61, .6); }
.msg .reply-btn { display: inline-flex; align-items: center; gap: 4px; margin-top: 4px; padding: 6px 10px; min-height: 30px; border-radius: 999px; border: 1px solid rgba(232, 163, 61, .5); background: rgba(232, 163, 61, .08); color: var(--amber); font-size: 13px; font-family: inherit; cursor: pointer; }
.msg .reply-btn:active { background: rgba(232, 163, 61, .18); }
/* 솔로 모드: 채팅 탭 상단 이번 라운드 장면·단서 접이식 카드 (진행 탭 본문 재사용) */
.chat-round { padding: 0; margin-bottom: 12px; }
.chat-round summary { cursor: pointer; list-style: none; display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; padding: 12px 14px; font-family: var(--font-display); font-size: 15px; color: var(--text); }
.chat-round summary::-webkit-details-marker { display: none; }
.chat-round summary b { color: var(--amber); }
.chat-round summary .eyebrow { font-size: 9px; letter-spacing: .22em; }
.chat-round summary svg.chev { margin-left: auto; transition: transform .2s; color: var(--muted); }
.chat-round[open] summary svg.chev { transform: rotate(180deg); }
.chat-round > .body { padding: 0 12px 12px; }
.chat-round > .body .clue { box-shadow: none; }
.chat-round > .body .discuss { margin-bottom: 0; }

/* ---------- 역할지 3줄 요약 카드 + 브리핑 '역할 확인 완료' 게이트 ---------- */
.role-summary { display: grid; gap: 8px; padding: 12px 14px; margin: 0 0 16px; border: 1.5px solid rgba(232, 163, 61, .55); background: linear-gradient(180deg, rgba(232, 163, 61, .08), rgba(232, 163, 61, .02)), var(--surface); }
.role-summary .rs-row { display: grid; gap: 2px; padding: 8px 10px; border-radius: 8px; background: var(--bg-deep); border: 1px solid var(--line); }
.role-summary .rs-row b { display: inline-flex; align-items: center; gap: 5px; font-family: var(--font-display); font-size: 13px; letter-spacing: .04em; color: var(--amber); font-weight: 700; }
.role-summary .rs-row span { font-size: 15px; line-height: 1.55; color: var(--text); overflow-wrap: anywhere; }
.role-summary .rs-row i.muted { font-style: normal; }
.brief-bar .btn.gated { opacity: 1; background: var(--surface-2); color: var(--muted); box-shadow: none; font-size: 15px; font-family: var(--font-body); cursor: not-allowed; }

/* ---------- 완주 후 "다른 대본으로 친구 초대" 카드 ---------- */
.invite-card { margin-top: 16px; border-color: rgba(232, 163, 61, .45); }
.invite-card .btn-grid { grid-template-columns: 1fr; }
.invite-card .btn { min-height: 48px; font-size: 16px; }
@media (min-width: 420px) { .invite-card .btn-grid { grid-template-columns: 3fr 2fr; } }
