/* ===== JUNKRAT'S TOTAL MAYHEM — scrapyard punk UI ===== */
@font-face {
  font-family: 'Black Ops One';
  src: url('fonts/black-ops-one-latin.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}

:root {
  --rust: #8a4b2a;
  --hazard: #f7c331;
  --burnt: #d2691e;
  --hot: #ff6a00;
  --ash: #241d18;
  --bone: #e8dcc8;
  --stencil: 'Black Ops One', 'Arial Black', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #17110d; }
body { font-family: var(--stencil); color: var(--bone); -webkit-user-select: none; user-select: none;
  touch-action: none; -webkit-tap-highlight-color: transparent; }

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

.hidden { display: none !important; }

/* ===================== HUD ===================== */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }

#crosshair { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); }
.ch-dot { position: absolute; left: -3px; top: -3px; width: 6px; height: 6px; border-radius: 50%;
  background: var(--hazard); box-shadow: 0 0 6px var(--hot); }
.ch-ring { position: absolute; left: -13px; top: -13px; width: 26px; height: 26px; border-radius: 50%;
  border: 2px dashed rgba(247,195,49,.7); animation: chspin 6s linear infinite; }
@keyframes chspin { to { transform: rotate(360deg); } }

#hud-top { position: absolute; top: 10px; left: 0; right: 0; display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.hud-chip { background: rgba(23,15,10,.78); border: 2px solid var(--rust); border-radius: 4px;
  padding: 5px 14px; font-size: 15px; letter-spacing: 1px; color: var(--bone);
  text-shadow: 1px 1px 0 #000; transform: skewX(-4deg); }
.hud-chip span { color: var(--hazard); }

#hud-bottom { position: absolute; left: 0; right: 0; bottom: 12px; display: flex; align-items: flex-end;
  justify-content: center; gap: 18px; flex-wrap: wrap; padding: 0 12px; }
.hud-label { font-size: 11px; letter-spacing: 2px; color: var(--burnt); margin-bottom: 3px; text-shadow: 1px 1px 0 #000; }

#health-wrap { min-width: 190px; }
#health-bar { height: 16px; background: rgba(23,15,10,.8); border: 2px solid var(--rust); border-radius: 3px; overflow: hidden; transform: skewX(-8deg); }
#health-fill { height: 100%; width: 100%; background: linear-gradient(90deg, #b3321f, var(--hot), var(--hazard));
  transition: width .18s ease-out; box-shadow: 0 0 10px rgba(255,106,0,.6) inset; }

#ammo-wrap { min-width: 120px; }
#ammo-pips { display: flex; gap: 5px; }
.ammo-pip { width: 14px; height: 20px; background: var(--hazard); border: 2px solid #7a5a10;
  border-radius: 50% 50% 40% 40%; box-shadow: 0 0 6px rgba(247,195,49,.5); }
.ammo-pip.spent { background: #3a2f26; border-color: #241d18; box-shadow: none; }
#reload-note { font-size: 11px; color: var(--hazard); letter-spacing: 2px; margin-top: 3px; animation: blink .5s steps(2) infinite; }
@keyframes blink { 50% { opacity: .25; } }

#abilities { display: flex; gap: 10px; }
.ability { position: relative; width: 86px; padding: 8px 6px 6px; text-align: center;
  background: rgba(23,15,10,.78); border: 2px solid var(--rust); border-radius: 5px; transform: skewX(-4deg); overflow: hidden; }
.ability .ab-key { font-size: 10px; color: var(--hazard); letter-spacing: 1px; }
.ability .ab-name { font-size: 11px; color: var(--bone); margin-top: 2px; }
.ability .ab-cd { position: absolute; left: 0; bottom: 0; width: 100%; height: 0%;
  background: rgba(247,195,49,.25); pointer-events: none; }
.ability.on-cd { filter: grayscale(.7) brightness(.6); }
.ability.ult { border-color: var(--hot); }
.ability.ult.ready { border-color: var(--hazard); box-shadow: 0 0 14px rgba(247,195,49,.8); animation: ultpulse .7s ease-in-out infinite; }
@keyframes ultpulse { 50% { box-shadow: 0 0 26px rgba(255,106,0,1); } }
#ult-ready-tag { position: absolute; top: 2px; right: 4px; font-size: 9px; color: var(--hot); animation: blink .4s steps(2) infinite; }

/* commentary + popups */
#commentary { position: absolute; left: 0; right: 0; bottom: 27%; text-align: center; pointer-events: none; }
.junk-line { display: inline-block; font-size: 30px; letter-spacing: 2px; color: var(--hazard);
  text-shadow: 3px 3px 0 #000, -1px -1px 0 var(--ash); transform: rotate(-2deg);
  animation: junkpop 2.2s ease-out forwards; }
.junk-line.hyped { font-size: 42px; color: var(--hot); animation-duration: 2.8s; }
.junk-line.feral { font-size: 54px; color: #ffd23e; text-shadow: 4px 4px 0 #000, 0 0 30px var(--hot); }
@keyframes junkpop {
  0% { opacity: 0; transform: scale(.4) rotate(6deg); }
  8% { opacity: 1; transform: scale(1.15) rotate(-3deg); }
  14% { transform: scale(1) rotate(-2deg); }
  75% { opacity: 1; }
  100% { opacity: 0; transform: scale(1.05) translateY(-24px) rotate(-2deg); }
}
#popups { position: absolute; left: 0; right: 0; top: 34%; text-align: center; pointer-events: none; }
.score-popup { display: block; font-size: 22px; color: #fff; text-shadow: 2px 2px 0 #000;
  animation: popuprise 1.4s ease-out forwards; }
.score-popup .pts { color: var(--hazard); }
@keyframes popuprise {
  0% { opacity: 0; transform: translateY(18px) scale(.6); }
  12% { opacity: 1; transform: translateY(0) scale(1.1); }
  20% { transform: scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-34px); }
}

#hurt-vignette { position: absolute; inset: 0; pointer-events: none; opacity: 0;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(179,40,20,.55) 100%); transition: opacity .12s; }

/* ===================== TOUCH ===================== */
#touch-ui { position: fixed; inset: 0; z-index: 20; pointer-events: none; }
#stick-zone { position: absolute; left: 0; bottom: 0; width: 45%; height: 60%; pointer-events: auto; }
#stick-base { position: absolute; left: 60px; bottom: 90px; width: 110px; height: 110px; border-radius: 50%;
  border: 3px solid rgba(247,195,49,.5); background: rgba(23,15,10,.4); opacity: .85; }
#stick-nub { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--hazard), var(--burnt)); transform: translate(-50%,-50%);
  box-shadow: 0 0 12px rgba(255,106,0,.6); }
#touch-buttons { position: absolute; right: 14px; bottom: 84px; display: flex; flex-direction: column; gap: 10px;
  align-items: flex-end; pointer-events: auto; }
.tbtn { min-width: 64px; min-height: 52px; padding: 8px 14px; font-family: var(--stencil); font-size: 14px;
  letter-spacing: 1px; color: var(--ash); background: linear-gradient(180deg, var(--hazard), var(--burnt));
  border: 3px solid #7a5a10; border-radius: 10px; box-shadow: 0 4px 0 #4a3208; }
.tbtn:active { transform: translateY(3px); box-shadow: 0 1px 0 #4a3208; }
.tbtn.big { min-width: 92px; min-height: 68px; font-size: 18px; }
.tbtn.ult { background: linear-gradient(180deg, #ffd23e, var(--hot)); border-color: #a33e00; }
.tbtn.ult.disabled { filter: grayscale(.8) brightness(.55); }

/* ===================== TITLE ===================== */
#title-screen { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center;
  background:
    repeating-linear-gradient(45deg, rgba(247,195,49,.06) 0 22px, transparent 22px 44px),
    radial-gradient(ellipse at 50% 120%, rgba(255,106,0,.28), transparent 60%),
    linear-gradient(180deg, #1c130d 0%, #2a1a10 55%, #17110d 100%);
  overflow-y: auto; }
.title-inner { text-align: center; padding: 26px 18px; max-width: 760px; position: relative; z-index: 2; }
.title-eyebrow { font-size: 15px; letter-spacing: 6px; color: var(--burnt); }
.game-title { font-size: clamp(44px, 10vw, 96px); line-height: .95; margin: 6px 0 2px;
  color: var(--bone); text-shadow: 5px 5px 0 #000, 0 0 40px rgba(255,106,0,.35); transform: rotate(-2deg); }
.game-title .hot { color: var(--hot); text-shadow: 5px 5px 0 #000, 0 0 44px rgba(255,106,0,.8);
  animation: hotflicker 1.7s ease-in-out infinite; }
@keyframes hotflicker { 0%,100% { text-shadow: 5px 5px 0 #000, 0 0 44px rgba(255,106,0,.8); }
  50% { text-shadow: 5px 5px 0 #000, 0 0 70px rgba(255,210,62,.95); } }
.title-sub { font-size: 15px; letter-spacing: 3px; color: var(--hazard); margin-bottom: 20px; transform: rotate(-1deg); }
#start-btn { font-family: var(--stencil); font-size: 24px; letter-spacing: 2px; cursor: pointer;
  color: var(--ash); background: linear-gradient(180deg, var(--hazard), var(--burnt));
  border: 4px solid #7a5a10; border-radius: 8px; padding: 14px 34px; box-shadow: 0 6px 0 #4a3208, 0 0 30px rgba(255,106,0,.35);
  transform: rotate(-1deg); transition: transform .1s; }
#start-btn:hover { transform: rotate(-1deg) scale(1.05); }
#start-btn:active { transform: rotate(-1deg) translateY(4px); box-shadow: 0 2px 0 #4a3208; }
.controls-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 18px; margin: 24px auto 10px;
  max-width: 640px; text-align: left; font-family: 'Arial Black', Arial, sans-serif; }
.controls-grid > div { background: rgba(23,15,10,.6); border-left: 4px solid var(--rust); padding: 7px 10px; border-radius: 3px; }
.controls-grid b { color: var(--hazard); font-size: 12px; letter-spacing: 1px; display: block; }
.controls-grid span { color: #cbbfa8; font-size: 11.5px; font-family: Arial, sans-serif; }
.title-foot { margin-top: 14px; font-size: 12px; letter-spacing: 2px; color: var(--burnt); }

.ember-field { position: absolute; inset: 0; overflow: hidden; z-index: 1; pointer-events: none; }
.ember { position: absolute; bottom: -10px; border-radius: 50%; background: var(--hot);
  box-shadow: 0 0 8px var(--hot); animation: emberrise linear infinite; opacity: .8; }
@keyframes emberrise { to { transform: translateY(-110vh) translateX(6vw); opacity: 0; } }

/* ===================== END SCREENS ===================== */
.end-screen { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, rgba(40,20,8,.88), rgba(15,9,6,.96)); overflow-y: auto; }
.end-inner { text-align: center; padding: 24px; max-width: 640px; }
.end-title { font-size: clamp(40px, 9vw, 84px); transform: rotate(-2deg); text-shadow: 5px 5px 0 #000; }
.end-title.boom { color: var(--hot); animation: hotflicker 1.2s ease-in-out infinite; }
.end-title.win { color: var(--hazard); text-shadow: 5px 5px 0 #000, 0 0 60px rgba(255,210,62,.8); }
.end-quote { margin: 10px 0 18px; font-size: 16px; color: var(--bone); font-family: Arial, sans-serif; font-style: italic; }
.tally { margin: 0 auto 20px; max-width: 420px; text-align: left; background: rgba(23,15,10,.75);
  border: 2px solid var(--rust); border-radius: 6px; padding: 12px 18px; font-family: 'Arial Black', Arial, sans-serif; }
.tally .trow { display: flex; justify-content: space-between; font-size: 13px; padding: 3px 0; color: #cbbfa8; }
.tally .trow span:last-child { color: var(--hazard); }
.tally .ttotal { border-top: 2px dashed var(--rust); margin-top: 6px; padding-top: 8px; font-size: 18px; color: var(--bone); }
.restart-btn { font-family: var(--stencil); font-size: 20px; letter-spacing: 2px; cursor: pointer;
  color: var(--ash); background: linear-gradient(180deg, var(--hazard), var(--burnt));
  border: 4px solid #7a5a10; border-radius: 8px; padding: 12px 28px; box-shadow: 0 6px 0 #4a3208; }
.restart-btn:active { transform: translateY(4px); box-shadow: 0 2px 0 #4a3208; }

#rotate-note { display: none; position: fixed; top: 6px; left: 50%; transform: translateX(-50%); z-index: 60;
  font-size: 11px; letter-spacing: 2px; color: var(--hazard); background: rgba(23,15,10,.85);
  padding: 4px 12px; border-radius: 4px; border: 1px solid var(--rust); }
@media (max-width: 620px) and (orientation: portrait) { #rotate-note { display: block; } }

/* ===================== MOBILE TUNING ===================== */
@media (max-width: 620px) {
  #hud-top { gap: 5px; top: 34px; padding: 0 4px; }
  .hud-chip { font-size: 10px; padding: 3px 7px; letter-spacing: 0; }
  #hud-bottom { gap: 8px; bottom: 8px; padding-bottom: 150px; }
  .ability { width: 66px; padding: 5px 4px 4px; }
  .ability .ab-name { font-size: 8.5px; }
  .ability .ab-key { font-size: 8px; }
  #health-wrap { min-width: 130px; }
  .junk-line { font-size: 20px; }
  .junk-line.hyped { font-size: 28px; }
  .junk-line.feral { font-size: 34px; }
  #commentary { bottom: 42%; }
  .controls-grid { grid-template-columns: 1fr; }
  .score-popup { font-size: 16px; }
}
body.touch .ability .ab-key { display: none; }
