:root {
  /* Dark, cozy "space" UI with friendly pastel accents. */
  --ink: #070812;
  --panel: rgba(10, 12, 20, 0.78);
  --glow: rgba(122, 213, 163, 0.22);
  --accent: rgb(122, 213, 163);   /* mint */
  --accent-2: rgb(240, 211, 132); /* honey */
  --accent-3: rgb(248, 120, 96);  /* coral */
  --text: rgba(243, 245, 255, 0.94);
  --text-muted: rgba(243, 245, 255, 0.68);
  --stroke: rgba(255, 255, 255, 0.12);
  --stroke-strong: rgba(255, 255, 255, 0.18);
  --surface: rgba(8, 10, 18, 0.88);
  --surface-strong: rgba(8, 10, 18, 0.94);
  --shadow: 0 4px 11px rgba(0, 0, 0, 0.45);
  --shadow-button: 0 2px 5px rgba(0, 0, 0, 0.35);
  --shadow-button-pressed: 0 1px 3px rgba(0, 0, 0, 0.35);
  --shadow-strong: 0 11px 27px rgba(0, 0, 0, 0.55);
  --font-body: "Nunito", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  --font-title: "Fredoka", "Nunito", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(circle at 18% 10%, rgba(240, 211, 132, 0.22), transparent 56%),
    radial-gradient(circle at 82% 18%, rgba(248, 120, 96, 0.2), transparent 60%),
    radial-gradient(circle at 38% 88%, rgba(122, 213, 163, 0.18), transparent 62%),
    radial-gradient(circle at 60% 55%, rgba(255, 255, 255, 0.06), transparent 58%),
    linear-gradient(180deg, #0a0b14 0%, #070816 55%, #04040c 100%);
  font-family: var(--font-body);
  color: var(--text);
  overflow: hidden;
}

canvas {
  display: block;
}

body.gamepad-active {
  cursor: none;
}

#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

#startup {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(24px, 6vh, 64px) 20px 32px;
  gap: 22px;
  z-index: 40;
  background:
    radial-gradient(circle at 18% 10%, rgba(240, 211, 132, 0.22), transparent 56%),
    radial-gradient(circle at 82% 18%, rgba(248, 120, 96, 0.2), transparent 60%),
    radial-gradient(circle at 38% 88%, rgba(122, 213, 163, 0.18), transparent 62%),
    linear-gradient(180deg, rgba(10, 11, 20, 0.92) 0%, rgba(7, 8, 22, 0.94) 55%, rgba(4, 4, 12, 0.98) 100%);
  overflow: hidden;
  transition: opacity 0.4s ease, visibility 0s linear 0.4s;
  pointer-events: auto;
}

#startup::before {
  content: '';
  position: absolute;
  inset: -30%;
  background:
    radial-gradient(circle at 20% 20%, rgba(122, 213, 163, 0.12), transparent 55%),
    radial-gradient(circle at 80% 30%, rgba(240, 211, 132, 0.12), transparent 60%),
    radial-gradient(circle at 40% 80%, rgba(248, 120, 96, 0.1), transparent 65%),
    radial-gradient(circle at 60% 60%, rgba(255, 255, 255, 0.08), transparent 55%);
  opacity: 0.8;
  animation: startupDrift 18s linear infinite;
}

#startup.is-hidden {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

.startup-logo,
.startup-card {
  position: relative;
  z-index: 1;
}

.startup-logo {
  width: min(640px, 92vw);
  margin: 0 auto;
}

#startup-logo {
  width: 100%;
  height: auto;
}

.startup-card {
  width: min(520px, 92vw);
  background: rgba(8, 10, 18, 0.82);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow-strong), 0 0 24px rgba(122, 213, 163, 0.14);
  border-radius: 20px;
  padding: 24px 24px 20px;
  text-align: center;
}

.startup-connecting {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.connecting-sigil {
  position: relative;
  width: 120px;
  height: 120px;
}

.sigil-core {
  position: absolute;
  inset: 40px;
  border-radius: 50%;
  background: rgba(240, 211, 132, 0.95);
  box-shadow: 0 0 18px rgba(240, 211, 132, 0.5), 0 0 30px rgba(122, 213, 163, 0.22);
  animation: sigilPulse 1.8s ease-in-out infinite;
}

.sigil-orbit {
  position: absolute;
  inset: 12px;
  border-radius: 50%;
  border: 1px solid rgba(122, 213, 163, 0.55);
  box-shadow: inset 0 0 12px rgba(248, 120, 96, 0.16);
  animation: sigilSpin 5s linear infinite;
}

.sigil-orbit.orbit-two {
  inset: 24px;
  border-style: dashed;
  border-color: rgba(240, 211, 132, 0.65);
  animation-duration: 3.6s;
  animation-direction: reverse;
}

.startup-status-title {
  font-family: var(--font-title);
  font-size: 14px;
  letter-spacing: 0.4px;
  color: var(--text-muted);
}

.startup-status-subtitle {
  font-size: 20px;
  color: var(--text);
}

.startup-form {
  display: none;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

#startup.is-ready .startup-connecting {
  display: none;
}

#startup.is-ready .startup-form {
  display: flex;
}

.startup-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.startup-form #name-input {
  flex: 1;
  min-width: 180px;
  font-size: 20px;
  padding: 10px 12px;
  border-radius: 10px;
  border-color: rgba(122, 213, 163, 0.3);
  background: var(--surface-strong);
  color: var(--text);
}

.startup-form #name-save {
  min-width: 110px;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 20px;
  letter-spacing: 1px;
  border: 1px solid var(--stroke);
  background: linear-gradient(135deg, rgba(122, 213, 163, 0.95), rgba(240, 211, 132, 0.95));
  color: rgba(10, 11, 20, 0.92);
  box-shadow: 0 10px 22px rgba(30, 20, 50, 0.14);
}

.startup-form #name-save:active {
  transform: translateY(1px);
}

#startup-name-label {
  font-size: 18px;
  color: var(--text-muted);
}

.startup-hint {
  font-size: 16px;
  color: var(--text-muted);
}

.startup-links {
  margin-top: 10px;
}

.startup-link {
  font-size: 14px;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.startup-link:hover,
.startup-link:focus-visible {
  color: var(--accent-2);
  text-decoration: underline;
}

#status {
  position: static;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  color: var(--text);
}

#status .status-text {
  font-size: 18px;
  color: var(--text);
}

#status .status-hearts {
  display: inline-flex;
  flex-wrap: nowrap;
  gap: 3px;
  font-size: 18px;
  line-height: 1;
}

#status .heart {
  color: #e34d4d;
}

#status .heart.empty {
  color: rgba(227, 77, 77, 0.35);
}


#ui-top-controls {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
}

#audio-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  min-height: 40px;
  height: 40px;
  box-sizing: border-box;
}

#audio-controls .audio-btn {
  min-width: 28px;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#audio-controls .audio-icon {
  width: 20px;
  height: 20px;
}

#music-toggle.active,
#sfx-toggle.active {
  color: var(--accent-2);
  border-color: rgba(122, 213, 163, 0.42);
  box-shadow: 0 0 14px rgba(122, 213, 163, 0.18);
}

#fullscreen-toggle {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  width: 40px;
  height: 40px;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 0;
  color: var(--text);
  border: 1px solid var(--stroke);
  cursor: pointer;
  pointer-events: auto;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

#ui-scale-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  min-height: 40px;
  height: 40px;
  box-sizing: border-box;
}

#ui-scale-control #ui-scale-value {
  min-width: 44px;
  text-align: center;
  font-size: 14px;
  color: var(--text-muted);
}

.ui-scale-btn {
  min-width: 28px;
  min-height: 28px;
  padding: 2px 6px;
  font-size: 16px;
  line-height: 1;
}


#fullscreen-toggle.active {
  color: var(--accent-2);
  border-color: rgba(122, 213, 163, 0.55);
}

#fullscreen-toggle .fullscreen-icon {
  width: 20px;
  height: 20px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow), 0 0 18px var(--glow);
  backdrop-filter: blur(6px);
  border-radius: 16px;
  padding: 10px;
}

.ui-scale {
  transform: scale(var(--ui-scale, 1));
}

.origin-top-left {
  transform-origin: top left;
}

.origin-top-right {
  transform-origin: top right;
}

.origin-bottom-left {
  transform-origin: bottom left;
}

.origin-bottom-right {
  transform-origin: bottom right;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px;
  margin: -8px -8px 0 -8px;
  min-height: 44px;
  position: relative;
  cursor: pointer;
  font-size: 16px;
}

.panel.collapsed .panel-header {
  margin-bottom: 0;
}

.panel.collapsed {
  padding-bottom: 0;
}

.panel-controls {
  display: flex;
  gap: 6px;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: flex-end;
}

.panel-btn {
  border: none;
  background: none;
  color: var(--text);
  border-radius: 12px;
  cursor: pointer;
  pointer-events: auto;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.panel-btn:active {
  transform: translateY(1px);
}

.panel-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  width: 100%;
  height: 100%;
  padding: 0 8px;
  border: none;
  background: transparent;
  cursor: pointer;
}

.panel-toggle svg {
  width: 18px;
  height: 18px;
  transition: transform 0.15s ease;
}

.panel.collapsed .panel-toggle svg {
  transform: rotate(90deg);
}

.panel-body {
  /* CSS-driven expand/collapse: JS only toggles `.collapsed`. */
  max-height: var(--panel-body-max, 520px);
  overflow: hidden;
  opacity: 1;
  transform-origin: top;
  transform: translateY(0) scaleY(1);
  transition: max-height 220ms cubic-bezier(0.2, 0.9, 0.2, 1), opacity 160ms ease, transform 220ms cubic-bezier(0.2, 0.9, 0.2, 1);
  will-change: max-height, opacity, transform;
}

.panel.collapsed .panel-body {
  max-height: 0;
  opacity: 0;
  transform: translateY(-4px) scaleY(0.98);
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .panel-body {
    transition: none;
  }
}

#dialog {
  position: absolute;
  left: 20px;
  bottom: 150px;
  width: 320px;
  font-size: 20px;
  line-height: 1.2;
  pointer-events: auto;
}

#dialog-title {
  font-family: var(--font-title);
  font-size: 16px;
  margin-bottom: 6px;
  color: var(--accent-2);
}

#dialog-text {
  color: var(--text);
  white-space: pre-line;
}

#ui-left-stack {
  position: absolute;
  left: 20px;
  top: 20px;
  width: 220px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: auto;
}

#inventory,
#build-menu {
  width: 100%;
}

.panel-title {
  font-family: var(--font-title);
  font-size: 16px;
  letter-spacing: 0.2px;
  color: var(--accent-2);
  line-height: 1.1;
}

#inventory-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: clamp(140px, 30vh, 240px);
  overflow-y: auto;
}

.inventory-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 6px;
  border-radius: 6px;
  border: 1px solid transparent;
  color: var(--text);
}

.inventory-item .count {
  color: var(--text-muted);
}

.inventory-item.is-usable {
  background: rgba(122, 213, 163, 0.35);
  border-color: rgb(6, 8, 14);
  cursor: pointer;
  box-shadow: var(--shadow-button);
}

.inventory-item.is-usable:active {
  background: rgba(122, 213, 163, 0.5);
  transform: translateY(1px);
  box-shadow: var(--shadow-button-pressed);
}

#inventory-list .empty {
  color: var(--text-muted);
  font-size: 16px;
}

#build-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: clamp(140px, 32vh, 260px);
  overflow-y: auto;
}

.build-btn {
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(8, 10, 18, 0.74);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  text-align: left;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.build-btn.active {
  border-color: rgba(240, 211, 132, 0.42);
  color: var(--accent);
}

.build-btn:active {
  transform: translateY(1px);
}

#build-status {
  margin-top: 8px;
  font-size: 16px;
  color: var(--text-muted);
}

#chat {
  position: absolute;
  right: 20px;
  bottom: 20px;
  width: 320px;
  pointer-events: auto;
}

#chat-log {
  height: clamp(120px, 22vh, 160px);
  overflow-y: auto;
  overflow-x: hidden;
  font-size: 18px;
  color: var(--text);
  padding-right: 4px;
}

#chat-log .line {
  margin-bottom: 6px;
}

#chat-log .system {
  color: var(--accent-3);
}

.field-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

#name-input {
  flex: 1;
  border: 1px solid var(--stroke);
  background: var(--surface-strong);
  color: var(--text);
  padding: 6px 8px;
  font-family: var(--font-body);
  font-size: 16px;
  outline: none;
}

#name-save {
  border: 1px solid var(--stroke);
  background: linear-gradient(135deg, rgba(122, 213, 163, 0.95), rgba(240, 211, 132, 0.95));
  color: rgba(10, 11, 20, 0.92);
  font-family: var(--font-title);
  font-size: 16px;
  padding: 6px 10px;
  cursor: pointer;
  pointer-events: auto;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

#name-save:active {
  transform: translateY(1px);
}

#chat-input {
  width: 100%;
  border: 1px solid var(--stroke);
  background: var(--surface-strong);
  color: var(--text);
  padding: 8px 10px;
  font-family: var(--font-body);
  font-size: 16px;
  outline: none;
  border-radius: 10px;
}

.chat-input-wrap {
  position: relative;
}

.chat-input-wrap #chat-input {
  padding-right: 74px;
}

.chat-input-wrap .key-hint {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text);
  opacity: 0.7;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 6px;
  padding: 2px 6px;
  pointer-events: none;
}

#touch-controls {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: block;
}

.touch-surface {
  pointer-events: auto;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}

#touch-joystick {
  position: absolute;
  left: calc(16px + env(safe-area-inset-left));
  bottom: calc(16px + env(safe-area-inset-bottom));
  width: 140px;
  height: 140px;
  display: none;
}

#touch-joystick .stick-base {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(8, 10, 18, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55), inset 0 0 18px rgba(255, 255, 255, 0.06);
}

#touch-joystick .stick-handle {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: rgba(122, 213, 163, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
  transition: transform 0.12s ease-out;
}

#touch-joystick.is-active .stick-handle {
  background: rgba(240, 211, 132, 0.92);
  transition: none;
}

#touch-actions {
  position: absolute;
  left: calc(16px + env(safe-area-inset-left));
  bottom: calc(16px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: row;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.action-btn {
  min-width: 108px;
  height: 38px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(8, 10, 18, 0.74);
  color: var(--btn-fg, var(--text));
  /* Softer than pure white: tint labels toward each button's accent (fallback above). */
  color: color-mix(in srgb, var(--text) 52%, var(--btn-accent, var(--accent-3)) 48%);
  font-family: var(--font-title);
  font-size: 16px;
  letter-spacing: 0.2px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55), inset 0 0 12px rgba(255, 255, 255, 0.06);
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 8px;
  line-height: 1;
  padding: 0 12px;
}

.action-shortcut {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  opacity: 0.65;
  letter-spacing: 1px;
  text-transform: uppercase;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 6px;
  padding: 2px 6px;
  min-width: 28px;
}

.action-btn[data-action="attack"] {
  --btn-accent: var(--accent-3); /* coral */
  --btn-fg: #ffd2c8;
  border-color: var(--btn-accent);
  border-color: color-mix(in srgb, var(--btn-accent) 62%, transparent);
}

.action-btn[data-action="gather"] {
  --btn-accent: var(--accent); /* mint */
  --btn-fg: #c3fff1;
  border-color: var(--btn-accent);
  border-color: color-mix(in srgb, var(--btn-accent) 62%, transparent);
}

.action-btn[data-action="interact"] {
  --btn-accent: var(--accent-2); /* honey */
  --btn-fg: #ffe0be;
  border-color: var(--btn-accent);
  border-color: color-mix(in srgb, var(--btn-accent) 62%, transparent);
}

.action-btn.active {
  transform: translateY(2px);
  filter: brightness(1.12);
}

.action-btn.is-disabled {
  opacity: 0.45;
  filter: grayscale(0.2);
}

.hidden {
  display: none;
}

@media (max-width: 720px) {
  #startup {
    padding-top: calc(24px + env(safe-area-inset-top));
  }

  .startup-card {
    padding: 20px 18px 18px;
  }

  .startup-input-row {
    flex-direction: column;
  }

  .startup-form #name-save {
    width: 100%;
  }
}

@media (pointer: coarse) {
  #touch-joystick {
    display: block;
  }

  #touch-actions {
    left: auto;
    right: calc(16px + env(safe-area-inset-right));
  }

  .action-btn {
    height: 56px;
  }

  .action-shortcut {
    display: none;
  }

  .chat-input-wrap .key-hint {
    display: none;
  }

  #ui-top-controls {
    top: calc(12px + env(safe-area-inset-top));
    right: calc(12px + env(safe-area-inset-right));
  }

  #status {
    font-size: 18px;
    gap: 6px;
    flex-wrap: wrap;
  }

  #status .status-text {
    font-size: 16px;
  }

  #status .status-hearts {
    font-size: 16px;
    gap: 3px;
  }


  #touch-actions.origin-bottom-left {
    transform-origin: bottom right;
  }

  #chat {
    right: 12px;
    top: calc(68px + env(safe-area-inset-top));
    bottom: auto;
    width: min(320px, 68vw);
  }

  #chat.origin-bottom-right {
    transform-origin: top right;
  }

  #ui-left-stack {
    left: 12px;
    top: 12px;
    width: min(240px, 60vw);
  }

  #dialog {
    left: 12px;
    width: min(320px, 72vw);
    bottom: calc(180px + env(safe-area-inset-bottom));
  }
}

@media (pointer: coarse) and (max-width: 520px) {
  #touch-joystick {
    width: 120px;
    height: 120px;
  }

  #touch-actions {
    flex-direction: column;
    align-items: flex-end;
  }

  #touch-joystick .stick-handle {
    width: 50px;
    height: 50px;
  }

  #ui-top-controls {
    top: calc(12px + env(safe-area-inset-top));
    right: calc(12px + env(safe-area-inset-right));
  }

  .action-btn {
    min-width: 92px;
    height: 56px;
    font-size: 18px;
  }
}

@media (max-width: 760px) and (pointer: fine) {
  #touch-actions {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 700px) {
  .startup-status-subtitle {
    font-size: 18px;
  }
}

@media (max-width: 700px) and (pointer: fine) {
  #chat,
  #dialog {
    width: 260px;
  }

  #ui-left-stack {
    width: 200px;
  }
}

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

@keyframes sigilPulse {
  0%,
  100% {
    transform: scale(0.92);
    opacity: 0.75;
  }
  50% {
    transform: scale(1.05);
    opacity: 1;
  }
}

@keyframes startupDrift {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(-4%, 3%, 0) scale(1.05);
  }
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
}

html.stats-page,
body.stats-page {
  overflow-y: auto;
  min-height: 100vh;
  background-repeat: no-repeat;
}

.stats-shell {
  max-width: 1100px;
  margin: 0 auto;
  padding: clamp(24px, 6vh, 64px) 20px 72px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.stats-hero {
  display: flex;
  flex-direction: column;
  gap: 24px;
  align-items: stretch;
}

.stats-logo {
  width: min(420px, 88vw);
  margin: 0 auto;
  align-self: center;
}

.stats-logo svg {
  width: 100%;
  height: auto;
}

.stats-hero-card {
  padding: 24px 22px;
  text-align: center;
  width: 100%;
  margin: 0;
}

.stats-title {
  font-family: var(--font-title);
  font-size: 18px;
  letter-spacing: 0.3px;
  color: var(--text);
  margin-bottom: 10px;
}

.stats-subtitle {
  color: var(--text-muted);
  font-size: 20px;
  margin-bottom: 16px;
}

.stats-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.stats-meta-item {
  background: rgba(8, 10, 18, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 10px 12px;
}

.stats-meta-item .stats-label {
  display: block;
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.stats-meta-item .stats-value {
  font-size: 22px;
  color: var(--text);
}

.stats-status {
  margin-top: 12px;
  font-size: 14px;
  color: var(--text-muted);
}

.stats-status.is-error {
  color: #f0b0a8;
}

.stats-links {
  margin-top: 12px;
}

.stats-link {
  font-size: 14px;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.stats-link:hover,
.stats-link:focus-visible {
  color: var(--accent-2);
  text-decoration: underline;
}

.stats-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.stats-panel {
  padding: 18px;
}

.stats-panel-title {
  margin: 0 0 14px;
  font-family: var(--font-title);
  font-size: 14px;
  color: var(--text);
  letter-spacing: 0.2px;
  text-transform: uppercase;
}

.stats-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.stats-row:last-child {
  border-bottom: none;
}

.stats-label {
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-size: 12px;
}

.stats-value {
  font-size: 22px;
  color: var(--text);
}

.stats-value.small {
  font-size: 16px;
}

.stats-value.muted {
  color: var(--text-muted);
}

.stats-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stats-player {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(8, 10, 18, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.stats-player-name {
  font-size: 22px;
}

.stats-player-meta {
  color: var(--text-muted);
  font-size: 14px;
}

.stats-empty {
  color: var(--text-muted);
  text-align: center;
  padding: 16px 8px;
}

.stats-footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

@media (max-width: 720px) {
  .stats-hero-card {
    padding: 20px;
  }

  .stats-player {
    flex-direction: column;
    align-items: flex-start;
  }

  .stats-player-name {
    font-size: 20px;
  }

  .stats-row {
    align-items: center;
  }
}

/* Landing page */
html.landing-page,
body.landing-page {
  height: auto;
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
}

body.landing-page {
  display: block;
}

.landing-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(28px, 4vw, 48px);
  padding: clamp(28px, 6vw, 72px) clamp(20px, 5vw, 64px) 64px;
}

.landing-hero {
  max-width: 820px;
  text-align: center;
}

.landing-kicker {
  font-size: 12px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 12px;
}

.landing-title {
  font-family: var(--font-title);
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.1;
  margin: 0 0 12px;
  color: var(--text);
}

.landing-center {
  width: 100%;
  display: flex;
  justify-content: center;
}

body.landing-page #startup {
  position: static;
  inset: auto;
  padding: 0;
  background: none;
  width: min(640px, 92vw);
  height: auto;
  overflow: visible;
  pointer-events: auto;
}

body.landing-page #startup::before {
  display: none;
}

body.landing-page #startup.is-hidden {
  opacity: 1;
  visibility: visible;
}

.landing-reasons {
  width: min(980px, 100%);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
}

.landing-reason {
  background: var(--surface);
  border: 1px solid var(--stroke);
  border-radius: 16px;
  padding: 18px 20px;
  box-shadow: var(--shadow);
}

.landing-reason h2 {
  font-family: var(--font-title);
  font-size: 18px;
  margin: 0 0 8px;
}

.landing-reason p {
  margin: 0;
  color: var(--text-muted);
  font-size: 15px;
}

@media (max-width: 700px) {
  .landing-shell {
    padding-bottom: 48px;
  }

  body.landing-page #startup {
    width: min(520px, 92vw);
  }
}
