:root {
  color-scheme: dark;
  --bg: #0d1112;
  --surface: #151b1c;
  --surface-raised: #1b2323;
  --border: #303b3a;
  --border-strong: #465350;
  --text: #f3f6f2;
  --muted: #a1afab;
  --faint: #71807c;
  --accent: #70e1b1;
  --accent-hover: #8de9c2;
  --accent-ink: #06110c;
  --warning: #ffca72;
  --warning-bg: #251e12;
  --danger: #ff9384;
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  background: var(--bg);
  color: var(--text);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  background: radial-gradient(circle at 78% -20%, rgba(112, 225, 177, 0.11), transparent 35rem), var(--bg);
}

button,
input,
select {
  font: inherit;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
  padding: 0 28px;
  border-bottom: 1px solid #222a2a;
  background: rgba(13, 17, 18, 0.88);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--text);
  font-size: 15px;
  font-weight: 760;
  text-decoration: none;
}

.brand-icon {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 30px;
  padding: 5px 7px;
  border: 1px solid #34403e;
  border-radius: 8px;
  background: #202827;
}

.brand-icon i {
  display: block;
  width: 2px;
  border-radius: 2px;
  background: var(--accent);
}

.brand-icon i:nth-child(1),
.brand-icon i:nth-child(5) {
  height: 7px;
}
.brand-icon i:nth-child(2),
.brand-icon i:nth-child(4) {
  height: 14px;
}
.brand-icon i:nth-child(3) {
  height: 20px;
}

.privacy-chip {
  padding: 6px 9px;
  border: 1px solid #31403a;
  border-radius: 999px;
  color: #aee8ce;
  background: #15221d;
  font-size: 12px;
  font-weight: 650;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  gap: 20px;
  width: min(1080px, calc(100% - 40px));
  margin: 0 auto;
  padding: 68px 0 40px;
}

.hero {
  grid-column: 1 / -1;
  max-width: 780px;
  padding-bottom: 24px;
}

.eyebrow,
.section-kicker {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 760;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

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

h1 {
  max-width: 720px;
  margin-bottom: 17px;
  font-size: clamp(42px, 7vw, 72px);
  line-height: 0.98;
  letter-spacing: -0.055em;
}

h2 {
  margin-bottom: 0;
  font-size: 21px;
  letter-spacing: -0.025em;
}

.lede {
  max-width: 680px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.65;
}

.warning {
  grid-column: 1 / -1;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 17px 19px;
  border: 1px solid #5b4524;
  border-radius: 10px;
  background: var(--warning-bg);
  color: #ffe2ad;
}

.warning-icon {
  display: grid;
  flex: 0 0 26px;
  width: 26px;
  height: 26px;
  place-items: center;
  border: 1px solid #8a6730;
  border-radius: 50%;
  color: var(--warning);
  font-weight: 800;
}

.warning p {
  margin: 4px 0 0;
  color: #cdbb9c;
  font-size: 13px;
  line-height: 1.5;
}

.monitor-card,
.settings-card,
.diagnostics-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(21, 27, 28, 0.92);
}

.monitor-card {
  grid-row: span 2;
  padding: 27px;
}

.monitor-heading-row,
.diagnostics-heading,
.range-heading,
.meter-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.state-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border: 1px solid #3d4745;
  border-radius: 999px;
  color: var(--muted);
  background: #121717;
  font-size: 12px;
}

.state-pill span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #687572;
}

.state-pill[data-state="active"] {
  border-color: #315d4b;
  color: #b7f1d6;
  background: #12231c;
}

.state-pill[data-state="active"] span {
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(112, 225, 177, 0.12);
}

.state-pill[data-state="error"] {
  border-color: #713f3a;
  color: #ffc0b7;
  background: #281614;
}

.state-pill[data-state="error"] span {
  background: var(--danger);
}

.message {
  min-height: 44px;
  margin: 22px 0;
  padding: 12px 14px;
  border-left: 3px solid var(--border-strong);
  color: var(--muted);
  background: #111718;
  font-size: 13px;
  line-height: 1.5;
}

.message[data-kind="error"] {
  border-left-color: var(--danger);
  color: #ffc0b7;
}

.meter-block {
  margin-bottom: 24px;
}

.meter-label-row {
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.meter-label-row output {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.meter {
  height: 16px;
  overflow: hidden;
  border: 1px solid #34403e;
  border-radius: 5px;
  background:
    repeating-linear-gradient(90deg, transparent 0, transparent calc(10% - 1px), rgba(255, 255, 255, 0.08) 10%), #0c1011;
}

.meter span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #4ecf9a 0 72%, #f0ca61 88%, #ef776b 100%);
  transition: width 70ms linear;
}

.primary-controls {
  display: grid;
  grid-template-columns: 1.4fr 0.75fr 0.9fr;
  gap: 10px;
  margin-bottom: 26px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 43px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 720;
  text-decoration: none;
  cursor: pointer;
}

.button-primary {
  color: var(--accent-ink);
  background: var(--accent);
}

.button-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.button-secondary {
  border-color: #3d4947;
  color: var(--text);
  background: #1c2424;
}

.button-secondary:hover:not(:disabled) {
  border-color: #566461;
  background: #242e2d;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.button:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(112, 225, 177, 0.45);
  outline-offset: 2px;
}

.toggle-row input:focus-visible + i {
  outline: 3px solid rgba(112, 225, 177, 0.45);
  outline-offset: 2px;
}

.button-icon {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 7px;
  border-radius: 50%;
  background: currentColor;
}

.control-grid {
  display: grid;
  gap: 22px;
}

.field {
  min-width: 0;
}

.field label,
.range-heading label {
  display: block;
  margin-bottom: 8px;
  color: #dce3df;
  font-size: 13px;
  font-weight: 680;
}

.field select {
  width: 100%;
  height: 43px;
  padding: 0 38px 0 12px;
  border: 1px solid #3d4947;
  border-radius: 7px;
  color: var(--text);
  background: #101617;
}

.field p {
  margin: 7px 0 0;
  color: var(--faint);
  font-size: 11px;
  line-height: 1.5;
}

.range-heading output {
  color: #c2ccc8;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

input[type="range"] {
  width: 100%;
  height: 5px;
  accent-color: var(--accent);
  cursor: pointer;
}

.range-scale {
  display: flex;
  justify-content: space-between;
  margin-top: 5px;
  color: var(--faint);
  font-size: 10px;
}

.settings-card {
  padding: 25px;
}

.section-copy {
  margin: 10px 0 21px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.toggle-list {
  display: grid;
  gap: 1px;
  overflow: hidden;
  border: 1px solid #303b3a;
  border-radius: 8px;
  background: #303b3a;
}

.toggle-row {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  min-height: 67px;
  padding: 11px 13px;
  background: #13191a;
  cursor: pointer;
}

.toggle-row strong,
.toggle-row small {
  display: block;
}

.toggle-row strong {
  font-size: 12px;
}

.toggle-row small {
  margin-top: 3px;
  color: var(--faint);
  font-size: 10px;
  line-height: 1.35;
}

.toggle-row input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.toggle-row i {
  position: relative;
  width: 34px;
  height: 19px;
  border: 1px solid #485451;
  border-radius: 999px;
  background: #242c2c;
}

.toggle-row i::after {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #9da8a5;
  content: "";
  transition:
    transform 140ms ease,
    background 140ms ease;
}

.toggle-row input:checked + i {
  border-color: #4ba77e;
  background: #1d533c;
}

.toggle-row input:checked + i::after {
  transform: translateX(15px);
  background: #b9f6d9;
}

.diagnostics-card {
  grid-column: 1 / -1;
  padding: 25px 27px 27px;
}

.diagnostics-heading > p {
  max-width: 390px;
  margin: 0;
  color: var(--faint);
  font-size: 11px;
  line-height: 1.5;
  text-align: right;
}

.diagnostic-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  overflow: hidden;
  margin: 22px 0 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--border);
}

.diagnostic-grid div {
  min-width: 0;
  padding: 14px;
  background: #111718;
}

.diagnostic-grid dt {
  margin-bottom: 5px;
  color: var(--faint);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.diagnostic-grid dd {
  overflow: hidden;
  margin: 0;
  color: #dbe3df;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

footer {
  grid-column: 1 / -1;
  padding: 10px 0 0;
  color: var(--faint);
  font-size: 11px;
  text-align: center;
}

.error-layout {
  display: grid;
  min-height: calc(100vh - 68px);
  width: min(760px, calc(100% - 40px));
  margin: 0 auto;
  padding: 48px 0;
  place-items: center;
}

.error-card {
  width: 100%;
  padding: clamp(28px, 7vw, 64px);
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(21, 27, 28, 0.92);
}

.error-card h1 {
  font-size: clamp(42px, 8vw, 68px);
}

.error-link {
  margin-top: 28px;
}

@media (max-width: 800px) {
  .layout {
    grid-template-columns: 1fr;
    width: min(680px, calc(100% - 28px));
    padding-top: 46px;
  }

  .monitor-card {
    grid-row: auto;
  }

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

  .primary-controls .button-primary {
    grid-column: 1 / -1;
  }

  .diagnostic-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 520px) {
  .site-header {
    padding: 0 15px;
  }

  .privacy-chip {
    font-size: 10px;
  }

  .layout {
    width: min(100% - 20px, 500px);
    padding-top: 36px;
  }

  h1 {
    font-size: 43px;
  }

  .monitor-card,
  .settings-card,
  .diagnostics-card {
    padding: 20px;
  }

  .monitor-heading-row,
  .diagnostics-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .diagnostics-heading > p {
    text-align: left;
  }

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

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