﻿:root {
  --bg: #141414;
  --surface: #1a1a1a;
  --text: #dfdfdc;
  --muted: #8d8a84;
  --soft: #5a5853;
  --line: #232323;
  --line-strong: #2c2c2c;
  --accent: #b0601e;
  --accent-soft: #cf8553;
  --green: #2a5e47;
  --green-soft: #86b39b;
  --yellow: #8e6b2a;
  --red: #7c3931;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", "SF Mono", Consolas, "Liberation Mono", Menlo, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  overscroll-behavior-y: contain;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  position: relative;
  --glow-a: rgba(176, 96, 30, 0.44);
  --glow-b: rgba(150, 75, 20, 0.3);
  --glow-c: rgba(190, 110, 40, 0.22);
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
}

body::before {
  content: "";
  position: fixed;
  inset: -8%;
  z-index: -1;
  opacity: 0.38;
  background:
    radial-gradient(ellipse at 18% 50%, var(--glow-a), transparent 54%),
    radial-gradient(ellipse at 82% 18%, var(--glow-b), transparent 52%),
    radial-gradient(ellipse at 52% 82%, var(--glow-c), transparent 54%);
  animation: drift 35s ease-in-out infinite alternate;
  pointer-events: none;
  will-change: transform, filter;
}

button,
input,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

code {
  font-family: var(--font-mono);
}

.app {
  position: relative;
  isolation: isolate;
  width: min(100%, 430px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px 18px 34px;
  transition: transform 0.22s ease;
  will-change: transform;
}

.app.pulling {
  transition: none;
}

.app[data-state="green"] {
  --accent: #2a5e47;
  --accent-soft: #86b39b;
}

.app[data-state="yellow"] {
  --accent: #8e6b2a;
  --accent-soft: #c59d47;
}

.app[data-state="orange"] {
  --accent: #b0601e;
  --accent-soft: #cf8553;
}

.app[data-state="red"] {
  --accent: #8c3b33;
  --accent-soft: #cc766d;
}

body[data-state="green"] {
  --glow-a: rgba(42, 94, 71, 0.44);
  --glow-b: rgba(30, 80, 55, 0.3);
  --glow-c: rgba(50, 110, 80, 0.22);
}

body[data-state="yellow"] {
  --glow-a: rgba(142, 107, 42, 0.44);
  --glow-b: rgba(120, 90, 30, 0.3);
  --glow-c: rgba(150, 120, 50, 0.22);
}

body[data-state="orange"] {
  --glow-a: rgba(176, 96, 30, 0.44);
  --glow-b: rgba(150, 75, 20, 0.3);
  --glow-c: rgba(190, 110, 40, 0.22);
}

body[data-state="red"] {
  --glow-a: rgba(140, 59, 51, 0.44);
  --glow-b: rgba(120, 40, 35, 0.3);
  --glow-c: rgba(160, 70, 60, 0.22);
}

@keyframes drift {
  0% {
    transform: translate(0, 0) scale(1);
    filter: hue-rotate(0deg);
  }
  33% {
    transform: translate(-3%, 2%) scale(1.03);
  }
  66% {
    transform: translate(2%, -2%) scale(0.98);
  }
  100% {
    transform: translate(-1%, 1%) scale(1.01);
    filter: hue-rotate(8deg);
  }
}

.topbar,
.scanner-panel,
.hero-panel,
.chart-panel,
.info-panel,
.events-panel,
.cta-panel,
.footer-mark,
.error-panel {
  border-top: 1px solid var(--line);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 10px 0 14px;
}

.brandline,
.brand-sub,
.section-label,
.meta-label,
.meta-row span,
.chart-copy,
.events-copy,
.meta-note,
.error-copy,
.error-title {
  margin: 0;
}

.brandline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.brand-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--accent);
}

.brand-word,
.brand-sub,
.section-label,
.meta-label,
.meta-row span,
.header-date,
.footer-mark {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

.brand-word {
  color: var(--muted);
  font-size: 9px;
}

.brand-sub {
  margin-top: 6px;
  color: var(--soft);
  font-size: 8px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.refresh-status {
  margin: 0;
  padding-top: 6px;
  color: var(--accent-soft);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.help-shell {
  position: relative;
}

.header-date {
  color: var(--soft);
  font-size: 8px;
  white-space: nowrap;
}

.help-button,
.refresh-button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}

.refresh-button:hover,
.help-button:hover,
.refresh-button:focus-visible {
  border-color: var(--accent);
  color: var(--text);
  outline: none;
}

.help-button:focus-visible {
  border-color: var(--accent);
  color: var(--text);
  outline: none;
}

.refresh-button:disabled {
  opacity: 0.5;
  cursor: wait;
}

.refresh-button.loading {
  border-color: var(--accent);
  color: var(--accent-soft);
}

.help-popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 10;
  width: min(320px, calc(100vw - 32px));
  padding: 14px 0 0;
  border: 1px solid var(--line-strong);
  background: rgba(20, 20, 20, 0.98);
}

.help-popover[hidden] {
  display: none;
}

.promise-block {
  padding: 0 14px 14px;
}

.promise-block + .promise-block {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.promise-copy {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.65;
}

.method-stack {
  display: grid;
  gap: 12px;
}

.flow {
  display: grid;
  gap: 0;
}

.scanner-panel,
.hero-panel,
.chart-panel,
.info-panel,
.events-panel,
.cta-panel,
.error-panel {
  padding: 16px 0 18px;
}

.scanner-panel {
  display: grid;
  gap: 8px;
  transition: opacity 0.4s ease, max-height 0.4s ease, padding 0.35s ease;
  max-height: 280px;
  overflow: hidden;
}

.scanner-panel.minimized {
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  opacity: 0;
}

.scan-line {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 22px;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.scan-line.visible {
  opacity: 1;
  transform: translateY(0);
}

.scan-dot {
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: var(--soft);
  flex: 0 0 auto;
}

.scan-copy {
  flex: 1;
  color: var(--muted);
  font-size: 11px;
}

.scan-mark {
  color: var(--soft);
  font-size: 11px;
}

.scan-line.active .scan-dot {
  background: var(--accent);
  animation: pulse 0.9s ease infinite;
}

.scan-line.done .scan-dot {
  background: var(--green-soft);
}

.scan-line.done .scan-mark::before {
  content: "✓";
  color: var(--green-soft);
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.35;
  }
}

.stage {
  opacity: 0;
  transform: translateY(14px);
  pointer-events: none;
  transition: opacity 0.55s ease, transform 0.55s ease;
}

.stage.revealed {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.section-label {
  color: var(--soft);
  font-size: 8px;
}

.hero-panel {
  padding-top: 28px;
}

.hero-readout {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-top: 14px;
}

.hero-value {
  font-size: clamp(7rem, 30vw, 9.25rem);
  font-weight: 300;
  line-height: 0.82;
  letter-spacing: -0.08em;
  color: var(--text);
}

.hero-scale {
  margin-top: 8px;
  color: var(--soft);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.16em;
}

.state-phrase {
  margin: 28px 0 0;
  color: var(--text);
  font-size: 18px;
  font-weight: 500;
  line-height: 1.4;
}

.state-sub {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.hero-meta {
  display: flex;
  gap: 0;
  margin-top: 26px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.hero-meta-col {
  flex: 1;
}

.hero-meta-col + .hero-meta-col {
  padding-left: 14px;
  border-left: 1px solid var(--line);
}

.meta-label {
  color: var(--soft);
  font-size: 8px;
}

.meta-value {
  margin: 6px 0 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.4;
}

.meta-value.accent {
  color: var(--accent-soft);
}

.meta-stack {
  margin-top: 18px;
  border-top: 1px solid var(--line);
}

.meta-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.meta-row span {
  color: var(--soft);
  font-size: 8px;
}

.meta-row strong {
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  text-align: right;
}

.meta-note {
  padding: 10px 0 2px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.chart-head {
  display: grid;
  gap: 8px;
}

.chart-copy {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.bars-grid {
  display: grid;
  grid-template-columns: repeat(30, minmax(0, 1fr));
  gap: 2px;
  align-items: end;
  height: 172px;
  margin-top: 20px;
}

.bar-card {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: stretch;
  height: 100%;
}

.bar-value {
  margin-bottom: 6px;
  color: var(--soft);
  font-size: 10px;
  text-align: center;
}

.bar-shape {
  width: 100%;
  border-radius: 1px 1px 0 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
  transition: opacity 0.25s ease;
}

.bar-card.current .bar-value {
  color: var(--text);
}

.bar-card.current .bar-shape {
  background: linear-gradient(180deg, rgba(207, 133, 83, 0.96), rgba(176, 96, 30, 0.72));
}

.bar-label {
  margin-top: 8px;
  color: var(--soft);
  font-family: var(--font-mono);
  font-size: 7px;
  text-align: center;
  text-transform: uppercase;
  min-height: 9px;
}

.bar-card.current .bar-label {
  color: var(--accent-soft);
}

.info-heading {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
}

.info-body {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.driver-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.drivers-copy {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
  max-width: 34ch;
}

.driver-group {
  display: grid;
  gap: 0;
}

.driver-row {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr) 30px;
  gap: 10px;
  align-items: center;
}

.driver-name {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.driver-track {
  width: 100%;
  height: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
}

.driver-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  transition: width 0.8s ease;
}

.driver-value {
  color: var(--soft);
  font-size: 11px;
  text-align: right;
  white-space: nowrap;
}

.driver-explain {
  margin: 6px 0 0;
  padding-left: 100px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.tips-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.tip-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
}

.tip-badge {
  display: inline-flex;
  min-width: 60px;
  justify-content: center;
  padding: 3px 6px;
  border: 1px solid currentColor;
  color: var(--accent-soft);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.tip-badge.calma {
  color: var(--green-soft);
}

.tip-text {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.disclaimer {
  margin-top: 16px;
  color: var(--soft);
  font-size: 10px;
  line-height: 1.6;
}

.method-item {
  display: grid;
  gap: 0;
}

.events-title {
  margin: 10px 0 0;
  color: var(--text);
  font-size: 24px;
  font-weight: 500;
  line-height: 1.15;
}

.events-copy {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
  max-width: 34ch;
}

.history-chart-shell {
  position: relative;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.history-chart {
  display: block;
  width: 100%;
  height: auto;
}

.history-grid {
  stroke: var(--line);
  stroke-width: 1;
}

.history-axis {
  fill: var(--soft);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.history-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.history-ipc-line {
  fill: none;
  stroke: rgba(223, 223, 220, 0.28);
  stroke-width: 2;
  stroke-dasharray: 4 5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.history-event-guide {
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 1;
  stroke-dasharray: 4 4;
}

.history-event-dot {
  fill: var(--bg);
  stroke-width: 2.5;
}

.chart-tooltip {
  position: absolute;
  display: none;
  min-width: 116px;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  background: rgba(20, 20, 20, 0.94);
  color: var(--text);
  font-size: 10px;
  line-height: 1.45;
  pointer-events: none;
}

.chart-tooltip span {
  display: block;
}

.tooltip-date {
  color: var(--soft);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tooltip-signal,
.tooltip-ipc {
  margin-top: 3px;
}

.events-list {
  display: grid;
  gap: 12px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.history-empty {
  margin: 0;
  color: var(--soft);
  font-size: 11px;
}

.event-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.event-dot {
  width: 7px;
  height: 7px;
  margin-top: 5px;
  border-radius: 999px;
  flex: 0 0 auto;
}

.event-meta {
  color: var(--soft);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.event-title {
  margin: 5px 0 0;
  color: var(--text);
  font-size: 12px;
  line-height: 1.5;
}

.cta-title {
  margin: 0;
  color: var(--text);
  font-size: 18px;
  font-weight: 500;
}

.cta-copy {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.cta-button {
  margin-top: 16px;
  padding: 12px 20px;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent-soft);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
}

.signup-row {
  display: none;
  gap: 8px;
  margin-top: 12px;
}

.signup-row.open {
  display: flex;
}

.signup-input {
  flex: 1;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
}

.signup-input::placeholder {
  color: var(--soft);
}

.signup-submit {
  padding: 12px 16px;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent-soft);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  cursor: pointer;
}

.signup-note {
  margin-top: 10px;
  color: var(--soft);
  font-size: 10px;
  line-height: 1.6;
}

.footer-note {
  margin: 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--soft);
  font-size: 10px;
  line-height: 1.7;
}

.error-panel {
  display: none;
}

.error-panel.visible {
  display: block;
}

.error-title {
  color: #d28e85;
  font-size: 15px;
}

.error-copy {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.footer-mark {
  margin-top: 18px;
  padding-top: 18px;
  color: var(--soft);
  font-size: 8px;
  text-align: center;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (min-width: 768px) {
  .app {
    padding-top: 24px;
    padding-bottom: 48px;
  }
}
