@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=Rubik:wght@400;500;700&display=swap');

:root {
  --bg-panel: #0b0b1e;
  --accent: #00e5ff;
  --danger: #ff4d4d;
  --gold: #ffd400;
  --text: #e8e8ff;
  --text-dim: #8888aa;
  font-size: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: radial-gradient(circle at 50% 0%, #10102a 0%, #050510 60%, #020208 100%);
  color: var(--text);
  font-family: 'Rubik', system-ui, sans-serif;
  min-height: 100%;
  overflow-x: hidden;
}

.wrap {
  max-width: 560px;
  margin: 0 auto;
  padding: 16px 12px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.topbar {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  position: relative;
}

.backlink {
  align-self: flex-start;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 500;
  transition: color 0.15s ease;
}
.backlink:hover { color: var(--accent); }

.logo {
  font-family: 'Press Start 2P', monospace;
  font-size: 1.25rem;
  letter-spacing: 1px;
  color: var(--danger);
  text-shadow: 0 0 12px rgba(255, 77, 77, 0.5);
  margin: 6px 0 0;
  text-align: center;
}
.logo span { color: var(--accent); text-shadow: 0 0 12px rgba(0, 229, 255, 0.5); }

.stats {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  background: var(--bg-panel);
  border: 1px solid #1c1c3d;
  border-radius: 10px;
  padding: 10px 8px;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.stat .label {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
}

.stat .value {
  font-family: 'Press Start 2P', monospace;
  font-size: 0.85rem;
  color: var(--text);
}

#wins { color: var(--gold); }
#beststreak { color: var(--accent); }

.stage {
  position: relative;
  width: 100%;
  aspect-ratio: 480 / 400;
  display: flex;
  justify-content: center;
  border-radius: 12px;
  overflow: hidden;
  background: #050510;
  box-shadow: 0 0 0 1px #1c1c3d, 0 20px 60px -20px rgba(255, 77, 77, 0.25);
}

#phaserParent {
  width: 100%;
  height: 100%;
}
#phaserParent canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

.fighthud {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: none;
  z-index: 2;
}

.hpblock {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
}
.hpblock-right { flex-direction: row-reverse; }

.hplabel {
  font-family: 'Press Start 2P', monospace;
  font-size: 0.55rem;
  color: var(--text-dim);
  text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}

.hpbar {
  flex: 1;
  height: 12px;
  border-radius: 6px;
  background: rgba(10, 10, 26, 0.75);
  border: 1px solid rgba(255,255,255,0.15);
  overflow: hidden;
}

.hpfill {
  height: 100%;
  width: 100%;
  transition: width 0.25s ease;
}
.hpfill-player { background: linear-gradient(90deg, #00e5ff, #38ffb0); }
.hpfill-foe {
  background: linear-gradient(90deg, #ff8a2b, #ff2b2b);
  margin-left: auto;
}

.timerblock {
  font-family: 'Press Start 2P', monospace;
  font-size: 0.85rem;
  color: var(--gold);
  text-shadow: 0 0 8px rgba(255, 212, 0, 0.6);
  min-width: 42px;
  text-align: center;
}

.overlay {
  position: absolute;
  inset: 0;
  background: rgba(2, 2, 10, 0.86);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
  z-index: 3;
}
.overlay.hidden { display: none; }
.overlay-panel { max-width: 380px; }
.overlay-panel h2 {
  font-family: 'Press Start 2P', monospace;
  font-size: 1rem;
  color: var(--danger);
  margin: 0 0 14px;
  text-shadow: 0 0 10px rgba(255, 77, 77, 0.5);
}
.overlay-panel p {
  color: var(--text-dim);
  font-size: 0.9rem;
  line-height: 1.5;
  margin: 0 0 20px;
}

.btn {
  font-family: 'Rubik', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 10px 22px;
  border-radius: 8px;
  border: 1px solid #2c2c5c;
  background: #14142e;
  color: var(--text);
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.btn:hover:not(:disabled) { background: #1c1c44; box-shadow: 0 0 14px rgba(0, 229, 255, 0.25); }
.btn:active:not(:disabled) { transform: scale(0.96); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary { background: var(--danger); color: #1a0505; border-color: var(--danger); }
.btn-primary:hover:not(:disabled) { background: #ff7a7a; box-shadow: 0 0 18px rgba(255, 77, 77, 0.55); }

.btn-danger { border-color: #5c2020; }
.btn-danger:hover:not(:disabled) { background: #2e1414; box-shadow: 0 0 14px rgba(255, 77, 77, 0.3); }

.btn-mute[aria-pressed="true"] { color: var(--text-dim); border-color: #2c2c5c; background: #0e0e22; }

.controls {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.buttons { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

.pad {
  display: none;
  width: 100%;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.pbtn {
  background: #14142e;
  border: 1px solid #2c2c5c;
  border-radius: 10px;
  color: var(--accent);
  font-family: 'Rubik', sans-serif;
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.5px;
  padding: 14px 0;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
}
.pbtn:active { background: #24244c; transform: scale(0.96); }
.upperbtn { color: var(--gold); grid-column: span 2; }

@media (pointer: coarse) {
  .pad { display: grid; }
}

.hint {
  font-size: 0.78rem;
  color: var(--text-dim);
  text-align: center;
  margin: 0;
}
.credit {
  font-size: 0.7rem;
  color: #55557a;
  text-align: center;
  margin: 0;
}

@media (max-width: 400px) {
  .logo { font-size: 1rem; }
  .stat .value { font-size: 0.7rem; }
  .overlay-panel h2 { font-size: 0.85rem; }
}
