:root {
  --bg: #171b16;
  --panel: #20251f;
  --panel-2: #2a3028;
  --field: #2f362d;
  --line: #394135;
  --line-strong: #56604f;
  --ink: #ece6d6;
  --ink-dim: #a7a28f;
  /* 소제목·라벨용 카키. 주황(강조색)은 주요 행동과 핵심 정보에만 쓴다 */
  --khaki: #c9b98a;
  --accent: #e8792b;
  --accent-ink: #1b1209;
  --hp: #e0664a;
  --ammo: #e2b443;
  --good: #8fb56f;
  --mono: "Cascadia Mono", "Consolas", "D2Coding", monospace;
  font-family: "Segoe UI", "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(--ink);
}

#gameCanvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- 화면 공통 ---------- */
.screen {
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}
.screen[hidden] { display: none; }
.screen > * { pointer-events: auto; }

/* ---------- 메인 화면 ---------- */
.menu {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 0 0 clamp(24px, 9vw, 140px);
}

.title-row { display: flex; align-items: center; gap: 14px; }
.title-mark { width: clamp(44px, 6vw, 72px); height: auto; flex-shrink: 0; }

.title {
  margin: 0;
  font-size: clamp(44px, 7vw, 88px);
  font-weight: 900;
  letter-spacing: 0.04em;
  line-height: 0.95;
}

.tagline {
  margin: 16px 0 34px;
  font-size: 18px;
  color: var(--ink-dim);
}

.menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(360px, 82vw);
}

.menu-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel);
  text-align: left;
  transition: border-color 0.15s, transform 0.15s;
}
.menu-btn:hover,
.menu-btn:focus-visible {
  border-color: var(--khaki);
  transform: translateX(4px);
  outline: none;
}
.menu-btn-icon { display: grid; place-items: center; width: 36px; height: 36px; flex-shrink: 0; border-radius: 3px; background: var(--panel-2); color: var(--khaki); }
.menu-btn-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.menu-btn-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.menu-btn-label { font-size: 19px; font-weight: 700; }
.menu-btn-desc { font-size: 13.5px; color: var(--ink-dim); }

/* 대표 버튼(봇 대전)은 강조색에 한 단계 크게 */
.menu-btn.primary {
  padding: 16px 16px;
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.menu-btn.primary .menu-btn-icon { background: rgb(27 18 9 / 14%); color: var(--accent-ink); }
.menu-btn.primary .menu-btn-label { font-size: 22px; }
.menu-btn.primary .menu-btn-desc { color: rgb(27 18 9 / 75%); }
.menu-btn.primary:hover,
.menu-btn.primary:focus-visible { border-color: var(--ink); }

.btn {
  padding: 9px 18px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--panel-2);
}
.btn:hover { border-color: var(--khaki); }

/* ---------- 우상단 버튼 ---------- */
.hud { position: fixed; top: 12px; right: 12px; z-index: 10; }
.icon-btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel);
}
.icon-btn:hover { border-color: var(--khaki); color: var(--khaki); }
/* 톱니바퀴 왼쪽의 글자 버튼 (규칙) */
.hud-text {
  right: 64px;
  height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel);
  font-size: 15px;
  font-weight: 600;
}
.hud-text:hover { border-color: var(--khaki); color: var(--khaki); }

/* ---------- 설정 등 겹쳐 뜨는 창 ---------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: rgb(0 0 0 / 60%);
}
/* display: grid 가 hidden 속성을 이기므로 따로 숨긴다 */
.overlay[hidden] { display: none; }

.panel {
  width: min(520px, 90vw);
  max-height: 80vh;
  overflow-y: auto;
  padding: 20px 24px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--khaki);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
  line-height: 1.7;
  box-shadow: 0 18px 50px rgb(0 0 0 / 45%);
}
.panel h2 { margin: 0 0 12px; font-weight: 800; letter-spacing: 0.01em; }

/* ---------- 설정 창 ---------- */
.settings-panel {
  width: min(560px, 94vw);
  max-height: 86vh;
  padding: 22px 24px 16px;
  display: flex;
  flex-direction: column;
}
.settings-panel h2 { font-size: 24px; margin-bottom: 4px; }
#settingsBody { overflow-y: auto; margin: 0 -24px; padding: 0 24px; }

.set-section { padding: 14px 0 6px; border-bottom: 1px solid var(--line); }
.set-section:last-child { border-bottom: 0; }
.set-section h3 {
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 700;
  color: var(--khaki);
}

.set-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 0;
}
.set-row.is-off { opacity: 0.4; }
.set-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.set-label { font-size: 15px; font-weight: 600; }
.set-desc { font-size: 12.5px; color: var(--ink-dim); margin-top: 2px; }
.set-control { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

/* 켜기/끄기 스위치 */
.switch {
  appearance: none;
  position: relative;
  width: 42px;
  height: 24px;
  margin: 0;
  border-radius: 12px;
  background: var(--line-strong);
  cursor: pointer;
  transition: background 0.15s;
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--ink);
  transition: transform 0.15s;
}
.switch:checked { background: var(--khaki); }
.switch:checked::after { background: var(--bg); }
.switch:checked::after { transform: translateX(18px); }
.switch:disabled { cursor: default; }
.switch:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* 속도 고르기 (여러 개 중 하나) */
.segmented {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
}
.segmented button {
  padding: 6px 12px;
  border: 0;
  border-left: 1px solid var(--line);
  background: transparent;
  font-size: 14px;
  color: var(--ink-dim);
}
.segmented button:first-child { border-left: 0; }
.segmented button:hover { color: var(--ink); }
.segmented button.on { background: var(--ink); color: var(--bg); font-weight: 700; }

/* 음량 */
.slider-wrap { display: flex; align-items: center; gap: 10px; }
.slider { width: 160px; accent-color: var(--khaki); }
.slider-value { width: 28px; text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-dim); }

.select {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--field);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
}

.btn-small { padding: 4px 10px; font-size: 13px; }
.btn-quiet { background: transparent; color: var(--ink-dim); }

.panel-foot {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.panel-foot > :only-child { margin-left: auto; }

/* ---------- 규칙 설명 창 ---------- */
.rules-panel {
  width: min(600px, 94vw);
  max-height: 86vh;
  padding: 22px 24px 16px;
  display: flex;
  flex-direction: column;
}
.rules-panel h2 { font-size: 24px; margin-bottom: 4px; }
#rulesBody { overflow-y: auto; margin: 0 -24px; padding: 0 24px 8px; }
.rules-section { padding-top: 14px; }
.rules-section h3 { margin: 0 0 4px; padding-bottom: 3px; border-bottom: 1px solid var(--line); font-size: 16px; color: var(--khaki); }
.rules-section ul { margin: 0; padding-left: 20px; }
.rules-section li { margin: 3px 0; font-size: 14.5px; line-height: 1.6; }
.rules-section li::marker { color: var(--khaki); }

/* 좁은 화면에서는 설명 아래로 조작 칸을 내린다 */
@media (max-width: 480px) {
  .set-row-choice, .set-row-range, .set-row-select { flex-direction: column; align-items: flex-start; gap: 8px; }
}

/* 움직임 줄이기 */
.reduce-motion *, .reduce-motion *::after { transition: none !important; }

/* ---------- 공통 추가 ---------- */
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
.btn-primary:hover { border-color: var(--ink); }
.btn:disabled { opacity: 0.45; cursor: default; border-color: var(--line); }
.muted { color: var(--ink-dim); }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px 1px 6px; border-radius: 3px; background: rgb(0 0 0 / 28%); font-size: 13px; font-weight: 600; }
.chip .dot { width: 10px; height: 10px; border-radius: 50%; background: currentColor; }
.chip-red .dot { background: #c4432f; }
.chip-yellow .dot { background: #d6a01f; }
.chip-green .dot { background: #4c8a3a; }
.chip-gray .dot { background: #7b8179; }

/* ---------- 게임 룸 ---------- */
.room-screen {
  display: grid;
  justify-items: center;
  align-items: start;
  overflow-y: auto;
  padding: 68px 16px 24px;
  background: rgb(15 18 14 / 72%);
  pointer-events: auto;
}
.room {
  width: min(1040px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  grid-template-areas: "head head" "seats guide" "foot foot";
  gap: 14px 24px;
  padding: 20px 24px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--khaki);
  border-radius: 6px;
  background: var(--panel);
  box-shadow: 0 18px 50px rgb(0 0 0 / 40%);
}
.room h3 { margin: 0; font-size: 14px; font-weight: 700; color: var(--khaki); }
.room-head { grid-area: head; display: flex; align-items: center; gap: 12px; }
.room-title { margin: 0; font-size: 24px; font-weight: 800; }
.room-back { padding: 6px 12px; }
.room-seats { grid-area: seats; min-width: 0; }
.room-row-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.count-wrap { display: flex; align-items: center; gap: 8px; }
.count-label { font-size: 13px; color: var(--ink-dim); }
.count-bar button { padding: 4px 10px; }

.seat-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.seat {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel-2);
}
.seat.human { border-color: var(--line-strong); }
.seat.empty { background: transparent; border-style: dashed; color: var(--ink-dim); }
.seat-num { width: 22px; height: 22px; display: grid; place-items: center; flex-shrink: 0; border-radius: 3px; background: rgb(0 0 0 / 25%); font-family: var(--mono); color: var(--ink-dim); font-size: 12px; }
.seat.empty .seat-num { background: transparent; }
.seat-name { width: 64px; font-weight: 700; }
.seat.empty .seat-name { font-weight: 400; flex: 1; width: auto; }
.seat-deck { flex: 1; min-width: 0; }
.seat-diff { width: 92px; }
.seat-remove, .seat-you-tag { width: 56px; text-align: center; }
.seat-you-tag { font-size: 12.5px; color: var(--khaki); font-weight: 700; }

.room-guide { grid-area: guide; min-width: 0; }
.deck-guide { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.deck-card { padding: 8px 12px; border-left: 4px solid var(--line); background: var(--panel-2); border-radius: 0 4px 4px 0; }
.deck-red { border-left-color: #c4432f; }
.deck-yellow { border-left-color: #d6a01f; }
.deck-green { border-left-color: #4c8a3a; }
.deck-gray { border-left-color: #7b8179; }
.deck-card h4 { margin: 0; font-size: 15px; }
.deck-desc { margin: 2px 0 4px; font-size: 13px; color: var(--ink-dim); line-height: 1.45; }
.deck-line { margin: 0; font-size: 12.5px; line-height: 1.45; }
.deck-line b { margin-right: 6px; }

.room-foot { grid-area: foot; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.room-status { display: flex; flex-direction: column; font-size: 14px; }
.room-hp { color: var(--ink-dim); font-size: 13px; }
.room-start { padding: 12px 36px; font-size: 18px; }

@media (max-width: 820px) {
  .room { grid-template-columns: minmax(0, 1fr); grid-template-areas: "head" "seats" "foot" "guide"; padding: 16px; }
}
@media (max-width: 520px) {
  .seat { flex-wrap: wrap; }
  .seat-deck { flex-basis: 40%; }
}

/* ---------- 멀티플레이: 룸 추가분 ---------- */
.room-head-extra { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.room-head-extra:empty { display: none; }
.room-net { font-size: 13px; }
.seat-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat.human .seat-name { width: auto; min-width: 64px; max-width: 130px; }
.seat.mine { background: rgb(232 121 43 / 12%); border-color: var(--accent); }
.select:disabled { opacity: 0.6; cursor: default; }

.input {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--field);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
}
.input:focus { outline: none; border-color: var(--accent); }

/* ---------- 멀티플레이: 로비 ---------- */
.lobby { grid-template-columns: minmax(0, 1fr); grid-template-areas: none; }
.lobby > * { grid-area: auto; }
.lobby-nick-label { font-size: 13px; color: var(--ink-dim); }
.lobby-nick { width: 150px; }
.lobby-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.lobby-status { margin-left: auto; font-size: 13px; color: var(--ink-dim); }
.lobby-status.error { color: #e58b78; }
.lobby-table { border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
.lobby-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) minmax(0, 140px) 130px 80px;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
}
.lobby-head { font-size: 12.5px; font-weight: 700; color: var(--khaki); background: rgb(0 0 0 / 22%); }
.lobby-list { list-style: none; margin: 0; padding: 0; max-height: 52vh; overflow-y: auto; }
.lobby-list .lobby-row { border-top: 1px solid var(--line); cursor: pointer; user-select: none; }
.lobby-list .lobby-row:hover { background: var(--panel-2); }
.lobby-list .lobby-row.on { background: rgb(232 121 43 / 14%); box-shadow: inset 3px 0 0 var(--accent); }
.lobby-list .lobby-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.lobby-title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lobby-host { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-dim); font-size: 14px; }
.lobby-count { font-size: 14px; font-variant-numeric: tabular-nums; }
.lobby-phase { font-size: 13px; }
.lobby-phase.waiting { color: var(--good); }
.lobby-phase.playing { color: var(--ink-dim); }
.lobby-row.playing .lobby-title { color: var(--ink-dim); }
.lobby-empty { margin: 0; padding: 28px 14px; color: var(--ink-dim); border-top: 1px solid var(--line); }
.lobby-error { margin: 0; color: #e58b78; font-size: 14px; }
.lobby-hint { font-size: 13px; }
.lobby-dialog { width: min(420px, 92vw); }
.lobby-form { display: flex; flex-direction: column; gap: 12px; margin-bottom: 12px; }
.lobby-field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--ink-dim); }
.lobby-field .input { color: var(--ink); }
.lobby-dialog .lobby-error { margin-bottom: 10px; }

@media (max-width: 620px) {
  .lobby-row { grid-template-columns: 22px minmax(0, 1fr) auto; gap: 4px 8px; }
  .lobby-head { display: none; }
  .lobby-host { grid-column: 2; grid-row: 2; }
  .lobby-count { grid-column: 3; grid-row: 1; text-align: right; }
  .lobby-phase { grid-column: 3; grid-row: 2; text-align: right; }
  .room-head { flex-wrap: wrap; }
  .lobby-tools .btn { flex: 1; }
  .lobby-status { flex-basis: 100%; margin-left: 0; }
}

/* ---------- 게임 화면 ---------- */
.game-screen > .game-grid {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: minmax(170px, 220px) minmax(0, 1fr) minmax(190px, 260px);
  grid-template-rows: 44px auto minmax(0, 1fr) auto clamp(140px, 28vh, 250px);
  grid-template-areas:
    "status status status"
    "opps   opps   opps"
    "loc    circle log"
    "me     prompt log"
    "me     hand   log";
  gap: 8px 12px;
  padding: 12px;
  pointer-events: none;
}
.game-grid > * { pointer-events: auto; min-width: 0; min-height: 0; }
.game-grid > .g-circle-zone, .game-grid > .g-hand-zone { pointer-events: none; }

.g-status { grid-area: status; display: flex; align-items: center; gap: 14px; padding-right: 170px; flex-wrap: wrap; overflow: hidden; }
.g-round { font-weight: 700; font-size: 16px; white-space: nowrap; }
.g-lead { display: flex; align-items: center; gap: 6px; }
.g-lead small, .g-hint { font-size: 12.5px; color: var(--ink-dim); }

.g-opps { grid-area: opps; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.plate, .g-me {
  position: relative;
  padding: 6px 10px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgb(32 37 31 / 94%);
}
.plate { min-width: 150px; }
.plate.turn, .g-me.turn { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.plate.dead, .g-me.dead { opacity: 0.45; }
.plate.targetable { cursor: pointer; border-color: var(--ammo); box-shadow: 0 0 0 2px var(--ammo); }
.plate.targetable:hover { background: #3a3426; }
.plate-top { display: flex; align-items: center; gap: 6px; }
.plate-name { font-weight: 700; font-size: 15px; }
.plate-sub { font-size: 12px; color: var(--ink-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plate-stats { display: flex; gap: 12px; margin-top: 2px; }
.stat { display: inline-flex; align-items: baseline; gap: 4px; }
.stat small { font-size: 12px; color: var(--ink-dim); }
.stat b { font-size: 16px; font-variant-numeric: tabular-nums; }
.stat.hp b { color: var(--hp); }
.stat.ammo b { color: var(--ammo); }
.plate-stats.big .stat b { font-size: 22px; }
/* 체력 막대: 채운 길이 = 남은 체력, 세로 눈금 하나 = 체력 5 */
.hpbar { position: relative; height: 5px; margin-top: 4px; border-radius: 1px; background: rgb(0 0 0 / 40%); overflow: hidden; }
.hpbar i { position: absolute; inset: 0 auto 0 0; width: var(--hp); background: var(--hp); transition: width 0.25s; }
.hpbar.low i { background: #ff4d33; }
.hpbar::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 calc(var(--tick) - 1px), rgb(23 27 22 / 90%) calc(var(--tick) - 1px) var(--tick)); }
.badge { padding: 0 6px; border-radius: 2px; font-size: 12px; font-weight: 700; line-height: 18px; letter-spacing: 0.02em; }
.badge.lead { background: var(--khaki); color: var(--bg); }
.badge.hide { background: #4c8a3a; color: #fff; }
.badge.out { background: #555; color: #ddd; }
.badge.away { background: transparent; color: var(--ink-dim); border: 1px dashed var(--ink-dim); line-height: 16px; }

.g-location { grid-area: loc; align-self: start; padding: 10px 12px; border: 1px solid var(--line); border-left: 3px solid var(--khaki); border-radius: 4px; background: rgb(32 37 31 / 92%); }
.g-location h4 { margin: 0 0 2px; font-size: 12.5px; font-weight: 700; color: var(--khaki); }
.g-loc-name { display: block; font-size: 16px; font-weight: 700; }
.g-loc-lines, .me-survivor ul, .g-detail ul { margin: 4px 0 0; padding-left: 16px; font-size: 13px; line-height: 1.45; }

.g-circle-zone { grid-area: circle; position: relative; }
.g-banner {
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 18px;
  border-radius: 3px;
  background: rgb(23 27 22 / 94%);
  border: 1px solid var(--line-strong);
  border-left-width: 4px;
  font-weight: 800;
  font-size: 17px;
  letter-spacing: 0.02em;
  white-space: nowrap;
  animation: banner-in 0.2s ease-out;
}
.g-banner.round { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.g-banner.good { border-left-color: var(--good); }
.g-banner.bad { border-left-color: var(--hp); }
@keyframes banner-in { from { opacity: 0; transform: translate(-50%, -6px); } }

.g-log { grid-area: log; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 4px; background: rgb(28 32 27 / 92%); overflow: hidden; align-self: stretch; }
.g-log:not(.open) { align-self: start; }
.g-log-toggle { padding: 8px 12px; border: 0; border-bottom: 1px solid var(--line); background: rgb(0 0 0 / 18%); text-align: left; font-size: 13px; font-weight: 700; color: var(--khaki); }
.g-log:not(.open) .g-log-toggle { border-bottom: 0; }
.g-log-list { list-style: none; margin: 0; padding: 6px 12px 10px; overflow-y: auto; flex: 1; font-size: 12.5px; line-height: 1.5; }
.g-log:not(.open) .g-log-list { display: none; }
.g-log-list li { padding: 1px 0; }
.g-log-list li.sep { margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--line); color: var(--khaki); font-weight: 600; }
.g-log-list li.sep:first-child { margin-top: 0; border-top: 0; }

.g-prompt { grid-area: prompt; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 10px; min-height: 34px; font-size: 15px; text-align: center; }
.g-prompt.mine > span { padding: 2px 0 2px 10px; border-left: 4px solid var(--accent); font-weight: 800; font-size: 16px; }
.g-prompt small { font-size: 12.5px; color: var(--ink-dim); flex-basis: 100%; }
.g-hand-zone { grid-area: hand; }

.g-me { grid-area: me; align-self: end; display: flex; flex-direction: column; gap: 4px; }
.me-survivor b { font-size: 13px; }
.me-counts { display: flex; gap: 12px; }

.pop {
  position: absolute;
  right: 8px;
  top: -6px;
  font-weight: 800;
  font-size: 18px;
  pointer-events: none;
  animation: pop-up 1.1s ease-out forwards;
}
.pop-dmg { color: #ff6a4d; }
.pop-heal { color: var(--good); }
.pop-ammo { color: var(--ammo); font-size: 14px; }
@keyframes pop-up { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(-26px); } }

.g-labels { position: fixed; inset: 0; z-index: 6; pointer-events: none; }
.g-labels[hidden] { display: none; }
.circle-label {
  position: absolute;
  left: 0;
  top: 0;
  padding: 1px 7px;
  border-radius: 2px;
  background: rgb(23 27 22 / 88%);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.circle-label.mine { color: var(--khaki); font-weight: 700; }
.circle-label.winning { background: var(--accent); color: var(--accent-ink); font-weight: 700; }

.g-detail {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 15;
  width: 240px;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: rgb(23 27 22 / 97%);
  box-shadow: 0 10px 30px rgb(0 0 0 / 45%);
  pointer-events: none;
  font-size: 14px;
}
.g-detail[hidden] { display: none; }
.detail-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 4px; font-size: 12.5px; }

.g-overlay { z-index: 25; }
.g-dialog { width: min(420px, 90vw); }
.g-dialog-text { margin: 4px 0 16px; font-size: 16px; }
.g-over-title { font-size: 28px; margin-bottom: 4px; }
.g-over-sub { margin: 0 0 16px; color: var(--ink-dim); }

/* ---------- 튜토리얼: 말풍선과 강조 테두리 ---------- */
.tut-layer { position: fixed; inset: 0; z-index: 24; pointer-events: none; }
.tut-layer[hidden] { display: none; }
.tut-ring {
  position: absolute;
  left: 0;
  top: 0;
  border: 2px solid var(--accent);
  border-radius: 6px;
  box-shadow: 0 0 0 9999px rgb(10 12 10 / 38%);
  transition: transform 0.2s, width 0.2s, height 0.2s;
}
.tut-ring[hidden] { display: none; }
.tut-bubble {
  position: absolute;
  left: 0;
  top: 0;
  width: min(360px, calc(100vw - 16px));
  padding: 14px 16px 10px;
  border: 1px solid var(--line-strong);
  border-left: 4px solid var(--khaki);
  border-radius: 4px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 6px 24px rgb(0 0 0 / 45%);
  pointer-events: auto;
  transition: transform 0.2s;
}
.tut-bubble.do { border-color: var(--accent); border-width: 2px 2px 2px 4px; }
.tut-bubble.tip { border-color: var(--line); }
.tut-text { margin: 0 0 10px; font-size: 15.5px; line-height: 1.6; text-align: left; }
.tut-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 30px; }
.tut-count { color: var(--ink-dim); font-size: 13px; }
.tut-next[hidden] { display: none; }
.tut-bubble.shake { animation: tut-shake 0.3s; }
@keyframes tut-shake {
  25% { translate: -6px 0; }
  50% { translate: 6px 0; }
  75% { translate: -3px 0; }
}

/* 좁은 화면: 한 줄로 쌓고, 기록은 오른쪽 아래 접이식 */
@media (max-width: 760px) {
  .game-screen > .game-grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(44px, auto) auto auto minmax(0, 1fr) auto clamp(110px, 22vh, 200px) auto;
    grid-template-areas: "status" "opps" "loc" "circle" "prompt" "hand" "me";
    gap: 6px;
    padding: 8px;
  }
  .g-status { padding-right: 150px; gap: 4px 10px; overflow: visible; }
  .g-lead small { display: none; }
  .g-hint { display: none; }
  .plate { min-width: 0; flex: 1 1 140px; padding: 4px 8px; }
  .g-location { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; padding: 6px 10px; }
  .g-location h4 { margin: 0; }
  .g-loc-lines { margin: 0; flex-basis: 100%; }
  .g-me { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px 14px; padding: 6px 10px; }
  .me-survivor ul { display: none; }
  .g-me { padding-right: 84px; }
  .g-log { position: fixed; right: 8px; bottom: 8px; z-index: 12; width: min(320px, 86vw); max-height: 50vh; }
  .g-log:not(.open) { width: auto; }
}
/* 영어일 때만 작은 소제목을 대문자로. 한글에 자간을 넓히면 글자가 흩어져 읽기 어렵다 */
html[lang="en"] :is(.set-section h3, .room h3, .lobby-head, .g-location h4, .g-log-toggle) { text-transform: uppercase; letter-spacing: 0.06em; }
