/* ════════════════════════════════════════════
   퓨즈 크루 · "폭탄 해체 작업대" 테마
   두꺼운 먹색 테두리 + 아래로 떨어지는 단단한 그림자(만화풍 종이 부품 느낌),
   경고 줄무늬 노랑, 크림색 종이, 어두운 초록 작업 매트.

   차례
   1. 바탕·변수  2. 버튼  3. 판 위에 겹치는 것(이름표·메모·표식)
   4. 상단 계기판  5. 오른쪽 패널  6. 하단 행동 바  7. 연출
   8. 겹치는 창  9. 처음 화면  10. 튜토리얼  11. 결과 창
   ════════════════════════════════════════════ */

/* ───────── 1. 바탕·변수 ───────── */
:root {
  --ink: #0b1220;
  --bg: #0a1320;
  --panel: #101b31;
  --card: #1c2c4c;
  --card2: #233659;
  --cream: #f6ecd4;
  --cream2: #e9dbb8;
  --paper-ink: #1b2233;
  --paper-muted: #6b7288;
  --paper-line: #e2d3ad;
  --text: #f3f6fc;
  --muted: #93a3c2;
  --hazard: #ffcc33;
  --red: #ff4d4d;
  --green: #4fd27a;
  --blue: #2f8fff;
  --cyan: #3de8ff;
  --sh: 0 4px 0 var(--ink);
  --stripes: repeating-linear-gradient(-45deg, var(--hazard) 0 9px, var(--ink) 9px 18px);
  --font: "Pretendard", "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 14px;
  -webkit-font-smoothing: antialiased;
  word-break: keep-all;
}
b { font-weight: 800; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

#gameCanvas { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
#labels { position: fixed; inset: 0; pointer-events: none; z-index: 2; }
#fx { position: fixed; inset: 0; pointer-events: none; z-index: 15; overflow: hidden; }

/* 위험할 때 화면 가장자리가 붉게 숨쉰다 */
#vignette {
  position: fixed; inset: 0; pointer-events: none; z-index: 1; opacity: 0;
  background: radial-gradient(ellipse at center, transparent 55%, rgb(255 40 40 / 40%) 100%);
}
body.danger #vignette { animation: breathe 1.6s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }

/* ───────── 2. 버튼: 두꺼운 테두리 + 눌리는 그림자 ───────── */
button {
  font: inherit; font-weight: 800; color: var(--text);
  background: var(--card2); border: 2px solid var(--ink); border-radius: 10px;
  padding: 7px 14px; cursor: pointer; white-space: nowrap;
  box-shadow: 0 3px 0 var(--ink);
  transition: transform .06s, box-shadow .06s, background .12s, filter .12s;
}
button:hover:not(:disabled) { filter: brightness(1.12); }
button:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 0 0 var(--ink); }
button:disabled { opacity: .45; cursor: default; }
button.primary { background: var(--hazard); color: var(--ink); }
button.danger { background: var(--red); color: #fff; }
button.ghost { background: transparent; color: var(--muted); box-shadow: none; border-color: #2c3d60; }
button.armed { background: var(--hazard); color: var(--ink); box-shadow: 0 3px 0 var(--ink), 0 0 0 4px rgb(255 204 51 / 30%); }
button.big { font-size: 16px; padding: 10px 22px; }
button.link { background: none; border: none; box-shadow: none; padding: 0; color: #8fc1ff; font-size: 12px; font-weight: 700; }
button.link:active { transform: none; }
button.icon { width: 36px; height: 36px; padding: 0; display: grid; place-items: center; font-size: 18px; border-radius: 10px; background: var(--card); }

/* ───────── 3. 판 위에 겹치는 것 ───────── */
/* 받침대 이름표: 1줄 얼굴·이름 / 2줄 탐지기·남은 개수 / 3줄 낸 숫자 */
.standLabel { position: absolute; display: flex; align-items: center; }
.lab {
  width: 100%; padding: 7px 10px 8px 9px; border-radius: 12px;
  display: flex; flex-direction: column; gap: 6px;
  background: var(--card); border: 2px solid var(--ink); box-shadow: var(--sh);
  border-left: 6px solid var(--seat);
}
.lab.turn { background: #2f3a24; border-color: var(--hazard); border-left-color: var(--seat); box-shadow: 0 4px 0 var(--ink), 0 0 0 4px rgb(255 204 51 / 25%); }
.lab .r1 { display: flex; align-items: center; gap: 7px; min-width: 0; }
.lab .r2 { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.lab .r3 { display: flex; flex-wrap: wrap; align-items: center; gap: 3px; pointer-events: auto; cursor: help; }
.lab .ava { position: relative; width: 28px; height: 28px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--seat); border: 2px solid var(--ink); font-size: 15px; }
.lab .crown {
  position: absolute; top: -23px; left: -5px; z-index: 1; font-size: 22px; font-style: normal; transform: rotate(-20deg);
  filter: drop-shadow(0 2px 0 var(--ink)) drop-shadow(0 0 4px rgb(255 204 51 / 70%));
}
.lab .pn { flex: 1; min-width: 0; font-weight: 900; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lab .sub { flex: none; font-size: 11px; font-weight: 800; color: var(--muted); }
.lab .kind { flex: none; font-size: 10px; font-weight: 900; padding: 1px 7px; border-radius: 99px; background: #31446b; color: #c5d2ea; }
.lab .kind.me { background: var(--hazard); color: var(--ink); }
.lab .kind.human { background: var(--green); color: var(--ink); }
.lab .chip { font-size: 11px; font-weight: 800; line-height: 20px; padding: 0 7px; border-radius: 6px; white-space: nowrap; }
.lab .chip.on { background: #1f6b46; color: #d6ffe6; }
.lab .chip.off { background: #2a3245; color: #7d8aa5; }
.lab .chip.no { background: #6b2430; color: #ffd1d1; }
.lab .chip.said { min-width: 22px; padding: 0 5px; text-align: center; line-height: 18px; background: var(--cream); color: var(--paper-ink); border: 1.5px solid var(--ink); }
.lab .chip.said.gone { opacity: .35; text-decoration: line-through; }
.lab .saidLbl { font-size: 10.5px; font-weight: 800; color: var(--muted); margin-right: 2px; }
.lab .count { font-size: 12px; font-weight: 700; color: #aab8d3; white-space: nowrap; }
.lab .count b { font-size: 15px; color: #fff; margin-right: 1px; }
.lab .count.done { color: #7fe0a6; }

/* 나만 보는 메모 (동료 전선 아래쪽에 붙는 쪽지) */
.memoTag {
  position: absolute; transform: translate(-50%, -100%) rotate(-4deg);
  padding: 1px 6px; border-radius: 5px; font-size: 12px; font-weight: 900; white-space: nowrap;
  background: #fff7a8; color: var(--paper-ink); border: 1.5px solid var(--ink); box-shadow: 0 2px 0 var(--ink);
}
.memoTag.y { background: var(--hazard); }
.memoTag.r { background: #ff9a9a; }

/* ≠ / = 표식 (붙어 있는 두 전선 사이) */
.relTag {
  position: absolute; transform: translate(-50%, -50%);
  width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%;
  font-size: 17px; font-weight: 900; line-height: 1; color: var(--ink);
  border: 2.5px solid var(--ink); box-shadow: 0 2px 0 var(--ink);
}
.relTag.ne { background: #ff9a9a; }
.relTag.eq { background: #9ff0c0; }

/* 메모 고르기 창 */
.memoPop {
  position: fixed; z-index: 40; width: 236px; padding: 10px;
  background: var(--cream); color: var(--paper-ink); border: 3px solid var(--ink); border-radius: 14px;
  box-shadow: 0 5px 0 var(--ink), 0 16px 32px rgb(0 0 0 / 45%);
  animation: menuIn .14s ease-out;
}
.memoPop[hidden] { display: none; }
.mmHead { font-weight: 900; font-size: 13px; margin-bottom: 8px; }
.mmHead small { font-weight: 700; color: var(--paper-muted); margin-left: 4px; }
.mmGrid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.mmRow { display: flex; gap: 4px; margin-top: 6px; }
.memoPop button.mm { padding: 5px 0; font-size: 13px; background: #fff; color: var(--paper-ink); box-shadow: 0 2px 0 var(--ink); }
.mmRow button.mm { flex: 1; }
.memoPop button.mm.on { background: #fff7a8; }
.memoPop button.mm.y { background: #ffe18a; }
.memoPop button.mm.r { background: #ffb3b3; }
.memoPop button.mm.clear { background: transparent; color: var(--paper-muted); box-shadow: none; }

/* ───────── 4. 상단 계기판 ───────── */
#topbar {
  position: fixed; top: 0; left: 0; right: var(--right); height: var(--top); z-index: 10;
  display: flex; align-items: center; gap: 14px; padding: 0 16px 6px;
  background: linear-gradient(#1b2c4c, #13213a);
}
#topbar::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 6px; background: var(--stripes); border-top: 2px solid var(--ink); }

.opTag, .turnBox {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 68px; padding: 6px 12px; border-radius: 12px; line-height: 1.15; cursor: help;
  background: var(--card); border: 2px solid var(--ink); box-shadow: var(--sh);
}
.opTag small, .turnBox small { font-size: 12px; color: var(--muted); font-weight: 700; }
.opTag b { font-size: 19px; font-weight: 900; color: var(--hazard); white-space: nowrap; }
.opTag.mission b { font-size: 16px; max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
.turnBox b { font-size: 24px; font-weight: 900; }
.turnBox.danger { background: #4a1820; animation: dangerBox .9s ease-in-out infinite; }
.turnBox.danger b { color: #ff8a8a; }

.dialBox { display: flex; align-items: center; gap: 8px; padding: 3px 18px 3px 4px; border-radius: 40px; background: var(--card); border: 2px solid var(--ink); box-shadow: var(--sh); cursor: help; }
.dial { display: block; }
.dial .needle { transition: all .4s cubic-bezier(.5, 1.8, .5, 1); }
.dialTxt { display: flex; flex-direction: column; line-height: 1.15; }
.dialTxt small { font-size: 13px; color: var(--muted); font-weight: 700; }
.dialTxt b { font-size: 26px; line-height: 1.05; font-weight: 900; }
.dialTxt b.boom { color: #ff6b6b; }
.dialBox.danger { background: #4a1820; animation: dangerBox .9s ease-in-out infinite; }
.dialBox.danger .dial { animation: jitter .25s linear infinite; }
@keyframes dangerBox { 50% { box-shadow: 0 4px 0 var(--ink), 0 0 0 5px rgb(255 77 77 / 40%); } }
@keyframes jitter { 25% { transform: rotate(-3deg); } 75% { transform: rotate(3deg); } }

/* 숫자판: 숫자마다 잘린 개수 */
.board { display: flex; gap: 4px; align-items: center; padding: 6px 9px; border-radius: 14px; background: #0d1729; border: 2px solid var(--ink); box-shadow: inset 0 2px 0 rgb(0 0 0 / 40%); cursor: help; }
.tk {
  width: 37px; padding: 5px 0 6px; border-radius: 10px; text-align: center;
  background: var(--cream); color: var(--paper-ink); border: 2px solid var(--ink); box-shadow: 0 3px 0 var(--ink);
}
.tk b { display: block; font-size: 19px; line-height: 21px; font-weight: 900; }
.tk .dots { display: flex; justify-content: center; gap: 3px; margin-top: 4px; }
.tk .dots i { width: 6px; height: 6px; border-radius: 50%; background: #c9b98f; }
.tk .dots i.on { background: var(--blue); }
.tk.sel { background: var(--hazard); box-shadow: 0 3px 0 var(--ink), 0 0 0 3px rgb(255 204 51 / 40%); }
.tk.done { background: var(--green); }
.tk.done .dots i { background: #1d6b41; }
.tk.pop { animation: tkPop 1s ease-out; }
@keyframes tkPop { 0% { transform: scale(1.6) rotate(-8deg); } 100% { transform: scale(1); } }
/* 숫자 사이의 노랑·빨강 막대 (점선은 후보) */
.cm { width: 10px; height: 42px; border-radius: 5px; flex: none; border: 2px solid var(--ink); }
.cm.y { background: var(--hazard); }
.cm.r { background: var(--red); }
.cm.q { border-style: dashed; background: transparent; }
.cm.y.q { border-color: var(--hazard); }
.cm.r.q { border-color: var(--red); }
.cm.gone { opacity: .25; }

/* ───────── 5. 오른쪽 패널: 로고·☰ / 장비함 / 최근 상황 ───────── */
#sideHead {
  position: fixed; top: 0; right: 0; width: var(--right); height: var(--sideHead); z-index: 17;
  display: flex; align-items: center; justify-content: space-between; padding: 0 12px 0 16px;
  background: var(--panel); border-left: 3px solid var(--ink); border-bottom: 2px solid #1d2c4b;
}
.brand { display: flex; align-items: center; gap: 2px; font-weight: 900; font-size: 19px; letter-spacing: -0.5px; white-space: nowrap; }
.brand .bombIco { font-size: 20px; margin-right: 4px; filter: drop-shadow(0 2px 0 var(--ink)); }
.brand .b1 { color: var(--hazard); text-shadow: 0 2px 0 var(--ink); }
.brand .b2 { color: #fff; text-shadow: 0 2px 0 var(--ink); }
#menuBtn.on { background: var(--hazard); color: var(--ink); }

/* ☰ 메뉴 */
.menu {
  position: absolute; top: calc(var(--sideHead) - 4px); right: 10px; width: 236px; padding: 8px;
  background: var(--cream); color: var(--paper-ink); border: 3px solid var(--ink); border-radius: 14px;
  box-shadow: 0 6px 0 var(--ink), 0 20px 40px rgb(0 0 0 / 45%);
  animation: menuIn .16s ease-out;
}
.menu[hidden] { display: none; }
@keyframes menuIn { from { opacity: 0; transform: translateY(-6px) scale(.97); } }
.mHead { font-size: 11px; font-weight: 900; color: #7b8296; padding: 6px 8px 3px; }
button.mi {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; margin: 1px 0;
  background: transparent; color: var(--paper-ink); border: 2px solid transparent; box-shadow: none; border-radius: 9px;
  text-align: left; font-weight: 800;
}
button.mi:hover { background: #fff; border-color: var(--ink); filter: none; }
button.mi:active { transform: none; }
.mIco { width: 22px; text-align: center; font-size: 16px; }
.mLabel { flex: 1; display: flex; flex-direction: column; line-height: 1.25; }
.mLabel small { font-size: 11px; font-weight: 600; color: var(--paper-muted); }
.sw { width: 36px; height: 20px; flex: none; border-radius: 99px; background: #c9bfa6; border: 2px solid var(--ink); position: relative; transition: background .15s; }
.sw i { position: absolute; top: 1px; left: 1px; width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 2px solid var(--ink); transition: left .15s; }
.sw.on { background: var(--green); }
.sw.on i { left: 17px; }

#side {
  position: fixed; top: 0; right: 0; bottom: 0; width: var(--right); z-index: 10;
  overflow-y: auto; padding: calc(var(--sideHead) + 14px) 14px 20px; background: var(--panel); border-left: 3px solid var(--ink);
  display: flex; flex-direction: column; gap: 18px;
}
.secHead { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 900; color: #c9d5ec; margin-bottom: 8px; }
.secHead .link { margin-left: auto; }
.hint { width: 17px; height: 17px; border-radius: 50%; background: var(--card2); border: 1.5px solid var(--ink); display: inline-grid; place-items: center; font-size: 10px; cursor: help; }

/* 장비 카드: 잠김(회색) → 준비됨(크림) → 켜짐(노랑) → 사용함(어둡게) */
.eq {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px; margin-bottom: 8px;
  border-radius: 12px; background: var(--card); border: 2px solid var(--ink); box-shadow: var(--sh);
  transition: transform .1s, filter .12s;
}
.eq .num { width: 24px; height: 24px; flex: none; border-radius: 50%; background: var(--hazard); color: var(--ink); border: 2px solid var(--ink); display: grid; place-items: center; font-weight: 900; font-size: 12px; }
.eq .ico { width: 22px; flex: none; text-align: center; font-size: 20px; font-weight: 900; }
.eqMain { flex: 1; min-width: 0; }
.eq .nm { font-weight: 900; font-size: 13.5px; }
.eqText { font-size: 11.5px; margin-top: 1px; opacity: .8; }
.eq.locked { filter: grayscale(.8); opacity: .6; }
.eq.locked .num { background: #5a6884; }
.eq.used { background: #141d31; box-shadow: none; opacity: .45; }
.eq.used .nm { text-decoration: line-through; }
.eq.ready { background: var(--cream); color: var(--paper-ink); }
.eq.can { cursor: pointer; }
.eq.can:hover { transform: translateY(-2px); }
.eq.armed { background: var(--hazard); color: var(--ink); }
.eq.pop { animation: eqPop 1.2s ease-out; }
@keyframes eqPop { 0% { transform: scale(1.08) rotate(-2deg); box-shadow: 0 4px 0 var(--ink), 0 0 0 8px rgb(79 210 122 / 55%); } 100% { transform: none; } }
.lock { display: flex; align-items: center; gap: 3px; font-size: 11px; font-weight: 800; color: #c9d5ec; }
.lock i { width: 7px; height: 7px; border-radius: 50%; background: #3b4a69; border: 1px solid var(--ink); }
.lock i.on { background: var(--blue); }
.useTag { font-size: 12px; font-weight: 900; color: var(--ink); background: var(--green); border: 2px solid var(--ink); padding: 2px 10px; border-radius: 99px; box-shadow: 0 2px 0 var(--ink); }
.openTag { font-size: 11px; font-weight: 800; color: #2a7a4c; }
.usedTag { font-size: 11px; color: var(--muted); }
.armedTag { font-size: 11px; font-weight: 900; color: var(--hazard); background: var(--ink); padding: 3px 9px; border-radius: 99px; }

.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; gap: 8px; align-items: flex-start; padding: 7px 0; font-size: 12.5px; line-height: 1.45; color: #96a6c4; border-bottom: 1px dashed #24355a; }
.feed li.latest { color: var(--text); }
.feed .fi { flex: none; width: 18px; text-align: center; }
.feed.full li { color: var(--paper-ink); border-bottom-color: #d7c9a3; }

/* ───────── 6. 하단 행동 바 ───────── */
#bottombar {
  position: fixed; left: 0; right: var(--right); bottom: 0; height: var(--bottom); z-index: 10;
  display: flex; align-items: center; gap: 16px; padding: 0 16px;
  background: linear-gradient(#13213a, #0e1a2f); border-top: 3px solid var(--ink);
}
.pill { display: flex; align-items: center; gap: 7px; padding: 8px 16px; border-radius: 99px; background: var(--card); border: 2px solid var(--ink); box-shadow: var(--sh); font-weight: 900; white-space: nowrap; }
.pill .dot { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--ink); }
.pill.me { background: var(--hazard); color: var(--ink); animation: mePulse 1.6s ease-in-out infinite; }
@keyframes mePulse { 50% { box-shadow: 0 4px 0 var(--ink), 0 0 0 6px rgb(255 204 51 / 30%); } }
.pill.win { background: var(--green); color: var(--ink); }
.pill.lose { background: var(--red); }
.thinking { display: inline-flex; gap: 3px; margin-left: 4px; }
.thinking i { width: 4px; height: 4px; border-radius: 50%; background: #c5d2ea; animation: think 1s infinite; }
.thinking i:nth-child(2) { animation-delay: .15s; }
.thinking i:nth-child(3) { animation-delay: .3s; }
@keyframes think { 0%, 60%, 100% { opacity: .25; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
.center { flex: 1; min-width: 0; }
.prompt { color: #c5d2ea; }
.prompt b { color: #fff; }
.steps { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.step { display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px 5px 5px; border-radius: 99px; background: #18264190; border: 2px solid #233659; color: #7f90b0; font-weight: 800; white-space: nowrap; }
.step i { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 12px; font-weight: 900; background: #2a3b60; color: #9fb0cf; }
.step.now { background: var(--cream); color: var(--paper-ink); border-color: var(--ink); box-shadow: 0 3px 0 var(--ink); padding-left: 12px; }
.step.now:has(i) { padding-left: 5px; }
.step.now i { background: var(--hazard); color: var(--ink); border: 2px solid var(--ink); }
.step.done { color: #d6ffe6; }
.step.done i { background: var(--green); color: var(--ink); }
.step .decl { font-size: 15px; color: var(--ink); background: var(--hazard); padding: 0 8px; border-radius: 6px; border: 2px solid var(--ink); margin-left: 2px; }
.arrow { color: #4a5b80; font-weight: 900; font-size: 18px; }
.mode { font-size: 11px; font-weight: 900; padding: 3px 9px; border-radius: 99px; background: var(--ink); color: var(--hazard); }
.actions { display: flex; gap: 7px; flex-wrap: wrap; justify-content: flex-end; }

/* ───────── 7. 연출 ───────── */
/* 만화 말풍선 */
.bubble {
  --ty: -100%;
  position: absolute; transform: translate(-50%, var(--ty));
  padding: 6px 13px; border-radius: 14px; white-space: nowrap;
  background: var(--cream); color: var(--paper-ink); border: 2.5px solid var(--ink);
  font-size: 14px; font-weight: 900; box-shadow: 0 4px 0 var(--ink);
  animation: bubIn .18s ease-out;
}
.bubble::after { content: ''; position: absolute; left: 50%; bottom: -8px; transform: translateX(-50%) rotate(45deg); width: 11px; height: 11px; background: inherit; border-right: 2.5px solid var(--ink); border-bottom: 2.5px solid var(--ink); }
.bubble .decl { color: #d1530b; font-size: 18px; }
.bubble.ok { background: var(--green); }
.bubble.bad { background: #ff7b7b; color: #fff; text-shadow: 0 1px 0 var(--ink); }
.bubble.bad .decl { color: #fff3a8; }
.bubble.safe { background: #8ef0ff; }
.bubble.boom { background: var(--red); color: #fff; font-size: 18px; }
.bubble.pop { animation: bubPop .25s ease-out; }
.bubble.below { --ty: 0%; }
.bubble.below::after { top: -8px; bottom: auto; transform: translateX(-50%) rotate(225deg); }
.bubble.out { opacity: 0; transition: opacity .25s; }
@keyframes bubIn { from { opacity: 0; transform: translate(-50%, var(--ty)) scale(.7); } }
@keyframes bubPop { 0% { transform: translate(-50%, var(--ty)) scale(1.3) rotate(-4deg); } 100% { transform: translate(-50%, var(--ty)) scale(1); } }

/* 알림 */
#toasts { position: fixed; left: calc((100vw - var(--right)) / 2); top: calc(var(--top) + 12px); transform: translateX(-50%); z-index: 19; display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; }
.toast { padding: 8px 16px; border-radius: 12px; background: var(--cream); color: var(--paper-ink); border: 2.5px solid var(--ink); box-shadow: 0 4px 0 var(--ink); font-size: 13.5px; font-weight: 700; animation: toastIn .22s ease-out; white-space: nowrap; }
.toast.err { background: #ffd9d9; }
.toast.good { background: #d8f8e4; }
.toast.out { opacity: 0; transform: translateY(-6px); transition: all .3s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px) scale(.9); } }

/* 큰 글씨: 먹색 외곽선이 두꺼운 만화 효과음 글씨 */
.banner {
  position: absolute; left: calc((100vw - var(--right)) / 2); top: 42%;
  transform: translate(-50%, -50%); text-align: center; pointer-events: none;
  animation: bannerIn 1.5s ease-out forwards;
}
.banner .bt {
  font-size: 54px; font-weight: 900; letter-spacing: -1px; color: var(--hazard); transform: rotate(-4deg);
  text-shadow: 3px 3px 0 var(--ink), -3px 3px 0 var(--ink), 3px -3px 0 var(--ink), -3px -3px 0 var(--ink),
    0 4px 0 var(--ink), 4px 0 0 var(--ink), -4px 0 0 var(--ink), 0 -4px 0 var(--ink), 0 9px 0 var(--ink);
}
.banner .bs { display: inline-block; margin-top: 10px; padding: 4px 14px; border-radius: 10px; font-size: 15px; font-weight: 800; color: var(--paper-ink); background: var(--cream); border: 2.5px solid var(--ink); box-shadow: 0 3px 0 var(--ink); }
.banner.win .bt { color: var(--green); font-size: 66px; }
.banner.boom .bt { color: #ff5a3c; font-size: 96px; transform: rotate(-8deg); }
.banner.boom::before {
  content: ''; position: absolute; left: 50%; top: 50%; width: 300px; height: 300px; transform: translate(-50%, -50%); z-index: -1;
  background: #ffd23f;
  clip-path: polygon(50% 0%, 61% 30%, 95% 18%, 72% 45%, 100% 62%, 66% 64%, 72% 98%, 50% 74%, 26% 98%, 32% 66%, 0% 64%, 28% 46%, 6% 18%, 39% 30%);
}
@keyframes bannerIn {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.5); }
  14% { opacity: 1; transform: translate(-50%, -50%) scale(1.12); }
  24% { transform: translate(-50%, -50%) scale(1); }
  76% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -62%); }
}
.screenFlash { position: absolute; inset: 0; animation: flash .9s ease-out forwards; }
.screenFlash.boom { background: radial-gradient(circle, #fff8d0 0%, #ff8a3d 40%, #b01010 100%); }
@keyframes flash { 0% { opacity: .95; } 100% { opacity: 0; } }

/* 마우스를 올리면 뜨는 설명 */
.tooltip {
  position: fixed; z-index: 100; max-width: 270px; padding: 8px 12px; border-radius: 10px;
  background: var(--cream); color: var(--paper-ink); border: 2px solid var(--ink); box-shadow: 0 3px 0 var(--ink);
  font-size: 12.5px; font-weight: 600; line-height: 1.5; white-space: pre-line;
  pointer-events: none;
}
.tooltip[hidden] { display: none; }

/* ───────── 8. 겹치는 창: 크림색 작전 서류 ───────── */
.overlay {
  position: fixed; inset: 0; z-index: 20;
  display: grid; place-items: center;
  background: rgb(5 9 16 / 72%);
  animation: fadeIn .2s ease-out;
}
/* 위의 display: grid 가 hidden 속성을 이기므로 명시적으로 숨긴다 */
.overlay[hidden] { display: none; }
@keyframes fadeIn { from { opacity: 0; } }
.panel {
  position: relative; width: min(520px, 92vw); max-height: 86vh; overflow-y: auto;
  padding: 30px 28px 22px; border-radius: 18px;
  background: var(--cream); color: var(--paper-ink); line-height: 1.65;
  border: 3px solid var(--ink); box-shadow: 0 8px 0 var(--ink), 0 30px 60px rgb(0 0 0 / 50%);
  animation: panelIn .24s cubic-bezier(.3, 1.5, .5, 1);
}
.panel::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 12px; background: var(--stripes); border-bottom: 2.5px solid var(--ink); }
.panel.wide { width: min(640px, 92vw); }
@keyframes panelIn { from { transform: translateY(16px) scale(.96); opacity: 0; } }
.panel h2 { margin: 4px 0 10px; font-weight: 900; }
.panel h3 { margin: 16px 0 4px; font-size: 15px; font-weight: 900; color: var(--paper-ink); }
.panel ul { margin: 0; padding-left: 20px; }
.panel li { margin-bottom: 3px; }
.panel .muted { color: #5e667a; }
.panel.center { text-align: center; }
.panel button:not(.primary):not(.danger):not(.ghost) { background: #fff; color: var(--paper-ink); }
.panel button.ghost { color: #5e667a; border-color: #c9b98f; }
.btnRow { display: flex; gap: 8px; justify-content: center; margin-top: 18px; flex-wrap: wrap; align-items: center; }
.hostOnly[hidden] { display: none; }

/* 고르기 창 (전체 스캔 숫자·동료) */
.pickBtns { display: grid; gap: 7px; margin: 12px 0 0; }
.pickBtns button { font-size: 17px; padding: 10px 6px; }

/* ───────── 9. 처음 화면: 제목 + 3단 메뉴 ───────── */
#lobby .panel.home { width: min(560px, 94vw); padding: 34px 32px 22px; }
#lobby .panel.home.compact { padding-top: 24px; }
.homeHead { text-align: center; margin-bottom: 18px; }
.homeLogo { width: 66px; height: 66px; margin: 0 auto 8px; display: grid; place-items: center; font-size: 34px; border-radius: 50%; background: var(--hazard); border: 3px solid var(--ink); box-shadow: 0 4px 0 var(--ink); }
.homeTitle { margin: 0; font-size: 40px; font-weight: 900; letter-spacing: -1px; color: #d99a00; text-shadow: 0 3px 0 var(--ink); }
.homeTitle span { color: var(--paper-ink); text-shadow: none; margin-left: 4px; }
.homeSub { margin: 6px 0 0; font-size: 14px; color: #5e667a; }
/* 하위 화면에서는 제목을 작게 */
.compact .homeHead { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 10px; }
.compact .homeLogo { width: 40px; height: 40px; font-size: 20px; margin: 0; box-shadow: 0 3px 0 var(--ink); }
.compact .homeTitle { font-size: 26px; }
.compact .homeSub { display: none; }

.menuList { border-top: 2px solid #d6c59b; }
.menuList.scroll { max-height: 46vh; overflow-y: auto; }
#lobby button.mRow {
  display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 10px;
  background: transparent; color: var(--paper-ink); border: none; border-bottom: 2px solid var(--paper-line); border-radius: 0;
  box-shadow: none; text-align: left; font-weight: 400; cursor: pointer;
}
#lobby button.mRow:hover:not(:disabled) { background: #fff7e2; filter: none; }
#lobby button.mRow:active:not(:disabled) { transform: none; background: #fbefcc; }
#lobby button.mRow:disabled { opacity: .5; cursor: default; }
.mIcon { width: 48px; height: 48px; flex: none; display: grid; place-items: center; font-size: 23px; border-radius: 50%; background: #efe2c0; border: 2px solid var(--ink); }
.mText { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.mText b { font-size: 17px; font-weight: 900; display: flex; align-items: center; gap: 8px; }
.mText em { font-style: normal; font-size: 11px; font-weight: 900; padding: 1px 8px; border-radius: 99px; background: var(--cyan); color: var(--ink); border: 1.5px solid var(--ink); }
.mText small { font-size: 13px; color: var(--paper-muted); }
.chev { font-size: 26px; color: #8f8a7a; line-height: 1; padding-right: 4px; }
.go { flex: none; font-size: 13px; font-weight: 900; padding: 6px 12px; border-radius: 99px; background: var(--hazard); border: 2px solid var(--ink); box-shadow: 0 2px 0 var(--ink); }
.stars { flex: none; font-size: 18px; letter-spacing: 1px; color: #e3a400; text-shadow: 0 1px 0 var(--ink); }
.stars i { font-style: normal; color: #d8c9a2; text-shadow: none; }

.subHead { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding-bottom: 12px; margin-bottom: 14px; border-bottom: 2px solid #d6c59b; }
.subHead b { font-size: 18px; font-weight: 900; }
#lobby button.back { justify-self: start; padding: 4px 6px; background: none; border: none; box-shadow: none; color: #5e667a; font-weight: 800; }
#lobby button.back:hover { color: var(--paper-ink); filter: none; }
.lead { margin: 14px 0 6px; font-size: 14px; font-weight: 700; color: #4a5065; }

.field { display: flex; align-items: center; gap: 10px; margin: 10px 0; flex-wrap: wrap; }
.fl { width: 56px; font-weight: 900; }
.segs { display: flex; gap: 6px; flex-wrap: wrap; }
#lobby button.seg { padding: 7px 13px; font-size: 14px; background: #fff; color: var(--paper-ink); }
#lobby button.seg.on { background: var(--hazard); }
.fh { font-size: 12.5px; font-weight: 700; color: var(--paper-muted); }
.fh.indent { margin: -4px 0 0; padding-left: 66px; }

.invite { display: flex; gap: 6px; margin: 8px 0; }
.invite input { flex: 1; font: inherit; font-size: 12px; padding: 8px; background: #fff; color: var(--paper-ink); border: 2px solid var(--ink); border-radius: 10px; }
.seatGrid { display: grid; grid-template-columns: 1fr 1fr; column-gap: 18px; margin: 12px 0 4px; border-top: 2px solid var(--paper-line); }
.seatRow { display: flex; align-items: center; gap: 10px; padding: 10px 4px; border-bottom: 2px solid var(--paper-line); font-size: 14px; }
.seatRow .sd { width: 13px; height: 13px; flex: none; border-radius: 50%; border: 2px solid var(--ink); }
.seatRow .sn { width: 34px; font-weight: 900; }
.seatRow .dim { color: #8b8f9e; }
.seatRow.out { opacity: .45; }
.note { margin: 8px 0 0; font-size: 12.5px; color: var(--paper-muted); }
.warn { margin: 14px 0 0; padding: 10px 14px; border-radius: 10px; background: #fff0d6; border-left: 5px solid #e0a020; font-size: 13px; color: #7a5410; }
.warn small { display: block; margin-top: 4px; font-size: 11px; word-break: break-all; }
.homeFoot { display: flex; justify-content: center; gap: 22px; margin-top: 16px; }
#lobby button.link { background: none; border: none; box-shadow: none; padding: 0; color: #4a6fa5; font-weight: 800; font-size: 13px; }
#lobby .homeFoot button.link { color: #5e667a; }
#lobby .warn button.link { color: #b06a00; text-decoration: underline; }

/* ───────── 10. 튜토리얼 ───────── */
#coach {
  position: fixed; right: 10px; top: calc(var(--sideHead) + 8px); z-index: 16;
  width: calc(var(--right) - 20px);
  padding: 20px 16px 14px; border-radius: 14px;
  background: var(--cream); color: var(--paper-ink);
  border: 3px solid var(--ink); box-shadow: 0 5px 0 var(--ink), 0 0 0 4px rgb(61 232 255 / 35%);
  overflow: hidden;
}
#coach::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 8px; background: repeating-linear-gradient(-45deg, var(--cyan) 0 8px, var(--ink) 8px 16px); }
#coach[hidden] { display: none; }
#coach.show { animation: coachIn .35s ease-out .15s both; }
@keyframes coachIn { from { opacity: 0; transform: translateX(16px); } }
.cHead { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.cTag { font-weight: 900; }
.cProg { color: var(--paper-muted); font-weight: 700; }
.cHead .link { margin-left: auto; color: var(--paper-muted); }
.cBar { height: 6px; border-radius: 6px; background: #ddd0ae; border: 1.5px solid var(--ink); margin: 8px 0 10px; overflow: hidden; }
.cBar i { display: block; height: 100%; background: var(--cyan); transition: width .3s; }
.cText { font-size: 14.5px; line-height: 1.6; }
.cText b { background: linear-gradient(transparent 55%, rgb(255 204 51 / 70%) 55%); }
.cFoot { display: flex; justify-content: flex-end; margin-top: 10px; }
.cDo { font-size: 13px; font-weight: 900; color: #0a7f95; animation: think 1.6s infinite; }
.cDo.watch { color: var(--paper-muted); }
/* 안내가 가리키는 HTML 요소 */
.guide { position: relative; z-index: 1; animation: guidePulse 1.1s ease-in-out infinite !important; }
@keyframes guidePulse {
  0%, 100% { box-shadow: 0 3px 0 var(--ink), 0 0 0 3px var(--cyan), 0 0 0 7px rgb(61 232 255 / 15%); }
  50% { box-shadow: 0 3px 0 var(--ink), 0 0 0 3px var(--cyan), 0 0 0 11px rgb(61 232 255 / 35%); }
}

/* ───────── 11. 결과 창 ───────── */
#result .panel::before { background: repeating-linear-gradient(-45deg, var(--red) 0 9px, var(--ink) 9px 18px); }
#result.win .panel::before { background: repeating-linear-gradient(-45deg, var(--green) 0 9px, var(--ink) 9px 18px); }
#resultTitle { font-size: 30px; }
#resultText { margin: 0 0 6px; color: #4a5065; }
.bigStars { font-size: 46px; letter-spacing: 6px; line-height: 1.1; color: #f2b400; text-shadow: 0 3px 0 var(--ink); }
.bigStars i { font-style: normal; color: #d8c9a2; text-shadow: none; }
.starWhy { margin: 2px 0 8px; font-weight: 800; color: #4a5065; }
.statGrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 10px 0 4px; }
.stat { display: flex; flex-direction: column; gap: 2px; padding: 8px 4px; border-radius: 10px; background: #fff; border: 2px solid var(--ink); box-shadow: 0 2px 0 var(--ink); }
.stat small { font-size: 11px; font-weight: 700; color: var(--paper-muted); line-height: 1.2; }
.stat b { font-size: 16px; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.campaignNote { margin: 10px 0 0; padding: 8px 12px; border-radius: 10px; background: #fff0d6; border: 2px solid var(--ink); font-weight: 800; font-size: 13.5px; }
.campaignNote[hidden] { display: none; }
