:root {
  color-scheme: dark;
  --ink: #f1eee7;
  --muted: #9ca3ad;
  --panel: rgba(10, 14, 22, 0.9);
  --line: rgba(238, 241, 245, 0.17);
  --cyan: #79d8e8;
  --warm: #e9a46e;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.42);
  font-family: Inter, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { width: 100%; min-height: 100%; margin: 0; overflow: hidden; background: #070b13; color: var(--ink); }
button, input, select { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }

#app-canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
#app-canvas.is-grabbing { cursor: grabbing; }
.grain { position: fixed; inset: 0; pointer-events: none; opacity: .08; mix-blend-mode: soft-light; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.7'/%3E%3C/svg%3E"); }

.screen { position: fixed; inset: 0; z-index: 3; pointer-events: none; }
.screen.is-active { pointer-events: auto; }
.screen[hidden] { display: none !important; }
.eyebrow { margin: 0 0 .7rem; color: var(--cyan); font-size: .68rem; font-weight: 700; letter-spacing: .19em; text-transform: uppercase; }

.loading-indicator { position: fixed; z-index: 20; top: 1.4rem; left: 50%; display: flex; align-items: center; gap: .65rem; padding: .65rem .9rem; transform: translateX(-50%); border: 1px solid var(--line); border-radius: 999px; background: rgba(7, 11, 19, .86); color: #c8ced7; font-size: .72rem; letter-spacing: .06em; transition: opacity .35s ease; }
.loading-indicator.is-done { opacity: 0; pointer-events: none; }
.loading-mark { width: .48rem; height: .48rem; border: 1px solid var(--cyan); border-top-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.intro-screen { display: flex; align-items: center; padding: clamp(1.4rem, 5vw, 5rem); background: linear-gradient(90deg, rgba(4, 8, 14, .84) 0%, rgba(4, 8, 14, .36) 48%, transparent 72%); }
.intro-copy { width: min(42rem, 58vw); margin-top: 2vh; }
.intro-copy h1 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(4rem, 10vw, 9.7rem); font-weight: 400; line-height: .75; letter-spacing: -.075em; text-wrap: balance; text-shadow: 0 10px 44px rgba(0, 0, 0, .5); }
.intro-copy h1 em { color: transparent; font-weight: 400; -webkit-text-stroke: 1px rgba(241, 238, 231, .78); }
.intro-deck { max-width: 30rem; margin: 2rem 0; color: #bec4cc; font-family: Georgia, serif; font-size: clamp(1rem, 1.5vw, 1.28rem); line-height: 1.5; }
.intro-actions { display: flex; align-items: center; gap: 1rem; }
.button { min-height: 2.9rem; padding: .75rem 1.15rem; border: 1px solid var(--line); border-radius: 2px; background: rgba(8, 13, 21, .62); cursor: pointer; font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; transition: border-color .2s, background .2s, transform .2s; }
.button:hover { border-color: rgba(121, 216, 232, .7); transform: translateY(-1px); }
.button-primary { border-color: #d7d1c7; background: #e8e3d9; color: #0a0e15; }
.button-primary span { margin-left: 2rem; }
.button-quiet { background: transparent; }
.corner-nav { position: absolute; top: 2rem; right: 2rem; display: flex; gap: 1.4rem; }
.corner-nav button, .topbar nav button { padding: .4rem 0; border: 0; border-bottom: 1px solid transparent; background: none; cursor: pointer; color: #b7bdc5; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; }
.corner-nav button:hover, .topbar nav button:hover { border-color: var(--cyan); color: white; }
.topbar nav #fly-toggle { padding-inline: .65rem; border: 1px solid rgba(121, 216, 232, .35); }
.topbar nav #fly-toggle.is-active { border-color: var(--cyan); background: rgba(121, 216, 232, .12); color: var(--cyan); }
.intro-index { position: absolute; right: 2rem; bottom: 2rem; display: flex; align-items: center; gap: .8rem; color: #7e8792; font-size: .65rem; }
.intro-index i { display: block; width: 5rem; height: 1px; background: var(--line); }

.panel-screen { display: grid; place-items: center; padding: 1rem; background: rgba(2, 5, 10, .7); backdrop-filter: blur(10px); overflow: auto; }
.editorial-panel { width: min(52rem, 100%); max-height: calc(100vh - 2rem); overflow: auto; padding: clamp(1.25rem, 4vw, 3.5rem); border: 1px solid var(--line); background: rgba(12, 17, 26, .96); box-shadow: var(--shadow); }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding-bottom: 1.4rem; border-bottom: 1px solid var(--line); }
.panel-heading h2 { margin: 0; font-family: Georgia, serif; font-size: clamp(2.4rem, 6vw, 4.5rem); font-weight: 400; line-height: .98; letter-spacing: -.045em; }
.icon-button { width: 2.6rem; height: 2.6rem; border: 1px solid var(--line); border-radius: 50%; background: transparent; cursor: pointer; color: #bcc3cc; font-size: 1.6rem; line-height: 1; }
.tutorial-stage { min-height: 22rem; }
.tutorial-step { display: none; position: relative; padding: 3rem 0 1rem 5rem; }
.tutorial-step.is-active { display: block; }
.tutorial-step .step-number { position: absolute; top: 3.3rem; left: 0; color: var(--cyan); font-size: .75rem; }
.tutorial-step h3 { margin: 0; font-family: Georgia, serif; font-size: 3rem; font-weight: 400; }
.tutorial-step p { max-width: 28rem; color: #adb5bf; line-height: 1.6; }
.gesture-diagram { position: relative; height: 8rem; margin-top: 2rem; border-top: 1px solid var(--line); overflow: hidden; }
.drop-diagram i { position: absolute; top: 1.2rem; left: 20%; width: 55%; height: 1.4rem; border: 1px solid var(--cyan); transform: perspective(100px) rotateX(45deg); }
.drop-diagram b { position: absolute; top: 2.8rem; left: 46%; color: var(--warm); font-size: 2rem; }
.drop-diagram span { position: absolute; bottom: .8rem; left: 34%; width: 32%; height: 1.5rem; border-radius: 50% 50% 10% 10%; background: #303945; }
.grab-diagram i { position: absolute; top: 1rem; left: 28%; width: 44%; height: 4.5rem; border: 1px solid var(--cyan); border-radius: 50%; transform: skewX(-18deg); }
.grab-diagram span { position: absolute; top: 2.2rem; left: 50%; width: 1.6rem; height: 1.6rem; border: 1px solid white; border-radius: 50%; box-shadow: 0 0 0 .5rem rgba(121, 216, 232, .12); }
.wind-diagram { display: flex; align-items: center; justify-content: center; gap: 1.6rem; color: var(--cyan); font: 3rem Georgia, serif; }
.wind-diagram b:nth-child(2) { color: var(--warm); transform: translateY(1rem); }
.tutorial-footer { display: flex; align-items: center; gap: .75rem; padding-top: 1.2rem; border-top: 1px solid var(--line); }
.step-dots { display: flex; gap: .35rem; margin-right: auto; }
.step-dots i { width: 1.6rem; height: 2px; background: #3f4854; }
.step-dots i.is-active { background: var(--cyan); }

.screen.main-screen.is-active { pointer-events: none; }
.main-screen.is-active .topbar, .main-screen.is-active .control-panel, .main-screen.is-active .canvas-hint { pointer-events: auto; }
.topbar { position: absolute; top: 0; left: 0; right: 0; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; min-height: 4.3rem; padding: .7rem 1.3rem; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, rgba(5, 9, 15, .94), rgba(5, 9, 15, .45)); backdrop-filter: blur(10px); }
.brand-lockup { display: flex; align-items: center; gap: .75rem; }
.brand-mark { display: grid; place-items: center; width: 2.4rem; height: 2.4rem; border: 1px solid rgba(121, 216, 232, .55); border-radius: 50%; color: var(--cyan); font: .72rem Georgia, serif; }
.brand-lockup strong, .brand-lockup small { display: block; }
.brand-lockup strong { font-family: Georgia, serif; font-size: .95rem; font-weight: 400; }
.brand-lockup small { margin-top: .15rem; color: #78828f; font-size: .58rem; letter-spacing: .12em; text-transform: uppercase; }
.topbar-status { display: flex; align-items: center; gap: .45rem; color: #aeb6bf; font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; }
.topbar-status i { width: .45rem; height: .45rem; border-radius: 50%; background: var(--warm); box-shadow: 0 0 12px rgba(233, 164, 110, .55); }
.topbar nav { display: flex; justify-content: flex-end; gap: 1.2rem; }

.control-panel { position: absolute; top: 5.4rem; right: 1.2rem; width: min(22.5rem, calc(100vw - 2rem)); max-height: calc(100vh - 6.6rem); overflow: auto; border: 1px solid var(--line); background: var(--panel); box-shadow: var(--shadow); backdrop-filter: blur(16px); }
.panel-grip { display: none; }
.control-heading { display: flex; align-items: center; justify-content: space-between; padding: 1.1rem 1.2rem; border-bottom: 1px solid var(--line); }
.control-heading .eyebrow { margin-bottom: .25rem; }
.control-heading h2 { margin: 0; font: 1.35rem Georgia, serif; }
.collapse-button { border: 0; background: none; cursor: pointer; color: #929aa4; font-size: 1.2rem; }
.control-body { padding: 1rem 1.2rem 1.2rem; }
.control-body.is-collapsed { display: none; }
.station-tabs { display: grid; grid-template-columns: repeat(4, 1fr); padding: .2rem; border: 1px solid var(--line); }
.station-tabs button { padding: .55rem .2rem; border: 0; background: transparent; cursor: pointer; color: #8f99a4; font-size: .67rem; text-transform: uppercase; }
.station-tabs button.is-active { background: #e8e3d9; color: #0b1017; }
.action-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .45rem; margin: .8rem 0 1.25rem; }
.action-button { display: flex; flex-direction: column; align-items: center; gap: .22rem; min-height: 3.8rem; padding: .45rem .15rem; border: 1px solid var(--line); background: rgba(255, 255, 255, .025); cursor: pointer; color: #b9c0c8; font-size: .64rem; text-transform: uppercase; }
.action-button span { color: var(--cyan); font-size: 1.25rem; line-height: 1; }
.action-button b { font-weight: 400; }
.action-button:hover, .action-primary { border-color: rgba(121, 216, 232, .5); background: rgba(121, 216, 232, .08); color: white; }
.parameter-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: .35rem; color: #7e8792; font-size: .62rem; letter-spacing: .08em; text-transform: uppercase; }
.parameter-heading button { padding: .2rem 0; border: 0; border-bottom: 1px solid #505966; background: none; cursor: pointer; color: #969faa; font-size: .58rem; text-transform: uppercase; }
.range-control { display: grid; grid-template-columns: 1fr auto; gap: .35rem; padding: .55rem 0; border-bottom: 1px solid rgba(255,255,255,.07); color: #c4cad1; font-size: .7rem; }
.range-control output { color: var(--cyan); font-variant-numeric: tabular-nums; }
.range-control input { grid-column: 1 / -1; width: 100%; height: 2px; margin: .5rem 0; accent-color: var(--cyan); }
.inline-toggles { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; padding: .9rem 0; }
.inline-toggles label { display: flex; align-items: center; gap: .45rem; color: #a8b0ba; font-size: .68rem; }
.inline-toggles input, .settings-list input { accent-color: var(--cyan); }
.diagnostics-panel { padding-top: .5rem; border-top: 1px solid var(--line); }
.diagnostics-panel summary { display: flex; justify-content: space-between; cursor: pointer; color: #89929e; font-size: .65rem; text-transform: uppercase; }
.diagnostics-panel dl { display: grid; grid-template-columns: 1fr 1fr; gap: .55rem; margin: .8rem 0 0; }
.diagnostics-panel dl div { padding: .5rem; background: rgba(255,255,255,.025); }
.diagnostics-panel dt { color: #6f7884; font-size: .56rem; text-transform: uppercase; }
.diagnostics-panel dd { margin: .2rem 0 0; color: #c9d0d8; font-size: .72rem; font-variant-numeric: tabular-nums; }
.canvas-hint { position: absolute; left: 50%; bottom: 1.2rem; padding: .55rem .85rem; transform: translateX(-50%); border: 1px solid var(--line); border-radius: 999px; background: rgba(6, 10, 17, .72); color: #8f98a3; font-size: .65rem; white-space: nowrap; backdrop-filter: blur(8px); }
.canvas-hint span { margin-right: .35rem; color: var(--cyan); }
.flight-hud { position: absolute; inset: 0; pointer-events: none; }
.flight-reticle { position: absolute; top: 50%; left: 50%; width: 1.2rem; height: 1.2rem; transform: translate(-50%, -50%); }
.flight-reticle::before, .flight-reticle::after { content: ""; position: absolute; background: rgba(121, 216, 232, .8); box-shadow: 0 0 8px rgba(121, 216, 232, .45); }
.flight-reticle::before { top: 50%; left: 0; width: 100%; height: 1px; }
.flight-reticle::after { top: 0; left: 50%; width: 1px; height: 100%; }
.flight-hud p { position: absolute; left: 50%; bottom: 1.2rem; display: flex; align-items: center; gap: .7rem; margin: 0; padding: .55rem .8rem; transform: translateX(-50%); border: 1px solid rgba(121, 216, 232, .32); border-radius: 999px; background: rgba(6, 10, 17, .78); color: #919ba7; font-size: .63rem; white-space: nowrap; backdrop-filter: blur(8px); }
.flight-hud strong { color: var(--cyan); font-size: .61rem; letter-spacing: .12em; text-transform: uppercase; }
.mobile-navigation { display: none; }

.settings-list { margin: 1rem 0 1.5rem; }
.settings-list > label { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 4.5rem; padding: .8rem 0; border-bottom: 1px solid var(--line); }
.settings-list strong, .settings-list small { display: block; }
.settings-list strong { font: 1.05rem Georgia, serif; }
.settings-list small { margin-top: .25rem; color: #7f8994; font-size: .68rem; }
.settings-list input { width: 1.15rem; height: 1.15rem; }
.settings-list select { padding: .55rem 2rem .55rem .7rem; border: 1px solid var(--line); background: #111722; color: white; }
.panel-done { display: block; margin-left: auto; min-width: 8rem; }
.credit-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin: 2rem 0; background: var(--line); }
.credit-grid article { padding: 1.25rem; background: #0e141e; }
.credit-grid article > span { color: var(--cyan); font-size: .62rem; }
.credit-grid h3 { margin: 1.3rem 0 .5rem; font: 1.2rem Georgia, serif; }
.credit-grid p, .license-note { color: #8f99a4; font-size: .72rem; line-height: 1.6; }
.license-note { max-width: 38rem; }
.fatal-error { position: fixed; z-index: 99; left: 50%; bottom: 2rem; display: flex; flex-direction: column; gap: .25rem; width: min(30rem, calc(100vw - 2rem)); padding: 1rem; transform: translateX(-50%); border: 1px solid #ca6a6a; background: #241317; box-shadow: var(--shadow); }
.fatal-error span { color: #d5b9bb; font-size: .75rem; }

@media (max-width: 760px) {
  .intro-screen { align-items: flex-end; padding: 1.25rem 1.25rem 6rem; background: linear-gradient(0deg, rgba(4,8,14,.96) 0%, rgba(4,8,14,.44) 60%, transparent 100%); }
  .intro-copy { width: 100%; }
  .intro-copy h1 { font-size: clamp(4rem, 22vw, 6.5rem); }
  .intro-deck { margin: 1.25rem 0; font-size: 1rem; }
  .intro-actions { align-items: stretch; flex-direction: column; width: min(22rem, 100%); gap: .5rem; }
  .corner-nav { top: 1rem; right: 1rem; }
  .intro-index { display: none; }
  .editorial-panel { max-height: calc(100dvh - 1rem); padding: 1.25rem; }
  .tutorial-step { padding-left: 2.5rem; }
  .tutorial-stage { min-height: 20rem; }
  .topbar { grid-template-columns: 1fr auto; min-height: 3.7rem; padding: .55rem .8rem; }
  .brand-lockup small, .topbar-status, .topbar nav button:not([data-open-screen="settings"]) { display: none; }
  .topbar nav { gap: .6rem; }
  .control-panel { top: auto; right: .5rem; bottom: .5rem; left: .5rem; width: auto; max-height: 48dvh; border-radius: 1rem 1rem .35rem .35rem; }
  .panel-grip { display: block; width: 2.5rem; height: 3px; margin: .5rem auto -.2rem; border-radius: 999px; background: #4b5562; }
  .control-heading { padding: .8rem 1rem; }
  .control-heading h2 { font-size: 1.1rem; }
  .control-body { padding: .8rem 1rem 1rem; }
  .action-grid { margin-bottom: .8rem; }
  .range-control { padding: .45rem 0; }
  .canvas-hint { top: 4.4rem; bottom: auto; max-width: calc(100vw - 1rem); overflow: hidden; text-overflow: ellipsis; }
  .mobile-navigation { position: absolute; inset: 0; z-index: 4; display: block; pointer-events: none; }
  .virtual-stick { position: absolute; bottom: calc(48dvh + 1rem); width: 5.8rem; height: 5.8rem; border: 1px solid rgba(121, 216, 232, .34); border-radius: 50%; background: radial-gradient(circle, rgba(121,216,232,.08), rgba(4,8,14,.54)); box-shadow: inset 0 0 24px rgba(0,0,0,.35); pointer-events: auto; touch-action: none; user-select: none; }
  #move-stick { left: .85rem; }
  #look-stick { right: .85rem; }
  .virtual-stick::before, .virtual-stick::after { content: ""; position: absolute; background: rgba(121, 216, 232, .14); }
  .virtual-stick::before { top: 50%; left: .65rem; right: .65rem; height: 1px; }
  .virtual-stick::after { top: .65rem; bottom: .65rem; left: 50%; width: 1px; }
  .virtual-stick > span { position: absolute; left: 50%; bottom: -.95rem; transform: translateX(-50%); color: #8e98a3; font-size: .56rem; letter-spacing: .12em; text-transform: uppercase; }
  .stick-thumb { position: absolute; z-index: 1; top: 50%; left: 50%; width: 2.35rem; height: 2.35rem; transform: translate(-50%, -50%); border: 1px solid rgba(121, 216, 232, .68); border-radius: 50%; background: rgba(15, 29, 39, .88); box-shadow: 0 4px 16px rgba(0,0,0,.45), inset 0 0 12px rgba(121,216,232,.08); pointer-events: none; }
  .elevation-controls { position: absolute; bottom: calc(48dvh + 1.75rem); left: 50%; display: flex; flex-direction: column; gap: .4rem; transform: translateX(-50%); pointer-events: auto; }
  .elevation-controls button { display: grid; place-items: center; width: 2.65rem; height: 2.65rem; padding: 0; border: 1px solid rgba(121,216,232,.34); border-radius: 50%; background: rgba(7, 13, 21, .76); color: var(--cyan); font-size: 1.15rem; touch-action: none; }
  .elevation-controls button.is-active { background: rgba(121,216,232,.2); border-color: var(--cyan); }
  .flight-hud { display: none !important; }
  .credit-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) and (max-height: 620px) {
  .virtual-stick { bottom: calc(48dvh + .5rem); width: 4.7rem; height: 4.7rem; }
  .elevation-controls { bottom: calc(48dvh + .7rem); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
