:root {
  color-scheme: dark;
  font: 16px/1.65 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #181817;
  color: #eeeae2;
  --muted: #b7b1a6;
  --amber: #e8bd86;
  --edge: #403d37;
}
* { box-sizing: border-box; }
body { margin: 0; overflow-wrap: anywhere; }
a { color: var(--amber); text-underline-offset: 5px; }
a, button, summary, input { touch-action: manipulation; }
a, button, summary { min-height: 44px; min-width: 44px; }
a { display: inline-flex; align-items: center; padding: 6px 2px; }
button, input, textarea {
  font: inherit;
  color: inherit;
  background: #25231f;
  border: 1px solid #656057;
  border-radius: 5px;
}
button { padding: 8px 16px; cursor: pointer; }
button:hover, summary:hover { background-color: #3a342b; }
button:disabled { color: #b4ada1; background: #25231f; border-color: #555048; cursor: default; }
input { min-height: 44px; padding: 8px 12px; min-width: 0; width: 100%; }
textarea { width: 100%; padding: 16px; resize: vertical; }
:where(a, button, summary, input, textarea):focus-visible {
  outline: 3px solid #ffce8b;
  outline-offset: 4px;
  box-shadow: 0 0 0 7px #171615;
}
h1:focus { outline: none; }
h1 { font-weight: 450; font-size: clamp(2.3rem, 4.5vw, 4.3rem); line-height: 1.12; letter-spacing: -.045em; max-width: 980px; margin: 52px 0 32px; }
h2 { font-size: 1.3rem; font-weight: 550; line-height: 1.4; letter-spacing: -.018em; }
p { max-width: 70ch; margin: 0 0 24px; }
header {
  padding: 18px clamp(20px, 3vw, 48px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--edge);
}
.wordmark { font-size: .95rem; font-weight: 600; letter-spacing: .015em; color: #f5ead9; text-decoration: none; }
nav { display: flex; flex-wrap: wrap; gap: 4px 24px; }
nav a { color: #e9e4db; text-decoration: none; font-size: .875rem; }
nav a[aria-current] { color: var(--amber); box-shadow: inset 0 -1px var(--amber); }
.skip { position: fixed; top: 10px; left: 20px; z-index: 100; transform: translateY(-160%); padding: 12px 18px; background: #181817; }
.skip:focus { transform: translateY(0); }
.page { padding: 24px clamp(24px, 7vw, 100px) 96px; max-width: 1440px; margin: auto; min-height: calc(100dvh - 81px); }
.page > p { color: #d5cfc4; font-size: 1.075rem; }
.app-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; padding: 0 0 20px; border-bottom: 1px solid var(--edge); }
.app-bar a { margin-right: auto; color: #d4c6b2; }
.app-bar button { background: transparent; font-size: .85rem; }
.controls { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 20px 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 20px; margin: 28px 0 56px; }
.card { padding: 28px; background: linear-gradient(140deg, #2b2722, #211f1c); border: 1px solid var(--edge); border-radius: 7px; }
.card h2 { margin: 0 0 12px; font-size: 1.45rem; font-weight: 450; }
.card h2 a { color: #f1e4d1; text-decoration: none; }
.card h2 a:hover { color: var(--amber); text-decoration: underline; }
.card p:last-child { margin-bottom: 0; }
.status { color: #d9b98d; font-size: .875rem; }
.evidence { color: var(--muted); font-size: .875rem; border-left: 1px solid #706047; padding: 4px 20px; margin: 32px 0; }
.evidence p { margin-bottom: 8px; }
.result { background: #22211e; border: 1px solid var(--edge); padding: 28px; max-width: 800px; border-radius: 6px; }
dt { color: var(--muted); text-transform: capitalize; font-size: .875rem; }
dd { margin: 0 0 16px; }
.note { padding: 28px; margin: 20px 0; border: 1px solid var(--edge); border-radius: 6px; background: #201e1b; }
.field { display: flex; flex-direction: column; gap: 8px; font-size: .875rem; }
.story-form { max-width: 800px; display: flex; flex-wrap: wrap; gap: 20px; margin: 32px 0; }
.story-form > .field:first-child { width: 100%; }
.story-form > .field { flex: 1 1 180px; }
#generation-reason { width: 100%; font-size: .875rem; color: var(--muted); margin: 0; }
pre { width: 100%; min-height: 44px; white-space: pre-wrap; }
iframe { width: 100%; height: 65dvh; min-height: 400px; border: 1px solid var(--edge); }
.desktop { background: radial-gradient(ellipse at top right, #32291e, #191918 75%); }
.desktop > .cards { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.desktop > .cards .card { padding: 24px 18px; border-color: #625340; }
.desktop > .cards h2 { font-size: 1.15rem; }
.fallback-message { margin: 28px 0; color: var(--muted); }
[hidden] { display: none !important; }

/* The scene is the first viewport. Its overlays never own the canvas's pointer events. */
.immersive .page { min-height: 100dvh; }
.immersive header {
  position: absolute;
  inset: 0 0 auto;
  z-index: 10;
  border: 0;
  background: linear-gradient(#10100fb8, #10100f52 60%, transparent);
  padding-bottom: 48px;
  pointer-events: none;
}
.immersive header a, .immersive header nav { pointer-events: auto; }
.immersive header a { text-shadow: 0 1px 2px #000c, 0 1px 10px #000; }
/* Bright sky and sunlit crowns pass behind the links; the panel keeps them at reading contrast. */
.immersive header nav { background: #10100fb8; border: 1px solid #ffffff14; border-radius: 10px; padding: 9px 18px; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.scene-panel { position: relative; height: 100vh; height: 100dvh; width: 100%; background: #181817; isolation: isolate; }
.scene-panel canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; border: 0; border-radius: 0; touch-action: pan-y; }
.scene-panel::after { content: ''; position: absolute; inset: 45% 0 0; z-index: 1; pointer-events: none; background: radial-gradient(ellipse 62% 80% at 0% 100%, #0b0b0ad0, #0b0b0a70 42%, transparent 74%), linear-gradient(transparent 72%, #0b0b0a66); }
.scene-caption { position: absolute; left: clamp(24px, 3vw, 48px); bottom: 36px; z-index: 2; max-width: min(440px, 38vw); pointer-events: none; text-shadow: 0 2px 12px #000; }
.caption-headline { font-size: clamp(1.2rem, 1.9vw, 1.65rem); line-height: 1.3; font-weight: 450; letter-spacing: -.025em; margin: 0 0 12px; }
.caption-about { color: #d7d0c4; font-size: .8rem; line-height: 1.45; text-wrap: balance; margin: 0; }
.scene-status { position: absolute; z-index: 3; top: 100px; left: clamp(24px, 3vw, 48px); right: 24px; max-width: 600px; font-size: .8rem; color: #e1d9cc; text-shadow: 0 1px 5px #000; pointer-events: none; }
.scene-status.is-ready { width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.scene-dock { position: absolute; right: clamp(24px, 3vw, 48px); bottom: 32px; z-index: 4; display: flex; gap: 8px; align-items: flex-end; max-width: calc(100% - 48px); }
.scene-dock button, .scene-dock summary {
  font-size: .75rem;
  line-height: 1.4;
  padding: 11px 12px;
  background: #1c1b18e8;
  color: #eee7dc;
  border: 1px solid #888073;
  border-radius: 5px;
  min-height: 44px;
}
.scene-dock button:hover, .scene-dock summary:hover { background: #3a3228; }
.scene-dock button:disabled { color: #b8afa1; border-color: #655e52; }
.scene-dock summary { display: flex; align-items: center; cursor: pointer; list-style: none; user-select: none; }
.scene-dock summary::-webkit-details-marker { display: none; }
.scene-dock summary::after { content: '+'; margin-left: 12px; color: #cbb99e; }
.scene-dock details[open] > summary::after { content: "\2212"; }
.studio-tools > summary { display: none; }
.scene-controls { display: flex; gap: 6px; }
.scene-picker { position: relative; }
.picker-options, .hotspots {
  position: absolute;
  bottom: calc(100% + 12px);
  right: 0;
  background: #1a1917fa;
  padding: 10px;
  border: 1px solid #76664f;
  border-radius: 6px;
  box-shadow: 0 12px 48px #0006;
  max-height: min(440px, 55dvh);
  overflow-y: auto;
  width: 210px;
  margin: 0;
}
.picker-options { display: grid; gap: 4px; }
.picker-options button { text-align: left; border-color: transparent; background: transparent; }
.picker-options button[aria-pressed=true] { color: var(--amber); background: #393126; }
.studio-links { position: relative; }
.hotspots { list-style: none; width: 254px; }
.hotspots button { width: 100%; border-color: transparent; text-align: left; background: transparent; }
.scene-help { display: none; }
.explore-content { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); min-height: 0; }
.explore-content:focus-within { position: relative; width: auto; height: auto; clip-path: none; padding: 40px; }

@media (max-width: 1100px) and (min-width: 701px) {
  .scene-caption { bottom: 108px; max-width: 460px; }
  .scene-dock { left: 24px; right: 24px; justify-content: flex-end; }
}
@media (max-width: 700px) {
  header { padding: 14px 20px; display: grid; grid-template-columns: 90px 1fr; gap: 12px; }
  .wordmark { max-width: 90px; line-height: 1.5; font-size: .85rem; }
  nav { display: grid; grid-template-columns: repeat(3, auto); gap: 0 12px; justify-content: end; }
  nav a { font-size: .75rem; }
  .immersive header { padding-bottom: 28px; }
  .immersive header nav { padding: 2px 12px; }
  .page { padding: 16px 24px 72px; }
  h1 { margin: 36px 0 24px; font-size: 2.35rem; }
  .app-bar { gap: 8px; }
  .app-bar button { font-size: .75rem; padding: 8px 10px; }
  .cards { gap: 14px; margin-bottom: 40px; }
  .card { padding: 24px; }
  .desktop > .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .note { padding: 24px; }
  .story-form > .field { width: 100%; flex-basis: 100%; }
  .scene-caption { left: 24px; right: 24px; bottom: 100px; max-width: none; }
  .caption-headline { font-size: 1.2rem; max-width: 330px; }
  .caption-about { font-size: .75rem; }
  .scene-status { top: 132px; font-size: .75rem; }
  .scene-dock { right: 20px; left: 20px; bottom: max(20px, env(safe-area-inset-bottom)); max-width: none; justify-content: space-between; gap: 6px; }
  .scene-dock > button, .scene-dock > details > summary { padding: 10px; font-size: .7rem; }
  .scene-dock summary::after { margin-left: 8px; }
  .studio-tools > summary { display: flex; }
  .studio-tools[open] { position: static; }
  .studio-tools[open] .scene-controls { position: absolute; bottom: 66px; left: 0; right: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 16px; border: 1px solid #76664f; border-radius: 7px; background: #1c1a17fa; }
  .scene-controls > .scene-picker:first-child { grid-column: 1 / -1; }
  .scene-controls summary { justify-content: space-between; }
  .picker-options { width: min(254px, 75vw); max-height: 35dvh; bottom: calc(100% + 8px); }
  .scene-controls > .scene-picker:first-child .picker-options { left: 0; right: auto; }
  .scene-controls > .scene-picker:nth-child(2) .picker-options { left: 0; right: auto; }
  .scene-controls > .scene-picker:nth-child(3) .picker-options { right: 0; }
  .hotspots { width: min(300px, calc(100vw - 40px)); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Authored studio launch. All text sits on an opaque, contrast-controlled surface. */
.studio-tools > summary { display: flex; }
.studio-tools { position: relative; }
.studio-tools[open] .scene-controls {
  position: absolute;
  right: 0;
  bottom: 58px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 280px;
  padding: 14px;
  border: 1px solid #76664f;
  border-radius: 7px;
  background: #1c1a17;
}
.studio-tools[open] .scene-help {
  display: block;
  position: absolute;
  bottom: 155px;
  right: 0;
  width: 280px;
  padding: 14px;
  margin: 0;
  background: #1c1a17;
  color: #eeeae2;
  font-size: 14px;
  border-radius: 7px;
}
.scene-panel[data-dev=false] .studio-tools[open] .scene-help { bottom: 136px; }
.studio-card {
  position: fixed;
  z-index: 6;
  width: min(320px, calc(100vw - 32px));
  padding: 22px;
  color: #eeeae2;
  background: #201e1b;
  border: 1px solid #8f7b5c;
  border-radius: 10px;
  box-shadow: 0 16px 56px #0008;
  font-size: 16px;
  line-height: 1.55;
}
.studio-card h2 { margin: 0 0 12px; font-size: 22px; }
.studio-card p { margin: 0 0 18px; }
.studio-card-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.studio-card-actions a { color: #e8bd86; }
.studio-card:focus { outline: 2px solid #e8bd86; outline-offset: 4px; }
.screen-layer {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100dvh;
  max-width: none;
  overflow-y: auto;
  z-index: 20;
  transform-origin: 0 0;
  background: #191918;
  will-change: transform, opacity;
}
.screen-layer.desktop, .desktop { background: radial-gradient(ellipse at top right, #32291e, #191918 75%); }
.desktop-dock { padding: 12px 20px; background: #25231f; border: 1px solid #625340; border-radius: 8px; }
.desktop-dock a { font-size: 16px; }
@media (max-width: 700px) {
  .studio-tools[open] .scene-controls { left: auto; right: 0; width: min(280px, calc(100vw - 40px)); }
  .studio-tools[open] .scene-help { width: min(280px, calc(100vw - 40px)); }
  .scene-panel[data-dev=false] .studio-tools[open] .scene-help { bottom: 58px; }
  .scene-panel[data-dev=false] .studio-tools[open] .scene-controls:empty { display: none; }
}

/* The same logical desktop composition is drawn on the Air canvas and laid out in HTML. */
.desktop-hub { position: relative; width: 100%; max-width: 1000px; aspect-ratio: 1000 / 625; margin: 28px auto 48px; transform-origin: 0 0; background: #211e19; }
.desktop-hub-art { position: absolute; width: 1000px; height: 625px; transform-origin: 0 0; color: #eeeae2; background: #211e19; font-weight: 550; }
.desktop-hub-art h1 { position: absolute; margin: 0; font-size: 42px; line-height: 1.2; letter-spacing: normal; font-weight: 550; }
.desktop-app { position: absolute; display: block; padding: 0; border: 2px solid #826b4d; border-radius: 0; color: #eeeae2; background: #332d25; text-decoration: none; }
.desktop-app-icon { position: absolute; }
.desktop-app-label { position: absolute; left: 0; right: 0; white-space: pre-line; text-align: center; font-size: 36px; line-height: 1.2; }
.desktop-hub-dock { position: absolute; left: 40px; top: 420px; width: 920px; height: 160px; display: block; background: #28231d; }
.desktop-hub-dock a { position: absolute; padding: 0; display: block; color: #eeeae2; }
.desktop-dock-icon { position: absolute; left: 65px; top: 24px; width: 38px; height: 38px; }
.desktop-dock-label { position: absolute; left: 0; right: 0; top: 86px; text-align: center; font-size: 28px; line-height: 1.2; }
.desktop-app:hover, .desktop-hub-dock a:hover { background: #493c2c; }
.screen-layer.desktop { padding: 16px; }

.scene-objects { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.studio-object { position: absolute; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; background: transparent; border-radius: 50%; transform: translate(-50%, -50%); pointer-events: auto; cursor: pointer; }
.studio-object[data-object=air] { width: 56px; height: 56px; }
.studio-object:hover { background: transparent; }
.object-dot { display: grid; place-items: center; width: 22px; height: 22px; border: 4px solid #15130f; border-radius: 50%; color: #15130f; background: #f5ead9; font: 700 13px/1 system-ui; box-shadow: 0 1px 4px #000b; }
.studio-object[data-object=air] .object-dot { width: 30px; height: 30px; border-width: 4px; background: #ffce8b; font-size: 20px; }
.object-name { position: absolute; display: none; width: max-content; max-width: 180px; padding: 7px 10px; border: 1px solid #8f7b5c; border-radius: 5px; color: #eeeae2; background: #201e1b; font: 550 12px/1.4 system-ui; white-space: nowrap; pointer-events: none; }
.studio-object[data-object=air] .object-name, .studio-object:hover .object-name, .studio-object:focus-visible .object-name { display: block; }
.studio-object[data-label-side=right] .object-name { left: calc(100% + 2px); top: 50%; transform: translateY(-50%); }
.studio-object[data-label-side=left] .object-name { right: calc(100% + 2px); top: 50%; transform: translateY(-50%); }
.studio-object[data-label-side=above] .object-name { left: 50%; bottom: calc(100% + 2px); transform: translateX(-50%); }
.studio-object:focus-visible { outline: 3px solid #ffce8b; outline-offset: 1px; box-shadow: 0 0 0 7px #15130f; }

/* Render the studio while its context warms, then reveal the complete public view. */
.scene-panel[data-context-ready="false"] > canvas { visibility: hidden; }

/* The wordmark is a single name; its tail shares the lead's baseline. */
.wordmark { display: inline-flex; align-items: baseline; white-space: nowrap; gap: 0; }
.wordmark-tail { font-size: .5em; letter-spacing: 0; }
#identity { font-size: 24px; font-weight: 500; letter-spacing: -.035em; max-width: none; }
#nav { align-items: center; }
#nav > button, #nav summary { font-size: 13px; padding: 8px 10px; }
.nav-objects { position: relative; }
.nav-mobile-apps { display: none; position: relative; }
.nav-objects summary { cursor: pointer; }
.nav-object-links { position: absolute; z-index: 30; right: 0; top: calc(100% + 10px); display: grid; width: 260px; max-height: 65dvh; overflow-y: auto; gap: 4px; padding: 12px; background: #24221e; border: 1px solid #897454; border-radius: 7px; }
.nav-object-links button { text-align: left; font-size: 14px; background: transparent; border-color: transparent; }
.nav-object-links a { padding: 8px 10px; font-size: 14px; }
.immersive header button, .immersive header summary { pointer-events: auto; }
.plain-nav { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 24px 0; }
@media (max-width: 700px) {
  header { grid-template-columns: 98px minmax(0, 1fr); padding: 10px 16px; gap: 6px; }
  #identity { font-size: 20px; }
  #nav { display: flex; flex-wrap: nowrap; justify-content: space-between; gap: 2px; }
  #nav > .nav-shortcut { display: none; }
  .nav-mobile-apps { display: block; }
  #nav > button, #nav summary { font-size: 11px; padding: 6px; }
  .immersive header nav { padding: 6px 8px; }
}
