:root {
  color-scheme: dark;
  font-family: "Trebuchet MS", Arial, sans-serif;
  color: #fff1f8;
  background: #130d1d;
  --pink: #ff78b4;
  --bar-height: 75px;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 300px; }
button { font: inherit; color: inherit; }
button:focus-visible, a:focus-visible, canvas:focus-visible { outline: 2px solid #ffd0e7; outline-offset: 3px; }
[hidden] { display: none !important; }
.topbar { min-height: var(--bar-height); display: flex; justify-content: space-between; align-items: center; padding: 0 clamp(13px, 3vw, 48px); gap: 10px; border-bottom: 1px solid #a54b82; background: radial-gradient(ellipse at 13% -40%, #5d2754, transparent 66%), linear-gradient(120deg, #2e142c, #1b1127 68%); box-shadow: 0 1px 0 #f88cbb55; position: relative; z-index: 6; }
.brand { display: inline-flex; align-items: center; gap: .145em; color: #fff5fb; font-size: clamp(23px, 3.55vw, 43px); font-weight: 900; letter-spacing: -.073em; line-height: .9; white-space: nowrap; }
.brand-mark { display: grid; place-items: center; width: 1.12em; height: 1.03em; padding-right: .06em; border: 1px solid #ff9bc7; border-radius: .18em; background: linear-gradient(145deg, #ffa0cb, #ff58a4); color: #2a1027; font-style: italic; letter-spacing: -.11em; box-shadow: 0 0 20px #fc5ca847, inset 0 1px 0 #ffd2e6; }
.brand-name { padding-bottom: .05em; }
.domain, h1 span { color: var(--pink); }
.toolbar, .view-controls { display: flex; gap: 7px; align-items: center; }
.ecosystem-link { display: grid; place-items: center; width: 37px; height: 35px; border: 1px solid #654966; border-radius: 8px; background: #2b1c38; }
.ecosystem-link:hover { border-color: #ad70a0; background: #51304e; }
.ecosystem-link img { display: block; max-width: 100%; object-fit: contain; }
.toolbar button, .view-controls button, .failure button { padding: 7px 10px; min-height: 35px; border: 1px solid #654966; border-radius: 8px; background: #2b1c38ed; font-size: .86rem; font-weight: 800; cursor: pointer; white-space: nowrap; }
.toolbar button:hover, .view-controls button:hover, .toolbar button[aria-pressed="true"], .view-controls button[aria-pressed="true"] { background: #51304e; border-color: #a96490; }
.speaker { color: #ffa4c9; margin-right: 6px; letter-spacing: -.17em; }
.workshop { position: relative; isolation: isolate; overflow: hidden; height: calc(100vh - var(--bar-height)); height: calc(100svh - var(--bar-height)); min-height: 450px; background: radial-gradient(at 53% 39%, #4a2949, #170f23 68%); }
#world { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; -webkit-tap-highlight-color: transparent; }
#world:focus-visible { outline-offset: -3px; }
#world[data-cursor="grab"] { cursor: grab; }
#world[data-cursor="grabbing"] { cursor: grabbing; }
#world[data-cursor="pointer"] { cursor: pointer; }
.heading { position: absolute; top: clamp(16px, 3vw, 44px); left: clamp(14px, 4vw, 54px); pointer-events: none; filter: drop-shadow(0 2px 8px #150b1d); }
h1 { margin: 0; font-size: clamp(29px, 4.7vw, 69px); letter-spacing: -.085em; font-weight: 900; line-height: .98; }
.heading p { margin: .6em 0 0; color: #e3c7df; font-size: .9rem; font-weight: 700; }
.view-controls { position: absolute; right: clamp(13px, 3vw, 48px); top: clamp(16px, 3vw, 44px); }
.cutaway-pins { position: absolute; inset: 0; z-index: 2; pointer-events: none; overflow: hidden; }
.cutaway-pin { position: absolute; display: flex; align-items: center; gap: 5px; font-size: .72rem; font-weight: 800; color: #fff9f0; text-shadow: 0 1px 6px #29171a; white-space: nowrap; transform: translate(-10px, -11px); }
.cutaway-pin i, #cutaway-parts li::before { display: grid; place-items: center; width: 21px; height: 21px; border-radius: 50%; background: #382336; border: 1px solid #ffbe86; color: #ffe2b8; font-style: normal; font-size: .75rem; box-shadow: 0 2px 7px #170c1b; }
.cutaway-pin:nth-child(4) i, #cutaway-parts li:nth-child(4)::before { border-color: #88dfff; color: #bfeeff; }
.cutaway-pin span { padding: 3px 5px; border-radius: 4px; background: #230f26d9; }
.cutaway-legend { position: absolute; z-index: 3; right: clamp(13px, 3vw, 48px); top: clamp(66px, 8vw, 94px); width: min(306px, 28vw); max-height: calc(100% - 140px); overflow: auto; padding: 12px 13px; border-radius: 9px; color: #fff1f8; border: 1px solid #9b7188; background: #241630eb; box-shadow: 0 9px 30px #10091580; }
.cutaway-legend h2 { margin: 0 0 7px; font-size: .99rem; }
#cutaway-parts { counter-reset: mechanism; list-style: none; margin: 0; padding: 0; }
#cutaway-parts li { position: relative; padding-left: 28px; font-size: .78rem; line-height: 1.33; color: #e5cadf; }
#cutaway-parts li + li { margin-top: 8px; }
#cutaway-parts li::before { counter-increment: mechanism; content: counter(mechanism); position: absolute; left: 0; top: 0; }
#cutaway-parts strong { display: block; color: #fff0f9; }
.tooltip { position: absolute; z-index: 4; display: grid; gap: 3px; max-width: min(250px, 70vw); padding: 7px 10px; border-radius: 7px; background: #23152fed; border: 1px solid #c672a7; box-shadow: 0 6px 20px #13091a8a; pointer-events: none; color: #fff0fa; font-size: .83rem; }
.tooltip span { color: #eed0e5; font-size: .76rem; }
.readout { position: absolute; left: clamp(13px, 3vw, 48px); bottom: clamp(13px, 3vw, 34px); display: flex; align-items: stretch; max-width: calc(100% - 26px); pointer-events: none; border: 1px solid #735276; border-radius: 9px; background: #23162eea; box-shadow: 0 5px 25px #140b1b70; }
.crew-notice { position: absolute; right: clamp(13px, 3vw, 48px); bottom: clamp(13px, 3vw, 34px); margin: 0; max-width: calc(100% - 26px); border: 1px solid #856078; border-radius: 9px; padding: 9px 11px; background: #28172de8; color: #fae1eb; pointer-events: none; font-size: .82rem; }
.machine-state { display: flex; align-items: center; gap: 8px; padding: 9px 11px; flex: 0 0 auto; border-right: 1px solid #644269; font-size: .85rem; font-weight: 800; }
.state-dot { width: 7px; height: 7px; border-radius: 50%; background: #c0a6c1; box-shadow: 0 0 0 3px #c0a6c130; }
[data-phase="ready"] .state-dot, [data-phase="feeding"] .state-dot { background: #a9ec82; box-shadow: 0 0 0 3px #a9ec8240, 0 0 10px #a9ec8290; }
[data-phase="starting"] .state-dot, [data-phase="warm"] .state-dot { background: #ffbf76; box-shadow: 0 0 0 3px #ffbf7640; }
[data-phase="emergency"] .state-dot { background: #fa7482; box-shadow: 0 0 0 3px #fa748240; }
.rotor-speed { display: inline-flex; margin-left: 3px; border-left: 1px solid #775572; padding-left: 8px; color: #f4a9d2; font-size: .73rem; font-variant-numeric: tabular-nums; font-weight: 700; }
#message { padding: 9px 11px; color: #e7cbe2; font-size: .87rem; line-height: 1.34; max-width: 470px; }
.guide { position: absolute; z-index: 5; right: clamp(13px, 3vw, 48px); top: 70px; width: min(405px, calc(100% - 26px)); max-height: calc(100% - 120px); overflow: auto; padding: 16px 18px; border: 1px solid #9d5c89; border-radius: 11px; background: #271833f5; box-shadow: 0 10px 40px #11091ac0; font-size: .9rem; line-height: 1.5; }
.guide h2 { margin: 0; font-size: 1.12rem; }
.guide ol { padding-left: 1.4rem; margin: .55em 0; }
.guide li + li { margin-top: .35em; }
.guide p { color: #e9c9e2; margin-bottom: 0; }
.failure { position: absolute; inset: 46% 15% auto; margin: 0; padding: 17px; background: #2a1937; border: 1px solid #a96794; border-radius: 10px; text-align: center; }
.failure button { margin: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 650px) {
  :root { --bar-height: 57px; }
  .topbar { padding: 0 10px; }
  .workshop { min-height: 400px; }
  .heading { top: 13px; }
  .heading p { font-size: .76rem; }
  .view-controls { top: 70px; }
  .view-controls button, .toolbar button { min-height: 30px; padding: 5px 6px; font-size: .75rem; }
  .speaker { display: none; }
  .ecosystem-link { width: 30px; height: 30px; }
  .cutaway-legend { top: 108px; width: min(235px, 62vw); max-height: 26%; padding: 9px 10px; }
  .cutaway-pin span { display: none; }
  .guide { top: 115px; max-height: calc(100% - 140px); }
  .readout { display: block; }
  .crew-notice { bottom: 92px; padding: 6px 8px; font-size: .75rem; }
  .machine-state { border-right: 0; padding: 7px 9px 1px; }
  #message { padding: 5px 9px 8px; font-size: .8rem; }
}

@media (max-width: 480px) {
  .toolbar #sound { position: relative; display: grid; place-items: center; width: 32px; padding: 0; }
  #sound-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .toolbar .speaker { display: block; position: relative; width: 19px; height: 16px; margin: 0; font-size: 0; }
  .speaker::before { content: ""; position: absolute; left: 0; top: 2px; width: 11px; height: 12px; background: currentColor; clip-path: polygon(0 34%, 36% 34%, 95% 0, 95% 100%, 36% 66%, 0 66%); }
  .speaker::after { content: "×"; position: absolute; right: 0; top: 0; font: bold 14px/16px Arial, sans-serif; }
  [aria-pressed="true"] > .speaker::after { content: ""; width: 7px; height: 12px; top: 2px; border-right: 2px solid currentColor; border-radius: 50%; }
}

@media (max-width: 345px) {
  .brand { font-size: clamp(17px, 5.7vw, 20px); }
  .toolbar button { padding-inline: 5px; }
  .toolbar { gap: 4px; }
}
