:root {
  color-scheme: dark;
  --ink: #f2f6f4;
  --muted: #8f9a9a;
  --dim: #5e686b;
  --panel: #0b0f17;
  --panel-2: #10151e;
  --surface: rgba(16, 21, 30, 0.82);
  --line: rgba(224, 236, 234, 0.11);
  --line-strong: rgba(224, 236, 234, 0.2);
  --accent: #b9f56a;
  --accent-soft: rgba(185, 245, 106, 0.14);
  --cyan: #5ae0df;
  --coral: #f57c63;
  --font-sans: "Segoe UI Variable Display", "Aptos", "Segoe UI", sans-serif;
  --font-mono: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  --topbar-height: 68px;
  --panel-width: 366px;
  --radius: 6px;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-width: 320px;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #070a10;
  color: var(--ink);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.noise {
  position: fixed;
  z-index: 1000;
  inset: 0;
  pointer-events: none;
  opacity: 0.045;
  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='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.7'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
}

.app-shell {
  width: 100%;
  height: 100%;
  background: var(--panel);
}

.topbar {
  position: relative;
  z-index: 50;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: var(--topbar-height);
  padding: 0 18px 0 21px;
  border-bottom: 1px solid var(--line);
  background: rgba(8, 11, 18, 0.94);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  width: max-content;
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: radial-gradient(circle at center, rgba(185, 245, 106, 0.12), transparent 64%);
}

.brand-mark svg {
  width: 25px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.2;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.brand-name {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.24em;
}

.brand-edition {
  margin-top: 6px;
  color: var(--muted);
  font: 400 8px/1 var(--font-mono);
  letter-spacing: 0.17em;
}

.topbar-center {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font: 400 9px/1 var(--font-mono);
  letter-spacing: 0.14em;
}

.live-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 9px rgba(185, 245, 106, 0.75);
  animation: live-pulse 2.2s ease-in-out infinite;
}

@keyframes live-pulse {
  50% { opacity: 0.4; box-shadow: 0 0 2px rgba(185, 245, 106, 0.2); }
}

.status-divider {
  width: 1px;
  height: 11px;
  margin: 0 3px;
  background: var(--line-strong);
}

.top-actions {
  display: flex;
  justify-self: end;
  align-items: center;
  gap: 8px;
}

.text-button,
.icon-button {
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
}

.text-button {
  margin-right: 6px;
  padding: 9px 11px;
  color: var(--muted);
  font: 500 9px/1 var(--font-mono);
  letter-spacing: 0.12em;
}

.text-button:hover {
  color: var(--ink);
}

.icon-button {
  display: grid;
  width: 35px;
  height: 35px;
  place-items: center;
  border-color: var(--line);
  border-radius: var(--radius);
}

.icon-button:hover {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.04);
}

.icon-button svg,
.viewport-tools svg,
.action-button svg,
.wide-button svg,
.mobile-panel-button svg,
.performance-note svg {
  width: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
}

.workspace {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--panel-width);
  width: 100%;
  height: calc(100% - var(--topbar-height));
}

.fractal-stage {
  position: relative;
  min-width: 0;
  height: 100%;
  overflow: hidden;
  background: #0a1013;
  cursor: grab;
  isolation: isolate;
  touch-action: none;
}

.fractal-stage.is-dragging {
  cursor: grabbing;
}

#fractalCanvas,
#fallbackCanvas,
#transitionCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#fractalCanvas,
#fallbackCanvas {
  z-index: 0;
}

#fallbackCanvas {
  display: none;
}

#transitionCanvas {
  z-index: 8;
  pointer-events: none;
  opacity: 0;
  transform: scale(1);
  transform-origin: var(--origin-x, 50%) var(--origin-y, 50%);
  clip-path: circle(150% at var(--origin-x, 50%) var(--origin-y, 50%));
}

#transitionCanvas.is-transitioning {
  animation: specimen-transition 820ms cubic-bezier(0.76, 0, 0.24, 1) forwards;
}

@keyframes specimen-transition {
  0% {
    opacity: 1;
    transform: scale(1);
    clip-path: circle(150% at var(--origin-x, 50%) var(--origin-y, 50%));
    filter: saturate(1) hue-rotate(0deg);
  }
  62% {
    opacity: 1;
    filter: saturate(1.7) hue-rotate(18deg);
  }
  100% {
    opacity: 0;
    transform: scale(1.075);
    clip-path: circle(0% at var(--origin-x, 50%) var(--origin-y, 50%));
    filter: saturate(2) hue-rotate(42deg) blur(8px);
  }
}

.stage-vignette {
  position: absolute;
  z-index: 2;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(2, 5, 9, 0.35), transparent 22%, transparent 70%, rgba(2, 5, 9, 0.56)),
    linear-gradient(90deg, rgba(2, 5, 9, 0.2), transparent 22%, transparent 80%, rgba(2, 5, 9, 0.12));
}

.stage-grid {
  position: absolute;
  z-index: 3;
  inset: 0;
  pointer-events: none;
  opacity: 0.12;
  background-image:
    linear-gradient(rgba(226, 241, 237, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(226, 241, 237, 0.12) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(circle at center, transparent 18%, black 125%);
}

.stage-heading {
  position: absolute;
  z-index: 10;
  top: 30px;
  left: 31px;
  pointer-events: none;
  text-shadow: 0 1px 20px rgba(0, 0, 0, 0.6);
}

.eyebrow {
  color: var(--accent);
  font: 500 8px/1.2 var(--font-mono);
  letter-spacing: 0.19em;
}

.specimen-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
}

.stage-heading h1 {
  margin: 0;
  font-size: clamp(25px, 2.5vw, 39px);
  font-weight: 500;
  letter-spacing: -0.045em;
}

.stage-heading p {
  margin: 5px 0 0;
  color: rgba(242, 246, 244, 0.64);
  font: 300 12px/1.4 var(--font-mono);
}

.info-button {
  display: grid;
  width: 20px;
  height: 20px;
  padding: 0;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.72);
  background: rgba(8, 11, 18, 0.35);
  font: 500 10px/1 var(--font-mono);
  pointer-events: auto;
  cursor: pointer;
}

.info-button:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.render-chip {
  position: absolute;
  z-index: 10;
  top: 29px;
  right: 29px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  color: rgba(242, 246, 244, 0.68);
  background: rgba(7, 10, 16, 0.43);
  backdrop-filter: blur(10px);
  font: 400 8px/1 var(--font-mono);
  letter-spacing: 0.1em;
}

.render-bars {
  display: flex;
  align-items: end;
  height: 9px;
  gap: 2px;
}

.render-bars i {
  display: block;
  width: 2px;
  background: var(--accent);
}

.render-bars i:nth-child(1) { height: 4px; }
.render-bars i:nth-child(2) { height: 8px; }
.render-bars i:nth-child(3) { height: 6px; }

.viewport-tools {
  position: absolute;
  z-index: 10;
  top: 50%;
  left: 20px;
  display: flex;
  width: 40px;
  padding: 4px;
  flex-direction: column;
  gap: 3px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  background: rgba(8, 11, 17, 0.6);
  backdrop-filter: blur(12px);
  transform: translateY(-50%);
}

.viewport-tools button {
  display: grid;
  width: 30px;
  height: 30px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 3px;
  color: rgba(242, 246, 244, 0.72);
  background: transparent;
  cursor: pointer;
}

.viewport-tools button:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.09);
}

.tool-separator {
  width: 24px;
  height: 1px;
  margin: 2px auto;
  background: var(--line-strong);
}

.coordinate-readout {
  position: absolute;
  z-index: 10;
  bottom: 126px;
  left: 31px;
  display: flex;
  gap: 18px;
  color: rgba(242, 246, 244, 0.7);
  font: 400 9px/1 var(--font-mono);
  letter-spacing: 0.03em;
  text-shadow: 0 1px 8px #000;
}

.coordinate-readout b {
  margin-right: 5px;
  color: var(--accent);
  font-weight: 500;
}

.gesture-hint {
  position: absolute;
  z-index: 10;
  right: 29px;
  bottom: 125px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(242, 246, 244, 0.54);
  font: 400 8px/1 var(--font-mono);
  letter-spacing: 0.08em;
  transition: opacity 300ms ease;
}

.gesture-hint.is-hidden {
  opacity: 0;
}

.gesture-hint i {
  width: 1px;
  height: 10px;
  margin: 0 4px;
  background: rgba(255, 255, 255, 0.24);
}

.mouse-icon {
  position: relative;
  width: 10px;
  height: 14px;
  border: 1px solid rgba(255, 255, 255, 0.54);
  border-radius: 5px;
}

.mouse-icon::after {
  position: absolute;
  top: 2px;
  left: 4px;
  width: 1px;
  height: 3px;
  background: var(--accent);
  content: "";
}

.specimen-card {
  position: absolute;
  z-index: 30;
  top: 104px;
  left: 31px;
  width: min(335px, calc(100% - 62px));
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 7px;
  background: rgba(10, 14, 20, 0.88);
  box-shadow: 0 22px 50px rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(20px);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-7px) scale(0.98);
  transition: opacity 180ms ease, transform 260ms ease;
}

.specimen-card.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

.specimen-card > button {
  position: absolute;
  top: 11px;
  right: 13px;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  color: var(--muted);
  background: transparent;
  font-size: 22px;
  cursor: pointer;
}

.specimen-card h2 {
  margin: 9px 0 8px;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.specimen-card p {
  margin: 0;
  color: #aab3b3;
  font-size: 12px;
  line-height: 1.65;
}

.info-fact {
  display: flex;
  justify-content: space-between;
  margin-top: 17px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font: 400 8px/1 var(--font-mono);
  letter-spacing: 0.12em;
}

.info-fact span { color: var(--dim); }
.info-fact b { color: var(--accent); font-weight: 500; }

.fractal-dock {
  position: absolute;
  z-index: 12;
  right: 22px;
  bottom: 18px;
  left: 22px;
  display: flex;
  height: 88px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 7px;
  background: rgba(8, 11, 17, 0.72);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(18px);
}

.dock-label {
  display: flex;
  width: 95px;
  min-width: 95px;
  padding: 16px 14px;
  flex-direction: column;
  justify-content: space-between;
  border-right: 1px solid var(--line);
  color: var(--dim);
  font: 400 7px/1 var(--font-mono);
  letter-spacing: 0.14em;
}

.dock-label b {
  color: var(--muted);
  font-size: 9px;
  font-weight: 400;
}

.dock-label b span {
  color: var(--accent);
}

.dock-items {
  display: grid;
  min-width: 0;
  flex: 1;
  grid-template-columns: repeat(6, minmax(112px, 1fr));
  overflow-x: auto;
  scrollbar-width: none;
}

.dock-items::-webkit-scrollbar { display: none; }

.fractal-option {
  position: relative;
  display: grid;
  min-width: 112px;
  padding: 11px 9px;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
}

.fractal-option:last-child { border-right: 0; }

.fractal-option::after {
  position: absolute;
  right: 10px;
  bottom: 0;
  left: 10px;
  height: 2px;
  background: var(--accent);
  content: "";
  opacity: 0;
  transform: scaleX(0.25);
  transition: opacity 180ms ease, transform 260ms ease;
}

.fractal-option:hover {
  background: rgba(255, 255, 255, 0.035);
}

.fractal-option.is-active {
  background: rgba(185, 245, 106, 0.055);
}

.fractal-option.is-active::after {
  opacity: 1;
  transform: scaleX(1);
}

.fractal-option > span:nth-child(2) {
  min-width: 0;
}

.fractal-option b,
.fractal-option small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fractal-option b {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.fractal-option small {
  margin-top: 5px;
  color: var(--dim);
  font: 400 6px/1 var(--font-mono);
  letter-spacing: 0.07em;
}

.fractal-option kbd {
  position: absolute;
  top: 7px;
  right: 7px;
  color: #4e585a;
  background: none;
  font: 400 6px/1 var(--font-mono);
}

.fractal-glyph {
  position: relative;
  display: block;
  width: 39px;
  height: 39px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.01) 64%);
  transition: border-color 180ms ease, transform 220ms ease;
}

.fractal-option:hover .fractal-glyph,
.fractal-option.is-active .fractal-glyph {
  border-color: rgba(185, 245, 106, 0.32);
  transform: rotate(8deg) scale(1.03);
}

.fractal-glyph::before,
.fractal-glyph::after,
.fractal-glyph i {
  position: absolute;
  display: block;
  content: "";
}

.glyph-mandelbrot::before {
  top: 12px; left: 10px; width: 16px; height: 16px;
  border-radius: 45% 55% 50% 50%; background: var(--accent); transform: rotate(-18deg);
}
.glyph-mandelbrot::after {
  top: 8px; left: 20px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent);
}
.glyph-mandelbrot i {
  top: 19px; left: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
}

.glyph-julia::before,
.glyph-julia::after {
  top: 10px; width: 10px; height: 19px; border: 2px solid var(--cyan); border-radius: 60% 40% 65% 35%;
}
.glyph-julia::before { left: 8px; transform: rotate(24deg); }
.glyph-julia::after { right: 8px; transform: rotate(204deg); }
.glyph-julia i { top: 17px; left: 18px; width: 3px; height: 3px; border-radius: 50%; background: var(--cyan); }

.glyph-ship::before {
  top: 9px; left: 10px; width: 17px; height: 21px; background: var(--coral);
  clip-path: polygon(45% 0, 58% 45%, 100% 58%, 62% 70%, 50% 100%, 37% 70%, 0 58%, 40% 44%);
}

.glyph-tricorn::before {
  top: 8px; left: 8px; width: 22px; height: 22px; border: 2px solid #d7a5ff; border-radius: 50%;
  clip-path: polygon(0 0, 100% 0, 100% 45%, 55% 45%, 55% 100%, 0 100%);
  transform: rotate(45deg);
}
.glyph-tricorn::after { top: 17px; left: 17px; width: 5px; height: 5px; border-radius: 50%; background: #d7a5ff; }

.glyph-multibrot::before {
  inset: 8px; border: 2px solid #ffd166; border-radius: 42% 58% 62% 38%; transform: rotate(22deg);
}
.glyph-multibrot::after { inset: 13px; border: 1px solid #ffd166; border-radius: 50%; transform: rotate(-35deg); }

.glyph-newton::before {
  inset: 8px; background: conic-gradient(from 30deg, #67dfd7 0 31%, transparent 31% 35%, #b9f56a 35% 65%, transparent 65% 69%, #f57c63 69%);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}
.glyph-newton::after { top: 16px; left: 16px; width: 7px; height: 7px; border-radius: 50%; background: #0b1018; }

.control-panel {
  position: relative;
  z-index: 40;
  display: grid;
  min-width: 0;
  height: 100%;
  grid-template-rows: auto auto 1fr auto;
  border-left: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.018), transparent 25%),
    var(--panel);
  box-shadow: -16px 0 38px rgba(0, 0, 0, 0.14);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 22px 17px;
}

.panel-header h2 {
  margin: 6px 0 0;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: 0.03em;
}

.panel-close {
  display: none;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  background: transparent;
  font-size: 20px;
}

.panel-tabs {
  display: grid;
  height: 42px;
  margin: 0 22px;
  grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid var(--line);
}

.panel-tab {
  position: relative;
  border: 0;
  color: var(--dim);
  background: transparent;
  font: 500 8px/1 var(--font-mono);
  letter-spacing: 0.12em;
  cursor: pointer;
}

.panel-tab::after {
  position: absolute;
  right: 17px;
  bottom: -1px;
  left: 17px;
  height: 2px;
  background: var(--accent);
  content: "";
  opacity: 0;
  transform: scaleX(0.5);
  transition: 180ms ease;
}

.panel-tab:hover { color: var(--muted); }
.panel-tab.is-active { color: var(--ink); }
.panel-tab.is-active::after { opacity: 1; transform: scaleX(1); }

.panel-scroll {
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
  scrollbar-width: thin;
}

.panel-scroll::-webkit-scrollbar { width: 5px; }
.panel-scroll::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.13); }

.control-page {
  display: none;
  padding: 3px 22px 28px;
  animation: page-enter 260ms ease;
}

.control-page.is-active { display: block; }

@keyframes page-enter {
  from { opacity: 0; transform: translateX(7px); }
}

.section-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 21px 0 19px;
}

.section-heading > span {
  color: var(--accent);
  font: 400 7px/1 var(--font-mono);
}

.section-heading h3 {
  margin: 0;
  color: #abb5b4;
  font: 500 8px/1 var(--font-mono);
  letter-spacing: 0.14em;
}

.section-heading i {
  height: 1px;
  flex: 1;
  background: var(--line);
}

.range-control {
  display: block;
  margin: 0 0 23px;
}

.range-control > span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.range-control b {
  color: #c7cfcd;
  font-size: 11px;
  font-weight: 500;
}

.range-control output {
  min-width: 48px;
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--accent);
  background: rgba(255, 255, 255, 0.025);
  font: 400 9px/1 var(--font-mono);
  text-align: center;
}

.range-control input[type="range"] {
  display: block;
  width: 100%;
  height: 14px;
  margin: 0;
  appearance: none;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.range-control input[type="range"]::-webkit-slider-runnable-track {
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent) 0 var(--range-progress, 50%), rgba(255, 255, 255, 0.13) var(--range-progress, 50%));
}

.range-control input[type="range"]::-moz-range-track {
  height: 2px;
  border: 0;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.13);
}

.range-control input[type="range"]::-moz-range-progress {
  height: 2px;
  background: var(--accent);
}

.range-control input[type="range"]::-webkit-slider-thumb {
  width: 11px;
  height: 11px;
  margin-top: -4.5px;
  appearance: none;
  border: 2px solid var(--panel);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 1px rgba(185, 245, 106, 0.4), 0 0 11px rgba(185, 245, 106, 0.28);
}

.range-control input[type="range"]::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border: 2px solid var(--panel);
  border-radius: 50%;
  background: var(--accent);
}

.range-control small {
  display: flex;
  justify-content: space-between;
  margin-top: 5px;
  color: #50595b;
  font: 400 6px/1 var(--font-mono);
  letter-spacing: 0.09em;
}

.range-control.compact {
  margin-bottom: 19px;
}

.range-control.is-disabled {
  opacity: 0.38;
}

.range-control.is-disabled input {
  cursor: not-allowed;
}

.linked-controls {
  position: relative;
  padding: 14px 13px 1px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.018);
  transition: opacity 180ms ease;
}

.linked-controls::before {
  position: absolute;
  top: -5px;
  left: 16px;
  width: 8px;
  height: 8px;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
  background: #0b0f17;
  content: "";
  transform: rotate(45deg);
}

.linked-controls.is-contextual {
  opacity: 0.54;
}

.coordinate-inputs {
  display: grid;
  margin-bottom: 17px;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.coordinate-inputs label {
  color: var(--dim);
  font: 400 7px/1 var(--font-mono);
  letter-spacing: 0.1em;
}

.coordinate-inputs input {
  width: 100%;
  height: 35px;
  margin-top: 7px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: #c9d1cf;
  outline: 0;
  background: rgba(255, 255, 255, 0.025);
  font: 400 9px/1 var(--font-mono);
  appearance: textfield;
}

.coordinate-inputs input:focus {
  border-color: rgba(185, 245, 106, 0.45);
}

.button-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.action-button,
.wide-button {
  display: flex;
  height: 39px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: #aeb7b6;
  background: rgba(255, 255, 255, 0.025);
  font: 500 7px/1 var(--font-mono);
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: 160ms ease;
}

.action-button:hover,
.wide-button:hover {
  border-color: var(--line-strong);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.05);
}

.action-button.is-accent {
  border-color: rgba(185, 245, 106, 0.2);
  color: var(--accent);
  background: var(--accent-soft);
}

.palette-grid {
  display: grid;
  margin-bottom: 24px;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.palette-button {
  position: relative;
  min-width: 0;
  height: 76px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.018);
  text-align: left;
  cursor: pointer;
}

.palette-button:hover,
.palette-button.is-active {
  border-color: rgba(185, 245, 106, 0.42);
}

.palette-button.is-active::after {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 5px;
  height: 5px;
  border: 2px solid #12161d;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
  content: "";
}

.palette-preview {
  display: block;
  width: 100%;
  height: 31px;
  margin-bottom: 7px;
  border-radius: 2px;
}

.palette-preview.aurora { background: linear-gradient(120deg, #101725, #4b46a8, #30c9bf, #d6fa7b); }
.palette-preview.ember { background: linear-gradient(120deg, #160b14, #6c1736, #f05d3c, #ffd166); }
.palette-preview.tide { background: linear-gradient(120deg, #061620, #0b4a6b, #28aab6, #b8fff1); }
.palette-preview.bloom { background: linear-gradient(120deg, #171022, #692c77, #ea70a6, #ffd1bd); }
.palette-preview.mineral { background: linear-gradient(120deg, #0e1514, #305a53, #8ba88b, #e9e0c0); }
.palette-preview.mono { background: linear-gradient(120deg, #080a0d, #3e444c, #aeb6ba, #fff); }

.palette-button b {
  display: block;
  overflow: hidden;
  font-size: 8px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.palette-button small {
  position: absolute;
  right: 7px;
  bottom: 7px;
  color: var(--dim);
  font: 400 6px/1 var(--font-mono);
}

.wide-button {
  width: 100%;
  margin-top: 5px;
}

.toggle-card {
  display: grid;
  width: 100%;
  min-height: 58px;
  padding: 11px;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 11px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.02);
  text-align: left;
  cursor: pointer;
}

.toggle-card:hover { border-color: var(--line-strong); }

.toggle-visual {
  position: relative;
  display: block;
  width: 31px;
  height: 17px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.04);
  transition: 180ms ease;
}

.toggle-visual i {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #6e7778;
  transition: 200ms ease;
}

.toggle-card[aria-checked="true"] .toggle-visual {
  border-color: rgba(185, 245, 106, 0.4);
  background: var(--accent-soft);
}

.toggle-card[aria-checked="true"] .toggle-visual i {
  left: 17px;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(185, 245, 106, 0.5);
}

.toggle-card b,
.toggle-card small { display: block; }
.toggle-card b { color: #c7cfcd; font-size: 10px; font-weight: 500; }
.toggle-card small { margin-top: 4px; color: var(--dim); font: 400 7px/1 var(--font-mono); }
.toggle-card em { color: var(--dim); font: normal 500 7px/1 var(--font-mono); letter-spacing: 0.08em; }
.toggle-card[aria-checked="true"] em { color: var(--accent); }

.toggle-card + .range-control { margin-top: 22px; }

.choice-group {
  margin-top: 2px;
}

.choice-group > span {
  display: block;
  margin-bottom: 9px;
  color: var(--dim);
  font: 400 7px/1 var(--font-mono);
  letter-spacing: 0.11em;
}

.choice-group > div {
  display: grid;
  height: 34px;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--line);
  border-radius: 4px;
}

.choice-button {
  border: 0;
  border-right: 1px solid var(--line);
  color: var(--dim);
  background: transparent;
  font: 400 7px/1 var(--font-mono);
  letter-spacing: 0.08em;
  cursor: pointer;
}

.choice-button:last-child { border-right: 0; }
.choice-button:hover { color: var(--muted); }
.choice-button.is-active { color: var(--accent); background: var(--accent-soft); }

.performance-summary {
  display: grid;
  margin-bottom: 17px;
  padding: 14px;
  grid-template-columns: 74px 1fr;
  align-items: center;
  gap: 13px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.02);
}

.gauge {
  position: relative;
  width: 69px;
  height: 36px;
  overflow: hidden;
}

.gauge::before {
  position: absolute;
  inset: 0 0 auto;
  width: 65px;
  height: 65px;
  border: 4px solid rgba(255, 255, 255, 0.09);
  border-bottom-color: transparent;
  border-left-color: #ef7a61;
  border-radius: 50%;
  box-sizing: border-box;
  content: "";
  transform: rotate(-45deg);
}

.gauge::after {
  position: absolute;
  right: 7px;
  bottom: 0;
  color: var(--accent);
  content: "";
}

.gauge span {
  position: absolute;
  z-index: 2;
  bottom: 2px;
  left: 32px;
  width: 27px;
  height: 1px;
  background: var(--accent);
  box-shadow: 0 0 5px rgba(185, 245, 106, 0.6);
  transform: rotate(-28deg);
  transform-origin: left center;
  transition: transform 800ms cubic-bezier(0.34, 1.3, 0.64, 1);
}

.gauge i {
  position: absolute;
  z-index: 3;
  bottom: 0;
  left: 29px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}

.performance-summary > div:last-child span,
.performance-summary > div:last-child b,
.performance-summary > div:last-child small { display: block; }
.performance-summary > div:last-child span { color: var(--dim); font: 400 6px/1 var(--font-mono); letter-spacing: 0.1em; }
.performance-summary > div:last-child b { margin-top: 6px; color: #ced6d4; font: 500 10px/1 var(--font-mono); }
.performance-summary > div:last-child small { margin-top: 6px; color: var(--dim); font: 400 7px/1.35 var(--font-mono); }

.segmented-control {
  display: grid;
  height: 47px;
  margin-bottom: 19px;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--line);
  border-radius: 4px;
}

.segmented-control button {
  border: 0;
  border-right: 1px solid var(--line);
  color: var(--dim);
  background: transparent;
  font: 500 8px/1 var(--font-mono);
  cursor: pointer;
}

.segmented-control button:last-child { border-right: 0; }
.segmented-control button small { display: block; margin-top: 4px; color: #4d5658; font-size: 6px; }
.segmented-control button.is-active { color: var(--accent); background: var(--accent-soft); }
.segmented-control button:hover { color: var(--muted); }

.check-control {
  display: grid;
  min-height: 45px;
  padding: 10px 0;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.check-control input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.check-control > span:nth-of-type(1) {
  display: grid;
  width: 15px;
  height: 15px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
}

.check-control > span:nth-of-type(1) i {
  width: 7px;
  height: 4px;
  border-bottom: 1px solid #0b0f17;
  border-left: 1px solid #0b0f17;
  opacity: 0;
  transform: translateY(-1px) rotate(-45deg);
}

.check-control input:checked + span {
  border-color: var(--accent);
  background: var(--accent);
}

.check-control input:checked + span i { opacity: 1; }
.check-control b, .check-control small { display: block; }
.check-control b { color: #b8c1bf; font-size: 9px; font-weight: 500; }
.check-control small { margin-top: 4px; color: var(--dim); font: 400 7px/1 var(--font-mono); }

.performance-note {
  display: grid;
  margin-top: 17px;
  padding: 11px;
  grid-template-columns: auto 1fr;
  gap: 9px;
  border: 1px solid rgba(90, 224, 223, 0.13);
  border-radius: 4px;
  color: #779494;
  background: rgba(90, 224, 223, 0.035);
}

.performance-note svg { width: 14px; color: var(--cyan); }
.performance-note p { margin: 0; font: 400 7px/1.55 var(--font-mono); }

.panel-footer {
  display: flex;
  height: 37px;
  padding: 0 22px;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  color: #4e585a;
  font: 400 6px/1 var(--font-mono);
  letter-spacing: 0.1em;
}

.panel-footer span:first-child {
  display: flex;
  align-items: center;
  gap: 6px;
}

.panel-footer i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 5px var(--accent);
}

.mobile-panel-button {
  position: absolute;
  z-index: 35;
  right: 14px;
  bottom: 14px;
  display: none;
  height: 42px;
  padding: 0 14px;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(185, 245, 106, 0.3);
  border-radius: 5px;
  color: var(--accent);
  background: rgba(8, 11, 17, 0.85);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(12px);
  font: 500 8px/1 var(--font-mono);
  letter-spacing: 0.09em;
}

dialog {
  position: fixed;
  inset: 0;
  width: min(490px, calc(100% - 30px));
  height: fit-content;
  max-height: calc(100dvh - 28px);
  margin: auto;
  padding: 36px;
  overflow-x: hidden;
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  color: var(--ink);
  background: #0d121a;
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.65);
}

dialog::backdrop {
  background: rgba(3, 5, 9, 0.74);
  backdrop-filter: blur(8px);
}

dialog[open] { animation: dialog-enter 300ms cubic-bezier(0.22, 1, 0.36, 1); }

@keyframes dialog-enter {
  from { opacity: 0; transform: translateY(10px) scale(0.97); }
}

.dialog-visual {
  position: absolute;
  top: -110px;
  right: -80px;
  width: 280px;
  height: 280px;
  opacity: 0.38;
}

.orbit {
  position: absolute;
  top: 50%;
  left: 50%;
  border: 1px solid var(--accent);
  border-radius: 50%;
}

.orbit-one { width: 210px; height: 90px; margin: -45px 0 0 -105px; transform: rotate(25deg); }
.orbit-two { width: 100px; height: 220px; margin: -110px 0 0 -50px; transform: rotate(42deg); }
.dialog-core { position: absolute; top: 50%; left: 50%; width: 12px; height: 12px; margin: -6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 25px var(--accent); }

.dialog-close {
  position: absolute;
  z-index: 2;
  top: 14px;
  right: 14px;
  width: 31px;
  height: 31px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  background: rgba(8, 11, 17, 0.4);
  font-size: 20px;
  cursor: pointer;
}

dialog h2 {
  position: relative;
  margin: 10px 0 11px;
  font-size: 29px;
  font-weight: 600;
  letter-spacing: -0.045em;
}

dialog > p {
  position: relative;
  max-width: 390px;
  margin: 0;
  color: #909b9b;
  font-size: 12px;
  line-height: 1.65;
}

.shortcut-grid {
  position: relative;
  display: grid;
  margin: 24px 0;
  grid-template-columns: 1fr 1fr;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.shortcut-grid span {
  display: flex;
  min-height: 52px;
  padding: 10px;
  align-items: center;
  gap: 10px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.shortcut-grid kbd {
  min-width: 42px;
  padding: 5px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  color: var(--accent);
  background: rgba(255, 255, 255, 0.025);
  font: 400 7px/1 var(--font-mono);
  text-align: center;
}

.shortcut-grid b { color: #9ba6a5; font-size: 9px; font-weight: 500; }

.dialog-action {
  width: 100%;
  height: 45px;
  border: 1px solid rgba(185, 245, 106, 0.35);
  border-radius: 4px;
  color: #10150e;
  background: var(--accent);
  font: 600 8px/1 var(--font-mono);
  letter-spacing: 0.1em;
  cursor: pointer;
}

.dialog-action span { margin-left: 8px; font-size: 14px; }

.toast {
  position: fixed;
  z-index: 1001;
  top: 80px;
  left: 50%;
  padding: 10px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  color: #c9d2d0;
  background: rgba(10, 14, 20, 0.88);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(12px);
  opacity: 0;
  pointer-events: none;
  font: 400 8px/1 var(--font-mono);
  letter-spacing: 0.08em;
  transform: translate(-50%, -8px);
  transition: 200ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

body[data-profile="economy"] .noise {
  display: none;
}

body[data-profile="economy"] .fractal-dock,
body[data-profile="economy"] .viewport-tools,
body[data-profile="economy"] .render-chip,
body[data-profile="economy"] .specimen-card,
body[data-profile="economy"] .mobile-panel-button {
  backdrop-filter: none;
}

body[data-profile="economy"] .stage-grid {
  opacity: 0.07;
}

body.reduce-motion .live-dot {
  animation: none;
}

@media (max-width: 1120px) {
  :root { --panel-width: 330px; }
  .dock-label { display: none; }
  .dock-items { grid-template-columns: repeat(6, 126px); }
  .fractal-option { min-width: 126px; }
  .gesture-hint { display: none; }
  .coordinate-readout { right: 25px; }
}

@media (max-width: 820px) {
  :root { --topbar-height: 60px; }

  .topbar {
    grid-template-columns: 1fr auto;
    padding: 0 13px;
  }

  .topbar-center { display: none; }
  .text-button { display: none; }
  .workspace { display: block; }
  .fractal-stage { width: 100%; }

  .control-panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(380px, 94vw);
    transform: translateX(102%);
    transition: transform 320ms cubic-bezier(0.22, 1, 0.36, 1);
  }

  .control-panel.is-open { transform: none; }
  .panel-close { display: block; }
  .mobile-panel-button { display: flex; }

  .fractal-dock { right: 12px; bottom: 13px; left: 12px; }
  .coordinate-readout { bottom: 116px; left: 18px; }
  .stage-heading { top: 22px; left: 20px; }
  .render-chip { top: 22px; right: 18px; }
  .viewport-tools { left: 12px; }
}

@media (max-width: 540px) {
  .brand-edition { display: none; }
  .brand-mark { width: 33px; height: 33px; }
  .top-actions { gap: 5px; }
  .icon-button { width: 33px; height: 33px; }
  .stage-heading p { font-size: 10px; }
  .stage-heading h1 { font-size: 25px; }
  .render-chip { display: none; }
  .viewport-tools { top: 45%; }

  .fractal-dock {
    right: 68px;
    height: 73px;
  }

  .dock-items { grid-template-columns: repeat(6, 69px); }
  .fractal-option {
    display: flex;
    min-width: 69px;
    padding: 8px;
    justify-content: center;
  }

  .fractal-option > span:nth-child(2),
  .fractal-option kbd { display: none; }
  .fractal-glyph { width: 42px; height: 42px; }
  .mobile-panel-button { width: 48px; height: 73px; padding: 0; justify-content: center; }
  .mobile-panel-button svg { width: 20px; }
  .mobile-panel-button { font-size: 0; }
  .coordinate-readout { right: auto; bottom: 102px; gap: 11px; font-size: 7px; }
  .coordinate-readout span:nth-child(2) { display: none; }
  .specimen-card { top: 93px; left: 20px; width: calc(100% - 40px); }

  dialog { padding: 31px 23px 25px; }
  dialog h2 { font-size: 25px; }
  .shortcut-grid { grid-template-columns: 1fr; }
  .shortcut-grid span { min-height: 43px; }
}

@media (max-height: 690px) and (min-width: 821px) {
  .fractal-dock { height: 74px; }
  .coordinate-readout,
  .gesture-hint { bottom: 106px; }
  .panel-header { padding-top: 15px; padding-bottom: 11px; }
  .panel-tabs { height: 36px; }
  .section-heading { margin-top: 17px; margin-bottom: 15px; }
  .range-control { margin-bottom: 17px; }
}

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