/* Z-DAY 게임 스타일 (index.html 에서 분리) */
  :root {
    --bg: #0b0708;
    --panel: rgba(32, 16, 19, 0.78);
    --panel-strong: rgba(44, 20, 24, 0.92);
    --line: #3d2327;
    --text: #f5ecec;
    --muted: #b59c9f;
    --red: #ff3344;
    --red-deep: #b3121f;
    --amber: #ffb020;
    --green: #5ee08a;
    --gold: #ffcf4a;          /* 숨겨진 선택지 · 배트 등 아이템 덕분에 생긴 것 */
    --track: #1d1012;         /* 게이지 · 막대의 빈 바탕 */
    --radius: 16px;           /* 패널 · 카드 · 선택지 */
    --radius-btn: 14px;       /* 누르는 버튼 */
    --font-mono: ui-monospace, "SF Mono", Consolas, monospace;           /* 숫자 · 타이머 */
    --font-display: "ZDay Title", "Black Han Sans", system-ui, sans-serif;            /* 제목 (메인 페이지와 같은 글꼴) */
  }

  /* 시작 화면 제목 글자만 담은 Black Han Sans (전체 글꼴은 Google Fonts 에서 나중에) */
  @font-face {
    font-family: "ZDay Title";
    src: url("/z-day/fonts/zday-title.woff2") format("woff2");
    font-display: swap;
    unicode-range: U+2D, U+41, U+44, U+59-5A;
  }

  * { box-sizing: border-box; }

  html, body { margin: 0; min-height: 100%; }

  body {
    background:
      radial-gradient(ellipse at 50% 120%, rgba(179, 18, 31, 0.25), transparent 60%),
      var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
    line-height: 1.5;
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
  }

  button { font: inherit; color: inherit; }

  [hidden] { display: none !important; }

  /* 화면에는 안 보이고 스크린리더만 읽음 */
  .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    border: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  /* ---------- 화면 효과 ---------- */

  /* 붉은 경고등 */
  .fx-alarm {
    position: fixed;
    top: -45vh;
    left: 50%;
    width: 160vw;
    height: 90vh;
    transform: translateX(-50%);
    background: radial-gradient(ellipse at center, rgba(255, 40, 60, 0.42), transparent 62%);
    animation: alarm 2.4s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
  }

  /* 가장자리 어둡게 */
  .fx-vignette {
    position: fixed;
    inset: 0;
    background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.75));
    pointer-events: none;
    z-index: 0;
  }

  /* CRT 스캔라인 */
  .fx-scan {
    position: fixed;
    inset: 0;
    background: repeating-linear-gradient(
      to bottom,
      rgba(0, 0, 0, 0.22) 0 1px,
      transparent 1px 3px
    );
    pointer-events: none;
    z-index: 50;
  }

  /* 가끔 번쩍이는 화면 */
  .fx-flicker {
    position: fixed;
    inset: 0;
    background: #ffdfe2;
    opacity: 0;
    animation: flicker 7s infinite;
    pointer-events: none;
    z-index: 51;
  }

  @keyframes alarm {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
  }
  @keyframes flicker {
    0%, 91%, 100% { opacity: 0; }
    92% { opacity: 0.07; }
    93% { opacity: 0; }
    95% { opacity: 0.1; }
    96% { opacity: 0; }
  }
  @keyframes jitter {
    0%, 95%, 100% { transform: translate(0, 0); }
    96% { transform: translate(2px, -1px); }
    97% { transform: translate(-2px, 1px); }
    98% { transform: translate(1px, 0); }
  }

  /* ---------- 레이아웃 ---------- */

  .wrap {
    position: relative;
    z-index: 1;
    max-width: 480px;
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0 auto;
    padding: 0 18px calc(24px + env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    animation: jitter 9s infinite;
  }

  #app {
    flex: 1;
    display: flex;
    flex-direction: column;
  }

  .screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding-top: 20px;
    animation: screen-in 0.45s ease both;
  }

  @keyframes screen-in {
    from { opacity: 0; transform: translateY(14px); filter: blur(3px); }
    to { opacity: 1; transform: none; filter: none; }
  }

  .actions {
    margin-top: auto;
    padding-top: 28px;
    display: grid;
    gap: 10px;
  }

  /* ---------- 상단 HUD (날짜·시간 + 📓 ⚙️) ---------- */

  #hud {
    position: sticky;
    top: 0;
    z-index: 5;
    padding: calc(14px + env(safe-area-inset-top)) 0 10px;
    background: linear-gradient(var(--bg) 75%, transparent);
  }
  #hud[hidden] { display: none; }

  .hud-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
  }
  .hud-day {
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 800;
    color: var(--amber);
    letter-spacing: 0.04em;
  }
  .inv-icon {
    position: relative;
    padding: 2px;
    border: 0;
    background: none;
    font-size: 17px;
    line-height: 1;
    cursor: pointer;
  }
  .inv-icon::after {
    content: attr(data-name);
    position: absolute;
    top: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 8px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--panel-strong);
    color: var(--text);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s;
  }
  .inv-icon.show-name::after { opacity: 1; }

  /* ---------- 버튼 ---------- */

  .btn {
    width: 100%;
    min-height: 58px;
    padding: 14px 20px;
    border: 0;
    border-radius: var(--radius-btn);
    background: linear-gradient(180deg, var(--red), var(--red-deep));
    color: #fff;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 0.02em;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(255, 51, 68, 0.3);
    transition: transform 0.12s ease, filter 0.12s ease;
  }
  .btn:hover { filter: brightness(1.08); }
  .btn:active { transform: scale(0.98); }
  .btn:focus-visible, .choice:focus-visible {
    outline: 3px solid var(--amber);
    outline-offset: 3px;
  }
  .btn-pulse { animation: btn-pulse 1.8s ease-in-out infinite; }
  .btn-ghost {
    background: transparent;
    border: 1px solid var(--line);
    box-shadow: none;
    color: var(--text);
  }

  @keyframes btn-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 51, 68, 0.55), 0 8px 24px rgba(255, 51, 68, 0.3); }
    50% { box-shadow: 0 0 0 12px rgba(255, 51, 68, 0), 0 8px 24px rgba(255, 51, 68, 0.3); }
  }

  /* ---------- 시작 화면 ---------- */

  .start {
    text-align: center;
    justify-content: center;
    padding-top: calc(40px + env(safe-area-inset-top));
  }
  .alert-pill {
    align-self: center;
    padding: 6px 14px;
    border: 1px solid rgba(255, 51, 68, 0.6);
    border-radius: 99px;
    background: rgba(255, 51, 68, 0.12);
    color: var(--red);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.16em;
    animation: blink 1.2s steps(1) infinite;
  }
  @keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
  }
  .start-zombie {
    font-size: 72px;
    margin: 28px 0 4px;
    animation: sway 3s ease-in-out infinite;
  }
  @keyframes sway {
    0%, 100% { transform: rotate(-6deg) translateY(0); }
    50% { transform: rotate(6deg) translateY(-6px); }
  }
  .start-sub {
    margin: 18px auto 0;
    max-width: 320px;
    color: var(--muted);
    font-size: 17px;
  }
  .start-sub strong { color: var(--text); }
  .start-meta {
    margin-top: 14px;
    color: var(--muted);
    font-size: 13px;
    text-align: center;
  }
  .disclaimer {
    margin: 10px 0 0;
    color: #7d6668;
    font-size: 12px;
    text-align: center;
  }

  /* 글리치 타이틀 */
  .glitch {
    position: relative;
    display: inline-block;
    margin: 0;
    font-family: var(--font-display);
    font-size: clamp(64px, 22vw, 96px);
    font-weight: 400;
    line-height: 1;
    letter-spacing: 0.04em;
    color: #fff;
    text-shadow: 0 0 18px rgba(255, 51, 68, 0.75), 0 0 42px rgba(255, 51, 68, 0.4);
  }
  .glitch::before,
  .glitch::after {
    content: attr(data-text);
    position: absolute;
    inset: 0;
    text-shadow: none;
  }
  .glitch::before {
    color: var(--red);
    animation: glitch-a 3.2s infinite steps(1);
  }
  .glitch::after {
    color: #37e1ff;
    opacity: 0.7;
    animation: glitch-b 3.2s infinite steps(1);
  }
  @keyframes glitch-a {
    0%, 84%, 100% { transform: none; clip-path: inset(0 0 100% 0); }
    85% { transform: translate(-5px, -1px); clip-path: inset(8% 0 58% 0); }
    88% { transform: translate(4px, 1px); clip-path: inset(62% 0 8% 0); }
    91% { transform: translate(-3px, 0); clip-path: inset(30% 0 42% 0); }
  }
  @keyframes glitch-b {
    0%, 84%, 100% { transform: none; clip-path: inset(0 0 100% 0); }
    86% { transform: translate(5px, 1px); clip-path: inset(50% 0 20% 0); }
    89% { transform: translate(-4px, 0); clip-path: inset(15% 0 65% 0); }
    92% { transform: translate(2px, -1px); clip-path: inset(70% 0 4% 0); }
  }

  /* 친구 결과 카드 */
  .friend {
    margin: 0 0 8px;
    padding: 16px;
    border: 1px solid rgba(255, 176, 32, 0.45);
    border-radius: var(--radius);
    background: rgba(255, 176, 32, 0.08);
    text-align: center;
  }
  .friend-label {
    margin: 0 0 4px;
    color: var(--amber);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.12em;
  }
  .friend-value {
    margin: 0;
    font-size: 18px;
    font-weight: 800;
  }
  .friend-score {
    margin: 2px 0 0;
    color: var(--muted);
    font-size: 13px;
  }

  /* ---------- 질문 화면 ---------- */

  .q-tag {
    margin: 8px 0 6px;
    color: var(--red);
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.08em;
  }
  .q-text {
    margin: 0 0 24px;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.65;
    word-break: keep-all;
    white-space: pre-line;
  }
  .choices {
    display: grid;
    gap: 12px;
  }
  .choice {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    min-height: 66px;
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
    font-size: 17px;
    font-weight: 600;
    text-align: left;
    word-break: keep-all;
    cursor: pointer;
    backdrop-filter: blur(6px);
    transition: border-color 0.15s, background 0.15s, transform 0.12s, opacity 0.2s;
    animation: screen-in 0.4s ease both;
  }
  .choice:nth-child(2) { animation-delay: 0.05s; }
  .choice:nth-child(3) { animation-delay: 0.1s; }
  .choice:nth-child(4) { animation-delay: 0.15s; }
  .choice:hover { border-color: rgba(255, 51, 68, 0.6); }
  .choice:active { transform: scale(0.985); }
  .choice:disabled { cursor: default; }
  .choice-key {
    flex: none;
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: rgba(255, 51, 68, 0.14);
    color: var(--red);
    font-size: 14px;
    font-weight: 900;
  }
  .choice.picked {
    border-color: var(--red);
    background: rgba(255, 51, 68, 0.2);
    box-shadow: 0 0 0 1px var(--red), 0 0 24px rgba(255, 51, 68, 0.35);
  }
  .choice.picked .choice-key { background: var(--red); color: #fff; }
  .choice.dim { opacity: 0.35; }
  .choice-body { display: grid; gap: 4px; }
  .choice-tag {
    justify-self: start;
    padding: 2px 8px;
    border-radius: 99px;
    background: rgba(255, 176, 32, 0.15);
    color: var(--amber);
    font-size: 12px;
    font-weight: 800;
  }
  .choice-note { color: var(--muted); font-size: 13px; font-weight: 600; }
  .choice.locked { opacity: 0.4; border-style: dashed; }
  .choice.locked .choice-key { background: rgba(181, 156, 159, 0.15); color: var(--muted); }
  .choice-result.death {
    border-left-color: var(--red-deep);
    background: rgba(179, 18, 31, 0.25);
    color: #ffd6da;
  }
  .choice-result {
    margin: 18px 0 0;
    padding: 14px 18px;
    border-left: 3px solid var(--red);
    border-radius: 0 var(--radius) var(--radius) 0;
    background: var(--panel-strong);
    font-size: 16px;
    font-weight: 600;
    line-height: 1.5;
    word-break: keep-all;
    animation: screen-in 0.3s ease both;
  }

  /* 도박 선택지 */
  .gamble {
    padding: 32px 20px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel-strong);
    text-align: center;
    animation: screen-in 0.4s ease both;
  }
  .gamble-icon { font-size: 56px; }
  .gamble-wait {
    margin: 14px 0 0;
    color: var(--muted);
    font-size: 18px;
    font-weight: 700;
    animation: blink 0.9s ease-in-out infinite;
  }
  .gamble.waiting .gamble-icon { animation: shake 0.5s ease-in-out infinite; }
  @keyframes shake {
    0%, 100% { transform: rotate(0); }
    25% { transform: rotate(-4deg); }
    75% { transform: rotate(4deg); }
  }
  .gamble-result {
    margin: 14px 0 22px;
    font-size: 19px;
    font-weight: 800;
    word-break: keep-all;
  }
  .gamble.tone-good { border-color: rgba(94, 224, 138, 0.6); }
  .gamble.tone-bad { border-color: rgba(255, 51, 68, 0.7); animation: screen-in 0.4s ease both, shake 0.3s 2; }
  .gamble.tone-none { border-color: rgba(181, 156, 159, 0.5); }

  /* ---------- 긴급속보 (재난문자) ---------- */

  .alert-card {
    margin-top: 24px;
    padding: 18px 18px 20px;
    border: 1px solid rgba(255, 51, 68, 0.55);
    border-radius: var(--radius);
    background: var(--panel-strong);
    box-shadow: 0 0 40px rgba(255, 51, 68, 0.18);
    cursor: pointer;
  }
  .alert-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 12px;
    color: var(--red);
    font-size: 14px;
    font-weight: 900;
    letter-spacing: 0.06em;
    animation: blink 1.2s steps(1) infinite;
  }
  .alert-msg {
    margin: 0;
    min-height: 3em;
    font-size: 19px;
    font-weight: 700;
    line-height: 1.6;
    word-break: keep-all;
  }
  .typing::after {
    content: '▍';
    margin-left: 2px;
    color: var(--red);
    animation: blink 0.7s steps(1) infinite;
  }
  .news-lines { margin-top: 24px; }
  .news-lines p {
    margin: 0 0 12px;
    font-size: 17px;
    font-weight: 600;
    line-height: 1.6;
    word-break: keep-all;
    animation: screen-in 0.6s ease both;
  }
  .news-lines p:last-child { color: var(--amber); font-weight: 800; }

  /* ---------- 짐 싸기 ---------- */

  .pack-urge {
    margin: -8px 0 14px;
    color: var(--amber);
    font-size: 17px;
    font-weight: 900;
  }
  .pack-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
  }
  .pack-timer {
    font-family: var(--font-mono);
    font-size: 16px;
    font-weight: 800;
    color: var(--muted);
  }
  .pack-timer b {
    margin-right: 2px;
    color: var(--text);
    font-size: 44px;
    line-height: 1;
    font-variant-numeric: tabular-nums;
  }
  .pack-timer.warn b {
    color: var(--red);
    text-shadow: 0 0 16px rgba(255, 51, 68, 0.7);
    animation: blink 0.5s steps(1) infinite;
  }
  .pack-slots {
    display: grid;
    justify-items: end;
    gap: 4px;
    font-size: 13px;
    font-weight: 700;
    color: var(--muted);
  }
  .pack-slot-row { display: flex; gap: 4px; }
  .pack-slot-row i {
    width: 18px;
    height: 18px;
    border: 1px solid var(--line);
    border-radius: 5px;
    background: rgba(0, 0, 0, 0.3);
  }
  .pack-slot-row i.full { border-color: var(--red); background: var(--red); }
  .pack-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .pack-item {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 62px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-btn);
    background: var(--panel);
    text-align: left;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, opacity 0.15s;
  }
  .pack-item:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
  .pack-item[aria-pressed="true"] {
    border-color: var(--red);
    background: rgba(255, 51, 68, 0.2);
    box-shadow: 0 0 0 1px var(--red);
  }
  .pack-item:disabled { opacity: 0.35; cursor: default; }
  .pack-emoji { flex: none; font-size: 26px; }
  .pack-info { display: grid; min-width: 0; }
  .pack-name { font-size: 14px; font-weight: 800; word-break: keep-all; }
  .pack-name small { color: var(--amber); font-size: 12px; font-weight: 800; }
  .pack-desc { color: var(--muted); font-size: 12px; line-height: 1.35; word-break: keep-all; }
  .pack-done .inv-list { justify-content: center; margin-top: 18px; }
  .after-text { margin-top: 24px; }

  /* ---------- 단톡방 말풍선 ---------- */

  .chat {
    display: grid;
    gap: 10px;
    margin: 4px 0 20px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(0, 0, 0, 0.3);
  }
  .bubble {
    justify-self: start;
    max-width: 88%;
    animation: screen-in 0.4s ease both;
  }
  .bubble-who {
    display: block;
    margin: 0 0 3px 4px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
  }
  .bubble p {
    margin: 0;
    padding: 9px 13px;
    border-radius: 4px 14px 14px 14px;
    background: #3a2428;
    font-size: 15px;
    line-height: 1.45;
    word-break: keep-all;
  }
  .bubble:nth-child(2) { animation-delay: 0.35s; }
  .bubble:nth-child(3) { animation-delay: 0.7s; }
  .bubble:nth-child(4) { animation-delay: 1.05s; }
  .bubble:nth-child(5) { animation-delay: 1.4s; }

  .delay-in { animation: screen-in 0.5s ease both; }

  /* ---------- 랜덤 이벤트 ---------- */

  .event {
    margin-top: 40px;
    padding: 36px 22px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel-strong);
    text-align: center;
  }
  .event-title {
    margin: 0;
    font-size: 15px;
    font-weight: 900;
    letter-spacing: 0.06em;
  }
  .event-good { border-color: rgba(94, 224, 138, 0.55); box-shadow: 0 0 40px rgba(94, 224, 138, 0.12); }
  .event-good .event-title { color: var(--green); }
  .event-bad { border-color: rgba(255, 176, 32, 0.55); box-shadow: 0 0 40px rgba(255, 176, 32, 0.12); }
  .event-bad .event-title { color: var(--amber); }
  .event-icon {
    margin: 22px 0 14px;
    font-size: 64px;
    animation: pop 0.5s 0.15s cubic-bezier(0.2, 1.6, 0.4, 1) both;
  }
  @keyframes pop {
    from { transform: scale(0.3); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
  }
  .event-text {
    margin: 0;
    font-size: 20px;
    font-weight: 800;
    word-break: keep-all;
  }
  .event-note {
    margin: 12px 0 0;
    color: var(--green);
    font-size: 15px;
    font-weight: 800;
  }

  /* ---------- 결과 화면 ---------- */

  .result { text-align: center; padding-top: calc(28px + env(safe-area-inset-top)); }
  .result-label {
    margin: 0;
    color: var(--red);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.2em;
  }
  .type-emoji {
    margin: 14px 0 4px;
    font-size: 84px;
    line-height: 1.1;
    animation: pop 0.6s cubic-bezier(0.2, 1.6, 0.4, 1) both;
  }
  .type-name {
    margin: 0;
    font-size: 32px;
    font-weight: 900;
    text-shadow: 0 0 20px rgba(255, 51, 68, 0.55);
  }
  .days {
    margin: 18px 0 4px;
    font-size: 19px;
    font-weight: 700;
    word-break: keep-all;
  }
  .days b {
    color: var(--amber);
    font-size: 34px;
    font-variant-numeric: tabular-nums;
  }
  .score {
    margin: 0;
    color: var(--muted);
    font-size: 15px;
  }
  .score b {
    color: var(--text);
    font-size: 20px;
    font-variant-numeric: tabular-nums;
  }

  .card {
    margin-top: 16px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
    text-align: left;
  }
  .card-title {
    margin: 0 0 12px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.08em;
  }
  .card p { margin: 0; word-break: keep-all; }
  .card .lead { font-weight: 800; margin-bottom: 6px; }
  .card-strength { border-color: rgba(94, 224, 138, 0.4); }
  .card-strength .card-title { color: var(--green); }
  .card-weakness { border-color: rgba(255, 51, 68, 0.45); }
  .card-weakness .card-title { color: var(--red); }

  .stat {
    display: grid;
    grid-template-columns: 76px 1fr 34px;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    font-size: 14px;
  }
  .stat:last-child { margin-bottom: 0; }
  .stat-name { font-weight: 700; white-space: nowrap; }
  .stat-bar {
    height: 10px;
    border-radius: 99px;
    background: #2a1619;
    overflow: hidden;
  }
  .stat-bar i {
    display: block;
    height: 100%;
    width: 0;
    border-radius: 99px;
    transition: width 1s cubic-bezier(0.2, 0.8, 0.2, 1);
  }
  .stat-val {
    text-align: right;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
  }
  .lv-low { background: var(--red); box-shadow: 0 0 8px var(--red); }
  .lv-mid { background: var(--amber); box-shadow: 0 0 8px var(--amber); }
  .lv-high { background: var(--green); box-shadow: 0 0 8px var(--green); }

  .badges {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
  }
  .badge {
    padding: 8px 14px;
    border: 1px solid rgba(255, 176, 32, 0.6);
    border-radius: 99px;
    background: rgba(255, 176, 32, 0.12);
    color: var(--amber);
    font-size: 14px;
    font-weight: 800;
    animation: pop 0.5s 0.8s cubic-bezier(0.2, 1.6, 0.4, 1) both;
  }

  .inv-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }
  .inv-item {
    padding: 6px 12px;
    border: 1px solid var(--line);
    border-radius: 99px;
    background: rgba(0, 0, 0, 0.25);
    font-size: 14px;
    font-weight: 700;
  }
  .card .inv-empty { color: var(--muted); }

  /* ---------- 토스트 ---------- */

  #toast {
    position: fixed;
    left: 50%;
    bottom: calc(28px + env(safe-area-inset-bottom));
    z-index: 60;
    padding: 12px 20px;
    border-radius: 99px;
    background: #fff;
    color: #111;
    font-weight: 800;
    font-size: 15px;
    opacity: 0;
    transform: translate(-50%, 16px);
    transition: opacity 0.25s, transform 0.25s;
    pointer-events: none;
  }
  #toast.show { opacity: 1; transform: translate(-50%, 0); }

  /* ---------- 푸터 ---------- */

  .site-footer {
    margin-top: 32px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 12px;
    text-align: center;
  }
  .site-footer nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px 16px;
    margin-bottom: 6px;
  }
  .site-footer nav a { color: var(--text); font-weight: 700; text-decoration: none; }
  .site-footer p { margin: 0; }
  .site-footer p a { color: inherit; }
  .site-footer a:hover { color: var(--red); }

  /* ---------- FAMILY SITE 드롭다운 ---------- */
  .family-site { position: relative; display: inline-block; margin-top: 10px; }
  .family-site summary {
    display: inline-flex; align-items: center; gap: 4px; cursor: pointer; list-style: none;
    color: var(--text); font-weight: 700; font-size: 12px; padding: 6px 10px; border-radius: 99px; border: 1px solid var(--line);
  }
  .family-site summary::-webkit-details-marker { display: none; }
  .family-site summary::marker { content: ''; }
  .family-site summary:hover { color: var(--red); border-color: var(--red); }
  .family-site .fs-arrow::before { content: '▾'; }
  .family-site[open] .fs-arrow::before { content: '▴'; }
  .family-site ul {
    position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
    margin: 0; padding: 6px; list-style: none; z-index: 30;
    background: var(--panel-strong); border: 1px solid var(--line); border-radius: var(--radius);
    width: max-content; max-width: calc(100vw - 32px); box-shadow: 0 12px 36px rgba(0, 0, 0, 0.5);
  }
  .family-site li a {
    display: block; padding: 10px 14px; white-space: nowrap; color: var(--text); text-decoration: none; font-size: 13px; border-radius: 10px;
  }
  .family-site li a:hover, .family-site li a:focus-visible { background: rgba(255, 255, 255, 0.08); color: var(--red); }

  /* ---------- 기억 알림 (memoryText) ---------- */

  #memory {
    position: fixed;
    top: calc(12px + env(safe-area-inset-top));
    left: 50%;
    z-index: 60;
    width: max-content;
    max-width: calc(100% - 32px);
    padding: 12px 18px;
    border: 1px solid rgba(255, 176, 32, 0.6);
    border-radius: 12px;
    background: var(--panel-strong);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    color: var(--amber);
    font-size: 14px;
    font-weight: 700;
    text-align: center;
    word-break: keep-all;
    opacity: 0;
    transform: translate(-50%, -12px);
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
  }
  #memory.show { opacity: 1; transform: translate(-50%, 0); }

  /* ---------- HUD 일지 아이콘 ---------- */

  .hud-right { display: flex; align-items: center; gap: 10px; }
  .hud-journal {
    position: relative;
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--panel);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
  }
  .hud-journal:hover:not(:disabled) { border-color: rgba(255, 176, 32, 0.6); }
  .hud-journal:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
  .hud-journal:disabled { opacity: 0.35; cursor: default; }
  .hud-dot {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--red);
    box-shadow: 0 0 0 2px var(--bg), 0 0 8px var(--red);
  }

  /* ---------- 장면 사진 (화면 전체 배경) ---------- */
  /* 화면이 사진보다 좁으면(모바일) 꽉 채우고 초점(--fx) 기준으로 양옆이 잘림.
     화면이 사진보다 넓으면(PC) 가운데에 사진 전체 + 양옆은 같은 사진을 흐리고 어둡게 확대 */

  #stage {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
    container-type: size;
    transition: background-color 0.8s ease;
  }
  /* 사진이 있을 때 화면 배경은 아주 어두운 단색 */
  body.has-photo #stage { background-color: #0b0708; }
  .stage-layer {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.8s ease;
    will-change: opacity;
  }
  .stage-layer.on { opacity: 1; }
  /* 사진의 색 기운만 양옆에 은은하게 번지게 (형태는 알아볼 수 없을 만큼 흐리고 옅게) */
  .stage-fill {
    position: absolute;
    inset: -12%;
    background: center / cover no-repeat;
    filter: blur(90px) saturate(1.3);
    opacity: 0.13;
  }
  .stage-photo {
    --w: calc(100vh * var(--ar, 0.75));
    position: absolute;
    top: 0;
    left: calc(min(0px, (100vw - var(--w)) * var(--fx, 0.5)) + max(0px, (100vw - var(--w)) / 2));
    width: var(--w);
    height: 100%;
    /* 위쪽 5% · 아래쪽 12% 를 투명하게 녹여 HUD 와 본문 패널로 자연스럽게 이어지게 */
    -webkit-mask-image: linear-gradient(to bottom, transparent 0%, transparent 0.5%, rgba(0, 0, 0, 0.4) 2.2%, rgba(0, 0, 0, 0.8) 3.6%,
      #000 5%, #000 88%, rgba(0, 0, 0, 0.82) 91%, rgba(0, 0, 0, 0.5) 94%, rgba(0, 0, 0, 0.18) 97%, transparent 99.3%, transparent 100%);
    mask-image: linear-gradient(to bottom, transparent 0%, transparent 0.5%, rgba(0, 0, 0, 0.4) 2.2%, rgba(0, 0, 0, 0.8) 3.6%,
      #000 5%, #000 88%, rgba(0, 0, 0, 0.82) 91%, rgba(0, 0, 0, 0.5) 94%, rgba(0, 0, 0, 0.18) 97%, transparent 99.3%, transparent 100%);
  }
  .stage-pic {
    position: absolute;
    inset: 0;
    background: center / cover no-repeat;
  }
  /* 화면이 사진보다 넓을 때(PC): 왼쪽·오른쪽 가장자리 15% 를 어둠 속으로 녹임. 모바일 세로는 위아래만
     (맨 끝 1.2% 는 완전히 투명: 사진 첫 픽셀 열이 1px 선처럼 남는 것을 막음) */
  .stage-layer[data-fit="contain"] .stage-pic {
    -webkit-mask-image: linear-gradient(to right, transparent 0%, transparent 1.2%, rgba(0, 0, 0, 0.12) 3.6%,
      rgba(0, 0, 0, 0.35) 6.4%, rgba(0, 0, 0, 0.62) 9.2%, rgba(0, 0, 0, 0.86) 12.1%, #000 15%, #000 85%,
      rgba(0, 0, 0, 0.86) 87.9%, rgba(0, 0, 0, 0.62) 90.8%, rgba(0, 0, 0, 0.35) 93.6%, rgba(0, 0, 0, 0.12) 96.4%,
      transparent 98.8%, transparent 100%);
    mask-image: linear-gradient(to right, transparent 0%, transparent 1.2%, rgba(0, 0, 0, 0.12) 3.6%,
      rgba(0, 0, 0, 0.35) 6.4%, rgba(0, 0, 0, 0.62) 9.2%, rgba(0, 0, 0, 0.86) 12.1%, #000 15%, #000 85%,
      rgba(0, 0, 0, 0.86) 87.9%, rgba(0, 0, 0, 0.62) 90.8%, rgba(0, 0, 0, 0.35) 93.6%, rgba(0, 0, 0, 0.12) 96.4%,
      transparent 98.8%, transparent 100%);
  }
  @supports (width: 1cqh) {
    .stage-photo {
      --w: calc(100cqh * var(--ar, 0.75));
      left: calc(min(0px, (100cqw - var(--w)) * var(--fx, 0.5)) + max(0px, (100cqw - var(--w)) / 2));
    }
  }
  /* ✦ 표시 가리기: 사진 오른쪽 아래 모서리를 원형 그라데이션으로 어둡게 덮음 */
  .stage-pic::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
      radial-gradient(circle at 86.5% 90%, rgba(4, 2, 3, 0.97) 0, rgba(4, 2, 3, 0.93) 4.5%, rgba(4, 2, 3, 0) 12%),
      radial-gradient(circle at 100% 100%, rgba(4, 2, 3, 0.85) 0, rgba(4, 2, 3, 0.55) 18%, rgba(4, 2, 3, 0) 34%);
  }
  /* 위쪽은 살짝, 아래쪽은 진하게 어둡게 */
  .stage-shade {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom,
      rgba(0, 0, 0, 0.42) 0%, rgba(0, 0, 0, 0.12) 16%, rgba(0, 0, 0, 0) 30%,
      rgba(0, 0, 0, 0.2) 52%, rgba(0, 0, 0, 0.72) 76%, rgba(0, 0, 0, 0.92) 100%);
    opacity: 0;
    transition: opacity 0.8s ease;
  }
  body.has-photo .stage-shade { opacity: 1; }

  /* ---------- 생존 일지 (수첩) ---------- */

  .jr-notice {
    position: fixed;
    left: 50%;
    bottom: calc(28px + env(safe-area-inset-bottom));
    z-index: 59;
    width: max-content;
    max-width: calc(100% - 32px);
    padding: 12px 20px;
    border-radius: 12px;
    background: #f4ecd8;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
    color: #23283a;
    font-size: 15px;
    font-weight: 800;
    opacity: 0;
    transform: translate(-50%, 20px);
    transition: opacity 0.25s, transform 0.25s;
    pointer-events: none;
  }
  .jr-notice.show { opacity: 1; transform: translate(-50%, 0); }

  .jr {
    --paper: #f4ecd8;
    --ink: #23283a;
    --pen: #1d4ea8;
    --lh: 33px;
    position: fixed;
    inset: 0;
    z-index: 58;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: calc(26px + env(safe-area-inset-top)) 0 calc(14px + env(safe-area-inset-bottom));
    background: rgba(0, 0, 0, 0.7);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    animation: jr-fade 0.25s ease both;
  }
  @keyframes jr-fade { from { opacity: 0; } to { opacity: 1; } }
  body.jr-lock { overflow: hidden; }

  .jr-stage {
    display: flex;
    justify-content: center;
    width: 100%;
    min-height: 0;
    perspective: 1600px;
  }
  .jr-book {
    position: relative;
    width: 92vw;
    max-width: 520px;
    border-radius: 6px 6px 8px 8px;
    box-shadow: 0 2px 0 #d8ccb0, 0 4px 0 #cbbd9e, 0 24px 60px rgba(0, 0, 0, 0.6);
    transform: rotate(-1.5deg);
    transform-style: preserve-3d;
  }
  .jr-book.opening { animation: jr-rise 0.35s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
  @keyframes jr-rise {
    from { transform: translateY(70vh) rotate(-1.5deg); }
    to { transform: translateY(0) rotate(-1.5deg); }
  }

  /* 표지: 왼쪽을 축으로 펼쳐짐 */
  .jr-cover {
    position: absolute;
    inset: 0;
    z-index: 6;
    display: grid;
    place-items: center;
    border-radius: 6px 8px 8px 6px;
    background:
      radial-gradient(ellipse at 30% 20%, rgba(255, 255, 255, 0.08), transparent 60%),
      linear-gradient(135deg, #4a3326, #2c1d16);
    box-shadow: inset 0 0 0 3px rgba(0, 0, 0, 0.25), inset 0 0 40px rgba(0, 0, 0, 0.5);
    color: #d9c7a0;
    font-family: "Nanum Pen Script", "Nanum Pen", cursive;
    font-size: 40px;
    transform-origin: left center;
    backface-visibility: hidden;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }
  .jr-book.opening .jr-cover { animation: jr-cover-open 0.35s 0.25s ease-in both; }
  @keyframes jr-cover-open {
    0% { opacity: 1; visibility: visible; transform: rotateY(0); }
    85% { opacity: 1; visibility: visible; }
    100% { opacity: 0; visibility: hidden; transform: rotateY(-170deg); }
  }

  /* 스프링 고리 */
  .jr-rings {
    position: absolute;
    top: -15px;
    left: 18px;
    right: 18px;
    z-index: 5;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
  }
  .jr-rings i {
    width: 10px;
    height: 30px;
    border: 3px solid #9a9aa3;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.5), transparent 60%);
    box-shadow: 1px 2px 2px rgba(0, 0, 0, 0.35);
  }
  .jr-rings i:nth-child(n + 13) { display: none; }

  /* 빨간 도장 */
  .jr-stamp {
    position: absolute;
    top: 26px;
    right: 18px;
    z-index: 4;
    padding: 2px 10px;
    border: 3px solid #c3242f;
    border-radius: 6px;
    color: #c3242f;
    font-family: var(--font-mono);
    font-size: 22px;
    font-weight: 900;
    letter-spacing: 0.06em;
    opacity: 0.82;
    transform: rotate(8deg);
    mix-blend-mode: multiply;
    box-shadow: inset 0 0 0 2px rgba(195, 36, 47, 0.18);
    pointer-events: none;
  }

  /* 커피 얼룩 */
  .jr-book::after {
    content: '';
    position: absolute;
    right: 14px;
    bottom: 18px;
    z-index: 3;
    width: 110px;
    height: 104px;
    border-radius: 50%;
    background:
      radial-gradient(circle at 50% 50%, transparent 54%, rgba(122, 74, 32, 0.24) 57%, rgba(122, 74, 32, 0.1) 62%, transparent 66%),
      radial-gradient(circle at 46% 52%, rgba(122, 74, 32, 0.07), transparent 58%);
    transform: rotate(18deg);
    mix-blend-mode: multiply;
    pointer-events: none;
  }

  .jr-pages {
    position: relative;
    max-height: calc(100vh - 170px);
    max-height: calc(100dvh - 170px);
    max-height: calc(100dvh - 170px);
    overflow-y: auto;
    overscroll-behavior: contain;
    border-radius: 6px 6px 8px 8px;
    background:
      radial-gradient(ellipse at 15% 8%, rgba(255, 255, 255, 0.55), transparent 55%),
      radial-gradient(ellipse at 95% 100%, rgba(160, 120, 60, 0.2), transparent 50%),
      linear-gradient(170deg, #f7f0de, var(--paper) 55%, #ece0c4);
    color: var(--ink);
    cursor: default;
  }
  .jr-pages.turn-next { animation: jr-turn-next 0.45s ease both; transform-origin: left center; }
  .jr-pages.turn-prev { animation: jr-turn-prev 0.45s ease both; transform-origin: right center; }
  @keyframes jr-turn-next {
    from { transform: rotateY(-80deg); opacity: 0.2; }
    to { transform: none; opacity: 1; }
  }
  @keyframes jr-turn-prev {
    from { transform: rotateY(80deg); opacity: 0.2; }
    to { transform: none; opacity: 1; }
  }

  .jr-page {
    position: relative;
    padding: 30px 22px 26px 58px;
    /* 왼쪽 빨간 여백선 */
    background: linear-gradient(90deg, transparent 42px, rgba(214, 60, 60, 0.55) 42px 44px, transparent 44px);
  }
  .jr-left { padding-bottom: 6px; padding-right: 96px; }

  .jr-date {
    margin: 0;
    font-family: "Nanum Pen Script", "Nanum Pen", "Gaegu", cursive;
    font-size: 34px;
    font-weight: 400;
    line-height: 1.1;
    color: var(--ink);
    word-break: keep-all;
  }
  .jr-weather {
    display: block;
    margin-top: 4px;
    font-family: "Nanum Pen Script", "Nanum Pen", "Gaegu", cursive;
    font-size: 28px;
    line-height: 1.1;
    color: #4a4f63;
  }

  /* 폴라로이드 사진 */
  .jr-photo {
    position: relative;
    width: min(82%, 300px);
    margin: 22px auto 14px;
    padding: 10px 10px 30px;
    background: #fff;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
    transform: rotate(-3deg);
  }
  .jr-left .jr-photo { margin-left: -14px; }
  .jr-photo img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    background: #ddd;
  }
  .jr-photo::before {
    content: '';
    position: absolute;
    top: -12px;
    left: 50%;
    width: 96px;
    height: 26px;
    background:
      repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.18) 0 3px, transparent 3px 6px),
      rgba(240, 226, 170, 0.62);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
    transform: translateX(-50%) rotate(4deg);
  }

  /* 줄 노트 본문 */
  .jr-text {
    padding-bottom: var(--lh);
    background: repeating-linear-gradient(
      to bottom,
      transparent 0 calc(var(--lh) - 1px),
      rgba(70, 110, 170, 0.28) calc(var(--lh) - 1px) var(--lh)
    );
    font-family: "Gowun Batang", "Nanum Myeongjo", "AppleMyungjo", "Batang", serif;
    font-size: 17.5px;
    line-height: var(--lh);
    color: var(--ink);
    word-break: keep-all;
  }
  .jr-line {
    margin: 0;
    opacity: 0;
    animation: jr-ink 0.35s ease forwards;
  }
  .jr-text.all .jr-line { animation: none; opacity: 1; }
  .jr-right:has(.jr-final-stamp) { padding-bottom: 86px; }
  @keyframes jr-ink {
    from { opacity: 0; transform: translateY(3px); }
    to { opacity: 1; transform: none; }
  }
  .jr-pen { color: var(--pen); }
  /* 손으로 그은 취소선 */
  .jr-strike {
    position: relative;
    text-decoration: none;
  }
  .jr-strike::after {
    content: '';
    position: absolute;
    left: -3px;
    right: -3px;
    top: 52%;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
    transform: rotate(-2.5deg);
    box-shadow: 0 2px 0 -0.5px currentColor;
    opacity: 0.85;
  }

  /* 하단 바 */
  .jr-bar {
    display: grid;
    grid-template-columns: 1fr auto 1.25fr;
    align-items: center;
    gap: 10px;
    width: 92vw;
    max-width: 520px;
  }
  .jr-count {
    color: #d9c7a0;
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
  }
  .jr-prev, .jr-next {
    min-height: 46px;
    padding: 8px 14px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 800;
    white-space: nowrap;
  }
  .jr-prev {
    border: 1px solid rgba(217, 199, 160, 0.45);
    background: rgba(0, 0, 0, 0.35);
    color: #e8dcc0;
    font-size: 14px;
  }
  .jr-prev:disabled { opacity: 0.35; cursor: default; }
  .jr-next {
    min-height: 54px;
    border: 0;
    background: linear-gradient(180deg, var(--red), var(--red-deep));
    box-shadow: 0 8px 24px rgba(255, 51, 68, 0.3);
    color: #fff;
    font-size: 18px;
  }
  .jr-prev:focus-visible, .jr-next:focus-visible { outline: 3px solid var(--amber); outline-offset: 3px; }

  /* PC: 양쪽으로 펼친 수첩 */
  @media (min-width: 900px) {
    .jr-book, .jr-bar { width: min(980px, 92vw); max-width: none; }
    .jr-rings i:nth-child(n + 13) { display: block; }
    .jr-pages {
      display: grid;
      grid-template-columns: 1fr 1.3fr;
      height: min(620px, calc(100vh - 190px));
      height: min(620px, calc(100dvh - 190px));
      max-height: none;
      overflow: hidden;
    }
    .jr-page { overflow-y: auto; overscroll-behavior: contain; padding-top: 40px; }
    .jr-left {
      padding-right: 26px;
      padding-bottom: 26px;
      box-shadow: inset -22px 0 26px -20px rgba(60, 40, 10, 0.35);
    }
    .jr-left .jr-photo { width: 86%; margin: 34px auto 0; }
    .jr-right {
      padding-right: 110px;
      box-shadow: inset 22px 0 26px -20px rgba(60, 40, 10, 0.35);
    }
    .jr-date { font-size: 40px; }
    .jr-weather { font-size: 32px; }
    .jr-text { font-size: 18px; --lh: 34px; }
  }

  /* ---------- 가방 바 ---------- */

  .bag {
    position: fixed;
    left: 50%;
    bottom: calc(10px + env(safe-area-inset-bottom));
    z-index: 45;
    display: flex;
    align-items: center;
    gap: 8px;
    width: min(444px, calc(100% - 24px));
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(20, 10, 12, 0.88);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    transform: translateX(-50%);
  }
  body.jr-lock .bag { display: none; }
  body.has-bag .wrap { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  body.has-bag #toast, body.has-bag .jr-notice { bottom: calc(92px + env(safe-area-inset-bottom)); }
  .bag-btn {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
  }
  .bag-btn:disabled { cursor: default; }
  .bag-btn:focus-visible { outline: 3px solid var(--amber); outline-offset: 4px; border-radius: 10px; }
  .bag-ico { flex: none; font-size: 22px; }
  .bag-slots {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-auto-flow: column; /* 민재가 있으면 6칸: 한 줄 유지 */
    grid-auto-columns: 1fr;
    gap: 5px;
  }
  .slot {
    display: grid;
    place-items: center;
    height: 38px;
    border: 1px dashed rgba(181, 156, 159, 0.35);
    border-radius: 9px;
    background: rgba(0, 0, 0, 0.25);
    font-size: 20px;
    line-height: 1;
  }
  .slot.filled {
    border-style: solid;
    border-color: rgba(255, 176, 32, 0.45);
    background: rgba(255, 176, 32, 0.08);
  }
  .slot.incoming > span { opacity: 0; }
  .slot.landed { animation: slot-land 0.4s ease; }
  @keyframes slot-land {
    0% { box-shadow: 0 0 0 0 rgba(255, 176, 32, 0.9); }
    100% { box-shadow: 0 0 0 10px rgba(255, 176, 32, 0); }
  }
  .bag-status { display: flex; gap: 2px; }
  .bag-status:empty { display: none; }
  .bag .inv-icon::after { top: auto; bottom: calc(100% + 8px); }

  /* ---------- 하단 시트 (가방 패널 · 설정) ---------- */

  .sheet {
    position: fixed;
    inset: 0;
    z-index: 57;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    animation: jr-fade 0.2s ease both;
  }
  .sheet-box {
    width: 100%;
    max-width: 480px;
    max-height: 82vh;
    max-height: 82dvh;
    overflow-y: auto;
    padding: 20px 18px calc(18px + env(safe-area-inset-bottom));
    border: 1px solid var(--line);
    border-bottom: 0;
    border-radius: 20px 20px 0 0;
    background: #1c1012;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.6);
    animation: sheet-up 0.28s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  }
  @keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
  .sheet-title {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin: 0 0 14px;
    font-size: 18px;
    font-weight: 900;
  }
  .sheet-title small { color: var(--muted); font-size: 13px; font-weight: 700; }
  .sheet-close { margin-top: 16px; min-height: 50px; }
  .bag-cards { display: grid; gap: 10px; }
  .bag-card {
    display: grid;
    grid-template-columns: 46px 1fr;
    gap: 2px 12px;
    align-items: center;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--panel);
  }
  .bag-card-emoji { grid-row: span 3; font-size: 34px; text-align: center; }
  .bag-card-name { font-weight: 800; }
  .bag-card-name small { margin-left: 6px; color: var(--amber); font-size: 12px; font-weight: 800; }
  .bag-card-desc { color: var(--muted); font-size: 13px; }
  .bag-card-hint {
    color: var(--text);
    font-size: 13px;
    font-style: italic;
    opacity: 0.45;
    word-break: keep-all;
  }
  .bag-empty { margin: 8px 0; color: var(--muted); text-align: center; }

  .tgl {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 54px;
    padding: 8px 4px;
    border-bottom: 1px solid var(--line);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
  }
  .tgl input { position: absolute; opacity: 0; width: 1px; height: 1px; }
  .tgl-ui {
    position: relative;
    flex: none;
    width: 46px;
    height: 26px;
    border-radius: 99px;
    background: #3a2528;
    transition: background 0.2s;
  }
  .tgl-ui::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.2s;
  }
  .tgl input:checked + .tgl-ui { background: var(--red); }
  .tgl input:checked + .tgl-ui::after { transform: translateX(20px); }
  .tgl input:focus-visible + .tgl-ui { outline: 3px solid var(--amber); outline-offset: 2px; }

  /* ---------- 아이템 연출 ---------- */

  #itemFx { position: fixed; inset: 0; z-index: 62; pointer-events: none; }
  .ifx-card {
    position: fixed;
    left: 50%;
    top: 42%;
    width: 150px;
    margin: -80px 0 0 -75px;
    padding: 20px 12px 14px;
    border: 2px solid var(--amber);
    border-radius: 16px;
    background: linear-gradient(180deg, #2c1a1d, #1a0f11);
    box-shadow: 0 0 30px rgba(255, 176, 32, 0.6), 0 0 80px rgba(255, 176, 32, 0.25);
    color: var(--text);
    text-align: center;
  }
  .ifx-emoji { font-size: 54px; line-height: 1.15; }
  .ifx-name { margin-top: 4px; font-size: 15px; font-weight: 800; }
  .ifx-label {
    position: absolute;
    top: -14px;
    left: 50%;
    padding: 3px 12px;
    border-radius: 99px;
    background: var(--amber);
    color: #1a0f11;
    font-size: 13px;
    font-weight: 900;
    white-space: nowrap;
    transform: translateX(-50%);
  }
  .ifx-use { border-color: #6fd0ff; box-shadow: 0 0 24px rgba(111, 208, 255, 0.5); }
  .ifx-use .ifx-label { background: #6fd0ff; }
  .ifx-full { border-color: #9a8a8c; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6); }
  .ifx-full .ifx-label { background: #e8dede; }
  .ifx-lose .ifx-label { background: var(--red); color: #fff; }
  .ifx-lose.red {
    border-color: var(--red);
    background: linear-gradient(180deg, #5a0f16, #2a070b);
    box-shadow: 0 0 34px rgba(255, 51, 68, 0.7);
  }
  .ifx-lose.crack::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 150 170'%3E%3Cpath d='M78 0 L70 40 L88 62 L64 96 L80 120 L60 170 M70 40 L30 58 M88 62 L132 80 M64 96 L20 118 M80 120 L120 150' fill='none' stroke='%23ffd6da' stroke-width='2.5' stroke-linejoin='bevel'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
  }
  .ifx-shard {
    position: fixed;
    background: linear-gradient(135deg, #7a1620, #2a070b);
    border: 1px solid rgba(255, 51, 68, 0.8);
  }

  /* ---------- 숨겨진 선택지 · 잠긴 선택지 ---------- */

  .choice { position: relative; }
  .choices .choice.secret {
    border: 2px solid var(--gold) !important;
    box-shadow: 0 0 0 1px rgba(255, 207, 74, 0.35), 0 0 18px rgba(255, 190, 40, 0.4);
  }
  .choice.secret::before {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: inherit;
    box-shadow: 0 0 18px 3px rgba(255, 200, 60, 0.55);
    animation: gold-glow 1.8s ease-in-out infinite;
    pointer-events: none;
  }
  @keyframes gold-glow { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }
  .choices .choice.secret .choice-key { background: rgba(255, 207, 74, 0.2); color: var(--gold); font-size: 18px; }
  .choice-secret { justify-self: start; color: var(--gold); font-size: 12px; font-weight: 800; letter-spacing: 0.04em; }
  .choice.locked .choice-key { font-size: 15px; }

  /* ---------- 시간 제한 ---------- */

  #choiceTimer {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 47;
    height: 7px;
    background: rgba(0, 0, 0, 0.55);
  }
  #choiceTimer i {
    display: block;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, var(--amber), var(--red));
    box-shadow: 0 0 12px var(--red);
    transition: width 0.1s linear;
  }
  #choiceTimer.low i { animation: blink 0.5s steps(1) infinite; }
  #timerEdge {
    --sq: 0;
    position: fixed;
    inset: 0;
    z-index: 44;
    pointer-events: none;
    box-shadow: inset 0 0 calc(30px + var(--sq) * 150px) calc(var(--sq) * 46px) rgba(255, 20, 40, 0.6);
    opacity: calc(0.25 + var(--sq) * 0.75);
    transition: box-shadow 0.1s linear, opacity 0.1s linear;
  }

  /* ---------- 장면 분위기 (무드) ---------- */

  #moodTint, #moodOver {
    position: fixed;
    inset: 0;
    pointer-events: none;
    transition: filter 0.6s ease;
  }
  #moodTint { z-index: 0; }
  #moodOver { z-index: 40; overflow: hidden; }
  .mt, .mo { position: absolute; inset: 0; opacity: 0; transition: opacity 0.8s ease; }
  #moodCanvas { position: absolute; inset: 0; width: 100%; height: 100%; }
  .wrap { transition: filter 0.8s ease; }

  /* 무드가 있는 장면에서는 기본 경고등·번쩍임 대신 무드 효과 */
  body.has-mood .fx-alarm, body.has-mood .fx-flicker { display: none; }

  .mt-daily { background: radial-gradient(ellipse at 50% 0%, rgba(255, 186, 120, 0.16), transparent 65%), rgba(40, 26, 18, 0.4); }
  .mt-unease { background: radial-gradient(ellipse at 50% 0%, rgba(255, 60, 40, 0.12), transparent 60%), rgba(18, 10, 8, 0.45); }
  .mt-dread { background: rgba(0, 0, 0, 0.84); }
  .mt-chase { background: linear-gradient(180deg, rgba(10, 14, 22, 0.55), rgba(0, 0, 0, 0.65)); }
  .mt-warm { background: radial-gradient(ellipse at 50% 15%, rgba(255, 140, 40, 0.24), transparent 70%), rgba(40, 20, 6, 0.42); }
  .mt-lonely { background: radial-gradient(ellipse at 50% 0%, rgba(120, 170, 255, 0.18), transparent 70%), rgba(8, 16, 32, 0.58); }
  body[data-mood="daily"] .mt-daily,
  body[data-mood="unease"] .mt-unease,
  body[data-mood="dread"] .mt-dread,
  body[data-mood="chase"] .mt-chase,
  body[data-mood="warm"] .mt-warm,
  body[data-mood="lonely"] .mt-lonely { opacity: 1; }

  /* 불안: 천천히 회전하는 붉은 경고등 + 가끔 깜빡이는 조명 */
  .mo-beacon {
    inset: auto;
    top: -90vmax;
    left: 50%;
    width: 180vmax;
    height: 180vmax;
    margin-left: -90vmax;
    background: conic-gradient(rgba(255, 40, 50, 0.32) 0deg 22deg, transparent 22deg 180deg, rgba(255, 40, 50, 0.22) 180deg 202deg, transparent 202deg);
    -webkit-mask-image: radial-gradient(circle, #000 0, rgba(0, 0, 0, 0.55) 22%, transparent 48%);
    mask-image: radial-gradient(circle, #000 0, rgba(0, 0, 0, 0.55) 22%, transparent 48%);
    animation: beacon 7s linear infinite;
  }
  @keyframes beacon { to { transform: rotate(360deg); } }
  body[data-mood="unease"] .mo-beacon { opacity: 0.9; }
  .mo-flicker { background: #000; }
  body[data-mood="unease"] .mo-flicker { animation: mood-flicker 5.5s infinite; }
  body[data-mood="unease"][data-flicker="strong"] .mo-flicker { animation: mood-flicker-strong 2.3s infinite; }
  @keyframes mood-flicker {
    0%, 86%, 100% { opacity: 0; }
    87% { opacity: 0.35; }
    88% { opacity: 0; }
    90% { opacity: 0.5; }
    91% { opacity: 0.1; }
    92% { opacity: 0; }
  }
  @keyframes mood-flicker-strong {
    0%, 70%, 100% { opacity: 0; }
    72% { opacity: 0.7; }
    74% { opacity: 0.1; }
    77% { opacity: 0.8; }
    80% { opacity: 0; }
    88% { opacity: 0.45; }
    90% { opacity: 0; }
  }

  /* 공포: 강한 붉은 비네팅 + 심장박동 */
  .mo-vignette { background: radial-gradient(ellipse at center, transparent 30%, rgba(110, 0, 8, 0.5) 70%, rgba(30, 0, 0, 0.92) 100%); }
  body[data-mood="dread"] .mo-vignette { opacity: 1; animation: vig-pulse 1.2s ease-in-out infinite; }
  @keyframes vig-pulse {
    0%, 100% { opacity: 0.72; }
    14% { opacity: 1; }
    28% { opacity: 0.8; }
    42% { opacity: 0.95; }
  }
  body[data-mood="dread"] .wrap { --beat: 1.004; --beat2: 1.002; animation: jitter 9s infinite, heartbeat 1.2s ease-in-out infinite; }
  body[data-mood="dread"][data-pulse="strong"] .wrap { --beat: 1.012; --beat2: 1.006; }
  @keyframes heartbeat {
    0%, 100% { scale: 1; }
    14% { scale: var(--beat); }
    28% { scale: 1; }
    42% { scale: var(--beat2); }
    56% { scale: 1; }
  }

  /* 추격: 높은 대비 + 흔들리는 가장자리 (+ canvas 그림자) */
  .mo-edge { inset: -10px; box-shadow: inset 0 0 90px 30px rgba(0, 0, 0, 0.9); }
  body[data-mood="chase"] .mo-edge { opacity: 1; animation: edge-shake 0.16s steps(2) infinite; }
  body[data-mood="chase"][data-intensity="max"] .mo-edge { box-shadow: inset 0 0 130px 50px rgba(40, 0, 0, 0.95); animation-duration: 0.1s; }
  @keyframes edge-shake {
    0% { transform: translate(3px, -2px); }
    50% { transform: translate(-3px, 2px); }
    100% { transform: translate(2px, 3px); }
  }
  body[data-mood="chase"] .wrap { filter: contrast(1.22) saturate(1.15); }
  body[data-mood="chase"][data-intensity="max"] .wrap { filter: contrast(1.38) saturate(1.25); }

  /* P2: 구급차 불빛이 가끔 화면을 스침 */
  .mo-ambulance {
    background: linear-gradient(100deg, transparent 35%, rgba(255, 40, 60, 0.3) 46%, rgba(50, 110, 255, 0.3) 56%, transparent 68%);
    background-size: 300% 100%;
  }
  body.fx-ambulance .mo-ambulance { opacity: 1; animation: ambulance 6.5s ease-in-out infinite; }
  @keyframes ambulance {
    0%, 60% { opacity: 0; background-position: 120% 0; }
    62% { opacity: 1; }
    80% { opacity: 1; background-position: -20% 0; }
    82%, 100% { opacity: 0; background-position: -20% 0; }
  }

  /* ④ 화면 흔들림 */
  #app.shake-now { animation: quake 0.3s linear; }
  @keyframes quake {
    0%, 100% { translate: 0 0; }
    20% { translate: -7px 3px; }
    40% { translate: 6px -4px; }
    60% { translate: -5px 2px; }
    80% { translate: 4px -2px; }
  }
  .q-line { display: block; }

  /* 식량 체크 실패: 잠시 흑백 */
  body.desat .wrap, body.desat #moodTint, body.desat #moodOver { filter: grayscale(1) brightness(0.85) !important; }

  /* 무드별 선택지 */
  body[data-mood="daily"] .choice {
    border-radius: 20px;
    border-color: rgba(255, 220, 180, 0.2);
    background: rgba(255, 244, 230, 0.07);
  }
  body[data-mood="daily"] .choice-key { border-radius: 50%; background: rgba(255, 200, 150, 0.14); color: #ffcf9e; }

  body[data-mood="unease"] .choice {
    border: 3px solid transparent;
    border-radius: 12px;
    background:
      linear-gradient(var(--panel-strong), var(--panel-strong)) padding-box,
      repeating-linear-gradient(-45deg, #f2c200 0 10px, #141414 10px 20px) border-box;
  }
  body[data-mood="unease"] .choice-key { background: #f2c200; color: #141414; }

  body[data-mood="dread"] .choice {
    border: 1px solid rgba(255, 40, 50, 0.7);
    border-radius: 6px;
    background:
      repeating-linear-gradient(97deg, rgba(255, 255, 255, 0.04) 0 1px, transparent 1px 7px),
      repeating-linear-gradient(8deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 11px),
      linear-gradient(160deg, #2b2a2c, #141315 60%, #201a1b);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 0 14px rgba(255, 30, 40, 0.18);
    animation: screen-in 0.4s ease both, choice-glitch 5s steps(1) infinite;
  }
  body[data-mood="dread"] .choice:nth-child(2n) { animation-duration: 0.4s, 6.7s; }
  body[data-mood="dread"] .choice:nth-child(3n) { animation-duration: 0.4s, 4.3s; }
  body[data-mood="dread"] .choice-key { border-radius: 4px; background: rgba(255, 40, 50, 0.2); }
  @keyframes choice-glitch {
    0%, 97.9% { translate: 0 0; filter: none; }
    98% { translate: -3px 1px; filter: hue-rotate(40deg) saturate(2) contrast(1.4); }
    100% { translate: 0 0; filter: none; }
  }

  body[data-mood="chase"] .choice {
    border: 2px solid rgba(255, 255, 255, 0.55);
    border-radius: 4px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.02));
    font-weight: 800;
    transform: skewX(-10deg);
    animation: chase-in 0.35s ease both;
  }
  body[data-mood="chase"] .choice > * { transform: skewX(10deg); }
  body[data-mood="chase"] .choice:active { transform: skewX(-10deg) scale(0.94); }
  body[data-mood="chase"] .choice.picked { animation: chase-bounce 0.35s cubic-bezier(0.3, 1.8, 0.5, 1); }
  body[data-mood="chase"] .choice-key { border-radius: 2px; }
  @keyframes chase-in {
    from { opacity: 0; transform: skewX(-10deg) translateX(40px); }
    to { opacity: 1; transform: skewX(-10deg); }
  }
  @keyframes chase-bounce {
    0% { transform: skewX(-10deg) scale(0.9); }
    60% { transform: skewX(-10deg) scale(1.06); }
    100% { transform: skewX(-10deg) scale(1); }
  }

  body[data-mood="warm"] .choice {
    border: 1px solid #b98d55;
    border-radius: 10px;
    background:
      radial-gradient(ellipse at 20% 0%, rgba(255, 255, 255, 0.35), transparent 60%),
      linear-gradient(170deg, #efdcb8, #e2c999);
    box-shadow: 0 3px 0 rgba(185, 141, 85, 0.7), 0 10px 20px rgba(0, 0, 0, 0.35);
    color: #3b2614;
  }
  body[data-mood="warm"] .choice-key { background: rgba(120, 70, 20, 0.15); color: #7a4a1a; }
  body[data-mood="warm"] .choice-note { color: #6b4a2a; }
  body[data-mood="warm"] .choice-secret, body[data-mood="warm"] .choice.secret .choice-key { color: #9a5200; }
  body[data-mood="warm"] .choice.picked { background: #f7e6c4; box-shadow: 0 0 0 2px #e07b25, 0 0 24px rgba(224, 123, 37, 0.5); }

  body[data-mood="lonely"] .choice {
    border: 1px solid rgba(210, 230, 255, 0.4);
    border-radius: 14px;
    background: linear-gradient(160deg, rgba(220, 235, 255, 0.15), rgba(160, 190, 230, 0.06));
    -webkit-backdrop-filter: blur(12px) saturate(1.2);
    backdrop-filter: blur(12px) saturate(1.2);
    box-shadow: inset 0 0 18px rgba(230, 240, 255, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.3);
    color: #eef4ff;
  }
  body[data-mood="lonely"] .choice-key { background: rgba(200, 225, 255, 0.18); color: #dfeaff; }

  /* ② 단톡방: 메신저 답장 입력창 */
  .choices.choices-chat .choice {
    padding-right: 56px;
    border: 1px solid #3a4250;
    border-radius: 24px;
    background: #1f242c;
    font-weight: 500;
  }
  .choices.choices-chat .choice::after {
    content: '➤';
    position: absolute;
    top: 50%;
    right: 12px;
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    margin-top: -16px;
    border-radius: 50%;
    background: var(--amber);
    color: #141414;
    font-size: 14px;
  }
  .choices.choices-chat .choice-key { border-radius: 50%; background: #2e3540; color: #b8c2d0; }

  /* 설정: 화면 흔들림·깜빡임 끄기 */
  body.calm-fx .wrap { animation: none !important; scale: none; }
  body.calm-fx .fx-flicker,
  body.calm-fx .mo-flicker,
  body.calm-fx .mo-ambulance { display: none; }
  body.calm-fx .mo-edge,
  body.calm-fx .mo-vignette { animation: none; }
  body.calm-fx #app.shake-now { animation: none; }
  body.calm-fx #choiceTimer.low i { animation: none; }
  body.calm-fx[data-mood="dread"] .choice { animation: screen-in 0.4s ease both; }

  /* ---------- 장면 화면: 사진 위 아래쪽 반투명 패널 ---------- */

  .screen.scene { padding-top: 0; }
  .scene-space { flex: 1 0 var(--photo-window, 30vh); }
  .screen.scene.packing { --photo-window: 16vh; }
  .panel {
    position: relative;
    margin: 0 -18px;
    padding: 18px 18px calc(22px + env(safe-area-inset-bottom));
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 22px 22px 0 0;
    background: linear-gradient(to bottom, rgba(14, 8, 9, 0.6), rgba(14, 8, 9, 0.8) 110px, rgba(14, 8, 9, 0.88));
    -webkit-backdrop-filter: blur(10px) saturate(1.1);
    backdrop-filter: blur(10px) saturate(1.1);
    box-shadow: 0 -18px 40px rgba(0, 0, 0, 0.3);
  }
  .panel .q-text {
    margin-bottom: 16px;
    font-size: 16.5px;
    line-height: 1.6;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
  }
  .panel .choices { gap: 8px; }
  .panel .choice { min-height: 54px; padding: 12px 14px; gap: 12px; font-size: 15.5px; }
  .panel .choice-key { width: 28px; height: 28px; font-size: 13px; }
  .panel .choice.secret .choice-key { font-size: 16px; }
  .panel .actions { margin-top: 0; padding-top: 18px; }
  .panel .alert-card { margin-top: 0; }
  .panel .news-lines { margin-top: 18px; }
  .panel .event { margin: 0 0 18px; padding: 18px 16px; }
  .panel .pack-urge { margin-top: -6px; }

  /* 게임 중: 하단 정보 숨김, 패널이 화면 아래 끝까지 */
  body.in-game .site-footer { display: none; }
  body.in-scene .wrap,
  body.in-scene.has-bag .wrap { padding-bottom: 0; }
  body.in-scene.has-bag .panel { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }

  /* 사진이 있을 때: HUD 는 투명하게, 무드 그라데이션은 옅게 */
  body.has-photo #hud { background: linear-gradient(rgba(8, 5, 6, 0.8), rgba(8, 5, 6, 0.42) 70%, transparent); }
  body.has-photo .hud-day { text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85); }
  #moodTint { transition: filter 0.6s ease, opacity 0.8s ease; }
  body.has-photo #moodTint { opacity: 0.45; }

  @media (min-width: 900px) {
    body.in-scene .wrap { max-width: 760px; }
    .panel { padding-left: 26px; padding-right: 26px; }
    /* PC: 패널 배경의 양옆·위쪽 가장자리도 녹여서 사진·어둠과 경계 없이 이어지게 (글자는 그대로 선명) */
    .panel {
      border-top-color: transparent;
      background: none;
      -webkit-backdrop-filter: none;
      backdrop-filter: none;
      box-shadow: none;
    }
    .panel::before {
      content: '';
      position: absolute;
      inset: 0;
      z-index: -1;
      border-radius: inherit;
      background: linear-gradient(to bottom, rgba(14, 8, 9, 0.6), rgba(14, 8, 9, 0.8) 110px, rgba(14, 8, 9, 0.88));
      -webkit-backdrop-filter: blur(10px) saturate(1.1);
      backdrop-filter: blur(10px) saturate(1.1);
      -webkit-mask-image: linear-gradient(to right, transparent, #000 56px, #000 calc(100% - 56px), transparent),
        linear-gradient(to bottom, transparent, #000 56px);
      -webkit-mask-composite: source-in;
      mask-image: linear-gradient(to right, transparent, #000 56px, #000 calc(100% - 56px), transparent),
        linear-gradient(to bottom, transparent, #000 56px);
      mask-composite: intersect;
    }
    .panel .choices { grid-template-columns: 1fr 1fr; }
    .panel .pack-grid { grid-template-columns: repeat(5, 1fr); }
    /* 짐 싸기: 패널을 넓혀 낮게 (724px = .wrap 760px - 좌우 여백 36px) → 사진의 가방이 더 보임 */
    .screen.scene.packing .panel {
      margin-left: calc((724px - min(1040px, 100vw - 48px)) / 2);
      margin-right: calc((724px - min(1040px, 100vw - 48px)) / 2);
    }
    .panel .pack-item { min-height: 56px; }
    .panel .pack-desc { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  }

  /* ---------- 세로 화면(폭 ≤ 높이 × 0.8): 사진은 HUD 바로 아래에 잘리지 않게, 글은 아래 2단계 ---------- */

  body.portrait .stage-photo {
    top: var(--pt, 0px);
    left: var(--pl, 0px);
    width: var(--pw, 100%);
    height: var(--ph, 50vh);
    transition: top 0.4s ease, left 0.4s ease, width 0.4s ease, height 0.4s ease;
  }
  body.portrait.in-scene .wrap,
  body.portrait.in-scene.has-bag .wrap {
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    padding-bottom: 0;
    overflow: hidden;
  }
  body.portrait.in-scene #app,
  body.portrait .screen.scene { min-height: 0; }
  body.portrait .scene-space { flex: 0 0 var(--photo-space, 40vh); transition: flex-basis 0.4s ease; }
  body.portrait .panel {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 12px 16px calc(14px + env(safe-area-inset-bottom));
    border-top: 0;
    border-radius: 0;
    background: linear-gradient(to bottom, rgba(14, 8, 9, 0.3), rgba(14, 8, 9, 0.82) 34px, rgba(14, 8, 9, 0.9));
    box-shadow: none;
  }
  body.portrait.in-scene.has-bag .panel { padding-bottom: calc(66px + env(safe-area-inset-bottom)); }
  body.portrait .panel .q-text { margin-bottom: 8px; font-size: 15.5px; line-height: 1.55; }
  body.portrait .panel .choices { gap: 6px; }
  body.portrait .panel .choice { min-height: 44px; padding: 9px 12px; gap: 10px; font-size: 15px; }
  body.portrait .panel .choice-key { width: 26px; height: 26px; font-size: 12.5px; }
  body.portrait .panel .choice-note,
  body.portrait .panel .choice-tag,
  body.portrait .panel .choice-secret { font-size: 12px; }
  body.portrait .panel .choice-result { margin-top: 10px; padding: 10px 14px; font-size: 14.5px; }
  body.portrait .chat { gap: 6px; margin: 0 0 10px; padding: 8px 10px; }
  body.portrait .bubble-who { margin-bottom: 1px; font-size: 12px; }
  body.portrait .bubble p { padding: 6px 10px; font-size: 13.5px; }
  body.portrait .bag { padding: 6px 8px; bottom: calc(8px + env(safe-area-inset-bottom)); }
  body.portrait .slot { height: 34px; font-size: 18px; }

  /* 1단계: 본문이 한 줄씩 → "탭하여 선택 ▼" / 2단계: 마지막 줄만 작게 + 선택지 */
  .q-text.reveal .q-line { animation: screen-in 0.5s ease both; }
  .panel.all .q-line,
  .panel.all .bubble { animation: none !important; opacity: 1; }
  .tap-hint, .story-mini { display: none; }
  body.portrait .panel.staged .tap-hint {
    display: block;
    margin: 4px auto 0;
    padding: 10px 18px;
    border: 0;
    background: none;
    color: var(--amber);
    font-size: 15px;
    font-weight: 800;
    visibility: hidden;
    cursor: pointer;
  }
  body.portrait .panel.staged.revealed .tap-hint { visibility: visible; animation: hint-bob 1.4s ease-in-out infinite; }
  @keyframes hint-bob { 0%, 100% { transform: translateY(0); opacity: 1; } 50% { transform: translateY(4px); opacity: 0.7; } }
  body.portrait .panel.staged.reading .choices { display: none; }
  body.portrait .panel.staged.choosing .chat,
  body.portrait .panel.staged.choosing .q-text,
  body.portrait .panel.staged.choosing .tap-hint { display: none; }
  body.portrait .panel.staged.choosing .story-mini {
    position: sticky;
    top: -12px;
    z-index: 2;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: -12px -16px 8px;
    padding: 10px 16px 8px;
    background: linear-gradient(rgba(14, 8, 9, 0.96) 75%, rgba(14, 8, 9, 0));
  }
  /* ④ 문 열기 결과처럼 선택지 자리에 결과 상자가 뜨면: 마지막 줄 띠가 위에 붙어 있지 않게 (아이콘을 덮지 않음) */
  body.portrait .panel.staged.choosing:has(.gamble) .story-mini { position: static; margin-bottom: 12px; }
  body.portrait .panel .gamble { padding: 22px 18px; }
  .story-mini-text {
    flex: 1;
    display: -webkit-box;
    overflow: hidden;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
    word-break: keep-all;
  }
  .reread {
    flex: none;
    min-width: 40px;
    height: 30px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--panel);
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
  }
  body.portrait .panel.staged.choosing .choices { animation: choices-up 0.35s ease both; }
  @keyframes choices-up { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }

  /* ---------- 가방이 가득 찼을 때: 버릴 아이템 고르기 ---------- */
  .discard-new {
    display: grid;
    grid-template-columns: 52px 1fr;
    gap: 2px 12px;
    align-items: center;
    margin: 0 0 14px;
    padding: 12px 14px;
    border: 2px solid var(--amber);
    border-radius: 14px;
    background: linear-gradient(180deg, #2c1a1d, #1a0f11);
    box-shadow: 0 0 24px rgba(255, 176, 32, 0.45);
    animation: pop 0.45s cubic-bezier(0.2, 1.6, 0.4, 1) both;
  }
  .discard-new .bag-card-emoji { font-size: 38px; }
  .discard-need { margin: -6px 0 12px; color: var(--amber); font-size: 14px; font-weight: 800; }
  .discard-card { width: 100%; color: inherit; text-align: left; cursor: pointer; }
  .discard-card:hover { border-color: rgba(255, 51, 68, 0.6); }
  .discard-card.picked { border-color: var(--red); background: rgba(255, 51, 68, 0.16); opacity: 0.75; }
  .discard-card.picked .bag-card-name { text-decoration: line-through; }
  .discard-mark { grid-column: 2; justify-self: start; color: var(--red); font-size: 12px; font-weight: 900; }
  .discard-actions { display: grid; gap: 8px; margin-top: 14px; }
  .discard-actions .btn { min-height: 48px; font-size: 16px; }

  /* ---------- 1인칭 연출 ---------- */

  /* 다른 장소로 이동할 때 걷듯이 위아래로 출렁임 */
  body.walking #stage { animation: walk-bg 0.8s ease-in-out; }
  body.walking #app { animation: walk-bob 0.8s ease-in-out; }
  @keyframes walk-bob {
    0%, 100% { translate: 0 0; rotate: 0deg; }
    17% { translate: 0 -8px; rotate: -0.3deg; }
    33% { translate: 0 3px; rotate: 0deg; }
    50% { translate: 0 -8px; rotate: 0.3deg; }
    67% { translate: 0 3px; rotate: 0deg; }
    84% { translate: 0 -5px; rotate: -0.15deg; }
  }
  @keyframes walk-bg {
    0%, 100% { translate: 0 0; scale: 1; }
    10%, 90% { scale: 1.04; }
    17% { translate: 0 -12px; }
    33% { translate: 0 5px; }
    50% { translate: 0 -12px; }
    67% { translate: 0 5px; }
    84% { translate: 0 -7px; }
  }

  /* 공포(dread): 시야 가장자리가 숨 쉬듯 천천히 좁아졌다 넓어짐 */
  .mo-breath { background: radial-gradient(ellipse at 50% 45%, transparent 48%, rgba(0, 0, 0, 0.7) 78%, rgba(0, 0, 0, 0.94) 100%); }
  body[data-mood="dread"] .mo-breath { opacity: 1; animation: breathe 5.5s ease-in-out infinite; }
  @keyframes breathe {
    0%, 100% { transform: scale(1.3); }
    50% { transform: scale(1.02); }
  }

  /* 시간 제한: 남은 시간이 줄수록 선택지 쪽으로 시야가 좁아지는 터널 */
  #tunnel {
    position: fixed;
    inset: 0;
    z-index: 43;
    pointer-events: none;
    background: radial-gradient(var(--rx, 300vmax) var(--ry, 300vmax) at var(--tx, 50%) var(--ty, 50%),
      transparent 0, transparent 68%, rgba(0, 0, 0, 0.9) 100%);
  }

  /* 필름 그레인: 사진 영역만이 아니라 화면 전체 (게임 중) */
  #grain {
    position: fixed;
    inset: -50%;
    z-index: 41;
    pointer-events: none;
    background-image: url("/noise.webp"); /* 미리 만든 잡음 그림 (SVG 필터보다 훨씬 가벼움) */
  will-change: transform;
    background-size: 128px 128px;
    opacity: 0;
    transition: opacity 0.8s ease;
    animation: grain 0.8s steps(5) infinite;
  }
  body.in-game #grain { opacity: 0.07; }
  @keyframes grain {
    0%, 100% { transform: translate(0, 0); }
    20% { transform: translate(-3%, 2%); }
    40% { transform: translate(2%, -3%); }
    60% { transform: translate(-2%, -1%); }
    80% { transform: translate(3%, 3%); }
  }
  body.calm-fx #grain { animation: none; }

  /* 설정 "화면 흔들림·깜빡임 끄기": 1인칭 연출도 하지 않음 */
  body.calm-fx.walking #stage,
  body.calm-fx.walking #app { animation: none; }
  body.calm-fx .mo-breath,
  body.calm-fx #tunnel { display: none; }

  /* ---------- 생존 막대 (HUD 날짜 줄 아래) ---------- */

  :root {
    --bar-health: #ec4f8c;
    --bar-supply: #b08a12;
    --bar-mind: #3a9cd2;
    --chart-bg: #1c1012;
  }
  .hud-bars {
    display: flex;
    gap: 12px;
    margin-top: 7px;
  }
  .hud-bar {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 6px 2px 3px;
    border-radius: 99px;
    transition: background 0.2s;
  }
  .bar-ico { font-style: normal; font-size: 13px; line-height: 1; }
  .bar-track {
    position: relative;
    width: 46px;
    height: 6px;
    border-radius: 99px;
    background: rgba(255, 255, 255, 0.12);
    overflow: hidden;
  }
  .bar-fill {
    position: absolute;
    inset: 0 auto 0 0;
    width: 0;
    border-radius: 99px;
    transition: width 0.45s ease;
  }
  [data-bar="health"] .bar-fill { background: var(--bar-health); }
  [data-bar="supply"] .bar-fill { background: var(--bar-supply); }
  [data-bar="mind"] .bar-fill { background: var(--bar-mind); }
  /* 변할 때 0.4초: 늘면 초록, 줄면 붉게 */
  .hud-bar.flash-up { animation: bar-up 0.4s ease; }
  .hud-bar.flash-down { animation: bar-down 0.4s ease; }
  @keyframes bar-up {
    0%, 100% { background: transparent; }
    35% { background: rgba(94, 224, 138, 0.45); box-shadow: 0 0 12px rgba(94, 224, 138, 0.6); }
  }
  @keyframes bar-down {
    0%, 100% { background: transparent; }
    35% { background: rgba(255, 51, 68, 0.5); box-shadow: 0 0 12px rgba(255, 51, 68, 0.7); }
  }
  /* 25 이하: 천천히 계속 깜빡임 */
  .hud-bar.low .bar-track { animation: bar-low 1.8s ease-in-out infinite; }
  .hud-bar.low .bar-ico { animation: bar-low 1.8s ease-in-out infinite; }
  @keyframes bar-low {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.25; }
  }
  body.calm-fx .hud-bar.low .bar-track,
  body.calm-fx .hud-bar.low .bar-ico { animation: none; }
  body.calm-fx .hud-bar.low .bar-track { outline: 1px solid var(--red); }

  /* 선택지 오른쪽: 영향받는 막대 아이콘 (크기만 다름) */
  .choice-bars {
    flex: none;
    display: flex;
    align-items: center;
    gap: 2px;
    margin-left: auto;
    padding-left: 6px;
  }
  .choice-bars i { font-style: normal; font-size: 12px; line-height: 1; opacity: 0.85; }
  .choice-bars i.big { font-size: 17px; opacity: 1; }
  .choice.locked .choice-bars { opacity: 0.5; }

  /* 패닉 (🧠 0) */
  .panic-msg {
    position: fixed;
    top: 38%;
    left: 50%;
    z-index: 60;
    width: min(90vw, 420px);
    padding: 16px 18px;
    border: 2px solid var(--red);
    border-radius: var(--radius);
    background: rgba(40, 6, 10, 0.94);
    color: #ffd6da;
    font-size: 20px;
    font-weight: 900;
    text-align: center;
    word-break: keep-all;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 40px rgba(255, 51, 68, 0.6);
    animation: panic-in 0.25s ease both;
  }
  @keyframes panic-in { from { transform: translate(-50%, -50%) scale(1.3); opacity: 0; } }
  #app.panic-shake { animation: quake 0.3s linear 4; }
  body.panic .fx-vignette { background: radial-gradient(ellipse at center, transparent 35%, rgba(120, 0, 10, 0.85)); }
  body.calm-fx #app.panic-shake { animation: none; }

  /* 하루 카드 */
  .day-card { margin-bottom: 14px; }
  .day-card-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    margin: 0 0 10px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.04em;
  }
  .day-card-head span:first-child { color: var(--amber); }
  .day-card-head b {
    padding: 2px 9px;
    border-radius: 99px;
    background: rgba(255, 176, 32, 0.16);
    color: var(--amber);
    font-size: 12px;
  }
  .panel .day-card .q-text { margin-bottom: 0; }
  .march-title { margin-bottom: 8px; color: var(--amber); text-align: left; }
  .gamble-result b { margin-right: 6px; }
  .tone-good .gamble-result b { color: var(--green); }
  .tone-bad .gamble-result b { color: var(--red); }

  /* 짐 풀기 */
  .unpack-list { display: grid; gap: 6px; margin-bottom: 12px; }
  .unpack-row {
    margin: 0;
    padding: 8px 12px;
    border: 1px solid rgba(176, 138, 18, 0.45);
    border-radius: 12px;
    background: rgba(176, 138, 18, 0.1);
    font-weight: 700;
    animation: screen-in 0.4s ease both;
  }
  .unpack-row b { color: var(--amber); font-weight: 800; }
  .unpack-note { margin: 0; color: var(--muted); font-size: 14px; word-break: keep-all; }
  .ifx-bar .ifx-label { background: var(--bar-supply); color: #fff; }

  /* 일지: 카드 기록(연필) · 막대 경고(붉은 펜) */
  .jr-log { color: #5b5552; font-style: italic; }
  .jr-warn { color: #b3121f; font-weight: 700; }

  /* 결과 화면 꺾은선 */
  .chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    margin: -4px 0 8px;
    color: var(--text);
    font-size: 13px;
    font-weight: 700;
  }
  .chart-legend i, .chart-tip i {
    display: inline-block;
    width: 10px;
    height: 3px;
    margin-right: 5px;
    border-radius: 2px;
    vertical-align: middle;
  }
  .chart-box { position: relative; touch-action: pan-y; }
  .chart-svg { display: block; width: 100%; height: auto; }
  .ch-grid { stroke: rgba(255, 255, 255, 0.08); stroke-width: 1; }
  .ch-axis { fill: var(--muted); font-size: 9px; font-family: inherit; }
  .ch-cross { stroke: rgba(255, 255, 255, 0.35); stroke-width: 1; stroke-dasharray: 3 3; }
  .chart-tip {
    position: absolute;
    top: -6px;
    display: grid;
    gap: 2px;
    padding: 6px 9px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(14, 8, 9, 0.95);
    color: var(--text);
    font-size: 12px;
    white-space: nowrap;
    pointer-events: none;
    transform: translateY(-100%);
  }
  .chart-table { margin-top: 8px; color: var(--muted); font-size: 13px; }
  .chart-table summary { cursor: pointer; }
  .chart-table table { width: 100%; margin-top: 6px; border-collapse: collapse; color: var(--text); font-variant-numeric: tabular-nums; }
  .chart-table th, .chart-table td { padding: 3px 4px; border-bottom: 1px solid var(--line); text-align: right; }
  .chart-table th[scope="row"], .chart-table thead th:first-child { text-align: left; }
  .chart-table > div, .chart-table { overflow-x: auto; }

  /* ---------- 구조 카운트다운 (HUD) ---------- */
  .hud-rescue {
    display: block; /* 날짜 줄이 길어져 (11월 8일 · D+5 · 시각) 구조 카운트다운은 늘 둘째 줄 */
    margin-top: 2px;
    color: var(--red);
    font-size: 13px;
    font-weight: 900;
    text-shadow: 0 0 8px rgba(255, 51, 68, 0.45);
  }
  .hud-rescue.arrive { animation: rescue-arrive 0.8s steps(1) 1; }
  @keyframes rescue-arrive {
    0%, 50% { opacity: 1; color: #fff; text-shadow: 0 0 14px var(--red), 0 0 4px var(--red); }
    25%, 75% { opacity: 0.25; }
    100% { opacity: 1; }
  }

  /* ---------- 달리기 미니게임 ---------- */
  .run-game, .mg { margin-top: 10px; text-align: center; }
  .run-intro, .mg-intro { margin: 0 0 10px; color: var(--amber); font-size: 15px; font-weight: 800; }
  .run-track { display: grid; gap: 6px; margin-bottom: 8px; text-align: left; }
  .run-label { color: var(--muted); font-size: 13px; font-weight: 700; }
  .run-bar {
    height: 14px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 99px;
    background: var(--track);
  }
  .run-bar i {
    display: block;
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--amber), var(--green));
    box-shadow: 0 0 10px rgba(94, 224, 138, 0.6);
    transition: width 0.08s linear;
  }
  .run-time { margin: 0 0 10px; font-family: var(--font-mono); font-size: 22px; font-weight: 900; }
  .run-time.low { color: var(--red); }
  .run-pads { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .run-pad {
    min-height: 84px;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: var(--radius-btn);
    background: rgba(255, 255, 255, 0.08);
    font-size: 20px;
    font-weight: 900;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    cursor: pointer;
  }
  .run-pad:disabled { opacity: 0.4; }
  .run-pad.hit { background: rgba(94, 224, 138, 0.25); border-color: var(--green); }
  .run-pad.miss { background: rgba(255, 51, 68, 0.25); border-color: var(--red); }
  .run-bat {
    width: 100%;
    min-height: 46px;
    margin-top: 10px;
    border: 1px solid var(--gold);
    border-radius: var(--radius-btn);
    background: rgba(255, 207, 74, 0.12);
    color: var(--gold);
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
  }
  .run-bat:disabled { opacity: 0.35; }
  .run-verdict { margin: 12px 0 0; font-size: 28px; font-weight: 900; animation: pop 0.4s cubic-bezier(0.2, 1.6, 0.4, 1) both; }
  .run-verdict.ok { color: var(--green); text-shadow: 0 0 16px rgba(94, 224, 138, 0.7); }
  .run-verdict.fail { color: var(--red); text-shadow: 0 0 16px rgba(255, 51, 68, 0.7); }
  .gym-result { margin: 12px 0 0; font-size: 16px; font-weight: 700; line-height: 1.55; }

  /* ---------- 엔딩 전환 ---------- */
  #endFx {
    position: fixed;
    inset: 0;
    z-index: 56;
    display: grid;
    place-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
  }
  #endFx.on { opacity: 1; }
  #endFx.end-rescued { background: radial-gradient(circle at 50% 45%, #fff 0%, rgba(255, 255, 255, 0.92) 40%, rgba(230, 240, 255, 0.85) 100%); }
  #endFx.end-rescued.on { animation: end-bloom 1.6s ease both; }
  @keyframes end-bloom { from { filter: blur(30px); transform: scale(0.6); } to { filter: none; transform: none; } }
  #endFx.end-survived { background: radial-gradient(circle at 50% 60%, rgba(255, 190, 110, 0.95), rgba(150, 70, 20, 0.92) 55%, #1a0d06 100%); }
  #endFx.end-dead { background: #000; }
  .ecg { width: min(80vw, 420px); height: 90px; }
  .ecg path { fill: none; stroke: #ff3344; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 0 6px #ff3344); }
  .ecg .beat { stroke-dasharray: 640; stroke-dashoffset: 640; animation: ecg-draw 1.3s linear forwards; }
  .ecg .flat { stroke-dasharray: 220; stroke-dashoffset: 220; animation: ecg-draw 0.5s 1.3s linear forwards, ecg-fade 0.6s 1.9s ease forwards; }
  @keyframes ecg-draw { to { stroke-dashoffset: 0; } }
  @keyframes ecg-fade { to { opacity: 0; } }

  /* 일지 마지막 장: 끊긴 문장 · 결과 도장 */
  .jr-cut { position: relative; }
  .jr-cut .ink {
    display: inline-block;
    width: 34px;
    height: 22px;
    margin-left: 2px;
    vertical-align: middle;
    border-radius: 50% 40% 55% 45%;
    background: radial-gradient(circle at 40% 45%, rgba(35, 40, 58, 0.9) 0 30%, rgba(35, 40, 58, 0.55) 48%, rgba(35, 40, 58, 0) 72%);
    filter: blur(1px);
    transform: scale(0.2);
    transform-origin: left center;
    animation: ink-bleed 1.6s 0.4s ease-out forwards;
  }
  @keyframes ink-bleed { to { transform: scale(1.6, 1.3); } }
  .jr-final-stamp {
    position: absolute;
    left: 58%;
    bottom: 0;
    z-index: 5;
    padding: 6px 18px;
    border: 5px solid currentColor;
    border-radius: 10px;
    font-family: var(--font-display);
    font-size: 40px;
    font-weight: 900;
    letter-spacing: 0.06em;
    white-space: nowrap;
    opacity: 0;
    mix-blend-mode: multiply;
    pointer-events: none;
    transform: translate(-50%, 0) rotate(-12deg);
    animation: stamp-slam 0.45s var(--stamp-delay, 0.6s) cubic-bezier(0.3, 1.5, 0.5, 1) forwards;
  }
  .jr-final-stamp.tone-rescued { color: #1f8a4c; }
  .jr-final-stamp.tone-survived { color: #c97a00; }
  .jr-final-stamp.tone-dead { color: #c3242f; }
  @keyframes stamp-slam {
    0% { opacity: 0; transform: translate(-50%, 0) rotate(-40deg) scale(2.6); }
    70% { opacity: 0.95; transform: translate(-50%, 0) rotate(-10deg) scale(0.92); }
    100% { opacity: 0.88; transform: translate(-50%, 0) rotate(-12deg) scale(1); }
  }
  .jr-book.final-shake { animation: quake 0.3s linear 1; animation-delay: calc(var(--stamp-delay, 0.6s) + 0.3s); }

  /* ---------- 그 후… (에필로그) ---------- */
  .screen.epilogue-screen { justify-content: center; min-height: 80vh; }
  body.epilogue-on { background: #000; }
  body.epilogue-on #stage, body.epilogue-on #moodTint, body.epilogue-on #moodOver { opacity: 0; }
  .epilogue { display: grid; gap: 18px; padding: 20px 4px; }
  .epi-title { margin: 0 0 8px; color: var(--muted); font-size: 15px; font-weight: 800; letter-spacing: 0.1em; }
  .epi-line { margin: 0; font-size: 18px; line-height: 1.7; word-break: keep-all; opacity: 0; animation: epi-in 1s ease forwards; }
  @keyframes epi-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
  .epilogue .actions { opacity: 0; animation: epi-in 0.6s ease forwards; }

  /* ---------- 결과 화면 ---------- */
  .res-head { margin-top: 8px; padding: 22px 16px 18px; border: 1px solid var(--line); border-radius: var(--radius); text-align: center; }
  .res-head.res-rescued { border-color: rgba(94, 224, 138, 0.55); background: radial-gradient(ellipse at 50% 0%, rgba(94, 224, 138, 0.16), transparent 70%); }
  .res-head.res-survived { border-color: rgba(255, 176, 32, 0.55); background: radial-gradient(ellipse at 50% 0%, rgba(255, 176, 32, 0.16), transparent 70%); }
  .res-head.res-dead { border-color: rgba(255, 51, 68, 0.55); background: radial-gradient(ellipse at 50% 0%, rgba(255, 51, 68, 0.16), transparent 70%); }
  .res-badge { display: inline-block; margin: 0; padding: 4px 14px; border-radius: 99px; font-size: 14px; font-weight: 900; }
  .res-rescued .res-badge { background: rgba(94, 224, 138, 0.18); color: var(--green); }
  .res-survived .res-badge { background: rgba(255, 176, 32, 0.18); color: var(--amber); }
  .res-dead .res-badge { background: rgba(255, 51, 68, 0.18); color: var(--red); }
  .res-emoji { margin: 12px 0 2px; font-size: 64px; line-height: 1.1; animation: pop 0.6s cubic-bezier(0.2, 1.6, 0.4, 1) both; }
  .res-name { margin: 0; font-family: var(--font-display); font-size: 30px; font-weight: 400; letter-spacing: 0.01em; }
  .res-stars { margin: 4px 0 0; font-size: 16px; letter-spacing: 2px; }
  .res-new { margin: 10px 0 0; color: var(--amber); font-size: 15px; font-weight: 900; animation: blink 1s steps(1) 3; }
  .res-death { margin: 0; color: #ffd6da; font-size: 15px; font-weight: 700; text-align: center; }
  .res-hint { margin: 6px 0 0; color: var(--muted); font-size: 14px; text-align: center; opacity: 0.7; }
  .moments ol { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
  .moments li { padding: 10px 12px; border-left: 3px solid var(--amber); border-radius: 0 10px 10px 0; background: rgba(0, 0, 0, 0.25); font-size: 15px; line-height: 1.5; word-break: keep-all; }
  .moments li small { display: block; color: var(--muted); font-size: 12px; font-weight: 700; }
  .style-line { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
  .style-line b { font-size: 18px; }
  .style-line span:first-child { font-size: 34px; }
  .style-desc { margin: -4px 0 14px; color: var(--muted); font-size: 14px; }
  .dex-head { display: flex; justify-content: space-between; align-items: baseline; }
  .dex-head small { color: var(--muted); font-size: 13px; font-weight: 700; }
  .dex-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .dex-cell { display: grid; place-items: center; gap: 2px; min-height: 74px; padding: 6px 4px; border: 1px solid var(--line); border-radius: 10px; background: rgba(0, 0, 0, 0.25); text-align: center; }
  .dex-cell b { font-size: 12px; line-height: 1.25; word-break: keep-all; }
  .dex-cell i { font-size: 22px; font-style: normal; line-height: 1; }
  .dex-cell small { font-size: 9px; letter-spacing: -1px; }
  .dex-cell.unknown b { color: var(--muted); }
  .dex-cell.unknown i { opacity: 0.35; filter: grayscale(1); }
  .dex-cell.r-rescued { border-color: rgba(94, 224, 138, 0.45); }
  .dex-cell.r-survived { border-color: rgba(255, 176, 32, 0.45); }
  .dex-cell.r-dead { border-color: rgba(255, 51, 68, 0.4); }
  .dex-cell.mine { box-shadow: 0 0 0 2px var(--amber); }
  @media (min-width: 520px) { .dex-grid { grid-template-columns: repeat(5, 1fr); } }
  .result .actions .btn-retry { min-height: 66px; font-size: 21px; }

  /* 움직임 줄이기 설정 존중 */
  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
    }
    .fx-flicker { display: none; }
  }

/* ---------- 시작 화면 (이어하기 · 엔딩 도감) ---------- */
.start-big { margin: 14px 0 0; font-size: 30px; font-weight: 900; letter-spacing: 0.04em; text-shadow: 0 0 18px rgba(255, 51, 68, 0.55); }
.continue-btn { display: grid; gap: 4px; justify-items: center; padding: 12px 18px; }
.continue-btn b { font-size: 20px; }
.cont-meta { font-size: 14px; font-weight: 700; opacity: 0.92; }
.cont-bars { display: flex; justify-content: center; gap: 10px; }
.cb { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; }
.cb i { font-style: normal; }
.cb-track { display: inline-block; width: 38px; height: 6px; overflow: hidden; border-radius: 99px; background: rgba(0, 0, 0, 0.35); }
.cb-track span { display: block; height: 100%; background: #fff; }
.start-new {
  justify-self: center;
  padding: 8px 14px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.confirm-new { display: grid; gap: 6px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); text-align: center; }
.confirm-new p { margin: 0; color: #ffd6da; font-size: 14px; font-weight: 700; }
.start-dex { display: flex; justify-content: center; align-items: center; gap: 12px; flex-wrap: wrap; }
.start-dex-btn { padding: 8px 14px; border: 1px solid var(--line); border-radius: 99px; background: var(--panel); font-size: 14px; font-weight: 800; cursor: pointer; }
.start-dex span { color: var(--amber); font-size: 13px; font-weight: 800; }

/* ---------- 프롤로그 건너뛰기 ---------- */
.skip-prologue {
  position: fixed;
  top: calc(64px + env(safe-area-inset-top));
  right: 12px;
  z-index: 60;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 99px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

/* ---------- 콜드 오픈 ---------- */
.cold-open {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #000;
  color: #fff;
  cursor: pointer;
}
.co-photo {
  position: absolute;
  inset: 0;
  background: center / cover no-repeat;
  opacity: 0;
  filter: brightness(0.55) contrast(1.15);
  transition: opacity 3.5s ease;
}
.cold-open.on .co-photo { opacity: 0.85; }
.co-beat { position: absolute; inset: 0; background: radial-gradient(ellipse at center, transparent 35%, rgba(120, 0, 10, 0.85)); animation: vig-pulse 1.2s ease-in-out infinite; }
.co-lines { position: relative; display: grid; gap: 14px; padding: 0 24px; text-align: center; }
.co-line { margin: 0; min-height: 1.4em; font-size: clamp(20px, 6vw, 30px); font-weight: 800; text-shadow: 0 2px 12px #000; }
.co-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.cold-open.flash .co-flash { animation: co-flash 0.2s linear forwards; }
@keyframes co-flash { 0% { opacity: 1; } 100% { opacity: 0; } }
.cold-open.dark .co-photo, .cold-open.dark .co-lines, .cold-open.dark .co-beat, .cold-open.dark .co-hint { display: none; }
.co-flashback { position: absolute; margin: 0; font-size: 26px; font-weight: 800; letter-spacing: 0.08em; animation: epi-in 0.8s ease both; }
.co-skip { position: absolute; top: calc(14px + env(safe-area-inset-top)); right: 14px; padding: 8px 14px; border: 1px solid rgba(255, 255, 255, 0.4); border-radius: 99px; background: rgba(0, 0, 0, 0.5); color: #fff; font-size: 14px; font-weight: 800; cursor: pointer; }
.co-hint { position: absolute; bottom: calc(24px + env(safe-area-inset-bottom)); margin: 0; color: rgba(255, 255, 255, 0.45); font-size: 12px; }
.start-sub { word-break: keep-all; }

/* ---------- 판정 연출 ("💪 체력 판정…" → 성공 / 실패) ---------- */
.judge-host { margin-top: 12px; }
.judge {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 18px 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-strong);
  text-align: center;
}
.judge-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 2px solid rgba(255, 255, 255, 0.55);
  border-radius: 50%;
  font-size: 22px;
  animation: judge-wobble 0.35s ease-in-out infinite alternate;
}
.judge-text { margin: 0; font-size: 17px; font-weight: 800; }
@keyframes judge-wobble { from { transform: rotate(-8deg) scale(0.96); } to { transform: rotate(8deg) scale(1.04); } }
.judge.ok, .judge.fail { animation: pop 0.4s cubic-bezier(0.2, 1.6, 0.4, 1) both; }
.judge.ok .judge-icon, .judge.fail .judge-icon { animation: none; }
.judge.ok { border-color: var(--green); box-shadow: 0 0 22px rgba(94, 224, 138, 0.45), inset 0 0 30px rgba(94, 224, 138, 0.18); }
.judge.ok .judge-text { color: var(--green); font-size: 24px; text-shadow: 0 0 14px rgba(94, 224, 138, 0.7); }
.judge.fail { border-color: var(--red); box-shadow: inset 0 0 30px rgba(255, 51, 68, 0.2); }
.judge.fail .judge-text { color: var(--red); font-size: 24px; }
/* 실패: 붉은 금이 가는 효과 */
.judge.fail::before, .judge.fail::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(115deg, transparent 47%, rgba(255, 51, 68, 0.95) 48%, rgba(255, 51, 68, 0.95) 49%, transparent 50%),
    linear-gradient(62deg, transparent 58%, rgba(255, 51, 68, 0.75) 58.6%, transparent 59.4%);
  clip-path: inset(0 100% 0 0);
  animation: judge-crack 0.35s 0.05s ease-out forwards;
}
.judge.fail::after {
  background: linear-gradient(160deg, transparent 30%, rgba(255, 51, 68, 0.7) 30.5%, transparent 31.3%),
    linear-gradient(20deg, transparent 70%, rgba(255, 51, 68, 0.6) 70.5%, transparent 71.2%);
  animation-delay: 0.15s;
}
@keyframes judge-crack { to { clip-path: inset(0 0 0 0); } }
.judge-tag { margin-right: 4px; }
.judge-tag.ok { color: var(--green); }
.judge-tag.fail { color: var(--red); }

/* 선택지 오른쪽: 판정 능력치 아이콘 (테두리 있는 작은 원 · 막대 아이콘과 구분) */
.choice-check {
  flex: none;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  margin-left: 6px;
  border: 1.5px solid rgba(255, 255, 255, 0.6);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.35);
}
.choice-bars + .choice-check { margin-left: 6px; }
.choice-body + .choice-check { margin-left: auto; }
.choice-check i { font-style: normal; font-size: 13px; line-height: 1; }
.choice.locked .choice-check { opacity: 0.5; }

/* [확성기] 줄: 노란 테두리 경고 상자 + 지직거리는 무전 */
.q-line.megaphone {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin: 8px 0;
  padding: 10px 12px;
  border: 2px solid var(--amber);
  border-radius: 10px;
  background: rgba(255, 176, 32, 0.1);
  color: #ffe2a6;
  font-size: 0.92em;
}
.q-line.megaphone > i { font-style: normal; flex: none; }
.q-line.megaphone > span { animation: radio-static 2.4s steps(1) infinite; }
@keyframes radio-static {
  0%, 18%, 22%, 56%, 60%, 100% { opacity: 1; transform: none; text-shadow: none; }
  19%, 57% { opacity: 0.55; transform: translateX(1px); text-shadow: -1px 0 rgba(255, 51, 68, 0.6), 1px 0 rgba(94, 224, 138, 0.5); }
  20%, 58% { opacity: 0.85; transform: translateX(-1px); }
}
body.calm-fx .q-line.megaphone > span { animation: none; }

/* ---------- 미니게임 공통 ---------- */
.mg-body { display: grid; gap: 10px; }
.mg:not(.live) .mg-body { opacity: 0.45; }
.mg-shaky.live:not(.done) { animation: mg-shaky 0.18s linear infinite; }
@keyframes mg-shaky { 0%, 100% { transform: translate(0, 0); } 25% { transform: translate(1px, -1px); } 50% { transform: translate(-1px, 1px); } 75% { transform: translate(1px, 1px); } }
body.calm-fx .mg-shaky.live { animation: none; }
.mg-btn {
  min-height: 64px;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-btn);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-size: 20px;
  font-weight: 900;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: pointer;
}
.mg-btn:disabled { opacity: 0.4; }
.mg-big { min-height: 96px; }
.mg-gauge { height: 16px; overflow: hidden; border: 1px solid var(--line); border-radius: 99px; background: var(--track); }
.mg-gauge i { display: block; width: 0; height: 100%; background: linear-gradient(90deg, var(--amber), var(--green)); transition: width 0.08s linear; }
.mg-debug { display: flex; gap: 8px; justify-content: center; margin-top: 10px; }
.mg-debug button { padding: 6px 10px; border: 1px dashed var(--muted); border-radius: 8px; background: transparent; color: var(--muted); font-size: 12px; cursor: pointer; }
/* timing */
.tm-bar { position: relative; height: 34px; border: 1px solid var(--line); border-radius: 10px; background: var(--track); overflow: hidden; }
.tm-zone { position: absolute; top: 0; bottom: 0; background: rgba(94, 224, 138, 0.45); box-shadow: inset 0 0 0 2px var(--green); }
.tm-mark { position: absolute; top: -2px; bottom: -2px; left: 0; width: 4px; margin-left: -2px; background: #fff; box-shadow: 0 0 8px #fff; }
.mg-dots { display: flex; gap: 8px; justify-content: center; margin: 0; }
.mg-dots i { width: 14px; height: 14px; border: 2px solid var(--muted); border-radius: 50%; }
.mg-dots i.hit { border-color: var(--green); background: var(--green); }
.mg-dots i.miss { border-color: var(--red); background: var(--red); }
/* hold: 누르는 동안 어두워지고 심장박동이 빨라짐 */
.mg-hold.down { background: rgba(255, 51, 68, 0.2); border-color: var(--red); }
body.mg-holding::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 30%, rgba(0, 0, 0, calc(0.4 + var(--hold, 0) * 0.5)));
  animation: vig-pulse calc(1.1s - var(--hold, 0) * 0.7s) ease-in-out infinite;
}
/* swipe */
.mg-swipe { min-height: 120px; touch-action: none; }
.mg-swipe.pulled { animation: mg-pull 0.25s ease-out; }
@keyframes mg-pull { 0% { transform: translateY(0); } 40% { transform: translateY(10px); } 100% { transform: translateY(0); } }

/* 15층 계단: 사진에 어둡고 붉은 필터 */
body.photo-red .stage-pic { filter: brightness(0.5) sepia(0.7) saturate(2.6) hue-rotate(-28deg); }
body.photo-red .stage-fill { filter: blur(90px) sepia(0.7) saturate(2.6) hue-rotate(-28deg); }

/* 옥상 보급 상자 카드 */
.supply-title { margin: 14px 0 8px; font-weight: 800; }
.supply-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.supply-card {
  display: grid;
  gap: 4px;
  justify-items: center;
  padding: 12px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-strong);
  color: var(--text);
  font: inherit;
  text-align: center;
  cursor: pointer;
}
.supply-card:hover:not(:disabled), .supply-card.picked { border-color: var(--amber); }
.supply-card:disabled:not(.picked) { opacity: 0.45; }
.supply-emoji { font-size: 28px; }
.supply-can { display: grid; color: var(--muted); font-size: 13px; line-height: 1.4; }
.supply-can small { color: var(--amber); font-size: 12px; font-weight: 800; }

/* ---------- 사진 위 핫스팟 (hidden · 사진 속 짐 싸기) ---------- */
.spot-pic { position: relative; aspect-ratio: var(--ar, 0.747); margin: 0 auto; user-select: none; -webkit-user-select: none; touch-action: pan-x; cursor: pointer; }
.spot-pic img { display: block; width: 100%; height: 100%; object-fit: fill; pointer-events: none; }
.spot {
  position: absolute;
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  transform: translate(-50%, -50%);
  pointer-events: none; /* 탭은 사진에서 가장 가까운 핫스팟으로 (js) */
}
.spot:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.spot-pic.debug .spot { background: rgba(255, 51, 68, 0.28); box-shadow: inset 0 0 0 2px rgba(255, 51, 68, 0.8); }
.spot.packed, .spot.found { box-shadow: 0 0 0 3px var(--green), 0 0 24px 6px rgba(94, 224, 138, 0.55); background: rgba(94, 224, 138, 0.12); }
.spot.glow { animation: spot-glow 0.5s ease-out; }
@keyframes spot-glow { 0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.9), 0 0 40px 18px rgba(255, 240, 180, 0.8); } 100% { box-shadow: 0 0 0 3px var(--green), 0 0 24px 6px rgba(94, 224, 138, 0.55); } }
.spot.hint:not(.packed) { animation: spot-hint 1.1s ease-in-out; }
@keyframes spot-hint { 0%, 100% { box-shadow: none; } 45% { box-shadow: 0 0 18px 4px rgba(255, 236, 170, 0.55), inset 0 0 14px rgba(255, 236, 170, 0.35); } }
.spot.nope { animation: spot-nope 0.35s linear; }
@keyframes spot-nope { 0%, 100% { box-shadow: none; } 30%, 70% { box-shadow: 0 0 0 3px var(--red); } }

/* 사진 속 짐 싸기: 사진이 주인공 (세로 화면 70% 이상), 글 영역은 타이머와 안내 한 줄 */
.screen.packing2 { padding-top: 0; }
.pk2 { position: relative; display: flex; flex-direction: column; }
.pk2-photo { position: relative; overflow: hidden; }
body.portrait .pk2-photo { margin: 0 -18px; }
.pk2-list {
  position: absolute;
  top: 8px;
  right: 6px;
  z-index: 2;
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 99px;
  background: rgba(0, 0, 0, 0.55);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
body.portrait .pk2-list { right: -6px; }
.pk2-foot { padding: 6px 0 4px; }
.pk2-row { display: flex; align-items: center; gap: 12px; }
.pk2-row .pack-timer b { font-size: 30px; }
.pk2-left { color: var(--muted); font-size: 13px; font-weight: 700; }
.pk2-row .btn { width: auto; min-height: 40px; margin-left: auto; padding: 8px 22px; }
.pk2-line { margin: 2px 0 0; color: var(--amber); font-size: 15px; font-weight: 800; }
.pk2-line.warn { color: var(--red); }
.pk-fly { position: fixed; z-index: 60; font-size: 30px; pointer-events: none; transform: translate(-50%, -50%); }

/* dial: 라디오 주파수 */
.dl-note { margin: 0; color: var(--green); font-size: 13px; font-weight: 700; }
.dl-band { position: relative; height: 30px; border: 1px solid var(--line); border-radius: 8px; background: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.18) 0 1px, transparent 1px 10%), var(--track); touch-action: none; cursor: ew-resize; }
.dl-needle { position: absolute; top: -3px; bottom: -3px; width: 3px; margin-left: -1.5px; background: var(--red); box-shadow: 0 0 8px var(--red); }
.mg.dl-in .dl-needle { background: var(--green); box-shadow: 0 0 10px var(--green); }
.dl-noise { display: flex; align-items: flex-end; gap: 3px; height: 34px; }
.dl-noise i { flex: 1; height: 10%; background: rgba(255, 255, 255, calc(0.2 + var(--noise, 1) * 0.5)); transition: height 0.1s linear; }
.dl-knob { position: relative; width: 116px; height: 116px; margin: 4px auto; border: 3px solid rgba(255, 255, 255, 0.55); border-radius: 50%; background: radial-gradient(circle at 40% 35%, #4a3135, #1d1012 70%); touch-action: none; cursor: grab; }
.dl-knob i { position: absolute; inset: 0; }
.dl-knob i::after { content: ""; position: absolute; top: 8px; left: 50%; width: 6px; height: 30px; margin-left: -3px; border-radius: 3px; background: var(--amber); }
.dl-knob:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; }
.mg-dial .mg-body { filter: blur(calc(var(--noise, 1) * 0.6px)); }
body.mg-static::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  opacity: calc(var(--noise, 1) * 0.35);
  background: repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.12) 0 1px, transparent 1px 3px);
  animation: static-roll 0.18s steps(3) infinite;
}
@keyframes static-roll { 0% { transform: translateY(0); } 50% { transform: translateY(1px); } 100% { transform: translateY(-1px); } }
body.calm-fx.mg-static::before { animation: none; }

/* drag: 바리케이드 쌓기 */
.dg-room { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; min-height: 170px; }
.dg-items { display: grid; gap: 8px; align-content: start; }
.dg-item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 6px 10px;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-btn);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-size: 24px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: grab;
}
.dg-item small { font-size: 14px; font-weight: 800; }
.dg-item.dragging { position: relative; z-index: 3; cursor: grabbing; border-color: var(--amber); box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6); }
.dg-item.placed { visibility: hidden; }
.dg-zone { display: grid; place-items: center; align-content: center; gap: 4px; border: 2px dashed var(--amber); border-radius: 14px; background: rgba(255, 176, 32, 0.08); }
.dg-zone.over { background: rgba(94, 224, 138, 0.18); border-color: var(--green); }
.dg-door { font-size: 46px; animation: door-thud 1.1s ease-in-out infinite; }
@keyframes door-thud { 0%, 60%, 100% { transform: none; } 66% { transform: translateX(-4px) rotate(-2deg); } 72% { transform: translateX(4px) rotate(2deg); } 78% { transform: translateX(-2px); } }
body.calm-fx .dg-door { animation: none; }
.dg-zone small { color: var(--amber); font-weight: 800; }
.dg-placed { display: flex; gap: 2px; min-height: 30px; font-size: 24px; }

/* trace: 붕대 감기 */
.tr-svg { display: block; width: 100%; aspect-ratio: 100 / 60; touch-action: none; user-select: none; cursor: crosshair; }
.tr-arm { fill: #c99272; stroke: #8a5a40; stroke-width: 0.6; }
.tr-wound { fill: none; stroke: #b3121f; stroke-width: 1.6; stroke-linecap: round; }
.tr-path { fill: none; stroke: rgba(255, 255, 255, 0.85); stroke-width: 1.4; stroke-dasharray: 2.2 2; stroke-linejoin: round; }
.tr-done { fill: none; stroke: #f5f1e8; stroke-width: 4.2; stroke-linecap: round; stroke-linejoin: round; opacity: 0.95; }
.tr-head { fill: var(--amber); }
.mg.tr-off .tr-head { fill: var(--red); animation: blink 0.5s steps(1) infinite; }
/* 사진 오른쪽 아래 ✦ 표시 가리기 (장면 사진 레이어와 같은 방식) + 아래쪽을 어둠으로 */
.spot-pic::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 86.5% 90%, rgba(4, 2, 3, 0.97) 0, rgba(4, 2, 3, 0.93) 4.5%, rgba(4, 2, 3, 0) 12%),
    radial-gradient(circle at 100% 100%, rgba(4, 2, 3, 0.85) 0, rgba(4, 2, 3, 0.55) 18%, rgba(4, 2, 3, 0) 34%),
    linear-gradient(to bottom, transparent 82%, rgba(11, 7, 8, 0.85));
}

/* ---------- 탈출 파트 미니게임 ---------- */
/* 사진 위에서 하는 미니게임: 배경 사진 대신 미니게임 안에 사진 전체 (잘리지 않음) */
.mg .mg-pic { width: min(100%, calc(56vh * var(--ar, 0.747))); border-radius: 10px; overflow: hidden; cursor: default; }
body.portrait .mg .mg-pic { width: min(100%, calc(46dvh * var(--ar, 0.747))); }
/* light: 어둠 속 불빛 */
.lt-exit { position: absolute; transform: translate(-50%, -50%); display: grid; place-items: center; font-size: 15px; line-height: 1; }
.lt-exit b { color: #6dff9a; font-size: 9px; letter-spacing: 0.08em; text-shadow: 0 0 6px #2bff6a; }
.lt-dark {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--lx, 50%) var(--ly, 50%), rgba(0, 0, 0, 0.05) 0, rgba(0, 0, 0, 0.25) calc(var(--lr, 40px) * 0.7), rgba(2, 1, 1, 0.985) var(--lr, 40px));
  pointer-events: none;
}
.lt-lighter { animation: lighter 0.9s steps(4) infinite; }
@keyframes lighter { 0%, 100% { opacity: 1; } 30% { opacity: 0.93; } 55% { opacity: 1; } 70% { opacity: 0.9; } }
body.calm-fx .lt-lighter { animation: none; }
/* stealth: 무궁화 꽃이 피었습니다 */
@keyframes st-twitch { 0%, 100% { transform: translate(-50%, -50%); } 50% { transform: translate(-46%, -50%) rotate(3deg); } }
/* balance: 판자 */
.bl-board { position: relative; height: 70px; border-bottom: 10px solid #8a6a48; border-radius: 4px; background: linear-gradient(transparent 60%, rgba(0, 0, 0, 0.4)); touch-action: none; cursor: ew-resize; }
.bl-zone { position: absolute; left: 29.75%; right: 29.75%; bottom: -10px; height: 10px; background: rgba(94, 224, 138, 0.55); }
.bl-me { position: absolute; bottom: 0; font-style: normal; font-size: 40px; line-height: 1; transform: translateX(-50%); }
.bl-board.off .bl-me { filter: drop-shadow(0 0 8px var(--red)); }
.bl-board.off { border-bottom-color: var(--red); }
/* memory */
.mm-show { display: grid; place-items: center; height: 72px; font-size: 52px; }
.mm-show.flash { animation: pop 0.3s ease-out; }
.mm-pad { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.mm-pad .mg-btn { min-height: 56px; font-size: 26px; }
/* code: 자물쇠 */
.cd-rows { display: grid; gap: 4px; justify-content: center; }
.cd-row { display: flex; gap: 6px; align-items: center; min-height: 26px; font-family: var(--font-mono); font-size: 18px; }
.cd-row span { display: inline-grid; place-items: center; width: 24px; }
.cd-row b { margin-left: 8px; font-size: 16px; letter-spacing: 2px; }
.cd-now { display: flex; gap: 10px; justify-content: center; font-family: var(--font-mono); font-size: 34px; font-weight: 900; }
.cd-now .fixed { color: var(--green); }
.cd-pad { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.cd-pad .mg-btn { min-height: 46px; font-size: 20px; }
/* whack: 창문의 그림자 */
.wh-win { position: absolute; padding: 0; border: 0; border-radius: 4px; background: transparent; cursor: pointer; }
.wh-win i { position: absolute; inset: 12% 22% 0; border-radius: 45% 45% 8% 8%; background: radial-gradient(ellipse at 50% 22%, #050304 22%, transparent 23%), linear-gradient(transparent 30%, #050304 31%); opacity: 0; transform: translateY(30%); transition: opacity 0.15s, transform 0.15s; }
.wh-win.on i { opacity: 0.92; transform: none; }
.wh-win.on { box-shadow: inset 0 0 0 2px rgba(255, 51, 68, 0.6); }
.wh-win.hit { animation: wh-hit 0.3s ease-out; }
@keyframes wh-hit { 0% { box-shadow: inset 0 0 0 3px var(--green), 0 0 18px var(--green); } 100% { box-shadow: none; } }
.cd-row:not([data-fb]) { display: none; } /* 아직 안 쓴 기회 줄은 숨김 (남은 기회는 글로) */
.cd-left { margin: 0; color: var(--muted); font-size: 13px; font-weight: 700; }
body.portrait .cd-pad .mg-btn { min-height: 36px; }
body.portrait .mg-code .mg-body { gap: 5px; }
body.portrait .mg-code .mg-intro { margin-bottom: 4px; }
body.portrait .cd-now { font-size: 24px; line-height: 1.2; }
/* 사진 위 미니게임 중: 배경 사진 자리로 비워 둔 공간을 접음 (가로 화면) */
body.mg-photo-on:not(.portrait) .scene-space { flex: 0 0 8px; }
body.mg-photo-on:not(.portrait) .mg .mg-pic { width: min(100%, calc(52vh * var(--ar, 0.747))); }
/* 선택지 경고 (예: ❤️ 가 낮을 때 강행군) */
.choice-warn { display: block; margin-top: 3px; color: var(--red); font-size: 12.5px; font-weight: 800; text-shadow: 0 0 8px rgba(255, 51, 68, 0.35); }

/* ---------- 공통 다듬기 (전체 점검) ---------- */
/* 키보드 초점: 모든 버튼 · 슬라이더에 같은 호박색 테두리 */
button:focus-visible, [role="slider"]:focus-visible, a:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
/* 미니게임 버튼: 누를 때 같은 반응 (연타 · 탭 · 키패드 · 화살표) */
.mg-btn:active:not(:disabled), .run-pad:active:not(:disabled) { transform: scale(0.97); background: rgba(255, 255, 255, 0.15); }
.mg-btn, .run-pad { transition: transform 0.06s ease, background 0.12s ease, border-color 0.12s ease; }
/* 타이머 · 숫자는 같은 글꼴, 자릿수 폭 고정 */
.run-time, .pack-timer, .cd-now, .cd-row, .hud-day { font-variant-numeric: tabular-nums; }
/* 키가 작은 폰 (iPhone SE 등): 미니게임 사진 · 큰 버튼을 줄여 가방 바 위에 다 들어오게 */
@media (max-height: 700px) {
  body.portrait .mg .mg-pic { width: min(100%, calc(36dvh * var(--ar, 0.747))); }
  body.portrait .mg-big { min-height: 70px; }
  body.portrait .run-pad { min-height: 68px; }
  body.portrait .mg-intro { margin-bottom: 6px; font-size: 14px; }
}
.screen.no-anim { animation: none; }

/* ---------- 도전 과제 ---------- */
.ach-list { display: grid; gap: 6px; max-height: min(60vh, 520px); overflow-y: auto; }
.ach-row { display: grid; grid-template-columns: 34px 1fr; column-gap: 8px; align-items: center; margin: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; background: rgba(0, 0, 0, 0.25); }
.ach-row i { grid-row: span 2; font-style: normal; font-size: 24px; text-align: center; }
.ach-row b { font-size: 15px; }
.ach-row span { color: var(--muted); font-size: 13px; line-height: 1.4; }
.ach-row:not(.got) b { color: var(--muted); }
.ach-row:not(.got) span { opacity: 0.55; filter: blur(0.6px); font-style: italic; } /* 흐릿한 힌트 */
.ach-row:not(.got) i { opacity: 0.5; }
.ach-row.got { border-color: rgba(255, 207, 74, 0.45); }
.ach-new { border-color: var(--gold); box-shadow: 0 0 18px rgba(255, 207, 74, 0.25); }
.ach-new .card-title { color: var(--gold); }
.ach-new .ach-row { background: transparent; border: 0; padding: 4px 0; }

/* 설정: 소리 크기 */
.vol { display: grid; grid-template-columns: auto 1fr 3.2em; gap: 10px; align-items: center; margin: 4px 0 14px; font-weight: 700; }
.vol input { width: 100%; accent-color: var(--amber); }
.vol b { color: var(--muted); font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; }

/* ⑨ 헬기 작별: 한 줄씩 천천히 */
.farewell { display: grid; gap: 14px; }
.fw-line { margin: 0; font-size: 18px; line-height: 1.7; word-break: keep-all; opacity: 0; animation: fw-in 1.4s ease forwards; }
.fw-actions { opacity: 0; animation: fw-in 1s ease forwards; }
@keyframes fw-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.door-break { color: var(--red); font-size: 20px; font-weight: 900; }

/* ---------- 미니게임 설명 카드 ---------- */
.mg-tut { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 20px; background: rgba(5, 2, 3, 0.78); animation: screen-in 0.3s ease both; }
.mg-tut-box { width: min(380px, 100%); padding: 20px 20px 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-strong); text-align: center; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6); }
.mg-tut-box h2 { margin: 0 0 12px; font-family: var(--font-display); font-size: 28px; font-weight: 400; letter-spacing: 0.02em; }
.mg-tut-goal { margin: 12px 0 6px; font-size: 16px; font-weight: 800; line-height: 1.5; word-break: keep-all; }
.mg-tut-how { margin: 0 0 16px; color: var(--muted); font-size: 13.5px; line-height: 1.5; word-break: keep-all; }
.mg .mg-intro { transition: opacity 0.4s ease; }
.mg.live .mg-intro { opacity: 0.55; }
/* 시범 그림 */
.mg-tut-demo { position: relative; height: 92px; margin: 0 auto; width: 220px; border-radius: 12px; background: rgba(0, 0, 0, 0.3); overflow: hidden; }
.dm-finger { position: absolute; left: 50%; top: 52px; font-style: normal; font-size: 30px; transform: translateX(-50%); }
.dm-bar { position: absolute; left: 20px; right: 20px; top: 20px; height: 18px; border-radius: 6px; background: var(--track); }
.dm-zone { position: absolute; left: 40%; width: 20%; top: 0; bottom: 0; background: rgba(94, 224, 138, 0.5); }
.dm-mark { position: absolute; top: -3px; bottom: -3px; width: 4px; background: #fff; animation: dm-mark 2s ease-in-out infinite alternate; }
@keyframes dm-mark { from { left: 2%; } to { left: 96%; } }
.demo-timing .dm-finger { animation: dm-tap 2s steps(1) infinite; }
@keyframes dm-tap { 0%, 45%, 60%, 100% { transform: translateX(-50%) scale(1); } 48%, 56% { transform: translateX(-50%) scale(0.8); } }
.dm-gauge { position: absolute; left: 30px; right: 30px; top: 20px; height: 14px; border-radius: 99px; background: var(--track); overflow: hidden; }
.dm-gauge i { display: block; height: 100%; background: linear-gradient(90deg, var(--amber), var(--green)); animation: dm-fill 2.2s ease-in infinite; }
.dm-slow i { animation-duration: 4s; animation-timing-function: linear; }
@keyframes dm-fill { from { width: 0; } to { width: 100%; } }
.demo-mash .dm-finger { animation: dm-mash 0.22s ease-in-out infinite alternate; }
@keyframes dm-mash { from { transform: translateX(-50%) scale(1); } to { transform: translateX(-50%) scale(0.75); } }
.dm-pads { position: absolute; left: 30px; right: 30px; top: 14px; display: flex; justify-content: space-between; }
.dm-pads b { display: grid; place-items: center; width: 60px; height: 32px; border: 2px solid rgba(255, 255, 255, 0.5); border-radius: 10px; }
.demo-run .dm-finger { animation: dm-alt 0.8s steps(1) infinite; }
@keyframes dm-alt { 0% { left: 30%; } 50% { left: 70%; } }
.demo-hold .dm-finger { animation: dm-hold 4s ease infinite; }
@keyframes dm-hold { 0%, 5% { transform: translateX(-50%) scale(1); } 10%, 95% { transform: translateX(-50%) scale(0.8); } }
.dm-rope { position: absolute; left: 50%; top: 0; bottom: 0; width: 4px; margin-left: -2px; background: repeating-linear-gradient(transparent 0 6px, #b98a52 6px 12px); animation: dm-rope 0.7s linear infinite; }
@keyframes dm-rope { from { background-position: 0 0; } to { background-position: 0 24px; } }
.demo-swipe .dm-finger { animation: dm-swipe 0.9s ease-in infinite; left: 62%; }
@keyframes dm-swipe { from { top: 6px; opacity: 1; } 80% { top: 56px; opacity: 1; } to { top: 60px; opacity: 0; } }
.dm-photo { position: absolute; inset: 8px 30px 30px; display: flex; justify-content: space-around; align-items: center; border-radius: 8px; background: #3a2c26; font-size: 22px; }
.dm-photo i { font-style: normal; }
.demo-hidden .dm-finger { animation: dm-hid 3s steps(1) infinite; }
@keyframes dm-hid { 0% { left: 28%; } 33% { left: 50%; } 66% { left: 72%; } }
.dm-knob { position: absolute; left: 50%; top: 8px; width: 46px; height: 46px; margin-left: -23px; border: 3px solid rgba(255, 255, 255, 0.5); border-radius: 50%; animation: dm-rot 2.4s ease-in-out infinite alternate; }
.dm-knob i { position: absolute; left: 50%; top: 4px; width: 4px; height: 14px; margin-left: -2px; background: var(--amber); border-radius: 2px; }
@keyframes dm-rot { from { transform: rotate(-80deg); } to { transform: rotate(60deg); } }
.demo-dial .dm-finger { animation: dm-sway 2.4s ease-in-out infinite alternate; }
@keyframes dm-sway { from { left: 38%; } to { left: 62%; } }
.dm-drag { position: absolute; inset: 10px 24px auto; display: flex; justify-content: space-between; font-size: 26px; }
.dm-drag i { font-style: normal; animation: dm-carry 2.2s ease-in-out infinite; }
.dm-drag-finger, .dm-drag .dm-finger { }
.dm-drag ~ .dm-finger { animation: dm-carry-f 2.2s ease-in-out infinite; }
@keyframes dm-carry { 0%, 15% { transform: translateX(0); } 70%, 100% { transform: translateX(120px); } }
@keyframes dm-carry-f { 0%, 15% { left: 22%; } 70%, 100% { left: 76%; } }
.dm-zig { position: absolute; left: 10px; right: 10px; top: 6px; width: 200px; height: 40px; }
.dm-zig polyline { fill: none; stroke: rgba(255, 255, 255, 0.8); stroke-width: 2; stroke-dasharray: 4 3; }
.demo-trace .dm-finger { animation: dm-zigf 2.6s linear infinite; }
@keyframes dm-zigf { 0% { left: 6%; top: 20px; } 16% { left: 20%; top: 6px; } 33% { left: 35%; top: 34px; } 50% { left: 50%; top: 6px; } 66% { left: 65%; top: 34px; } 83% { left: 80%; top: 6px; } 100% { left: 94%; top: 20px; } }
.dm-dark { position: absolute; inset: 0; background: radial-gradient(circle 26px at var(--dx, 30%) 50%, rgba(255, 240, 200, 0.25), rgba(0, 0, 0, 0.95) 30px); animation: dm-dark 2.6s ease-in-out infinite alternate; }
.dm-exit { position: absolute; left: 70%; top: 30%; font-style: normal; font-size: 16px; }
@property --dx { syntax: '<percentage>'; inherits: false; initial-value: 30%; }
@keyframes dm-dark { from { --dx: 20%; } to { --dx: 72%; } }
.demo-light .dm-finger { animation: dm-lightf 2.6s ease-in-out infinite alternate; }
@keyframes dm-lightf { from { left: 20%; } to { left: 72%; } }
.dm-st { position: absolute; inset: 10px 26px auto; display: flex; justify-content: space-between; font-size: 26px; }
.dm-st i { font-style: normal; animation: dm-turn 3s steps(1) infinite; }
.dm-st b { animation: dm-walk 3s linear infinite; }
@keyframes dm-turn { 0%, 55% { transform: scaleX(1); } 60%, 85% { transform: scaleX(-1); filter: drop-shadow(0 0 6px var(--red)); } }
@keyframes dm-walk { 0% { transform: translateX(0); } 55%, 100% { transform: translateX(60px); } }
.demo-stealth .dm-finger { animation: dm-hold 3s ease infinite; }
.dm-plank { position: absolute; left: 24px; right: 24px; top: 40px; height: 8px; border-radius: 3px; background: #8a6a48; }
.dm-plank i { position: absolute; bottom: 4px; left: 50%; font-style: normal; font-size: 26px; animation: dm-sway2 1.6s ease-in-out infinite alternate; }
@keyframes dm-sway2 { from { transform: translateX(-90%); } to { transform: translateX(-10%); } }
.demo-balance .dm-finger { animation: dm-sway 1.6s ease-in-out infinite alternate-reverse; }
.dm-arrows { position: absolute; inset: 8px 40px auto; display: flex; justify-content: space-around; font-size: 24px; }
.dm-arrows i { font-style: normal; opacity: 0; animation: dm-flash 3s steps(1) infinite; }
.dm-arrows i:nth-child(2) { animation-delay: 0.6s; }
.dm-arrows i:nth-child(3) { animation-delay: 1.2s; }
@keyframes dm-flash { 0%, 18% { opacity: 1; } 20%, 100% { opacity: 0; } }
.demo-memory .dm-finger { animation: dm-tap 1s steps(1) infinite 2s; }
.dm-code { position: absolute; inset: 14px 10px; display: grid; gap: 6px; place-content: center; font-size: 15px; }
.dm-code b { font-family: var(--font-mono); letter-spacing: 2px; }
.dm-wins { position: absolute; inset: 10px 24px auto; display: flex; justify-content: space-between; }
.dm-wins i { width: 34px; height: 40px; border: 2px solid rgba(120, 160, 220, 0.6); border-radius: 3px; background: #142235; }
.dm-wins i.on { background: radial-gradient(ellipse at 50% 30%, #000 30%, transparent 32%), linear-gradient(transparent 45%, #000 46%), #142235; animation: dm-shadow 1.8s steps(1) infinite; }
@keyframes dm-shadow { 0%, 60% { opacity: 1; } 61%, 100% { opacity: 0.3; } }
.demo-whack .dm-finger { left: 40%; animation: dm-tap 1.8s steps(1) infinite; }
body.calm-fx .mg-tut-demo * { animation-duration: 3s !important; }
.set-tut { margin: 4px 0 12px; }

/* ---------- 입체 사진 (js/depth.js): WebGL 캔버스가 사진 위를 덮음. 못 쓰면 천천히 확대 ---------- */
.stage-gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; opacity: 0; transition: opacity 0.4s ease; }
.stage-layer.depth .stage-gl { opacity: 1; }
.stage-pic { animation: pic-zoom 26s ease-in-out infinite alternate; }
.stage-layer.depth .stage-pic { animation: none; }
body.calm-fx .stage-pic { animation: none; }
@keyframes pic-zoom { from { transform: scale(1); } to { transform: scale(1.07); } }
.stage-pic::after { z-index: 1; }

/* ---------- ④ 새벽 현관: 손전등 (사진만 어둡게, 글은 #app 이라 그대로) ---------- */
.torch {
  position: absolute; inset: 0; opacity: 0; pointer-events: none; transition: opacity 1.2s ease;
  background: rgba(2, 1, 1, 0.94);
}
.torch.on { opacity: 1; }
.torch.on:not(.lit) { animation: torch-dim 9s ease-in-out infinite; }
.torch.lit {
  background: radial-gradient(circle var(--tr, 120px) at var(--tx, 50%) var(--ty, 25%),
    rgba(2, 1, 1, 0) 0%, rgba(2, 1, 1, 0.08) 45%, rgba(2, 1, 1, 0.55) 75%, rgba(2, 1, 1, 0.95) 100%);
}
@keyframes torch-dim { 0%, 62%, 100% { background-color: rgba(2, 1, 1, 0.94); } 72% { background-color: rgba(2, 1, 1, 0.8); } 80% { background-color: rgba(2, 1, 1, 0.9); } }
body.calm-fx .torch.on:not(.lit) { animation: none; }

/* 결과 화면: 관계 · 다른 선택을 했다면… */
.relations .rel-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 6px 0; font-weight: 700; }
.relations .rel-hearts { letter-spacing: 2px; font-size: 15px; white-space: nowrap; }
.relations .rel-clue { margin: 12px 0 0; padding-top: 10px; border-top: 1px dashed rgba(255, 255, 255, 0.15); color: var(--muted); font-size: 14px; font-style: italic; }
/* ---------- 결과 화면: 당신의 20일 (폴라로이드 회상) ---------- */
.recall { margin: 22px 0 6px; text-align: center; }
.recall-title { margin: 0 0 14px; font-family: "Nanum Pen Script", "Nanum Pen", "Gaegu", cursive; font-size: 30px; color: #f1e6cf; }
.recall-stack { position: relative; width: min(300px, 82vw); aspect-ratio: 0.78; margin: 0 auto; cursor: pointer; outline: none; }
.recall-stack:focus-visible { box-shadow: 0 0 0 3px var(--amber); border-radius: 6px; }
.polaroid {
  position: absolute; inset: 0; margin: 0; padding: 12px 12px 0; display: flex; flex-direction: column;
  background: #f4ecd8; border-radius: 3px; box-shadow: 0 14px 30px rgba(0, 0, 0, 0.55);
  opacity: 0; transform: rotate(var(--tilt)) translateY(14px) scale(0.97);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.polaroid.on { opacity: 1; transform: rotate(var(--tilt)); z-index: 2; }
.polaroid.past { opacity: 0; transform: rotate(calc(var(--tilt) * -2)) translate(-18px, -6px) scale(0.98); }
.pol-photo { flex: 1; background: #2a1d1f center / cover no-repeat; filter: sepia(0.25) contrast(0.95); }
.polaroid figcaption {
  min-height: 74px; display: flex; align-items: center; justify-content: center; padding: 8px 6px 10px;
  color: #23283a; font-family: "Nanum Pen Script", "Nanum Pen", "Gaegu", cursive; font-size: 22px; line-height: 1.25; word-break: keep-all;
}
.pol-date { color: #b3121f; font-weight: 400; margin-right: 6px; white-space: nowrap; }
.recall-dots { display: flex; justify-content: center; gap: 7px; margin: 16px 0 0; }
.recall-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--line); transition: background 0.3s; }
.recall-dots i.on { background: var(--amber); }
body.calm-fx .polaroid { transition: opacity 0.3s ease; }

/* 생존자 칭호 */
.survivor-title { margin: 22px 0 18px; text-align: center; }
.st-label { margin: 0 0 6px; color: var(--muted); font-size: 14px; font-weight: 700; }
.st-name { margin: 0; font-family: var(--font-display); font-size: clamp(26px, 7.4vw, 36px); line-height: 1.25; word-break: keep-all; color: #f1e6cf; }

/* 기록 자세히 보기 (막대 그래프 · 능력치 · 생존 점수) */
.res-more { margin: 14px 0 4px; }
.res-more > summary { cursor: pointer; padding: 12px 4px; color: var(--muted); font-weight: 700; text-align: center; list-style: none; }
.res-more > summary::-webkit-details-marker { display: none; }
.res-more > summary::after { content: ' ▾'; }
.res-more[open] > summary::after { content: ' ▴'; }
.res-more .card-title small { margin-left: 8px; color: var(--muted); font-weight: 600; }

/* P4 선택지 앞 작은 선택: 고르기 전엔 본래 선택지를 숨김 */
.choices.pre-on .choice:not(.pre-choice) { display: none; }

/* 사망: 일지가 끊긴 뒤 검은 화면에 한 줄씩 */
.epilogue.epi-dead { min-height: 60vh; align-content: center; text-align: center; }
.epilogue.epi-dead .epi-line { color: #d9cfc4; font-size: 17px; }

/* 털린 집 · 경로별 장면: 사진을 어둡게 (photoDim) */
body.photo-dim .stage-pic { filter: brightness(0.42) saturate(0.6); }
body.photo-dim .stage-fill { opacity: 0.06; }

/* 자물쇠: 규칙과 남은 기회 (설명 카드를 봤어도 늘 보임) */
.cd-head { display: grid; gap: 4px; margin-bottom: 8px; text-align: center; }
.cd-rules { margin: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 12px; color: var(--muted); font-size: 13px; }
.cd-head .cd-left { margin: 0; color: var(--amber); font-weight: 800; }

/* ---------- 동료 (HUD 줄 · 탐색) ---------- */
.hud-party { display: flex; gap: 6px; margin-top: 6px; }
.party-ico { width: 30px; height: 30px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: rgba(0, 0, 0, 0.45); font-size: 17px; line-height: 1; cursor: pointer; }
.party-ico.st-away { opacity: 0.55; border-style: dashed; }
.party-ico.st-gone, .party-ico.st-dead { opacity: 0.3; filter: grayscale(1); }
.party-ico.st-dead { border-color: var(--red-deep); }
.party-note { margin: 8px 0 0; color: #f1e6cf; font-size: 15px; line-height: 1.55; word-break: keep-all; }
.party-note.danger { color: var(--red); font-weight: 800; }
.explore-loc .loc-name, .explore-rest .loc-name { font-weight: 800; }
.loc-meta { display: flex; gap: 10px; align-items: center; color: var(--muted); font-size: 14px; }
.loc-risk { color: var(--red); letter-spacing: 0.05em; }
.loc-loot { letter-spacing: 0.1em; }

/* 떠날 결심 · 갈림길: 목적지 네 곳 (잠긴 곳은 회색 + 힌트) */
.dest-list { list-style: none; margin: 10px 0 12px; padding: 0; display: grid; gap: 6px; }
.dest-list li { display: grid; gap: 2px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 12px; background: rgba(0, 0, 0, 0.35); font-size: 15px; }
.dest-list li.locked { opacity: 0.55; filter: grayscale(1); }
.dest-list li.locked b { font-weight: 700; }
.dest-list li span { color: var(--muted); font-size: 13px; }

/* ---------- 선택의 근거: 필요 한 줄 · 설명 · ⭐ · 물건 · 동료의 한마디 ---------- */
.hud-need { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; margin-top: 5px; color: var(--muted); font-size: 12.5px; font-weight: 700; }
.hud-need i { font-style: normal; opacity: 0.5; }
.hud-need .need-low { color: var(--amber); }
.hud-need .need-warn { color: var(--red); }
.choice-body { min-width: 0; }
.choice-why { margin-top: 3px; color: var(--muted); font-size: 12.5px; font-weight: 500; line-height: 1.35; word-break: keep-all; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; } /* 두 줄까지: 한 줄 말줄임이면 "아니면 다친다" 같은 대가가 잘림 */
/* 선택지가 4개 이상이면 한 화면에 들어가도록 예전처럼 한 줄 */
.choices:has(> .choice:nth-of-type(4)) .choice-why { -webkit-line-clamp: 1; line-clamp: 1; }
.choice-tags { display: flex; flex-wrap: wrap; gap: 4px 6px; margin-top: 4px; }
.need-tag { padding: 1px 7px; border-radius: 999px; background: rgba(255, 207, 74, 0.16); color: var(--gold); font-size: 11.5px; font-weight: 800; }
.choice-item { padding: 1px 7px; border-radius: 999px; font-size: 11.5px; font-weight: 700; }
.choice-item.has { background: rgba(94, 224, 138, 0.14); color: var(--green); }
.choice-item.miss { background: rgba(255, 255, 255, 0.05); color: var(--muted); opacity: 0.6; }
.party-say { margin: 10px 0 8px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 14px 14px 14px 4px; background: rgba(0, 0, 0, 0.45); color: #f1e6cf; font-size: 14.5px; line-height: 1.5; word-break: keep-all; }
.party-say b { margin-right: 6px; color: var(--amber); font-weight: 800; }
.party-say.animal { font-style: italic; color: var(--muted); }

.choice-why .need-tag, .choice-why .choice-item, .loc-meta .need-tag { display: inline-block; margin-right: 6px; vertical-align: 1px; }
.hud-party { gap: 5px; margin-top: 4px; }
.party-ico { width: 26px; height: 26px; font-size: 15px; }
.party-say { margin: 8px 0 6px; padding: 6px 11px; font-size: 14px; }
.loc-meta { min-width: 0; }
.loc-hint { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 12.5px; font-weight: 500; }
.loc-meta .need-tag { flex: none; }
@media (max-width: 420px) { .hud-day { font-size: 12.5px; letter-spacing: 0; } }
/* 설명 줄이 붙은 뒤에도 한 화면에: 탐색 목록은 조금 촘촘하게 · 날짜 줄은 한 줄 */
.explore-list { gap: 8px; }
.explore-list .choice { min-height: 0; padding: 10px 16px; }
.choices .choice:has(.choice-why) { padding-top: 12px; padding-bottom: 12px; }
@media (max-width: 420px) { #hudDay { font-size: 12px; white-space: nowrap; letter-spacing: -0.01em; } .hud-day { min-width: 0; overflow: hidden; text-overflow: ellipsis; } }
.hud-sub { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 4px; }
.hud-sub .hud-need { margin-top: 0; flex: 1; min-width: 0; }
.hud-sub .hud-party { margin-top: 0; flex: none; }
body .panel .explore-list { gap: 7px; }
body .panel .explore-list .choice { min-height: 0; padding-top: 8px; padding-bottom: 8px; }
.day-card .explore-q { margin: 2px 0 0; font-size: 17px; }
.daycard.explore .day-card { padding-bottom: 6px; }
.explore-loc .loc-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.explore-loc .loc-meta { flex-wrap: wrap; row-gap: 2px; overflow: hidden; } /* ⭐ 지금 필요한 것이 붙어도 판정 종류가 잘리지 않게 */
.loc-meta .loc-risk, .loc-meta .loc-loot { flex: none; white-space: nowrap; }

/* 선택지 6개 이상 (⑧ 등): 간결한 모양 · 한 화면에 */
body .panel .choices.choices-compact { gap: 7px; }
body .panel .choices.choices-compact .choice { min-height: 0; padding-top: 9px; padding-bottom: 9px; font-size: 15.5px; }
body .panel .choices.choices-compact .choice-key { width: 28px; height: 28px; font-size: 14px; }
body .panel .choices.choices-compact .choice-secret { display: none; }

.pass-reason { margin: 2px 0 0; color: var(--muted); font-size: 13.5px; }
.judge-tag.fled { background: rgba(255, 176, 32, 0.16); color: var(--amber); }

/* ---------- 탐색: 사진 카드 (좌우로 넘기기) ---------- */
.ex-screen .ex-head { padding-bottom: 4px; }
.ex-screen .explore-q { margin: 2px 0 0; }
.ex-carousel { position: relative; margin: 8px -4px 0; }
.ex-track {
  display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding: 0 7%;
  padding: 2px 7% 4px; align-items: flex-start; scrollbar-width: none; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain;
}
.ex-track::-webkit-scrollbar { display: none; }
.ex-track:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; border-radius: var(--radius); }
.ex-card {
  flex: 0 0 86%; scroll-snap-align: center; display: flex; flex-direction: column;
  background: var(--panel-strong); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  opacity: 0.55; transform: scale(0.96); transition: opacity 0.2s, transform 0.2s;
}
.ex-card.on { opacity: 1; transform: none; border-color: #6a3a40; }
.ex-photo { position: relative; height: clamp(104px, 19vh, 190px); background: var(--track); }
.ex-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ex-photo .need-tag { position: absolute; left: 8px; top: 8px; margin: 0; }
.ex-count { position: absolute; right: 8px; bottom: 6px; font: 600 12px var(--font-mono); color: #fff; background: rgba(0,0,0,0.55); padding: 2px 7px; border-radius: 99px; }
.ex-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 5px; }
.ex-name { margin: 0; font-size: 21px; font-weight: 800; line-height: 1.2; }
.ex-mood { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.4; }
.ex-tags { margin: 2px 0 0; display: flex; flex-wrap: wrap; gap: 5px; }
.ex-tags span { font-size: 13px; font-weight: 700; padding: 3px 8px; border-radius: 99px; background: rgba(255,255,255,0.06); white-space: nowrap; }
.ex-risk.low { color: var(--green); background: rgba(94, 224, 138, 0.12); }
.ex-risk.mid { color: var(--amber); background: rgba(255, 176, 32, 0.13); }
.ex-risk.high { color: #ff6b78; background: rgba(255, 51, 68, 0.15); }
.ex-loot { color: var(--text); }
.ex-stat { margin: 0; font-size: 14px; font-weight: 700; }
.ex-warn { margin: 0; font-size: 13.5px; color: var(--amber); }
.ex-go { margin-top: 4px; width: 100%; min-height: 46px; }
.ex-card:not(.on) .ex-go { pointer-events: none; }
.ex-arrow {
  display: none; position: absolute; top: 38%; z-index: 2; width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--line); background: rgba(0,0,0,0.6); color: var(--text); font-size: 24px; line-height: 1; cursor: pointer;
}
.ex-arrow.prev { left: 0; } .ex-arrow.next { right: 0; }
.ex-arrow:disabled { opacity: 0.25; cursor: default; }
@media (hover: hover) and (pointer: fine) { .ex-arrow { display: block; } }
.ex-dots { margin: 6px 0 0; display: flex; justify-content: center; gap: 7px; }
.ex-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--line); transition: background 0.2s, transform 0.2s; }
.ex-dots i.on { background: var(--amber); transform: scale(1.25); }
.ex-rest {
  margin-top: 8px; width: 100%; text-align: left; display: flex; flex-direction: column; gap: 2px; padding: 10px 14px;
  background: transparent; color: var(--text); border: 1px dashed #6a3a40; border-radius: var(--radius-btn); cursor: pointer; font: inherit;
}
.ex-rest b { font-size: 16px; } .ex-rest span { color: var(--muted); font-size: 13.5px; }
.ex-rest b .need-tag { margin-left: 6px; vertical-align: 1px; }
.ex-rest:disabled, .ex-go:disabled { opacity: 0.5; }
.ex-screen .party-say { margin-top: 8px; }
/* 탐색 결과 카드 */
.ex-res-title { outline: none; border: 0; box-shadow: none; margin: 4px 0 6px; font-size: 21px; font-weight: 800; line-height: 1.25; }
.ex-res-text { margin: 0 0 10px; line-height: 1.55; }
.ex-res-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ex-res-col { border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; min-width: 0; }
.ex-res-col > b { display: block; font-size: 13px; margin-bottom: 4px; }
.ex-res-col.gain > b { color: var(--green); } .ex-res-col.loss > b { color: #ff6b78; }
.ex-res-col ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 3px; font-size: 14px; line-height: 1.35; }
.ex-empty { margin: 0; color: var(--muted); font-size: 14px; }
@media (max-width: 330px) { .ex-res-cols { grid-template-columns: 1fr; } }
@media (max-width: 370px) { .ex-name { font-size: 19px; } .ex-res-col ul { font-size: 13.5px; } }

.party-note.danger b { color: var(--text); }

/* ---------- 본문은 항상 전부: 넘치면 화면 전체가 스크롤 (패널 안 스크롤 · ↑ 다시 보기 없앰) ---------- */
body.portrait.in-scene .wrap,
body.portrait.in-scene.has-bag .wrap { overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
body.portrait.in-scene #app { min-height: 0; }
body.portrait .panel { flex: 1 0 auto; overflow: visible; }
.q-text.reveal ~ .choices .choice { animation-delay: calc(var(--choices-delay, 0s) + var(--i-delay, 0s)); }
.q-text.reveal ~ .choices { --i-delay: 0s; }
/* 하단 가방 바가 마지막 선택지를 가리지 않게 (모든 화면) */
body.has-bag .screen:not(.scene) { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
body.portrait.in-scene.has-bag .panel { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }

.bar-num { min-width: 20px; font: 700 12px/1 var(--font-mono); color: var(--text); opacity: 0.85; text-align: left; }
.hud-bar.low .bar-num { color: #ff6b78; opacity: 1; }
.hud-bars { gap: 8px; }
.bar-track { width: 40px; }
/* 동료 아이콘: 겹치지 않게 간격 */
.hud-party { gap: 8px; }
.party-ico { display: inline-flex; align-items: center; justify-content: center; overflow: hidden; }
/* 화면을 가로지르는 붉은 빛(불안 분위기): 아주 은은하게 */
body[data-mood="unease"] .mo-beacon { opacity: 0.12; }
/* 살금살금: 사진 위 좀비는 붉은 윤곽선만, 돌아볼 때 윤곽이 밝아짐 (눈알 표시 없앰) */
/* 알림(동료 정보 등): 다른 패널과 같은 어두운 카드, 글자 잘림 없이 */
#toast {
  width: max-content; max-width: calc(100vw - 32px); box-sizing: border-box; padding: 12px 16px; border-radius: 14px;
  background: var(--panel-strong); color: var(--text); border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
  font-weight: 600; font-size: 14.5px; line-height: 1.45; text-align: left; white-space: normal; word-break: keep-all;
}
#toast { white-space: pre-line; }
body .choices .choice.locked { opacity: 0.5 !important; filter: grayscale(1) !important; }
.choice.locked .choice-note { color: var(--muted); }

/* 설명 줄은 잘리지 않게 (화면이 스크롤되므로 줄임표 대신 줄바꿈) */
.panel .choice-why, body.portrait .panel .choice-why, .choices-compact .choice-why { white-space: normal !important; overflow: visible !important; text-overflow: clip !important; display: block !important; -webkit-line-clamp: unset !important; }

/* ---------- 하루의 흐름 ---------- */
.day-line { margin: 8px 0 0; color: var(--text); font-size: 14.5px; line-height: 1.5; }
.day-journal { margin: 12px 0 0; padding: 10px 12px; border-radius: 12px; background: rgba(245, 236, 222, 0.06); border: 1px dashed var(--line); color: var(--muted); font-size: 14px; line-height: 1.55; }
.choice-result.hunger { border-color: var(--amber); }
[data-bar="supply"] .bar-num { min-width: 34px; }
