/*
 * shell.css — 게임 화면 뼈대: 위쪽 상태 막대 · 왼쪽 세로 책갈피(장소 이동) · 장소 화면 자리 · "준비 중" 안내판
 */

.game-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  height: 100%;
  max-width: 1560px;
  margin: 0 auto;
  padding: 12px 18px 16px 8px;
}

/* ───────── 위쪽 상태 막대 ───────── */
.ws-header { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding-left: 10px; }
.hud-name { max-width: 360px; overflow: hidden; text-overflow: ellipsis; }
.hud-chip {
  --face: var(--paper);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: var(--px);
  padding: 3px 12px;
  white-space: nowrap;
}
.hud-day b { font-family: var(--font-title); font-weight: 400; font-size: 18px; }
.hud-money { font-weight: 700; }
.hud-spacer { flex: 1; }
.hud-chip[hidden] { display: none; }

/* 소지금 · 행동력 · 체력 · 정신력 칸 (hudHelp.js) */
.hud-stats { display: flex; gap: 6px; }
.hud-stat { border: 0; font: inherit; color: inherit; cursor: pointer; gap: 4px; padding: 3px 10px; transition: transform 0.1s; }
.hud-stat:hover { --face: #fffaf0; transform: translateY(-1px); }
.hud-stat .hs-val { font-weight: 700; min-width: 1.2em; text-align: right; }
.hud-stat.is-low .hs-val { color: var(--red); }
.hud-stat-sanity.is-low .hs-val { color: var(--purple); }
.hud-stat.is-low { animation: hs-pulse 1.6s ease-in-out infinite; }
@keyframes hs-pulse { 50% { --face: #f6e1d8; } }
.hs-icon { font-size: 15px; line-height: 1; }
.hs-card { min-width: 210px; }
.hs-head { display: flex; align-items: baseline; gap: 6px; }
.hs-head .tt-name { flex: 1; }
.hs-num { font-size: 16px; color: #3a2718; }
.hs-gauge { height: 8px; margin: 6px 0 6px; background: #e8dcc4; box-shadow: 0 0 0 2px #3a2718; }
.hs-gauge span { display: block; height: 100%; background: var(--c); box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.35); transition: width 0.3s; }
.hs-short { font-size: 13px; color: #5b4632; }
.hs-warn { margin: 6px 0 0; padding: 4px 8px; background: #efe3f6; color: #5b3f74; font-size: 12.5px; font-weight: 700; }
.hs-click { margin-top: 6px; padding-top: 5px; border-top: 2px dotted rgba(139, 90, 52, 0.35); font-size: 12px; color: #a0522d; }
.hs-modal { width: min(460px, 92vw); }
.hs-modal-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.hs-modal-head > div { flex: 1; }
.hs-modal-head .modal-title { margin: 0; text-align: left; }
.hs-big-icon { display: grid; place-items: center; width: 48px; height: 48px; font-size: 28px; background: #fffaf0; box-shadow: 0 0 0 3px var(--c); }
.hs-num-lg { font-size: 22px; font-family: var(--font-title); font-weight: 400; }
.hs-uses { margin: 4px 0 8px; padding-left: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; font-size: 14.5px; line-height: 1.6; }
.hs-uses li { position: relative; padding-left: 20px; }
.hs-uses li::before { content: '◆'; position: absolute; left: 2px; color: var(--c); font-size: 11px; top: 3px; }
.hs-next { margin: 0; font-size: 13px; color: var(--ink-soft); }
.px-icon { width: 32px; height: 32px; flex: none; image-rendering: pixelated; }
.btn .px-icon { margin: -6px 2px -6px -4px; vertical-align: middle; }
.hud-chip .px-icon { margin: -4px 0 -4px -6px; }

/* ───────── 왼쪽 책갈피 + 장소 화면 ───────── */
.shell-body { display: grid; grid-template-columns: 80px minmax(0, 1fr); min-height: 0; }

.scene-nav {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  padding-top: 18px;
}
.scene-tab {
  --face: var(--wood);
  --line: var(--ink);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  width: 66px;
  padding: 8px 4px 6px;
  border: 0;
  background: var(--face);
  /* 오른쪽은 테두리 없이 → 장소 화면 뒤에서 튀어나온 책갈피처럼 */
  box-shadow:
    inset 0 3px 0 rgba(255, 222, 182, 0.28),
    inset 0 -3px 0 rgba(40, 20, 8, 0.3),
    0 calc(-1 * var(--px)) 0 0 var(--line),
    0 var(--px) 0 0 var(--line),
    calc(-1 * var(--px)) 0 0 0 var(--line);
  color: #f7ead0;
  line-height: 1.3;
  cursor: pointer;
  transition: width 0.12s, background-color 0.12s;
}
.scene-tab:hover { --face: var(--wood-light); width: 70px; }
.scene-tab:focus-visible { outline: 2px dashed var(--red); outline-offset: 4px; }
.scene-tab.is-active { --face: var(--red); width: 80px; }
.scene-tab.is-active::after { /* 지금 장소 표시: 오른쪽 작은 삼각형 */
  content: '';
  position: absolute;
  top: 50%;
  right: 4px;
  border: 5px solid transparent;
  border-left-color: #fff4e2;
  transform: translateY(-50%);
}
.scene-icon { width: 32px; height: 32px; image-rendering: pixelated; filter: drop-shadow(0 2px 0 rgba(40, 20, 8, 0.35)); }
.scene-key { position: absolute; top: 3px; left: 6px; font-size: 10px; opacity: 0.75; }
.scene-label { font-family: var(--font-title); font-size: 14px; white-space: nowrap; }
.scene-badge { padding: 0 5px; background: rgba(255, 244, 226, 0.22); font-size: 10.5px; }
.scene-badge:empty { display: none; }
.scene-soon { font-size: 10px; opacity: 0.85; }
.scene-tab.is-soon:not(.is-active) { --face: #9c7d5e; }
.scene-tab.is-soon .scene-icon { filter: grayscale(0.6) opacity(0.8) drop-shadow(0 2px 0 rgba(40, 20, 8, 0.3)); }

.scene-host { position: relative; min-height: 0; }
.scene { position: absolute; inset: 0; }
.scene[hidden] { display: none; }

/* ───────── "준비 중" 안내판 ───────── */
.soon-wrap { height: 100%; display: flex; align-items: center; justify-content: center; padding: 20px; }
.soon-card { width: min(580px, 100%); padding: 26px 36px 30px; align-items: center; text-align: center; }
.soon-head { display: flex; justify-content: center; margin-bottom: 18px; }
.soon-icons { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; margin-bottom: 14px; }
.soon-icons img { width: 64px; height: 64px; image-rendering: pixelated; }
.soon-lead { margin: 0 0 14px; font-size: 16px; line-height: 1.8; }
.soon-list {
  margin: 0 0 22px;
  padding: 12px 18px 12px 36px;
  background: var(--paper-2);
  box-shadow: 0 0 0 2px var(--paper-edge);
  line-height: 1.9;
  text-align: left;
}
.soon-stamp {
  display: inline-block;
  padding: 4px 18px;
  border: 3px solid var(--red);
  color: var(--red);
  font-family: var(--font-title);
  font-size: 20px;
  transform: rotate(-4deg);
  opacity: 0.85;
}

/* ───────── 좁은 화면: 책갈피를 위쪽 가로줄로 ───────── */
@media (max-width: 760px) {
  body { overflow: auto; }
  .game-shell { height: auto; padding-left: 12px; }
  .shell-body { grid-template-columns: 1fr; }
  .scene-nav { flex-direction: row; align-items: flex-end; padding: 0 0 0 6px; }
  .scene-tab, .scene-tab:hover, .scene-tab.is-active { width: auto; padding: 6px 10px; }
  .scene-tab.is-active::after { display: none; }
  .scene { position: static; }
}

/* ───────── 하루 흐름 (2단계) ───────── */
.hud-phase { color: var(--ink-2); }
.hud-phase-btn { white-space: nowrap; }
.game-shell.is-night .hud-phase-btn { --face: #4a4f7a; --line: #262a4a; --hi: rgba(200, 210, 255, 0.3); }
.game-shell.is-night .hud-phase-btn:hover:not(:disabled) { --face: #5b6194; }
.hud-save { font-size: 12px; color: var(--ink-soft); white-space: nowrap; }
.hud-save.is-error { color: var(--red); font-weight: 700; }
.hud-save.is-flash { animation: save-flash 1.2s ease-out; }
@keyframes save-flash { 0% { color: var(--green); } 100% { color: var(--ink-soft); } }

/* 밤: 화면 전체가 살짝 푸르스름하게 어두워짐 */
.game-shell { transition: filter 0.6s; }
body:has(.game-shell.is-night) { background-color: #cfc6b8; }
.game-shell.is-night .panel,
.game-shell.is-night .codex-desk { filter: brightness(0.94) saturate(0.85); }
.game-shell.is-night .hud-chip.hud-day { --face: #e3e3ef; }

/* 저장 칸 (브라우저 · 서버) */
.hud-saves { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.3; }
button.hud-save { border: 0; background: none; padding: 0; font: inherit; font-size: 12px; cursor: pointer; }
button.hud-save:hover { text-decoration: underline; }
.hud-cloud { font-size: 11.5px; color: #2f6f8f; white-space: nowrap; }
.hud-cloud.is-dirty { color: #a0522d; }
.hud-cloud[hidden], .hud-cloud-btn[hidden] { display: none; }
.hud-cloud-btn { white-space: nowrap; }
