@font-face {
  font-family: "Jersey 15";
  src: url("assets/fonts/Jersey15-Regular.ttf") format("truetype");
  font-display: swap;
}

:root {
  --navy: #14172a;
  --navy2: #1b2140;
  --ink: #0e1124;
  --gold: #f0a929;
  --cream: #faf9f0;
  --muted: #9aa0c4;
  --hp: #3ad976;
  --foe: #d95b66;
}

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

html, body {
  height: 100%;
  background: var(--navy);
  color: var(--cream);
  font-family: "Jersey 15", system-ui, sans-serif;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
}

#stage { position: fixed; inset: 0; }

#game {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: var(--navy);
}

#topbar {
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  left: 0; right: 0;
  text-align: center;
  pointer-events: none;
  text-shadow: 0 2px 0 #00000080;
}
#wordmark {
  color: var(--gold);
  letter-spacing: clamp(2px, 0.7vw, 6px);
  font-size: clamp(30px, 6.2vw, 76px);
  line-height: 1;
}
#tagline {
  color: var(--cream);
  letter-spacing: 1px;
  font-size: clamp(13px, 1.9vw, 22px);
  margin-top: 2px;
}

#hud {
  position: absolute;
  top: calc(max(10px, env(safe-area-inset-top)) + clamp(52px, 8.2vw, 104px));
  left: 0; right: 0;
  display: flex;
  align-items: flex-start;
  gap: clamp(8px, 2vw, 22px);
  padding: 0 clamp(10px, 3vw, 28px);
}
.hpwrap { flex: 1; }
.hplabel { font-size: clamp(12px, 1.6vw, 18px); letter-spacing: 1px; }
.hpwrap.right .hplabel { text-align: right; }
.hpbar {
  height: clamp(12px, 1.7vw, 18px);
  background: var(--ink);
  border: 2px solid var(--gold);
  overflow: hidden;
}
.hpfill { display: block; height: 100%; width: 100%; background: var(--hp); transition: width 90ms linear; }
.hpfill.foe { background: var(--foe); margin-left: auto; }
#vs { color: var(--gold); font-size: clamp(18px, 2.6vw, 30px); align-self: center; }

#bottombar {
  position: absolute;
  left: 0; right: 0;
  bottom: max(8px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
/* App download badges — shown ONLY on the K.O. (game-over) screen, below REMATCH. */
#koapps {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  max-width: min(700px, 92vw);
  margin-top: 4px;
}
.koapp {
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--ink);
  border: 2px solid var(--gold);
  color: var(--cream);
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 10px;
  font-family: system-ui, sans-serif;
  line-height: 1.1;
}
.koapp.soon { border-style: dashed; border-color: var(--muted); }
.koapp[href] { cursor: pointer; }
.koapp[href]:hover { background: var(--navy2); border-color: var(--cream); }
.klogo { width: 26px; height: 26px; color: var(--gold); flex: 0 0 auto; }
.koapp.soon .klogo { color: var(--muted); }
.ktext { display: flex; flex-direction: column; align-items: flex-start; }
.klab { font-size: 15px; font-weight: 600; }
.ksub { font-size: 11px; color: var(--muted); letter-spacing: 0.3px; }

#kolegal {
  margin-top: 12px;
  font-family: system-ui, sans-serif;
  font-size: 13px;
  color: var(--muted);
}
#kolegal a { color: var(--muted); text-decoration: underline; }
#kolegal a:hover { color: var(--cream); }
.kdot { margin: 0 8px; }

#select { display: flex; gap: 6px; pointer-events: auto; }
.pick {
  width: clamp(30px, 4.4vw, 44px);
  height: clamp(30px, 4.4vw, 44px);
  border: 2px solid #2d3568;
  background: var(--ink);
  image-rendering: pixelated;
  cursor: pointer;
  padding: 0;
}
.pick.on { border-color: var(--gold); }

#hint { color: var(--muted); font-size: 13px; letter-spacing: 1px; }

#ko {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: #0a0c18cc;
  z-index: 5;
}
#ko.hidden { display: none; }
#koword { color: var(--gold); font-size: clamp(70px, 18vw, 220px); line-height: 0.9; }
#koresult { color: var(--cream); font-size: clamp(20px, 3.2vw, 40px); letter-spacing: 1px; }
#rematch {
  font-family: "Jersey 15", system-ui, sans-serif;
  font-size: clamp(20px, 3vw, 34px);
  letter-spacing: 2px;
  color: var(--ink);
  background: var(--gold);
  border: none;
  padding: 8px 28px;
  border-radius: 8px;
  cursor: pointer;
}
#rematch:active { transform: scale(0.97); }

#touch {
  position: absolute;
  left: 0; right: 0;
  bottom: clamp(96px, 20vh, 200px);
  display: flex;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 4;
}
#touch.hidden { display: none; }
.pad, .acts { display: flex; gap: 12px; }
.tbtn {
  width: 64px; height: 64px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  background: #0e1124cc;
  color: var(--cream);
  font-family: system-ui, sans-serif;
  font-size: 22px;
  -webkit-tap-highlight-color: transparent;
}
.tbtn:active { background: var(--gold); color: var(--ink); }
.tbtn.punch, .tbtn.kick { font-size: 18px; }

@media (orientation: portrait) {
  #select { flex-wrap: wrap; max-width: 92vw; justify-content: center; }
  #hint { display: none; }
  /* On a phone the bottom is the thumb zone (touch controls). Move the badges + picks to the TOP,
     just under the HP bars, so they never overlap the fight or the controls. */
  #bottombar { top: clamp(118px, 19vh, 168px); bottom: auto; }
  #touch { bottom: max(14px, env(safe-area-inset-bottom)); }
}
