:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  background: #08110f;
  color: #ecfdf5;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at top, #12372d, #08110f 55%); }
main { width: min(960px, calc(100% - 32px)); margin: 0 auto; padding: 36px 0 56px; }
h1 { margin: 0 0 8px; font-size: clamp(2rem, 6vw, 4rem); letter-spacing: -0.04em; }
h2 { margin-top: 0; }
p { color: #b7d8cd; line-height: 1.6; }
a { color: inherit; }
.eyebrow { color: #6ee7b7; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; }
.panel { margin-top: 24px; padding: 24px; border: 1px solid #285449; border-radius: 20px; background: rgba(7, 26, 22, 0.88); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 20px; }
.button, button, input::file-selector-button {
  border: 0; border-radius: 999px; padding: 12px 18px; background: #6ee7b7; color: #06231a;
  font: inherit; font-weight: 800; text-decoration: none; cursor: pointer;
}
button.secondary, .button.secondary { background: #173d33; color: #d1fae5; }
button:disabled { opacity: 0.45; cursor: not-allowed; }
input[type="file"] { width: 100%; padding: 16px; border: 1px dashed #3a6e60; border-radius: 14px; color: #d1fae5; }
.controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-top: 16px; }
.controls label { display: grid; gap: 7px; color: #b7d8cd; font-weight: 700; }
select, input[type="range"] { width: 100%; }
.toggle span { display: flex; align-items: center; gap: 8px; min-height: 40px; color: #ecfdf5; }
.toggle input { width: 18px; height: 18px; accent-color: #6ee7b7; }
select { border: 1px solid #3a6e60; border-radius: 10px; padding: 10px; background: #102e27; color: #ecfdf5; font: inherit; }
output { color: #6ee7b7; font-variant-numeric: tabular-nums; }
.status { margin-top: 16px; padding: 14px 16px; border-radius: 12px; background: #102e27; color: #d1fae5; }
.warning { border-left: 4px solid #fbbf24; background: #32270c; color: #fde68a; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; margin-top: 28px; }
.choice { display: block; padding: 24px; border: 1px solid #285449; border-radius: 18px; background: #0c241e; text-decoration: none; }
.choice:hover { border-color: #6ee7b7; transform: translateY(-2px); }
.choice strong { display: block; font-size: 1.35rem; margin-bottom: 8px; }
.matrix-shell { margin: 24px auto 0; width: min(100%, 760px); }
#matrix { width: 100%; height: auto; display: block; background: black; image-rendering: pixelated; }
.matrix-shell.dual-lane { width: min(100%, 460px); }
.matrix-shell:fullscreen { width: 100vw; height: 100vh; margin: 0; background: #000; display: grid; place-items: center; }
.matrix-shell:fullscreen #matrix { width: auto; height: auto; max-width: 100vw; max-height: 100vh; }
#preview { width: 100%; display: block; border-radius: 14px; background: #020807; cursor: crosshair; touch-action: manipulation; }
.metrics { display: flex; flex-wrap: wrap; gap: 10px 22px; margin-top: 12px; color: #a7f3d0; font-variant-numeric: tabular-nums; }
progress { width: 100%; height: 14px; margin-top: 16px; accent-color: #6ee7b7; }
.back { display: inline-block; margin-bottom: 24px; color: #a7f3d0; }
.sr-only-video { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
code { color: #a7f3d0; }
details { margin-top: 18px; color: #b7d8cd; }
summary { cursor: pointer; font-weight: 700; }
pre { white-space: pre-wrap; overflow-wrap: anywhere; padding: 12px; border-radius: 10px; background: #06110e; color: #a7f3d0; font-size: 0.82rem; line-height: 1.55; }
.advanced-controls { padding: 0 2px; }
.control-note { margin: 10px 0 0; font-size: 0.9rem; }
.safety-confirm { display: flex; align-items: center; gap: 9px; margin-top: 10px; color: #fff7d6; font-weight: 700; }
.safety-confirm input { width: 18px; height: 18px; accent-color: #fbbf24; }
.diagnostic-groups { margin-top: 18px; }
.diagnostic-groups details { border-top: 1px solid #285449; padding-top: 12px; }
.diagnostic-groups pre { margin-bottom: 8px; }

@media (max-width: 560px) {
  main { width: min(100% - 20px, 960px); padding-top: 22px; }
  .panel { padding: 16px; border-radius: 15px; }
}
