:root {
  --bg-1: #0d1321;
  --bg-2: #1a2942;
  --panel: rgba(20, 30, 46, 0.88);
  --panel-alt: rgba(15, 25, 38, 0.9);
  --text: #eef6ff;
  --muted: #bfd5ef;
  --accent: #7ee7bf;
  --accent-2: #ffd166;
  --danger: #ff6b6b;
  --warning: #ff9f1c;
  --shadow: rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--bg-1), var(--bg-2));
  color: var(--text);
  font-family: "Segoe UI", Tahoma, sans-serif;
}

.app {
  width: min(960px, calc(100vw - 32px));
  background: rgba(10, 15, 25, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  box-shadow: 0 26px 50px var(--shadow);
  padding: 18px 18px 12px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.label {
  margin: 0 0 4px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 11px;
  color: var(--muted);
}

.player-name {
  margin: 0 0 4px;
  color: var(--accent-2);
  font-size: 0.88rem;
  font-weight: 700;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 2.5rem);
}

.start-btn {
  border: none;
  background: linear-gradient(135deg, var(--accent), #5fd4b8);
  color: #072015;
  font-weight: 800;
  padding: 12px 20px;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 10px 26px rgba(126, 231, 191, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.start-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(126, 231, 191, 0.42);
}

.hud {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.stat-card {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stat-label {
  color: var(--muted);
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stat-card strong {
  font-size: clamp(1.1rem, 2vw, 1.7rem);
}

.game-shell {
  background: linear-gradient(180deg, rgba(7, 18, 33, 0.9), rgba(16, 27, 40, 0.95));
  border-radius: 16px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
  background: linear-gradient(180deg, #0f2239, #0f1f2b 52%, #142838 100%);
}

.footer-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.98rem;
}

.status-text {
  margin: 0;
  color: var(--accent-2);
  font-weight: 700;
}

.ranking-status {
  min-height: 1.2em;
  margin: 0;
  color: var(--accent);
  font-weight: 700;
}

@media (max-width: 640px) {
  .topbar,
  .footer-bar {
    flex-direction: column;
    align-items: flex-start;
  }

  .hud {
    grid-template-columns: 1fr;
  }
}
