/* ===== Base ===== */
:root{
  --glass-bg: rgba(255,255,255,.18);
  --glass-stroke: rgba(255,255,255,.28);
  --panel: rgba(17,17,17,.5);
  --panel-stroke: rgba(51,51,51,.5);
  --muted: #cbd5e1;
  --danger: #ff6b6b;
  --accent: #ffd166;
  --ok: #4ade80;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }

body {
  background: radial-gradient(1200px 800px at 70% -10%, #2b2b2b, #181818) fixed;
  color: white;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  text-align: center;
  margin: 0;
  padding: 10px;
}

/* ===== Top Bar ===== */
#topBar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--panel);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid var(--panel-stroke);
    border-radius: 16px;
    margin: 8px auto 12px;
    max-width: 1100px;
    gap: 12px;
}
#topBar h2 { margin: 0; font-size: 22px; letter-spacing: .3px; }
#topBar .sub { color: var(--muted); font-size: 12px; }
#topBar .hud { display:flex; gap:14px; align-items:center; flex-wrap: wrap; }
#topBar .hud span { background: rgba(255,255,255,.06); padding:6px 10px; border-radius:10px; border:1px solid rgba(255,255,255,.09); }

/* Power-up badge */
.badge{
  display:inline-block;
  padding:6px 10px;
  border-radius:12px;
  background: var(--glass-bg);
  border:1px solid var(--glass-stroke);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color:white;
  font-weight:600;
  box-shadow: 0 8px 30px rgba(0,0,0,.15) inset, 0 1px 0 rgba(255,255,255,.12);
}
.badge.hidden{ display:none; }
.badge .badge-progress{
  margin-top:6px; height:6px; width:140px; border-radius:999px;
  background: rgba(255,255,255,.12); overflow:hidden;
  border:1px solid rgba(255,255,255,.15);
}
#powerupProgress{
  height:100%; width:100%;
  background: linear-gradient(90deg, var(--ok), #22d3ee);
  transform-origin:left center;
}

/* ===== Canvas ===== */
canvas {
  background: linear-gradient(180deg, #5e86a7 0%, #8b7272 100%);
  display: block;
  margin: 0 auto;
  max-width: 100%;
  height: auto;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
  border: 1px solid rgba(255,255,255,.07);
}

/* ===== Buttons (Glassmorphism) ===== */
button {
  padding: 10px 18px;
  font-size: 1rem;
  margin: 6px;
  cursor: pointer;
  border: 1px solid var(--glass-stroke);
  border-radius: 12px;
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: white;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .2);
  transition: transform .15s ease, background .3s ease, box-shadow .3s ease, opacity .2s ease;
}
button:hover { background: rgba(255,255,255,.32); transform: translateY(-1px); box-shadow:0 8px 18px rgba(0,0,0,.25); }
button:active { transform: translateY(0); }

/* Controls row */
#controlsRow{
  max-width:1100px;
  margin: 10px auto 0;
  display:flex; align-items:center; justify-content:center; gap:18px; flex-wrap:wrap;
}
.actions{ display:flex; align-items:center; gap:8px; }

/* ===== D-Pad ===== */
#mobile-controls {
  width: 140px; height: 140px; position: relative; user-select: none; touch-action: none;
  border-radius: 50%;
  background: rgba(51, 51, 51, 0.5);
  border: 3px solid rgba(102, 102, 102, 0.5);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.arrow {
  position: absolute; width: 40px; height: 40px;
  background: rgba(68, 68, 68, 0.5);
  color: white;
  border: 2px solid rgba(102, 102, 102, 0.5);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  transition: background 0.2s ease, transform .08s ease;
  box-shadow: 0 4px 10px rgba(0,0,0,.25) inset;
}
.arrow:hover { background: rgba(68, 68, 68, 0.7); }
.arrow:active { transform: scale(.96); }
#upBtn { top: 5px; left: 50px; }
#downBtn { bottom: 5px; left: 50px; }
#leftBtn { left: 5px; top: 50px; }
#rightBtn { right: 5px; top: 50px; }

/* ===== Overlay ===== */
#overlay{
  position: fixed; inset: 0; display:flex; align-items:center; justify-content:center;
  background: rgba(0,0,0,.35);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 50;
}
#overlay.hidden{ display:none; }
.overlay-card{
  min-width: 280px; max-width: 90vw;
  background: rgba(255,255,255,.12);
  border:1px solid rgba(255,255,255,.25);
  border-radius: 18px; padding: 18px 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
.overlay-actions{ margin-top:10px; }

/* ===== Footer Stars ===== */
footer { margin: 16px 0 20px; }
.rate { display:flex; gap:8px; justify-content:center; }
.star {
  font-size: 32px; cursor: pointer; color: gray;
  transition: transform 0.15s, color .3s;
  filter: drop-shadow(0 1px 0 rgba(0,0,0,.35));
}
.star.selected { color: gold; text-shadow: 0 0 8px rgba(255,215,0,.35); }
.star:hover { transform: scale(1.15) rotate(-2deg); }

/* ===== Utility ===== */
.hidden{ display:none !important; }
.dimmed{ filter: blur(2px) brightness(.85) saturate(.9); }
