/* Snyder speed test. Every colour, shadow and font is a brandOS token from assets/brand/*.css;
   data-brand="snyder" and the resolved data-theme on <html> select the palette. */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--brandOS-font-body);
  font-size: 15px;
  line-height: 1.5;
  color: var(--brandOS-text-primary);
  background: radial-gradient(1100px 520px at 50% -180px, color-mix(in oklch, var(--brandOS-brand) 14%, transparent), transparent 70%), var(--brandOS-background-primary);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  transition:
    background-color 0.3s,
    color 0.3s;
}

a {
  color: inherit;
}

button,
select {
  font: inherit;
}

:focus-visible {
  outline: 3px solid var(--brandOS-border-focus);
  outline-offset: 3px;
}

/* Panels toggle with the hidden attribute; their display rules must not override it. */
[hidden] {
  display: none !important;
}

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

.page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 1080px;
  margin: 0 auto;
  padding: 22px 20px 28px;
}

/* Header */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.brand {
  display: inline-flex;
  border-radius: var(--brandOS-radius-sm);
}

.brand-logo {
  display: block;
}

/* Brand logos range from near-square to 10:1 wordmarks; the cap keeps a wide one from crowding the bar. */
.brand-logo svg {
  display: block;
  width: auto;
  max-width: min(300px, 62vw);
  height: 34px;
}

.brand-logo-on-dark,
[data-theme='dark'] .brand-logo-on-light {
  display: none;
}

[data-theme='dark'] .brand-logo-on-dark {
  display: block;
}

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

/* Server picker: a pill button and a styled listbox (app.js), in place of a native <select>. */

.server-picker {
  position: relative;
  min-width: 0;
}

.server-trigger {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  min-width: 0;
  max-width: 300px;
  height: 36px;
  padding: 0 10px 0 13px;
  border: 1px solid var(--brandOS-border-subtle);
  border-radius: var(--brandOS-radius-full);
  background: var(--brandOS-background-elevated);
  color: var(--brandOS-text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}

.server-trigger:hover:not(:disabled),
.is-open .server-trigger {
  border-color: var(--brandOS-brand);
}

.is-open .server-trigger {
  box-shadow: 0 0 0 4px color-mix(in oklch, var(--brandOS-brand) 14%, transparent);
}

.server-trigger:disabled {
  cursor: default;
}

.server-current {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.server-chevron {
  transition: transform 0.25s cubic-bezier(0.3, 0.7, 0.4, 1);
}

.server-picker .server-chevron {
  width: 14px;
  height: 14px;
  color: var(--brandOS-text-tertiary);
}

.is-open .server-chevron {
  transform: rotate(180deg);
}

.server-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 20;
  width: max(100%, 280px);
  max-height: min(340px, calc(100vh - 80px));
  margin: 0;
  padding: 6px;
  overflow-y: auto;
  border: 1px solid var(--brandOS-border-subtle);
  border-radius: 16px;
  background: var(--brandOS-background-elevated);
  box-shadow: var(--brandOS-shadow-lg);
  list-style: none;
  transform-origin: top right;
  animation: menu-in 0.18s cubic-bezier(0.3, 0.7, 0.4, 1);
}

.server-menu:focus {
  outline: none;
}

@keyframes menu-in {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.97);
  }
}

.server-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px 10px 30px;
  position: relative;
  border-radius: 11px;
  color: var(--brandOS-text-primary);
  cursor: pointer;
  transition: background-color 0.15s;
}

/* The server in use carries a brand-coloured dot; the keyboard or pointer position a soft fill. */
.server-option::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 12px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  transform: translateY(-50%) scale(0);
  background: var(--brandOS-brand);
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--brandOS-brand) 22%, transparent);
  transition: transform 0.2s;
}

.server-option.is-current::before {
  transform: translateY(-50%) scale(1);
}

/* The Automatic row is a mode, not a server: no dot, a check while it is on, a rule beneath it. */
.server-option-auto {
  padding-left: 12px;
}

.server-option-auto::before {
  content: none;
}

.server-option-auto::after {
  content: '';
  position: absolute;
  right: 8px;
  bottom: -5px;
  left: 8px;
  height: 1px;
  background: var(--brandOS-border-subtle);
}

.server-option-auto + .server-option {
  margin-top: 9px;
}

.server-option-check {
  display: grid;
  flex: none;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  color: var(--brandOS-text-on-primary);
  background: var(--brandOS-brand);
  transform: scale(0);
  transition: transform 0.2s cubic-bezier(0.3, 1.5, 0.5, 1);
}

.server-option-check svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.server-option-auto[aria-selected='true'] .server-option-check {
  transform: scale(1);
}

.server-option.is-active {
  background: color-mix(in oklch, var(--brandOS-brand) 11%, transparent);
}

.server-option + .server-option {
  margin-top: 2px;
}

.server-option-text {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.server-option-name {
  overflow: hidden;
  font-size: 14px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

:is(.server-option.is-current, .server-option-auto[aria-selected='true']) .server-option-name {
  color: var(--brandOS-brand);
}

.server-option-detail {
  color: var(--brandOS-text-tertiary);
  font-size: 12px;
}

.server-option-detail.is-nearest {
  color: var(--brandOS-brand);
  font-weight: 600;
}

.server-option-ping {
  flex: none;
  padding: 2px 9px;
  border-radius: var(--brandOS-radius-full);
  background: var(--brandOS-background-tertiary);
  color: var(--brandOS-text-secondary);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.server-option-ping:empty {
  display: none;
}

.server-option-ping.is-down {
  color: var(--brandOS-status-error);
}

.server-picker svg,
.theme-switch svg,
.btn-secondary svg,
.metric-label svg,
.embed-full svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.server-picker svg {
  flex: none;
  width: 15px;
  height: 15px;
}

.server-pin {
  color: var(--brandOS-brand);
}

/* Theme: system, light or dark, as one segmented control; the thumb slides under the checked mode. */

.theme-switch {
  position: relative;
  display: inline-grid;
  flex: none;
  grid-auto-columns: 32px;
  grid-auto-flow: column;
  height: 36px;
  padding: 3px;
  border: 1px solid var(--brandOS-border-subtle);
  border-radius: var(--brandOS-radius-full);
  background: var(--brandOS-background-elevated);
}

.theme-switch::before {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 32px;
  height: 28px;
  border-radius: var(--brandOS-radius-full);
  background: color-mix(in oklch, var(--brandOS-brand) 16%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in oklch, var(--brandOS-brand) 40%, transparent);
  transition: transform 0.28s cubic-bezier(0.3, 0.7, 0.4, 1);
}

.theme-switch:has([data-theme-mode='light'][aria-checked='true'])::before {
  transform: translateX(32px);
}

.theme-switch:has([data-theme-mode='dark'][aria-checked='true'])::before {
  transform: translateX(64px);
}

.theme-switch button {
  position: relative;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: var(--brandOS-radius-full);
  background: transparent;
  color: var(--brandOS-text-tertiary);
  cursor: pointer;
  transition: color 0.2s;
}

.theme-switch button:hover {
  color: var(--brandOS-text-primary);
}

.theme-switch button[aria-checked='true'] {
  color: var(--brandOS-brand);
}

.theme-switch svg {
  width: 16px;
  height: 16px;
}

/* Panels */

.panel {
  border: 1px solid var(--brandOS-border-subtle);
  border-radius: 20px;
  background: var(--brandOS-background-elevated);
  box-shadow: var(--brandOS-shadow-md);
  padding: 28px;
  transition:
    background-color 0.3s,
    border-color 0.3s;
}

.test {
  display: grid;
  grid-template-columns: minmax(280px, 380px) 1fr;
  align-items: center;
  gap: 40px;
}

/* Gauge: the arc and the active phase share currentColor. */

.gauge {
  position: relative;
  width: 100%;
  max-width: 370px;
  margin: 0 auto;
  aspect-ratio: 1;
  color: var(--brandOS-brand);
  container-type: inline-size;
  transition: color 0.4s;
}

.gauge[data-phase='upload'] {
  color: var(--brandOS-dataviz-cat-4);
}

.gauge[data-phase='ping'] {
  color: var(--brandOS-dataviz-cat-2);
}

.gauge-svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.gauge-track,
.gauge-value {
  fill: none;
  stroke-width: 18;
  stroke-linecap: round;
}

.gauge-track {
  stroke: var(--brandOS-border-subtle);
}

.gauge-value {
  stroke: currentColor;
  stroke-dasharray: 100 100;
  stroke-dashoffset: 100;
  transition:
    stroke-dashoffset 0.35s ease-out,
    opacity 0.2s;
}

[data-theme='dark'] .gauge-value {
  filter: drop-shadow(0 0 10px color-mix(in oklch, currentColor 45%, transparent));
}

.gauge-value.is-empty {
  opacity: 0;
}

.gauge-ticks line {
  stroke: var(--brandOS-border-default);
  stroke-width: 2;
  stroke-linecap: round;
}

.gauge-ticks text {
  fill: var(--brandOS-text-tertiary);
  font-size: 11px;
  font-weight: 600;
  text-anchor: middle;
  dominant-baseline: middle;
  transform-box: fill-box;
  transform-origin: center;
  transition:
    fill 0.3s,
    font-size 0.3s;
}

/* A milestone the arc has passed stays lit in the phase colour (the gauge's currentColor). */
.gauge-ticks text.is-lit {
  fill: currentColor;
  font-size: 12.5px;
  font-weight: 800;
  filter: drop-shadow(0 0 4px color-mix(in oklch, currentColor 60%, transparent));
}

.gauge-sparks {
  pointer-events: none;
}

.spark {
  fill: currentColor;
  transform-box: fill-box;
  transform-origin: center;
}

.spark-ring {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  transform-box: fill-box;
  transform-origin: center;
}

/* The needle: a neutral metal blade with a coloured tip, a counterweight behind the pivot and a capped
   hub. It pivots on the dial's centre and springs slightly as it settles on each new reading. */
.gauge-needle {
  transform: rotate(135deg);
  transform-origin: 150px 150px;
  filter: drop-shadow(0 2px 2px color-mix(in oklch, var(--brandOS-gray-1000) 35%, transparent));
  transition: transform 0.45s cubic-bezier(0.25, 1.25, 0.5, 1);
}

.needle-body {
  transform-origin: 150px 150px;
}

.needle-stop-light {
  stop-color: var(--brandOS-gray-150);
}

.needle-stop-dark {
  stop-color: var(--brandOS-gray-500);
}

.needle-blade {
  fill: url(#needleBlade);
}

.needle-tail,
.needle-screw {
  fill: var(--brandOS-gray-650);
}

.needle-tip {
  fill: currentColor;
}

/* Before the throughput phases the tip wears the brand colour, not the latency colour. */
.gauge:is([data-phase='idle'], [data-phase='ping']) .needle-tip {
  fill: var(--brandOS-brand);
}

.needle-ridge {
  stroke: color-mix(in oklch, var(--brandOS-gray-050) 75%, transparent);
  stroke-width: 0.8;
  stroke-linecap: round;
}

.needle-hub {
  fill: var(--brandOS-gray-750);
  stroke: color-mix(in oklch, currentColor 60%, transparent);
  stroke-width: 1.5;
  transition: stroke 0.3s;
}

.needle-cap {
  fill: url(#needleCap);
}

/* Redline, past 1 Gbps: the tip glows hot, the hub ring heats up, and while the test runs the
   needle shudders against the reading. Reduced motion stops the shudder with every other animation. */
.gauge.is-redline .needle-tip {
  fill: var(--brandOS-status-warning);
  filter: drop-shadow(0 0 3px var(--brandOS-status-warning)) drop-shadow(0 0 7px var(--brandOS-status-error));
}

.gauge.is-redline .needle-hub {
  stroke: var(--brandOS-status-warning);
}

.gauge.is-shuddering .needle-body {
  animation: needle-shudder 0.09s linear infinite alternate;
}

@keyframes needle-shudder {
  from {
    transform: rotate(-1.3deg);
  }

  to {
    transform: rotate(1.3deg);
  }
}

.gauge.is-redline .gauge-number {
  text-shadow:
    0 0 4px var(--brandOS-background-elevated),
    0 0 10px var(--brandOS-background-elevated),
    0 0 18px color-mix(in oklch, var(--brandOS-status-warning) 55%, transparent);
}

[data-theme='dark'] .gauge.is-redline .gauge-number {
  text-shadow:
    0 0 4px color-mix(in oklab, var(--brandOS-brand) 24%, var(--brandOS-gray-1000)),
    0 0 10px color-mix(in oklab, var(--brandOS-brand) 24%, var(--brandOS-gray-1000)),
    0 0 18px color-mix(in oklch, var(--brandOS-status-warning) 55%, transparent);
}

.gauge.is-redline .gauge-phase {
  color: var(--brandOS-status-warning);
}

[data-theme='light'] .gauge.is-redline .gauge-phase {
  color: var(--brandOS-status-error);
}

/* The readout sits below the hub, in the dial's open lower half, so the needle stays in view. Its type
   and the button are sized in container units (cqw: percent of the dial's width), so the dial keeps
   the same layout from a 270 px embed to the 370 px page. */
.gauge-readout {
  position: absolute;
  top: 58.5%;
  right: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
}

/* The phase word rides under the number with the unit ("Download · Mbps"), not under the hub, where
   the needle and its counterweight sweep. */
.gauge-caption {
  display: flex;
  align-items: baseline;
  gap: 0.4em;
}

.gauge-unit::before {
  content: '·';
  margin-right: 0.4em;
  color: var(--brandOS-text-tertiary);
}

.gauge-phase {
  color: var(--brandOS-text-secondary);
  font-size: max(9px, 3.3cqw);
  font-weight: 650;
  letter-spacing: 0.1em;
  line-height: 1.4;
  text-transform: uppercase;
}

.gauge:is([data-phase='download'], [data-phase='upload']) .gauge-phase {
  color: currentColor;
}

/* Near 10G the blade passes behind the right-hand digits; a halo in the panel's own colour fades it
   out around them so the number stays clean. */
.gauge-number {
  color: var(--brandOS-text-primary);
  font-family: var(--brandOS-font-heading);
  font-size: 14cqw;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1.04;
  text-shadow:
    0 0 4px var(--brandOS-background-elevated),
    0 0 10px var(--brandOS-background-elevated);
}

[data-theme='dark'] .gauge-number {
  text-shadow:
    0 0 4px color-mix(in oklab, var(--brandOS-brand) 24%, var(--brandOS-gray-1000)),
    0 0 10px color-mix(in oklab, var(--brandOS-brand) 24%, var(--brandOS-gray-1000));
}

.gauge-unit {
  color: var(--brandOS-text-secondary);
  font-size: max(10px, 3.8cqw);
  font-weight: 500;
  line-height: 1.4;
}

.start-btn {
  position: absolute;
  left: 50%;
  bottom: 4%;
  min-width: clamp(118px, 40cqw, 150px);
  height: clamp(36px, 12.4cqw, 46px);
  padding: 0 24px;
  transform: translateX(-50%);
  border: 1.5px solid transparent;
  border-radius: var(--brandOS-radius-full);
  background: var(--brandOS-interactive-primary);
  color: var(--brandOS-text-on-primary);
  font-size: 15px;
  font-weight: 650;
  cursor: pointer;
  box-shadow: 0 6px 18px color-mix(in oklch, var(--brandOS-interactive-primary) 35%, transparent);
  transition:
    background-color 0.2s,
    color 0.2s,
    border-color 0.2s,
    box-shadow 0.2s;
}

.start-btn:hover:not(:disabled) {
  background: var(--brandOS-interactive-primary-hover);
}

.start-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.start-btn.is-running {
  border-color: var(--brandOS-border-default);
  background: var(--brandOS-background-elevated);
  color: var(--brandOS-text-primary);
  box-shadow: none;
}

.start-btn.is-running:hover {
  border-color: var(--brandOS-text-secondary);
  background: var(--brandOS-background-tertiary);
}

/* Results */

.details {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

.status {
  min-height: 1.5em;
  margin: 0;
  color: var(--brandOS-text-secondary);
  font-size: 15px;
  font-weight: 500;
}

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

.metric {
  padding: 14px 16px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: var(--brandOS-background-tertiary);
  transition:
    border-color 0.25s,
    box-shadow 0.25s,
    background-color 0.3s;
}

.metric-label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--brandOS-text-secondary);
  font-size: 13px;
  font-weight: 600;
}

.metric-label svg {
  width: 17px;
  height: 17px;
  stroke-width: 2.4;
}

.metric-value {
  margin-top: 6px;
  color: var(--brandOS-text-primary);
  font-size: 28px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  line-height: 1.15;
}

.metric-unit {
  margin-left: 5px;
  color: var(--brandOS-text-secondary);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
}

/* Ping and Jitter: the big number is unloaded (tagged in the title); the line under it gives the same
   measure while downloading and while uploading, each arrow in that phase's colour. */
.metric-note {
  margin-left: auto;
  padding: 1px 7px;
  border-radius: var(--brandOS-radius-full);
  background: var(--brandOS-background-elevated);
  color: var(--brandOS-text-tertiary);
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.metric-sub {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 10px;
  margin-top: 4px;
  color: var(--brandOS-text-tertiary);
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.metric-sub b {
  color: var(--brandOS-text-secondary);
  font-weight: 650;
}

.metric-sub :is(.sub-dl, .sub-ul) {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.metric-sub svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sub-dl svg {
  color: var(--brandOS-brand);
}

.sub-ul svg {
  color: var(--brandOS-dataviz-cat-4);
}

.metric-bar {
  height: 4px;
  margin-top: 10px;
  overflow: hidden;
  border-radius: var(--brandOS-radius-full);
  background: var(--brandOS-border-subtle);
}

.metric-bar span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  transition: width 0.3s linear;
}

/* Per-metric accents: download uses the brand colour, upload and latency two dataviz categories. */

.metric-dl .metric-label svg {
  color: var(--brandOS-brand);
}

.metric-dl .metric-bar span {
  background: var(--brandOS-brand);
}

.metric-dl.is-active {
  border-color: color-mix(in oklch, var(--brandOS-brand) 55%, transparent);
  box-shadow: 0 0 0 4px color-mix(in oklch, var(--brandOS-brand) 14%, transparent);
}

.metric-ul .metric-label svg {
  color: var(--brandOS-dataviz-cat-4);
}

.metric-ul .metric-bar span {
  background: var(--brandOS-dataviz-cat-4);
}

.metric-ul.is-active {
  border-color: color-mix(in oklch, var(--brandOS-dataviz-cat-4) 55%, transparent);
  box-shadow: 0 0 0 4px color-mix(in oklch, var(--brandOS-dataviz-cat-4) 14%, transparent);
}

:is(.metric-ping, .metric-jitter) .metric-label svg {
  color: var(--brandOS-dataviz-cat-2);
}

:is(.metric-ping, .metric-jitter) .metric-bar span {
  background: var(--brandOS-dataviz-cat-2);
}

:is(.metric-ping, .metric-jitter).is-active {
  border-color: color-mix(in oklch, var(--brandOS-dataviz-cat-2) 55%, transparent);
  box-shadow: 0 0 0 4px color-mix(in oklch, var(--brandOS-dataviz-cat-2) 14%, transparent);
}

.connection {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px 20px;
  margin: 0;
  padding: 16px 0 0;
  border-top: 1px solid var(--brandOS-border-subtle);
}

.connection dt {
  color: var(--brandOS-text-tertiary);
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.connection dd {
  margin: 3px 0 0;
  color: var(--brandOS-text-primary);
  font-size: 14px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

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

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 14px;
  border: 1px solid var(--brandOS-border-subtle);
  border-radius: 10px;
  background: var(--brandOS-background-elevated);
  color: var(--brandOS-text-primary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition:
    border-color 0.2s,
    opacity 0.2s;
}

.btn-secondary:hover:not(:disabled) {
  border-color: var(--brandOS-brand);
}

.btn-secondary:disabled {
  opacity: 0.45;
  cursor: default;
}

.btn-secondary svg {
  width: 16px;
  height: 16px;
}

/* Links */

.links {
  display: grid;
  gap: 24px;
  margin-top: 20px;
}

.link-group h2 {
  margin: 0 0 12px;
  color: var(--brandOS-text-secondary);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(185px, 1fr));
  gap: 10px;
}

.tile {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border: 1px solid var(--brandOS-border-subtle);
  border-radius: 12px;
  background: var(--brandOS-background-elevated);
  color: var(--brandOS-text-primary);
  font-size: 14px;
  font-weight: 550;
  text-decoration: none;
  transition:
    border-color 0.2s,
    transform 0.2s,
    box-shadow 0.2s;
}

/* Third-party logos keep their own colours, so they sit on a light chip in both themes. */
.tile-icon {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--brandOS-border-subtle);
  border-radius: 8px;
  background: var(--brandOS-gray-050);
}

.tile-icon svg {
  display: block;
  width: 20px;
  height: 20px;
}

.tile-label {
  flex: 1;
  min-width: 0;
}

.tile:hover {
  border-color: var(--brandOS-brand);
  box-shadow: 0 4px 14px color-mix(in oklch, var(--brandOS-brand) 14%, transparent);
  transform: translateY(-1px);
}

/* Footer */

.footer {
  margin-top: auto;
  padding-top: 30px;
  color: var(--brandOS-text-tertiary);
  font-size: 13px;
  text-align: center;
}

.footer p {
  margin: 3px 0;
}

.footer a {
  color: var(--brandOS-text-secondary);
  white-space: nowrap;
}

.footer-sep {
  margin: 0 6px;
}

/* Embed: the widget a brand's own site frames from /embed. The host page shows around the card. */

.embed-body {
  min-height: 0;
  background: transparent;
}

.page.embed {
  min-height: 0;
  max-width: none;
  padding: 0;
}

.embed-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  border-radius: 16px;
  box-shadow: none;
}

.embed-head,
.embed-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.embed-brand {
  min-width: 0;
}

.embed .brand-logo svg {
  max-width: min(170px, 42vw);
  height: 24px;
}

.embed .server-trigger {
  max-width: 210px;
  height: 32px;
  font-size: 12px;
}

.embed .server-menu {
  width: max(100%, 250px);
  max-height: calc(100vh - 60px);
}

.embed .gauge {
  max-width: 270px;
}

.embed .metrics {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.embed .metric {
  padding: 9px 11px;
  border-radius: 12px;
}

.embed .metric-value {
  margin-top: 3px;
  font-size: 20px;
}

.embed .metric-bar {
  margin-top: 8px;
}

.embed-foot .status {
  min-width: 0;
  min-height: 0;
  font-size: 13px;
}

.embed-full {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 5px;
  color: var(--brandOS-text-secondary);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.embed-full:hover {
  color: var(--brandOS-brand);
}

.embed-full svg {
  width: 14px;
  height: 14px;
}

/* compact, wide frame: gauge left, results right. */
@media (min-width: 620px) {
  .embed[data-layout='compact'] .embed-card {
    grid-template-columns: minmax(220px, 280px) 1fr;
    align-items: center;
    column-gap: 22px;
  }

  .embed[data-layout='compact'] :is(.embed-head, .embed-foot) {
    grid-column: 1 / -1;
  }

  .embed[data-layout='compact'] .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* mini: no dial; the start button, the live reading and the four results in one strip. */
.embed[data-layout='mini'] .embed-card {
  gap: 10px;
  padding: 12px 14px;
}

.embed[data-layout='mini'] .gauge {
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: none;
  margin: 0;
  aspect-ratio: auto;
}

.embed[data-layout='mini'] .gauge-svg {
  display: none;
}

.embed[data-layout='mini'] .gauge-readout {
  position: static;
  flex-direction: row;
  align-items: baseline;
  gap: 7px;
  padding: 0;
}

.embed[data-layout='mini'] .gauge-number {
  font-size: 28px;
}

/* The strip is wide, so the dial-relative type sizes would balloon; fix them. */
.embed[data-layout='mini'] .gauge-phase {
  font-size: 12px;
}

.embed[data-layout='mini'] .gauge-unit {
  font-size: 14px;
}

.embed[data-layout='mini'] .start-btn {
  position: static;
  order: -1;
  min-width: 112px;
  height: 38px;
  padding: 0 18px;
  transform: none;
  font-size: 14px;
}

.embed[data-layout='mini'] .metric-value {
  font-size: 17px;
}

.embed[data-layout='mini'] :is(.metric-bar, .metric-sub) {
  display: none;
}

@media (min-width: 520px) {
  .embed .metrics {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* Dark theme: navy surfaces for this page only. The Snyder profile's dark greys are neutral, so the
   brand colour is mixed into black. Mix in OKLab: OKLCH would interpolate hue from the brand blue
   to black's 0° and turn the surfaces purple. Every colour still derives from brandOS tokens. */

[data-theme='dark'] body {
  background:
    radial-gradient(1100px 520px at 50% -180px, color-mix(in oklab, var(--brandOS-brand) 22%, transparent), transparent 70%), color-mix(in oklab, var(--brandOS-brand) 18%, var(--brandOS-gray-1000));
}

[data-theme='dark'] :is(.panel, .server-trigger, .server-menu, .theme-switch, .tile, .btn-secondary, .start-btn.is-running) {
  border-color: color-mix(in oklab, var(--brandOS-brand) 34%, var(--brandOS-gray-1000));
  background: color-mix(in oklab, var(--brandOS-brand) 24%, var(--brandOS-gray-1000));
}

[data-theme='dark'] .is-open .server-trigger {
  border-color: var(--brandOS-brand);
}

[data-theme='dark'] :is(.metric, .server-option-ping, .start-btn.is-running:hover) {
  background: color-mix(in oklab, var(--brandOS-brand) 30%, var(--brandOS-gray-1000));
}

[data-theme='dark'] .metric-note {
  background: color-mix(in oklab, var(--brandOS-brand) 20%, var(--brandOS-gray-1000));
}

[data-theme='dark'] .start-btn.is-running:hover {
  background: color-mix(in oklab, var(--brandOS-brand) 30%, var(--brandOS-gray-1000));
}

[data-theme='dark'] .connection {
  border-color: color-mix(in oklab, var(--brandOS-brand) 34%, var(--brandOS-gray-1000));
}

[data-theme='dark'] .metric-bar {
  background: color-mix(in oklab, var(--brandOS-brand) 36%, var(--brandOS-gray-1000));
}

[data-theme='dark'] .gauge-track {
  stroke: color-mix(in oklab, var(--brandOS-brand) 36%, var(--brandOS-gray-1000));
}

/* The embed leaves the host page's own background around the card. */
[data-theme='dark'] .embed-body {
  background: transparent;
}

/* Responsive */

@media (max-width: 860px) {
  .test {
    grid-template-columns: 1fr;
    gap: 26px;
  }

  .gauge {
    max-width: 340px;
  }
}

@media (max-width: 560px) {
  .page {
    padding: 16px 14px 22px;
  }

  .topbar {
    margin-bottom: 16px;
  }

  /* Phones: the logo gets its own row; the server picker and theme switch share the next. */
  .topbar {
    flex-wrap: wrap;
    gap: 12px;
  }

  .topbar-actions {
    width: 100%;
  }

  .topbar .server-picker {
    flex: 1;
  }

  .topbar .server-trigger {
    max-width: none;
  }

  /* The menu spans the picker, so it opens straight down on a phone. */
  .topbar .server-menu {
    left: 0;
    width: 100%;
    transform-origin: top center;
  }

  .brand-logo svg {
    height: 26px;
  }

  /* Narrow cards: "Loaded" on its own line, both loaded values together beneath it. */
  .metric-sub .sub-label {
    flex-basis: 100%;
  }

  .panel {
    padding: 20px 16px;
    border-radius: 16px;
  }

  .metrics {
    gap: 10px;
  }

  .metric {
    padding: 12px 13px;
  }

  .metric-value {
    font-size: 24px;
  }

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

  .tile {
    font-size: 13px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}
