/* ==========================================================================
   Tiny Alps — interface
   Quiet glass instruments around the orb. The accent follows the season.
   ========================================================================== */
:root {
  --ink: rgba(12, 14, 17, 0.56);
  --ink-strong: rgba(12, 14, 17, 0.82);
  --ink-solid: #0c0e11;
  --paper: #ece8df;
  --paper-2: #cfcabe;
  --muted: #9a978d;
  --line: rgba(236, 232, 223, 0.11);
  --line-2: rgba(236, 232, 223, 0.2);
  --accent: #7fb2e4;
  --accent-ink: #0c0e11;
  --serif: 'Cormorant Garamond', 'Iowan Old Style', Georgia, serif;
  --sans: 'Instrument Sans', 'Helvetica Neue', system-ui, -apple-system, sans-serif;
  --r-lg: 18px;
  --r-md: 12px;
  --r-sm: 8px;
  --blur: saturate(140%) blur(18px);
  --ease: cubic-bezier(.2, .7, .2, 1);
}
body.season-spring { --accent: #a9d27e; }
body.season-summer { --accent: #7fb2e4; }
body.season-autumn { --accent: #e6a640; }
body.season-winter { --accent: #bcdcea; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #000; overflow: hidden; color: var(--paper); font-family: var(--sans); -webkit-font-smoothing: antialiased; }
#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
#scene:active { cursor: grabbing; }
body.hovering #scene { cursor: pointer; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }

/* ---------- loader ---------- */
#loader { position: fixed; inset: 0; display: grid; place-content: center; justify-items: center; gap: 10px; text-align: center; background: #000; transition: opacity 1.6s ease; z-index: 60; }
#loader.done { opacity: 0; pointer-events: none; }
.ld-title { font-family: var(--serif); font-weight: 300; font-size: clamp(44px, 7vw, 76px); letter-spacing: 0.01em; line-height: 1; }
.ld-sub { font-family: var(--serif); font-style: italic; font-size: 19px; color: var(--muted); margin-bottom: 26px; }
.ld-bar { width: 200px; height: 1px; background: rgba(255,255,255,.12); }
.ld-bar i { display: block; height: 100%; width: 0; background: var(--paper); transition: width .5s var(--ease); }
.ld-msg { font-size: 12px; color: var(--muted); margin-top: 8px; }
#fade { position: fixed; inset: 0; background: #000; opacity: 0; pointer-events: none; transition: opacity .7s ease; z-index: 30; }

/* ---------- HUD shell ---------- */
#ui { position: fixed; inset: 0; pointer-events: none; z-index: 10; transition: opacity .6s ease; }
#ui > * { pointer-events: auto; }
#ui #toast, #ui #tip, #ui #title-card { pointer-events: none; }
body.ui-hidden #ui > *:not(#toast):not(#title-card):not(#story-ui) { opacity: 0; pointer-events: none; }
body.mode-story #ui .top, body.mode-story #ui .rail, body.mode-story #ui .dock, body.mode-story #follow-card,
body.mode-photo #ui .top, body.mode-photo #ui .rail, body.mode-photo #ui .dock, body.mode-photo #follow-card,
body.mode-tour #ui .dock, body.mode-tour #follow-card { opacity: 0; pointer-events: none; transform: translateY(8px); }
.top, .rail, .dock, #follow-card { transition: opacity .5s var(--ease), transform .5s var(--ease); }

.glass { background: var(--ink); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); border: 1px solid var(--line); }

/* ---------- top ---------- */
.top { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: flex-start; padding: 22px 26px; pointer-events: none; }
.top > * { pointer-events: auto; }
.wordmark { margin: 0; font-family: var(--serif); font-weight: 300; font-size: 34px; line-height: 1; letter-spacing: 0.005em; }
.when { margin-top: 8px; display: flex; gap: 14px; align-items: baseline; font-size: 13px; color: var(--paper-2); }
#date { font-family: var(--serif); font-style: italic; font-size: 18px; color: var(--paper); }
#clock { font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
#season-name { color: var(--accent); font-size: 12px; }
.top-actions { display: flex; gap: 6px; }
.icon { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: var(--paper-2); position: relative; transition: background .25s, color .25s; }
.icon:hover { background: rgba(236,232,223,.08); color: var(--paper); }
.top-actions .icon { background: var(--ink); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); border: 1px solid var(--line); }
.top-actions .icon:hover { background: var(--ink-strong); }
#btn-sound .on { display: none; }
#btn-sound[aria-pressed="true"] .on { display: inline; }
#btn-sound[aria-pressed="true"] .off { display: none; }
#btn-sound[aria-pressed="true"] { color: var(--accent); }
.badge { position: absolute; right: -2px; top: -2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); font-size: 10.5px; font-weight: 600; display: grid; place-items: center; font-variant-numeric: tabular-nums; }

/* ---------- mode rail ---------- */
.rail { position: absolute; right: 22px; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 4px; padding: 8px 6px; border-radius: 22px; background: var(--ink); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); border: 1px solid var(--line); }
.mode { width: 62px; padding: 9px 0 7px; border-radius: 14px; display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--muted); font-size: 10.5px; letter-spacing: 0.01em; transition: color .25s, background .25s; }
.mode:hover { color: var(--paper); background: rgba(236,232,223,.06); }
.mode.active { color: var(--accent); background: rgba(236,232,223,.07); }
.rail-sep { height: 1px; background: var(--line); margin: 4px 10px; }
#btn-shake:active svg { animation: wobble .5s var(--ease); }
@keyframes wobble { 20% { transform: rotate(-12deg); } 45% { transform: rotate(10deg); } 70% { transform: rotate(-5deg); } }

/* ---------- dock ---------- */
.dock { position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%); width: min(780px, calc(100% - 32px)); padding: 14px 18px 12px; border-radius: var(--r-lg); background: var(--ink); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); border: 1px solid var(--line); display: grid; gap: 10px; }
.dock-row { display: flex; align-items: center; gap: 14px; }
.speed { display: flex; border: 1px solid var(--line); border-radius: 999px; padding: 2px; }
.sp { height: 26px; min-width: 38px; padding: 0 9px; border-radius: 999px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; display: grid; place-items: center; transition: background .2s, color .2s; }
.sp svg { width: 14px; height: 14px; }
.sp:hover { color: var(--paper); }
.sp.active { background: var(--paper); color: var(--ink-solid); }
.toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--paper-2); cursor: pointer; user-select: none; }
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.tg { width: 28px; height: 16px; border-radius: 8px; background: rgba(236,232,223,.16); position: relative; transition: background .25s; flex: none; }
.tg::after { content: ''; position: absolute; left: 2px; top: 2px; width: 12px; height: 12px; border-radius: 50%; background: var(--paper); transition: transform .25s var(--ease); }
.toggle input:checked + .tg { background: var(--accent); }
.toggle input:checked + .tg::after { transform: translateX(12px); background: var(--ink-solid); }
.toggle input:focus-visible + .tg { outline: 2px solid var(--accent); outline-offset: 2px; }
.scenes { margin-left: auto; position: relative; }
.pill { height: 30px; padding: 0 10px 0 14px; border-radius: 999px; border: 1px solid var(--line-2); font-size: 12.5px; display: inline-flex; align-items: center; gap: 4px; color: var(--paper); transition: background .2s; }
.pill:hover { background: rgba(236,232,223,.07); }
.pill svg { width: 16px; height: 16px; }
.menu { position: absolute; bottom: calc(100% + 10px); right: 0; width: 280px; padding: 6px; border-radius: var(--r-md); background: var(--ink-strong); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); border: 1px solid var(--line); display: grid; gap: 1px; }
.menu button { text-align: left; padding: 9px 12px; border-radius: var(--r-sm); display: grid; gap: 1px; transition: background .2s; }
.menu button:hover { background: rgba(236,232,223,.08); }
.menu .m-title { font-family: var(--serif); font-size: 17px; line-height: 1.15; }
.menu .m-sub { font-size: 11.5px; color: var(--muted); }
#scenes-menu { max-height: min(560px, calc(100vh - 230px)); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.menu .m-head { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); padding: 10px 12px 4px; }
.menu .m-head:first-child { padding-top: 6px; }
/* calendar markers on the season scrubber */
.ev-marks { position: absolute; inset: 0; pointer-events: none; }
.ev-marks .ev { position: absolute; top: 3px; width: 14px; height: 14px; margin-left: -7px; padding: 0; pointer-events: auto; cursor: pointer; display: grid; place-items: center; }
.ev-marks .ev::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--paper); box-shadow: 0 0 0 1.5px rgba(0,0,0,.35); transition: transform .2s, background .2s; }
.ev-marks .ev:hover::before { transform: scale(1.6); }
.ev-marks .ev.on::before { background: var(--accent); transform: scale(1.4); box-shadow: 0 0 0 1.5px rgba(0,0,0,.35), 0 0 8px var(--accent); }

.scrub { display: grid; grid-template-columns: 54px 1fr; align-items: center; gap: 10px; }
.scrub-label { font-size: 11.5px; color: var(--muted); }
.track { position: relative; height: 30px; border-radius: 8px; cursor: ew-resize; touch-action: none; overflow: hidden; }
.year-track .bands { position: absolute; inset: 9px 0 9px 0; border-radius: 6px;
  background: linear-gradient(90deg, #dfe7ee 0%, #e6edf2 7%, #b4c78f 20%, #8fbf6a 32%, #5f9f4a 45%, #8aa04a 58%, #d79a36 72%, #b06a2a 82%, #c9d4dc 91%, #dfe7ee 100%); opacity: .55; }
.year-track .ticks { position: absolute; inset: 0; display: flex; justify-content: space-between; padding: 0 1.5%; font-size: 10px; color: var(--paper); align-items: center; pointer-events: none; mix-blend-mode: normal; }
.year-track .ticks span { width: 8.33%; text-align: center; opacity: .82; text-shadow: 0 1px 2px rgba(0,0,0,.6); }
.day-track .sky-grad { position: absolute; inset: 9px 0; border-radius: 6px;
  background: linear-gradient(90deg, #0b1226 0%, #0f1a36 18%, #3b3f6a 23%, #d98a6a 26%, #f2c98c 29%, #9cc4e8 36%, #7fb2e4 50%, #9cc4e8 64%, #f0b47a 72%, #c9637a 76%, #3d3a6a 80%, #101a36 86%, #0b1226 100%); opacity: .6; }
.day-track .hours { position: absolute; inset: 0; display: flex; justify-content: space-between; align-items: center; font-size: 10px; color: var(--paper); pointer-events: none; padding: 0 2px; }
.day-track .hours span { text-shadow: 0 1px 2px rgba(0,0,0,.7); opacity: .82; font-variant-numeric: tabular-nums; }
.thumb { position: absolute; top: 2px; bottom: 2px; width: 2px; margin-left: -1px; background: var(--paper); border-radius: 1px; pointer-events: none; box-shadow: 0 0 0 1px rgba(0,0,0,.25); }
.thumb i { position: absolute; left: 50%; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; background: var(--paper); border: 3px solid var(--accent); box-shadow: 0 2px 8px rgba(0,0,0,.45); }
.day-track .thumb i { border-color: #f2c98c; }
body.night .day-track .thumb i { border-color: #8fa3d9; background: #e6ecff; }

.weather { display: flex; gap: 4px; flex-wrap: wrap; }
.wx { height: 34px; padding: 0 11px 0 9px; border-radius: 10px; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); border: 1px solid transparent; transition: color .2s, background .2s, border-color .2s; }
.wx svg { width: 18px; height: 18px; }
.wx:hover { color: var(--paper); background: rgba(236,232,223,.05); }
.wx.active { color: var(--paper); border-color: var(--line-2); background: rgba(236,232,223,.07); }
.wx.active svg { color: var(--accent); }
.mini-slider { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); }
input[type=range] { -webkit-appearance: none; appearance: none; width: 110px; height: 18px; background: transparent; cursor: pointer; }
input[type=range]::-webkit-slider-runnable-track { height: 2px; background: var(--line-2); border-radius: 1px; }
input[type=range]::-moz-range-track { height: 2px; background: var(--line-2); border-radius: 1px; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; margin-top: -6px; border-radius: 50%; background: var(--paper); border: 0; box-shadow: 0 1px 4px rgba(0,0,0,.4); }
input[type=range]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--paper); border: 0; }

/* ---------- looks ---------- */
.btn-looks { margin-left: auto; gap: 7px; padding-left: 8px; }
.btn-looks + .scenes { margin-left: 0; }
.pill-sw { width: 16px; height: 16px; border-radius: 50%; flex: none; background: var(--look-sw, linear-gradient(135deg, #5f8a4a, #9fbad2 55%, #e6dcc2)); box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); }
.looks-menu { position: fixed; width: 300px; max-height: min(70vh, 560px); overflow-y: auto; z-index: 20; }
.looks-menu button { grid-template-columns: 34px 1fr; column-gap: 12px; align-items: center; }
.looks-menu .sw { grid-row: 1 / span 2; width: 34px; height: 34px; border-radius: 9px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.14); }
.looks-menu button.active { background: rgba(236,232,223,.1); }
.looks-menu button.active .m-title::after { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-left: 8px; vertical-align: middle; }
.look-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 10px; }
.look-grid button { display: grid; gap: 6px; padding: 6px; border-radius: 10px; border: 1px solid var(--line); text-align: left; font-size: 11.5px; color: var(--paper-2); transition: border-color .2s, background .2s; }
.look-grid button:hover { background: rgba(236,232,223,.05); }
.look-grid button.active { border-color: var(--accent); color: var(--paper); }
.look-grid .sw { height: 26px; border-radius: 6px; display: block; }
.look-grid .m-title { line-height: 1.2; }
.look-grid button.look-auto { grid-column: 1 / -1; grid-template-columns: 54px 1fr; align-items: center; column-gap: 10px; }
.look-grid button.look-auto .sw { height: 26px; }
.looks-menu button.look-auto { border-bottom: 1px solid var(--line); border-radius: 10px 10px 0 0; margin-bottom: 4px; padding-bottom: 12px; }
#btn-glass .strike { display: none; }
#btn-glass[aria-pressed="false"] .strike { display: inline; }
#btn-glass[aria-pressed="false"] .glint { display: none; }
#btn-glass[aria-pressed="false"] { color: var(--accent); }

/* ---------- follow card ---------- */
.card { position: absolute; left: 24px; bottom: 24px; width: 260px; padding: 16px 18px 14px; border-radius: var(--r-lg); background: var(--ink); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); border: 1px solid var(--line); }
.fc-name { font-family: var(--serif); font-size: 28px; line-height: 1.05; }
.fc-role { font-family: var(--serif); font-style: italic; font-size: 16px; color: var(--paper-2); margin-top: 2px; }
.fc-act { margin-top: 12px; font-size: 13px; display: flex; gap: 8px; align-items: center; color: var(--paper); }
.fc-act::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex: none; animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.text-btn { margin-top: 12px; font-size: 12px; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-2); }
.text-btn:hover { color: var(--paper); }

/* ---------- train ride ---------- */
#follow-card .fc-views { margin: 12px 0 0; }
.fc-views button.active { color: var(--ink-solid); background: var(--paper); border-color: var(--paper); }
#follow-card .fc-views + .text-btn { margin-top: 10px; }
#btn-train.active { color: var(--accent); background: rgba(236,232,223,.07); }
#tunnel-shade { position: fixed; inset: 0; pointer-events: none; z-index: 5; opacity: 0; transition: opacity .6s ease;
  background: radial-gradient(circle at 50% 46%, rgba(255,236,200,.22) 0, rgba(20,16,12,.0) 3%, rgba(6,5,4,.93) 12%, #050404 60%); }
#tunnel-shade.on { opacity: 1; }
body.riding #poi-layer { display: none; }

/* ---------- places ---------- */
#poi-layer { position: absolute; inset: 0; pointer-events: none !important; overflow: hidden; }
body.labels-off #poi-layer, body.mode-story #poi-layer, body.mode-photo #poi-layer, body.mode-tour #poi-layer { display: none; }
.poi { position: absolute; left: 0; top: 0; display: flex; align-items: center; gap: 7px; height: 24px; padding: 0 11px 0 6px; border-radius: 999px;
  background: rgba(12, 14, 17, .46); backdrop-filter: blur(10px) saturate(140%); -webkit-backdrop-filter: blur(10px) saturate(140%);
  border: 1px solid var(--line); color: var(--paper); font-size: 12px; letter-spacing: .01em; white-space: nowrap;
  pointer-events: none; opacity: 0; transition: opacity .35s ease, background .2s, border-color .2s; will-change: transform, opacity; }
.poi.show { opacity: 1; pointer-events: auto; }
.poi .dot { position: relative; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--accent); background: rgba(12, 14, 17, .55); flex: none; }
.poi .dot::after { content: ''; position: absolute; inset: -6px; border-radius: 50%; border: 1px solid var(--accent); opacity: 0; animation: poi-ping 3.2s ease-out infinite; }
@keyframes poi-ping { 0% { transform: scale(.4); opacity: .7; } 70%, 100% { transform: scale(1.25); opacity: 0; } }
.poi .p-sub { max-width: 0; overflow: hidden; color: var(--muted); font-size: 11px; transition: max-width .35s var(--ease); }
.poi:hover { background: var(--ink-strong); border-color: var(--line-2); }
.poi:hover .p-sub { max-width: 260px; }
.poi.current { border-color: color-mix(in srgb, var(--accent) 60%, transparent); }
.poi.current .dot { background: var(--accent); }
#place-list { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 2px; counter-reset: pl; }
#place-list button { width: 100%; text-align: left; padding: 9px 10px; border-radius: var(--r-sm); display: grid; grid-template-columns: 22px 1fr; gap: 1px 8px; transition: background .2s; counter-increment: pl; }
#place-list button::before { content: counter(pl); grid-row: 1 / span 2; font-family: var(--serif); font-size: 17px; color: var(--muted); line-height: 1.2; }
#place-list button:hover { background: rgba(236,232,223,.07); }
#place-list button.current { background: color-mix(in srgb, var(--accent) 10%, transparent); }
#place-list button.current::before { color: var(--accent); }
#place-list .pl-name { font-family: var(--serif); font-size: 18px; line-height: 1.2; }
#place-list .pl-sub { font-size: 11.5px; color: var(--muted); line-height: 1.4; }
.pc-kicker { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; margin-bottom: 6px; }
.pc-nav { display: flex; align-items: center; gap: 2px; margin-top: 12px; }
.pc-nav .icon { width: 34px; height: 34px; border: 1px solid var(--line); }
.pc-nav .text-btn { margin: 0 0 0 auto; }
#btn-places.active { color: var(--accent); background: rgba(236,232,223,.07); }
body.mode-story #place-card, body.mode-photo #place-card, body.mode-tour #place-card { opacity: 0; pointer-events: none; }

/* ---------- drawers ---------- */
.drawer { position: absolute; top: 84px; bottom: 24px; width: min(340px, calc(100% - 32px)); padding: 18px 18px 18px 20px; border-radius: var(--r-lg); background: var(--ink-strong); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); border: 1px solid var(--line); overflow-y: auto; scrollbar-width: thin; animation: drawer-in .45s var(--ease); }
.drawer.right { right: 100px; }
.drawer.left { left: 24px; }
@keyframes drawer-in { from { opacity: 0; transform: translateY(10px); } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.drawer-head h2 { margin: 0; font-family: var(--serif); font-weight: 400; font-size: 26px; }
.close svg { width: 18px; height: 18px; }
.drawer-note { margin: 0 0 14px; font-size: 12.5px; line-height: 1.5; color: var(--muted); max-width: 32ch; }
#resident-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
#resident-list button { width: 100%; text-align: left; padding: 9px 10px; border-radius: var(--r-sm); display: grid; grid-template-columns: 1fr auto; gap: 1px 10px; transition: background .2s; }
#resident-list button:hover { background: rgba(236,232,223,.07); }
#resident-list .r-name { font-family: var(--serif); font-size: 18px; }
#resident-list .r-role { grid-column: 1; font-size: 11.5px; color: var(--muted); }
#resident-list .r-act { grid-row: 1 / span 2; grid-column: 2; align-self: center; font-size: 11px; color: var(--paper-2); max-width: 120px; text-align: right; }
#resident-list .away { opacity: .45; }
#resident-list h4 { margin: 14px 0 4px; font-size: 11.5px; font-weight: 500; color: var(--muted); }

#journal-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; counter-reset: j; }
#journal-list li { padding: 11px 12px 12px; border-radius: var(--r-sm); border: 1px solid var(--line); counter-increment: j; display: grid; grid-template-columns: 26px 1fr; gap: 2px 8px; }
#journal-list li::before { content: counter(j); grid-row: 1 / span 2; font-family: var(--serif); font-size: 20px; color: var(--muted); line-height: 1.1; }
#journal-list .j-name { font-family: var(--serif); font-size: 18px; line-height: 1.2; }
#journal-list .j-hint { font-size: 12px; line-height: 1.45; color: var(--muted); }
#journal-list li.found { border-color: color-mix(in srgb, var(--accent) 45%, transparent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
#journal-list li.found::before { color: var(--accent); }
#journal-list li:not(.found) .j-name { color: var(--paper-2); }

.set-group { padding: 12px 0 14px; border-top: 1px solid var(--line); }
.set-group:first-of-type { border-top: 0; padding-top: 2px; }
.set-group h3 { margin: 0 0 10px; font-size: 12px; font-weight: 500; color: var(--muted); }
.set { display: grid; grid-template-columns: 1fr 140px; align-items: center; font-size: 13px; margin: 6px 0; }
.set input[type=range] { width: 140px; }
.set.check { grid-template-columns: auto 1fr; gap: 10px; cursor: pointer; }
.set.check input { accent-color: var(--accent); }
.seg { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.seg button { padding: 6px 11px; border-radius: 999px; font-size: 12px; color: var(--muted); border: 1px solid var(--line); transition: all .2s; }
.seg button:hover { color: var(--paper); }
.seg button.active { color: var(--ink-solid); background: var(--paper); border-color: var(--paper); }
.set-note { margin: 4px 0 0; font-size: 11.5px; color: var(--muted); }

/* ---------- modal ---------- */
.modal { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,.35); }
.modal-box { width: min(460px, calc(100% - 32px)); padding: 20px 22px 18px; border-radius: var(--r-lg); background: var(--ink-strong); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); border: 1px solid var(--line); animation: drawer-in .4s var(--ease); }
.keys { display: grid; grid-template-columns: auto 1fr; gap: 9px 18px; margin: 12px 0 4px; font-size: 13px; }
.keys dt { color: var(--paper); font-weight: 500; white-space: nowrap; }
.keys dd { margin: 0; color: var(--paper-2); }

/* ---------- story ---------- */
#story-ui { position: absolute; left: 0; right: 0; bottom: 0; display: grid; place-items: center; padding-bottom: 2.2vh; opacity: .35; transition: opacity .4s; }
#story-ui:hover { opacity: 1; }
.story-bar { width: min(720px, calc(100% - 32px)); display: grid; grid-template-columns: auto 1fr auto; grid-template-rows: auto auto; align-items: center; gap: 6px 14px; }
.story-bar .icon { color: var(--paper); }
#story-pause .pl { display: none; }
#story-pause.paused .pl { display: inline; }
#story-pause.paused .pz { display: none; }
.story-track { position: relative; height: 2px; background: rgba(236,232,223,.18); border-radius: 1px; }
.story-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--paper); border-radius: 1px; }
.story-marks i { position: absolute; top: -3px; width: 1px; height: 8px; background: rgba(236,232,223,.5); }
.story-chapters { grid-column: 2; display: flex; justify-content: space-between; }
.story-chapters button { font-family: var(--serif); font-style: italic; font-size: 15px; color: var(--muted); transition: color .2s; }
.story-chapters button.on, .story-chapters button:hover { color: var(--paper); }
#story-exit { grid-row: 1; grid-column: 3; margin: 0; }
#title-card { position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); text-align: center; opacity: 0; transition: opacity 1.4s ease; text-shadow: 0 2px 30px rgba(0,0,0,.55); }
#title-card.show { opacity: 1; }
.tc-main { font-family: var(--serif); font-weight: 300; font-size: clamp(48px, 8vw, 96px); line-height: 1; }
.tc-sub { font-family: var(--serif); font-style: italic; font-size: clamp(18px, 2.2vw, 26px); color: var(--paper-2); margin-top: 10px; }

/* ---------- photo ---------- */
#photo-ui { position: absolute; left: 0; right: 0; bottom: 18px; display: grid; place-items: center; }
.photo-bar { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 16px; padding: 10px 14px 10px 18px; border-radius: 999px; background: var(--ink); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); border: 1px solid var(--line); max-width: calc(100% - 32px); }
.photo-bar .mini-slider { margin: 0; }
.photo-bar .text-btn { margin: 0; }
.seg.compact { margin: 0; }
.seg.compact button { padding: 4px 9px; font-size: 11.5px; }
.shutter { height: 34px; padding: 0 16px; border-radius: 999px; background: var(--paper); color: var(--ink-solid); font-size: 12.5px; font-weight: 600; transition: transform .15s; }
.shutter:active { transform: scale(.96); }
body.mode-photo #scene { cursor: crosshair; }

/* ---------- toast & tooltip ---------- */
#toast { position: absolute; left: 50%; top: 22px; transform: translate(-50%, -10px); padding: 10px 16px 10px 14px; border-radius: 999px; background: var(--ink-strong); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); border: 1px solid var(--line); font-size: 13px; opacity: 0; transition: opacity .4s, transform .4s var(--ease); display: flex; gap: 10px; align-items: baseline; max-width: calc(100% - 32px); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast b { font-family: var(--serif); font-weight: 500; font-size: 17px; color: var(--accent); }
#tip { position: fixed; left: 0; top: 0; padding: 5px 9px; border-radius: 8px; background: var(--ink-strong); border: 1px solid var(--line); font-size: 12px; opacity: 0; transition: opacity .2s; white-space: nowrap; transform: translate(14px, 14px); }
#tip.show { opacity: 1; }
#tip em { font-family: var(--serif); font-size: 15px; font-style: normal; }
#tip small { color: var(--muted); margin-left: 6px; font-size: 11px; }

/* ---------- small screens ---------- */
@media (max-width: 1380px) and (min-width: 821px) {
  .card { bottom: 224px; }
}
@media (max-width: 820px) {
  .top { padding: 14px 16px; }
  .wordmark { font-size: 26px; }
  .when { gap: 10px; font-size: 12px; }
  #date { font-size: 15px; }
  .top-actions { gap: 4px; }
  .icon { width: 36px; height: 36px; }
  .rail { top: auto; bottom: 236px; right: 50%; transform: translateX(50%); flex-direction: row; padding: 4px; border-radius: 16px; }
  .mode { width: 52px; padding: 6px 0 5px; font-size: 9.5px; }
  .rail-sep { width: 1px; height: auto; margin: 6px 2px; }
  .dock { bottom: 12px; padding: 12px 12px 10px; gap: 8px; }
  .scrub { grid-template-columns: 1fr; }
  .scrub-label { display: none; }
  .wx span { display: none; }
  .wx { padding: 0 8px; }
  .mini-slider span { display: none; }
  .mini-slider input { width: 80px; }
  .toggle .tg-label { font-size: 11px; }
  .drawer.right, .drawer.left { left: 16px; right: 16px; width: auto; top: 70px; bottom: 300px; }
  .card { left: 16px; right: 16px; width: auto; bottom: 300px; }
  .menu { width: min(280px, calc(100vw - 32px)); }
  .btn-looks .look-name { display: none; }
  .btn-looks { padding: 0 8px; }
}
@media (max-width: 480px) {
  .speed .sp { min-width: 32px; padding: 0 6px; }
  .toggle .tg-label { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; }
}

/* ---------- film ---------- */
.film-tabs { margin: 2px 0 6px; }
.film-pane .set-group:first-child { border-top: 0; }
.film-keys { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 4px; counter-reset: none; }
.film-keys li { display: grid; grid-template-columns: 1fr auto; align-items: center; border: 1px solid var(--line); border-radius: var(--r-sm); }
.film-keys .fk-go { display: flex; align-items: center; gap: 10px; padding: 7px 10px; text-align: left; font-size: 12.5px; color: var(--paper-2); }
.film-keys .fk-go b { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 600; background: rgba(236,232,223,.1); color: var(--paper); }
.film-keys .fk-go:hover { color: var(--paper); }
.film-keys .fk-del { width: 30px; height: 30px; display: grid; place-items: center; color: var(--muted); }
.film-keys .fk-del:hover { color: var(--paper); }
.film-keys .fk-del svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.film-keys .fk-empty { display: block; padding: 10px 12px; font-size: 12px; color: var(--muted); border-style: dashed; }
.film-row { display: flex; align-items: center; gap: 14px; }
.film-row .text-btn { margin: 0; }
.film-pane .pill { padding: 0 14px; }
.film-go { width: 100%; margin-top: 8px; height: 38px; }
.film-go:disabled { opacity: .45; cursor: default; }
.set b { font-weight: 500; color: var(--paper); margin-left: 4px; }
.film-compat { color: #e6c27a; }
/* the canvas keeps the export frame shape while recording */
body.rendering #scene, body.live-rec #scene { object-fit: contain; background: #000; }
body.rendering #ui { display: none; }
body.rendering #scene { cursor: progress; }
#render-overlay { position: fixed; left: 0; right: 0; bottom: 22px; display: grid; place-items: center; z-index: 30; pointer-events: none; }
#render-overlay[hidden] { display: none; }
.ro-box { pointer-events: auto; width: min(420px, calc(100% - 32px)); padding: 14px 16px 10px; border-radius: var(--r-md); background: var(--ink-strong); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); border: 1px solid var(--line); }
.ro-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.ro-title { font-family: var(--serif); font-size: 20px; }
.ro-kind { font-size: 11px; color: var(--muted); letter-spacing: .06em; }
.ro-bar { height: 4px; border-radius: 2px; background: rgba(236,232,223,.12); overflow: hidden; }
.ro-bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s linear; }
.ro-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; font-size: 12px; color: var(--paper-2); font-variant-numeric: tabular-nums; }
.ro-foot .text-btn { margin: 0; }
#rec-pill { position: fixed; top: 22px; left: 50%; transform: translateX(-50%); z-index: 30; display: none; align-items: center; gap: 10px; height: 36px; padding: 0 6px 0 14px; border-radius: 999px; background: var(--ink-strong); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); border: 1px solid var(--line); font-size: 12px; letter-spacing: .08em; font-variant-numeric: tabular-nums; }
body.live-rec #rec-pill { display: flex; }
.rec-dot { width: 9px; height: 9px; border-radius: 50%; background: #e5484d; box-shadow: 0 0 10px #e5484d; animation: rec-blink 1.2s steps(2, end) infinite; }
@keyframes rec-blink { 50% { opacity: .25; } }
#rec-stop { height: 26px; padding: 0 12px; border-radius: 999px; background: var(--paper); color: var(--ink-solid); font-weight: 600; letter-spacing: 0; }
body.live-rec .top .wordmark { opacity: .4; }
body.film-preview #poi-layer, body.live-rec #poi-layer { display: none; }
@media (prefers-reduced-motion: reduce) { .rec-dot { animation: none; } }

/* short windows: a compact rail so all ten modes fit */
@media (max-height: 700px) and (min-width: 821px) {
  .rail { gap: 2px; padding: 6px 5px; }
  .mode { width: 54px; padding: 6px 0 5px; gap: 2px; font-size: 9.5px; }
  .mode svg { width: 19px; height: 19px; }
  .rail-sep { margin: 2px 10px; }
}
@media (max-height: 560px) and (min-width: 821px) {
  .mode span { display: none; }
  .mode { padding: 8px 0; }
}
@media (max-width: 820px) {
  .rail { max-width: calc(100vw - 24px); overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain; }
  .rail::-webkit-scrollbar { display: none; }
  .rail .mode { flex: none; }
}
@media (max-width: 820px) {
  #scenes-menu { position: fixed; left: 16px; right: 16px; width: auto; bottom: 232px; max-height: calc(100vh - 330px); }
}
