:root {
  color-scheme: dark;
  --bg: #071015;
  --panel: #0d1a22;
  --line: #244858;
  --text: #edf7fb;
  --muted: #8fb0bd;
  --accent: #42d7b6;
  --warn: #f0c05a;
  --wind: #67b7ff;
  --danger: #ff6b6b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: radial-gradient(circle at 50% -20%, #173444 0, #071015 46%, #05090c 100%);
  color: var(--text);
}

.page {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 34px;
}

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

h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 680;
  letter-spacing: 0;
}

.meta {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid rgba(66, 215, 182, .45);
  background: rgba(66, 215, 182, .08);
  color: var(--accent);
  border-radius: 6px;
  font-size: 14px;
  white-space: nowrap;
}

.status.error {
  border-color: rgba(255, 107, 107, .5);
  background: rgba(255, 107, 107, .08);
  color: var(--danger);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 14px currentColor;
}

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

.summary-item,
.card,
.api {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(18, 38, 49, .92), rgba(9, 19, 25, .94));
  border-radius: 8px;
}

.summary-item {
  padding: 14px 16px;
}

.label {
  color: var(--muted);
  font-size: 13px;
}

.summary-value {
  margin-top: 6px;
  font-size: 24px;
  font-weight: 700;
}

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

.card {
  min-height: 220px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.device-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 28px;
}

.device-name {
  font-size: 16px;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.chip {
  color: var(--accent);
  border: 1px solid rgba(66, 215, 182, .38);
  background: rgba(66, 215, 182, .08);
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  flex: 0 0 auto;
}

.metric {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 12px;
  background: rgba(255, 255, 255, .035);
  border: 1px solid rgba(255, 255, 255, .06);
  border-radius: 8px;
}

.icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, .07);
  font-size: 12px;
  color: var(--muted);
}

.metric-name {
  color: var(--muted);
  font-size: 13px;
}

.metric-value {
  margin-top: 2px;
  font-size: 24px;
  line-height: 1.15;
  font-weight: 760;
  overflow-wrap: anywhere;
}

.voltage .metric-value {
  color: var(--warn);
}

.wind .metric-value {
  color: var(--wind);
}

.weekly-wind .metric-value {
  color: var(--accent);
}

.time {
  margin-top: auto;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.api {
  margin-top: 18px;
  padding: 14px 16px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.refresh-footer {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-top: 18px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(7, 16, 21, .94);
  backdrop-filter: blur(10px);
  color: var(--muted);
  font-size: 13px;
}

.footer-label {
  margin-right: 8px;
}

.footer-value {
  color: var(--text);
  font-weight: 650;
}

.refresh-state.success {
  color: var(--accent);
}

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

.refresh-state.loading {
  color: var(--wind);
}

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

@media (max-width: 680px) {
  header {
    align-items: start;
    flex-direction: column;
  }

  .summary,
  .grid {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 24px;
  }

  .refresh-footer {
    position: static;
    flex-direction: column;
  }
}
