@font-face { font-family: Kalam; src: url('../../assets/fonts/kalam/Kalam-Regular.ttf') format('truetype'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: Kalam; src: url('../../assets/fonts/kalam/Kalam-Bold.ttf') format('truetype'); font-weight: 700; font-style: normal; font-display: swap; }
:root { color-scheme: dark; --background: #0b0c0c; --foreground: #f1e3c8; --muted: #cabb9f; --accent: #c5a375; --scrim: #0b0c0cef; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; background: var(--background); }
body, button { color: var(--foreground); font-family: Kalam, cursive; font-weight: 400; }
button { font-size: inherit; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; opacity: .45; }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
#viewer, #loading { position: fixed; inset: 0; display: grid; place-items: center; }
.panel { position: relative; display: block; width: min(100vw, calc(100vh * 16 / 9)); width: min(100vw, calc(100dvh * 16 / 9)); aspect-ratio: 16 / 9; margin: 0; padding: 0; border: 0; background: var(--background); container-type: inline-size; }
.panel img { display: block; width: 100%; height: 100%; aspect-ratio: 16 / 9; object-fit: contain; pointer-events: none; -webkit-user-drag: none; }
.scene-button { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; border: 0; background: transparent; }
#advance:disabled { opacity: 1; cursor: wait; }
#advance:focus-visible { outline-offset: -4px; }
#viewer, .panel img { user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none; }
.menu-toggle { position: absolute; top: max(.65rem, env(safe-area-inset-top)); right: max(.65rem, env(safe-area-inset-right)); min-height: 44px; padding: .35rem 1rem; border: 1px solid #ccb58b70; border-radius: 2px; background: #0b0c0cd9; font-size: 1rem; }
#loading { z-index: 10; background: var(--background); }
.loading-copy { position: absolute; inset: auto 0 0; padding: clamp(1rem, 5vw, 3rem); background: linear-gradient(transparent, var(--scrim)); text-align: center; font-size: clamp(1rem, 2cqw, 1.5rem); }
#loading-status { margin: .6rem 0; color: var(--foreground); }
.loading-indicator { display: block; width: 3rem; height: 2px; margin: 1rem auto 0; background: var(--accent); animation: breathe 1.3s ease-in-out infinite alternate; }
[data-state="error"] .loading-indicator { display: none; }
#retry, #load-back, #save-retry { padding: .5rem 1rem; border: 1px solid var(--accent); background: var(--background); color: var(--foreground); border-radius: 2px; }
.menu-surface { position: absolute; right: 4%; bottom: 9%; width: 29%; max-height: 79%; --menu-padding: clamp(.8rem, 2cqw, 1.8rem); padding: var(--menu-padding); overflow-y: auto; background: linear-gradient(110deg, #0b0c0cb5, #10120feb 45%, #0b0c0ced); border-left: 1px solid #c5a37570; box-shadow: 0 12px 50px #0003; scrollbar-color: #8b7757 #171814; font-size: clamp(1rem, 1.65cqw, 1.4rem); }
.menu-surface h1 { margin: 0 0 .45em; font-size: 1.3em; font-weight: 400; line-height: 1.25; color: var(--muted); }
.menu-surface h1:focus { outline: none; }
.menu-surface p { line-height: 1.35; }
.main-actions { display: grid; }
.main-actions button, .back-button { min-height: 44px; padding: .18em 0; border: 0; border-bottom: 1px solid #b697633b; background: transparent; text-align: left; }
.main-actions button { font-size: 1.24em; line-height: 1.3; }
.main-actions button:not(:disabled):hover, .back-button:hover { color: #fff4de; background: #d4b8890d; }
/* Keep the explicit launcher exit reachable while a short menu surface scrolls. */
.main-actions [data-action="oryx"] { position: sticky; bottom: calc(-1 * var(--menu-padding)); background: #10120f; }
.main-actions [data-action="oryx"]:hover { background: #1a1a15; }
.menu-note { margin: .55em 0; font-size: .83em; color: var(--muted); }
.menu-footer { margin: 1em 0 0; font-size: .72em; color: var(--muted); }
.back-button { margin-top: .6em; color: var(--muted); font-size: .9em; }
/* Only visible controls navigate, so Back stays in view while a long menu view scrolls, flush with the
   surface's lower edge (its padding would let text show beneath). The gallery pins its own. */
.menu-surface:not([data-view="gallery"]) > .back-button { position: sticky; bottom: calc(-1 * var(--menu-padding)); width: 100%; background: #10120f; }
.menu-surface:not([data-view="gallery"]) > .back-button:hover { background: #1a1a15; }
.save-slots { display: grid; gap: .4rem; }
.slot-button { display: grid; width: 100%; min-height: 54px; padding: .45em .6em; border: 1px solid #b6976350; background: #d4b88909; text-align: left; line-height: 1.25; }
.slot-button strong { font-weight: 400; }
.slot-button span { font-size: .8em; color: var(--muted); }
.slot-button small { margin-top: .22em; font-size: .64em; color: var(--muted); }
.slot-button:not(:disabled):hover { border-color: var(--accent); }
.language-options { display: flex; gap: .5rem; }
.language-options button { flex: 1; min-height: 64px; padding: .5em; border: 1px solid #b6976350; background: transparent; }
.language-options small { display: block; font-size: .7em; }
.language-options [aria-pressed="true"] { border-color: var(--foreground); background: #d4b88920; font-weight: 700; }
.confirm-actions { display: grid; gap: .55rem; }
.confirm-actions button { min-height: 44px; padding: .35em .5em; border: 1px solid var(--accent); background: transparent; }
.confirm-actions [data-action="overwrite"], .confirm-actions [data-action="confirm-delete"] { background: #c5a37520; }
.slot-row { display: grid; grid-template-columns: 1fr auto; gap: .4rem; }
.slot-delete { min-width: 44px; padding: .35em .7em; border: 1px solid #b6976350; background: transparent; color: var(--muted); font-size: .8em; }
.slot-delete:hover, .slot-delete:focus-visible { border-color: var(--accent); color: inherit; }
.history-trimmed { margin: 0 0 .6rem; font-size: .8em; color: var(--muted); }
.credits section { padding: .5em 0 .65em; border-bottom: 1px solid #b697633b; }
.credits section:last-child { border-bottom: 0; }
.credits h2 { margin: 0 0 .2em; color: var(--accent); font-size: .78em; font-weight: 400; letter-spacing: .08em; }
.credits p { margin: .3em 0; font-size: .9em; }
.credits .credits-name { font-size: 1.24em; line-height: 1.3; }
.credits ul { margin: .4em 0 .55em; padding: 0; list-style: none; font-size: .86em; line-height: 1.35; }
.credits li { position: relative; padding-left: .95em; }
.credits li::before { content: ''; position: absolute; left: .1em; top: .7em; width: .45em; height: 1px; background: var(--accent); }
.menu-surface[data-view="credits"] > .menu-footer { display: none; }
.dialogue-definitions { position: absolute; pointer-events: none; }
.dialogue { position: absolute; inset: 0; pointer-events: none; text-align: left; }
.thought, .speech, .narration { position: absolute; animation: ink-appear .22s ease-out; }
.thought { left: 43%; top: 12%; width: 16%; color: #f5e5c6; font-size: clamp(1rem, 1.85cqw, 1.9rem); line-height: 1.15; text-align: center; text-shadow: 0 2px 5px #000; }
.thought > span { white-space: pre-line; }
.thought-dots { position: absolute; top: 75%; left: -12%; width: 35%; height: auto; fill: #eedcbb; filter: drop-shadow(0 1px 2px #0008); }
.speech { left: 58%; top: 19%; width: 26%; aspect-ratio: 20 / 11; color: #171713; font-size: clamp(1rem, 2.1cqw, 2rem); line-height: 1.2; text-align: center; }
.speech-shape { position: absolute; inset: 0; width: 100%; height: 100%; filter: drop-shadow(0 2px 3px #0006); }
.speech > span { position: absolute; inset: 18% 15% 32%; display: grid; place-items: center; text-wrap: balance; }
.narration { left: 4%; bottom: 5.5%; width: 65%; padding: 1.1em 1.25em .85em; color: #f3e6d0; background: linear-gradient(100deg, #0b0c0cf0, #0b0c0cd9 80%, #0b0c0c00); font-size: clamp(1rem, 1.5cqw, 1.55rem); line-height: 1.4; text-shadow: 0 1px 3px #000; }
.narration::before { content: ''; position: absolute; left: 1.25em; top: .2em; width: 25%; height: 2px; background: linear-gradient(90deg, #dec99d, #dec99d20); transform: rotate(-.5deg); }
.dialogue-next { position: absolute; right: 4%; bottom: 7%; display: flex; align-items: center; gap: .65em; min-height: 44px; padding: .45em .75em; color: #ead9b7; border: 1px solid #d7bd8555; border-radius: 2px; background: #0b0c0ce3; font-size: clamp(.9rem, 1.3cqw, 1.25rem); }
.dialogue-next:hover { background: #28251deb; border-color: var(--accent); }
.dialogue-next small { font-family: system-ui, sans-serif; font-size: .65em; color: var(--muted); }
.dialogue-next > span:last-child { font-size: 1.45em; line-height: 1; }
.artwork-id { position: absolute; right: max(1.5%, env(safe-area-inset-right)); bottom: max(1.5%, env(safe-area-inset-bottom)); z-index: 2; padding: .25em .5em; background: #0b0c0c99; border-radius: 2px; color: #eadcc3a6; font: 10px/1.3 ui-monospace, monospace; letter-spacing: .08em; pointer-events: none; user-select: none; }
.notice { position: fixed; z-index: 15; inset: auto 0 0; margin: 0; padding: .7rem 1rem; background: var(--scrim); color: var(--foreground); text-align: center; font-size: 1rem; }
#panel-error { pointer-events: none; }
.save-notice button { margin-left: .7rem; }
.noscript { position: fixed; z-index: 20; inset: 0 0 auto; margin: 0; padding: 1rem; background: var(--background); text-align: center; }
.noscript a { color: var(--accent); }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
@keyframes breathe { to { opacity: .25; transform: scaleX(.55); } }
@keyframes ink-appear { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 600px) and (orientation: portrait) {
  .loading-panel { align-self: start; margin-top: max(env(safe-area-inset-top), 10dvh); }
  .game-panel { align-self: start; margin-top: max(env(safe-area-inset-top), 18dvh); }
  .menu-surface { position: fixed; left: 1.25rem; right: 1.25rem; bottom: max(1.25rem, env(safe-area-inset-bottom)); width: auto; max-height: 53dvh; --menu-padding: 1rem; padding: var(--menu-padding) 1.25rem; font-size: 1.1rem; }
  .menu-footer { margin-top: .6rem; }
  .main-actions button { min-height: 45px; }
  .loading-copy { position: fixed; inset: auto 0 8dvh; }
  .thought { left: 41%; top: 8%; width: 20%; font-size: .85rem; }
  .speech { left: 60%; top: 23%; width: 33%; font-size: .9rem; }
  .narration { top: calc(100% + 1.5rem); bottom: auto; left: 4%; width: 92%; padding: 1.25rem 1rem; font-size: 1.1rem; background: transparent; }
  .dialogue-next { top: calc(100% + 10.5rem); bottom: auto; right: 5%; font-size: 1rem; }
  .menu-toggle { top: -3.25rem; }
}
@media (max-height: 500px) and (orientation: landscape) {
  .menu-surface { right: 3%; bottom: 8%; width: 34%; max-height: 88%; --menu-padding: .55rem; padding: var(--menu-padding) .85rem; font-size: .95rem; }
  .menu-surface h1 { font-size: 1.12em; margin-bottom: .2rem; }
  .main-actions button { min-height: 44px; font-size: 1.12em; }
  .menu-footer { margin-top: .4rem; font-size: .66em; }
  .narration { width: 64%; bottom: 4%; padding: .7em .8em .6em; font-size: .95rem; line-height: 1.2; }
  .narration::before { left: .8em; }
  .dialogue-next { right: 3%; bottom: 8%; gap: .4em; padding: .35em .55em; font-size: .9rem; }
}
@media (prefers-reduced-motion: reduce) { .loading-indicator, .thought, .speech, .narration { animation: none; } }
