:root {
  --ink: #0a1e2d;
  --muted: #6b7f90;
  --line: #d7e3eb;
  --paper: #f3f8fb;
  --white: #ffffff;
  --blue: #2387f6;
  --green: #2dc778;
  --amber: #e6a83c;
  --red: #e7685b;
  --navy: #0c2d42;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background:
    radial-gradient(circle at 85% 4%, rgba(35, 135, 246, 0.13), transparent 27rem),
    linear-gradient(145deg, #f9fcfd, var(--paper));
  color: var(--ink);
  font-family: "SF Pro Display", "SF Pro Text", "PingFang SC", "Helvetica Neue", sans-serif;
  min-height: 100vh;
}

button,
a { font: inherit; }

.diag-nav {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin: 0 auto;
  max-width: 1180px;
  padding: 26px 32px;
}

.diag-brand {
  align-items: center;
  color: inherit;
  display: flex;
  gap: 12px;
  text-decoration: none;
}

.diag-brand strong,
.diag-brand small { display: block; }
.diag-brand small { color: var(--muted); font-size: 11px; letter-spacing: 0.08em; margin-top: 2px; }

.diag-mark {
  align-items: end;
  background: linear-gradient(145deg, #46a4ff, #2765db);
  border-radius: 13px;
  display: flex;
  gap: 3px;
  height: 42px;
  justify-content: center;
  padding-bottom: 10px;
  width: 42px;
}

.diag-mark i { background: white; border-radius: 4px; display: block; width: 3px; }
.diag-mark i:nth-child(1) { height: 10px; opacity: 0.68; }
.diag-mark i:nth-child(2) { height: 19px; }
.diag-mark i:nth-child(3) { height: 14px; opacity: 0.82; }

.diag-nav nav { display: flex; gap: 8px; }
.diag-nav nav a {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #38566a;
  font-size: 13px;
  padding: 10px 15px;
  text-decoration: none;
}

main {
  margin: 0 auto;
  max-width: 1180px;
  padding: 50px 32px 90px;
}

.diag-hero {
  align-items: end;
  display: grid;
  gap: 80px;
  grid-template-columns: 1.5fr 0.7fr;
  padding: 38px 0 88px;
}

.eyebrow,
.section-head span,
.panel-head span,
.report-panel > div > span,
.transcript span {
  color: #557a94;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.2em;
}

.eyebrow i {
  background: var(--green);
  border-radius: 50%;
  box-shadow: 0 0 0 6px rgba(45, 199, 120, 0.12);
  display: inline-block;
  height: 8px;
  margin-right: 10px;
  width: 8px;
}

.diag-hero h1 {
  font-size: clamp(46px, 6.8vw, 82px);
  letter-spacing: -0.055em;
  line-height: 0.98;
  margin: 25px 0 28px;
}

.diag-hero > div > p,
.section-head p,
.test-copy,
.report-panel p,
.privacy-note p {
  color: var(--muted);
  line-height: 1.7;
}

.diag-hero > div > p { font-size: 18px; max-width: 670px; }

.score-card {
  background: var(--navy);
  border-radius: 30px;
  color: white;
  padding: 30px;
}

.score-card > span { color: #82b9d8; font-size: 12px; }
.score-card strong { display: block; font-size: 35px; margin-top: 24px; }
.score-card p { color: #abc3d2; font-size: 13px; min-height: 42px; }
.score-card button {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  color: white;
  cursor: pointer;
  padding: 10px 15px;
}

.section-head {
  align-items: end;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  padding-bottom: 20px;
}

.section-head h2 { font-size: 32px; margin: 9px 0 0; }
.section-head p { font-size: 13px; margin: 0; }

.check-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 20px;
}

.check-card {
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
  border-radius: 23px;
  min-height: 170px;
  padding: 24px;
}

.check-card h3 { font-size: 20px; margin: 30px 0 7px; }
.check-card p { color: #425d70; font-size: 13px; margin: 0; }
.check-card small { color: var(--muted); display: block; line-height: 1.5; margin-top: 10px; }

.check-state {
  background: #edf2f5;
  border-radius: 999px;
  color: #728695;
  font-size: 11px;
  font-weight: 700;
  padding: 6px 9px;
}

.check-card[data-state="pass"] .check-state { background: #e5f8ee; color: #218b56; }
.check-card[data-state="warn"] .check-state { background: #fff3dc; color: #9c6b17; }
.check-card[data-state="fail"] .check-state { background: #ffebe8; color: #b5473d; }

.stability-section { margin-top: 70px; }

.stability-heading {
  align-items: end;
  display: flex;
  justify-content: space-between;
  margin-bottom: 20px;
}

.stability-heading > div > span {
  color: #557a94;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.2em;
}

.stability-heading h2 { font-size: 32px; margin: 9px 0 0; }
.stability-heading p { color: var(--muted); font-size: 13px; margin: 10px 0 0; }

#refreshStability {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #38566a;
  cursor: pointer;
  padding: 10px 15px;
}

#refreshStability:disabled { cursor: wait; opacity: 0.58; }

.stability-shell {
  background:
    radial-gradient(circle at 84% 5%, rgba(65, 166, 255, 0.2), transparent 22rem),
    linear-gradient(145deg, #0f344a, #071d2b);
  border: 1px solid #183f56;
  border-radius: 30px;
  color: white;
  display: grid;
  gap: 30px;
  grid-template-columns: 0.7fr 1.3fr;
  overflow: hidden;
  padding: 32px;
  position: relative;
}

.stability-overview { align-self: center; min-width: 0; }

.stability-badge {
  align-items: center;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  color: #b7cedb;
  display: inline-flex;
  font-size: 11px;
  gap: 9px;
  padding: 7px 11px;
}

.stability-badge i {
  background: #8aa6b6;
  border-radius: 50%;
  box-shadow: 0 0 0 5px rgba(138, 166, 182, 0.12);
  height: 8px;
  width: 8px;
}

.stability-shell[data-state="healthy"] .stability-badge i {
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(45, 199, 120, 0.14);
}

.stability-shell[data-state="degraded"] .stability-badge i {
  background: var(--red);
  box-shadow: 0 0 0 5px rgba(231, 104, 91, 0.14);
}

.stability-shell[data-state="stale"] .stability-badge i {
  background: var(--amber);
  box-shadow: 0 0 0 5px rgba(230, 168, 60, 0.14);
}

.stability-overview h3 {
  font-size: clamp(26px, 3vw, 38px);
  letter-spacing: -0.035em;
  line-height: 1.05;
  margin: 25px 0 12px;
}

.stability-overview p {
  color: #a9c0ce;
  font-size: 13px;
  line-height: 1.65;
  margin: 0;
  max-width: 330px;
}

.stability-overview > small {
  color: #7193a7;
  display: block;
  font-size: 10px;
  letter-spacing: 0.1em;
  margin-top: 28px;
}

.stability-metrics {
  display: grid;
  gap: 1px;
  grid-template-columns: repeat(2, 1fr);
  overflow: hidden;
}

.status-metric {
  background: rgba(255, 255, 255, 0.075);
  min-height: 126px;
  padding: 24px;
}

.status-metric:nth-child(1) { border-radius: 21px 0 0; }
.status-metric:nth-child(2) { border-radius: 0 21px 0 0; }
.status-metric:nth-child(3) { border-radius: 0 0 0 21px; }
.status-metric:nth-child(4) { border-radius: 0 0 21px; }
.status-metric span { color: #8fb0c2; display: block; font-size: 11px; }
.status-metric strong { display: block; font-size: 28px; margin-top: 16px; }
.status-metric small { color: #7896a7; display: block; font-size: 10px; margin-top: 7px; }

.probe-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  grid-column: 1 / -1;
}

.probe-row span {
  align-items: center;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 999px;
  color: #8eabba;
  display: inline-flex;
  font-size: 11px;
  gap: 7px;
  padding: 8px 11px;
}

.probe-row span::before {
  background: #658497;
  border-radius: 50%;
  content: "";
  height: 6px;
  width: 6px;
}

.probe-row span[data-state="pass"] { color: #b9e8cf; }
.probe-row span[data-state="pass"]::before { background: var(--green); }
.probe-row span[data-state="fail"] { color: #ffc1ba; }
.probe-row span[data-state="fail"]::before { background: var(--red); }

@media (max-width: 820px) {
  .stability-shell { grid-template-columns: 1fr; }
  .stability-heading { align-items: start; gap: 20px; }
  .stability-heading p { max-width: 460px; }
}

@media (max-width: 560px) {
  .stability-section { margin-top: 54px; }
  .stability-heading { align-items: stretch; flex-direction: column; }
  #refreshStability { align-self: flex-start; }
  .stability-shell { border-radius: 24px; padding: 24px; }
  .stability-metrics { grid-template-columns: 1fr; }
  .status-metric { min-height: 108px; }
  .status-metric:nth-child(n) { border-radius: 0; }
  .status-metric:first-child { border-radius: 18px 18px 0 0; }
  .status-metric:last-child { border-radius: 0 0 18px 18px; }
  .probe-row { gap: 6px; }
}

.interactive-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: 0.85fr 1.15fr;
  margin-top: 70px;
}

.test-panel {
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid var(--line);
  border-radius: 30px;
  padding: 30px;
}

.mic-panel {
  background: linear-gradient(145deg, #0e344b, #071c2a);
  border-color: #0d3147;
  color: white;
}

.panel-head { align-items: center; display: flex; justify-content: space-between; }
.panel-head b { color: var(--muted); font-size: 11px; }
.mic-panel .panel-head b { color: #8db4ca; }
.test-panel h2 { font-size: 29px; margin: 30px 0 10px; }
.test-copy { font-size: 14px; min-height: 48px; }
.mic-panel .test-copy { color: #a9c0ce; }

blockquote {
  background: #edf5fa;
  border-radius: 18px;
  color: #27465a;
  font-family: "SF Mono", monospace;
  font-size: 14px;
  line-height: 1.6;
  margin: 24px 0;
  padding: 20px;
}

.primary-action,
.secondary-action,
#copyReport {
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 700;
  min-height: 46px;
  padding: 0 20px;
}

.primary-action { background: var(--blue); color: white; }
.secondary-action { background: rgba(255, 255, 255, 0.12); color: white; }
.secondary-action:disabled { cursor: not-allowed; opacity: 0.4; }

.test-status { color: var(--muted); font-size: 12px; margin: 15px 0 0; }
.mic-panel .test-status { color: #9db7c6; }
.action-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }

.mic-meter {
  align-items: center;
  display: flex;
  gap: 5px;
  height: 44px;
  margin-top: 20px;
}

.mic-meter i {
  animation: none;
  background: #5d879e;
  border-radius: 4px;
  height: 8px;
  width: 4px;
}

.mic-meter.active i { animation: pulse 0.7s ease-in-out infinite alternate; }
.mic-meter.active i:nth-child(2n) { animation-delay: 0.14s; }
.mic-meter.active i:nth-child(3n) { animation-delay: 0.26s; }

@keyframes pulse {
  from { height: 8px; opacity: 0.5; }
  to { height: 36px; opacity: 1; }
}

audio { margin-top: 18px; width: 100%; }

.transcript {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  margin-top: 18px;
  padding: 16px;
}

.transcript p { color: white; line-height: 1.6; margin: 8px 0 0; }

.report-panel {
  align-items: center;
  background: #fff8e7;
  border: 1px solid #f1ddad;
  border-radius: 27px;
  display: flex;
  justify-content: space-between;
  margin-top: 18px;
  padding: 26px 30px;
}

.report-panel h2 { font-size: 23px; margin: 8px 0; }
.report-panel p { font-size: 13px; margin: 0; }
#copyReport { background: #162f40; color: white; flex: 0 0 auto; margin-left: 24px; }

.privacy-note {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 24px;
  grid-template-columns: 110px 1fr;
  margin-top: 54px;
  padding-top: 28px;
}

.privacy-note p { font-size: 13px; margin: 0; }

@media (max-width: 820px) {
  .diag-nav { padding: 18px 20px; }
  .diag-nav nav a:first-child { display: none; }
  main { padding: 30px 20px 64px; }
  .diag-hero,
  .check-grid,
  .interactive-grid { grid-template-columns: 1fr; }
  .diag-hero { gap: 35px; padding: 28px 0 60px; }
  .check-grid { grid-template-columns: repeat(2, 1fr); }
  .section-head { align-items: start; flex-direction: column; gap: 6px; }
  .interactive-grid { margin-top: 52px; }
  .report-panel { align-items: start; flex-direction: column; gap: 20px; }
  #copyReport { margin: 0; width: 100%; }
}

@media (max-width: 520px) {
  .check-grid { grid-template-columns: 1fr; }
  .check-card { min-height: 150px; }
  .privacy-note { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .mic-meter.active i { animation: none; height: 22px; }
}
