:root {
  color-scheme: dark;
  --bg: #12315a;
  --panel: rgba(12, 25, 43, 0.78);
  --panel-soft: rgba(13, 31, 52, 0.66);
  --ink: #fff2d5;
  --muted: #c7d7e6;
  --line: rgba(235, 184, 76, 0.94);
  --line-dim: rgba(79, 127, 174, 0.9);
  --gold: #f3bd45;
  --blue: #2f88d2;
  --green: #75d7a0;
  --red: #df685f;
  --shadow: rgba(2, 5, 8, 0.46);
  --cell: rgba(11, 20, 30, 0.72);
  --ui-center-x: 50%;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  min-width: 320px;
  background:
    linear-gradient(180deg, rgba(4, 23, 46, 0.08), rgba(4, 18, 34, 0.34)),
    url("assets/stormwind-valley-pixel-v3.png") center / cover no-repeat,
    var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", system-ui, sans-serif;
}

a {
  color: inherit;
  font: inherit;
}

h1,
h2,
p {
  margin: 0;
}

.dashboard-shell {
  display: grid;
  width: min(940px, calc(100vw - 170px));
  height: min(470px, calc(100dvh - 190px));
  min-height: 390px;
  margin-left: var(--ui-center-x);
  gap: 18px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: 118px minmax(0, 1fr);
  grid-template-areas:
    "apps apps"
    "vps foundry";
  transform: translate(-50%, clamp(132px, 21vh, 168px));
}

.panel {
  min-width: 0;
  min-height: 0;
  border: 3px solid var(--line-dim);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(0, 0, 0, 0.08)),
    var(--panel);
  box-shadow:
    0 10px 0 var(--shadow),
    0 0 28px rgba(243, 189, 69, 0.16);
  overflow: hidden;
  padding: 12px;
  backdrop-filter: blur(1.5px);
}

.app-panel {
  grid-area: apps;
  align-self: center;
  justify-self: center;
  width: fit-content;
  max-width: 100%;
  height: auto;
  border: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
  backdrop-filter: none;
}

.vps-health {
  grid-area: vps;
}

.foundry-health {
  grid-area: foundry;
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 28px;
  margin-bottom: 10px;
  border-bottom: 2px solid rgba(235, 184, 76, 0.48);
  padding-bottom: 8px;
}

.panel-title h1,
.panel-title h2 {
  overflow: hidden;
  font-size: 0.88rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  line-height: 1;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.rune {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  background: var(--blue);
  box-shadow:
    0 0 0 2px rgba(47, 136, 210, 0.28),
    0 0 12px rgba(47, 136, 210, 0.86);
}

.app-grid,
.health-grid {
  display: grid;
  min-height: 0;
  height: calc(100% - 38px);
  gap: 10px;
}

.app-grid {
  align-content: center;
  height: auto;
  grid-auto-rows: minmax(86px, auto);
  justify-items: center;
  width: fit-content;
  max-width: 100%;
}

.health-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: 54px repeat(2, minmax(0, 1fr));
}

.app-card,
.panel-status,
.stat-card {
  border: 3px solid var(--line-dim);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(0, 0, 0, 0.1)),
    var(--cell);
  color: var(--ink);
  box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.22);
}

.app-card {
  display: flex;
  min-height: 86px;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: fit-content;
  max-width: min(100%, 390px);
  padding: 14px 28px;
  text-decoration: none;
}

.app-card:hover {
  border-color: var(--line);
  background:
    linear-gradient(180deg, rgba(243, 189, 69, 0.14), rgba(0, 0, 0, 0.1)),
    rgba(14, 35, 61, 0.84);
}

.app-icon {
  width: clamp(54px, 6vw, 72px);
  height: clamp(54px, 6vw, 72px);
  flex: 0 0 auto;
  object-fit: contain;
  filter: drop-shadow(0 4px 0 rgba(0, 0, 0, 0.35));
}

.app-copy {
  display: grid;
  min-width: 0;
  gap: 7px;
  justify-items: center;
  text-align: center;
}

.app-card strong {
  overflow: hidden;
  color: #fff2c8;
  font-size: clamp(1.15rem, 2vw, 1.42rem);
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-card span,
.stat-label {
  color: var(--muted);
  font-size: 0.82rem;
}

.app-card .launch {
  color: var(--gold);
  font-weight: 900;
  text-transform: uppercase;
}

.panel-status {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
  grid-column: 1 / -1;
  padding: 8px 10px;
}

.status-item {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
  flex: 1 1 0;
}

.status-item > span:last-child {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.status-item strong,
.status-item span span {
  overflow: hidden;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-item strong {
  color: #fff2c8;
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.status-item span span {
  color: var(--muted);
  font-size: 0.66rem;
}

.status-light {
  width: 13px;
  height: 13px;
  flex: 0 0 auto;
  background: var(--green);
  box-shadow:
    0 0 0 2px rgba(109, 211, 158, 0.22),
    0 0 14px rgba(109, 211, 158, 0.78);
}

.status-item.warning .status-light {
  background: var(--gold);
  box-shadow:
    0 0 0 2px rgba(241, 201, 102, 0.22),
    0 0 14px rgba(241, 201, 102, 0.76);
}

.status-item.pending .status-light {
  background: var(--blue);
  box-shadow:
    0 0 0 2px rgba(103, 199, 236, 0.22),
    0 0 14px rgba(103, 199, 236, 0.76);
}

.status-item.critical .status-light,
.status-item.offline .status-light {
  background: var(--red);
  box-shadow:
    0 0 0 2px rgba(223, 104, 95, 0.24),
    0 0 14px rgba(223, 104, 95, 0.78);
}

.stat-card {
  display: grid;
  min-width: 0;
  min-height: 0;
  align-items: center;
  gap: 8px 11px;
  grid-template-columns: 54px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  padding: 10px;
}

.stat-card:has(.sparkline) {
  grid-template-rows: minmax(0, 1fr) 18px;
}

.stat-card:not(:has(.gauge)) {
  align-items: center;
  grid-template-columns: 1fr;
  padding-left: 16px;
}

.stat-top {
  display: grid;
  min-width: 0;
  align-content: center;
  gap: 5px;
}

.stat-label,
.stat-value {
  overflow: hidden;
  line-height: 1.1;
  text-overflow: ellipsis;
}

.stat-value {
  color: var(--gold);
  font-size: clamp(0.78rem, 1.25vw, 0.92rem);
  font-weight: 700;
  white-space: nowrap;
}

.gauge {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  background:
    radial-gradient(circle at center, rgba(8, 12, 16, 0.94) 0 48%, transparent 50%),
    conic-gradient(var(--green) var(--gauge-value), rgba(147, 109, 49, 0.6) 0);
  border: 2px solid rgba(147, 109, 49, 0.86);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.035);
}

.gauge span {
  color: #fff2c8;
  display: block;
  width: 100%;
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1;
  text-align: center;
}

.stat-card.warning .gauge {
  background:
    radial-gradient(circle at center, rgba(8, 12, 16, 0.94) 0 48%, transparent 50%),
    conic-gradient(var(--gold) var(--gauge-value), rgba(147, 109, 49, 0.6) 0);
}

.stat-card.critical .gauge,
.stat-card.offline .gauge {
  background:
    radial-gradient(circle at center, rgba(8, 12, 16, 0.94) 0 48%, transparent 50%),
    conic-gradient(var(--red) var(--gauge-value), rgba(147, 109, 49, 0.6) 0);
}

.sparkline {
  display: flex;
  height: 18px;
  align-items: end;
  gap: 2px;
  grid-column: 1 / -1;
  border-top: 1px solid rgba(184, 143, 70, 0.28);
  padding-top: 5px;
  overflow: hidden;
}

.sparkline span {
  width: 100%;
  min-width: 3px;
  height: var(--spark-height);
  background: rgba(76, 170, 226, 0.74);
  box-shadow: 0 0 7px rgba(47, 136, 210, 0.3);
}

.stat-card.warning .sparkline span {
  background: rgba(241, 201, 102, 0.78);
}

.stat-card.critical .sparkline span,
.stat-card.offline .sparkline span {
  background: rgba(223, 104, 95, 0.72);
}

@media (max-width: 900px) {
  .dashboard-shell {
    width: min(700px, calc(100vw - 52px));
    height: min(650px, calc(100dvh - 110px));
    grid-template-columns: 1fr;
    grid-template-rows: 82px minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas:
      "apps"
      "vps"
      "foundry";
    transform: translate(-50%, clamp(54px, 9vh, 84px));
  }

  .app-panel {
    width: fit-content;
    max-width: 100%;
  }

  .app-grid {
    grid-auto-rows: 54px;
  }

  .app-card {
    min-height: 54px;
    padding: 8px 18px;
  }

  .app-card .app-copy > span:not(.launch) {
    display: none;
  }

  .app-icon {
    width: 42px;
    height: 42px;
  }
}

@media (max-width: 560px) {
  .dashboard-shell {
    width: calc(100vw - 24px);
    height: min(710px, calc(100dvh - 72px));
    min-height: 0;
    gap: 10px;
    grid-template-rows: 72px minmax(0, 1fr) minmax(0, 1fr);
    transform: translate(-50%, 46px);
  }

  .panel {
    padding: 9px;
  }

  .panel-title {
    height: 24px;
    margin-bottom: 7px;
    padding-bottom: 6px;
  }

  .app-grid,
  .health-grid {
    height: calc(100% - 31px);
  }

  .app-grid {
    grid-auto-rows: 42px;
  }

  .app-card {
    min-height: 42px;
    padding: 6px 14px;
  }

  .app-card strong {
    font-size: 0.95rem;
  }

  .app-icon {
    width: 32px;
    height: 32px;
  }

  .health-grid {
    gap: 7px;
    grid-template-rows: 45px repeat(2, minmax(0, 1fr));
  }

  .stat-card {
    gap: 6px;
    grid-template-columns: 40px minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    padding: 7px;
  }

  .stat-card:has(.sparkline) {
    grid-template-rows: minmax(0, 1fr) 12px;
  }

  .stat-card:not(:has(.gauge)) {
    grid-template-columns: 1fr;
    padding-left: 10px;
  }

  .panel-status {
    gap: 8px;
    padding: 6px 7px;
  }

  .status-item {
    gap: 6px;
  }

  .status-item strong {
    font-size: 0.62rem;
  }

  .status-item span span {
    font-size: 0.56rem;
  }

  .status-light {
    width: 10px;
    height: 10px;
  }

  .stat-label {
    font-size: 0.68rem;
  }

  .stat-value {
    font-size: 0.66rem;
  }

  .gauge {
    width: 38px;
    height: 38px;
    border-width: 1px;
  }

  .gauge span {
    font-size: 0.55rem;
  }

  .sparkline {
    height: 12px;
    gap: 1px;
    padding-top: 3px;
  }
}
.app-panel .panel-title {
  display: none;
}
