:root {
  color-scheme: dark;
  --bg: #020806;
  --color-bg-deep: #020806;
  --surface: rgba(4, 22, 18, 0.42);
  --surface-alt: rgba(56, 240, 255, 0.08);
  --text: #e8faf4;
  --color-ink: #e8faf4;
  --color-ink-dim: rgba(232, 250, 244, 0.72);
  --muted: rgba(180, 230, 210, 0.55);
  --color-muted: rgba(180, 230, 210, 0.55);
  --line: rgba(93, 255, 200, 0.14);
  --line-strong: rgba(93, 255, 200, 0.28);
  --green: #5dffc8;
  --red: #d9503f;
  --gold: #e3ad32;
  --blue: #38f0ff;
  --violet: #ff2ea6;
  --neon-mint: #5dffc8;
  --neon-cyan: #38f0ff;
  --neon-magenta: #ff2ea6;
  --glass-bg: rgba(4, 22, 18, 0.42);
  --glass-border: rgba(93, 255, 200, 0.14);
  --glass-highlight: rgba(255, 255, 255, 0.06);
  --shadow: 0 8px 48px rgba(0, 0, 0, 0.45), 0 0 1px rgba(93, 255, 200, 0.25);
  --shadow-glass: 0 8px 48px rgba(0, 0, 0, 0.45), 0 0 1px rgba(93, 255, 200, 0.25);
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", sans-serif;
  --radius: 16px;
  --radius-sm: 10px;
  font-family: var(--font-sans);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1.05rem;
  line-height: 1.6;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
}

body.modal-open {
  overflow: hidden;
}

body.content-fullscreen-fallback {
  overflow: hidden;
}

body.intro-modal-open .site-shell,
body.intro-modal-open .matrix-bg {
  filter: blur(10px) saturate(0.86);
  transform: scale(1.012);
}

.site-shell,
.matrix-bg,
.app-header,
.seo-summary,
.site-footer,
#contentContainer > :not(.modal) {
  transition: filter 180ms ease, transform 180ms ease;
}

body.modal-blur-open .app-header,
body.modal-blur-open .seo-summary,
body.modal-blur-open .site-footer,
body.modal-blur-open #contentContainer > :not(.modal),
body.modal-blur-open .matrix-bg {
  filter: blur(10px) saturate(0.86);
  transform: scale(1.012);
}

button,
input,
select {
  font: inherit;
  letter-spacing: 0;
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1.35rem;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.2);
  color: var(--color-ink);
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-decoration: none;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

button:hover:not(.primary-button):not(.drapps-primary-button):not(.lang-button):not(:disabled) {
  border-color: rgba(93, 255, 200, 0.35);
  background: rgba(93, 255, 200, 0.08);
}

button:focus-visible {
  outline: 2px solid var(--neon-cyan);
  outline-offset: 2px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.primary-button,
.drapps-primary-button {
  border: none;
  background: linear-gradient(135deg, #00c896 0%, #00a8ff 100%);
  color: #021210;
  box-shadow: 0 0 24px rgba(0, 255, 180, 0.35);
}

.primary-button:hover:not(:disabled),
.drapps-primary-button:hover:not(:disabled) {
  background: linear-gradient(135deg, #00c896 0%, #00a8ff 100%);
  color: #021210;
  filter: brightness(1.08);
  transform: translateY(-2px);
  box-shadow: 0 0 36px rgba(56, 240, 255, 0.45);
}

input[type="file"] {
  width: 100%;
  color: var(--muted);
}

input[type="number"],
select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.26);
  color: var(--text);
  padding: 0 10px;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--neon-mint);
}

.matrix-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background:
    radial-gradient(ellipse 100% 70% at 30% 10%, #0a4a38 0%, transparent 55%),
    radial-gradient(ellipse 80% 60% at 70% 90%, #1a2040 0%, transparent 50%),
    var(--bg);
  background-size: 180% 180%;
  background-position: 0% 25%, 100% 70%, 0 0;
  animation: matrix-bg-drift 32s ease-in-out infinite;
}

.matrix-bg__webgl {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
}

.matrix-bg--gl {
  animation: none;
  background: var(--bg);
}

.matrix-bg--gl .matrix-bg__bloom,
.matrix-bg--gl .matrix-bg__grid {
  display: none;
}

.matrix-bg__bloom,
.matrix-bg__grid,
.matrix-bg__glyphs,
.matrix-bg__scan,
.matrix-bg__vignette {
  position: absolute;
  inset: 0;
}

.matrix-bg__bloom {
  inset: -10%;
  z-index: 1;
  background:
    radial-gradient(circle at 20% 30%, rgba(0, 255, 180, 0.35) 0%, transparent 45%),
    radial-gradient(circle at 78% 65%, rgba(56, 240, 255, 0.22) 0%, transparent 42%),
    radial-gradient(circle at 50% 100%, rgba(255, 46, 166, 0.12) 0%, transparent 48%);
  animation: matrix-bloom 18s ease-in-out infinite, matrix-bloom-rotate 24s linear infinite;
}

.matrix-bg__grid {
  z-index: 2;
  background-image:
    repeating-linear-gradient(0deg, transparent 0, transparent 14px, rgba(0, 255, 160, 0.07) 14px, rgba(0, 255, 160, 0.07) 15px),
    repeating-linear-gradient(90deg, transparent 0, transparent 56px, rgba(56, 240, 255, 0.06) 56px, rgba(56, 240, 255, 0.06) 57px);
  background-size: 100% 100%, 100% 100%;
  opacity: 0.65;
  animation: matrix-grid-flicker 3.8s steps(2, end) infinite, matrix-grid-pan 12s linear infinite;
}

.matrix-bg__glyphs {
  display: none;
  left: 50%;
  top: 50%;
  inset: auto;
  z-index: 3;
  width: max-content;
  max-width: none;
  font-family: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;
  font-size: 11px;
  line-height: 1.35;
  letter-spacing: 0.12em;
  color: rgba(0, 255, 170, 0.32);
  white-space: pre;
  overflow: visible;
  text-shadow: 0 0 1px rgba(0, 255, 200, 0.9), 0 0 14px rgba(0, 255, 180, 0.25);
  transform-origin: center center;
  opacity: 0.55;
  animation: matrix-glyphs-drift 22s ease-in-out infinite, matrix-glyphs-flicker 2.6s steps(3, end) infinite;
  user-select: none;
  box-sizing: border-box;
}

.matrix-bg__scan {
  z-index: 4;
  background-image: repeating-linear-gradient(to bottom, transparent 0, transparent 160px, rgba(0, 255, 200, 0.05) 200px, rgba(56, 240, 255, 0.12) 220px, rgba(0, 255, 200, 0.05) 240px, transparent 280px, transparent 400px);
  background-size: 100% 400px;
  animation: matrix-scan 7s linear infinite;
  mix-blend-mode: screen;
  opacity: 0.45;
}

.matrix-bg__vignette {
  z-index: 5;
  background: radial-gradient(ellipse 85% 75% at 50% 45%, transparent 30%, rgba(0, 0, 0, 0.75) 100%);
}

.site-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(18px) saturate(1.35);
  -webkit-backdrop-filter: blur(18px) saturate(1.35);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow), inset 0 1px 0 var(--glass-highlight);
}

@keyframes matrix-bg-drift {
  0%, 100% { background-position: 0% 25%, 100% 70%, 0 0; }
  50% { background-position: 100% 55%, 0% 35%, 0 0; }
}

@keyframes matrix-bloom {
  0%, 100% { opacity: 0.78; transform: scale(1) translate(0, 0); }
  50% { opacity: 1; transform: scale(1.08) translate(3%, -2%); }
}

@keyframes matrix-bloom-rotate {
  0% { filter: hue-rotate(0deg); }
  100% { filter: hue-rotate(360deg); }
}

@keyframes matrix-grid-flicker {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 0.88; }
}

@keyframes matrix-grid-pan {
  0% { background-position: 0 0, 0 0; }
  100% { background-position: 0 15px, 57px 0; }
}

@keyframes matrix-glyphs-flicker {
  0%, 100% { opacity: 0.35; }
  33% { opacity: 0.55; }
  66% { opacity: 0.42; }
}

@keyframes matrix-glyphs-drift {
  0%, 100% { transform: translate(-50%, -50%) rotate(-2deg) scale(1.08) translateY(0); }
  50% { transform: translate(-50%, -50%) rotate(-2deg) scale(1.08) translateY(-2.5%); }
}

@keyframes matrix-scan {
  0% { background-position: 0 0; }
  100% { background-position: 0 400px; }
}

@media (prefers-reduced-motion: reduce) {
  .matrix-bg,
  .matrix-bg__bloom,
  .matrix-bg__grid,
  .matrix-bg__glyphs,
  .matrix-bg__scan {
    animation: none !important;
  }

  .matrix-bg__glyphs {
    opacity: 0.28;
    transform: translate(-50%, -50%) rotate(-2deg) scale(1.08);
  }
}

.app-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: end;
  padding: 24px clamp(16px, 4vw, 42px) 16px;
  position: sticky;
  top: 0;
  z-index: 5;
  border-width: 0 0 1px;
  border-radius: 0;
}

.title-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.title-block h1 {
  margin: 0;
  font-size: clamp(1.6rem, 2.5vw, 2.4rem);
  line-height: 1.05;
  font-weight: 760;
  background: linear-gradient(105deg, var(--text) 0%, var(--neon-mint) 45%, var(--neon-cyan) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 28px rgba(93, 255, 200, 0.25));
}

.title-apps-link {
  display: inline-flex;
  align-items: center;
  min-height: 1.65rem;
  padding: 0.22rem 0.52rem;
  border: 1px solid rgba(93, 255, 200, 0.16);
  border-radius: 999px;
  background: rgba(93, 255, 200, 0.045);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  line-height: 1;
  text-decoration: none;
  transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.title-apps-link:hover,
.title-apps-link:focus-visible {
  border-color: rgba(93, 255, 200, 0.34);
  background: rgba(93, 255, 200, 0.08);
  color: var(--neon-mint);
  box-shadow: 0 0 18px rgba(93, 255, 200, 0.16);
  outline: none;
}

.title-block p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.96rem;
  max-width: 68ch;
}

.title-block .disclaimer {
  margin-top: 3px;
  font-size: 0.78rem;
}

.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.drapps-primary-button {
  letter-spacing: 0.03em;
}

.needs-setup-attention {
  border-color: rgba(255, 171, 64, 0.72);
  background: rgba(255, 139, 32, 0.13);
  color: #ffe7c2;
  box-shadow: 0 0 0 1px rgba(255, 171, 64, 0.2), 0 0 28px rgba(255, 139, 32, 0.32);
  animation: setupAttentionPulse 1.8s ease-in-out infinite;
}

.needs-setup-attention:hover:not(:disabled) {
  border-color: rgba(255, 190, 88, 0.92);
  background: rgba(255, 139, 32, 0.2);
  box-shadow: 0 0 0 1px rgba(255, 190, 88, 0.3), 0 0 38px rgba(255, 139, 32, 0.42);
}

@keyframes setupAttentionPulse {
  0%,
  100% {
    box-shadow: 0 0 0 1px rgba(255, 171, 64, 0.18), 0 0 20px rgba(255, 139, 32, 0.24);
  }
  50% {
    box-shadow: 0 0 0 1px rgba(255, 190, 88, 0.36), 0 0 38px rgba(255, 139, 32, 0.48);
  }
}

@media (prefers-reduced-motion: reduce) {
  .needs-setup-attention {
    animation: none;
  }
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  padding: 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  flex-shrink: 0;
}

.lang-button {
  margin: 0;
  min-height: 0;
  padding: 0.2rem 0.3rem;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  box-shadow: none;
  font: inherit;
  line-height: 1.2;
  letter-spacing: 0.08em;
}

.lang-button:hover,
.lang-button:focus-visible {
  color: var(--neon-mint);
  background: transparent;
  outline: none;
}

.lang-button:focus-visible {
  box-shadow: 0 0 0 2px rgba(56, 240, 255, 0.45);
}

.lang-button.is-active {
  color: var(--neon-mint);
  text-shadow: 0 0 12px rgba(93, 255, 200, 0.45);
}

.lang-separator {
  color: var(--muted);
  opacity: 0.45;
  user-select: none;
  font-weight: 600;
}

.app-shell {
  max-width: 72rem;
  width: 100%;
  margin: 0 auto;
  padding: 22px clamp(16px, 4vw, 42px) 34px;
}

.site-footer {
  margin-top: auto;
  padding: 2rem 1.25rem;
  background: rgba(2, 10, 8, 0.65);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  border-top: 1px solid var(--glass-border);
  color: var(--color-ink-dim);
  font-size: 0.9rem;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.35);
}

.site-footer a {
  color: var(--neon-mint);
}

.site-footer a:hover {
  color: var(--color-ink);
}

.site-footer__inner {
  max-width: 72rem;
  margin: 0 auto;
}

.site-footer__line {
  margin: 0;
  line-height: 1.5;
}

.site-footer__imprint-link {
  font-weight: 600;
}

.workspace-section {
  position: relative;
  min-width: 0;
  background: var(--glass-bg);
  backdrop-filter: blur(18px) saturate(1.35);
  -webkit-backdrop-filter: blur(18px) saturate(1.35);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.section-header {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
  min-width: 0;
  padding: 14px 54px 14px 16px;
  border-bottom: 1px solid var(--line);
}

.plot-heading {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  gap: 7px 10px;
  align-items: center;
  min-width: 0;
  padding-top: 4px;
}

.curve-header-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 10px;
  align-items: center;
  justify-content: end;
  min-width: 0;
  padding-right: 4px;
}

.curve-header-actions .plot-toggle {
  flex: 0 0 auto;
}

.curve-header-actions .fullscreen-actions {
  flex: 0 0 auto;
}

.section-header h2 {
  flex: 0 0 auto;
  margin: 0;
  font-size: 1rem;
  line-height: 1.25;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(56, 240, 255, 0.08);
  font-size: 0.84rem;
  white-space: nowrap;
}

.plot-heading .status-pill {
  white-space: normal;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
}

.status-dot.ready {
  background: var(--green);
}

.status-dot.error {
  background: var(--red);
}

.source-row {
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.source-row:last-child {
  border-bottom: 0;
}

.source-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.source-head.compact {
  margin-bottom: 10px;
}

.source-title {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
}

.swatch {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.16);
  flex: 0 0 auto;
}

.swatch.red {
  background: var(--red);
}

.swatch.green {
  background: var(--green);
}

.swatch.spectrum {
  background: linear-gradient(90deg, var(--violet), var(--blue), var(--green), var(--gold), var(--red));
}

.source-meta {
  color: var(--muted);
  font-size: 0.84rem;
  text-align: right;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 106px;
  gap: 10px;
  align-items: end;
}

.field-grid.single {
  grid-template-columns: 1fr;
}

.crop-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 10px;
  align-items: end;
  margin-top: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(4, 20, 16, 0.3);
}

.crop-controls input[type="range"] {
  display: block;
}

.crop-reset {
  min-height: 34px;
  padding: 0 10px;
  font-size: 0.76rem;
}

.crop-reset:disabled {
  cursor: not-allowed;
}

.field label {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  margin-bottom: 5px;
  font-weight: 650;
  text-transform: uppercase;
}

.sample-line {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.86rem;
}

.sample-line code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--text);
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 6px;
}

.workspace {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.seo-summary {
  margin-top: 18px;
  padding: 18px;
  border-radius: var(--radius);
}

.seo-summary h2 {
  margin: 0 0 9px;
  color: var(--neon-mint);
  font-size: 1rem;
}

.seo-summary h3 {
  margin: 16px 0 8px;
  color: var(--neon-mint);
  font-size: 1rem;
}

.seo-summary p {
  margin: 0 0 9px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.seo-summary p:last-child {
  margin-bottom: 0;
}

.preview-box {
  min-width: 0;
}

.preview-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 0.86rem;
  margin-bottom: 8px;
}

.preview-label.compact {
  margin-top: 10px;
  margin-bottom: 0;
}

.canvas-frame {
  position: relative;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  background:
    linear-gradient(45deg, rgba(0,0,0,0.04) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(0,0,0,0.04) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(0,0,0,0.04) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(0,0,0,0.04) 75%),
    rgba(255, 255, 255, 0.92);
  background-size: 22px 22px;
  background-position: 0 0, 0 11px, 11px -11px, -11px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  min-height: 160px;
}

.canvas-frame.large {
  min-height: 280px;
}

.plot-frame {
  width: 100%;
  height: var(--plot-height, 300px);
  background:
    linear-gradient(180deg, rgba(93, 255, 200, 0.08), rgba(56, 240, 255, 0.025)),
    rgba(4, 22, 18, 0.58);
  backdrop-filter: blur(16px) saturate(1.25);
  -webkit-backdrop-filter: blur(16px) saturate(1.25);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), inset 0 0 42px rgba(93, 255, 200, 0.06);
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  touch-action: none;
}

#spectrumCanvas,
#plotCanvas {
  min-height: 280px;
  max-width: 100%;
}

.plot-frame #plotCanvas {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  max-width: 100%;
  cursor: crosshair;
}

#redCanvas,
#greenCanvas,
#spectrumCanvas {
  cursor: crosshair;
}

.reference-frame.is-interaction-disabled,
.spectrum-frame.is-interaction-disabled {
  cursor: not-allowed;
}

.reference-frame.is-interaction-disabled canvas,
.spectrum-frame.is-interaction-disabled canvas {
  pointer-events: none;
  cursor: not-allowed;
}

.spectrum-controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  padding: 0 16px 16px;
  align-items: end;
}

.spectrum-controls.modal-controls {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 0;
  margin-top: 12px;
}

.toggle-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  color: var(--muted);
  font-size: 0.9rem;
}

.toggle-line input {
  width: 17px;
  height: 17px;
  accent-color: var(--green);
}

.toggle-line input:disabled {
  cursor: not-allowed;
}

.toggle-line input:disabled + span {
  opacity: 0.48;
}

.toggle-line:has(input:disabled) {
  cursor: not-allowed;
}

.plot-toggle {
  min-height: 38px;
  padding: 0 2px;
  white-space: nowrap;
}

.fullscreen-button {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 3;
  width: 38px;
  min-height: 34px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: rgba(232, 250, 244, 0.78);
  font-family: var(--font-sans);
  font-size: 0.96rem;
  letter-spacing: 0;
  line-height: 1;
  box-shadow: none;
  white-space: nowrap;
}

.fullscreen-button:hover:not(:disabled),
.fullscreen-button:focus-visible {
  border: 0;
  background: rgba(93, 255, 200, 0.08);
  color: var(--neon-mint);
  transform: none;
  box-shadow: none;
}

.fullscreen-actions {
  display: none;
  gap: 10px;
  align-items: center;
  flex-wrap: nowrap;
}

#contentContainer:fullscreen,
#contentContainer:-webkit-full-screen,
body.content-fullscreen-fallback #contentContainer {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  border-radius: 0;
  border: 0;
  display: flex;
  flex-direction: column;
  overflow: auto;
  background: rgba(4, 22, 18, 0.9);
}

body.content-fullscreen-fallback #contentContainer {
  position: fixed;
  inset: 0;
  z-index: 30;
}

#contentContainer:fullscreen .section-header,
#contentContainer:-webkit-full-screen .section-header,
body.content-fullscreen-fallback #contentContainer .section-header {
  position: sticky;
  top: 0;
  z-index: 2;
  background: rgba(4, 22, 18, 0.72);
  backdrop-filter: blur(18px) saturate(1.35);
  -webkit-backdrop-filter: blur(18px) saturate(1.35);
}

#contentContainer:fullscreen .fullscreen-actions,
#contentContainer:-webkit-full-screen .fullscreen-actions,
body.content-fullscreen-fallback #contentContainer .fullscreen-actions {
  display: flex;
}

#contentContainer:fullscreen .plot-area,
#contentContainer:-webkit-full-screen .plot-area,
body.content-fullscreen-fallback #contentContainer .plot-area {
  flex: 1 1 auto;
  min-height: 360px;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
}

#contentContainer:fullscreen .canvas-frame.large,
#contentContainer:-webkit-full-screen .canvas-frame.large,
body.content-fullscreen-fallback #contentContainer .canvas-frame.large {
  flex: 1 1 auto;
  height: auto;
  min-height: 360px;
}

#contentContainer:fullscreen #plotCanvas,
#contentContainer:-webkit-full-screen #plotCanvas,
body.content-fullscreen-fallback #contentContainer #plotCanvas {
  min-height: 0;
}

.plot-area {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 16px;
}

.plot-explainer {
  color: rgba(232, 250, 244, 0.7);
  font-size: 0.84rem;
  line-height: 1.35;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 0 16px 16px;
}

.metric {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  background: rgba(4, 20, 16, 0.38);
  box-shadow: inset 0 1px 0 var(--glass-highlight);
  min-width: 0;
}

.metric-label {
  color: var(--muted);
  font-size: 0.76rem;
  text-transform: uppercase;
  font-weight: 700;
  margin-bottom: 5px;
}

.metric-value {
  font-size: 1.12rem;
  font-weight: 760;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.table-wrap {
  padding: 0 16px 16px;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  background: rgba(4, 20, 16, 0.38);
}

th,
td {
  text-align: left;
  padding: 9px 8px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 0.76rem;
  text-transform: uppercase;
  background: rgba(56, 240, 255, 0.08);
}

.empty-cell {
  color: var(--muted);
}

.message-bar {
  margin: 0 16px 16px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: rgba(4, 20, 16, 0.38);
  font-size: 0.9rem;
}

.modal[hidden] {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  box-sizing: border-box;
  padding: clamp(14px, 3vw, 32px);
  overflow: hidden;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.52);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.intro-modal .modal-backdrop {
  background: rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(18px) saturate(0.82);
  -webkit-backdrop-filter: blur(18px) saturate(0.82);
}

.choice-modal {
  z-index: 36;
}

.modal-panel {
  position: relative;
  z-index: 1;
  width: min(1160px, 100%);
  max-height: min(88vh, 900px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  background: rgba(4, 22, 18, 0.72);
  backdrop-filter: blur(22px) saturate(1.3);
  -webkit-backdrop-filter: blur(22px) saturate(1.3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.42), inset 0 1px 0 var(--glass-highlight);
}

.adjustable-modal-panel {
  min-width: min(520px, calc(100vw - 20px));
  min-height: min(420px, calc(100vh - 20px));
  height: min(760px, calc(100vh - 64px));
  height: min(760px, calc(100dvh - 64px));
  grid-template-rows: auto auto minmax(0, 1fr) auto;
}

.adjustable-modal-panel.is-floating {
  position: fixed;
  max-height: none;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.modal-drag-handle {
  cursor: move;
  user-select: none;
}

.modal-drag-handle button {
  cursor: pointer;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.12rem;
}

.modal-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

#closeReferencesButton,
#closeHelpButton,
#closeSpectrumReferenceButton {
  width: 38px;
  padding: 0;
  font-size: 1.4rem;
  line-height: 1;
}

.choice-panel {
  width: min(560px, 100%);
  max-height: min(88vh, 620px);
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.choice-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px 0;
}

.choice-mark {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(93, 255, 200, 0.07);
}

.choice-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  box-shadow: 0 0 18px currentColor;
}

.choice-dot.red {
  color: #ff5a50;
  background: currentColor;
}

.choice-dot.green {
  color: var(--neon-mint);
  background: currentColor;
}

.choice-body {
  min-height: 0;
  overflow: auto;
  padding: 12px 22px 16px;
}

.choice-body h2 {
  margin: 0 0 8px;
  font-size: clamp(1.28rem, 2.4vw, 1.75rem);
  line-height: 1.16;
}

.choice-body p {
  margin: 0;
  color: var(--color-ink-dim);
  font-size: 0.98rem;
  line-height: 1.5;
}

.choice-body .choice-note {
  margin-top: 10px;
  color: var(--muted);
}

.choice-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  padding: 16px 18px 18px;
  border-top: 1px solid var(--line);
  background: rgba(4, 20, 16, 0.28);
}

.modal-body {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 16px;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
}

.setup-stepper {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(4, 20, 16, 0.28);
}

.setup-step-button {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  min-width: 0;
  min-height: 42px;
  padding: 7px 10px;
  text-align: left;
  color: var(--muted);
}

.setup-step-button.is-active {
  color: var(--text);
  border-color: var(--line-strong);
  background: rgba(93, 255, 200, 0.1);
}

.setup-step-button.is-complete .setup-step-number {
  border-color: rgba(93, 255, 200, 0.52);
  background: rgba(93, 255, 200, 0.16);
  color: var(--neon-mint);
}

.setup-step-button:disabled {
  cursor: default;
  opacity: 0.46;
}

.setup-step-number {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 760;
}

.setup-wizard-body {
  grid-template-columns: 1fr;
}

.setup-wizard-page {
  grid-column: 1 / -1;
}

.setup-step-intro {
  margin: 0 0 14px;
  padding: 11px 13px;
  border: 1px solid rgba(93, 255, 200, 0.16);
  border-radius: var(--radius-sm);
  background: rgba(93, 255, 200, 0.06);
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.48;
}

.setup-wizard-nav {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  background: rgba(4, 20, 16, 0.28);
}

.setup-step-hint {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
  text-align: center;
}

.modal-resize-handle {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 22px;
  height: 22px;
  cursor: nwse-resize;
  z-index: 2;
}

.modal-resize-handle::before {
  content: "";
  position: absolute;
  right: 6px;
  bottom: 6px;
  width: 10px;
  height: 10px;
  border-right: 2px solid var(--line-strong);
  border-bottom: 2px solid var(--line-strong);
}

.reference-editor {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(4, 20, 16, 0.38);
  padding: 14px;
}

.spectrum-editor {
  grid-column: 1 / -1;
}

.reference-editor-layout {
  display: grid;
  grid-template-rows: auto minmax(180px, 1fr);
  gap: 12px;
}

.spectrum-editor-layout {
  grid-template-columns: minmax(260px, 330px) minmax(0, 1fr);
  grid-template-rows: none;
  align-items: start;
}

.reference-frame {
  min-height: 0;
  align-self: start;
  background:
    linear-gradient(180deg, rgba(93, 255, 200, 0.06), rgba(56, 240, 255, 0.018)),
    rgba(4, 22, 18, 0.5);
  backdrop-filter: blur(14px) saturate(1.22);
  -webkit-backdrop-filter: blur(14px) saturate(1.22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.045);
}

.spectrum-frame {
  min-height: 0;
  align-self: start;
  background:
    linear-gradient(180deg, rgba(93, 255, 200, 0.06), rgba(56, 240, 255, 0.018)),
    rgba(4, 22, 18, 0.5);
  backdrop-filter: blur(14px) saturate(1.22);
  -webkit-backdrop-filter: blur(14px) saturate(1.22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.045);
}

.reference-frame canvas,
.spectrum-frame canvas {
  width: 100%;
  height: auto;
  min-height: 0;
}

.intro-panel {
  width: min(520px, 100%);
}

.intro-body {
  padding: 18px;
}

.intro-steps {
  margin: 0 0 18px;
  padding-left: 0;
  color: var(--text);
  list-style: none;
}

.intro-steps li {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  margin: 0 0 10px;
  line-height: 1.45;
}

.step-glyph {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface-alt);
  color: var(--neon-mint);
  font-size: 1rem;
  font-weight: 760;
  line-height: 1;
}

.intro-body .primary-button {
  width: 100%;
}

.help-panel {
  width: min(820px, 100%);
}

.help-body {
  display: grid;
  gap: 14px;
  padding: 18px;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
}

.help-section {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(4, 20, 16, 0.38);
  padding: 14px;
}

.help-section h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.help-section p,
.help-section li {
  color: var(--muted);
  line-height: 1.45;
}

.help-section p {
  margin: 0 0 9px;
}

.help-section p:last-child {
  margin-bottom: 0;
}

.help-section ol {
  margin: 0;
  padding-left: 20px;
}

.help-section li {
  margin-bottom: 7px;
}

.help-section li:last-child {
  margin-bottom: 0;
}

@media (max-width: 1050px) {
  .app-header {
    grid-template-columns: 1fr;
  }

  .header-actions {
    justify-content: flex-start;
  }

  .modal-body {
    grid-template-columns: 1fr;
  }

  .spectrum-editor-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .section-header {
    flex-wrap: wrap;
  }

  .curve-header-actions {
    margin-left: auto;
  }

  .spectrum-controls,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .app-header {
    position: static;
  }

  .field-grid {
    grid-template-columns: 1fr;
  }

  .setup-stepper {
    grid-template-columns: 1fr;
  }

  .setup-wizard-nav {
    grid-template-columns: 1fr;
  }

  .setup-step-hint {
    text-align: left;
    order: -1;
  }

  .choice-actions {
    grid-template-columns: 1fr;
  }

  .crop-controls {
    grid-template-columns: 1fr;
  }

  .modal {
    padding: 10px;
    place-items: center;
    overflow: hidden;
  }

  .modal-panel {
    max-height: 100%;
  }

  .adjustable-modal-panel {
    width: 100%;
    min-height: 0;
    height: 100%;
  }

  .modal-header {
    align-items: flex-start;
  }

  .reference-editor-layout,
  .spectrum-editor-layout {
    grid-template-rows: auto auto;
  }

  .spectrum-controls.modal-controls {
    grid-template-columns: 1fr;
  }
}
