:root {
  --bg-deep: #050813;
  --bg-mid: #0a0f24;
  --surface: rgba(20, 28, 56, 0.55);
  --border: rgba(255, 255, 255, 0.08);
  --text-primary: #f5f7ff;
  --text-secondary: rgba(245, 247, 255, 0.65);
  --text-tertiary: rgba(245, 247, 255, 0.4);
  --logo-blue: #2444ff;
  --logo-blue-glow: rgba(36, 68, 255, 0.55);
  --logo-red: #ff1a3a;
  --logo-red-glow: rgba(255, 26, 58, 0.55);
  --status-good: #10b981;
  --status-warn: #f59e0b;
  --status-crit: #ef4444;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI Variable',
    'Segoe UI', Roboto, sans-serif;
  background:
    radial-gradient(ellipse at top, #0e1538 0%, var(--bg-mid) 35%, var(--bg-deep) 100%);
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.aurora {
  position: fixed;
  width: 720px;
  height: 720px;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.32;
  pointer-events: none;
  z-index: 0;
  will-change: transform;
  animation: drift 22s ease-in-out infinite alternate;
}
.aurora-blue {
  background: var(--logo-blue);
  top: -240px;
  left: -240px;
}
.aurora-red {
  background: var(--logo-red);
  bottom: -240px;
  right: -240px;
  animation-delay: -11s;
}
@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(80px, 60px) scale(1.15); }
}

.page {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.5rem 1.5rem 1rem;
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  margin-bottom: 1.25rem;
}
.logo-frame {
  position: relative;
  width: 200px;
  height: 200px;
  padding: 4px;
  flex-shrink: 0;
  background:
    conic-gradient(
      from var(--frame-angle),
      var(--logo-blue) 0deg,
      #6a7dff 90deg,
      var(--logo-red) 180deg,
      #ff6b85 270deg,
      var(--logo-blue) 360deg
    );
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06),
    0 0 40px rgba(36, 68, 255, 0.35),
    0 0 60px rgba(255, 26, 58, 0.25),
    0 30px 60px rgba(0, 0, 0, 0.55);
  animation: frame-rotate-angle 14s linear infinite;
}
.logo-frame-inner {
  position: relative;
  width: 100%;
  height: 100%;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.logo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 58% center;
  display: block;
}
@property --frame-angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}
@keyframes frame-rotate-angle {
  to { --frame-angle: 360deg; }
}
.brand-text { display: flex; flex-direction: column; gap: 0.3rem; }
.brand-title {
  margin: 0;
  font-size: 2.25rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  background: linear-gradient(135deg, #ffffff 0%, #c2d1ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.brand-subtitle {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.gauge-card {
  width: 100%;
  background: var(--surface);
  backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: 1.5rem 2rem 1.25rem;
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.4rem 0.95rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--text-secondary);
  transition: color 0.4s ease, background 0.4s ease, border-color 0.4s ease;
}
.card-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.5rem;
}
.refresh-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0;
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease,
    transform 0.15s ease;
  font: inherit;
}
.refresh-btn:hover:not(:disabled) {
  color: var(--text-primary);
  background: rgba(36, 68, 255, 0.18);
  border-color: rgba(36, 68, 255, 0.45);
}
.refresh-btn:active:not(:disabled) {
  transform: scale(0.94);
}
.refresh-btn:focus-visible {
  outline: 2px solid var(--logo-blue);
  outline-offset: 2px;
}
.refresh-btn:disabled {
  opacity: 0.6;
  cursor: progress;
}
.refresh-btn.is-spinning .refresh-icon {
  animation: refresh-spin 0.9s linear infinite;
}
@keyframes refresh-spin {
  to { transform: rotate(360deg); }
}
.status-pill.is-good  { color: var(--status-good); border-color: rgba(16, 185, 129, 0.35); }
.status-pill.is-warn  { color: var(--status-warn); border-color: rgba(245, 158, 11, 0.35); }
.status-pill.is-crit  { color: var(--status-crit); border-color: rgba(239, 68, 68, 0.4); }
.status-pill.is-error { color: var(--status-crit); border-color: rgba(239, 68, 68, 0.4); }
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 0 currentColor;
  animation: dot-pulse 1.8s ease-out infinite;
}
@keyframes dot-pulse {
  0%   { box-shadow: 0 0 0 0 currentColor; }
  70%  { box-shadow: 0 0 0 10px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

.gauge-wrap {
  position: relative;
  width: 100%;
  max-width: 280px;
  aspect-ratio: 1;
  margin: 0.25rem 0 0.75rem;
}
.gauge {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.gauge-track {
  fill: none;
  stroke: rgba(255, 255, 255, 0.06);
  stroke-width: 14;
}
.gauge-fill {
  fill: none;
  stroke: url(#gaugeGradient);
  stroke-width: 14;
  stroke-linecap: round;
  stroke-dasharray: 722.566;
  stroke-dashoffset: 722.566;
  transition: stroke-dashoffset 1.2s cubic-bezier(0.22, 1, 0.36, 1);
}
.gauge-readout {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  text-align: center;
  pointer-events: none;
}
.gauge-value {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.15rem;
  font-size: 4.5rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(135deg, #ffffff 0%, #b8c6ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  transform-origin: center;
  will-change: transform, filter;
}
.gauge-value.is-updating {
  background:
    linear-gradient(
      105deg,
      #b8c6ff 0%,
      #ffffff 35%,
      #ffffff 50%,
      #b8c6ff 65%,
      #b8c6ff 100%
    );
  background-size: 280% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation:
    value-shimmer 1.1s cubic-bezier(0.22, 1, 0.36, 1) forwards,
    value-pulse 0.9s cubic-bezier(0.34, 1.4, 0.64, 1) forwards;
}
@keyframes value-shimmer {
  from { background-position: 220% 0; }
  to   { background-position: -120% 0; }
}
@keyframes value-pulse {
  0%   { transform: scale(1);    filter: drop-shadow(0 0 0 transparent); }
  35%  { transform: scale(1.06); filter: drop-shadow(0 0 22px rgba(36, 68, 255, 0.55)); }
  65%  { transform: scale(0.985); filter: drop-shadow(0 0 12px rgba(255, 26, 58, 0.35)); }
  100% { transform: scale(1);    filter: drop-shadow(0 0 0 transparent); }
}
.gauge-unit {
  font-size: 1.5rem;
  font-weight: 600;
  -webkit-text-fill-color: initial;
  background: none;
  color: var(--text-secondary);
}
.gauge-label {
  margin-top: 0.5rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.3em;
  color: var(--text-tertiary);
}

.meta {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.7rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
@media (min-width: 520px) {
  .meta { grid-template-columns: repeat(3, 1fr); }
}
.meta-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  text-align: center;
}
.meta-key {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: var(--text-tertiary);
  text-transform: uppercase;
}
.meta-val {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.footer {
  text-align: center;
  padding: 0.75rem 1rem 1rem;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  color: var(--text-secondary);
  position: relative;
  z-index: 1;
}
.brand-sonic {
  font-weight: 800;
  color: var(--logo-red);
  letter-spacing: 0.18em;
  text-shadow: 0 0 18px var(--logo-red-glow);
}

@media (max-width: 520px) {
  .brand { flex-direction: column; gap: 1rem; text-align: center; margin-bottom: 1rem; }
  .logo-frame { width: 150px; height: 150px; }
  .brand-title { font-size: 1.85rem; }
  .gauge-value { font-size: 3.8rem; }
  .gauge-wrap  { max-width: 240px; }
  .gauge-card  { padding: 1.25rem 1rem 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  .aurora, .logo-frame, .status-dot, .gauge-fill {
    animation: none !important;
    transition: none !important;
  }
}
}
