/* SATDOG TURF WAR — neon arcade UI */
:root {
  --base: #0d1020;
  --panel: #141a33;
  --lime: #7CFF2E;
  --magenta: #FF2E88;
  --ink: #eef4ff;
  --dim: #8a93b8;
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  width: 100%; height: 100%; overflow: hidden;
  background: var(--base); color: var(--ink);
  font-family: "Trebuchet MS", Verdana, system-ui, sans-serif;
  user-select: none; -webkit-user-select: none; touch-action: none;
  overscroll-behavior: none;
}
#game, #game canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }

/* ---------- HUD ---------- */
#hud { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
#topbar { position: absolute; top: max(10px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); }
#turfbar {
  position: relative; width: min(60vw, 520px); height: 26px;
  display: flex; border-radius: 13px; overflow: hidden;
  border: 2px solid rgba(255,255,255,.22);
  box-shadow: 0 0 14px rgba(0,0,0,.6);
  background: #1a2040;
}
#turfA { background: var(--lime); width: 50%; transition: width .25s; box-shadow: 0 0 8px var(--lime); }
#turfB { background: var(--magenta); width: 50%; transition: width .25s; box-shadow: 0 0 8px var(--magenta); }
#timer {
  position: absolute; inset: -2px 50%; transform: translateX(-50%);
  background: var(--base); border: 2px solid var(--ink);
  border-radius: 12px; padding: 1px 10px;
  font-size: 20px; font-weight: 900; line-height: 22px;
  text-shadow: 0 0 8px rgba(255,255,255,.4);
}
#scores {
  position: absolute; top: max(44px, calc(env(safe-area-inset-top) + 34px)); right: 12px;
  display: flex; gap: 8px; font-size: 15px; font-weight: 900;
}
#scoreA { color: var(--lime); text-shadow: 0 0 8px var(--lime); }
#scoreB { color: var(--magenta); text-shadow: 0 0 8px var(--magenta); }
#killfeed {
  position: absolute; top: max(74px, calc(env(safe-area-inset-top) + 64px)); left: 12px;
  display: flex; flex-direction: column; gap: 4px; max-width: 40vw;
}
.kill-item {
  background: rgba(13,16,32,.85); border-left: 3px solid var(--lime);
  border-radius: 6px; padding: 4px 10px; font-size: 13px; font-weight: 700;
  animation: kf-in .25s ease-out;
}
.kill-item.magenta { border-left-color: var(--magenta); }
@keyframes kf-in { from { transform: translateX(-12px); opacity: 0; } }
.kill-item.fade { opacity: 0; transition: opacity .5s; }
#crosshair { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); }
#crosshair span {
  display: block; width: 14px; height: 14px; border: 2px solid #fff;
  border-radius: 50%; box-shadow: 0 0 6px rgba(0,0,0,.8), inset 0 0 4px rgba(0,0,0,.5);
}
#minimap {
  position: absolute; left: 12px; bottom: max(12px, env(safe-area-inset-bottom));
  border: 2px solid rgba(255,255,255,.25); border-radius: 12px;
  box-shadow: 0 0 12px rgba(0,0,0,.7); background: #0a0d1a;
}
#inkwrap {
  position: absolute; right: 14px; bottom: max(14px, env(safe-area-inset-bottom));
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
#inkbar {
  width: 26px; height: 150px; border-radius: 13px; border: 2px solid rgba(255,255,255,.3);
  background: #1a2040; position: relative; overflow: hidden;
}
#inkfill {
  position: absolute; bottom: 0; left: 0; right: 0; height: 100%;
  background: linear-gradient(to top, #4d9fff, #a8d8ff);
  transition: height .12s linear;
}
#specialPrompt {
  font-size: 15px; font-weight: 900; color: var(--lime);
  text-shadow: 0 0 10px var(--lime);
  animation: pulse 0.8s infinite alternate;
}
@keyframes pulse { from { transform: scale(1); } to { transform: scale(1.12); } }
#hpwrap { position: absolute; bottom: max(14px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); width: min(46vw, 340px); }
#hpbar { height: 12px; border-radius: 6px; background: #1a2040; border: 2px solid rgba(255,255,255,.25); overflow: hidden; }
#hpfill { height: 100%; width: 100%; background: linear-gradient(90deg, #4dff7c, #a8ffcb); transition: width .15s; }
#btnPause {
  position: absolute; top: max(10px, env(safe-area-inset-top)); left: 12px;
  pointer-events: auto;
}
.hud-btn {
  background: var(--panel); color: var(--ink); border: 2px solid var(--dim);
  border-radius: 10px; font-size: 15px; font-weight: 900; padding: 6px 12px;
  cursor: pointer;
}
.hud-btn:active { transform: scale(.94); }
#debug {
  position: absolute; top: max(10px, env(safe-area-inset-top)); left: 64px;
  background: rgba(0,0,0,.7); color: #0f0; font-family: monospace;
  font-size: 12px; padding: 6px 8px; border-radius: 6px; line-height: 1.5;
}

/* ---------- Touch UI ---------- */
#touchUI { position: absolute; inset: 0; z-index: 6; pointer-events: none; }
#joy {
  position: absolute; left: 26px; bottom: calc(max(90px, env(safe-area-inset-bottom)) + 40px);
  width: 130px; height: 130px; border-radius: 50%;
  border: 2px solid rgba(124,255,46,.5); background: rgba(13,16,32,.45);
  pointer-events: auto;
}
#joyKnob {
  position: absolute; left: 50%; top: 50%; width: 56px; height: 56px;
  border-radius: 50%; background: var(--lime); opacity: .85;
  transform: translate(-50%,-50%); box-shadow: 0 0 12px var(--lime);
}
#touchUI button {
  pointer-events: auto; border: none; border-radius: 50%;
  font-weight: 900; color: #0d1020; font-family: inherit;
}
#btnFire {
  position: absolute; right: 26px; bottom: calc(max(90px, env(safe-area-inset-bottom)) + 40px);
  width: 96px; height: 96px; font-size: 16px;
  background: var(--magenta); box-shadow: 0 0 16px var(--magenta);
}
#btnJump {
  position: absolute; right: 140px; bottom: calc(max(90px, env(safe-area-inset-bottom)) + 24px);
  width: 70px; height: 70px; font-size: 12px;
  background: var(--lime); box-shadow: 0 0 12px var(--lime);
}
#btnBomb {
  position: absolute; right: 44px; bottom: calc(max(90px, env(safe-area-inset-bottom)) + 150px);
  width: 70px; height: 70px; font-size: 12px;
  background: #ffd32e; box-shadow: 0 0 12px #ffd32e;
}
#btnSpecial {
  position: absolute; right: 148px; bottom: calc(max(90px, env(safe-area-inset-bottom)) + 150px);
  width: 70px; height: 70px; font-size: 11px;
  background: #5a6a8a; box-shadow: none; opacity: .55;
}
#btnSpecial.ready {
  background: var(--lime); box-shadow: 0 0 22px var(--lime); opacity: 1;
  animation: special-glow .7s infinite alternate;
}
#btnDive {
  position: absolute; right: 250px; bottom: calc(max(90px, env(safe-area-inset-bottom)) + 30px);
  width: 64px; height: 64px; font-size: 10px;
  background: #18d48c; box-shadow: 0 0 12px #18d48c; opacity: .8;
}
#btnDive:active { opacity: 1; }
@keyframes special-glow { from { transform: scale(1); } to { transform: scale(1.1); } }
#touchUI button:active { transform: scale(.92); filter: brightness(1.2); }

/* ---------- Menus ---------- */
#menu { position: absolute; inset: 0; z-index: 10; }
.screen {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 35%, rgba(124,255,46,.10), transparent 60%),
              radial-gradient(ellipse at 50% 65%, rgba(255,46,136,.10), transparent 60%),
              linear-gradient(180deg, rgba(9,12,24,.58) 0%, rgba(9,12,24,.34) 45%, rgba(9,12,24,.68) 100%);
  padding: 20px;
}
.panel {
  background: var(--panel); border: 2px solid rgba(124,255,46,.35); border-radius: 22px;
  padding: 32px 40px; text-align: center; max-width: min(92vw, 560px);
  box-shadow: 0 0 40px rgba(124,255,46,.12), 0 0 80px rgba(255,46,136,.08), inset 0 0 30px rgba(0,0,0,.4);
  display: flex; flex-direction: column; gap: 14px; max-height: 92vh; overflow-y: auto;
}
.title { font-size: clamp(38px, 8vw, 64px); font-weight: 900; letter-spacing: 2px; line-height: 1.05; }
.t-lime { color: var(--lime); text-shadow: 0 0 18px var(--lime); }
.t-magenta { color: var(--magenta); text-shadow: 0 0 18px var(--magenta); }
.tagline { color: var(--dim); font-size: 15px; font-weight: 700; }
.panel-title { font-size: 30px; font-weight: 900; color: var(--ink); }
.big-btn {
  font-family: inherit; font-size: 20px; font-weight: 900; letter-spacing: 1px;
  padding: 14px 26px; border-radius: 16px; border: 2px solid transparent; cursor: pointer;
  transition: transform .08s, filter .08s;
}
.big-btn:active { transform: scale(.96); }
.big-btn.lime { background: var(--lime); color: #0d1020; box-shadow: 0 0 18px rgba(124,255,46,.55); }
.big-btn.magenta { background: var(--magenta); color: #fff; box-shadow: 0 0 18px rgba(255,46,136,.55); }
.big-btn.ghost { background: transparent; color: var(--ink); border-color: var(--dim); }
.big-btn:hover { filter: brightness(1.1); }
.lang-btn {
  font-family: inherit; background: none; border: 2px solid var(--dim); color: var(--dim);
  border-radius: 10px; padding: 6px 14px; font-weight: 900; cursor: pointer; font-size: 14px;
}
.how-body { text-align: left; color: var(--dim); font-size: 15px; line-height: 1.65; white-space: pre-line; }
.how-body b { color: var(--ink); }
.setting {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  font-size: 17px; font-weight: 700; padding: 8px 4px;
}
.setting input[type="checkbox"] { width: 24px; height: 24px; accent-color: var(--lime); }
.setting input[type="range"] { width: 140px; accent-color: var(--lime); }

/* ---------- End screen ---------- */
.end-title { font-size: clamp(40px, 9vw, 64px); font-weight: 900; letter-spacing: 2px; }
.end-title.win { color: var(--lime); text-shadow: 0 0 24px var(--lime); }
.end-title.lose { color: var(--magenta); text-shadow: 0 0 24px var(--magenta); }
.end-turf { font-size: 26px; font-weight: 900; }
.end-turf .ea { color: var(--lime); } .end-turf .eb { color: var(--magenta); }
#scoreboard { width: 100%; border-collapse: collapse; font-size: 14px; }
#scoreboard th, #scoreboard td { padding: 6px 8px; border-bottom: 1px solid rgba(255,255,255,.1); text-align: center; }
#scoreboard th { color: var(--dim); font-size: 12px; text-transform: uppercase; letter-spacing: 1px; }
#scoreboard td.me { color: var(--lime); font-weight: 900; }

/* ---------- Countdown ---------- */
#countdown { background: rgba(9,12,24,.55); }
#countNum {
  font-size: clamp(90px, 22vw, 180px); font-weight: 900; color: var(--lime);
  text-shadow: 0 0 40px var(--lime);
  animation: count-pop .9s ease-out;
}
@keyframes count-pop { 0% { transform: scale(2.2); opacity: 0; } 30% { opacity: 1; } }

@media (max-width: 640px) {
  .panel { padding: 22px 20px; }
  #minimap { width: 120px; height: 120px; }
  #inkbar { height: 110px; }
  #turfbar { width: 64vw; }
}
