@import url("https://fonts.googleapis.com/css2?family=Press+Start+2P&family=Nunito:wght@700;800&display=swap");

:root {
  --bg: #1a1230;
  --panel: #2a1f4a;
  --panel2: #35285c;
  --ink: #f4eefc;
  --muted: #a898c8;
  --coin: #ffd84a;
  --coin-edge: #c49212;
  --pink: #ff6bcb;
  --teal: #3ee0c0;
  --blue: #5aa8ff;
  --grass: #4ecf70;
  --dirt: #6b4a2a;
  --pad: #3d3060;
  --pad-on: #5a4890;
  --shadow: #0c0818;
  --pixel: 4px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  min-height: 100%;
  background:
    radial-gradient(ellipse at 50% 0%, #3a2868 0%, var(--bg) 55%, #0e0a1a 100%);
  color: var(--ink);
  font-family: Nunito, system-ui, sans-serif;
  image-rendering: pixelated;
}

#app {
  max-width: 1180px;
  margin: 0 auto;
  padding: 16px 16px 40px;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding: 12px 14px;
  background: var(--panel);
  border: 4px solid #4a3a78;
  box-shadow: 0 6px 0 var(--shadow);
}
.brand { display: flex; gap: 12px; align-items: center; }
.logo {
  width: 48px; height: 48px;
  display: grid; place-items: center;
  background: linear-gradient(180deg, var(--pink), #b03080);
  border: 3px solid #fff3;
  font-size: 22px;
  box-shadow: 0 4px 0 #801050;
}
h1 {
  font-family: "Press Start 2P", monospace;
  font-size: 13px;
  line-height: 1.4;
  color: #fff;
  text-shadow: 2px 2px 0 #0008;
}
.tag { font-size: 12px; color: var(--muted); margin-top: 4px; }

.stats { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.coin-pill {
  display: flex; align-items: baseline; gap: 8px;
  background: #1a1230;
  border: 3px solid var(--coin-edge);
  padding: 8px 12px;
  min-width: 140px;
}
.coin-icon {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffe98a, var(--coin) 50%, var(--coin-edge));
  box-shadow: 0 0 0 2px #fff4 inset;
  color: transparent;
  display: inline-block;
}
#coins {
  font-family: "Press Start 2P", monospace;
  font-size: 14px;
  color: var(--coin);
}
.coin-pill small { color: var(--muted); font-size: 10px; letter-spacing: 0.08em; }

.bpm-pill {
  background: #1a1230;
  border: 3px solid #4a3a78;
  padding: 6px 10px;
  font-size: 12px;
  color: var(--muted);
}
.bpm-pill input { width: 100px; vertical-align: middle; accent-color: var(--teal); }

.btn {
  font-family: "Press Start 2P", monospace;
  font-size: 10px;
  border: none;
  padding: 12px 14px;
  cursor: pointer;
  color: #fff;
  background: #5a40c0;
  box-shadow: 0 4px 0 #2a1860;
  border: 3px solid #8a70ff;
  transition: transform 0.05s, box-shadow 0.05s;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #2a1860; }
.btn.play {
  background: linear-gradient(180deg, #4ee090, #1a9050);
  border-color: #8fffb0;
  box-shadow: 0 4px 0 #0a5030;
  color: #062018;
}
.btn.ghost {
  background: #3a2f60;
  border-color: #6a5a90;
  box-shadow: 0 4px 0 #1a1030;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 16px;
}
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
}

.island-wrap { position: relative; }
.island-sky {
  position: absolute; inset: 0 0 auto 0; height: 120px;
  background:
    radial-gradient(circle at 80% 30%, #ffe8a0 0 8px, transparent 9px),
    radial-gradient(circle at 20% 50%, #fff8 0 3px, transparent 4px),
    linear-gradient(180deg, #4a70d0 0%, #7ab0f0 40%, transparent 100%);
  border-radius: 8px 8px 0 0;
  pointer-events: none;
  opacity: 0.55;
  z-index: 0;
}
.island-panel {
  position: relative;
  z-index: 1;
  background: var(--panel);
  border: 4px solid #4a3a78;
  box-shadow: 0 8px 0 var(--shadow);
  padding: 14px;
}
.island-title {
  font-family: "Press Start 2P", monospace;
  font-size: 11px;
  margin-bottom: 12px;
  color: var(--teal);
}

.grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding: 14px;
  background:
    repeating-linear-gradient(90deg, #2d6b3a 0 8px, #348a44 8px 16px),
    #2d6b3a;
  border: 4px solid var(--dirt);
  box-shadow: inset 0 -12px 0 #245530, 0 6px 0 #4a3018;
  min-height: 320px;
}

.pad {
  aspect-ratio: 1;
  background: var(--pad);
  border: 4px solid #2a2040;
  box-shadow: inset 0 -6px 0 #221838, 0 3px 0 #1a1030;
  cursor: pointer;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  overflow: hidden;
  transition: background 0.08s, transform 0.08s;
}
.pad:hover { background: var(--pad-on); }
.pad.empty::after {
  content: "+";
  font-family: "Press Start 2P", monospace;
  font-size: 16px;
  color: #6a5a90;
}
.pad.filled { cursor: default; }
.pad.hit {
  background: #6a50b0;
  transform: scale(1.04);
  box-shadow: 0 0 0 3px var(--coin), inset 0 -6px 0 #221838;
}
.pad .sprite {
  width: 56px; height: 56px;
  image-rendering: pixelated;
}
.pad .mname {
  font-family: "Press Start 2P", monospace;
  font-size: 7px;
  color: #fff;
  text-align: center;
  text-shadow: 1px 1px 0 #000;
  max-width: 90%;
  line-height: 1.3;
}
.pad .remove {
  position: absolute;
  top: 4px; right: 4px;
  width: 18px; height: 18px;
  border: none;
  background: #c04060;
  color: #fff;
  font-size: 10px;
  cursor: pointer;
  font-family: monospace;
  line-height: 1;
  display: none;
}
.pad.filled:hover .remove { display: block; }

.hint {
  margin-top: 10px;
  font-size: 13px;
  color: var(--muted);
}
.hint strong { color: var(--coin); }

.transport {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.beat-lights {
  display: flex;
  gap: 6px;
  margin-left: auto;
}
.beat-lights span {
  width: 14px; height: 14px;
  background: #2a2040;
  border: 2px solid #4a3a78;
}
.beat-lights span.on {
  background: var(--coin);
  border-color: #fff8;
  box-shadow: 0 0 8px var(--coin);
}

.shop {
  background: var(--panel);
  border: 4px solid #4a3a78;
  box-shadow: 0 8px 0 var(--shadow);
  display: flex;
  flex-direction: column;
  max-height: 640px;
}
.shop-head {
  padding: 12px 14px;
  border-bottom: 3px solid #4a3a78;
  background: var(--panel2);
}
.shop-head h2 {
  font-family: "Press Start 2P", monospace;
  font-size: 11px;
  color: var(--pink);
}
.shop-head p { font-size: 12px; color: var(--muted); margin-top: 6px; }

.shop-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.shop-card {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px;
  background: #1e1638;
  border: 3px solid #3a2f60;
  cursor: pointer;
  text-align: left;
  color: inherit;
  font: inherit;
}
.shop-card:hover { border-color: var(--teal); }
.shop-card.selected { border-color: var(--pink); box-shadow: 0 0 0 2px #ff6bcb55; }
.shop-card.locked { opacity: 0.85; }
.shop-card canvas {
  width: 48px; height: 48px;
  image-rendering: pixelated;
  background: #120c22;
  border: 2px solid #2a2040;
}
.shop-card .info .name {
  font-family: "Press Start 2P", monospace;
  font-size: 8px;
  line-height: 1.4;
}
.shop-card .info .desc {
  font-size: 11px;
  color: var(--muted);
  margin-top: 3px;
}
.shop-card .price {
  font-family: "Press Start 2P", monospace;
  font-size: 8px;
  color: var(--coin);
  white-space: nowrap;
}
.shop-card .price.owned { color: var(--teal); }
.shop-card .buy-btn {
  grid-column: 1 / -1;
  font-family: "Press Start 2P", monospace;
  font-size: 8px;
  padding: 8px;
  border: 2px solid #8fffb0;
  background: #1a8050;
  color: #dff;
  cursor: pointer;
}
.shop-card .buy-btn:disabled {
  background: #403050;
  border-color: #605070;
  color: #888;
  cursor: not-allowed;
}

.owned {
  border-top: 3px solid #4a3a78;
  padding: 10px 14px;
  background: #1a1230;
}
.owned h3 {
  font-family: "Press Start 2P", monospace;
  font-size: 9px;
  color: var(--muted);
  margin-bottom: 6px;
}
.selected-info {
  font-size: 13px;
  color: var(--ink);
  min-height: 36px;
}

.foot {
  margin-top: 18px;
  text-align: center;
  font-size: 11px;
  color: #6a5a90;
}

/* floating +5 coins */
#float-coins {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  overflow: hidden;
}
.floater {
  position: absolute;
  font-family: "Press Start 2P", monospace;
  font-size: 12px;
  color: var(--coin);
  text-shadow: 2px 2px 0 #000;
  animation: floatUp 0.9s ease-out forwards;
}
@keyframes floatUp {
  0% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-48px) scale(1.2); }
}
