:root {
  --bg: #081123;
  --bg-soft: #0f1b35;
  --panel: rgba(14, 29, 56, 0.78);
  --panel-border: rgba(92, 144, 220, 0.28);
  --text: #dce8fa;
  --muted: #97aecf;
  --accent: #37c9f6;
  --accent-2: #2a8fff;
  --danger: #ff6b7f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 10%, rgba(55, 201, 246, 0.22), transparent 36%),
    radial-gradient(circle at 88% 88%, rgba(42, 143, 255, 0.2), transparent 40%),
    linear-gradient(145deg, #081123 0%, #0a1b39 45%, #0b1630 100%);
}

.shell {
  width: min(1100px, 95vw);
  margin: 24px auto;
  padding: 20px;
}

.top {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: end;
  margin-bottom: 16px;
}

h1 {
  margin: 0;
  letter-spacing: 0.3px;
  font-size: 1.9rem;
}

.subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.server-meta {
  text-align: right;
}

.meta-links {
  display: flex;
  gap: 6px;
  justify-content: end;
  flex-wrap: wrap;
}

.admin-link {
  display: inline-block;
  margin-bottom: 6px;
  color: #062447;
  text-decoration: none;
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  border-radius: 999px;
  padding: 6px 10px;
}

.admin-link.checking {
  opacity: 0.86;
}

.admin-link.unavailable {
  opacity: 0.55;
  pointer-events: none;
  filter: grayscale(0.3);
}

.meta-label {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.11em;
}

.meta-value {
  display: block;
  margin-top: 4px;
  font-size: 0.98rem;
  overflow-wrap: anywhere;
}

.meta-subvalue {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}

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

.hero {
  margin-bottom: 14px;
}

.gauge-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 14px 16px 12px;
  backdrop-filter: blur(6px);
}

.gauge-stage {
  position: relative;
}

.gauge-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}

.gauge-head h2 {
  margin: 0;
  color: #a9c5e8;
  font-size: 0.88rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.gauge-phase {
  color: var(--muted);
  font-size: 0.84rem;
}

.gauge-svg {
  width: 100%;
  height: 230px;
  display: block;
  margin-top: 6px;
}

.gauge-center-action {
  position: absolute;
  left: 50%;
  top: 63%;
  transform: translate(-50%, -50%);
  z-index: 2;
}

#gauge-track {
  fill: none;
  stroke: rgba(84, 127, 188, 0.32);
  stroke-width: 18;
  stroke-linecap: round;
}

#gauge-fill {
  fill: none;
  stroke: url(#gauge-gradient);
  stroke-width: 18;
  stroke-linecap: round;
  transition: stroke-dashoffset 160ms linear;
}

#gauge-needle {
  stroke: #d7e9ff;
  stroke-width: 4;
  stroke-linecap: round;
  transform-origin: 200px 180px;
  transition: transform 160ms ease-out;
}

#gauge-hub {
  fill: #dcecff;
}

#gauge-min,
#gauge-max {
  fill: #9cb6d8;
  font-size: 14px;
}

#gauge-max {
  text-anchor: end;
}

.gauge-readout {
  margin-top: -16px;
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 8px;
}

#gauge-value {
  font-size: 2rem;
  line-height: 1;
  font-weight: 650;
}

#gauge-unit {
  color: var(--muted);
  font-size: 0.9rem;
}

.card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 16px;
  backdrop-filter: blur(6px);
}

.card h2 {
  margin: 0 0 12px;
  color: #a9c5e8;
  font-size: 0.95rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.value {
  font-size: 2.1rem;
  font-weight: 650;
  color: #f3f8ff;
  min-height: 2.5rem;
}

.unit {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 3px;
}

.detail {
  margin-top: 8px;
  color: #b8ccea;
  font-size: 0.84rem;
  overflow-wrap: anywhere;
}

.controls {
  margin-top: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

#run-btn {
  border: 0;
  border-radius: 11px;
  padding: 11px 18px;
  font-weight: 650;
  letter-spacing: 0.03em;
  color: #052043;
  cursor: pointer;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  box-shadow: 0 10px 24px rgba(24, 132, 229, 0.28);
}

#run-btn:disabled {
  opacity: 0.58;
  cursor: not-allowed;
}

.thread-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.86rem;
}

.thread-control select,
.thread-control input[type="number"] {
  background: #0f1c36;
  color: #dce8fa;
  border: 1px solid rgba(109, 153, 223, 0.3);
  border-radius: 8px;
  padding: 7px 9px;
}

.thread-control input[type="number"] {
  width: 86px;
}

.status {
  color: var(--muted);
}

.status.error {
  color: var(--danger);
}

.notes {
  margin-top: 12px;
  color: #9fb7d9;
  font-size: 0.82rem;
}

.notes p {
  margin: 5px 0;
}

code {
  color: #d5e7ff;
}

.hidden {
  display: none !important;
}

.results-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.results-card {
  width: min(980px, 95vw);
  background: rgba(11, 27, 53, 0.86);
  border: 1px solid rgba(106, 152, 226, 0.35);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 24px 60px rgba(2, 8, 22, 0.5);
  backdrop-filter: blur(8px);
}

.results-card h1 {
  margin: 0;
  font-size: 2rem;
}

.results-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
}

.results-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.results-grid article {
  background: rgba(16, 36, 70, 0.68);
  border: 1px solid rgba(108, 154, 227, 0.24);
  border-radius: 12px;
  padding: 14px;
}

.results-grid h2 {
  margin: 0;
  font-size: 0.82rem;
  color: #aac8ec;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.summary-value {
  margin: 8px 0 0;
  font-size: 1.7rem;
  font-weight: 650;
  color: #f2f8ff;
}

.summary-meta {
  margin: 6px 0 0;
  color: #a8c0df;
  font-size: 0.86rem;
  overflow-wrap: anywhere;
}

.results-extra {
  margin-top: 14px;
  color: #a8c0df;
}

.results-extra p {
  margin: 4px 0;
}

.results-actions {
  margin-top: 18px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

#run-another-btn,
#back-live-btn {
  border: 0;
  border-radius: 10px;
  padding: 11px 16px;
  font-weight: 650;
  cursor: pointer;
}

#run-another-btn {
  color: #052043;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
}

#back-live-btn.ghost {
  color: #d6e6fb;
  background: rgba(18, 40, 77, 0.75);
  border: 1px solid rgba(110, 156, 230, 0.3);
}

@media (max-width: 980px) {
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .top {
    flex-direction: column;
    align-items: start;
  }

  .server-meta {
    text-align: left;
  }

  .meta-links {
    justify-content: start;
  }

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

  .gauge-center-action {
    top: 61%;
  }
}

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

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

  #run-btn {
    padding: 10px 14px;
  }

  .gauge-center-action {
    top: 60%;
  }
}
