/* ============================================================
   BEAT NEMI — STYLE
   Tema: dark romantic arcade (plum gelap + pink neon)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Baloo+2:wght@700;800&family=Fredoka:wght@400;500;600;700&display=swap');

:root {
  --pink: #ff2e88;
  --pink-soft: #ff7ab8;
  --pink-glow: rgba(255, 46, 136, 0.55);
  --gold: #ffd166;
  --cream: #fff4fa;
  --ink: #3b0a2a;
  --card: rgba(255, 255, 255, 0.07);
  --card-border: rgba(255, 255, 255, 0.14);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: #1d0626;
  font-family: "Fredoka", sans-serif;
  color: var(--cream);
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#game {
  position: fixed;
  inset: 0;
  display: block;
  touch-action: none;
  cursor: none;
}

.hidden { display: none !important; }

/* ================= HUD ================= */

#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 14px;
  padding-top: max(14px, env(safe-area-inset-top));
  padding-bottom: max(14px, env(safe-area-inset-bottom));
}

.card {
  background: var(--card);
  border: 1.5px solid var(--card-border);
  border-radius: 18px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* ---- top bar ---- */

.topbar {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.hp-card {
  flex: 1;
  max-width: 460px;
  padding: 10px 14px;
  pointer-events: none;
}

.hp-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
}

#phase-label {
  color: var(--gold);
  font-size: 12.5px;
}

.hp-track {
  position: relative;
  height: 24px;
  background: rgba(0, 0, 0, 0.45);
  border-radius: 999px;
  overflow: hidden;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.5);
}

#hp-fill {
  height: 100%;
  width: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #26d367, #7bff9e, #26d367);
  background-size: 200% 100%;
  animation: hpShimmer 2.5s linear infinite;
  transition: width 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 0 12px rgba(38, 211, 103, 0.5);
}

#hp-fill.hp-mid {
  background: linear-gradient(90deg, #ffb020, #ffe08a, #ffb020);
  background-size: 200% 100%;
  box-shadow: 0 0 12px rgba(255, 209, 102, 0.5);
}

#hp-fill.hp-low {
  background: linear-gradient(90deg, #ff3860, #ff5e3a, #ff3860);
  background-size: 200% 100%;
  animation: hpShimmer 0.8s linear infinite;
  box-shadow: 0 0 12px rgba(255, 56, 96, 0.55);
}

@keyframes hpShimmer {
  from { background-position: 0% 0; }
  to   { background-position: 200% 0; }
}

#hp-num {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12.5px;
  font-weight: 700;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.top-right {
  margin-left: auto;
  display: flex;
  gap: 8px;
  align-items: center;
}

.combo-card {
  padding: 6px 14px;
  text-align: center;
  border-color: rgba(255, 209, 102, 0.5);
}

#combo-num {
  display: block;
  font-family: "Baloo 2", sans-serif;
  font-size: 26px;
  font-weight: 800;
  color: var(--gold);
  line-height: 1;
  text-shadow: 0 0 14px rgba(255, 209, 102, 0.6);
}

.combo-word { font-size: 10.5px; font-weight: 700; letter-spacing: 1px; }

.combo-card.pop { animation: comboPop 0.22s cubic-bezier(0.34, 1.56, 0.64, 1); }

@keyframes comboPop {
  0% { transform: scale(1.25) rotate(-3deg); }
  100% { transform: scale(1) rotate(0); }
}

.icon-btn {
  pointer-events: auto;
  width: 44px;
  height: 44px;
  border: 1.5px solid var(--card-border);
  border-radius: 14px;
  background: var(--card);
  backdrop-filter: blur(10px);
  font-size: 20px;
  cursor: pointer;
  transition: transform 0.12s, background 0.12s;
}

.icon-btn:hover { background: rgba(255, 255, 255, 0.14); transform: translateY(-2px); }
.icon-btn:active { transform: translateY(1px); }

/* ---- bottom bar ---- */

.bottombar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.ult-btn {
  pointer-events: auto;
  position: relative;
  overflow: hidden;
  min-width: 240px;
  padding: 11px 26px;
  border: 2px solid rgba(255, 179, 236, 0.35);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
  color: var(--cream);
  font-family: "Baloo 2", sans-serif;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 1px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.ult-btn:disabled { cursor: default; opacity: 0.85; }

#ult-fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 0%;
  background: linear-gradient(90deg, rgba(255, 46, 136, 0.55), rgba(255, 138, 216, 0.75));
  transition: width 0.3s ease;
}

#ult-label { position: relative; z-index: 1; text-shadow: 0 1px 3px rgba(0,0,0,0.6); }

.ult-btn.ready {
  border-color: var(--pink-soft);
  box-shadow: 0 0 22px var(--pink-glow), 0 0 44px rgba(255, 46, 136, 0.25);
  animation: ultPulse 0.9s ease-in-out infinite;
}

.ult-btn.ready:hover { transform: scale(1.06); }

@keyframes ultPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.045); }
}

.toolbar {
  pointer-events: auto;
  display: flex;
  gap: 8px;
  padding: 8px;
}

.weapon-btn {
  position: relative;
  width: 58px;
  height: 58px;
  border: 2px solid transparent;
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 27px;
  cursor: pointer;
  transition: transform 0.14s, background 0.14s, border-color 0.14s;
}

.weapon-btn:hover { transform: translateY(-4px) scale(1.06); background: rgba(255, 255, 255, 0.12); }

.weapon-btn.active {
  border-color: var(--pink);
  background: rgba(255, 46, 136, 0.22);
  box-shadow: 0 0 14px var(--pink-glow);
  transform: translateY(-2px);
}

.w-key {
  position: absolute;
  right: 4px;
  bottom: 2px;
  font-size: 9.5px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.5);
}

/* ================= OVERLAYS ================= */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(24, 4, 32, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: overlayIn 0.4s ease;
}

@keyframes overlayIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.title-box, .win-box {
  text-align: center;
  max-width: 520px;
  width: 100%;
  animation: boxIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes boxIn {
  from { transform: scale(0.8) translateY(30px); opacity: 0; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}

.title-emoji {
  font-size: 64px;
  animation: bounce 1.6s ease-in-out infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0) rotate(-4deg); }
  50% { transform: translateY(-14px) rotate(4deg); }
}

.game-title {
  font-family: "Baloo 2", sans-serif;
  font-size: clamp(46px, 11vw, 82px);
  font-weight: 800;
  line-height: 1.05;
  background: linear-gradient(180deg, #ffb3ec 0%, #ff2e88 55%, #ff5e3a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 4px 0 #6b0f3a) drop-shadow(0 8px 24px rgba(255, 46, 136, 0.45));
  margin-bottom: 10px;
}

#subtitle {
  font-size: 16.5px;
  color: rgba(255, 244, 250, 0.85);
  margin-bottom: 28px;
}

#subtitle b { color: var(--pink-soft); }

.big-btn {
  pointer-events: auto;
  display: inline-block;
  padding: 16px 44px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(180deg, #ff5ea8, #ff2e88);
  color: white;
  font-family: "Baloo 2", sans-serif;
  font-size: 21px;
  font-weight: 800;
  letter-spacing: 1px;
  cursor: pointer;
  box-shadow: 0 7px 0 #a3125b, 0 14px 30px rgba(255, 46, 136, 0.4);
  transition: transform 0.12s, box-shadow 0.12s;
}

.big-btn:hover { transform: translateY(-2px); box-shadow: 0 9px 0 #a3125b, 0 18px 36px rgba(255, 46, 136, 0.5); }
.big-btn:active { transform: translateY(5px); box-shadow: 0 2px 0 #a3125b; }

.upload-label {
  display: block;
  margin-top: 20px;
  font-size: 13.5px;
  color: rgba(255, 244, 250, 0.6);
  cursor: pointer;
  text-decoration: underline dotted;
}

.upload-label:hover { color: var(--pink-soft); }
.upload-label input { display: none; }

.hint {
  margin-top: 16px;
  font-size: 12.5px;
  color: rgba(255, 244, 250, 0.45);
}

/* ---- win overlay ---- */

.win-box {
  padding: 34px 30px;
  border-radius: 28px;
  background: rgba(43, 10, 51, 0.85);
  border: 1.5px solid rgba(255, 122, 184, 0.35);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5), 0 0 60px rgba(255, 46, 136, 0.15);
}

.win-box h2 {
  font-family: "Baloo 2", sans-serif;
  font-size: 42px;
  color: var(--gold);
  text-shadow: 0 3px 0 #7a4a00, 0 6px 20px rgba(255, 209, 102, 0.4);
  margin-bottom: 12px;
}

#win-quote {
  font-size: 16px;
  font-style: italic;
  color: var(--pink-soft);
  margin-bottom: 22px;
  line-height: 1.5;
}

.stats {
  margin: 0 auto 26px;
  max-width: 330px;
  text-align: left;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 4px;
  font-size: 14.5px;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.12);
}

.stat-row b { color: var(--gold); }

/* ================= RESPONSIVE ================= */

@media (max-width: 560px) {
  .hp-card { max-width: none; }
  .weapon-btn { width: 50px; height: 50px; font-size: 23px; }
  .ult-btn { min-width: 200px; font-size: 13px; padding: 10px 20px; }
  #combo-num { font-size: 21px; }
  .icon-btn { width: 40px; height: 40px; }
  .win-box { padding: 26px 20px; }
  #game { cursor: auto; }
}
