:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #06131a;
  color: #eefbff;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 16% 0%, rgba(95, 210, 255, 0.22), transparent 36%),
    radial-gradient(circle at 90% 14%, rgba(178, 244, 255, 0.16), transparent 30%),
    #06131a;
  background-size: auto, auto, auto;
}

button,
input,
select {
  font: inherit;
}

a {
  color: inherit;
}

code {
  border: 1px solid rgba(125, 220, 255, 0.28);
  border-radius: 5px;
  background: rgba(2, 11, 16, 0.88);
  color: #b8f3ff;
  padding: 0.08rem 0.28rem;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.9em;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: 100%;
  border-bottom: 1px solid rgba(125, 220, 255, 0.18);
  background: rgba(6, 19, 26, 0.9);
  padding: 14px max(20px, calc((100vw - 1180px) / 2));
  backdrop-filter: blur(18px);
}

.brand {
  display: grid;
  gap: 1px;
  color: #eefbff;
  text-decoration: none;
}

.brand span {
  color: #7ddcff;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 1.05rem;
  font-weight: 800;
}

.brand small {
  color: #8fb8c7;
  font-size: 0.72rem;
  font-weight: 650;
}

.site-header nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
}

.site-header nav a {
  border-radius: 6px;
  color: #bfdce6;
  font-size: 0.9rem;
  font-weight: 650;
  padding: 8px 10px;
  text-decoration: none;
}

.site-header nav a:hover {
  background: rgba(125, 220, 255, 0.12);
  color: #7ddcff;
}

.site-header nav a[aria-current="page"] {
  background: rgba(125, 220, 255, 0.14);
  color: #7ddcff;
}

main,
.site-footer {
  width: calc(100% - 32px);
  max-width: 1180px;
  margin: 0 auto;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  align-items: end;
  gap: 32px;
  padding: 56px 0 28px;
}

.hero-copy {
  min-width: 0;
  max-width: 820px;
}

.eyebrow,
.section-kicker {
  margin: 0 0 10px;
  color: #7ddcff;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.eyebrow::before,
.section-kicker::before {
  content: "> ";
  color: #39c8ff;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 860px;
  margin-bottom: 18px;
  color: #f3fcff;
  font-size: clamp(2.45rem, 6vw, 4.8rem);
  line-height: 0.98;
  letter-spacing: 0;
  overflow-wrap: anywhere;
  text-shadow: 0 0 34px rgba(125, 220, 255, 0.18);
}

h2 {
  margin-bottom: 12px;
  color: #f3fcff;
  font-size: clamp(1.55rem, 3vw, 2.25rem);
  line-height: 1.1;
}

h3 {
  margin-bottom: 10px;
  color: #e5faff;
  font-size: 1.05rem;
}

.lede {
  max-width: 760px;
  margin-bottom: 0;
  color: #bedce6;
  font-size: 1.08rem;
  line-height: 1.65;
}

.disclosure-kicker {
  margin-top: 28px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.button,
#startButton,
#pauseButton,
#stopButton,
#exportButton,
#deleteButton {
  min-height: 44px;
  border-radius: 6px;
  padding: 0 18px;
  font-weight: 760;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.button.primary,
#startButton {
  border: 1px solid rgba(125, 220, 255, 0.6);
  background: #66d9ff;
  color: #021019;
  box-shadow: 0 0 28px rgba(102, 217, 255, 0.22);
}

.button.primary:hover,
#startButton:hover {
  background: #7ddcff;
}

.button.secondary,
#pauseButton,
#stopButton,
#exportButton,
#deleteButton {
  border: 1px solid rgba(184, 243, 255, 0.3);
  background: rgba(2, 11, 16, 0.72);
  color: #e5faff;
}

.button.secondary:hover,
#pauseButton:hover:not(:disabled),
#stopButton:hover:not(:disabled),
#exportButton:hover:not(:disabled),
#deleteButton:hover:not(:disabled) {
  border-color: rgba(125, 220, 255, 0.6);
  background: rgba(125, 220, 255, 0.12);
}

.research-note {
  min-width: 0;
  border: 1px solid rgba(125, 220, 255, 0.3);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(9, 31, 42, 0.92), rgba(5, 18, 25, 0.94));
  padding: 18px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.32), inset 0 1px 0 rgba(213, 248, 255, 0.1);
}

.research-note strong {
  display: block;
  margin-bottom: 8px;
  color: #7ddcff;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.research-note p,
.site-footer p {
  color: #b7d2dc;
  line-height: 1.62;
}

.research-note p,
.site-footer p {
  margin-bottom: 0;
}

.demo-panel {
  margin-top: 24px;
  border: 1px solid rgba(125, 220, 255, 0.24);
  border-radius: 8px;
  background: rgba(6, 22, 31, 0.9);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.26), inset 0 1px 0 rgba(213, 248, 255, 0.08);
}

.demo-panel {
  padding: 24px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.panel-header h2 {
  margin-bottom: 6px;
}

#statusText {
  margin-bottom: 0;
  color: #a9c7d2;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

#startButton,
#pauseButton,
#stopButton,
#exportButton,
#deleteButton {
  cursor: pointer;
}

#exportButton:disabled,
#startButton:disabled,
#pauseButton:disabled,
#stopButton:disabled,
#deleteButton:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.settings-grid {
  display: grid;
  gap: 12px;
}

.settings-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 18px;
}

.stats-grid div {
  border: 1px solid rgba(125, 220, 255, 0.2);
  border-radius: 6px;
  background: rgba(2, 11, 16, 0.74);
}

.stat-label {
  margin-bottom: 6px;
  color: #88b7c7;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
}

.stat-value {
  margin: 0;
  color: #eefbff;
  font-weight: 780;
}

.settings-grid label {
  display: grid;
  gap: 7px;
  color: #9ec7d6;
  font-size: 0.86rem;
  font-weight: 720;
}

.settings-grid select,
.settings-grid input[type="range"] {
  min-height: 42px;
  width: 100%;
}

.settings-grid select {
  border: 1px solid rgba(184, 243, 255, 0.3);
  border-radius: 6px;
  background: #06131a;
  color: #eefbff;
  padding: 0 10px;
}

.range-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

#yAxisValue {
  color: #7ddcff;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.82rem;
}

.settings-grid input[type="range"] {
  accent-color: #66d9ff;
  cursor: pointer;
}

.settings-grid select:focus-visible,
.settings-grid input[type="range"]:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 2px solid #7ddcff;
  outline-offset: 2px;
}

.chart-frame {
  min-height: 320px;
  border: 1px solid rgba(125, 220, 255, 0.24);
  border-radius: 6px;
  background: #020b10;
  overflow: hidden;
}

#traceCanvas {
  display: block;
  width: 100%;
  height: 370px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0 0;
}

.stats-grid div {
  min-width: 0;
  padding: 14px;
}

.stat-value {
  overflow-wrap: anywhere;
  color: #7ddcff;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 1.12rem;
}

.guide-panel {
  display: grid;
  grid-template-columns: minmax(0, 0.75fr) minmax(0, 1.25fr);
  gap: 28px;
  padding: 34px 0 18px;
}

.guide-copy p {
  max-width: 520px;
  margin-bottom: 0;
  color: #bedce6;
  line-height: 1.68;
}

.guide-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.guide-grid > div {
  min-width: 0;
  border-left: 1px solid rgba(125, 220, 255, 0.3);
  padding-left: 18px;
}

.check-list,
.signal-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.check-list li,
.signal-list li {
  position: relative;
  color: #bedce6;
  line-height: 1.58;
  padding-left: 24px;
}

.check-list li::before,
.signal-list li::before {
  position: absolute;
  left: 0;
  color: #7ddcff;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-weight: 800;
}

.check-list li::before {
  content: "[ ]";
  font-size: 0.74rem;
  top: 0.14rem;
}

.signal-list li::before {
  content: ">";
}

.signal-list strong {
  color: #eefbff;
}

.legal-page {
  padding: 56px 0 20px;
}

.legal-page h1 {
  max-width: 900px;
  margin-bottom: 28px;
}

.legal-page .lede {
  margin-bottom: 24px;
}

.legal-grid {
  display: grid;
  gap: 14px;
  max-width: 900px;
}

.legal-grid section {
  border: 1px solid rgba(125, 220, 255, 0.22);
  border-radius: 8px;
  background: rgba(6, 22, 31, 0.86);
  padding: 20px;
}

.legal-grid h2 {
  margin-bottom: 10px;
  font-size: 1.18rem;
}

.legal-grid p {
  margin-bottom: 12px;
  color: #bedce6;
  line-height: 1.68;
}

.legal-grid p:last-child {
  margin-bottom: 0;
}

.legal-grid a,
.site-footer nav a {
  color: #7ddcff;
  text-decoration-color: rgba(125, 220, 255, 0.48);
  text-underline-offset: 3px;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 28px 0 44px;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

noscript {
  display: block;
  width: calc(100% - 32px);
  max-width: 1180px;
  margin: 16px auto;
  border: 1px solid rgba(255, 188, 104, 0.6);
  border-radius: 8px;
  background: rgba(55, 35, 8, 0.75);
  color: #ffd9a3;
  padding: 14px;
}

@media (max-width: 960px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .guide-panel {
    grid-template-columns: 1fr;
  }

  .settings-grid,
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

}

@media (max-width: 680px) {
  .site-header {
    position: static;
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
    padding: 14px 16px;
  }

  .site-header nav {
    justify-content: flex-start;
  }

  main,
  .site-footer {
    width: calc(100% - 24px);
  }

  .hero {
    padding-top: 32px;
  }

  .hero-copy,
  .lede,
  .research-note,
  .demo-panel {
    max-width: calc(100vw - 24px);
  }

  h1 {
    font-size: 2.15rem;
    line-height: 1.02;
  }

  .panel-header {
    align-items: stretch;
    flex-direction: column;
  }

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .actions,
  .hero-actions {
    display: grid;
  }

  .settings-grid,
  .guide-grid,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .demo-panel {
    padding: 18px;
  }

  #traceCanvas {
    height: 310px;
  }
}
