:root {
  color-scheme: dark;
  --bg: #07111f;
  --panel: rgba(15, 29, 47, 0.82);
  --panel-strong: #102139;
  --line: rgba(160, 190, 220, 0.14);
  --text: #f3f7fb;
  --muted: #91a4b9;
  --blue: #3e8bff;
  --cyan: #29d4c7;
  --green: #4ed7a6;
  --yellow: #ffc861;
  --red: #ff5b68;
  --radius: 22px;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--bg);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 8% 5%, rgba(45, 118, 210, 0.18), transparent 32rem),
    radial-gradient(circle at 90% 80%, rgba(26, 186, 169, 0.1), transparent 34rem),
    linear-gradient(160deg, #07111f 0%, #081523 46%, #06101c 100%);
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

.ambient {
  position: fixed;
  z-index: 0;
  width: 28rem;
  height: 28rem;
  border-radius: 50%;
  filter: blur(110px);
  pointer-events: none;
  opacity: 0.18;
}

.ambient-one {
  top: -14rem;
  right: 8%;
  background: #286dcc;
}

.ambient-two {
  bottom: -16rem;
  left: 12%;
  background: #1aa893;
}

.shell {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 30px 0 44px;
}

.topbar,
.hero,
.panel-heading,
.history-heading,
.history-title-row,
.history-footer,
.metadata-row,
.top-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: inline-flex;
  gap: 12px;
  align-items: center;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 1px solid rgba(78, 174, 255, 0.32);
  border-radius: 15px;
  background: linear-gradient(145deg, rgba(55, 131, 242, 0.22), rgba(34, 211, 196, 0.08));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.06);
}

.brand-mark svg {
  width: 30px;
  fill: rgba(62, 139, 255, 0.18);
  stroke: #68b5ff;
  stroke-width: 2.3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 17px;
  letter-spacing: 0.06em;
}

.brand small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
}

.top-actions {
  gap: 12px;
}

.connection,
.refresh-button {
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(8, 20, 34, 0.68);
  color: var(--muted);
}

.connection {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 0 14px;
  font-size: 12px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--yellow);
  box-shadow: 0 0 10px currentColor;
}

.connection-online .status-dot {
  color: var(--green);
  background: var(--green);
}

.connection-error .status-dot {
  color: var(--red);
  background: var(--red);
}

.connection-idle .status-dot {
  color: var(--muted);
  background: var(--muted);
}

.refresh-button {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  padding: 0 14px;
  cursor: pointer;
  transition: 160ms ease;
}

.refresh-button:hover:not(:disabled) {
  color: var(--text);
  border-color: rgba(89, 161, 255, 0.44);
  background: rgba(31, 75, 126, 0.28);
}

.refresh-button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.refresh-button svg {
  width: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.refresh-button.is-loading svg {
  animation: rotate 1s linear infinite;
}

.hero {
  min-height: 190px;
  padding: 38px 4px 28px;
}

.eyebrow,
.section-label {
  margin: 0 0 8px;
  color: #6f8faf;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
}

.hero h1 {
  margin: 0;
  font-size: clamp(34px, 6vw, 58px);
  font-weight: 650;
  letter-spacing: -0.04em;
}

.hero h1 span {
  color: #72b9ff;
}

.hero-copy {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.last-seen {
  min-width: 210px;
  padding: 17px 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(10, 23, 39, 0.55);
  text-align: right;
}

.last-seen span,
.last-seen small {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.last-seen strong {
  display: block;
  margin: 5px 0;
  font-size: 20px;
}

.notice,
.alert-card {
  display: flex;
  align-items: center;
  border-radius: var(--radius);
}

[hidden] {
  display: none !important;
}

.notice {
  gap: 14px;
  margin-bottom: 18px;
  padding: 16px 18px;
  border: 1px solid rgba(255, 91, 104, 0.28);
  background: rgba(100, 28, 38, 0.24);
}

.notice-icon {
  display: grid;
  flex: 0 0 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 91, 104, 0.16);
  color: #ffadb4;
  font-weight: 800;
}

.notice strong,
.notice p {
  margin: 0;
}

.notice p {
  margin-top: 3px;
  color: #c5a8ad;
  font-size: 12px;
}

.alert-card {
  position: relative;
  gap: 18px;
  min-height: 116px;
  margin-bottom: 18px;
  padding: 22px 24px;
  overflow: hidden;
  border: 1px solid rgba(255, 91, 104, 0.34);
  background:
    linear-gradient(110deg, rgba(123, 24, 36, 0.52), rgba(52, 19, 32, 0.46)),
    var(--panel-strong);
  box-shadow: 0 18px 50px rgba(5, 7, 14, 0.24);
}

.alert-card::after {
  position: absolute;
  right: -50px;
  width: 190px;
  height: 190px;
  border: 32px solid rgba(255, 91, 104, 0.05);
  border-radius: 50%;
  content: "";
}

.alert-icon {
  display: grid;
  flex: 0 0 66px;
  height: 66px;
  place-items: center;
  border: 1px solid rgba(255, 182, 189, 0.3);
  border-radius: 20px;
  background: rgba(255, 91, 104, 0.16);
  color: #ffb6bd;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.alert-content {
  position: relative;
  z-index: 1;
  flex: 1;
}

.alert-content p,
.alert-content h2,
.alert-content span {
  margin: 0;
}

.alert-content p {
  color: #ff9ba5;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.alert-content h2 {
  margin: 5px 0 7px;
  font-size: 20px;
}

.alert-content span {
  color: #cda7ac;
  font-size: 12px;
}

.alert-action,
.map-button {
  position: relative;
  z-index: 1;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.alert-action {
  padding: 12px 16px;
  border: 1px solid rgba(255, 205, 210, 0.28);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

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

.panel {
  min-width: 0;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.025), transparent 45%),
    var(--panel);
  box-shadow: 0 20px 60px rgba(2, 8, 16, 0.18);
  backdrop-filter: blur(16px);
}

.panel-heading {
  align-items: flex-start;
}

.panel-heading h2,
.history-heading h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 650;
}

.event-badge {
  padding: 6px 9px;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  opacity: 0.86;
}

.event-critical {
  color: #ff8d98;
  background: rgba(255, 91, 104, 0.1);
}

.event-warning {
  color: var(--yellow);
  background: rgba(255, 200, 97, 0.08);
}

.event-success {
  color: var(--green);
  background: rgba(78, 215, 166, 0.08);
}

.event-muted,
.event-unknown {
  color: #9aadc0;
  background: rgba(154, 173, 192, 0.06);
}

.event-visual {
  display: grid;
  width: 92px;
  height: 92px;
  margin: 34px auto 26px;
  place-items: center;
  border: 1px solid rgba(82, 155, 245, 0.24);
  border-radius: 28px;
  background: radial-gradient(circle at 38% 30%, rgba(86, 167, 255, 0.3), rgba(31, 95, 172, 0.12));
  color: #92caff;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 0.04em;
  box-shadow: 0 0 40px rgba(49, 126, 226, 0.12);
}

.visual-critical {
  border-color: rgba(255, 91, 104, 0.36);
  background: radial-gradient(circle at 38% 30%, rgba(255, 91, 104, 0.34), rgba(112, 28, 45, 0.13));
  color: #ffadb5;
  box-shadow: 0 0 40px rgba(255, 91, 104, 0.12);
}

.visual-success {
  border-color: rgba(78, 215, 166, 0.32);
  background: radial-gradient(circle at 38% 30%, rgba(78, 215, 166, 0.3), rgba(20, 103, 83, 0.12));
  color: #91f0cf;
}

.visual-warning {
  border-color: rgba(255, 200, 97, 0.3);
  background: radial-gradient(circle at 38% 30%, rgba(255, 200, 97, 0.28), rgba(126, 84, 15, 0.1));
  color: #ffe09e;
}

.event-description,
.panel-note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.event-description {
  min-height: 42px;
  margin: 0 0 19px;
  text-align: center;
}

.metadata-row {
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
}

.metadata-row strong {
  color: #c7d4e0;
  font-weight: 500;
}

.battery-list {
  display: grid;
  gap: 16px;
  margin: 33px 0 29px;
}

.battery-item {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: rgba(6, 16, 29, 0.38);
}

.battery-icon {
  position: relative;
  display: flex;
  flex: 0 0 25px;
  height: 42px;
  align-items: flex-end;
  padding: 3px;
  overflow: hidden;
  border: 2px solid #5edab0;
  border-radius: 6px;
}

.battery-icon::before {
  position: absolute;
  top: -5px;
  left: 7px;
  width: 7px;
  height: 4px;
  border-radius: 2px 2px 0 0;
  background: currentColor;
  content: "";
}

.battery-icon span {
  width: 100%;
  height: 0;
  border-radius: 2px;
  background: linear-gradient(to top, #29b98a, #77ecc7);
  transition: height 500ms ease;
}

.battery-secondary {
  border-color: #62a9fa;
}

.battery-secondary span {
  background: linear-gradient(to top, #347fd7, #78bcff);
}

.battery-copy {
  flex: 1;
}

.battery-copy > span,
.battery-copy strong {
  display: block;
}

.battery-copy > span {
  color: var(--muted);
  font-size: 11px;
}

.battery-copy strong {
  margin-top: 4px;
  font-size: 25px;
  letter-spacing: -0.03em;
}

.battery-copy small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.battery-state {
  font-size: 10px;
  font-weight: 700;
}

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

.state-warning {
  color: var(--yellow);
}

.state-critical {
  color: var(--red);
}

.state-neutral,
.state-unknown {
  color: var(--muted);
}

.panel-note {
  margin: 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.location-orbit {
  position: relative;
  display: grid;
  width: 150px;
  height: 112px;
  margin: 19px auto 9px;
  place-items: center;
}

.orbit {
  position: absolute;
  border: 1px solid rgba(89, 160, 237, 0.16);
  border-radius: 50%;
}

.orbit-one {
  width: 142px;
  height: 62px;
  transform: rotate(-10deg);
}

.orbit-two {
  width: 96px;
  height: 96px;
  transform: rotate(52deg);
}

.location-pin {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #79bdff, #317ed7);
  box-shadow: 0 0 34px rgba(56, 136, 225, 0.36);
}

.location-pin svg {
  width: 25px;
  fill: none;
  stroke: white;
  stroke-width: 1.8;
}

.coordinates {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.coordinates div {
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(6, 16, 29, 0.34);
}

.coordinates span,
.coordinates strong {
  display: block;
}

.coordinates span {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 9px;
}

.coordinates strong {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
  font-weight: 500;
}

.map-button {
  width: 100%;
  margin: 13px 0;
  padding: 11px 14px;
  border: 1px solid rgba(78, 155, 244, 0.25);
  border-radius: 13px;
  background: rgba(51, 123, 211, 0.13);
  color: #9dceff;
}

.history-section {
  margin-top: 40px;
}

.history-heading {
  margin-bottom: 17px;
}

.filters {
  display: flex;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(8, 20, 34, 0.6);
}

.filter-button {
  padding: 7px 13px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
}

.filter-button.active {
  background: #245e9f;
  color: white;
  box-shadow: 0 4px 18px rgba(36, 94, 159, 0.28);
}

.history-list {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.history-item {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  min-height: 132px;
  border-bottom: 1px solid var(--line);
}

.history-item:last-child {
  border-bottom: 0;
}

.timeline-mark {
  position: relative;
  display: grid;
  place-items: center;
}

.timeline-mark::after {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
  background: var(--line);
  content: "";
}

.timeline-mark span {
  z-index: 1;
  display: grid;
  width: 37px;
  height: 37px;
  place-items: center;
  border: 1px solid rgba(90, 162, 246, 0.25);
  border-radius: 12px;
  background: #10233b;
  color: #91caff;
  font-size: 9px;
  font-weight: 900;
}

.history-critical .timeline-mark span {
  border-color: rgba(255, 91, 104, 0.28);
  background: #381b29;
  color: #ff9fa8;
}

.history-warning .timeline-mark span {
  border-color: rgba(255, 200, 97, 0.28);
  background: #30291d;
  color: #ffda8e;
}

.history-success .timeline-mark span {
  border-color: rgba(78, 215, 166, 0.26);
  background: #17352f;
  color: #82e7c4;
}

.history-main {
  min-width: 0;
  padding: 18px 22px 16px 4px;
}

.history-title-row {
  align-items: flex-start;
}

.history-title-row h3 {
  margin: 4px 0 0;
  font-size: 15px;
}

.history-category {
  color: #7292b2;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.history-title-row time {
  color: var(--muted);
  font-size: 11px;
}

.history-details {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin: 13px 0;
  color: var(--muted);
  font-size: 11px;
}

.history-details strong {
  color: #ced9e4;
}

.history-footer {
  padding-top: 11px;
  border-top: 1px solid rgba(160, 190, 220, 0.08);
  color: #6f859c;
  font-size: 10px;
}

.history-map {
  color: #78baff;
  text-decoration: none;
}

.empty-state {
  display: grid;
  min-height: 280px;
  place-items: center;
  align-content: center;
  padding: 30px;
  color: var(--muted);
  text-align: center;
}

.empty-state > span {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  color: #6e9bc8;
  font-size: 28px;
}

.empty-state h3,
.empty-state p {
  margin: 0;
}

.empty-state h3 {
  color: #c8d5e0;
  font-size: 14px;
}

.empty-state p {
  margin-top: 6px;
  font-size: 11px;
}

footer {
  display: flex;
  justify-content: space-between;
  padding: 26px 4px 0;
  color: #5f758c;
  font-size: 10px;
}

@keyframes rotate {
  to { transform: rotate(360deg); }
}

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

  .location-panel {
    grid-column: 1 / -1;
  }

  .location-panel .location-orbit {
    margin-top: 10px;
  }
}

@media (max-width: 650px) {
  .shell {
    width: min(100% - 24px, 560px);
    padding-top: 18px;
  }

  .brand small,
  .connection {
    display: none;
  }

  .brand-mark {
    width: 42px;
    height: 42px;
  }

  .refresh-button {
    height: 38px;
  }

  .hero {
    display: block;
    min-height: 0;
    padding: 44px 2px 24px;
  }

  .hero-copy {
    font-size: 12px;
  }

  .last-seen {
    display: flex;
    min-width: 0;
    align-items: center;
    justify-content: space-between;
    margin-top: 24px;
    padding: 13px 15px;
    text-align: left;
  }

  .last-seen strong {
    margin: 0 0 0 auto;
    font-size: 15px;
  }

  .last-seen small {
    display: none;
  }

  .alert-card {
    display: grid;
    grid-template-columns: 54px 1fr;
    gap: 14px;
    padding: 18px;
  }

  .alert-icon {
    width: 54px;
    height: 54px;
    font-size: 13px;
  }

  .alert-content h2 {
    font-size: 16px;
  }

  .alert-action {
    grid-column: 1 / -1;
  }

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

  .location-panel {
    grid-column: auto;
  }

  .history-heading {
    display: block;
  }

  .filters {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    margin-top: 15px;
  }

  .filter-button {
    padding-inline: 7px;
  }

  .history-item {
    grid-template-columns: 52px minmax(0, 1fr);
  }

  .timeline-mark span {
    width: 32px;
    height: 32px;
  }

  .history-main {
    padding-right: 15px;
  }

  .history-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .history-details span:last-child {
    grid-column: 1 / -1;
  }

  footer {
    display: block;
    line-height: 1.8;
    text-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
