:root {
  --wifi-ink: #17202a;
  --wifi-muted: #64706b;
  --wifi-line: rgba(23, 32, 42, 0.14);
  --wifi-panel: rgba(255, 252, 246, 0.9);
  --wifi-panel-strong: rgba(255, 255, 255, 0.96);
  --wifi-good: #16734c;
  --wifi-ok: #9a6400;
  --wifi-bad: #b42318;
  --wifi-blue: #1d5f8f;
}

.wifi-app {
  color: var(--wifi-ink);
}

.wifi-nav {
  max-width: 78rem;
}

.wifi-shell {
  width: min(100% - 2rem, 78rem);
  margin: 0 auto;
  padding: clamp(1rem, 3vw, 2rem) 0 3rem;
  display: grid;
  grid-template-columns: minmax(18rem, 0.85fr) minmax(28rem, 1.45fr);
  gap: clamp(1rem, 2.5vw, 1.6rem);
}

.control-panel,
.results-panel,
.history-panel {
  border: 1px solid var(--wifi-line);
  background: var(--wifi-panel);
  box-shadow: 0 18px 48px rgba(37, 43, 34, 0.1);
  border-radius: 8px;
}

.control-panel {
  padding: clamp(1rem, 2.4vw, 1.35rem);
  align-self: start;
}

.results-panel {
  padding: clamp(1rem, 2.4vw, 1.35rem);
}

.history-panel {
  grid-column: 1 / -1;
  padding: clamp(1rem, 2.4vw, 1.35rem);
}

.eyebrow {
  margin: 0 0 0.4rem;
  color: var(--wifi-blue);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.control-panel h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1;
  letter-spacing: 0;
}

.lede {
  margin-bottom: 1.1rem;
  color: var(--wifi-muted);
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
  margin-top: 1rem;
}

.progress-wrap {
  margin-top: 1rem;
}

.progress-label,
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.progress-label {
  color: var(--wifi-muted);
  font-size: 0.86rem;
  margin-bottom: 0.4rem;
}

.progress-track {
  height: 0.62rem;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(23, 32, 42, 0.12);
}

.progress-bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--wifi-blue), #168663);
  transition: width 0.18s ease;
}

.tester-notes {
  margin-top: 1.1rem;
  font-size: 0.92rem;
}

.tester-notes p {
  margin-bottom: 0;
  color: var(--wifi-muted);
}

.score-band {
  display: grid;
  grid-template-columns: minmax(10rem, 0.52fr) minmax(14rem, 1fr);
  gap: 1rem;
  align-items: center;
  padding: 1rem;
  border: 1px solid var(--wifi-line);
  border-left: 0.45rem solid var(--wifi-muted);
  border-radius: 8px;
  background: var(--wifi-panel-strong);
}

.verdict-band {
  padding: 1rem;
  border: 1px solid var(--wifi-line);
  border-left: 0.45rem solid var(--wifi-muted);
  border-radius: 8px;
  background: var(--wifi-panel-strong);
  margin-bottom: 0.9rem;
}

.score-band.good {
  border-left-color: var(--wifi-good);
}

.score-band.ok {
  border-left-color: var(--wifi-ok);
}

.score-band.bad {
  border-left-color: var(--wifi-bad);
}

.verdict-band.good {
  border-left-color: var(--wifi-good);
}

.verdict-band.ok {
  border-left-color: var(--wifi-ok);
}

.verdict-band.bad {
  border-left-color: var(--wifi-bad);
}

.verdict-band strong {
  display: block;
  margin: 0.25rem 0 0.35rem;
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  line-height: 1.04;
  letter-spacing: 0;
}

.verdict-band p {
  margin: 0;
  color: var(--wifi-muted);
}

.action-list {
  margin: 0.8rem 0 0;
  padding-left: 1.2rem;
  color: var(--wifi-ink);
}

.action-list li {
  margin-bottom: 0.24rem;
}

.score-label,
.metric-card span {
  display: block;
  color: var(--wifi-muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

#scoreValue {
  display: block;
  margin-top: 0.1rem;
  font-size: clamp(2.4rem, 7vw, 4.5rem);
  line-height: 0.95;
  letter-spacing: 0;
}

#scoreSummary {
  margin: 0;
  color: var(--wifi-muted);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.8rem;
  margin-top: 0.9rem;
}

.metric-card {
  min-height: 8.6rem;
  margin: 0;
  padding: 0.9rem;
  border: 1px solid var(--wifi-line);
  border-radius: 8px;
  background: var(--wifi-panel-strong);
  box-shadow: none;
}

.metric-card strong {
  display: block;
  margin: 0.55rem 0 0.25rem;
  font-size: clamp(1.6rem, 3vw, 2.25rem);
  line-height: 1;
  letter-spacing: 0;
}

.metric-card em,
.history-pill {
  display: inline-block;
  width: fit-content;
  margin-bottom: 0.42rem;
  padding: 0.16rem 0.45rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-style: normal;
  font-weight: 700;
  line-height: 1.35;
}

.metric-card em.good,
.history-pill.good {
  color: #0f5134;
  background: rgba(22, 115, 76, 0.12);
}

.metric-card em.ok,
.history-pill.ok {
  color: #764a00;
  background: rgba(154, 100, 0, 0.14);
}

.metric-card em.bad,
.history-pill.bad {
  color: #842029;
  background: rgba(180, 35, 24, 0.12);
}

.metric-card small {
  display: block;
  color: var(--wifi-muted);
  line-height: 1.35;
}

.plain-guide {
  margin-top: 0.95rem;
  padding: 1rem;
  border: 1px solid var(--wifi-line);
  border-radius: 8px;
  background: rgba(248, 250, 247, 0.86);
}

.plain-guide h2 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  letter-spacing: 0;
}

.guide-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.guide-grid p {
  margin: 0;
  color: var(--wifi-muted);
  font-size: 0.9rem;
  line-height: 1.42;
}

.guide-grid strong {
  color: var(--wifi-ink);
}

.chart-panel {
  margin-top: 0.95rem;
  padding: 1rem;
  border: 1px solid var(--wifi-line);
  border-radius: 8px;
  background: var(--wifi-panel-strong);
}

.section-heading {
  margin-bottom: 0.75rem;
}

.section-heading h2 {
  margin: 0;
  font-size: 1rem;
  letter-spacing: 0;
}

.section-heading span {
  color: var(--wifi-muted);
  font-size: 0.86rem;
}

#latencyChart {
  display: block;
  width: 100%;
  height: auto;
  min-height: 12rem;
  border-radius: 6px;
  background: #f8faf7;
}

.history-table-wrap {
  overflow-x: auto;
}

.history-panel table {
  margin: 0;
  min-width: 48rem;
}

.history-panel th,
.history-panel td {
  white-space: nowrap;
  font-size: 0.9rem;
}

.history-panel td:last-child {
  white-space: normal;
}

@media (max-width: 900px) {
  .wifi-shell {
    grid-template-columns: 1fr;
  }

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

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

@media (max-width: 560px) {
  .wifi-shell {
    width: min(100% - 1rem, 78rem);
  }

  .button-row,
  .score-band,
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .metric-card {
    min-height: 7.2rem;
  }
}
