:root {
  --bg: #05060d;
  --glass: rgba(16, 18, 30, 0.5);
  --glass-strong: rgba(12, 14, 24, 0.86);
  --line: rgba(255, 255, 255, 0.12);
  --text: #f3f5ff;
  --muted: rgba(228, 234, 255, 0.62);
  --accent: #7cf2d0;
  --accent-2: #8ea8ff;
  --radius: 24px;
  --pad: clamp(16px, 2.4vw, 40px);
  --tap: 64px;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans', 'Helvetica Neue', sans-serif;
  font-variant-numeric: tabular-nums;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  overscroll-behavior: none;
}
body.idle {
  cursor: none;
}
button {
  font: inherit;
  color: inherit;
  touch-action: manipulation;
}
svg {
  display: block;
}

#stage {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
}
#layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
}
#dim {
  position: fixed;
  inset: 0;
  background: #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 4s ease;
  z-index: 50;
}
#fader {
  position: fixed;
  inset: 0;
  background: #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.38s ease;
  z-index: 40;
}
#fader.on {
  opacity: 1;
}

/* ---------- Szenenname ---------- */
#toast {
  position: fixed;
  left: 50%;
  top: 13vh;
  transform: translateX(-50%);
  text-align: center;
  pointer-events: none;
  opacity: 0;
  z-index: 30;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.6);
}
#toast b {
  display: block;
  font-size: clamp(30px, 4.4vw, 64px);
  font-weight: 250;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  padding-left: 0.32em;
}
#toast span {
  display: block;
  margin-top: 10px;
  font-size: clamp(14px, 1.4vw, 19px);
  color: var(--muted);
  letter-spacing: 0.04em;
}
#toast.show {
  animation: toast 3.6s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@keyframes toast {
  0% {
    opacity: 0;
    transform: translate(-50%, 14px);
    letter-spacing: 0.6em;
  }
  14%,
  70% {
    opacity: 1;
    transform: translate(-50%, 0);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -8px);
  }
}

/* ---------- Widgets ---------- */
#widgets {
  position: fixed;
  inset: 0;
  pointer-events: none;
  transition: transform 60s linear, opacity 0.6s ease;
  z-index: 10;
}
body.widgets-off #widgets {
  opacity: 0;
}
.slot {
  position: absolute;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 42vw;
}
.slot.tl {
  top: var(--pad);
  left: var(--pad);
}
.slot.tr {
  top: var(--pad);
  right: var(--pad);
  align-items: flex-end;
}
.slot.bl {
  bottom: var(--pad);
  left: var(--pad);
}
.slot.br {
  bottom: var(--pad);
  right: var(--pad);
  align-items: flex-end;
}
.w {
  background: var(--glass);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  backdrop-filter: blur(16px) saturate(150%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 22px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.32);
  animation: wIn 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.w[hidden] {
  display: none;
}
body.eco .w {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  background: rgba(10, 12, 22, 0.72);
}
@keyframes wIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
}
.w-sub {
  color: var(--muted);
  font-size: clamp(13px, 1.25vw, 17px);
  margin-top: 4px;
}
.w-time {
  display: flex;
  align-items: baseline;
  gap: 8px;
  line-height: 1;
}
.w-time b {
  font-size: clamp(44px, 5.6vw, 84px);
  font-weight: 250;
  letter-spacing: -0.02em;
}
.w-time small {
  font-size: clamp(18px, 1.9vw, 28px);
  color: var(--muted);
  font-weight: 300;
}
/* Auf der Uhr-Szene ist die Uhr schon riesig */
/* Offenes Dock schiebt die unteren Widgets nach oben */
.slot.bl,
.slot.br {
  transition: transform 0.45s cubic-bezier(0.2, 0.9, 0.2, 1);
}
body.dock-open .slot.bl,
body.dock-open .slot.br {
  transform: translateY(calc(-1 * clamp(96px, 8vw, 116px)));
}
body[data-scene='clock'] #toast {
  top: 3vh;
}
body[data-scene='clock'] .w-clock {
  display: none;
}

.w-wx {
  display: flex;
  align-items: center;
  gap: 14px;
}
.w-wx-icon .wi {
  width: clamp(56px, 6vw, 84px);
  height: clamp(56px, 6vw, 84px);
}
.w-wx-temp {
  font-size: clamp(36px, 4.2vw, 60px);
  font-weight: 250;
  line-height: 1;
}
.w-wx-desc {
  font-size: clamp(15px, 1.4vw, 19px);
  color: var(--text);
  opacity: 0.9;
}
.w-wx-meta {
  max-width: 30vw;
}
.w-sunarc {
  width: clamp(180px, 17vw, 260px);
  height: auto;
}
.w-sundot {
  filter: drop-shadow(0 0 6px #ffd34d);
  transition: cx 2s, cy 2s;
}
.w-sunrow {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  font-size: clamp(13px, 1.2vw, 16px);
  color: var(--muted);
}
.w-sunrow .w-left {
  color: var(--text);
}
.w-trip {
  display: flex;
  gap: clamp(16px, 2vw, 30px);
}
.w-trip > div {
  display: flex;
  flex-direction: column;
}
.w-lbl {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
}
.w-trip b {
  font-size: clamp(22px, 2.3vw, 34px);
  font-weight: 300;
}
.w-trip [hidden] {
  display: none !important;
}
.w-cal-h {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 8px;
  text-align: center;
}
.w-cal {
  display: grid;
  grid-template-columns: repeat(7, 2.2em);
  gap: 2px;
  text-align: center;
  font-size: clamp(13px, 1.15vw, 16px);
}
.w-cal i {
  font-style: normal;
  color: var(--muted);
  font-size: 0.8em;
}
.w-cal span {
  padding: 4px 0;
  border-radius: 999px;
}
.w-cal .today {
  background: var(--accent);
  color: #04120d;
  font-weight: 600;
  box-shadow: 0 0 16px rgba(124, 242, 208, 0.55);
}
.w-moon {
  display: flex;
  gap: 14px;
  align-items: center;
}
.w-moon canvas {
  width: 56px;
  height: 56px;
  filter: drop-shadow(0 0 10px rgba(220, 228, 255, 0.35));
}
.w-moon b {
  font-weight: 400;
  font-size: 18px;
}

/* ---------- Wetter-Icons ---------- */
.wi .wi-spin {
  transform-box: fill-box;
  transform-origin: center;
  animation: spin 24s linear infinite;
}
.wi .wi-float {
  animation: float 6s ease-in-out infinite;
}
.wi .wi-drop {
  animation: drop 1.1s linear infinite;
}
.wi .wi-snow {
  animation: snow 2.4s linear infinite;
}
.wi .wi-flash {
  animation: flash 3s steps(1) infinite;
}
.wi .wi-fog {
  animation: fog 4s ease-in-out infinite alternate;
}
.wi .wi-glow {
  filter: drop-shadow(0 0 4px rgba(220, 230, 255, 0.6));
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes float {
  50% {
    transform: translateX(2px);
  }
}
@keyframes drop {
  from {
    transform: translateY(-6px);
    opacity: 0;
  }
  30% {
    opacity: 1;
  }
  to {
    transform: translateY(8px);
    opacity: 0;
  }
}
@keyframes snow {
  from {
    transform: translate(0, -6px);
    opacity: 0;
  }
  30% {
    opacity: 1;
  }
  to {
    transform: translate(3px, 9px);
    opacity: 0;
  }
}
@keyframes flash {
  0%,
  60% {
    opacity: 1;
  }
  62%,
  66% {
    opacity: 0.2;
  }
  68% {
    opacity: 1;
  }
}
@keyframes fog {
  to {
    transform: translateX(6px);
  }
}

/* ---------- Dock ---------- */
#dock {
  position: fixed;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  transform: translate(-50%, calc(100% + 40px));
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: calc(100vw - 32px);
  padding: 10px;
  background: var(--glass-strong);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid var(--line);
  border-radius: 30px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  transition: transform 0.45s cubic-bezier(0.2, 0.9, 0.2, 1), opacity 0.45s;
  opacity: 0;
  z-index: 35;
}
#dock.show {
  transform: translate(-50%, 0);
  opacity: 1;
}
.dock-scenes {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  touch-action: pan-x;
  min-width: 0;
}
.dock-scenes::-webkit-scrollbar {
  display: none;
}
.dock-sep {
  width: 1px;
  align-self: stretch;
  margin: 8px 4px;
  background: var(--line);
  flex: none;
}
.dock-btn {
  flex: none;
  width: clamp(68px, 6.6vw, 88px);
  height: clamp(68px, 6.6vw, 84px);
  border: 0;
  border-radius: 20px;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--muted);
  transition: background 0.2s, color 0.2s, transform 0.15s;
}
.dock-btn svg {
  width: 28px;
  height: 28px;
}
.dock-btn span {
  font-size: 12px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.dock-btn:active {
  transform: scale(0.92);
  background: rgba(255, 255, 255, 0.1);
}
.dock-btn.active {
  color: #04120d;
  background: linear-gradient(140deg, var(--accent), var(--accent-2));
  box-shadow: 0 6px 24px rgba(124, 242, 208, 0.35);
}
.dock-btn.active-soft {
  color: var(--accent);
}
.dock-btn.off {
  opacity: 0.45;
}

/* ---------- Einstellungen ---------- */
#sheet {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(560px, 94vw);
  background: var(--glass-strong);
  -webkit-backdrop-filter: blur(26px) saturate(160%);
  backdrop-filter: blur(26px) saturate(160%);
  border-left: 1px solid var(--line);
  transform: translateX(105%);
  transition: transform 0.45s cubic-bezier(0.2, 0.9, 0.2, 1);
  z-index: 45;
  display: flex;
  flex-direction: column;
  box-shadow: -30px 0 80px rgba(0, 0, 0, 0.5);
}
#sheet.open {
  transform: none;
}
.sheet-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 18px 8px 28px;
}
.sheet-h h2 {
  margin: 0;
  font-weight: 300;
  font-size: 28px;
  letter-spacing: 0.02em;
}
.icon-btn {
  width: var(--tap);
  height: var(--tap);
  border-radius: 20px;
  border: 0;
  background: rgba(255, 255, 255, 0.08);
  display: grid;
  place-items: center;
}
.icon-btn svg {
  width: 28px;
  height: 28px;
}
.sheet-body {
  overflow-y: auto;
  touch-action: pan-y;
  overscroll-behavior: contain;
  padding: 0 24px 40px;
  flex: 1;
}
section {
  padding: 18px 0 8px;
  border-bottom: 1px solid var(--line);
}
section h3 {
  margin: 0 0 12px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--accent);
  font-weight: 600;
}
.hint {
  color: var(--muted);
  font-size: 14px;
  margin: 14px 0 8px;
}
.seg {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 18px;
  margin-bottom: 10px;
}
.seg button {
  flex: 1;
  min-height: 56px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  font-size: 16px;
  color: var(--muted);
}
.seg button.on {
  background: rgba(255, 255, 255, 0.16);
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}
.row {
  width: 100%;
  min-height: var(--tap);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 4px;
  border: 0;
  background: transparent;
  text-align: left;
}
.row b {
  font-weight: 400;
  font-size: 17px;
  display: block;
}
.row small {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}
.sw {
  flex: none;
  width: 60px;
  height: 36px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.16);
  position: relative;
  transition: background 0.25s;
}
.sw::after {
  content: '';
  position: absolute;
  top: 4px;
  left: 4px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.25s cubic-bezier(0.3, 0.9, 0.3, 1.2);
}
.toggle.on .sw {
  background: var(--accent);
}
.toggle.on .sw::after {
  transform: translateX(24px);
}
.chips {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.chips button {
  min-height: 72px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 13px;
}
.chips svg {
  width: 24px;
  height: 24px;
}
.chips button.on {
  color: var(--text);
  border-color: var(--accent);
  background: rgba(124, 242, 208, 0.12);
}
.slider input {
  flex: 1;
  max-width: 60%;
  height: 44px;
  accent-color: var(--accent);
  touch-action: pan-x;
}
.info span {
  display: flex;
  align-items: center;
  gap: 10px;
}
.info svg {
  width: 22px;
  height: 22px;
  color: var(--accent);
}
.btn {
  min-height: 52px;
  padding: 0 20px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.08);
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn svg {
  width: 22px;
  height: 22px;
}
.btn.big {
  min-height: 64px;
  width: 100%;
}
.btn-row {
  border-radius: 16px;
  padding: 10px 14px;
  margin: 6px 0;
  background: rgba(255, 255, 255, 0.05);
}
.btn-row.flash {
  background: rgba(124, 242, 208, 0.25);
}
.search {
  display: flex;
  gap: 8px;
  margin: 8px 0;
}
.search input {
  flex: 1;
  min-height: 56px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.3);
  color: var(--text);
  padding: 0 18px;
  font-size: 17px;
  user-select: text;
  -webkit-user-select: text;
}
.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.status {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 16px;
  font-size: 14px;
  margin: 16px 0 8px;
}
.status dt {
  color: var(--muted);
}
.status dd {
  margin: 0;
}
.foot {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  margin-top: 24px;
}

/* ---------- Großuhr ---------- */
.bigclock {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-shadow: 0 6px 60px rgba(0, 0, 0, 0.35);
}
.bc-time {
  font-size: clamp(120px, 24vw, 420px);
  font-weight: 200;
  line-height: 0.9;
  letter-spacing: -0.03em;
  display: flex;
}
.bc-time span {
  display: inline-block;
}
.bc-time .tick {
  animation: tick 0.7s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes tick {
  from {
    opacity: 0;
    transform: translateY(-0.12em);
    filter: blur(8px);
  }
}
.bc-colon {
  animation: colon 2s steps(1) infinite;
  margin: 0 0.02em;
  transform: translateY(-0.06em);
}
@keyframes colon {
  50% {
    opacity: 0.25;
  }
}
.bc-sec {
  width: min(56vw, 900px);
  height: 3px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
  margin: clamp(10px, 2vh, 24px) 0;
}
.bc-sec i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transform-origin: left;
  transform: scaleX(0);
}
.bc-date {
  font-size: clamp(20px, 2.6vw, 40px);
  font-weight: 300;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.85);
}
.bc-fc {
  display: flex;
  gap: clamp(8px, 1.4vw, 22px);
  margin-top: clamp(20px, 5vh, 56px);
}
.fc {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 64px;
  padding: 10px 6px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.fc span {
  font-size: 13px;
  color: var(--muted);
}
.fc .wi {
  width: 44px;
  height: 44px;
}
.fc b {
  font-weight: 400;
  font-size: 19px;
}
.fc em {
  font-style: normal;
  font-size: 12px;
  color: #7cc4ff;
  min-height: 1em;
}
body[data-scene='clock'] .slot.tr .w-weather {
  display: none;
}

/* ---------- Hyperraum-Anzeige ---------- */
.hud-speed {
  position: absolute;
  left: 50%;
  bottom: 14vh;
  transform: translateX(-50%);
  text-align: center;
  opacity: 0.75;
}
.hud-speed b {
  display: block;
  font-size: clamp(28px, 3vw, 44px);
  font-weight: 200;
}
.hud-speed span {
  font-size: 12px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Kleine Bildschirme / Hochformat */
@media (max-width: 760px) {
  .slot {
    max-width: 90vw;
  }
  .slot.tr .w-sun,
  .slot.br {
    display: none;
  }
  .w-wx-meta {
    max-width: 50vw;
  }
  .bc-fc .fc:nth-child(n + 6) {
    display: none;
  }
}
@media (max-height: 520px) {
  .bc-fc {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  #toast.show {
    animation-duration: 0.01s;
  }
}

/* ---------- Szenen-Knopf (z. B. Kamin-Ton) ---------- */
.scene-btn {
  position: absolute;
  right: var(--pad);
  bottom: calc(var(--pad) + 4px);
  pointer-events: auto;
  min-height: var(--tap);
  padding: 0 20px 0 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--glass-strong);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  z-index: 20;
  transition: transform 0.45s cubic-bezier(0.2, 0.9, 0.2, 1);
}
.scene-btn svg {
  width: 26px;
  height: 26px;
}
.scene-btn.pulse {
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse {
  50% {
    box-shadow: 0 0 0 8px rgba(255, 170, 80, 0.18);
    border-color: rgba(255, 180, 90, 0.6);
  }
}
body.dock-open .scene-btn {
  transform: translateY(calc(-1 * clamp(96px, 8vw, 116px)));
}
body[data-scene='fireplace'] .slot.br {
  bottom: calc(var(--pad) + 84px);
}

/* ---------- Tempo-Verlauf ---------- */
.w-speedchart {
  pointer-events: auto;
  width: clamp(300px, 28vw, 420px);
  padding: 12px 16px 12px;
}
.w-sc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}
.w-sc-range {
  display: flex;
  gap: 4px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  padding: 3px;
}
.w-sc-range button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  min-height: 40px;
  min-width: 58px;
  border-radius: 11px;
}
.w-sc-range button.on {
  background: rgba(255, 255, 255, 0.16);
  color: var(--text);
}
.w-sc-chart {
  display: block;
  width: 100%;
  height: clamp(80px, 9vw, 120px);
}
.w-sc-stats {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
}
.w-sc-stats div {
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.w-sc-stats b {
  font-weight: 300;
  font-size: clamp(18px, 1.8vw, 24px);
}
.w-sc-stats b::after {
  content: ' km/h';
  font-size: 11px;
  color: var(--muted);
}
.w-sc-stats [data-max] {
  color: #ffb199;
}

/* ---------- Statistik-Szene ---------- */
body[data-scene='stats'] #widgets {
  display: none;
}
body[data-scene='stats'] #toast {
  top: 40vh;
}
.stats {
  position: absolute;
  inset: 0;
  padding: clamp(14px, 2vw, 28px);
  display: grid;
  grid-template-columns: 1fr 1.45fr 1fr;
  grid-template-rows: auto 1.25fr 1fr 0.85fr;
  grid-template-areas:
    'head head head'
    'gauge hist hist'
    'gauge tiles dist'
    'wx wx wx';
  gap: clamp(10px, 1.2vw, 16px);
}
.st-head {
  grid-area: head;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.st-head h2 {
  margin: 0;
  font-weight: 250;
  font-size: clamp(22px, 2.4vw, 34px);
  letter-spacing: 0.04em;
}
.st-head p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 14px;
}
.st-range {
  pointer-events: auto;
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 18px;
  background: var(--glass-strong);
  border: 1px solid var(--line);
}
.st-range button {
  border: 0;
  background: transparent;
  color: var(--muted);
  min-height: 52px;
  min-width: 78px;
  border-radius: 14px;
  font-size: 15px;
}
.st-range button.on {
  background: linear-gradient(140deg, var(--accent), var(--accent-2));
  color: #04120d;
  font-weight: 600;
}
.st-card {
  position: relative;
  background: rgba(16, 18, 30, 0.55);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
  animation: stIn 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.st-card:nth-of-type(2) { animation-delay: 0.08s; }
.st-card:nth-of-type(3) { animation-delay: 0.16s; }
.st-card:nth-of-type(4) { animation-delay: 0.24s; }
.st-card:nth-of-type(5) { animation-delay: 0.32s; }
@keyframes stIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }
}
.st-card canvas {
  flex: 1;
  width: 100%;
  min-height: 0;
  display: block;
}
.st-cap {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}
.st-cap b {
  font-weight: 500;
  font-size: 15px;
}
.st-cap span {
  color: var(--muted);
  font-size: 12px;
}
.st-gauge { grid-area: gauge; }
.st-hist { grid-area: hist; }
.st-dist { grid-area: dist; }
.st-wx { grid-area: wx; }
.st-tiles {
  grid-area: tiles;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 10px;
}
.st-tile {
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.st-tile span {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}
.st-tile b {
  font-weight: 300;
  font-size: clamp(18px, 1.9vw, 28px);
}
.st-tile[data-tile='peak'] b {
  color: #ffb199;
}
.st-tile[data-tile='avg'] b {
  color: #ffe08a;
}
.st-wxicons {
  position: absolute;
  left: 16px;
  right: 16px;
  top: 38px;
  height: 0;
  pointer-events: none;
}
.st-wxicons span {
  position: absolute;
  transform: translate(-50%, 0);
  top: -6px;
}
.st-wxicons .wi {
  width: 26px;
  height: 26px;
  opacity: 0.9;
}
@media (max-width: 900px) {
  .stats {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto 1fr 1fr 1fr;
    grid-template-areas: 'head head' 'gauge hist' 'tiles dist' 'wx wx';
  }
}
