/* Visual novel: one stage, one passage, choices at the end of the scene. */
body.vn-shell .site-header, body.vn-shell .site-footer { display: none; }
body.vn-shell { background: #0b141a; }
body.vn-playing { overflow: hidden; }
body.vn-shell #main { outline: none; }
.vn-title-screen, .vn-character-screen { min-height: 100svh; position: relative; isolation: isolate; overflow: hidden; }
.vn-title-art, .vn-title-shade, .vn-character-backdrop { position: absolute; inset: 0; z-index: -1; }
.vn-title-art { background: #172831 url('assets/moon-village.svg') 68% center / cover no-repeat; }
.vn-title-shade { background: linear-gradient(90deg, #101d26f5 0%, #101d26dc 30%, #101d2630 76%), linear-gradient(0deg, #0a161b 0%, transparent 26%); }
.vn-title-copy { padding: clamp(64px, 11vh, 140px) 9vw 90px; max-width: 740px; }
.vn-kicker { color: #c5a57c; font-size: 11px; letter-spacing: .32em; }
.vn-title-copy h1 { font-size: clamp(48px, 6.4vw, 92px); letter-spacing: .13em; line-height: 1.55; margin: 16px 0 6px; text-shadow: 0 3px 25px #060e1690; }
.vn-title-chapter { color: #e2c398; font: 17px/2 var(--serif); letter-spacing: .24em; }
.vn-title-rule { width: 72px; height: 1px; background: #b68a60; margin: 24px 0; }
.vn-title-intro { font: 15px/2.1 var(--serif); color: #a9b9b9; letter-spacing: .08em; }
.vn-title-menu { display: grid; gap: 3px; width: min(310px,100%); margin-top: 30px; }
.vn-title-menu button { font: 17px/1.6 var(--serif); padding: 13px 4px; text-align: left; border-bottom: 1px solid #c7ac7f26; letter-spacing: .18em; color: #c6cfca; display: flex; justify-content: space-between; align-items: center; }
.vn-title-menu button span { color: #bd946b; font: 17px system-ui; }
.vn-title-menu button:hover { padding-left: 12px; color: #f4e2c0; background: #b8935a0a; }
.vn-title-menu .vn-menu-primary { color: #e5bf88; }
.vn-local-note { font-size: 10px; color: #7e9397; margin-top: 20px; letter-spacing: 1px; }
.vn-legacy { color: #b8a991; font-size: 11px; padding: 10px 0; }
.vn-title-footer { position: absolute; bottom: 24px; left: 9vw; right: 5vw; display: flex; gap: 24px; align-items: center; font-size: 11px; color: #8da2a5; }
.vn-title-footer button { padding: 6px 0; border-bottom: 1px solid #71828640; }
.vn-title-footer > span { margin-left: auto; font-size: 10px; letter-spacing: 2px; }
.vn-screen-back { position: absolute; top: 26px; left: 4vw; z-index: 3; color: #bec9c5; font-size: 12px; padding: 10px; }
.vn-character-backdrop { background: radial-gradient(ellipse at 28% 40%, #34515a 0, transparent 58%), linear-gradient(115deg, #152b35, #0b171f 80%); }
.vn-character-backdrop::after { content: ''; position: absolute; inset: 8%; border: 1px solid #c6a8791c; }
.vn-character-layout { min-height: 100svh; display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); align-items: center; max-width: 1280px; margin: auto; padding: 80px 7vw 50px; gap: 5vw; }
.vn-character-portrait { height: min(76vh, 720px); align-self: end; min-height: 350px; display: grid; place-items: end center; }
.vn-character-portrait svg { width: 100%; height: 100%; max-height: 740px; filter: drop-shadow(0 20px 50px #0004); }
.vn-character-info { position: relative; z-index: 1; padding: 10px 0 30px; }
.vn-character-info h1 { font-size: clamp(36px, 4.6vw, 64px); letter-spacing: .18em; margin: 18px 0 8px; }
.vn-character-alias { font-size: 12px; color: #b89c77; letter-spacing: 2px; }
.vn-character-description { font: 16px/2.1 var(--serif); color: #bdc8c5; margin: 24px 0; max-width: 470px; }
.vn-character-tabs { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 8px; margin: 28px 0; }
.vn-character-tabs button { padding: 12px 4px; border: 1px solid #6e7e7d5c; color: #9baead; background: #0a171a38; }
.vn-character-tabs span, .vn-character-tabs small { display: block; }
.vn-character-tabs span { font: 15px/1.8 var(--serif); }
.vn-character-tabs small { font-size: 9px; color: #91a2a1; margin-top: 3px; }
.vn-character-tabs button[aria-pressed='true'] { border-color: #d5b07a; background: #b8955a15; color: #f1d5ab; }
.vn-enter { display: flex; width: 100%; align-items: center; justify-content: space-between; padding: 18px 21px; color: #f1d7b1; border: 1px solid #b58e62; background: #77604430; font: 15px/1.5 var(--serif); letter-spacing: 1px; gap: 15px; }
.vn-enter:hover { background: #84664160; }
.vn-enter span { font: 12px system-ui; white-space: nowrap; }
.vn-unavailable { color: #9aa9a8; padding: 18px 0; font-size: 12px; }

.vn-game { height: 100vh; height: 100dvh; width: 100%; display: grid; grid-template-columns: minmax(0,1fr) 68px; background: #0b151b; }
.vn-stage { position: relative; min-width: 0; height: 100%; overflow: hidden; isolation: isolate; }
.vn-backdrop, .vn-vignette { position: absolute; inset: 0; pointer-events: none; }
.vn-backdrop { background: #182e37; z-index: -3; }
.vn-backdrop svg { width: 100%; height: 100%; display: block; }
.vn-vignette { z-index: -2; background: linear-gradient(180deg,#08151a65,transparent 23%,transparent 58%,#08151aba),linear-gradient(90deg,#08151a30,transparent 35%); }
.vn-location { position: absolute; top: max(22px,env(safe-area-inset-top)); left: 4%; color: #e4dcc5; background: #101e25b8; border-left: 2px solid #c09869; padding: 9px 16px; max-width: 85%; font: 11px/1.8 system-ui; letter-spacing: .12em; pointer-events: none; }
.vn-portrait { position: absolute; bottom: 0; right: 9%; width: min(48%,600px); height: 89%; pointer-events: none; animation: portrait-in .32s ease-out; }
.vn-portrait svg { height: 100%; width: 100%; filter: drop-shadow(0 12px 18px #0712186b); }
@keyframes portrait-in { from { opacity:0; transform:translateX(8px); } to { opacity:1; transform:none; } }
.vn-dialogue { position: absolute; left: 6%; right: 6%; bottom: max(4.5%,env(safe-area-inset-bottom)); border: 1px solid #c8ad80; background: linear-gradient(125deg,#f0e8d9f7,#e4d8c4f2); color: #25343c; box-shadow: 0 12px 45px #0005, inset 0 0 0 5px #f6f0e357, inset 0 0 0 6px #bfa78266; padding: 26px 30px 12px; }
.vn-speaker { position: absolute; top: -19px; left: 28px; padding: 5px 25px; min-width: 100px; text-align: center; font: 16px/1.6 var(--serif); color: #f1dfbf; background: #6e4833; border: 1px solid #bc9364; box-shadow: 0 2px 12px #0002; letter-spacing: 2px; }
.vn-text-hit { display: block; width: 100%; text-align: left; padding: 0 4px; color: inherit; min-height: 100px; max-height: min(34vh,280px); overflow-y: auto; cursor: pointer; scrollbar-width: thin; scrollbar-color: #ab9373 transparent; }
.vn-text { display: block; font-family: var(--serif); font-size: calc(var(--reading) + 2px); line-height: 1.95; letter-spacing: .035em; overflow-wrap: anywhere; }
.vn-reflection { color: #755f49; }
.vn-dialogue-controls { display: flex; align-items: center; justify-content: space-between; gap: 16px; border-top: 1px solid #bca88b45; margin-top: 15px; padding-top: 8px; }
.vn-dialogue-controls button { font-size: 11px; color: #81705b; padding: 5px 0; min-height: 32px; }
.vn-dialogue-controls button:disabled { opacity: .32; }
.vn-beat-position { font: 10px system-ui; letter-spacing: 2px; color: #a18e74; }
.vn-dialogue-controls .vn-advance { color: #825132; letter-spacing: 2px; min-width: 88px; text-align: right; }
.vn-advance span { margin-left: 12px; }
.vn-resource-change { position: absolute; right: 7%; top: 24px; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; max-width: 43%; }
.vn-resource-change span { padding: 6px 10px; border: 1px solid #bba16f70; background: #14272dd9; color: #ebd3a5; font-size: 11px; }
.vn-rail { display: flex; flex-direction: column; align-items: stretch; justify-content: center; gap: clamp(5px,2vh,18px); background: #0a141be8; border-left: 1px solid #c9b28b20; padding: max(12px,env(safe-area-inset-top)) 6px max(12px,env(safe-area-inset-bottom)); z-index: 5; }
.vn-rail button { display: grid; justify-items: center; gap: 2px; padding: 6px 0; color: #9eaca9; min-height: 48px; }
.vn-rail button:hover { color: #efd4a8; background: #d7c1900c; }
.vn-rail b { font: 23px/1.1 var(--serif); }
.vn-rail span { font-size: 10px; letter-spacing: 1px; }
.vn-choices-panel { position: absolute; left: 50%; top: 52%; transform: translate(-50%,-50%); width: min(760px,84%); max-height: calc(100% - 100px); overflow-y: auto; padding: 8px 4px; scrollbar-width: thin; scrollbar-color: #947956 #152932; }
.vn-choice-prompt { color: #ecd8b5; font: 18px/1.7 var(--serif); letter-spacing: 3px; text-align: center; margin-bottom: 18px; text-shadow: 0 2px 10px #000; }
.vn-choices { display: grid; gap: 12px; }
.vn-choice { position: relative; display: grid; grid-template-columns: 26px minmax(0,1fr) 20px; align-items: center; gap: 16px; text-align: left; width: 100%; padding: 16px 23px; color: #24353b; border: 1px solid #bfa37c; background: linear-gradient(115deg,#f2e9d9f5,#d9c8acf5); box-shadow: 0 8px 30px #0711163b,inset 0 0 0 4px #f8f0e333; }
.vn-choice:hover:not(:disabled) { background: #fff1d8; border-color: #ebc17d; transform: translateY(-1px); }
.vn-choice:disabled { opacity: .82; background: #c0b9a8f2; color: #4d5758; }
.vn-choice-number { font: 19px var(--serif); color: #926846; }
.vn-choice-copy { min-width: 0; }
.vn-choice-copy strong { display: block; font: 500 17px/1.6 var(--serif); }
.vn-choice-desc { display: block; font-size: 11px; color: #67706b; margin-top: 4px; }
.vn-choice-copy small { display: block; font: 11px/1.7 system-ui; color: #855b3b; margin-top: 5px; }
.vn-choice-arrow { color: #906344; }
.vn-lock-reason { display: block; font: 11px/1.6 system-ui; color: #79503d; border-top: 1px solid #8d765a40; padding-top: 5px; margin-top: 6px; }
.vn-reread { display: block; margin: 14px auto 0; color: #d1c4ac; font-size: 11px; padding: 8px 12px; }
.vn-show-ui { display: none; position: absolute; bottom: max(24px,env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); background: #15272bda; border: 1px solid #baa17b90; color: #e8d3ae; padding: 10px 22px; font-size: 12px; }
.ui-hidden .vn-dialogue,.ui-hidden .vn-choices-panel,.ui-hidden .vn-location,.ui-hidden .vn-resource-change,.ui-hidden .vn-terminal { visibility: hidden; }
.ui-hidden .vn-show-ui { display: block; }
.vn-terminal { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); width: min(720px,86%); max-height: calc(100% - 84px); overflow-y: auto; background: #13252df2; border: 1px solid #9c825a; box-shadow: 0 20px 60px #0005; padding: 32px 38px; scrollbar-width: thin; scrollbar-color: #927a57 transparent; }
.vn-terminal h1 { font-size: clamp(24px,3vw,37px); line-height: 1.5; letter-spacing: 2px; color: #e9d4ac; margin: 15px 0; }
.vn-ending-subtitle { font: 13px/1.9 var(--serif); color: #aebfb8; }
.vn-terminal-body { margin: 25px 0; border-top: 1px solid #b49b7338; }
.vn-terminal-body h2 { font: 11px/1.6 system-ui; color: #c9a778; letter-spacing: 2px; margin: 18px 0 8px; }
.vn-terminal-body p { font: 14px/2 var(--serif); color: #b8c6c0; }
.vn-ending-time { font-size: 10px; color: #879d9c; margin: 18px 0; }
.vn-terminal-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 20px; }
.vn-terminal .vn-reread { margin-left: 0; padding-left: 0; color: #9eb0ac; }
.vn-pause-menu { display: grid; gap: 8px; }
.vn-pause-menu button { text-align: left; border-bottom: 1px solid #bca27430; color: #d8c4a2; padding: 13px 0; display: flex; justify-content: space-between; font: 16px var(--serif); }
.vn-pause-menu button span { color: #8ca09f; }
.vn-status-modal .game-aside { position: static; display: block; width: 100%; }
.vn-status-modal .profile-summary { display: flex; }
.vn-status-modal .aside-label,.vn-status-modal .save-status { display: none; }
.vn-status-modal .resources { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 20px; margin: 25px 0; }
.vn-status-modal .resource { margin: 0; }
.vn-status-modal .resource-desc { display: block; }
.vn-status-modal .journey-note,.vn-status-modal .clue-list { display: flex; flex-wrap: wrap; }
.vn-status-modal .journey-note { display: block; }
.vn-status-modal .journey-note:empty { display: none; }
.vn-save-slots { display: grid; gap: 12px; margin: 20px 0; }
.vn-save-slot { border: 1px solid #65757570; padding: 16px; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.vn-save-slot small { font-size: 10px; letter-spacing: 2px; color: #b09b78; }
.vn-save-slot h3 { font-size: 17px; margin: 5px 0; color: #dac6a2; }
.vn-save-slot p { font-size: 10px; color: #8b9d9d; }
.vn-save-slot > div:last-child { display: flex; flex-direction: column; gap: 8px; }
.vn-save-slot button { border: 1px solid #7d806e; padding: 6px 10px; white-space: nowrap; font-size: 11px; color: #d1bd98; }
.vn-save-slot button:disabled { opacity: .35; }

@media (max-width: 740px) and (orientation: portrait) {
  .vn-title-art { background-position: 62% center; }
  .vn-title-shade { background: linear-gradient(90deg,#101d26ed,#101d2680 80%),linear-gradient(0deg,#0a161bd9,transparent); }
  .vn-title-copy { padding: 12svh 9vw 110px; }
  .vn-title-copy h1 { font-size: 52px; }
  .vn-title-chapter { font-size: 14px; }
  .vn-title-menu { width: 250px; margin-top: 25px; }
  .vn-title-intro { font-size: 13px; }
  .vn-title-footer { gap: 20px; bottom: max(20px,env(safe-area-inset-bottom)); }
  .vn-title-footer > span { display: none; }
  .vn-character-layout { display: flex; flex-direction: column; gap: 0; padding: 70px 7vw 30px; align-items: stretch; }
  .vn-character-portrait { height: 40svh; min-height: 240px; width: 100%; align-self: center; margin-bottom: -40px; }
  .vn-character-info { padding-top: 0; }
  .vn-character-info h1 { font-size: 35px; margin-top: 10px; }
  .vn-character-description { margin: 14px 0; font-size: 14px; }
  .vn-character-tabs { margin: 20px 0; }
  .vn-character-tabs button { padding: 10px 2px; }
  .vn-game { grid-template-columns: minmax(0,1fr); grid-template-rows: minmax(0,1fr) auto; }
  .vn-stage { grid-row: 1; }
  .vn-rail { grid-row: 2; flex-direction: row; padding: 4px 5px max(4px,env(safe-area-inset-bottom)); gap: 0; border-left: 0; border-top: 1px solid #c9b28b20; }
  .vn-rail button { flex: 1; min-height: 50px; padding: 5px 0; gap: 1px; }
  .vn-rail b { font-size: 20px; }
  .vn-rail span { font-size: 9px; }
  .vn-location { top: max(16px,env(safe-area-inset-top)); left: 16px; max-width: calc(100% - 32px); font-size: 10px; padding: 7px 12px; }
  .vn-portrait { width: 89%; height: 73%; right: -9%; bottom: 15%; }
  .vn-dialogue { left: 13px; right: 13px; bottom: 16px; padding: 26px 18px 9px; }
  .vn-speaker { left: 18px; font-size: 15px; padding: 4px 19px; top: -17px; }
  .vn-text { font-size: var(--reading); line-height: 1.85; letter-spacing: .01em; }
  .vn-text-hit { min-height: 132px; max-height: 36svh; }
  .vn-dialogue-controls { margin-top: 11px; padding-top: 4px; }
  .vn-dialogue-controls button { min-height: 36px; }
  .vn-choices-panel { width: calc(100% - 30px); top: 52%; max-height: calc(100% - 84px); }
  .vn-choice-prompt { font-size: 16px; margin-bottom: 14px; }
  .vn-choice { padding: 14px; grid-template-columns: 19px minmax(0,1fr) 12px; gap: 9px; }
  .vn-choice-copy strong { font-size: 16px; }
  .vn-choice-copy small { font-size: 11px; }
  .vn-choice-desc { font-size: 11px; }
  .vn-resource-change { top: 66px; right: 17px; max-width: calc(100% - 34px); }
  .vn-resource-change span { font-size: 10px; padding: 4px 7px; }
  .vn-terminal { width: calc(100% - 30px); padding: 24px 22px; }
  .vn-terminal h1 { font-size: 25px; }
  .vn-terminal-actions { gap: 15px; }
}
@media (max-height: 540px) and (orientation: landscape) {
  .vn-game { grid-template-columns: minmax(0,1fr) 55px; }
  .vn-rail { gap: 0; padding-block: 3px; }
  .vn-rail button { min-height: 40px; padding: 3px 0; }
  .vn-rail b { font-size: 18px; }
  .vn-rail span { font-size: 9px; }
  .vn-location { top: 12px; padding: 5px 12px; font-size: 9px; }
  .vn-dialogue { bottom: 4%; left: 5%; right: 5%; padding: 19px 24px 5px; }
  .vn-speaker { top: -16px; font-size: 13px; padding: 4px 20px; }
  .vn-text { font-size: calc(var(--reading) - 2px); line-height: 1.7; }
  .vn-text-hit { min-height: 55px; max-height: 28vh; }
  .vn-dialogue-controls { margin-top: 7px; padding-top: 2px; }
  .vn-dialogue-controls button { min-height: 26px; padding-block: 2px; font-size: 10px; }
  .vn-portrait { height: 96%; right: 12%; width: 45%; }
  .vn-choices-panel { max-height: calc(100% - 58px); top: 53%; }
  .vn-choice-prompt { margin-bottom: 9px; font-size: 15px; }
  .vn-choices { gap: 8px; }
  .vn-choice { padding: 10px 18px; }
  .vn-choice-copy strong { font-size: 15px; }
  .vn-choice-copy small,.vn-choice-desc { font-size: 10px; margin-top: 2px; }
  .vn-reread { margin-top: 6px; padding-block: 3px; }
  .vn-terminal { max-height: calc(100% - 42px); padding: 22px 30px; }
  .vn-title-copy { padding-top: 30px; padding-bottom: 70px; }
  .vn-title-copy h1 { font-size: 48px; margin-block: 6px; }
  .vn-title-rule { margin-block: 12px; }
  .vn-title-intro { display: none; }
  .vn-title-menu { margin-top: 10px; gap: 0; }
  .vn-title-menu button { padding-block: 7px; font-size: 14px; }
  .vn-local-note { margin-top: 10px; }
  .vn-character-layout { padding-top: 55px; padding-bottom: 20px; }
  .vn-character-portrait { min-height: 270px; height: 83vh; }
  .vn-character-info h1 { margin: 8px 0; font-size: 32px; }
  .vn-character-description { margin: 10px 0; font-size: 12px; }
  .vn-character-tabs { margin: 13px 0; }
  .vn-character-tabs button { padding: 6px 2px; }
  .vn-enter { padding: 11px 14px; font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) { .vn-portrait { animation: none; } }
@media (max-height: 340px) and (orientation: landscape) {
  .vn-rail { justify-content: flex-start; overflow-y: auto; }
}

.vn-game:is([data-phase="narration"], [data-phase="result"], [data-phase="ending"], [data-phase="failure"]) .vn-stage { cursor: pointer; }
