/* D.VA: TOKKI STRIKE — bubblegum pink / white / sky blue on deep neon navy */
@font-face {
  font-family: 'Fredoka';
  src: url('../fonts/fredoka-latin.woff2') format('woff2');
  font-weight: 400 700;
  font-display: swap;
}

:root {
  --pink: #ff6ec7;
  --pink-hot: #ff2e9a;
  --sky: #6ad6ff;
  --navy: #0a0e24;
  --navy-2: #131a3d;
  --white: #f5f7ff;
  --chip-bg: rgba(14, 18, 46, 0.82);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--navy);
  font-family: 'Fredoka', 'Comic Sans MS', 'Chalkboard SE', 'Segoe UI Rounded', system-ui, sans-serif;
  color: var(--white);
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

#app { position: fixed; inset: 0; }
#game-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.hidden { display: none !important; }

/* ============ SCREENS (title / end) ============ */
.screen {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 70%, rgba(255, 46, 154, 0.14), rgba(10, 14, 36, 0.78) 60%, rgba(8, 11, 30, 0.92));
  z-index: 40;
}
.title-stack, .end-stack { text-align: center; padding: 20px; max-width: 720px; animation: rise 0.7s cubic-bezier(0.2, 1.4, 0.4, 1); }
@keyframes rise { from { transform: translateY(30px) scale(0.96); opacity: 0; } to { transform: none; opacity: 1; } }

.title-eyebrow {
  letter-spacing: 0.35em; font-size: 13px; font-weight: 600; color: var(--sky);
  text-shadow: 0 0 12px rgba(106, 214, 255, 0.8);
}
.game-title { line-height: 0.95; margin: 10px 0 4px; }
.t-dva {
  display: block; font-size: clamp(64px, 14vw, 120px); font-weight: 700;
  color: var(--pink);
  text-shadow: 0 0 24px rgba(255, 110, 199, 0.65), 0 4px 0 #a3176b, 0 8px 24px rgba(0,0,0,0.5);
  transform: skew(-4deg);
}
.t-sub {
  display: block; font-size: clamp(26px, 5.5vw, 44px); font-weight: 600; letter-spacing: 0.28em;
  color: var(--white); text-shadow: 0 0 16px rgba(106, 214, 255, 0.55);
}
.title-tag { font-size: clamp(13px, 2.2vw, 17px); color: #ffd6ef; margin: 10px 0 22px; font-style: italic; }

.big-btn {
  font-family: inherit; font-weight: 700; font-size: clamp(20px, 3.4vw, 28px);
  color: #fff; background: linear-gradient(135deg, var(--pink-hot), var(--pink) 55%, #ff9bdd);
  border: none; border-radius: 999px; padding: 14px 46px; cursor: pointer;
  box-shadow: 0 0 28px rgba(255, 46, 154, 0.55), 0 6px 0 #a3176b;
  transition: transform 0.12s cubic-bezier(0.2, 1.6, 0.4, 1), box-shadow 0.12s;
}
.big-btn:hover { transform: scale(1.07) rotate(-1deg); box-shadow: 0 0 44px rgba(255, 46, 154, 0.85), 0 6px 0 #a3176b; }
.big-btn:active { transform: scale(0.97); box-shadow: 0 0 18px rgba(255, 46, 154, 0.5), 0 2px 0 #a3176b; }

.controls-card {
  display: flex; gap: 28px; justify-content: center; flex-wrap: wrap;
  margin: 26px auto 0; padding: 16px 22px;
  background: var(--chip-bg); border: 1px solid rgba(106, 214, 255, 0.25); border-radius: 18px;
  backdrop-filter: blur(6px);
}
.ctl-col { text-align: left; }
.ctl-row { font-size: 14px; padding: 3px 0; color: #cdd6ff; }
.key {
  display: inline-block; min-width: 52px; text-align: center;
  background: var(--navy-2); border: 1px solid rgba(255, 110, 199, 0.5); border-bottom-width: 3px;
  border-radius: 8px; padding: 2px 8px; margin-right: 8px;
  color: var(--pink); font-weight: 600; font-size: 12px;
}
.key.alt { border-color: rgba(106, 214, 255, 0.5); color: var(--sky); min-width: 66px; }
.title-foot { margin-top: 20px; font-size: 12px; letter-spacing: 0.2em; color: rgba(245, 247, 255, 0.45); }

/* ============ HUD ============ */
#hud { position: absolute; inset: 0; pointer-events: none; z-index: 20; }
.hud-label { font-size: 10px; letter-spacing: 0.25em; color: var(--sky); opacity: 0.85; }

#hud-topleft { position: absolute; top: 14px; left: 16px; display: flex; flex-direction: column; gap: 6px; }
#score-box, #wave-box, #combo-box {
  background: var(--chip-bg); border-radius: 12px; padding: 6px 14px;
  border: 1px solid rgba(255, 110, 199, 0.3); display: flex; gap: 10px; align-items: baseline;
  backdrop-filter: blur(4px);
}
#score-val { font-size: 24px; font-weight: 700; color: var(--white); min-width: 70px; text-align: right; }
#wave-val { font-size: 16px; font-weight: 600; color: var(--pink); }
#combo-box { border-color: rgba(106, 214, 255, 0.5); color: var(--sky); font-size: 12px; font-weight: 600; animation: pop-in 0.2s; }
#combo-val { font-size: 18px; color: #fff; }

#killfeed {
  position: absolute; top: 14px; right: 16px; display: flex; flex-direction: column; gap: 6px; align-items: flex-end;
  max-width: 44vw;
}
.feed-chip {
  background: var(--chip-bg); border: 1px solid rgba(106, 214, 255, 0.3); border-radius: 999px;
  padding: 5px 14px; font-size: 13px; font-weight: 600; color: var(--white);
  animation: chip-in 0.25s cubic-bezier(0.2, 1.6, 0.4, 1);
  box-shadow: 0 2px 12px rgba(0,0,0,0.4);
  white-space: nowrap;
}
.feed-chip.kill b { color: var(--pink); }
.feed-chip.absorb { border-color: rgba(106, 214, 255, 0.6); color: var(--sky); }
.feed-chip.ult { border-color: var(--pink-hot); background: linear-gradient(135deg, rgba(255,46,154,0.4), var(--chip-bg)); }
.feed-chip.warn { border-color: #ffb84d; color: #ffd9a0; }
.feed-chip.fade { opacity: 0; transform: translateX(24px); transition: all 0.4s; }
@keyframes chip-in { from { transform: translateX(40px) scale(0.8); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes pop-in { from { transform: scale(0.7); opacity: 0; } to { transform: none; opacity: 1; } }

#hud-bottomleft { position: absolute; left: 16px; bottom: 16px; width: min(300px, 42vw); }
.bar-label { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; color: var(--white); margin-bottom: 3px; text-shadow: 0 1px 4px rgba(0,0,0,0.8); }
.bar-label.small { font-size: 10px; letter-spacing: 0.18em; color: rgba(205, 214, 255, 0.75); margin-top: 6px; }
.bar { height: 14px; border-radius: 999px; background: rgba(10, 14, 36, 0.75); border: 1px solid rgba(245,247,255,0.18); overflow: hidden; }
.bar .fill { height: 100%; width: 100%; border-radius: 999px; transition: width 0.15s ease-out; }
.mech-hp .fill { background: linear-gradient(90deg, var(--pink-hot), var(--pink), #ffb3e2); box-shadow: 0 0 12px rgba(255,110,199,0.7); }
.matrix .fill { background: linear-gradient(90deg, #2e9fff, var(--sky)); box-shadow: 0 0 10px rgba(106,214,255,0.7); }
.fuel .fill { background: linear-gradient(90deg, #ffb84d, #ffd98a); }
.pilot-hp .fill { background: linear-gradient(90deg, #6ad6ff, #b3ecff); box-shadow: 0 0 12px rgba(106,214,255,0.7); }
.callmech .fill { background: linear-gradient(90deg, #c86aff, #f0c0ff); }
.bar { margin-bottom: 2px; }
.bar.matrix, .bar.fuel, .bar.callmech { height: 9px; }

#hud-bottomright { position: absolute; right: 16px; bottom: 16px; display: flex; gap: 8px; }
.ability {
  background: var(--chip-bg); border: 1px solid rgba(106, 214, 255, 0.3); border-radius: 12px;
  padding: 6px 10px; text-align: center; min-width: 58px;
  transition: all 0.15s;
}
.ability .ab-key { display: block; font-size: 10px; font-weight: 700; color: var(--sky); letter-spacing: 0.1em; }
.ability .ab-name { display: block; font-size: 11px; font-weight: 600; color: var(--white); }
.ability.ult { border-color: rgba(255, 46, 154, 0.5); }
.ability.ult .ab-key { color: var(--pink); }
.ability.ult.ready { background: linear-gradient(135deg, rgba(255,46,154,0.45), var(--chip-bg)); box-shadow: 0 0 16px rgba(255,46,154,0.5); animation: ult-pulse 1s infinite alternate; }
.ability.cooldown { opacity: 0.38; }
@keyframes ult-pulse { from { transform: scale(1); } to { transform: scale(1.08); } }

#crosshair { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); }
.ch-dot { position: absolute; left: -2px; top: -2px; width: 4px; height: 4px; border-radius: 50%; background: var(--pink); box-shadow: 0 0 6px var(--pink); }
.ch-ring { position: absolute; left: -11px; top: -11px; width: 22px; height: 22px; border: 2px solid rgba(255, 110, 199, 0.65); border-radius: 50%; }
#hitmarker {
  position: absolute; left: -13px; top: -13px; width: 26px; height: 26px; opacity: 0;
  background:
    linear-gradient(45deg, transparent 46%, #fff 46%, #fff 54%, transparent 54%),
    linear-gradient(-45deg, transparent 46%, #fff 46%, #fff 54%, transparent 54%);
  transform: rotate(45deg) scale(1.3);
}
#hitmarker.show { animation: hitm 0.18s ease-out; }
@keyframes hitm { 0% { opacity: 1; transform: rotate(45deg) scale(0.9); } 100% { opacity: 0; transform: rotate(45deg) scale(1.5); } }

#center-popups { position: absolute; left: 50%; top: 34%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; }
.center-popup {
  font-size: clamp(18px, 3.4vw, 30px); font-weight: 700; color: var(--white);
  text-shadow: 0 0 14px rgba(255, 110, 199, 0.9), 0 2px 6px rgba(0,0,0,0.7);
  animation: cpop 1.6s cubic-bezier(0.2, 1.4, 0.4, 1) forwards;
  white-space: nowrap;
}
.center-popup small { display: block; text-align: center; font-size: 0.5em; color: var(--sky); letter-spacing: 0.2em; }
@keyframes cpop {
  0% { transform: scale(0.4); opacity: 0; }
  12% { transform: scale(1.15); opacity: 1; }
  22% { transform: scale(1); }
  75% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-26px) scale(0.96); }
}

#potg-banner {
  position: absolute; left: 0; right: 0; top: 22%;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  animation: potg-in 0.4s cubic-bezier(0.2, 1.4, 0.4, 1);
}
.potg-stripe { width: 100%; height: 4px; background: linear-gradient(90deg, transparent, var(--pink), var(--sky), var(--pink), transparent); box-shadow: 0 0 18px rgba(255,110,199,0.8); }
.potg-text {
  font-size: clamp(30px, 6vw, 56px); font-weight: 700; letter-spacing: 0.14em; color: var(--white);
  text-shadow: 0 0 26px rgba(255, 46, 154, 1), 0 4px 0 #a3176b;
}
.potg-sub { font-size: clamp(14px, 2.4vw, 20px); font-weight: 600; color: var(--pink); letter-spacing: 0.2em; }
@keyframes potg-in { from { transform: scaleY(0.2); opacity: 0; } to { transform: none; opacity: 1; } }

#wave-banner {
  position: absolute; left: 50%; top: 18%; transform: translateX(-50%);
  font-size: clamp(22px, 4.6vw, 40px); font-weight: 700; letter-spacing: 0.18em; color: var(--sky);
  text-shadow: 0 0 20px rgba(106, 214, 255, 0.8), 0 2px 8px rgba(0,0,0,0.7);
  animation: cpop 2.2s cubic-bezier(0.2, 1.4, 0.4, 1) forwards;
  white-space: nowrap;
}

#vignette {
  position: absolute; inset: 0; pointer-events: none; opacity: 0;
  background: radial-gradient(ellipse at center, transparent 52%, rgba(255, 20, 60, 0.5) 100%);
  transition: opacity 0.2s;
}
#vignette.hurt { opacity: 1; }

#mute-btn {
  position: absolute; right: 16px; top: 50%; pointer-events: auto; cursor: pointer;
  background: var(--chip-bg); border: 1px solid rgba(245,247,255,0.2); border-radius: 10px;
  padding: 4px 9px; font-size: 15px;
}
#pause-hint {
  position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%);
  font-size: 26px; font-weight: 700; letter-spacing: 0.2em; color: var(--white);
  text-shadow: 0 0 18px rgba(106,214,255,0.8);
}

/* ============ END SCREEN ============ */
#end-title {
  font-size: clamp(48px, 11vw, 96px); font-weight: 700; color: var(--pink);
  text-shadow: 0 0 30px rgba(255, 46, 154, 0.8), 0 5px 0 #a3176b;
  transform: skew(-4deg);
}
#end-title.victory { color: var(--sky); text-shadow: 0 0 30px rgba(106, 214, 255, 0.9), 0 5px 0 #1e6fa0; }
#end-quip { font-size: clamp(15px, 2.6vw, 21px); color: #ffd6ef; font-style: italic; margin: 8px 0 22px; }
.end-stats { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-bottom: 26px; }
.stat {
  background: var(--chip-bg); border: 1px solid rgba(106, 214, 255, 0.28); border-radius: 14px;
  padding: 12px 20px; min-width: 110px;
}
.stat-label { display: block; font-size: 10px; letter-spacing: 0.2em; color: var(--sky); }
.stat-val { display: block; font-size: 30px; font-weight: 700; color: var(--white); }

/* ============ TOUCH UI ============ */
#touch-ui { position: absolute; inset: 0; z-index: 30; pointer-events: none; }
#joystick {
  position: absolute; left: 26px; bottom: 96px; width: 124px; height: 124px;
  border-radius: 50%; border: 2px solid rgba(255, 110, 199, 0.5);
  background: rgba(14, 18, 46, 0.4); pointer-events: auto;
}
#joystick-knob {
  position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ff9bdd, var(--pink-hot));
  transform: translate(-50%, -50%); box-shadow: 0 0 16px rgba(255, 46, 154, 0.7);
}
#touch-buttons {
  position: absolute; right: 18px; bottom: 88px; display: grid;
  grid-template-columns: repeat(2, 74px); gap: 10px; pointer-events: auto;
}
.tbtn {
  font-family: inherit; font-weight: 700; font-size: 13px; color: #fff;
  background: rgba(14, 18, 46, 0.65); border: 2px solid rgba(106, 214, 255, 0.55);
  border-radius: 16px; padding: 16px 0; touch-action: none;
}
.tbtn.ult { border-color: var(--pink-hot); color: var(--pink); grid-column: span 2; }
.tbtn:active { background: rgba(255, 110, 199, 0.4); }

@media (max-width: 720px) {
  #hud-bottomleft { width: 44vw; bottom: 12px; }
  #hud-bottomright { display: none; }
  #killfeed { max-width: 52vw; }
  .feed-chip { font-size: 11px; padding: 4px 10px; }
  #mute-btn { top: auto; bottom: 230px; }
  .controls-card { gap: 14px; padding: 12px 14px; }
  .ctl-row { font-size: 12px; }
}
