:root {
  --bg: #07070a;
  --bg-2: #0d0d12;
  --ink: #ece6da;
  --ink-2: #b9b2a5;
  --muted: #7d776d;
  --line: rgba(236, 230, 218, 0.12);
  --line-2: rgba(236, 230, 218, 0.22);
  --gold: #d8b46a;
  --gold-2: #f0d9a0;
  --glass: rgba(14, 13, 18, 0.72);
  --serif: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  --radius: 14px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body.studio-open { overflow: hidden; }
a { color: inherit; }
.mono { font-family: var(--mono); font-size: 0.92em; letter-spacing: -0.01em; }
.small { font-size: 0.8rem; }
kbd {
  font-family: var(--mono); font-size: 0.75rem; padding: 1px 6px; border-radius: 5px;
  border: 1px solid var(--line-2); background: rgba(255, 255, 255, 0.04);
}
::selection { background: rgba(216, 180, 106, 0.35); }

/* ------------------------------------------------------------------ nav */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px clamp(16px, 4vw, 48px);
  transition: background 0.4s, backdrop-filter 0.4s, padding 0.4s;
}
.nav.scrolled { background: rgba(7, 7, 10, 0.72); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); padding-top: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--gold-2); font-family: var(--serif); font-size: 1.2rem; letter-spacing: 0.01em; }
.brand span { color: var(--ink); }
.nav nav { display: flex; gap: clamp(14px, 2.5vw, 32px); align-items: center; }
.nav nav a { text-shadow: 0 1px 8px rgba(0, 0, 0, 0.6); text-decoration: none; color: var(--ink-2); font-size: 0.9rem; letter-spacing: 0.02em; transition: color 0.2s; }
.nav nav a:hover { color: var(--ink); }
.nav .nav-cta { color: var(--bg) !important; background: var(--gold); padding: 8px 16px; border-radius: 999px; font-weight: 500; }
.nav .nav-cta:hover { background: var(--gold-2); }
@media (max-width: 720px) {
  .nav nav a:not(.nav-cta) { display: none; }
}

/* ------------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px; text-decoration: none; cursor: pointer;
  padding: 13px 24px; border-radius: 999px; font: 500 0.95rem var(--sans); letter-spacing: 0.01em;
  border: 1px solid transparent; transition: transform 0.2s, background 0.2s, border-color 0.2s, color 0.2s;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--gold); color: #120e06; }
.btn-primary:hover { background: var(--gold-2); }
.btn-ghost { border-color: var(--line-2); color: var(--ink); background: rgba(7, 7, 10, 0.3); backdrop-filter: blur(6px); }
.btn-ghost:hover { border-color: var(--ink-2); }

.eyebrow { font: 500 0.75rem var(--sans); letter-spacing: 0.22em; text-transform: uppercase; color: var(--gold); margin: 0 0 14px; }

/* ------------------------------------------------------------------ hero */
.hero { position: relative; height: 100vh; height: 100svh; min-height: 560px; overflow: hidden; }
#hero-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hero-shade {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(120% 90% at 20% 80%, rgba(7, 7, 10, 0.75) 0%, rgba(7, 7, 10, 0.1) 55%, transparent 70%),
    linear-gradient(to bottom, rgba(7, 7, 10, 0.7) 0%, rgba(7, 7, 10, 0.2) 14%, transparent 28%, transparent 60%, var(--bg) 100%);
}
.hero-content { position: absolute; left: clamp(16px, 6vw, 96px); bottom: clamp(80px, 14vh, 160px); max-width: 680px; }
.hero-title {
  font-family: var(--serif); font-weight: 400; font-size: clamp(3.4rem, 11vw, 9.5rem); line-height: 0.9; margin: 0 0 22px;
  text-shadow: 0 2px 40px rgba(7, 7, 10, 0.35);
  letter-spacing: -0.035em; font-variation-settings: 'opsz' 144;
}
.hero-title em { font-style: italic; color: var(--gold-2); }
.hero-sub { font-size: clamp(1rem, 1.5vw, 1.2rem); color: var(--ink-2); max-width: 520px; margin: 0 0 30px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.hero-caption { position: absolute; right: clamp(16px, 4vw, 48px); bottom: 28px; color: var(--ink-2); font-size: 0.78rem; opacity: 0.8; }
.scroll-cue { position: absolute; left: 50%; bottom: 26px; width: 22px; height: 36px; border: 1px solid var(--line-2); border-radius: 12px; transform: translateX(-50%); }
.scroll-cue span { position: absolute; left: 50%; top: 7px; width: 3px; height: 7px; margin-left: -1.5px; border-radius: 2px; background: var(--ink-2); animation: cue 2s infinite; }
@keyframes cue { 0% { opacity: 0; transform: translateY(0); } 30% { opacity: 1; } 100% { opacity: 0; transform: translateY(12px); } }
@media (max-width: 720px) { .scroll-cue, .hero-caption { display: none; } }

/* ------------------------------------------------------------------ sections */
section { position: relative; }
.section-head { max-width: 760px; margin: 0 auto 48px; padding: 0 16px; text-align: center; }
.section-head h2 { font-family: var(--serif); font-weight: 300; font-size: clamp(2.2rem, 5vw, 3.8rem); line-height: 1.05; letter-spacing: -0.02em; margin: 0 0 18px; }
.section-sub { color: var(--ink-2); font-size: 1.05rem; margin: 0 auto; max-width: 620px; }

.manifesto { padding: clamp(80px, 14vw, 180px) clamp(16px, 6vw, 96px) clamp(60px, 10vw, 140px); max-width: 1180px; margin: 0 auto; }
.lede { font-family: var(--serif); font-weight: 300; font-size: clamp(1.7rem, 3.6vw, 3rem); line-height: 1.22; letter-spacing: -0.015em; margin: 0 0 56px; }
.lede em { color: var(--gold-2); }
.manifesto-cols { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(24px, 5vw, 72px); color: var(--ink-2); font-size: 1.05rem; }
.manifesto-cols em { color: var(--ink); }
@media (max-width: 760px) { .manifesto-cols { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------------ collection */
.collection { padding: 60px clamp(12px, 3vw, 40px) 120px; }
.filters { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: -16px auto 36px; padding: 0 16px; }
.filters button {
  font: 500 0.8rem var(--sans); letter-spacing: 0.04em; color: var(--ink-2); background: transparent; cursor: pointer;
  border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px; transition: all 0.2s;
}
.filters button:hover { color: var(--ink); border-color: var(--line-2); }
.filters button.on { color: #120e06; background: var(--ink); border-color: var(--ink); }

.grid {
  display: grid; gap: clamp(10px, 1.4vw, 18px); max-width: 1500px; margin: 0 auto;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
  grid-auto-flow: dense;
}
.card {
  position: relative; overflow: hidden; border-radius: var(--radius); background: var(--bg-2); cursor: pointer;
  aspect-ratio: 4 / 3; border: 1px solid var(--line); isolation: isolate;
  opacity: 0; transform: translateY(24px); transition: opacity 0.9s, transform 0.9s cubic-bezier(.2, .7, .2, 1);
}
.card.in { opacity: 1; transform: none; }
.card.wide { grid-column: span 2; aspect-ratio: 8 / 3; }
.card.tall { grid-row: span 2; aspect-ratio: auto; }
@media (max-width: 760px) { .card.wide { grid-column: auto; aspect-ratio: 4 / 3; } .card.tall { grid-row: auto; aspect-ratio: 4 / 3; } }
.card img, .card canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 1.6s cubic-bezier(.2, .7, .2, 1), filter 0.6s; }
.card canvas.live, .ch-figure canvas.live { position: absolute; inset: 0; width: 100%; height: 100%; display: block; opacity: 0; transition: opacity 0.7s, transform 1.6s cubic-bezier(.2, .7, .2, 1); pointer-events: none; }
.card canvas.live.on, .ch-figure canvas.live.on { opacity: 1; }
.card .meta {
  position: absolute; inset: auto 0 0 0; padding: 60px 20px 18px; z-index: 2;
  background: linear-gradient(to top, rgba(5, 5, 8, 0.85), rgba(5, 5, 8, 0.4) 55%, transparent);
  transform: translateY(8px); opacity: 0.0; transition: all 0.45s;
}
.card:hover .meta, .card:focus-visible .meta { transform: none; opacity: 1; }
@media (hover: none) { .card .meta { opacity: 1; transform: none; } }
.card h3 { font-family: var(--serif); font-style: italic; font-weight: 400; font-size: 1.5rem; margin: 0; letter-spacing: -0.01em; }
.card .kind { font-size: 0.72rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--gold); margin: 0 0 4px; }
.card .eq { font-family: var(--mono); font-size: 0.78rem; color: var(--ink-2); margin: 6px 0 0; }
.card .open { position: absolute; top: 14px; right: 14px; z-index: 2; font-size: 0.72rem; letter-spacing: 0.08em; padding: 6px 12px; border-radius: 999px; background: rgba(7, 7, 10, 0.6); backdrop-filter: blur(8px); border: 1px solid var(--line-2); opacity: 0; transition: opacity 0.4s; }
.card:hover .open { opacity: 1; }
.card .loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 0.8rem; letter-spacing: 0.1em; }
.card.hidden { display: none; }

/* ------------------------------------------------------------------ atlas */
.atlas { padding: 100px clamp(12px, 3vw, 40px) 140px; background: radial-gradient(60% 50% at 50% 50%, rgba(216, 180, 106, 0.05), transparent 70%); }
.atlas-stage { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(10px, 2vw, 24px); max-width: 1200px; margin: 0 auto; }
@media (max-width: 760px) { .atlas-stage { grid-template-columns: 1fr; } }
.atlas-panel { position: relative; margin: 0; aspect-ratio: 1; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: #000; }
.atlas-panel canvas { width: 100%; height: 100%; display: block; touch-action: none; }
.atlas-panel:first-child canvas { cursor: crosshair; }
.atlas-panel figcaption { position: absolute; left: 14px; bottom: 12px; font-size: 0.8rem; color: var(--ink-2); background: rgba(7, 7, 10, 0.55); padding: 4px 10px; border-radius: 8px; backdrop-filter: blur(6px); }
.atlas-marker { position: absolute; width: 18px; height: 18px; margin: -9px 0 0 -9px; border: 1.5px solid var(--gold-2); border-radius: 50%; pointer-events: none; box-shadow: 0 0 0 4px rgba(240, 217, 160, 0.15), 0 0 18px rgba(240, 217, 160, 0.5); transition: left 0.05s, top 0.05s; }
.atlas-marker::after { content: ''; position: absolute; left: 50%; top: 50%; width: 3px; height: 3px; margin: -1.5px; background: var(--gold-2); border-radius: 50%; }
.atlas-hint { text-align: center; color: var(--muted); font-size: 0.88rem; margin-top: 22px; }
.atlas-hint a { color: var(--gold); text-decoration: none; }

/* ------------------------------------------------------------------ mathematics */
.math { padding: 100px clamp(16px, 4vw, 48px) 80px; }
.chapter { display: grid; grid-template-columns: 1.05fr 1fr; gap: clamp(28px, 6vw, 96px); max-width: 1240px; margin: 0 auto clamp(90px, 12vw, 160px); align-items: center; }
.chapter:nth-child(even) .ch-figure { order: -1; }
@media (max-width: 860px) { .chapter { grid-template-columns: 1fr; } .chapter:nth-child(even) .ch-figure { order: 0; } }
.ch-num { font-family: var(--serif); font-style: italic; color: var(--gold); font-size: 1.1rem; margin: 0 0 6px; }
.chapter h3 { font-family: var(--serif); font-weight: 300; font-size: clamp(1.9rem, 3.4vw, 2.8rem); line-height: 1.08; margin: 0 0 22px; letter-spacing: -0.02em; }
.chapter p { color: var(--ink-2); margin: 0 0 16px; }
.chapter p strong { color: var(--ink); font-weight: 500; }
.eqn {
  font-family: var(--mono); font-size: clamp(0.95rem, 1.6vw, 1.15rem); color: var(--ink); margin: 26px 0; padding: 18px 22px;
  border-left: 2px solid var(--gold); background: linear-gradient(90deg, rgba(216, 180, 106, 0.08), transparent); border-radius: 0 10px 10px 0;
  overflow-x: auto;
}
.eqn .note { display: block; color: var(--muted); font-size: 0.78rem; margin-top: 6px; font-family: var(--sans); }
.ch-figure { margin: 0; position: relative; border-radius: var(--radius); overflow: hidden; aspect-ratio: 1; border: 1px solid var(--line); cursor: pointer; background: var(--bg-2); }
.ch-figure img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 1.8s cubic-bezier(.2, .7, .2, 1); }
.ch-figure figcaption { z-index: 1; position: absolute; left: 0; right: 0; bottom: 0; padding: 40px 18px 14px; font-size: 0.82rem; color: var(--ink-2); background: linear-gradient(to top, rgba(5, 5, 8, 0.8), transparent); }
.ch-figure figcaption b { color: var(--gold); font-weight: 500; }
.ch-meta { font-size: 0.82rem; color: var(--muted); border-top: 1px solid var(--line); padding-top: 14px; margin-top: 22px; }
.ch-meta a { color: var(--gold); text-decoration: none; }

/* ------------------------------------------------------------------ coda */
.coda { padding: clamp(80px, 12vw, 160px) 16px; text-align: center; border-top: 1px solid var(--line); background: radial-gradient(50% 60% at 50% 100%, rgba(216, 180, 106, 0.08), transparent 70%); }
.coda-inner { max-width: 860px; margin: 0 auto; }
.coda blockquote { font-family: var(--serif); font-weight: 300; font-style: italic; font-size: clamp(1.5rem, 3.2vw, 2.4rem); line-height: 1.3; margin: 0 0 18px; }
.coda .cite { color: var(--muted); margin: 0 0 36px; }
.footer { padding: 40px 16px 56px; text-align: center; color: var(--muted); font-size: 0.85rem; border-top: 1px solid var(--line); }
.footer p { margin: 6px 0; }

/* reveal on scroll */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity 1s, transform 1s cubic-bezier(.2, .7, .2, 1); }
.reveal.in { opacity: 1; transform: none; }

/* ================================================================== STUDIO */
.studio { position: fixed; inset: 0; z-index: 50; background: #000; display: none; }
.studio.open { display: block; animation: fadein 0.5s; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.stage { position: absolute; inset: 0; touch-action: none; cursor: grab; transition: left 0.45s cubic-bezier(.2, .8, .2, 1); }
@media (min-width: 721px) { .studio:not(.panel-hidden) .stage { left: 364px; } }
.stage.dragging { cursor: grabbing; }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* draggable roots (Newton, free roots) */
#handles { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; display: none; }
#handles.on { display: block; }
.handle { pointer-events: auto; cursor: grab; opacity: 0.35; transition: opacity 0.6s; }
.stage.awake .handle, .handle.held { opacity: 1; }
.studio.ui-hidden .handle { opacity: 0 !important; pointer-events: none; }
.handle .hit { fill: transparent; }
.handle .ring { fill: rgba(0, 0, 0, 0.15); stroke: rgba(255, 255, 255, 0.92); stroke-width: 1.5; filter: drop-shadow(0 0 3px rgba(0, 0, 0, 0.8)); transition: r 0.2s, stroke 0.2s; }
.handle .core { fill: #fff; }
.handle:hover .ring, .handle.held .ring { r: 11px; stroke: var(--gold-2); }
.handle.held { cursor: grabbing; }

.progress { position: absolute; left: 0; right: 0; top: 0; height: 2px; z-index: 3; pointer-events: none; opacity: 0; transition: opacity 0.6s; }
.progress.on { opacity: 1; }
.progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, transparent, var(--gold-2)); transition: width 0.2s; }

.panel {
  position: absolute; top: 12px; left: 12px; bottom: 12px; width: 340px; z-index: 5;
  display: flex; flex-direction: column;
  background: var(--glass); backdrop-filter: blur(22px) saturate(1.2); -webkit-backdrop-filter: blur(22px) saturate(1.2);
  border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  transition: transform 0.45s cubic-bezier(.2, .8, .2, 1), opacity 0.35s;
}
.studio.panel-hidden .panel { transform: translateX(calc(-100% - 24px)); opacity: 0; pointer-events: none; }
.panel-show { position: absolute; top: 16px; left: 16px; z-index: 4; opacity: 0; pointer-events: none; transition: opacity 0.3s; }
.studio.panel-hidden .panel-show { opacity: 1; pointer-events: auto; }
.studio.ui-hidden .panel-show, .studio.ui-hidden .stage-ui, .studio.ui-hidden .panel, .studio.ui-hidden .save-menu { opacity: 0 !important; pointer-events: none !important; }
.studio.ui-hidden .stage { left: 0 !important; bottom: 0 !important; }

.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 10px 16px; border-bottom: 1px solid var(--line); }
.brand.small { font-family: var(--sans); font-size: 0.82rem; color: var(--ink-2); gap: 4px; }
.brand.small:hover { color: var(--ink); }
.panel-title { font-family: var(--serif); font-style: italic; font-size: 1.15rem; color: var(--gold-2); }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line); background: rgba(7, 7, 10, 0.5); color: var(--ink-2); cursor: pointer; backdrop-filter: blur(10px); }
.icon-btn:hover { color: var(--ink); border-color: var(--line-2); }

.panel-body { flex: 1; overflow-y: auto; padding: 14px 16px 18px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent; }
.types { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.type-btn {
  position: relative; height: 92px; border-radius: 12px; overflow: hidden; cursor: pointer; padding: 0;
  border: 1px solid var(--line); background: #111 center/cover no-repeat; color: var(--ink);
  font: 500 0.8rem var(--sans); letter-spacing: 0.01em; text-align: left; transition: border-color 0.2s, transform 0.2s, filter 0.3s;
  filter: saturate(0.7) brightness(0.8);
}
.type-btn.on, .type-btn:hover { filter: none; }
.type-btn span { position: absolute; left: 0; right: 0; bottom: 0; padding: 22px 9px 7px; background: linear-gradient(to top, rgba(0,0,0,.9), transparent); line-height: 1.2; }
.type-btn b { display: block; font-weight: 600; }
.type-btn i { display: block; font-style: normal; font-size: 0.64rem; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scenes { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 8px; margin-bottom: 6px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent; }
.scene { position: relative; flex: none; width: 74px; height: 52px; border-radius: 8px; overflow: hidden; padding: 0; cursor: pointer; border: 1px solid var(--line); background: #111 center/cover no-repeat; color: var(--ink); transition: transform 0.2s, border-color 0.2s; }
.scene span { position: absolute; inset: auto 0 0 0; padding: 10px 4px 3px; font: 500 0.56rem var(--sans); line-height: 1.1; text-align: left; background: linear-gradient(to top, rgba(0,0,0,.85), transparent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scene:hover { transform: translateY(-1px); border-color: var(--gold); }
.tabs { display: flex; gap: 4px; padding: 3px; margin: 12px 0 4px; border-radius: 11px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); position: sticky; top: -14px; z-index: 3; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.tabs button { flex: 1; font: 600 0.72rem var(--sans); letter-spacing: 0.16em; text-transform: uppercase; padding: 8px; border-radius: 8px; border: 0; background: transparent; color: var(--muted); cursor: pointer; transition: color 0.2s, background 0.2s; }
.tabs button:hover { color: var(--ink); }
.tabs button.on { background: rgba(216, 180, 106, 0.16); color: var(--gold-2); }
.pal-strip { height: 22px; border-radius: 8px; border: 1px solid var(--line-2); margin-bottom: 6px; }
.type-btn:hover { border-color: var(--line-2); transform: translateY(-1px); }
.type-btn.on { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; }
.formula { font-size: 0.82rem; color: var(--gold-2); padding: 10px 12px; border-radius: 10px; background: rgba(216, 180, 106, 0.07); border: 1px solid rgba(216, 180, 106, 0.18); margin-bottom: 6px; line-height: 1.45; }

.group { margin-top: 16px; }
.group-title { display: flex; align-items: center; justify-content: space-between; font-size: 0.68rem; font-weight: 600; letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; }
.ctl { margin: 0 0 11px; }
.ctl-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 0.8rem; color: var(--ink-2); margin-bottom: 4px; }
.ctl-row output { font-family: var(--mono); font-size: 0.74rem; color: var(--ink); opacity: 0.85; }
.lbl { display: inline-flex; align-items: center; gap: 7px; }
.ctl-head { display: flex; align-items: center; font-size: 0.8rem; color: var(--ink); margin: 2px 0 4px; }
.ctl-note { font-size: 0.72rem; color: var(--muted); line-height: 1.45; margin: 0 0 8px; }
.rng { position: relative; }
.ghost { position: absolute; top: 50%; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; background: var(--gold-2); box-shadow: 0 0 8px 2px rgba(240, 206, 130, 0.55); pointer-events: none; transition: opacity 0.4s; }
.studio:not(.drifting) .ghost { opacity: 0 !important; }

/* the ∿ toggle beside a slider: let this parameter drift */
.wob { display: inline-grid; place-items: center; width: 24px; height: 17px; padding: 0; border: 1px solid var(--line-2); border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; transition: color 0.2s, background 0.2s, border-color 0.2s; }
.wob svg { width: 15px; height: 8px; display: block; }
.wob:hover { color: var(--ink); border-color: var(--ink-2); }
.wob.on { color: #17130b; background: var(--gold); border-color: var(--gold); }
.studio.drifting .wob.on svg { animation: wob 2.6s ease-in-out infinite; }
@keyframes wob { 0%, 100% { transform: translateX(-1.5px); } 50% { transform: translateX(1.5px); } }
.wob-inline svg { width: 15px; height: 8px; vertical-align: middle; color: var(--gold-2); }

.ctl.inline { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 0.8rem; color: var(--ink-2); }

input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 20px; background: transparent; margin: 0; cursor: pointer; }
input[type=range]::-webkit-slider-runnable-track { height: 3px; border-radius: 3px; background: linear-gradient(90deg, var(--gold) 0 var(--fill, 50%), rgba(255, 255, 255, 0.14) var(--fill, 50%)); }
input[type=range]::-moz-range-track { height: 3px; border-radius: 3px; background: rgba(255, 255, 255, 0.14); }
input[type=range]::-moz-range-progress { height: 3px; border-radius: 3px; background: var(--gold); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: var(--ink); margin-top: -5.5px; border: 0; box-shadow: 0 0 0 4px rgba(236, 230, 218, 0.1); transition: box-shadow 0.2s; }
input[type=range]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--ink); border: 0; }
input[type=range]:hover::-webkit-slider-thumb { box-shadow: 0 0 0 6px rgba(236, 230, 218, 0.16); }

select, input[type=text], input[type=number] {
  width: 100%; font: 0.82rem var(--sans); color: var(--ink); background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; outline: none;
}
input[type=text] { font-family: var(--mono); letter-spacing: 0.08em; }
select:focus, input:focus { border-color: var(--gold); }
select option { background: #15141a; }

.seg { display: flex; flex-wrap: wrap; gap: 4px; padding: 3px; border-radius: 10px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); }
.seg button { flex: 1 1 auto; font: 500 0.74rem var(--sans); padding: 6px 8px; border-radius: 7px; border: 0; background: transparent; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--ink); color: #111; }

.switch { position: relative; width: 38px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: rgba(255, 255, 255, 0.12); transition: background 0.2s; cursor: pointer; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--ink); transition: transform 0.25s cubic-bezier(.2, .8, .2, 1); }
.switch input:checked + span { background: var(--gold); }
.switch input:checked + span::after { transform: translateX(16px); background: #111; }

.swatches { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.swatch { height: 26px; border-radius: 7px; border: 1px solid var(--line); cursor: pointer; position: relative; padding: 0; }
.swatch:hover { transform: translateY(-1px); }
.swatch.on { outline: 1.5px solid var(--ink); outline-offset: 2px; }
.swatch-name { font-size: 0.72rem; color: var(--muted); margin: 0 0 4px; min-height: 1.2em; }
.swatch-name b { color: var(--ink); font-weight: 500; }
.swatch-group { font-size: 0.62rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); margin: 8px 0 4px; opacity: 0.8; }

.color-row { display: flex; align-items: center; gap: 10px; }
input[type=color] { -webkit-appearance: none; appearance: none; width: 38px; height: 26px; border-radius: 7px; border: 1px solid var(--line-2); background: none; padding: 0; cursor: pointer; }
input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
input[type=color]::-webkit-color-swatch { border: 0; border-radius: 6px; }

.mini-btn { display: inline-flex; align-items: center; gap: 6px; font: 500 0.72rem var(--sans); color: var(--ink-2); background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line); border-radius: 8px; padding: 4px 9px; cursor: pointer; white-space: nowrap; }
.mini-btn:hover { color: var(--ink); border-color: var(--line-2); }
.seed-row { display: flex; gap: 6px; }
.seed-row input { flex: 1; }

.toast { position: absolute; left: 50%; top: 22px; transform: translate(-50%, -20px); z-index: 10; background: var(--ink); color: #111; font-size: 0.82rem; font-weight: 500; padding: 9px 18px; border-radius: 999px; opacity: 0; transition: all 0.35s; pointer-events: none; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

.save-menu { position: absolute; z-index: 12; right: 14px; top: 66px; width: 220px; padding: 8px; border-radius: 14px; background: rgba(20, 19, 25, 0.95); border: 1px solid var(--line-2); box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5); display: none; }
.save-menu.on { display: block; animation: fadein 0.2s; }
.save-title { font-size: 0.68rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); margin: 4px 8px 6px; }
.save-menu button { display: block; width: 100%; text-align: left; font: 0.82rem var(--sans); color: var(--ink); background: transparent; border: 0; border-radius: 8px; padding: 8px 10px; cursor: pointer; }
.save-menu button:hover { background: rgba(255, 255, 255, 0.07); }

@media (max-width: 720px) {
  .panel { top: auto; left: 8px; right: 8px; bottom: 8px; width: auto; height: 46vh; }
  .studio.panel-hidden .panel { transform: translateY(calc(100% + 24px)); }
  .studio:not(.panel-hidden) .stage { bottom: calc(46vh + 8px); }
  .stage { transition: bottom 0.45s cubic-bezier(.2, .8, .2, 1); }
  .save-menu { right: 8px; top: 58px; }
  .hint { display: none; }
}

/* ------------------------------------------------------------------ stage overlay: toolbar + drift dock */
.stage-ui { position: absolute; inset: 0; z-index: 4; pointer-events: none; transition: left 0.45s cubic-bezier(.2, .8, .2, 1), opacity 0.4s; }
@media (min-width: 721px) { .studio:not(.panel-hidden) .stage-ui { left: 364px; } }
.stage-ui > * { pointer-events: auto; }
.stage-ui .hud, .stage-ui .hint { pointer-events: none; }

.toolbar { position: absolute; top: 14px; right: 14px; display: flex; align-items: center; gap: 2px; padding: 5px; border-radius: 16px; background: var(--glass); backdrop-filter: blur(18px) saturate(1.2); -webkit-backdrop-filter: blur(18px) saturate(1.2); border: 1px solid var(--line); box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35); }
.tool { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 12px 0 10px; border: 0; border-radius: 11px; background: transparent; color: var(--ink-2); font: 500 0.78rem var(--sans); cursor: pointer; transition: background 0.2s, color 0.2s; }
.tool.icon-only { padding: 0 9px; }
.tool svg { width: 19px; height: 19px; flex: none; }
.tool:hover { background: rgba(255, 255, 255, 0.07); color: var(--ink); }
.tool-sep { width: 1px; height: 20px; background: var(--line); margin: 0 3px; }
@media (max-width: 1280px) { .tool span { display: none; } .tool { padding: 0 9px; } }

.hud { position: absolute; left: 18px; top: 16px; font-size: 0.7rem; color: rgba(236, 230, 218, 0.55); pointer-events: none; text-shadow: 0 1px 3px #000; line-height: 1.5; max-width: calc(100% - 420px); }
.hud-drift { color: var(--gold-2); letter-spacing: 0.08em; }
.hint { position: absolute; left: 50%; bottom: 200px; transform: translateX(-50%); font-size: 0.74rem; color: rgba(236, 230, 218, 0.75); background: rgba(7, 7, 10, 0.55); padding: 7px 14px; border-radius: 999px; backdrop-filter: blur(10px); border: 1px solid var(--line); transition: opacity 1s; white-space: nowrap; }
.hint.gone { opacity: 0; }

.dock {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); width: min(900px, calc(100% - 32px));
  display: flex; align-items: flex-start; gap: 16px; padding: 14px 16px 12px 14px; border-radius: 24px;
  background: var(--glass); backdrop-filter: blur(22px) saturate(1.3); -webkit-backdrop-filter: blur(22px) saturate(1.3);
  border: 1px solid rgba(216, 180, 106, 0.22); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition: border-color 0.6s, box-shadow 0.6s;
}
.studio.drifting .dock { border-color: rgba(216, 180, 106, 0.45); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(216, 180, 106, 0.12); }
.drift-main {
  position: relative; flex: none; width: 58px; height: 58px; border-radius: 50%; cursor: pointer; display: grid; place-items: center;
  border: 1.5px solid var(--gold); background: radial-gradient(circle at 50% 35%, rgba(216, 180, 106, 0.28), rgba(216, 180, 106, 0.06)); color: var(--gold-2);
  transition: background 0.3s, color 0.3s, transform 0.2s; animation: invite 3.2s ease-in-out infinite;
}
.drift-main:hover { transform: scale(1.04); }
.drift-main svg { width: 26px; height: 26px; }
.drift-main .i-pause { display: none; width: 20px; height: 20px; }
.studio.drifting .drift-main { background: radial-gradient(circle at 50% 30%, var(--gold-2), var(--gold) 70%); color: #17130b; animation: none; }
.studio.drifting .drift-main .i-play { display: none; }
.studio.drifting .drift-main .i-pause { display: block; }
.dm-ring { position: absolute; inset: -1.5px; border-radius: 50%; border: 1.5px solid var(--gold-2); opacity: 0; pointer-events: none; }
.studio.drifting .dm-ring { animation: ring 2.8s ease-out infinite; }
@keyframes ring { 0% { transform: scale(1); opacity: 0.7; } 100% { transform: scale(1.7); opacity: 0; } }
@keyframes invite { 0%, 100% { box-shadow: 0 0 0 0 rgba(216, 180, 106, 0); } 50% { box-shadow: 0 0 22px 2px rgba(216, 180, 106, 0.28); } }
.dock-main { flex: 1; min-width: 0; }
.dock-head { display: flex; align-items: baseline; gap: 10px; margin: 2px 0 8px; }
.dock-title { font-family: var(--serif); font-style: italic; font-size: 1.2rem; color: var(--gold-2); line-height: 1; }
.dock-sub { flex: 1; min-width: 0; font-size: 0.72rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dock-fold { align-self: center; display: grid; place-items: center; width: 26px; height: 22px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); cursor: pointer; }
.dock-fold:hover { color: var(--ink); background: rgba(255, 255, 255, 0.06); }
.dock-fold svg { width: 16px; height: 16px; transition: transform 0.3s; }
.studio.dock-folded .dock-fold svg { transform: rotate(180deg); }
.studio.dock-folded .dock-knobs { display: none; }
.dock-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip { display: inline-flex; align-items: center; gap: 6px; flex: none; padding: 5px 11px 5px 8px; border-radius: 999px; border: 1px solid var(--line-2); background: transparent; color: var(--ink-2); font: 500 0.74rem var(--sans); cursor: pointer; transition: all 0.2s; }
.chip svg { width: 14px; height: 7px; opacity: 0.5; }
.chip em { font-style: normal; font-size: 0.62rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-left: 1px; }
.chip:hover { color: var(--ink); border-color: var(--ink-2); }
.chip.on { border-color: var(--gold); color: var(--gold-2); background: rgba(216, 180, 106, 0.13); }
.chip.on svg { opacity: 1; }
.chip.on em { color: var(--gold); }
.studio.drifting .chip.on svg { animation: wob 2.6s ease-in-out infinite; }
.dock-knobs { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 2px 18px; margin-top: 10px; align-items: end; }
.dock-knobs .voy-row { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.voy-row .ctl { flex: none; }
.voy-row .seg { flex-wrap: nowrap; }

/* lap progress round the drift button */
.lap { position: absolute; inset: -6px; width: calc(100% + 12px); height: calc(100% + 12px); transform: rotate(-90deg); pointer-events: none; }
.lap circle { fill: none; stroke: rgba(216, 180, 106, 0.16); stroke-width: 2; }
.lap #lap-ring { stroke: var(--gold-2); stroke-width: 2.6; stroke-linecap: round; stroke-dasharray: 201.06; stroke-dashoffset: 201.06; opacity: 0; transition: stroke-dashoffset 0.4s linear, opacity 0.6s; filter: drop-shadow(0 0 3px rgba(240, 206, 130, 0.7)); }
.drift-main .lap, .drift-main svg.lap { width: calc(100% + 12px); height: calc(100% + 12px); }

/* the chart: where the voyage is, on its map */
.chart { flex: none; width: 216px; align-self: stretch; display: flex; flex-direction: column; }
.chart.none { display: none; }
.chart-map { position: relative; width: 100%; aspect-ratio: 3 / 2; border-radius: 12px; overflow: hidden; border: 1px solid var(--line-2); cursor: crosshair; touch-action: none; background: #0d0c10; }
.chart-map canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.chart-label { font-size: 0.64rem; color: var(--muted); margin-top: 5px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chart-tabs { position: absolute; left: 5px; top: 5px; display: flex; gap: 3px; }
.chart-tabs button { font: 600 0.62rem var(--sans); letter-spacing: 0.04em; padding: 2px 7px; border-radius: 999px; border: 1px solid var(--line-2); background: rgba(7, 7, 10, 0.7); color: var(--ink-2); cursor: pointer; }
.chart-tabs button.on { background: var(--gold); border-color: var(--gold); color: #17130b; }
.chart-grow { position: absolute; right: 5px; top: 5px; width: 22px; height: 22px; display: grid; place-items: center; padding: 0; border-radius: 7px; border: 1px solid var(--line-2); background: rgba(7, 7, 10, 0.7); color: var(--ink-2); cursor: pointer; opacity: 0; transition: opacity 0.2s; }
.chart-grow svg { width: 13px; height: 13px; }
.chart-map:hover .chart-grow { opacity: 1; }
.studio.chart-big .chart { position: absolute; right: 0; bottom: calc(100% + 12px); width: min(540px, 100%); padding: 10px; border-radius: 20px; background: var(--glass); backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px); border: 1px solid rgba(216, 180, 106, 0.3); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5); }
.studio.chart-big .chart-grow { opacity: 1; }
.studio.dock-folded .chart { display: none; }

/* the name of the place, as the voyage passes it */
.caption { position: absolute; left: 20px; top: 46px; max-width: min(460px, calc(100% - 40px)); pointer-events: none; opacity: 0; transform: translateY(6px); transition: opacity 1.2s, transform 1.2s; text-shadow: 0 1px 14px rgba(0, 0, 0, 0.85), 0 0 2px rgba(0, 0, 0, 0.6); }
.caption.on { opacity: 1; transform: none; }
.caption b { display: block; font: italic 400 1.75rem var(--serif); color: var(--ink); letter-spacing: -0.01em; line-height: 1.15; }
.caption span { display: block; font-size: 0.78rem; color: rgba(236, 230, 218, 0.72); margin-top: 3px; }
.studio:not(.drifting) .caption { opacity: 0; }

/* recording */
.rec-dot { opacity: 0.5; }
.studio.recording #act-record { color: #ff6b5e; }
.studio.recording #act-record span { display: inline; font-family: var(--mono); }
.studio.recording .rec-dot { opacity: 1; animation: rec 1.2s ease-in-out infinite; }
@keyframes rec { 50% { opacity: 0.25; } }
.dock-knobs .ctl { margin: 0; }
.dock-knobs .ctl-row { margin-bottom: 0; font-size: 0.74rem; }
.dock-knobs .seg { padding: 2px; }
.dock-knobs .seg button { padding: 3px 6px; font-size: 0.7rem; }

@media (max-width: 720px) {
  .hud { display: none; }
  .stage-ui { left: 0 !important; bottom: calc(46vh + 8px); transition: bottom 0.45s cubic-bezier(.2, .8, .2, 1); }
  .studio.panel-hidden .stage-ui { bottom: 0; }
  .toolbar { top: 8px; right: 8px; }
  .tool span { display: none; }
  .dock { bottom: 8px; width: calc(100% - 16px); padding: 10px; gap: 10px; }
  .drift-main { width: 50px; height: 50px; }
  .dock-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .chart { width: 132px; }
  .caption { top: 12px; left: 12px; }
  .caption b { font-size: 1.25rem; }
}

@media (prefers-reduced-motion: reduce) {
  .drift-main { animation: none; }
  html { scroll-behavior: auto; }
  .reveal, .card { transition: none; opacity: 1; transform: none; }
}
