/* Nachtdienst: one painted canvas, letterboxed in the night. */
@font-face { font-family: "Special Elite L"; src: url(../fonts/special-elite.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC; font-display: block; }
@font-face { font-family: "Special Elite L"; src: url(../fonts/special-elite-ext.woff2) format("woff2"); unicode-range: U+0100-02BA, U+1E00-1EFF; font-display: block; }
@font-face { font-family: "Caveat L"; src: url(../fonts/caveat-latin.woff2) format("woff2"); font-weight: 400 700; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC; font-display: block; }
@font-face { font-family: "Caveat L"; src: url(../fonts/caveat-latin-ext.woff2) format("woff2"); font-weight: 400 700; unicode-range: U+0100-02BA, U+1E00-1EFF; font-display: block; }
@font-face { font-family: "Homemade Apple L"; src: url(../fonts/homemade-apple.woff2) format("woff2"); font-display: block; }
@font-face { font-family: "IM Fell English L"; src: url(../fonts/im-fell.woff2) format("woff2"); font-display: block; }
@font-face { font-family: "IM Fell English L"; src: url(../fonts/im-fell-italic.woff2) format("woff2"); font-style: italic; font-display: block; }
@font-face { font-family: "IM Fell English SC L"; src: url(../fonts/im-fell-sc.woff2) format("woff2"); font-display: block; }

:root { --night: #14111a; --ink: #2b2233; --paper: #f3ebdc; color-scheme: dark; }
html, body { height: 100%; margin: 0; background: var(--night); overflow: hidden; }
/* a phone: no bounce, no pull-to-refresh, no callouts or selection on a long press */
html, body { overscroll-behavior: none; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; -webkit-text-size-adjust: 100%; }
html:fullscreen, html:-webkit-full-screen { background: var(--night); }
body { display: grid; place-items: center; -webkit-tap-highlight-color: transparent; }
#stage { position: relative; width: min(100vw, calc(100vh * 16 / 9)); aspect-ratio: 16 / 9; max-width: 100%; }
@supports (height: 100dvh) { #stage { width: min(100vw, calc(100dvh * 16 / 9)); } }
#screen { display: block; width: 100%; height: 100%; touch-action: none; user-select: none; -webkit-user-select: none; outline: none; }
#keys { position: absolute; left: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; border: 0; padding: 0; pointer-events: none; font-size: 16px; }
#loading { position: absolute; inset: 0; display: grid; place-items: center; background: var(--night); color: var(--paper); font: 28px "Caveat", "Caveat L", cursive; letter-spacing: .02em; transition: opacity .8s; }
#loading.gone { opacity: 0; pointer-events: none; }
@media (prefers-reduced-motion: reduce) { #loading { transition: none; } }
#storylink { position: absolute; display: block; cursor: pointer; border-radius: 12px; }
#storylink:focus-visible { outline: 3px solid #e8aa38; }
#saveview { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(14, 10, 20, .82); }
#saveview figure { margin: 0; max-width: 86%; display: grid; gap: 14px; justify-items: center; }
#saveview img { max-width: 100%; max-height: 70vh; box-shadow: 0 10px 40px rgba(0,0,0,.5); }
#saveview figcaption { color: var(--paper); font: 22px "Caveat", "Caveat L", cursive; text-align: center; }
#saveview a, #saveview button { color: #f2c66b; font: inherit; background: none; border: 0; cursor: pointer; text-decoration: underline; padding: 0 4px; }
[hidden] { display: none !important; }
#turn { display: none; }
@media (orientation: portrait) and (max-width: 820px) {
  #turn { display: grid; position: fixed; inset: auto 0 0 0; padding: 18px max(16px, env(safe-area-inset-left, 0px)) calc(18px + env(safe-area-inset-bottom, 0px)); place-items: center; color: var(--paper); font: 24px "Caveat", "Caveat L", cursive; text-align: center; }
  body { place-items: start center; padding-top: 30vh; }
}
/* a phone upright with its rotation locked: the stage turned a quarter, filling the glass (see touch.js) */
html.sideways body { display: block; padding: 0; }
html.sideways #stage { position: fixed; left: 50%; top: 50%; width: min(100vh, calc(100vw * 16 / 9)); max-width: none; aspect-ratio: 16 / 9; transform: translate(-50%, -50%) rotate(90deg); }
@supports (height: 100dvh) { html.sideways #stage { width: min(100dvh, calc(100vw * 16 / 9)); } }
html.sideways #turn { display: none; }
html, body { touch-action: none; }

/* the admin panel (js/admin.js, ?admin): plain, out of the way, scrollable by touch */
#adminbtn { position: fixed; left: max(4px, env(safe-area-inset-left, 0px)); top: max(4px, env(safe-area-inset-top, 0px)); z-index: 20; width: 34px; height: 34px; border: 0; border-radius: 8px; background: rgba(243, 235, 220, .14); color: var(--paper); font: 20px/34px system-ui, sans-serif; cursor: pointer; padding: 0; }
#admin { position: fixed; top: 0; right: 0; bottom: 0; z-index: 21; width: min(440px, 94vw); overflow-y: auto; -webkit-overflow-scrolling: touch; touch-action: pan-y; overscroll-behavior: contain;
  background: rgba(24, 20, 30, .96); color: var(--paper); font: 15px/1.35 system-ui, sans-serif; padding: 0 14px 40px; box-sizing: border-box; box-shadow: -6px 0 24px rgba(0, 0, 0, .5); -webkit-user-select: none; user-select: none; }
#admin header { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 6px; padding: 12px 0 10px; background: #18141e; border-bottom: 1px solid rgba(243, 235, 220, .15); }
#admin header span { flex: 1; opacity: .75; font-size: 13px; }
#admin h3 { margin: 16px 0 6px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; opacity: .6; }
#admin .row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 4px 0; }
#admin button, #admin select { font: inherit; font-size: 14px; color: var(--paper); background: #3a3248; border: 1px solid rgba(243, 235, 220, .2); border-radius: 6px; padding: 6px 10px; cursor: pointer; }
#admin button:active { background: #54486a; }
#admin header button { padding: 2px 12px; font-size: 20px; }
#admin .cab { margin: 14px 0 4px; display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }
#admin .drawer { margin: 6px 0 6px 10px; padding: 6px 8px; border-left: 3px solid rgba(243, 235, 220, .2); }
#admin .drawer.cur { border-left-color: #e8aa38; }
#admin .drawer.done { opacity: .5; }
#admin .dim { opacity: .65; }
#admin .small { font-size: 12.5px; }
