:root {
  --bg: #0b1020;
  --rail: #2a3348;
  --rail-line: #3d4a66;
  --player: #38bdf8;
  --obstacle: #f43f5e;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #fbbf24;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Georgia, "Times New Roman", serif;
  color: var(--text);
  background:
    radial-gradient(ellipse at 50% 0%, #1e293b, transparent 55%),
    linear-gradient(180deg, #0b1020, #111827);
}

.header {
  text-align: center;
  padding: 1.25rem 1rem 0.5rem;
}

.header h1 {
  margin: 0.3rem 0;
}

.header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.back {
  color: var(--muted);
  text-decoration: none;
  font-family: system-ui, sans-serif;
  font-size: 0.9rem;
}

.back:hover {
  color: var(--text);
}

.hud {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1.25rem 1.75rem;
  font-family: system-ui, sans-serif;
  margin: 0.75rem 0 0.5rem;
  font-size: 0.95rem;
}

.hud strong {
  color: var(--accent);
}

.stage {
  position: relative;
  width: min(360px, 92vw);
  margin: 0 auto;
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 14px;
  background: #151b2d;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 0.6rem;
  background: rgba(8, 12, 24, 0.72);
  border-radius: 14px;
  text-align: center;
  padding: 1rem;
}

.overlay.hidden {
  display: none;
}

.overlay p {
  margin: 0;
  font-family: system-ui, sans-serif;
}

#overlay-title {
  font-size: 1.4rem;
  font-weight: 700;
}

.hint {
  color: var(--muted);
  font-size: 0.9rem;
}

.overlay-actions {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

#start,
.secondary,
.skin-btn {
  border: none;
  border-radius: 8px;
  padding: 0.65rem 1.1rem;
  cursor: pointer;
  font-family: system-ui, sans-serif;
  font-weight: 600;
}

#start {
  background: var(--accent);
  color: #111;
}

.secondary {
  background: #334155;
  color: #fff;
}

#start:hover,
.secondary:hover,
.skin-btn:hover:not(:disabled) {
  filter: brightness(1.06);
}

.shop {
  max-width: 520px;
  margin: 1.5rem auto 0;
  padding: 0 1rem 1rem;
  text-align: center;
}

.shop h2 {
  margin: 0 0 0.35rem;
}

.shop-note {
  margin: 0 0 1rem;
  color: var(--muted);
  font-family: system-ui, sans-serif;
  font-size: 0.9rem;
}

.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
}

.skin-card {
  background: #1e293b;
  border-radius: 12px;
  padding: 0.9rem 0.7rem;
  border: 2px solid transparent;
}

.skin-card.equipped {
  border-color: var(--accent);
}

.skin-preview {
  width: 48px;
  height: 64px;
  margin: 0 auto 0.55rem;
  position: relative;
}

.skin-preview .body {
  position: absolute;
  left: 6px;
  right: 6px;
  top: 18px;
  bottom: 4px;
  border-radius: 8px;
}

.skin-preview .head {
  position: absolute;
  left: 50%;
  top: 4px;
  width: 22px;
  height: 22px;
  margin-left: -11px;
  border-radius: 50%;
}

.skin-card h3 {
  margin: 0 0 0.25rem;
  font-size: 1rem;
}

.skin-card .price {
  margin: 0 0 0.55rem;
  font-family: system-ui, sans-serif;
  font-size: 0.85rem;
  color: var(--muted);
}

.skin-btn {
  width: 100%;
  background: #38bdf8;
  color: #0f172a;
}

.skin-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.skin-btn.owned {
  background: #64748b;
  color: #fff;
}

.skin-btn.equipped-btn {
  background: var(--accent);
}

.controls {
  text-align: center;
  color: var(--muted);
  font-family: system-ui, sans-serif;
  font-size: 0.85rem;
  padding: 0.9rem 1rem 2rem;
}
