/* Still Meadow — glass panels over a living field (the orb presentation's look, made quieter). */
:root {
  --ink: #eef5ea; --muted: #b5c6b6; --dim: #8fa292; --leaf: #7fd18b; --leaf-2: #3f7f46; --line: rgba(255,255,255,.16);
  --glass: rgba(12, 26, 21, .56); --glass-2: rgba(12, 26, 21, .78); --warm: #f1d9a8;
  --display: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --body: ui-sans-serif, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #0c1f1a; color: var(--ink); font: 16px/1.55 var(--body); -webkit-font-smoothing: antialiased; }
a { color: var(--leaf); }
button, input, textarea, select { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--display); font-weight: 500; line-height: 1.15; margin: 0; letter-spacing: .005em; text-wrap: balance; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
#world { position: fixed; inset: 0; z-index: 0; background: #0c1f1a; }
.veil { position: fixed; inset: 0; z-index: 1; pointer-events: none; background: radial-gradient(ellipse at 50% 120%, transparent 30%, rgba(4,10,8,.45) 100%); }
.glass { background: var(--glass); border: 1px solid var(--line); border-radius: 18px; backdrop-filter: blur(14px) saturate(1.1); -webkit-backdrop-filter: blur(14px) saturate(1.1); box-shadow: 0 10px 40px rgba(0,0,0,.28); }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 999px; padding: .72em 1.35em; border: 1px solid rgba(255,255,255,.3); background: rgba(10,25,20,.55);
  color: var(--ink); text-decoration: none; cursor: pointer; font-weight: 600; letter-spacing: .01em; transition: background .4s, border-color .4s, transform .4s; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.btn:hover { border-color: rgba(255,255,255,.6); background: rgba(20,45,36,.7); }
.btn:focus-visible, .chip:focus-visible, .card:focus-visible { outline: 2px solid var(--leaf); outline-offset: 3px; }
.btn.primary { background: color-mix(in srgb, var(--leaf) 85%, #fff); color: #0d1f16; border-color: transparent; }
.btn.primary:hover { background: #a6e6ae; }
.btn.small { padding: .45em .95em; font-size: 14px; }
.btn[disabled] { opacity: .5; cursor: default; }
.iconbtn { width: 46px; height: 46px; padding: 0; border-radius: 50%; }
.iconbtn svg { width: 20px; height: 20px; }

/* the CSS orb avatar: the presentation's chapter badge */
.orb { --s: 56px; position: relative; display: inline-grid; place-items: center; width: var(--s); height: var(--s); border-radius: 50%; flex: none; overflow: hidden;
  background: radial-gradient(circle at 50% 50%, color-mix(in srgb, var(--orb) 45%, #000) 0%, color-mix(in srgb, var(--orb) 22%, #000) 55%, color-mix(in srgb, var(--orb) 70%, #fff) 74%, color-mix(in srgb, var(--orb) 35%, transparent) 86%);
  box-shadow: 0 0 16px color-mix(in srgb, var(--orb) 60%, transparent), 0 0 34px color-mix(in srgb, var(--orb) 30%, transparent), inset 0 0 12px color-mix(in srgb, var(--orb) 80%, transparent); animation: orbglow 4.2s ease-in-out infinite; }
.orb::before { content: ''; position: absolute; inset: -25%; background: conic-gradient(from 0deg, transparent 0 10%, color-mix(in srgb, var(--orb) 60%, #fff) 22%, transparent 38%, transparent 55%, var(--orb) 72%, transparent 88%); filter: blur(5px); opacity: .6; mix-blend-mode: screen; animation: orbswirl 9s linear infinite; }
.orb s { position: absolute; inset: 28%; border-radius: 50%; background: radial-gradient(color-mix(in srgb, var(--orb) 50%, #fff), transparent 70%); animation: orbcore 3.2s ease-in-out infinite; text-decoration: none; }
.orb b { position: absolute; inset: 0; animation: orbswirl 6s linear infinite reverse; }
.orb b::before { content: ''; position: absolute; left: 50%; top: 9%; width: 9%; height: 9%; border-radius: 50%; background: #fff; box-shadow: 0 0 6px #fff, 0 0 12px var(--orb); }
.orb .glyph { position: relative; width: 44%; height: 44%; stroke: #fff; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 0 4px rgba(0,0,0,.5)); }
@keyframes orbglow { 50% { box-shadow: 0 0 22px var(--orb), 0 0 46px color-mix(in srgb, var(--orb) 40%, transparent), inset 0 0 14px var(--orb); } }
@keyframes orbswirl { to { transform: rotate(360deg); } }
@keyframes orbcore { 50% { transform: scale(1.25); opacity: .8; } }
@media (prefers-reduced-motion: reduce) { .orb, .orb::before, .orb s, .orb b { animation: none; } }

/* top bar */
.top { position: fixed; z-index: 5; top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between; padding: 14px max(16px, env(safe-area-inset-left)); pointer-events: none; }
.top > * { pointer-events: auto; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font: 500 19px var(--display); text-shadow: 0 1px 8px rgba(0,0,0,.4); }
.brand .orb { --s: 30px; }

/* ── landing ───────────────────────────────────────────────────────────────────────────────────────────── */
.landing { position: relative; z-index: 2; min-height: 100%; }
.hero { min-height: 92vh; display: grid; place-items: center; padding: 90px 16px 40px; }
.hero .glass { max-width: 620px; padding: clamp(22px, 4vw, 40px); text-align: center; }
.hero h1 { font-size: clamp(34px, 6vw, 58px); }
.hero p { color: var(--muted); font-size: clamp(16px, 2vw, 19px); margin: 16px auto 26px; max-width: 34em; }
.hero .row { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.scrollhint { margin-top: 28px; color: var(--dim); font-size: 14px; }
.spaces { max-width: 1100px; margin: 0 auto; padding: 10px 16px 60px; }
.spaces h2 { font-size: clamp(24px, 3.4vw, 32px); text-shadow: 0 1px 10px rgba(0,0,0,.5); margin-bottom: 6px; }
.spaces .sub { color: var(--muted); margin: 0 0 20px; text-shadow: 0 1px 8px rgba(0,0,0,.5); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.card { display: flex; gap: 14px; align-items: center; padding: 16px; color: var(--ink); text-decoration: none; transition: transform .6s cubic-bezier(.2,.8,.2,1), border-color .6s, background .6s; }
.card:hover { transform: translateY(-3px); border-color: rgba(255,255,255,.35); background: var(--glass-2); }
.card h3 { font-size: 19px; }
.card small { display: block; color: var(--muted); font-size: 13px; margin-top: 3px; }
.card .mine { color: var(--warm); font-size: 12px; }
.empty { padding: 22px; color: var(--muted); }
.foot { max-width: 1100px; margin: 0 auto; padding: 0 16px 40px; color: var(--dim); font-size: 13px; text-shadow: 0 1px 8px rgba(0,0,0,.6); }
.soundtoggle { pointer-events: auto; }

/* ── a space ───────────────────────────────────────────────────────────────────────────────────────────── */
.gate { position: fixed; inset: 0; z-index: 8; display: grid; place-items: center; padding: 16px; background: rgba(4,12,9,.35); transition: opacity 1.6s ease; }
.gate.out { opacity: 0; pointer-events: none; }
.gate .glass { max-width: 460px; width: 100%; padding: 30px 26px; text-align: center; }
.gate .orb { --s: 86px; margin-bottom: 14px; }
.gate h1 { font-size: clamp(28px, 5vw, 40px); }
.gate p { color: var(--muted); margin: 10px 0 22px; }
.subs { position: fixed; z-index: 4; left: 50%; bottom: 112px; transform: translateX(-50%); width: min(760px, calc(100% - 32px)); text-align: center; pointer-events: none; }
.subs p { display: inline-block; margin: 0; padding: 12px 20px; font: 400 clamp(18px, 2.4vw, 24px)/1.45 var(--display); color: #fff; text-shadow: 0 1px 12px rgba(0,0,0,.6);
  background: rgba(8,20,16,.38); border-radius: 14px; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); opacity: 0; transform: translateY(6px); transition: opacity 1.2s ease, transform 1.2s ease; }
.subs p.on { opacity: 1; transform: none; }
.hud { position: fixed; z-index: 5; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 999px; transition: opacity 1.5s; }
.hud.idle { opacity: .25; }
.hud .play { width: 58px; height: 58px; background: color-mix(in srgb, var(--leaf) 85%, #fff); color: #0d1f16; border: 0; }
.hud .play svg { width: 24px; height: 24px; }
.hud .sep { width: 1px; height: 26px; background: var(--line); }
.orbtip { position: fixed; z-index: 4; transform: translate(-50%, -100%); padding: 5px 11px; border-radius: 999px; font-size: 13px; color: #fff; background: rgba(8,22,18,.7); border: 1px solid var(--line); pointer-events: none; white-space: nowrap; transition: opacity .6s; }
.pop { position: fixed; z-index: 7; bottom: 96px; left: 50%; transform: translateX(-50%); width: min(360px, calc(100% - 32px)); padding: 18px 20px; display: none; }
.pop.open { display: block; }
.pop h3 { font-size: 18px; margin-bottom: 10px; }
.pop label { display: grid; grid-template-columns: 90px 1fr; gap: 10px; align-items: center; color: var(--muted); font-size: 14px; margin: 8px 0; }
input[type=range] { width: 100%; accent-color: var(--leaf); height: 26px; }
.sharebox { display: flex; gap: 8px; margin: 8px 0; }
.sharebox input { flex: 1; min-width: 0; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line); background: rgba(0,0,0,.25); }
.note { color: var(--dim); font-size: 13px; }
.toast { position: fixed; z-index: 9; top: 70px; left: 50%; transform: translateX(-50%); padding: 10px 18px; border-radius: 999px; background: rgba(8,22,18,.88); border: 1px solid var(--line); font-size: 14px; opacity: 0; transition: opacity .6s; pointer-events: none; }
.toast.on { opacity: 1; }

/* ── builder ───────────────────────────────────────────────────────────────────────────────────────────── */
.builder { position: fixed; z-index: 6; top: 70px; right: 16px; bottom: 16px; width: min(420px, calc(100% - 32px)); display: flex; flex-direction: column; overflow: hidden; }
.builder header { padding: 18px 20px 0; }
.builder header h2 { font-size: 24px; }
.steps { display: flex; gap: 4px; padding: 12px 14px 0; overflow-x: auto; scrollbar-width: none; }
.steps button { flex: none; border: 0; background: transparent; color: var(--dim); padding: 7px 8px; border-radius: 999px; cursor: pointer; font-size: 13px; font-weight: 600; }
.steps button.on { color: #0d1f16; background: var(--leaf); }
.steps button.done:not(.on) { color: var(--ink); }
.pane { flex: 1; overflow-y: auto; padding: 16px 20px; }
.pane h3 { font-size: 18px; margin: 4px 0 6px; }
.pane .hint { color: var(--muted); font-size: 14px; margin: 0 0 14px; }
.pane label.f { display: block; font-size: 14px; color: var(--muted); margin: 14px 0 6px; }
.pane input[type=text], .pane textarea, .pane select { width: 100%; padding: 11px 13px; border-radius: 12px; border: 1px solid var(--line); background: rgba(0,0,0,.25); outline: none; }
.pane input[type=text]:focus, .pane textarea:focus, .pane select:focus { border-color: var(--leaf); }
.pane textarea { resize: vertical; min-height: 92px; line-height: 1.5; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line); background: rgba(255,255,255,.04); border-radius: 999px; padding: 8px 14px; cursor: pointer; font-size: 14px; transition: background .3s, border-color .3s; }
.chip:hover { border-color: rgba(255,255,255,.4); }
.chip.on { background: color-mix(in srgb, var(--leaf) 26%, transparent); border-color: var(--leaf); }
.glyphs { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.glyphs button { aspect-ratio: 1; border-radius: 12px; border: 1px solid var(--line); background: rgba(255,255,255,.04); cursor: pointer; display: grid; place-items: center; padding: 0; }
.glyphs button.on { border-color: var(--leaf); background: color-mix(in srgb, var(--leaf) 22%, transparent); }
.glyphs .glyph { width: 60%; height: 60%; stroke: var(--ink); fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatches button { width: 32px; height: 32px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; box-shadow: 0 0 10px color-mix(in srgb, var(--c) 60%, transparent); background: var(--c); }
.swatches button.on { border-color: #fff; }
.preview { display: flex; align-items: center; gap: 14px; margin: 18px 0 4px; padding: 12px; border-radius: 14px; background: rgba(255,255,255,.04); }
.preview h3 { margin: 0; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.fields button { text-align: left; padding: 12px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255,255,255,.04); cursor: pointer; }
.fields button.on { border-color: var(--leaf); background: color-mix(in srgb, var(--leaf) 18%, transparent); }
.fields button i { display: block; height: 30px; border-radius: 8px; margin-bottom: 8px; }
.orbcard { border: 1px solid var(--line); border-radius: 16px; padding: 14px; margin: 12px 0; background: rgba(0,0,0,.12); }
.orbcard .head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.orbcard .head b { font: 500 17px var(--display); }
.orbcard .row { display: flex; gap: 8px; margin-top: 10px; align-items: center; flex-wrap: wrap; }
.orbcard .row select { flex: 1; min-width: 150px; }
.breath { display: inline-block; width: 14px; height: 14px; border-radius: 50%; background: var(--leaf); animation: breath 4s ease-in-out infinite; vertical-align: -2px; margin-right: 6px; }
@keyframes breath { 0%, 100% { transform: scale(.6); opacity: .5; } 50% { transform: scale(1.15); opacity: 1; } }
.err { color: #ffb3a6; font-size: 14px; margin: 8px 0 0; }
.builder footer { display: flex; justify-content: space-between; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line); }
.toggle { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: 14px; background: rgba(255,255,255,.04); cursor: pointer; margin: 10px 0; }
.toggle input { margin-top: 4px; width: 18px; height: 18px; accent-color: var(--leaf); }
.toggle small { display: block; color: var(--muted); }
.done-box { text-align: center; padding: 10px 0; }
.done-box .orb { --s: 70px; margin: 8px 0 12px; }
.mini { position: fixed; z-index: 6; top: 70px; right: 16px; display: none; }
body.building .hud, body.building .subs { right: auto; left: calc((100% - min(420px, calc(100% - 32px)) - 16px) / 2); }
@media (max-width: 760px) {
  .builder { top: auto; left: 0; right: 0; bottom: 0; width: 100%; height: 58vh; border-radius: 20px 20px 0 0; border-bottom: 0; }
  body.building .hud { display: none; }
  body.building .subs { left: 50%; bottom: calc(58vh + 12px); }
  .builder.min { height: 64px; }
  .subs { bottom: 100px; }
  .hud { gap: 6px; }
  .hud .iconbtn { width: 42px; height: 42px; }
}
.builder .collapse { display: none; }
@media (max-width: 760px) { .builder .collapse { display: inline-flex; } }
@media (max-width: 440px) { .brand .bt { display: none; } }

/* ── v2: lights, stories, transitions ─────────────────────────────────────────────────────────────────── */
body.onlanding { overflow-y: auto; }
body:not(.onlanding) { overflow: hidden; }
.wash { position: fixed; inset: 0; z-index: 2; pointer-events: none; opacity: 0; transition: opacity 2.4s ease;
  background: radial-gradient(circle at 50% 42%, color-mix(in srgb, var(--wc, #7fd18b) 40%, #fff) 0%, color-mix(in srgb, var(--wc, #7fd18b) 22%, transparent) 30%, rgba(4,12,9,.55) 80%); }
.wash.on { opacity: .55; }
.story { position: fixed; z-index: 6; left: 50%; bottom: calc(max(18px, env(safe-area-inset-bottom)) + 74px); transform: translate(-50%, 16px); width: min(680px, calc(100% - 32px)); padding: 20px 24px 18px;
  text-align: center; opacity: 0; transition: opacity 1.4s ease, transform 1.4s ease; }
.story.in { opacity: 1; transform: translate(-50%, 0); }
.story small { display: block; font: 600 12px/1 var(--body); letter-spacing: .14em; text-transform: uppercase; color: var(--warm); opacity: .85; }
.story h2 { font-size: clamp(22px, 3vw, 30px); margin: 8px 0 10px; }
.story p { min-height: 3em; margin: 0 0 14px; font: 400 clamp(17px, 2.2vw, 22px)/1.5 var(--display); color: #fff; opacity: 0; transform: translateY(6px); transition: opacity 1.1s ease, transform 1.1s ease; }
.story p.on { opacity: 1; transform: none; }
#hint { position: fixed; z-index: 4; left: 50%; bottom: 96px; transform: translateX(-50%); padding: 8px 16px; border-radius: 999px; font-size: 14px; color: var(--muted); background: rgba(8,22,18,.5); backdrop-filter: blur(6px); pointer-events: none; }
.spirits { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.spirits button { text-align: left; padding: 12px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255,255,255,.04); cursor: pointer; }
.spirits button.on { border-color: var(--leaf); background: color-mix(in srgb, var(--leaf) 18%, transparent); }
.libitem { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.libitem div { flex: 1; min-width: 0; } .libitem b { display: block; font: 500 16px var(--display); } .libitem small { color: var(--muted); font-size: 13px; }
.orbcard .head small { text-align: right; }
.credits { max-width: 760px; margin: 90px auto 40px; padding: 24px; }
.credits li { margin: 8px 0; color: var(--muted); }

/* the story's own little animation, in a round window inside the light */
.scenewin { position: fixed; z-index: 5; left: 50%; top: max(80px, 8vh); width: min(56vh, 86vw, 480px); aspect-ratio: 1; transform: translateX(-50%) scale(.92);
  border-radius: 50%; overflow: hidden; opacity: 0; transition: opacity 1.6s ease, transform 1.6s ease; pointer-events: none;
  background: radial-gradient(circle at 50% 45%, rgba(10,24,20,.82) 0%, rgba(6,16,13,.9) 70%, rgba(6,16,13,.6) 100%);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--wc, #7fd18b) 60%, transparent), 0 0 40px color-mix(in srgb, var(--wc, #7fd18b) 35%, transparent), inset 0 0 50px rgba(0,0,0,.6);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.scenewin.in { opacity: 1; transform: translateX(-50%) scale(1); }
.scenewin canvas { width: 100%; height: 100%; display: block; }
@media (max-width: 760px) { .scenewin { top: 76px; width: min(44vh, 84vw); } }

/* a slow iridescent rim around the story window */
.scenewin::after { content: ''; position: absolute; inset: 0; border-radius: 50%; pointer-events: none; animation: rimspin 26s linear infinite; opacity: .85;
  background: conic-gradient(from 0deg, color-mix(in srgb, var(--wc, #7fd18b) 80%, #fff), #ffd88a, #ffc8e0, #b8ecff, #d0c0ff, color-mix(in srgb, var(--wc, #7fd18b) 80%, #fff));
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px)); mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px)); filter: blur(.6px); }
@keyframes rimspin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .scenewin::after { animation: none; } }

/* the narrator's words: soft, low on the screen, never in the way */
.narr { position: fixed; z-index: 4; left: 50%; bottom: calc(max(18px, env(safe-area-inset-bottom)) + 120px); transform: translateX(-50%); width: min(640px, calc(100% - 32px)); text-align: center; pointer-events: none; }
.narr p { display: inline-block; margin: 0; padding: 10px 18px; border-radius: 14px; font: italic 400 clamp(16px, 2vw, 20px)/1.5 var(--display); color: rgba(255,255,255,.92);
  background: rgba(8,20,16,.35); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); text-shadow: 0 1px 10px rgba(0,0,0,.5); opacity: 0; transform: translateY(6px); transition: opacity 1.6s ease, transform 1.6s ease; }
.narr p.on { opacity: 1; transform: none; }
body.onlanding .narr { bottom: max(18px, env(safe-area-inset-bottom)); }
body.building .narr { display: none; }
