/* =========================================================
 *  심야 병동 (NIGHT HOSPITAL) — 2004년 한국 의료기관 공포 UI
 * ========================================================= */
:root {
  --bg: #071012;
  --panel: #0c181b;
  --panel-2: #112226;
  --border: #203c42;
  --accent: #38bdf8;
  --green: #4ade80;
  --danger: #f87171;
  --warn: #fbbf24;
  --text: #e2e8f0;
  --muted: #8fa3ad;
  --paper: #e8e4d8;
  --paper-text: #1c2426;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; width: 100%; height: 100%;
  background: var(--bg); color: var(--text);
  font-family: 'Noto Sans KR', system-ui, sans-serif;
  overflow-x: hidden;
}
#app { width: 100%; max-width: 100vw; overflow-x: hidden; }
body.large-text { font-size: 18px; }
[hidden] { display: none !important; }
button { font-family: inherit; cursor: pointer; }
.muted { color: var(--muted); font-size: .88rem; }

/* 화면 전환 */
.screen { display: none; min-height: 100vh; width: 100%; position: relative; }
.screen.active { display: flex; flex-direction: column; }

/* 버튼 */
.btn {
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px;
  padding: 10px 16px; font-size: .95rem; font-weight: 600;
  transition: background .15s, border-color .15s, transform .1s;
}
.btn:hover:not(:disabled) { border-color: var(--accent); background: #163036; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: #0e4a5c; border-color: var(--accent); color: #f0f9ff; }
.btn.primary:hover:not(:disabled) { background: #156278; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); border-color: var(--border); }
.btn.small { padding: 6px 11px; font-size: .82rem; }
.btn.big { padding: 13px 26px; font-size: 1.05rem; }
.icon-btn {
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 6px; padding: 5px 9px; font-size: .95rem;
}
.icon-btn.alert { border-color: var(--danger); animation: pulseAlert 1s infinite; }
.q-chip {
  background: #142a30; color: #bae6fd; border: 1px solid #284b54;
  border-radius: 999px; padding: 5px 11px; font-size: .8rem;
}
.q-chip.asked { opacity: .55; }
.q-chip:disabled { opacity: .4; cursor: not-allowed; }

/* 배경 효과 & 타이틀 무대 */
.title-bg-stage {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background: #04090b; overflow: hidden;
}
.title-bg-img {
  position: absolute; inset: -2%;
  background-size: cover; background-position: center right;
  filter: contrast(1.06) brightness(0.76);
  transition: background-image 0.6s ease;
}
.title-shadow-drift {
  position: absolute; inset: -10%;
  background: radial-gradient(ellipse at 72% 48%, transparent 18%, rgba(3, 8, 10, 0.72) 72%);
  animation: shadowDrift 18s ease-in-out infinite alternate;
}
.title-scrim {
  position: absolute; inset: 0;
  background: linear-gradient(95deg, rgba(4, 10, 12, 0.94) 0%, rgba(4, 10, 12, 0.78) 42%, rgba(4, 10, 12, 0.18) 78%, rgba(4, 10, 12, 0.45) 100%);
}
.title-vignette {
  position: absolute; inset: 0;
  box-shadow: inset 0 0 140px rgba(0, 0, 0, 0.88);
}
.title-film-grain {
  position: absolute; inset: 0; opacity: 0.045;
  background-image: radial-gradient(#ffffff 0.6px, transparent 0.6px);
  background-size: 3px 3px;
}
.crt-scanlines {
  position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(0,0,0,0) 0, rgba(0,0,0,0) 2px, rgba(0,0,0,.18) 3px);
}
.fluorescent-glow {
  position: absolute; top: 0; right: 18%;
  width: 42%; height: 180px;
  background: radial-gradient(ellipse, rgba(167,243,208,.18), transparent 72%);
  animation: flicker 7.5s infinite;
}
body.no-flicker .fluorescent-glow, body.no-flicker .title-shadow-drift,
body.low-spec .crt-scanlines, body.low-spec .title-film-grain { animation: none; display: none; }

/* 타이틀 (영화 포스터 & 인디 공포 레이아웃) */
#screen-title { justify-content: space-between; padding: 0; }
.title-layout {
  position: relative; z-index: 2; min-height: 100vh; width: 100%; max-width: 100%; min-width: 0;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 44px 56px 26px;
}
.title-hero { max-width: 520px; width: 100%; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; }
.title-kicker {
  letter-spacing: .34em; color: var(--muted);
  font-family: 'IBM Plex Mono', monospace; margin: 0; font-size: .82rem;
}
.title-main {
  font-family: 'Song Myung', 'Noto Serif KR', serif;
  font-size: clamp(2.8rem, 5.2vw, 4.4rem);
  font-weight: 400; margin: 4px 0 10px; letter-spacing: .06em;
  color: #f4fafb;
  text-shadow: 0 0 28px rgba(94, 234, 212, 0.22), 0 4px 18px rgba(0, 0, 0, 0.85);
}
.title-tag {
  color: #cbd5e1; font-family: 'Noto Serif KR', serif;
  font-size: 1.05rem; margin: 0 0 12px; letter-spacing: .02em;
}
.title-brief { font-size: .88rem; color: var(--muted); line-height: 1.65; margin: 0 0 24px; }

.title-primary-menu { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 340px; margin-bottom: 18px; }
.menu-cta {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 13px 16px; border-radius: 6px;
  background: rgba(8, 20, 24, 0.78); backdrop-filter: blur(8px);
  border: 1px solid rgba(148, 198, 208, 0.22); color: var(--text);
  text-align: left; transition: all .2s ease;
}
.menu-cta:hover:not(:disabled) {
  border-color: var(--ns-accent, #5eead4);
  background: rgba(13, 34, 40, 0.92);
  transform: translateX(4px);
}
.menu-cta.primary {
  background: linear-gradient(90deg, rgba(14, 74, 92, 0.88), rgba(10, 46, 58, 0.84));
  border-color: rgba(94, 234, 212, 0.55);
}
.menu-cta:disabled { opacity: .4; cursor: not-allowed; }
.cta-title { font-size: 1rem; font-weight: 700; letter-spacing: .02em; }
.cta-sub { font-size: .74rem; color: var(--muted); font-family: 'IBM Plex Mono', monospace; }

.title-secondary-menu { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sec-link {
  background: rgba(6, 15, 18, 0.62); color: var(--muted);
  border: 1px solid rgba(148, 198, 208, 0.16); border-radius: 5px;
  padding: 6px 11px; font-size: .8rem; transition: color .15s, border-color .15s;
}
.sec-link:hover { color: var(--text); border-color: var(--ns-accent, #5eead4); }

.title-bottom { display: flex; flex-direction: column; gap: 10px; margin-top: 24px; }
.title-disclaimer { margin: 0; font-size: .76rem; color: rgba(147, 168, 176, 0.78); }

@keyframes shadowDrift {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(-2%, 1.5%) scale(1.03); }
}

@media (max-width: 768px) {
  .title-layout { padding: 24px 16px 20px; width: 100%; max-width: 100vw; overflow-x: hidden; }
  .title-hero { max-width: 100%; width: 100%; }
  .title-bg-img { background-position: center center; }
  .title-scrim { background: linear-gradient(180deg, rgba(4,10,12,0.72) 0%, rgba(4,10,12,0.88) 55%, rgba(4,10,12,0.96) 100%); }
  .title-primary-menu { max-width: 100%; }
  .menu-cta { flex-wrap: wrap; padding: 11px 13px; gap: 4px; }
  .cta-sub { font-size: .68rem; }
  .ns-collection-bar { max-width: 100%; }
  .title-disclaimer { font-size: .7rem; line-height: 1.4; }
}

/* 의료기관 선택 */
#screen-hospitals { padding: 28px 18px; align-items: center; }
.hosp-wrap { max-width: 1080px; width: 100%; z-index: 2; }
.hosp-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.hospitals-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.hosp-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  padding: 18px; display: flex; flex-direction: column; gap: 10px;
}
.hosp-card.locked { opacity: .62; }
.hosp-tier { font-size: .78rem; color: var(--accent); font-weight: 700; }
.hosp-card h3 { margin: 0; font-size: 1.35rem; font-family: 'Noto Serif KR', serif; }
.hosp-sub { margin: 0; font-size: .85rem; color: var(--green); }
.hosp-desc { margin: 0; font-size: .88rem; color: var(--muted); line-height: 1.5; }
.hosp-stats { display: flex; flex-direction: column; gap: 4px; font-size: .84rem; background: var(--panel-2); padding: 10px; border-radius: 6px; }
.hosp-sys { display: flex; flex-wrap: wrap; gap: 5px; }
.sys-tag { font-size: .74rem; padding: 3px 8px; border-radius: 4px; background: #142c33; border: 1px solid #264c56; color: #bae6fd; }
.hosp-days { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.hosp-lock-msg { padding: 10px; text-align: center; background: #131c1e; border-radius: 6px; font-size: .85rem; color: var(--muted); }

/* 종이 문서 & 책상 질감 고급화 */
.school-paper {
  background: linear-gradient(165deg, #ece8dc 0%, #ded8c6 100%);
  color: var(--paper-text);
  border: 1px solid #a89f85; border-radius: 5px;
  box-shadow: 0 8px 24px rgba(0,0,0,.45), inset 0 0 18px rgba(120, 108, 82, 0.14);
}

/* 일차 소개 */
#screen-intro { justify-content: center; align-items: center; padding: 24px 16px; }
.intro-wrap { max-width: 680px; width: 100%; z-index: 2; display: flex; flex-direction: column; gap: 12px; }
.intro-hanja { color: var(--accent); font-family: 'IBM Plex Mono', monospace; font-weight: 700; }
.intro-title { margin: 0; font-family: 'Noto Serif KR', serif; font-size: 1.85rem; }
.intro-sub { margin: 0; color: var(--green); font-size: .92rem; }
.intro-story { line-height: 1.65; color: #cbd5e1; }
.intro-events { margin: 0; padding-left: 20px; color: #bae6fd; font-size: .9rem; }
.bang { padding: 14px 16px; }
.rules-list { margin: 6px 0 0; padding-left: 20px; font-size: .86rem; line-height: 1.55; }
.rules-list li.new { font-weight: 700; color: #0f3a47; }

/* 메인 게임 화면 */
#screen-game { height: 100vh; overflow: hidden; }
.topbar {
  height: 48px; background: #091417; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 12px; gap: 10px; z-index: 10; flex-shrink: 0;
}
.tb-left, .tb-right { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; }
.tb-hosp { background: #12333d; color: var(--accent); padding: 3px 8px; border-radius: 4px; font-size: .8rem; font-weight: 700; }
.tb-day { font-family: 'IBM Plex Mono', monospace; font-weight: 700; color: var(--green); }
.tb-clock { font-family: 'IBM Plex Mono', monospace; color: #f8fafc; background: #13252a; padding: 2px 7px; border-radius: 4px; }
.tb-stat { font-size: .85rem; }
.tb-stat.risk b { color: var(--warn); }
.tb-stat.warn b { color: var(--danger); }

.game-main {
  flex: 1; display: grid; grid-template-columns: 420px 1fr;
  min-height: 0; overflow: hidden;
}

/* 좌측 당직 창구 */
.booth {
  background: #091316; border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 10px; gap: 8px;
  overflow-y: auto;
}
.scene {
  position: relative; height: 250px; border-radius: 8px; overflow: hidden;
  border: 3px solid #1e3338;
  box-shadow: inset 0 0 40px rgba(0,0,0,.85), 0 6px 18px rgba(0,0,0,.45);
  background: radial-gradient(circle at 50% 25%, #0c1d21 0%, #04090b 85%);
  flex-shrink: 0;
}
.scene::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  border-top: 2px solid rgba(167, 243, 208, 0.12);
  box-shadow: inset 0 0 28px rgba(0, 0, 0, 0.55);
}
.portrait-wrap { position: absolute; inset: 0; display: flex; justify-content: center; align-items: flex-end; }
.portrait-wrap img, .portrait-svg { height: 96%; width: auto; object-fit: contain; pointer-events: none; }
.reveal { position: absolute; inset: 0; pointer-events: none; clip-path: circle(0px at 50% 50%); background: rgba(12,35,30,.55); }
.scene.mirror-on .lens { display: block; }
.lens {
  display: none; position: absolute; width: 144px; height: 144px; border-radius: 50%;
  border: 2px solid var(--green); box-shadow: 0 0 22px rgba(74,222,128,.35);
  transform: translate(-50%, -50%); pointer-events: none;
}
.lens-caption {
  position: absolute; bottom: -26px; left: 50%; transform: translateX(-50%);
  white-space: nowrap; background: rgba(0,0,0,.82); color: var(--green);
  font-size: .72rem; padding: 2px 7px; border-radius: 4px;
}

.speech { padding: 10px 12px; min-height: 78px; cursor: pointer; position: relative; }
.speech-name { font-weight: 700; font-size: .84rem; color: #0f4c5c; margin-bottom: 4px; }
.speech-text { font-size: .9rem; line-height: 1.5; }
.speech-more { display: none; position: absolute; right: 10px; bottom: 6px; font-size: .75rem; }
.speech.has-more .speech-more { display: block; }

.booth-actions { display: flex; flex-direction: column; gap: 6px; }
.tool-btn {
  background: #122c33; color: #bae6fd; border: 1px solid #2b5966;
  border-radius: 6px; padding: 7px 12px; font-weight: 600; text-align: left;
}
.tool-btn.active { background: #14532d; border-color: var(--green); color: #dcfce7; }
.question-list { display: flex; flex-wrap: wrap; gap: 6px; }
.rules-panel { padding: 10px 12px; font-size: .8rem; max-height: 150px; overflow-y: auto; }
.rules-panel h4 { margin: 0 0 4px; }

/* 우측 콘솔 */
.desk { display: flex; flex-direction: column; min-height: 0; background: #0a1518; }
.console-switcher {
  display: flex; gap: 4px; padding: 6px 10px; background: #081113;
  border-bottom: 1px solid var(--border); overflow-x: auto; flex-shrink: 0;
}
.con-tab {
  background: var(--panel); color: var(--muted); border: 1px solid var(--border);
  border-radius: 6px; padding: 6px 11px; font-size: .83rem; white-space: nowrap;
}
.con-tab.active { background: #133640; color: #f0f9ff; border-color: var(--accent); }
.badge { background: var(--danger); color: #fff; border-radius: 999px; padding: 1px 6px; font-size: .72rem; margin-left: 4px; }

.mode-panel { display: none; flex: 1; min-height: 0; overflow-y: auto; padding: 10px; }
.mode-panel.active { display: flex; flex-direction: column; }

/* 서류 책상 */
.desk-tabs { display: flex; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
.desk-tab { background: var(--panel-2); color: var(--text); border: 1px solid var(--border); border-radius: 5px; padding: 5px 10px; font-size: .8rem; }
.desk-tab.active { border-color: var(--accent); }
.desk-surface {
  flex: 1; position: relative; min-height: 300px;
  background:
    radial-gradient(circle at 38% 18%, rgba(56, 189, 248, 0.08) 0%, transparent 55%),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.012) 0, rgba(255,255,255,0.012) 2px, transparent 2px, transparent 14px),
    linear-gradient(180deg, #101f23 0%, #091316 100%);
  border: 2px solid #1b3238; border-radius: 8px; overflow: hidden;
  box-shadow: inset 0 0 50px rgba(0,0,0,.65);
}
.desk-hint { position: absolute; bottom: 8px; left: 12px; font-size: .78rem; color: var(--muted); pointer-events: none; }
.doc-card {
  position: absolute; width: 255px; padding: 12px; cursor: grab; user-select: none;
  font-size: .82rem;
}
.doc-title { font-weight: 700; border-bottom: 1px solid #9e967d; padding-bottom: 4px; margin-bottom: 6px; font-size: .88rem; }
.field { display: flex; justify-content: space-between; margin: 3px 0; gap: 8px; }
.field .lbl { color: #5c584a; }
.field .val { font-weight: 600; text-align: right; }
.seal-row { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; padding-top: 6px; border-top: 1px dashed #9e967d; }
.seal-mark { border: 1.5px solid #b91c1c; color: #b91c1c; padding: 1px 6px; font-weight: 700; font-size: .74rem; }
.seal-none { color: #b91c1c; font-size: .74rem; font-weight: 700; }
.reg-scroll { max-height: 190px; overflow-y: auto; }
.reg-table { width: 100%; border-collapse: collapse; font-size: .76rem; }
.reg-table th, .reg-table td { border-bottom: 1px solid #c5beaa; padding: 4px; text-align: left; }
.wb-strip { background: #dbeafe; color: #1e293b; padding: 8px; border-radius: 4px; border: 1px solid #60a5fa; }
.wb-strip.suspect { border-color: #ef4444; background: #fee2e2; }
.wb-hidden { margin-top: 5px; font-size: .76rem; color: #b91c1c; font-weight: 700; }
.chart-box { display: flex; flex-direction: column; gap: 10px; }
.chart-page-txt { min-height: 44px; line-height: 1.55; }
.chart-nav { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding-top: 8px; border-top: 1px dashed #b5ad96; }

/* X-Ray & PACS & EMR & 증거 보드 */
.med-empty { padding: 28px; text-align: center; background: var(--panel); border: 1px dashed var(--border); border-radius: 8px; }
.xray-shell, .pacs-shell, .emr-shell, .ev-shell { display: flex; flex-direction: column; gap: 10px; }
.xray-head, .pacs-head, .emr-head, .ev-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.xray-lightbox {
  position: relative; height: 280px; border-radius: 8px; overflow: hidden;
  background: radial-gradient(circle, #e0f2fe 0%, #7dd3fc 65%, #0c4a6e 100%);
  border: 2px solid #38bdf8; display: flex; justify-content: center; align-items: center;
}
.xray-film { width: 240px; height: 240px; cursor: grab; touch-action: none; }
.xray-svg { width: 100%; height: 100%; border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.xray-dual-overlay {
  position: absolute; top: 8px; left: 8px; background: rgba(0,0,0,.75);
  color: var(--green); padding: 3px 8px; font-size: .75rem; border-radius: 4px;
}
.pacs-viewport { background: #030608; border: 1px solid var(--border); border-radius: 8px; display: flex; justify-content: center; padding: 10px; }
.pacs-svg { max-width: 300px; width: 100%; height: auto; }
.pacs-controls { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; background: var(--panel); padding: 10px; border-radius: 8px; }
.pacs-controls label { display: flex; flex-direction: column; font-size: .8rem; gap: 4px; }
.emr-input { background: var(--panel-2); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 6px 10px; }
.emr-body { background: var(--paper); color: var(--paper-text); padding: 8px; border-radius: 6px; max-height: 170px; overflow-y: auto; }
.vital-row { display: flex; justify-content: space-between; align-items: center; padding: 7px 10px; background: var(--panel); border: 1px solid var(--border); border-radius: 6px; font-size: .84rem; margin-top: 5px; }
.vital-row.anom { border-color: var(--danger); background: #261215; }
.ev-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.ev-card {
  text-align: left; background: var(--panel); color: var(--text); border: 1px solid var(--border);
  border-radius: 6px; padding: 10px; display: flex; flex-direction: column; gap: 4px;
}
.ev-card.selected { border-color: var(--green); background: #113025; }
.ev-cat { font-size: .72rem; color: var(--accent); }
.ev-title { font-weight: 700; font-size: .88rem; }
.ev-sum { font-size: .78rem; color: var(--muted); }

/* CCTV */
.cctv-shell { display: flex; flex-direction: column; gap: 8px; }
.cctv-screen { position: relative; height: 300px; background: #020605; border: 2px solid #1f3d33; border-radius: 8px; overflow: hidden; }
.cctv-img-wrap { width: 100%; height: 100%; transition: transform .2s; filter: contrast(112%) saturate(78%) blur(0.4px); }
.cctv-img-wrap.zoomed { transform: scale(1.35); }
.cctv-img-wrap img, .cctv-img-wrap svg { width: 100%; height: 100%; object-fit: cover; }
.cctv-hud { position: absolute; inset: 0; pointer-events: none; padding: 8px 12px; display: flex; flex-direction: column; justify-content: space-between; font-family: 'IBM Plex Mono', monospace; font-size: .78rem; color: #86efac; text-shadow: 0 1px 2px #000; }
.cctv-hud-top, .cctv-hud-bot { display: flex; justify-content: space-between; }
.rec-dot { color: #f87171; }
#cctv-status.anom { color: #f87171; font-weight: 700; }
.cctv-anomaly-layer { position: absolute; inset: 0; pointer-events: none; }
.cctv-ghost-silhouette { position: absolute; left: 48%; top: 30%; width: 42px; height: 110px; background: radial-gradient(ellipse, rgba(0,0,0,.85), transparent); filter: blur(2px); }
.cctv-anom-tag { position: absolute; bottom: 28px; left: 12px; background: rgba(185,28,28,.85); color: #fff; font-size: .76rem; padding: 2px 8px; border-radius: 4px; }
.cctv-off-overlay { position: absolute; inset: 0; background: #050807; display: flex; flex-direction: column; justify-content: center; align-items: center; color: var(--muted); }
.cctv-channels { display: grid; grid-template-columns: repeat(auto-fill, minmax(115px, 1fr)); gap: 5px; }
.cctv-ch { background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: 5px; padding: 5px 7px; font-size: .74rem; text-align: left; display: flex; flex-direction: column; }
.cctv-ch.active { border-color: var(--green); background: #102a20; }
.cctv-ch.alert { border-color: var(--danger); }
.cctv-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.bright-lbl { font-size: .78rem; display: flex; align-items: center; gap: 5px; }
.cctv-log { max-height: 75px; overflow-y: auto; font-size: .76rem; background: #060d0e; padding: 6px 8px; border-radius: 5px; border: 1px solid var(--border); }

/* 전화·방송·호출벨 */
.comms-shell { display: flex; flex-direction: column; gap: 10px; }
.comms-card { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 12px; }
.comms-card.ringing { border-color: var(--danger); }
.comms-head h3 { margin: 0 0 8px; font-size: .96rem; }
.phone-btn-row, .pa-btn-row, .phone-dial { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.bell-item { display: flex; justify-content: space-between; align-items: center; padding: 8px; border: 1px solid var(--border); border-radius: 6px; margin-top: 6px; font-size: .84rem; }
.bell-item.ringing { border-color: var(--warn); background: #261e0d; }

/* 하단 판정 바 */
.stamp-bar {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  padding: 8px 10px; background: #071012; border-top: 1px solid var(--border); flex-shrink: 0;
}
.stamp-btn {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 6px; border-radius: 6px; border: 1.5px solid var(--border);
  background: linear-gradient(180deg, #152a30 0%, #0d1c20 100%);
  color: var(--text); font-weight: 700; font-size: .86rem;
  box-shadow: 0 3px 0 #050c0e, inset 0 1px 0 rgba(255,255,255,0.08);
  transition: transform .08s, box-shadow .08s, filter .15s;
}
.stamp-btn:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #050c0e;
}
.stamp-btn.pass { border-color: #22c55e; }
.stamp-btn.check { border-color: #38bdf8; }
.stamp-btn.deny { border-color: #f59e0b; }
.stamp-btn.anom { border-color: #ef4444; }
.stamp-face { font-family: 'Noto Serif KR', serif; font-size: 1.05rem; }

/* 정산 & 엔딩 */
#screen-settle, #screen-ending { justify-content: center; align-items: center; padding: 24px 16px; }
.settle-wrap, .ending-wrap { max-width: 620px; width: 100%; padding: 24px; border-radius: 10px; z-index: 2; }
.ending-wrap { background: rgba(10,21,24,.94); border: 1px solid var(--border); text-align: center; }
.ending-seal { width: 64px; height: 64px; margin: 0 auto 10px; border: 2px solid var(--danger); color: var(--danger); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 2rem; font-family: 'Noto Serif KR', serif; }
.ledger { display: flex; flex-direction: column; gap: 6px; margin: 14px 0; }
.led-row { display: flex; justify-content: space-between; border-bottom: 1px dashed #a8a08a; padding-bottom: 4px; }
.partner-box { margin-top: 16px; padding: 12px; border: 1px solid #b5ad96; border-radius: 6px; background: #f4f1e6; display: flex; flex-direction: column; gap: 6px; }
.partner-notice { font-size: .74rem; color: #5c584a; }
.ending-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 16px; }

/* 모달 & 도감 그리드 */
.modal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.75); z-index: 50; justify-content: center; align-items: center; padding: 16px; }
.modal.open { display: flex; }
.modal-box { max-width: 760px; width: 100%; max-height: 85vh; overflow-y: auto; padding: 20px; position: relative; }
.modal-close { position: sticky; top: 0; float: right; background: #1c2426; color: #fff; border: none; border-radius: 50%; width: 28px; height: 28px; }
.codex-grid, .char-grid, .map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; margin-top: 10px; }
.codex-card, .char-card, .map-node { background: #f5f2e8; border: 1px solid #b5ad96; border-radius: 6px; padding: 9px; text-align: left; color: #1c2426; }
.codex-card.locked, .char-card.locked { opacity: .58; }
.char-nm { font-weight: 700; font-size: .9rem; }
.char-role { font-size: .76rem; color: #0e4a5c; margin: 2px 0 4px; }
.char-bio { font-size: .78rem; line-height: 1.4; }
.sound-box { display: flex; flex-direction: column; gap: 10px; }
.sound-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }

/* 토스트 & 플래시 */
#toast-layer { position: fixed; top: 58px; right: 14px; z-index: 60; display: flex; flex-direction: column; gap: 6px; }
.toast { background: #12282e; color: #f0f9ff; border: 1px solid var(--accent); padding: 9px 14px; border-radius: 6px; font-size: .85rem; }
.toast.good { border-color: var(--green); }
.toast.bad { border-color: var(--danger); }
#fx-flash { position: fixed; inset: 0; pointer-events: none; z-index: 55; opacity: 0; }
#fx-flash.good { animation: flashGreen .4s; }
#fx-flash.bad { animation: flashRed .4s; }

@keyframes flicker { 0%, 96%, 100% { opacity: 1; } 97% { opacity: .4; } 98% { opacity: .9; } }
@keyframes pulseAlert { 0%, 100% { opacity: 1; } 50% { opacity: .5; } }
@keyframes flashGreen { 0% { background: rgba(74,222,128,.22); opacity: 1; } 100% { opacity: 0; } }
@keyframes flashRed { 0% { background: rgba(248,113,113,.28); opacity: 1; } 100% { opacity: 0; } }

/* 모바일 대응 */
@media (max-width: 768px) {
  #screen-game { height: auto; min-height: 100vh; overflow: visible; }
  .game-main { grid-template-columns: 1fr; overflow: visible; }
  .booth { border-right: none; border-bottom: 1px solid var(--border); }
  .scene { height: 210px; }
  .stamp-bar { grid-template-columns: repeat(2, 1fr); position: sticky; bottom: 0; z-index: 15; }
  .pacs-controls { grid-template-columns: 1fr; }
}
