:root {
  color-scheme: light;
  --bg: #422006;
  --panel: #57310c;
  --coin: #fbbf24;
  --coin-edge: #b45309;
  --ink: #fef3c7;
  --accent: #34d399;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

#app {
  max-width: 460px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
  user-select: none;
  -webkit-user-select: none;
}

.topbar { display: flex; align-items: center; gap: 8px; padding: 2px 2px 6px; }
.title { font-weight: 800; font-size: 20px; }
.title small { font-weight: 500; font-size: 12px; color: #fcd34d; }
.spacer { flex: 1; }
.hud { font-size: 14px; background: rgba(0,0,0,.35); border-radius: 999px; padding: 4px 12px; white-space: nowrap; }
.hud .sep { color: #fbbf24; margin: 0 4px; }
.hud .opt { color: #fde68a; }

#status { font-size: 14px; color: #fde68a; min-height: 20px; margin: 0 2px 6px; }

#vault { text-align: center; position: relative; padding: 4px 0 2px; }
#coins { font-size: 34px; font-weight: 800; font-variant-numeric: tabular-nums; }
.coins-label { color: #fcd34d; font-size: 13px; margin-bottom: 6px; }

#coin {
  width: 148px;
  height: 148px;
  border-radius: 50%;
  border: 8px solid var(--coin-edge);
  background: radial-gradient(circle at 35% 30%, #fde68a, var(--coin) 60%, #d97706);
  color: #78350f;
  font-size: 84px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0,0,0,.5);
  transition: transform .06s;
  touch-action: manipulation;
}
#coin:active { transform: scale(.93); }
#coin.pop { animation: pop .18s ease-out; }
@keyframes pop {
  0% { transform: scale(.9); }
  60% { transform: scale(1.04); }
  100% { transform: scale(1); }
}

#floats { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.gain {
  position: absolute;
  left: 50%;
  font-weight: 800;
  font-size: 18px;
  color: #fef9c3;
  animation: rise 1s ease-out forwards;
}
@keyframes rise {
  0% { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; transform: translate(-50%, -90px); }
}

#shop { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--panel);
  border: 1px solid rgba(251,191,36,.35);
  border-radius: 12px;
  padding: 8px 10px;
  cursor: pointer;
  text-align: left;
  color: var(--ink);
  width: 100%;
  font: inherit;
}
.item:disabled { opacity: .45; cursor: default; }
.item .icon { font-size: 26px; }
.item .info { flex: 1; min-width: 0; }
.item .name { font-weight: 800; font-size: 15px; }
.item .desc { font-size: 12px; color: #fde68a; }
.item .meta { font-size: 13px; color: #fef3c7; white-space: nowrap; }
.item .owned {
  background: var(--accent);
  color: #064e3b;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  padding: 2px 8px;
}

#statusbar { margin-top: 10px; }
#statusbar .actions { display: flex; gap: 8px; justify-content: center; }
.btn {
  border: 1px solid rgba(255,255,255,.35);
  background: rgba(0,0,0,.3);
  color: #fff;
  border-radius: 10px;
  padding: 8px 16px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}
.btn.danger-arm { background: #b91c1c; border-color: #b91c1c; }

#toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: rgba(0,0,0,.85);
  color: #fff;
  border-radius: 999px;
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
  max-width: 92vw;
  text-align: center;
}
#toast.show { opacity: 1; }

html.touch #coin { width: 168px; height: 168px; }
html.touch .item { padding: 10px; }
html.touch .btn { padding-top: 10px; padding-bottom: 10px; }
