:root {
  --brass: #c9a24a;
  --brass-hi: #f1d27a;
  --brass-lo: #7a5f1f;
  --copper: #b87333;
  --copper-hi: #e6a35b;
  --iron: #3a332a;
  --iron-dark: #1c1813;
  --paper: #f0dfb4;
  --rivet: #8b6a2a;
  --steam: rgba(240, 223, 180, 0.6);
  --danger: #c24a2a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background:
    radial-gradient(ellipse at top, #2a2218 0%, #120d08 60%, #000 100%);
  color: var(--paper);
  font-family: "Georgia", "Times New Roman", serif;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  -webkit-user-select: none;
  overflow: hidden;
}

#frame {
  position: relative;
  width: 100%;
  max-width: 660px;
  padding: 18px;
  background:
    linear-gradient(145deg, #2b2218, #0f0a06);
  border: 6px solid var(--brass-lo);
  border-radius: 14px;
  box-shadow:
    0 0 0 2px var(--iron-dark),
    0 0 40px rgba(0,0,0,0.8),
    inset 0 0 30px rgba(0,0,0,0.6);
}

@media (max-width: 520px) {
  #frame {
    padding: 8px;
    border-width: 3px;
    border-radius: 8px;
  }
  #hud {
    padding: 6px 8px;
    gap: 4px;
  }
  .hud-item .label { font-size: 9px; }
  .hud-item span:last-child { font-size: 16px; }
  .panel h1 { font-size: 28px; letter-spacing: 3px; }
}

@media (hover: none) and (pointer: coarse) {
  .controls::after {
    content: " · swipe to hop";
  }
}

#frame::before,
#frame::after {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, var(--brass-hi), var(--brass) 50%, var(--brass-lo) 100%);
  box-shadow: inset 0 0 4px rgba(0,0,0,0.8), 0 0 4px rgba(0,0,0,0.6);
}
#frame::before { top: 6px; left: 6px; }
#frame::after  { top: 6px; right: 6px; }

#hud {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  padding: 10px 14px;
  margin-bottom: 10px;
  background:
    repeating-linear-gradient(45deg, #1a130b 0 6px, #241a0f 6px 12px);
  border: 2px solid var(--brass-lo);
  border-radius: 8px;
  box-shadow: inset 0 0 10px rgba(0,0,0,0.8);
}

.hud-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-variant: small-caps;
  letter-spacing: 1px;
}

.hud-item .label {
  font-size: 11px;
  color: var(--copper-hi);
  text-shadow: 0 1px 0 #000;
}

.hud-item span:last-child {
  font-family: "Courier New", monospace;
  font-size: 20px;
  color: var(--brass-hi);
  text-shadow: 0 0 6px rgba(241, 210, 122, 0.6);
}

#game {
  display: block;
  width: 100%;
  height: auto;
  max-width: 624px;
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  border: 4px solid var(--brass-lo);
  border-radius: 6px;
  background: #0a0806;
  image-rendering: pixelated;
  touch-action: none;
  -webkit-touch-callout: none;
  box-shadow:
    inset 0 0 24px rgba(0,0,0,0.9),
    0 0 14px rgba(0,0,0,0.6);
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(10, 6, 3, 0.82);
  backdrop-filter: blur(2px);
  border-radius: 14px;
  z-index: 10;
}

.overlay.hidden { display: none; }

.panel {
  width: 80%;
  max-width: 440px;
  padding: 28px 26px;
  text-align: center;
  background:
    linear-gradient(160deg, #3a2d18, #1a120a);
  border: 3px solid var(--brass);
  border-radius: 10px;
  box-shadow:
    0 0 0 2px var(--iron-dark),
    inset 0 0 20px rgba(0,0,0,0.7),
    0 8px 40px rgba(0,0,0,0.7);
  position: relative;
}

.panel::before,
.panel::after {
  content: "";
  position: absolute;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, var(--brass-hi), var(--brass-lo));
}
.panel::before { top: 6px; left: 6px; }
.panel::after  { bottom: 6px; right: 6px; }

.panel h1 {
  margin: 0 0 4px;
  font-size: 40px;
  letter-spacing: 6px;
  color: var(--brass-hi);
  text-shadow:
    0 0 2px var(--brass-lo),
    0 2px 0 #000,
    0 0 20px rgba(241, 210, 122, 0.4);
  font-variant: small-caps;
}

.panel .subtitle {
  margin: 0 0 18px;
  color: var(--copper-hi);
  font-style: italic;
  letter-spacing: 1px;
}

.score-block {
  margin: 14px auto;
  padding: 10px 12px;
  display: inline-block;
  text-align: left;
  font-family: "Courier New", monospace;
  background: rgba(0,0,0,0.4);
  border: 1px dashed var(--brass-lo);
  border-radius: 6px;
  color: var(--brass-hi);
}

.score-block div { margin: 2px 0; }

button {
  margin: 8px 6px 4px;
  padding: 10px 22px;
  font-family: inherit;
  font-variant: small-caps;
  letter-spacing: 2px;
  font-size: 16px;
  color: #1a120a;
  background: linear-gradient(180deg, var(--brass-hi) 0%, var(--brass) 55%, var(--brass-lo) 100%);
  border: 2px solid var(--iron-dark);
  border-radius: 6px;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.4),
    inset 0 -2px 0 rgba(0,0,0,0.3),
    0 2px 0 #000;
  cursor: pointer;
  transition: transform 0.06s ease, box-shadow 0.06s ease;
}

button:hover { filter: brightness(1.08); }

button:active {
  transform: translateY(2px);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.2),
    inset 0 2px 4px rgba(0,0,0,0.5);
}

.controls {
  margin: 14px 0 4px;
  font-size: 12px;
  color: var(--copper-hi);
  letter-spacing: 1px;
}

.flavor {
  margin: 6px 0 0;
  font-size: 12px;
  font-style: italic;
  color: #a89068;
  line-height: 1.4;
}
