:root {
  color-scheme: dark;
  font-family: Arial, Helvetica, sans-serif;
  background: #05080a;
  color: #f0f4f4;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  min-height: 100vh;
  overflow-x: hidden;
  background:
    linear-gradient(rgba(5, 10, 12, 0.34), rgba(5, 10, 12, 0.58)),
    url('../images/backgrounds/background_image.png') center / cover fixed no-repeat;
}

.snowfall {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: url('../images/effects/snowfall.gif') center / cover no-repeat;
  opacity: 0.22;
  mix-blend-mode: screen;
}

.stats-container {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: clamp(72px, 13vh, 150px) 20px 100px;
}

.stats-panel {
  width: min(620px, 100%);
  padding: clamp(24px, 4vw, 38px);
  border: 1px solid rgba(0, 255, 255, 0.38);
  border-radius: 18px;
  background: rgba(4, 10, 12, 0.82);
  box-shadow: 0 0 28px rgba(0, 255, 255, 0.16);
  backdrop-filter: blur(7px);
}

.panel-header {
  text-align: center;
}

.eyebrow {
  margin: 0 0 6px;
  color: #8fdede;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

#page-title {
  margin: 0;
  font-size: clamp(1.8rem, 5vw, 2.7rem);
}

#player-name {
  min-height: 1.4em;
  margin: 10px 0 18px;
  color: #00ffff;
  font-size: clamp(1.2rem, 4vw, 1.7rem);
}

.status-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 44px;
  margin: 0 auto 20px;
  padding: 9px 12px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.34);
  text-align: center;
  font-size: 0.92rem;
}

.status-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #aaa;
  box-shadow: 0 0 9px currentColor;
}

.status-panel[data-state='connected'] {
  border-color: #00c878;
}
.status-panel[data-state='connected'] .status-dot {
  background: #00e48b;
}
.status-panel[data-state='loading'] .status-dot {
  background: #ffc857;
}
.status-panel[data-state='partial'] {
  border-color: #ffc857;
}
.status-panel[data-state='partial'] .status-dot {
  background: #ffc857;
}
.status-panel[data-state='invalid'],
.status-panel[data-state='unavailable'] {
  border-color: #ff5c6c;
}
.status-panel[data-state='invalid'] .status-dot,
.status-panel[data-state='unavailable'] .status-dot {
  background: #ff5c6c;
}

.retry-btn {
  flex: 0 0 auto;
  padding: 7px 11px;
  border: 1px solid #00ffff;
  border-radius: 7px;
  background: #073d42;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}
.retry-btn:hover,
.retry-btn:focus-visible {
  background: #0b646a;
}

.stat-grid {
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.25);
}

.stat-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.stat-row:last-child {
  border-bottom: 0;
}

.label {
  font-weight: 700;
}

.value {
  color: #d9ffff;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.last-updated {
  min-height: 1.2em;
  margin: 12px 0 0;
  color: #9baeb0;
  text-align: center;
  font-size: 0.78rem;
}

.button-section {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.btn {
  min-width: 170px;
  padding: 13px 22px;
  border: 1px solid #00ffff;
  border-radius: 8px;
  background: #07565b;
  box-shadow: 0 0 10px rgba(0, 255, 255, 0.34);
  color: #fff;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  transition: transform 0.18s ease, background 0.18s ease;
}
.btn-secondary {
  background: rgba(11, 35, 38, 0.88);
}
.btn:hover,
.btn:focus-visible {
  transform: translateY(-1px);
  background: #0d7377;
}

.audio-toggle {
  position: fixed;
  left: max(16px, env(safe-area-inset-left));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 5;
  width: 42px;
  height: 42px;
  border: 1px solid #00ffff;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  cursor: pointer;
  backdrop-filter: blur(3px);
}
.audio-toggle:hover,
.audio-toggle:focus-visible {
  box-shadow: 0 0 10px #00ffff;
}

@media (max-width: 640px) {
  body {
    background-attachment: scroll;
  }

  .stats-container {
    align-items: start;
    padding: 80px 12px 90px;
  }

  .stats-panel {
    padding: 22px 16px;
  }

  .status-panel {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .stat-row {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .value {
    text-align: left;
  }

  .button-section {
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .snowfall {
    display: none;
  }
  .btn {
    transition: none;
  }
}
