/* Island Builder: a quiet editorial shell around a playable Three.js island. */
@font-face { font-family: "Instrument Sans"; src: url("fonts/instrument-sans.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "Instrument Serif"; src: url("fonts/instrument-serif.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Instrument Serif"; src: url("fonts/instrument-serif-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }

:root {
  --paper: #f5f1ea;
  --ink: #1f1d36;
  --ink-2: #5d5a74;
  --line: rgba(31, 29, 54, 0.12);
  --glass: rgba(250, 248, 244, 0.84);
  --glass-line: rgba(31, 29, 54, 0.1);
  --accent: #d9644e;
  --sel: #2f2b5f;
  --warm: #f2c46d;
  --shadow: 0 14px 34px -18px rgba(20, 18, 50, 0.38);
  --r: 14px;
  --head-h: 56px;
  --sans: "Instrument Sans", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --exploration-footer-bg: #f5f1ea;
  --exploration-footer-ink: #1f1d36;
  --exploration-footer-border: rgba(31, 29, 54, 0.12);
  color-scheme: light;
}
body[data-phase="night"] .stage { --glass: rgba(20, 19, 44, 0.74); --glass-line: rgba(255, 255, 255, 0.12); --ink: #f3efe6; --ink-2: #b8b4d4; --line: rgba(255, 255, 255, 0.16); --sel: #f3efe6; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-top: var(--head-h); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; font-family: var(--sans); color: var(--ink); background: var(--paper); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
button, a { font: inherit; color: inherit; }
button { cursor: pointer; }
img, video { max-width: 100%; }
img { height: auto; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 60; background: var(--paper); padding: 10px 14px; border-radius: 10px; }
.skip:focus { top: 10px; }
.eyebrow { font: 600 11px/1.3 var(--sans); letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-2); margin: 0 0 8px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; letter-spacing: -0.01em; margin: 0; }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 40; height: var(--head-h); display: flex; align-items: center; gap: 14px;
  padding: 0 max(18px, env(safe-area-inset-right)) 0 max(18px, env(safe-area-inset-left));
  background: rgba(245, 241, 234, 0.92); border-bottom: 1px solid var(--line); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.back { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; font-size: 14px; font-weight: 500; color: var(--ink-2); padding: 6px 2px; }
.back:hover { color: var(--ink); }
.brand { font: 400 21px/1 var(--serif); padding-left: 14px; border-left: 1px solid var(--line); white-space: nowrap; }
.toplinks { margin-left: auto; display: flex; align-items: center; gap: 2px; }
.toplinks a { text-decoration: none; font-size: 14px; font-weight: 500; padding: 8px 12px; border-radius: 8px; white-space: nowrap; color: var(--ink-2); }
.toplinks a:hover { color: var(--ink); background: rgba(31, 29, 54, 0.05); }
.toplinks .create-yours { margin-left: 8px; color: #fff; background: var(--accent); font-weight: 600; }
.toplinks .create-yours:hover { background: #c95843; color: #fff; }
.toplinks .short { display: none; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 9px 16px; border-radius: 10px;
  border: 1px solid var(--line); background: transparent; color: var(--ink); font-size: 14px; font-weight: 600; text-decoration: none; transition: background 0.15s, border-color 0.15s; }
.btn:hover { border-color: currentColor; }
.btn.primary { background: #1f1d36; color: #f5f1ea; border-color: #1f1d36; }
.btn.primary:hover { background: #33305a; }
.btn.primary.create-yours { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.link { border-color: transparent; padding-left: 4px; padding-right: 4px; }
.btn:disabled { opacity: 0.55; cursor: progress; }

/* ---------- stage ---------- */
.stage { position: relative; height: calc(100svh - var(--head-h)); min-height: 560px; overflow: hidden; isolation: isolate; color: var(--ink); }
.sky { position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, #a9cdf2 0%, #dde7f8 52%, #f7e2d6 100%); }
.sky::after { content: ""; position: absolute; inset: 0; opacity: var(--night, 0); background: linear-gradient(180deg, #0b1030 0%, #252a5c 48%, #7d6699 100%); }
#stars { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; opacity: var(--night, 0); }
.moon { position: absolute; z-index: 1; right: 7%; top: 24%; width: 58px; height: 58px; border-radius: 50%;
  background: radial-gradient(circle at 42% 40%, #fffbe9, #fff0bf 70%); box-shadow: 0 0 40px 8px rgba(255, 240, 190, 0.3);
  opacity: var(--night, 0); transform: translateY(calc((1 - var(--night, 0)) * 24px)); }
#scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; outline: none; }

.panel { background: var(--glass); border: 1px solid var(--glass-line); border-radius: var(--r); box-shadow: var(--shadow);
  backdrop-filter: blur(14px) saturate(1.1); -webkit-backdrop-filter: blur(14px) saturate(1.1); transition: background 0.6s, border-color 0.6s; }

.status { position: absolute; left: 18px; top: 18px; z-index: 5; padding: 14px 16px 12px; width: min(300px, calc(100% - 36px)); }
.status .eyebrow { margin-bottom: 4px; }
.status h1 { font-size: 25px; line-height: 1.05; }
.progress { list-style: none; display: flex; gap: 4px; margin: 10px 0; padding: 0; }
.progress li { flex: 1; height: 3px; border-radius: 2px; background: var(--line); transition: background 0.4s; }
.progress li.on { background: var(--ink); }
body[data-phase="night"] .progress li.on { background: var(--warm); }
.hint { margin: 0; font-size: 13.5px; line-height: 1.4; color: var(--ink-2); }

.controls { position: absolute; right: 18px; top: 18px; z-index: 5; display: flex; gap: 2px; padding: 5px; }
.ctl { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 64px; padding: 7px 6px 5px; border: 0; border-radius: 10px; background: transparent; font-size: 11.5px; font-weight: 500; color: var(--ink-2); }
.ctl:hover { background: rgba(127, 127, 160, 0.12); color: var(--ink); }
.ctl[aria-pressed="true"] { background: var(--sel); color: #f5f1ea; }
body[data-phase="night"] .ctl[aria-pressed="true"] { color: #1f1d36; }
.ico { width: 20px; height: 20px; display: block; background: currentColor; -webkit-mask: var(--m) center / contain no-repeat; mask: var(--m) center / contain no-repeat; }
.ico-moon { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Cpath d='M20 14.5A8.5 8.5 0 0 1 9.5 4a8.5 8.5 0 1 0 10.5 10.5Z'/%3E%3C/svg%3E"); }
.ico-sun { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='4.2'/%3E%3Cpath d='M12 2v2.5M12 19.5V22M2 12h2.5M19.5 12H22M4.9 4.9l1.8 1.8M17.3 17.3l1.8 1.8M4.9 19.1l1.8-1.8M17.3 6.7l1.8-1.8'/%3E%3C/svg%3E"); }
.ico-play { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linejoin='round'%3E%3Cpath d='M7.5 5v14l11-7z'/%3E%3C/svg%3E"); }
.ico-stop { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Crect x='6' y='6' width='12' height='12' rx='1.5'/%3E%3C/svg%3E"); }
.ico-sound { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 9.5h3.5L12 6v12l-4.5-3.5H4z'/%3E%3Cpath d='M15.5 9a4 4 0 0 1 0 6M18 6.5a7.5 7.5 0 0 1 0 11'/%3E%3C/svg%3E"); }
.ico-mute { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 9.5h3.5L12 6v12l-4.5-3.5H4z'/%3E%3Cpath d='M16 10l4 4M20 10l-4 4'/%3E%3C/svg%3E"); }
.ico-reset { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4.5 12a7.5 7.5 0 1 0 2.3-5.4'/%3E%3Cpath d='M4 4v4.5h4.5'/%3E%3C/svg%3E"); }

/* ---------- tray ---------- */
.tray { position: absolute; left: 50%; bottom: 18px; z-index: 6; transform: translateX(-50%); max-width: calc(100% - 24px); }
.tray ul { list-style: none; margin: 0; padding: 6px; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none;
  background: var(--glass); border: 1px solid var(--glass-line); border-radius: 16px; box-shadow: var(--shadow); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); transition: background 0.6s; }
.tray ul::-webkit-scrollbar { display: none; }
.card { position: relative; flex: none; width: 96px; padding: 6px 6px 7px; border-radius: 11px; border: 1px solid transparent; background: transparent;
  display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--ink); transition: background 0.15s, border-color 0.15s; }
.card .thumb { width: 82px; height: 72px; border-radius: 8px; background: rgba(255, 255, 255, 0.55); display: grid; place-items: center; overflow: hidden; }
body[data-phase="night"] .card .thumb { background: rgba(255, 255, 255, 0.08); }
.card img { width: 68px; height: 68px; object-fit: contain; transition: transform 0.25s ease; }
.card b { font-size: 12.5px; font-weight: 600; }
.card small { font-size: 10.5px; color: var(--ink-2); white-space: nowrap; }
.card:hover { background: rgba(127, 127, 160, 0.1); }
.card:hover img { transform: translateY(-2px); }
.card[aria-pressed="true"] { border-color: var(--sel); background: rgba(127, 127, 160, 0.1); }
.card.placed .thumb { opacity: 0.45; }
.card.placed::after { content: "✓"; position: absolute; top: 8px; right: 10px; width: 18px; height: 18px; border-radius: 50%; background: #1f1d36; color: #f5f1ea; font-size: 11px; line-height: 18px; text-align: center; }
body[data-phase="night"] .card.placed::after { background: var(--warm); color: #1f1d36; }

.scroll-cue { position: absolute; right: 18px; bottom: 22px; z-index: 5; display: flex; gap: 8px; align-items: center; text-decoration: none; font-size: 13.5px; font-weight: 600;
  padding: 11px 16px; border-radius: 12px; background: #1f1d36; color: #f5f1ea; box-shadow: 0 10px 26px -10px rgba(20, 18, 50, 0.55); animation: cue 2.4s ease-in-out infinite; }
.scroll-cue:hover { background: #33305a; }
.scroll-cue .short { display: none; }
@keyframes cue { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(4px); } }
body[data-phase="night"] .scroll-cue { background: #f5f1ea; color: #1f1d36; }

/* ---------- picker / info / toast ---------- */
.lot-picker { position: absolute; left: 50%; bottom: 150px; z-index: 7; transform: translateX(-50%); padding: 12px 14px 10px; width: min(460px, calc(100% - 24px)); text-align: center; }
.lp-title { margin: 0 0 8px; font-size: 14px; color: var(--ink-2); }
.lp-title b { color: var(--ink); font-weight: 600; }
.lp-list { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.lp-list button { border: 1px solid var(--line); background: transparent; border-radius: 8px; padding: 7px 11px; font-size: 13px; font-weight: 500; color: var(--ink); }
.lp-list button:hover, .lp-list button:focus-visible { border-color: var(--ink); }
.lp-list button:disabled { opacity: 0.35; cursor: default; text-decoration: line-through; }
.lp-cancel { margin-top: 6px; background: none; border: 0; font-size: 12.5px; color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; }

.info { position: absolute; right: 18px; top: 96px; z-index: 7; width: min(320px, calc(100% - 36px)); padding: 16px; }
.info h2 { font-size: 26px; margin-bottom: 10px; }
.info-close { position: absolute; right: 10px; top: 10px; width: 30px; height: 30px; border-radius: 8px; border: 0; background: transparent; font-size: 20px; line-height: 1; color: var(--ink-2); }
.info-close:hover { background: rgba(127, 127, 160, 0.12); }
.info-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.info-pair figure { margin: 0; }
.info-pair img, .info-model { width: 100%; aspect-ratio: 1; object-fit: contain; border-radius: 10px; background: rgba(255, 255, 255, 0.85); display: block; }
.info-model canvas { width: 100%; height: 100%; display: block; }
.info-pair figcaption { font-size: 11px; margin-top: 5px; color: var(--ink-2); }
.info p { font-size: 13.5px; line-height: 1.45; margin: 12px 0; color: var(--ink-2); }
.info-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.info-actions .btn { min-height: 34px; padding: 6px 11px; font-size: 13px; }

.toast { position: absolute; left: 50%; top: 18px; z-index: 8; transform: translateX(-50%); padding: 10px 10px 10px 16px; display: flex; align-items: center; gap: 14px; font-size: 14px; font-weight: 500; max-width: calc(100% - 24px); animation: toast-in 0.35s ease-out; }
.toast .btn { min-height: 32px; padding: 5px 12px; font-size: 13px; }
@keyframes toast-in { from { transform: translate(-50%, -12px); opacity: 0; } }

/* ---------- intro / fatal ---------- */
.intro { position: absolute; inset: 0; z-index: 12; display: grid; place-items: center; padding: 16px; background: rgba(31, 29, 54, 0.2); transition: opacity 0.5s; }
.intro.gone { opacity: 0; pointer-events: none; }
.intro-card { background: #f5f1ea; color: #1f1d36; border-radius: 18px; padding: 28px 30px 22px; max-width: 470px; text-align: center; box-shadow: 0 30px 70px -30px rgba(20, 18, 50, 0.55); border: 1px solid rgba(31, 29, 54, 0.1); }
.intro-card h2 { font-size: 44px; line-height: 1; margin: 2px 0 14px; }
.intro-card h2 em { color: #5d5a74; }
.intro-card p { margin: 0 0 18px; line-height: 1.5; color: #5d5a74; font-size: 15px; }
.intro-card .btn { color: #1f1d36; border-color: rgba(31, 29, 54, 0.14); }
.intro-card .btn.primary { color: #f5f1ea; }
.intro-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.loadbar { height: 2px; background: rgba(31, 29, 54, 0.1); overflow: hidden; margin: 20px 0 12px; border-radius: 2px; }
.loadbar span { display: block; height: 100%; width: 4%; background: #1f1d36; transition: width 0.3s; }
.intro-note { font-size: 12px !important; margin: 0 !important; }
.fatal { position: absolute; left: 50%; top: 50%; z-index: 13; transform: translate(-50%, -50%); padding: 20px; text-align: center; width: min(360px, calc(100% - 32px)); display: flex; flex-direction: column; gap: 10px; }

/* ---------- sections below the game ---------- */
.section { max-width: 1200px; margin: 0 auto; padding: 96px 24px 24px; }
.section-head { max-width: 760px; margin-bottom: 36px; }
.section-head h2 { font-size: clamp(38px, 5vw, 60px); line-height: 1.02; margin-bottom: 18px; }
.section-head em, .cta h2 em { color: var(--ink-2); }
.section-lede { font-size: 17px; line-height: 1.55; color: var(--ink-2); margin: 0; }

.viewer { display: grid; grid-template-columns: 200px minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.viewer-list { display: flex; flex-direction: column; gap: 2px; }
.viewer-list button { display: flex; align-items: center; gap: 10px; text-align: left; border: 0; background: transparent; padding: 6px 8px; border-radius: 10px; font-size: 14px; font-weight: 500; color: var(--ink-2); }
.viewer-list button img { width: 36px; height: 36px; object-fit: contain; }
.viewer-list button:hover { background: rgba(31, 29, 54, 0.05); color: var(--ink); }
.viewer-list button[aria-selected="true"] { background: #fff; color: var(--ink); box-shadow: 0 0 0 1px var(--line); }
.viewer-list .group { font: 600 10.5px var(--sans); letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-2); margin: 12px 8px 4px; }
.viewer-list .group:first-child { margin-top: 0; }
.viewer-stage { position: relative; aspect-ratio: 4 / 3.4; border-radius: 18px; background: radial-gradient(ellipse at 50% 38%, #ffffff 0%, #eee8dd 70%, #e4ddd0 100%); border: 1px solid var(--line); overflow: hidden; }
#viewer { width: 100%; height: 100%; display: block; touch-action: pan-y; cursor: grab; }
#viewer:active { cursor: grabbing; }
.viewer-hint { position: absolute; left: 16px; bottom: 12px; margin: 0; font-size: 12px; color: var(--ink-2); }
.viewer-loading { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; font-size: 14px; color: var(--ink-2); }
.viewer-side h3 { font-size: 30px; margin: 14px 0 8px; }
.viewer-side p { font-size: 14.5px; line-height: 1.5; color: var(--ink-2); margin: 0 0 14px; }
.viewer-concept { margin: 0; background: #fff; border-radius: 14px; border: 1px solid var(--line); padding: 14px; }
.viewer-concept img { width: 100%; aspect-ratio: 1; object-fit: contain; display: block; }
.viewer-concept figcaption { font-size: 12px; color: var(--ink-2); margin-top: 6px; }
.facts { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 13px; border-top: 1px solid var(--line); padding-top: 12px; }
.facts dt { color: var(--ink-2); }
.facts dd { margin: 0; font-weight: 500; }

.video-block video, .film video { width: 100%; aspect-ratio: 16 / 9; border-radius: 16px; background: #15142e; display: block; }
.steps { list-style: none; margin: 40px 0 0; padding: 0; display: grid; gap: 28px; counter-reset: s; }
.steps li { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 32px; align-items: center; padding-top: 28px; border-top: 1px solid var(--line); counter-increment: s; }
.steps li:nth-child(even) figure { order: 2; }
.steps figure { margin: 0; }
.steps img { width: 100%; border-radius: 12px; display: block; border: 1px solid var(--line); }
.steps h3 { font-size: 30px; margin-bottom: 10px; }
.steps h3::before { content: counter(s, decimal-leading-zero) "  "; font: 500 13px var(--sans); color: var(--ink-2); vertical-align: middle; letter-spacing: 0.08em; }
.steps p { font-size: 15.5px; line-height: 1.6; color: var(--ink-2); margin: 0; }
.numbers { display: grid; grid-template-columns: repeat(4, 1fr); margin: 56px 0 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.numbers div { padding: 22px 18px; border-left: 1px solid var(--line); }
.numbers div:first-child { border-left: 0; padding-left: 0; }
.numbers dt { font: 400 34px/1.1 var(--serif); }
.numbers dd { margin: 4px 0 0; font-size: 13px; color: var(--ink-2); }
.film-row { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 32px; margin-top: 56px; align-items: center; }
.film { margin: 0; }
.film figcaption { font-size: 12.5px; color: var(--ink-2); margin-top: 8px; }
.prompt { margin: 0; padding: 0 0 0 22px; border-left: 2px solid var(--accent); }
.prompt p { font: italic 400 22px/1.4 var(--serif); margin: 0 0 12px; }
.prompt cite { font-style: normal; font-size: 12.5px; color: var(--ink-2); }
.cta { text-align: center; padding-bottom: 110px; }
.cta h2 { font-size: clamp(40px, 5.5vw, 64px); line-height: 1; margin-bottom: 16px; }
.cta p { max-width: 540px; margin: 0 auto 26px; color: var(--ink-2); font-size: 16px; line-height: 1.55; }
.cta-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }

/* ---------- footer ---------- */
.site-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px max(18px, env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) 18px; font-size: 12px;
  background: var(--exploration-footer-bg); color: var(--exploration-footer-ink); border-top: 1px solid var(--exploration-footer-border); }
.foot-name { color: var(--ink-2); }

/* ---------- modal ---------- */
.modal { border: 0; padding: 0; width: min(980px, calc(100% - 24px)); max-height: calc(100svh - 24px); border-radius: 18px; background: var(--paper); color: var(--ink); box-shadow: 0 40px 90px -30px rgba(15, 12, 45, 0.6); }
.modal::backdrop { background: rgba(21, 20, 46, 0.62); backdrop-filter: blur(4px); }
.modal-inner { padding: 20px 22px 22px; }
.modal-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 14px; }
.modal-head h2 { font-size: 32px; line-height: 1.05; }
.modal-close { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: transparent; font-size: 22px; line-height: 1; flex: none; }
#making-video { width: 100%; aspect-ratio: 16 / 9; border-radius: 12px; background: #15142e; display: block; }
.modal-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  .viewer { grid-template-columns: 1fr; }
  .viewer-list { flex-direction: row; overflow-x: auto; scrollbar-width: none; gap: 4px; }
  .viewer-list .group { display: none; }
  .viewer-list button { flex: none; flex-direction: column; gap: 2px; font-size: 12px; padding: 6px 8px; }
  .viewer-side { display: grid; grid-template-columns: 140px 1fr; gap: 0 18px; align-items: start; }
  .viewer-concept { grid-row: span 3; padding: 8px; }
  .viewer-side h3 { margin-top: 0; }
  .steps li { grid-template-columns: 1fr; gap: 16px; }
  .steps li:nth-child(even) figure { order: 0; }
  .film-row { grid-template-columns: 1fr; }
}
@media (max-width: 900px) { .toplinks .long { display: none; } .toplinks .short { display: inline; } }
/* between phone and wide desktop the centred tray reaches the right edge: lift the cue above it */
@media (min-width: 641px) and (max-width: 1280px) {
  .scroll-cue { bottom: 168px; padding: 8px 12px; font-size: 12.5px; }
  .scroll-cue .long { display: none; } .scroll-cue .short { display: inline; }
}
@media (max-width: 640px) {
  :root { --head-h: 52px; }
  .back .long, .brand { display: none; }
  .toplinks a { padding: 7px 8px; font-size: 13.5px; }
  .toplinks .create-yours { margin-left: 4px; padding: 7px 10px; }
  .stage { min-height: 600px; }
  .status { left: 10px; top: 10px; right: 10px; width: auto; padding: 11px 13px 10px; }
  .status h1 { font-size: 21px; }
  .progress { margin: 8px 0; }
  .hint { font-size: 13px; }
  .controls { left: 10px; right: 10px; top: auto; bottom: 170px; justify-content: space-between; padding: 4px; }
  .ctl { flex: 1; min-width: 0; flex-direction: row; justify-content: center; gap: 6px; padding: 8px 4px; font-size: 12px; }
  .ico { width: 18px; height: 18px; }
  .tray { bottom: 38px; }
  .card { width: 84px; }
  .card .thumb { width: 72px; height: 60px; }
  .card img { width: 56px; height: 56px; }
  .scroll-cue { left: 50%; right: auto; bottom: 6px; transform: translateX(-50%); padding: 5px 12px; font-size: 12px; animation: none; }
  .scroll-cue .long { display: none; } .scroll-cue .short { display: inline; }
  .lot-picker { bottom: 232px; padding: 9px 10px 8px; }
  .lp-title { font-size: 13px; margin-bottom: 6px; }
  .lp-list { flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; scrollbar-width: none; }
  .lp-list button { flex: none; }
  .info { top: auto; bottom: 232px; right: 10px; left: 10px; width: auto; padding: 12px; }
  .info h2 { font-size: 22px; margin-bottom: 8px; }
  .info-pair img, .info-model { max-height: 104px; }
  .info p { margin: 8px 0; }
  .intro-card { padding: 22px 18px 16px; }
  .intro-card h2 { font-size: 36px; }
  .section { padding: 64px 18px 16px; }
  .numbers { grid-template-columns: repeat(2, 1fr); }
  .numbers div:nth-child(3) { border-left: 0; padding-left: 0; }
  .numbers div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .viewer-side { grid-template-columns: 110px 1fr; }
  .modal-inner { padding: 14px; }
  .modal-head h2 { font-size: 24px; }
}
@media (max-height: 520px) and (orientation: landscape) {
  :root { --head-h: 46px; }
  .stage { min-height: 340px; }
  .status { width: 230px; padding: 8px 12px; top: 8px; left: 8px; }
  .status .eyebrow, .hint { display: none; }
  .status h1 { font-size: 18px; }
  .progress { margin: 6px 0 0; }
  .controls { top: 8px; right: 8px; padding: 3px; }
  .ctl { min-width: 50px; padding: 5px 4px 4px; font-size: 10px; }
  .ico { width: 17px; height: 17px; }
  .tray { bottom: 6px; }
  .tray ul { padding: 4px; gap: 3px; }
  .card { width: 70px; padding: 3px 3px 4px; gap: 2px; }
  .card .thumb { width: 62px; height: 44px; }
  .card img { width: 42px; height: 42px; }
  .card b { font-size: 11px; }
  .card small, .lp-title { display: none; }
  .scroll-cue { bottom: 8px; right: 8px; padding: 6px 10px; font-size: 11.5px; animation: none; }
  .scroll-cue .long { display: none; } .scroll-cue .short { display: inline; }
  .lot-picker { bottom: 92px; padding: 6px 10px; }
  .lp-list { flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; }
  .lp-list button { flex: none; }
  .info { top: 62px; right: 8px; bottom: auto; width: 290px; max-height: calc(100% - 158px); overflow: auto; padding: 12px; }
  .info-pair img, .info-model { max-height: 86px; }
  .intro-card { padding: 14px 18px 12px; }
  .intro-card h2 { font-size: 30px; margin-bottom: 8px; }
  .intro-card p { margin-bottom: 10px; font-size: 14px; }
  .loadbar { margin: 10px 0 6px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; } }
