/* ============================================================
   PROJECT KILLCAM — Squidly Arena Demo
   ============================================================ */

.ka-body {
  margin: 0;
  min-height: 100dvh;
  min-height: 100svh;
  color: #e2e8f0;
  background: #05080e;
  font-family: "Barlow Condensed", system-ui, sans-serif;
  overflow-x: hidden;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  padding-left: env(safe-area-inset-left, 0);
  padding-right: env(safe-area-inset-right, 0);
  padding-bottom: env(safe-area-inset-bottom, 0);
}

/* Live round: reduce scroll bounce fighting the canvas */
body.ka-playing {
  overflow: hidden;
  touch-action: none;
}

.ka-scan {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 2px,
      rgba(0, 0, 0, 0.12) 2px,
      rgba(0, 0, 0, 0.12) 4px
    );
  opacity: 0.35;
}

.ka-top {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.45rem 0.85rem;
  padding-top: max(0.45rem, env(safe-area-inset-top, 0px));
  background: rgba(6, 10, 16, 0.95);
  border-bottom: 1px solid rgba(56, 189, 248, 0.35);
}

.ka-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: #7dd3fc;
  text-decoration: none;
  font-family: "Share Tech Mono", monospace;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
}

.ka-brand img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.ka-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  margin-left: auto;
  font-family: "Share Tech Mono", monospace;
  font-size: 0.65rem;
  letter-spacing: 0.08em;
}

.ka-nav a {
  color: #94a3b8;
  text-decoration: none;
}

.ka-nav a:hover,
.ka-nav a.is-active {
  color: #7dd3fc;
}

.ka-main {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.85rem 0.75rem 2rem;
  display: grid;
  gap: 1rem;
}

@media (min-width: 960px) {
  .ka-main {
    grid-template-columns: 1fr 280px;
    align-items: start;
  }
}

.ka-stage-wrap {
  border: 1px solid rgba(56, 189, 248, 0.35);
  background: #0a0e14;
  border-radius: 3px;
  overflow: hidden;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}

.ka-chrome {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.4rem;
  padding: 0.4rem 0.7rem;
  font-family: "Share Tech Mono", monospace;
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  color: #7dd3fc;
  background: rgba(0, 0, 0, 0.55);
  border-bottom: 1px solid rgba(56, 189, 248, 0.2);
}

.ka-rec {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: #f87171;
}

.ka-rec-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 8px #ef4444;
  animation: ka-blink 1s step-end infinite;
}

@keyframes ka-blink {
  50% { opacity: 0.2; }
}

.ka-score {
  color: #fbbf24;
  font-weight: 700;
}

.ka-viewport {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #02040a;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  overflow: hidden;
  cursor: crosshair;
  /* isolate compositing for smoother mobile paint */
  transform: translateZ(0);
}

.ka-viewport.is-playing {
  cursor: none;
}

.ka-viewport.is-touch.is-playing {
  cursor: none;
}

#ka-canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  /* never stretch internal 16:9 buffer — parent must stay 16:9 */
  object-fit: contain;
}

/* Rotate-to-landscape gate */
.ka-rotate {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  padding-top: max(1rem, env(safe-area-inset-top, 0px));
  padding-bottom: max(1rem, env(safe-area-inset-bottom, 0px));
  background: rgba(2, 4, 10, 0.92);
  backdrop-filter: blur(10px);
}

.ka-rotate[hidden] {
  display: none !important;
}

.ka-rotate-card {
  width: min(26rem, 100%);
  padding: 1.25rem 1.1rem 1.1rem;
  border: 1px solid rgba(56, 189, 248, 0.45);
  border-radius: 4px;
  background: linear-gradient(180deg, #0c1520 0%, #080c12 100%);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.55);
  text-align: center;
}

.ka-rotate-phone {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  margin-bottom: 0.65rem;
  font-size: 2rem;
  line-height: 1;
  animation: ka-rotate-nudge 1.6s ease-in-out infinite;
}

.ka-rotate-arrow {
  color: #7dd3fc;
  font-size: 1.6rem;
}

@keyframes ka-rotate-nudge {
  0%,
  100% { transform: rotate(-8deg); }
  50% { transform: rotate(82deg); }
}

.ka-rotate-lead {
  margin: 0.5rem 0 1rem;
  font-size: 0.95rem;
  line-height: 1.45;
  color: #cbd5e1;
}

.ka-rotate-card .ka-btn {
  width: 100%;
  margin-bottom: 0.45rem;
  min-height: 48px;
}

.ka-rotate-card .ka-disclaimer {
  margin-top: 0.55rem;
}

.ka-hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}

/* Mortal Kombat–style Commander headshot toast (bottom-right) */
.ka-toasty {
  position: absolute;
  right: 0.55rem;
  bottom: 3.4rem;
  z-index: 12;
  display: flex;
  align-items: flex-end;
  gap: 0.45rem;
  max-width: min(14rem, 46vw);
  padding: 0.35rem 0.45rem 0.4rem;
  border: 2px solid #fbbf24;
  border-radius: 4px 4px 0 4px;
  background: linear-gradient(165deg, rgba(12, 18, 28, 0.96), rgba(40, 20, 8, 0.94));
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.55),
    0 10px 28px rgba(0, 0, 0, 0.55),
    0 0 22px rgba(251, 191, 36, 0.35);
  transform: translateX(120%) scale(0.85);
  opacity: 0;
  pointer-events: none;
}

.ka-toasty.is-on {
  animation: ka-toasty-pop 1.85s cubic-bezier(0.2, 1.2, 0.3, 1) forwards;
}

.ka-toasty-img {
  width: 64px;
  height: 72px;
  object-fit: cover;
  object-position: center top;
  border-radius: 3px;
  border: 1px solid rgba(251, 191, 36, 0.55);
  flex-shrink: 0;
  filter: saturate(1.15) contrast(1.05);
}

.ka-toasty-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
  padding-bottom: 0.15rem;
}

.ka-toasty-kicker {
  font-family: "Share Tech Mono", monospace;
  font-size: 0.52rem;
  letter-spacing: 0.14em;
  color: #7dd3fc;
}

.ka-toasty-line {
  font-family: "Barlow Condensed", system-ui, sans-serif;
  font-weight: 800;
  font-size: clamp(1.05rem, 3.2vw, 1.45rem);
  letter-spacing: 0.06em;
  color: #fbbf24;
  text-shadow: 0 0 12px rgba(251, 191, 36, 0.55);
  line-height: 1.05;
}

@keyframes ka-toasty-pop {
  0% {
    opacity: 0;
    transform: translateX(120%) scale(0.7) rotate(6deg);
  }
  12% {
    opacity: 1;
    transform: translateX(0) scale(1.08) rotate(-2deg);
  }
  22% {
    transform: translateX(0) scale(1) rotate(0deg);
  }
  78% {
    opacity: 1;
    transform: translateX(0) scale(1) rotate(0deg);
  }
  100% {
    opacity: 0;
    transform: translateX(110%) scale(0.9) rotate(4deg);
  }
}

/* Night Shade shame toast — slides in from the left */
.ka-toasty-ns {
  right: auto;
  left: 0.55rem;
  border-color: #e879f9;
  border-radius: 4px 4px 4px 0;
  background: linear-gradient(195deg, rgba(18, 10, 28, 0.96), rgba(50, 12, 40, 0.94));
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.55),
    0 10px 28px rgba(0, 0, 0, 0.55),
    0 0 22px rgba(232, 121, 249, 0.4);
  transform: translateX(-120%) scale(0.85);
  flex-direction: row-reverse;
  text-align: right;
}

.ka-toasty-ns .ka-toasty-img {
  border-color: rgba(232, 121, 249, 0.6);
  filter: saturate(1.2) contrast(1.05) hue-rotate(-8deg);
}

.ka-toasty-ns .ka-toasty-kicker {
  color: #f0abfc;
}

.ka-toasty-ns .ka-toasty-line {
  color: #f9a8d4;
  text-shadow: 0 0 12px rgba(244, 114, 182, 0.55);
}

.ka-toasty-ns.is-on {
  animation: ka-toasty-ns-pop 1.95s cubic-bezier(0.2, 1.2, 0.3, 1) forwards;
}

@keyframes ka-toasty-ns-pop {
  0% {
    opacity: 0;
    transform: translateX(-120%) scale(0.7) rotate(-6deg);
  }
  12% {
    opacity: 1;
    transform: translateX(0) scale(1.08) rotate(2deg);
  }
  22% {
    transform: translateX(0) scale(1) rotate(0deg);
  }
  78% {
    opacity: 1;
    transform: translateX(0) scale(1) rotate(0deg);
  }
  100% {
    opacity: 0;
    transform: translateX(-110%) scale(0.9) rotate(-4deg);
  }
}

@media (max-width: 900px) {
  .ka-toasty {
    bottom: 2.6rem;
    right: 0.35rem;
    max-width: min(12.5rem, 52vw);
  }

  .ka-toasty-ns {
    left: 0.35rem;
    right: auto;
    max-width: min(12.5rem, 52vw);
  }

  .ka-toasty-img {
    width: 52px;
    height: 58px;
  }

  .ka-toasty-line {
    font-size: 1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ka-toasty.is-on,
  .ka-toasty-ns.is-on {
    animation: none;
    opacity: 1;
    transform: none;
  }
}

.ka-cross {
  position: absolute;
  left: 0;
  top: 0;
  width: 44px;
  height: 44px;
  /* Positioned via JS translate3d for snappy mouse tracking (no left/top layout) */
  transform: translate3d(-9999px, -9999px, 0);
  will-change: transform;
  border: 2px solid rgba(56, 189, 248, 0.95);
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5), 0 0 12px rgba(56, 189, 248, 0.45);
  pointer-events: none;
  contain: layout style;
}

.ka-cross::before,
.ka-cross::after {
  content: "";
  position: absolute;
  background: rgba(56, 189, 248, 0.95);
}

.ka-cross::before {
  left: 50%;
  top: -8px;
  bottom: -8px;
  width: 1px;
  transform: translateX(-50%);
}

.ka-cross::after {
  top: 50%;
  left: -8px;
  right: -8px;
  height: 1px;
  transform: translateY(-50%);
}

.ka-timer,
.ka-wave {
  position: absolute;
  font-family: "Share Tech Mono", monospace;
  letter-spacing: 0.08em;
  text-shadow: 0 1px 3px #000;
}

/* Ammo + frags: top-left under wave — clear of bottom civ tip */
.ka-ammo-stack {
  position: absolute;
  left: 0.75rem;
  top: 2.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  z-index: 6;
  pointer-events: none;
}

.ka-ammo,
.ka-nades {
  font-family: "Share Tech Mono", monospace;
  letter-spacing: 0.08em;
  text-shadow: 0 1px 3px #000;
  font-weight: 700;
}

.ka-ammo {
  color: #e2e8f0;
  font-size: 0.78rem;
}

.ka-ammo.is-empty {
  color: #f87171;
  animation: ka-blink 0.6s step-end infinite;
}

.ka-ammo.is-reload {
  color: #38bdf8;
}

.ka-nades {
  color: #fbbf24;
  font-size: 0.72rem;
}

.ka-nades.is-empty {
  color: #64748b;
}

/* Friendly-fire tip: bottom-center of playfield */
.ka-civ-tip {
  position: absolute;
  left: 50%;
  bottom: 0.55rem;
  transform: translateX(-50%);
  z-index: 6;
  max-width: calc(100% - 1.25rem);
  padding: 0.28rem 0.65rem;
  border: 1px solid rgba(134, 239, 172, 0.45);
  background: rgba(6, 16, 12, 0.88);
  color: #86efac;
  font-family: "Share Tech Mono", monospace;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-align: center;
  text-shadow: 0 1px 2px #000;
  white-space: nowrap;
  pointer-events: none;
}

.ka-timer {
  right: 0.75rem;
  top: 0.75rem;
  color: #fbbf24;
  font-size: 1.4rem;
  font-weight: 700;
}

.ka-timer.ka-timer-bonus {
  color: #fde68a !important;
  text-shadow: 0 0 14px rgba(251, 191, 36, 0.75);
  animation: ka-timer-pulse 0.55s ease-in-out infinite;
}

@keyframes ka-timer-pulse {
  50% {
    filter: brightness(1.25);
  }
}

.ka-end-bite h2 {
  color: #f87171 !important;
}

.ka-end-megwin h2 {
  color: #38bdf8 !important;
}

.ka-wave {
  left: 0.75rem;
  top: 0.75rem;
  color: #7dd3fc;
  font-size: 0.75rem;
}

.ka-combo {
  position: absolute;
  left: 50%;
  top: 26%;
  transform: translateX(-50%);
  font-family: "Share Tech Mono", monospace;
  font-size: 1rem;
  color: #f472b6;
  letter-spacing: 0.12em;
  opacity: 0;
  transition: opacity 0.15s;
}

.ka-combo.is-on {
  opacity: 1;
}

/* Radio sits mid-lower so it never sits under bottom banners */
.ka-radio {
  position: absolute;
  left: 0.75rem;
  right: 0.75rem;
  bottom: 5.25rem;
  font-family: "Share Tech Mono", monospace;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  color: #86efac;
  text-align: center;
  min-height: 1.2em;
  text-shadow: 0 1px 4px #000;
  z-index: 7;
  pointer-events: none;
}

.ka-float {
  position: absolute;
  left: 50%;
  top: 40%;
  transform: translate(-50%, -50%);
  font-family: "Share Tech Mono", monospace;
  font-size: 2rem;
  font-weight: 800;
  color: #fbbf24;
  text-shadow: 0 0 12px rgba(251, 191, 36, 0.8), 0 2px 0 #000;
  opacity: 0;
  pointer-events: none;
}

.ka-float.is-pop {
  animation: ka-pop 0.55s ease-out forwards;
}

.ka-float.is-neg {
  color: #f87171;
  text-shadow: 0 0 12px rgba(248, 113, 113, 0.85), 0 2px 0 #000;
}

.ka-btn-reload {
  border-color: #38bdf8;
  color: #7dd3fc;
}

.ka-btn-nade {
  border-color: #fbbf24;
  color: #fde68a;
}

.ka-btn-nade:not(:disabled):hover {
  background: rgba(251, 191, 36, 0.15);
}

.ka-btn-reload.is-urgent:not(:disabled) {
  border-color: #f87171;
  color: #fecaca;
  box-shadow: 0 0 0 1px rgba(248, 113, 113, 0.45), 0 0 14px rgba(248, 113, 113, 0.35);
  animation: ka-blink 0.7s step-end infinite;
}

.ka-btn-nade.is-empty-warn {
  border-color: #78716c;
  color: #a8a29e;
}

/* Warnings stay visible while condition is true (no auto-hide) */
.ka-warn {
  position: absolute;
  z-index: 6;
  display: none;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 0.9rem;
  border: 2px solid #f87171;
  background: rgba(40, 8, 8, 0.94);
  color: #fecaca;
  font-family: "Share Tech Mono", monospace;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-shadow: 0 1px 2px #000;
  box-shadow: 0 0 16px rgba(248, 113, 113, 0.4);
  pointer-events: none;
  opacity: 1;
}

.ka-warn.is-on {
  display: inline-flex;
}

/* Mag empty: upper center — above combo / not over radio */
.ka-warn-reload {
  left: 50%;
  top: 12%;
  transform: translateX(-50%);
}

/* Frags warning: bottom-right — clear of center radio + civ tip */
.ka-warn-frag {
  top: auto;
  left: auto;
  right: 0.55rem;
  bottom: 2.15rem;
  transform: none;
  border-color: #fbbf24;
  background: rgba(40, 28, 8, 0.94);
  color: #fde68a;
  box-shadow: 0 0 16px rgba(251, 191, 36, 0.4);
  max-width: min(14rem, calc(100% - 1rem));
  font-size: 0.65rem;
  padding: 0.35rem 0.55rem;
  letter-spacing: 0.08em;
}

.ka-warn-frag.is-on {
  transform: none;
}

/* One-shot attention when FRAG pressed while empty — banner stays after */
.ka-warn-frag.is-nudge {
  animation: ka-warn-nudge-br 0.7s ease-out 1;
}

@keyframes ka-warn-nudge-br {
  0% { transform: scale(1); box-shadow: 0 0 16px rgba(251, 191, 36, 0.4); }
  40% { transform: scale(1.05); box-shadow: 0 0 28px rgba(251, 191, 36, 0.75); }
  100% { transform: scale(1); box-shadow: 0 0 16px rgba(251, 191, 36, 0.4); }
}

.ka-warn-icon {
  font-size: 1.15rem;
  line-height: 1;
}

@keyframes ka-pop {
  0% { opacity: 0; transform: translate(-50%, -40%) scale(0.6); }
  20% { opacity: 1; transform: translate(-50%, -55%) scale(1.15); }
  100% { opacity: 0; transform: translate(-50%, -90%) scale(1); }
}

.ka-screen {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  text-align: center;
  background:
    linear-gradient(180deg, rgba(5, 10, 18, 0.72), rgba(5, 10, 18, 0.92)),
    url("assets/killcam-hud/arena/bg-pitch.jpg") center / cover;
}

.ka-screen-dim {
  background: rgba(5, 10, 18, 0.82);
}

.ka-screen.is-hidden,
.ka-screen[hidden] {
  display: none !important;
}

.ka-kicker {
  margin: 0 0 0.4rem;
  font-family: "Share Tech Mono", monospace;
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  color: #7dd3fc;
}

.ka-screen h1,
.ka-screen h2 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.6rem, 5vw, 2.4rem);
  letter-spacing: 0.06em;
  color: #f0f9ff;
  text-shadow: 0 0 24px rgba(56, 189, 248, 0.35);
}

.ka-lead {
  margin: 0 0 0.85rem;
  max-width: 32rem;
  color: #94a3b8;
  line-height: 1.45;
  font-size: 1.05rem;
}

.ka-howto-box {
  margin: 0.65rem 0 0.85rem;
  max-width: 26rem;
  width: 100%;
  text-align: left;
  border: 1px solid rgba(56, 189, 248, 0.22);
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.28);
  padding: 0.35rem 0.55rem;
}

.ka-howto-box summary {
  cursor: pointer;
  font-family: "Share Tech Mono", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  color: #7dd3fc;
  padding: 0.45rem 0.2rem;
  list-style: none;
  min-height: 40px;
  display: flex;
  align-items: center;
}

.ka-howto-box summary::-webkit-details-marker {
  display: none;
}

.ka-howto-box summary::before {
  content: "▸ ";
  color: #38bdf8;
}

.ka-howto-box[open] summary::before {
  content: "▾ ";
}

.ka-howto {
  margin: 0 0 0.5rem;
  padding: 0 0 0.25rem;
  list-style: none;
  font-family: "Share Tech Mono", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: #cbd5e1;
  line-height: 1.7;
}

.ka-deploy {
  min-width: min(16rem, 90%);
  min-height: 52px;
  font-size: 0.9rem;
  margin: 0.35rem 0 0.5rem;
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.35);
}

.ka-start-dock {
  display: none;
  flex: 1 1 100%;
  min-height: 52px;
  font-size: 0.9rem;
  order: -1;
}

/* Title / end: show big DEPLOY dock; hide combat buttons */
body.ka-on-title .ka-start-dock,
body.ka-on-end .ka-start-dock {
  display: inline-flex;
}

body.ka-on-title .ka-play-only,
body.ka-on-end .ka-play-only {
  display: none;
}

body.ka-playing .ka-start-dock,
body.ka-paused .ka-start-dock {
  display: none !important;
}

.ka-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.5rem 1.15rem;
  border: 1px solid rgba(56, 189, 248, 0.45);
  background: transparent;
  color: #e2e8f0;
  font-family: "Share Tech Mono", monospace;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  cursor: pointer;
  text-decoration: none;
  border-radius: 2px;
}

.ka-btn[hidden] {
  display: none !important;
}

.ka-btn-primary {
  background: linear-gradient(180deg, #38bdf8, #0284c7);
  border-color: #7dd3fc;
  color: #0b1220;
}

.ka-btn-primary:hover {
  filter: brightness(1.08);
}

.ka-btn-ghost:hover {
  border-color: #7dd3fc;
  color: #7dd3fc;
}

.ka-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.ka-disclaimer {
  margin: 0.85rem 0 0;
  font-size: 0.75rem;
  color: #64748b;
}

.ka-end-score {
  font-family: "Share Tech Mono", monospace;
  font-size: 1.1rem;
  color: #fbbf24;
  letter-spacing: 0.08em;
}

.ka-end-stats {
  font-family: "Share Tech Mono", monospace;
  font-size: 0.72rem;
  color: #94a3b8;
  letter-spacing: 0.06em;
}

.ka-end-quote {
  max-width: 28rem;
  color: #86efac;
  font-style: italic;
  line-height: 1.4;
}

.ka-end-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  justify-content: center;
  margin-top: 0.5rem;
}

.ka-pause-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 0.35rem;
}

/* Loadout picker — title screen (full) and end screen (compact) share this */
.ka-loadout {
  width: 100%;
  max-width: 34rem;
  margin: 0.5rem 0 0.65rem;
}

.ka-weapon-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.ka-weapon-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  width: 9.5rem;
  margin: 0;
  padding: 0.5rem;
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 4px;
  background: rgba(6, 12, 20, 0.7);
  color: #cbd5e1;
  font-family: "Share Tech Mono", monospace;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
  appearance: none;
}

.ka-weapon-card:hover {
  border-color: rgba(56, 189, 248, 0.6);
}

.ka-weapon-card.is-selected {
  border-color: #38bdf8;
  background: rgba(10, 22, 34, 0.85);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.4), 0 0 16px rgba(56, 189, 248, 0.3);
}

.ka-weapon-card.is-locked {
  opacity: 0.55;
  cursor: not-allowed;
}

.ka-weapon-thumb {
  width: 100%;
  height: 3.6rem;
  border-radius: 2px;
  background-size: cover;
  background-repeat: no-repeat;
  margin-bottom: 0.1rem;
}

.ka-weapon-name {
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  color: #7dd3fc;
}

.ka-weapon-card.is-selected .ka-weapon-name {
  color: #fbbf24;
}

.ka-weapon-stats {
  font-size: 0.6rem;
  color: #94a3b8;
  letter-spacing: 0.05em;
}

.ka-weapon-blurb {
  font-size: 0.6rem;
  color: #86efac;
  line-height: 1.3;
}

.ka-weapon-card.is-locked .ka-weapon-blurb {
  color: #fbbf24;
}

.ka-loadout-msg {
  min-height: 1.1em;
  margin: 0.35rem 0 0;
  font-family: "Share Tech Mono", monospace;
  font-size: 0.65rem;
  color: #fbbf24;
  text-align: center;
  opacity: 0;
}

.ka-loadout-msg.is-flash {
  animation: ka-loadout-flash 1.6s ease-out;
}

@keyframes ka-loadout-flash {
  0% { opacity: 0; }
  15% { opacity: 1; }
  80% { opacity: 1; }
  100% { opacity: 0; }
}

.ka-loadout-compact .ka-weapon-card {
  width: 7.6rem;
  padding: 0.4rem;
}

.ka-loadout-compact .ka-weapon-thumb {
  height: 2.6rem;
}

.ka-loadout-compact .ka-weapon-stats,
.ka-loadout-compact .ka-weapon-blurb {
  font-size: 0.56rem;
}

.ka-unlock-flash {
  margin: 0.4rem 0 0;
  padding: 0.4rem 0.7rem;
  border: 1px solid rgba(251, 191, 36, 0.5);
  border-radius: 3px;
  background: rgba(40, 28, 8, 0.5);
  color: #fde68a;
  font-family: "Share Tech Mono", monospace;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-align: center;
}

@media (max-width: 900px) {
  .ka-weapon-card {
    width: 7.6rem;
    padding: 0.4rem;
  }
  .ka-weapon-thumb {
    height: 2.8rem;
  }
  .ka-weapon-name {
    font-size: 0.7rem;
  }
  .ka-weapon-stats,
  .ka-weapon-blurb {
    font-size: 0.56rem;
  }
  .ka-loadout-compact .ka-weapon-card {
    width: 6.6rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ka-loadout-msg.is-flash {
    animation: none;
    opacity: 1;
  }
}

.ka-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.7rem;
  padding-bottom: max(0.55rem, env(safe-area-inset-bottom, 0px));
  border-top: 1px solid rgba(148, 163, 184, 0.12);
  background: rgba(0, 0, 0, 0.35);
}

.ka-hint {
  font-family: "Share Tech Mono", monospace;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  color: #64748b;
}

.ka-side {
  border: 1px solid rgba(56, 189, 248, 0.25);
  background: rgba(8, 14, 24, 0.92);
  border-radius: 3px;
  padding: 0.9rem 0.95rem 1.1rem;
}

.ka-side-details {
  margin: 0;
}

.ka-side-details > summary {
  cursor: pointer;
  list-style: none;
  font-family: "Share Tech Mono", monospace;
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  color: #7dd3fc;
  margin: 0 0 0.55rem;
  min-height: 44px;
  display: flex;
  align-items: center;
}

.ka-side-details > summary::-webkit-details-marker {
  display: none;
}

.ka-side-details > summary::before {
  content: "▸ ";
  color: #64748b;
}

.ka-side-details[open] > summary::before {
  content: "▾ ";
}

.ka-side h3 {
  margin: 0 0 0.55rem;
  font-family: "Share Tech Mono", monospace;
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  color: #7dd3fc;
}

.ka-side ul {
  margin: 0 0 0.85rem;
  padding-left: 1.1rem;
  color: #94a3b8;
  line-height: 1.5;
  font-size: 0.95rem;
}

.ka-side blockquote {
  margin: 0 0 0.65rem;
  padding: 0.55rem 0.7rem;
  border-left: 2px solid rgba(56, 189, 248, 0.4);
  background: rgba(0, 0, 0, 0.25);
}

.ka-side blockquote p {
  margin: 0 0 0.25rem;
  color: #e2e8f0;
}

.ka-side cite {
  font-family: "Share Tech Mono", monospace;
  font-size: 0.65rem;
  color: #64748b;
  font-style: normal;
}

.ka-side-foot {
  margin: 0.85rem 0 0;
  font-family: "Share Tech Mono", monospace;
  font-size: 0.65rem;
  letter-spacing: 0.06em;
  color: #64748b;
}

.ka-side-foot a {
  color: #7dd3fc;
  text-decoration: none;
}

/* ---- Mobile / tablet layout ---- */
/* Always keep 16:9 — never stretch the 1280×720 buffer into portrait. */
@media (max-width: 900px) {
  .ka-main {
    padding: 0.35rem 0.35rem 0.75rem;
    gap: 0.5rem;
  }

  .ka-stage-wrap {
    box-shadow: none;
  }

  .ka-viewport {
    aspect-ratio: 16 / 9;
    width: 100%;
    max-height: min(42dvh, calc(100vw * 9 / 16));
    margin-inline: auto;
  }

  /* Title/end screens need room — DEPLOY must stay tappable */
  body.ka-on-title .ka-viewport,
  body.ka-on-end .ka-viewport {
    aspect-ratio: auto;
    min-height: min(68dvh, 520px);
    max-height: min(72dvh, 640px);
    height: auto;
  }

  /* MEG boss needs a tall stage on phones — 42dvh hides the fight */
  body.ka-meg-phase .ka-viewport,
  body.ka-playing.ka-meg-phase .ka-viewport {
    aspect-ratio: auto !important;
    width: 100%;
    min-height: min(72dvh, 580px);
    max-height: min(80dvh, 720px);
    height: auto;
  }

  body.ka-meg-phase .ka-side {
    display: none;
  }

  body.ka-on-title .ka-screen,
  body.ka-on-end .ka-screen {
    position: absolute;
    inset: 0;
    min-height: 100%;
    justify-content: flex-start;
    padding-bottom: 1rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    z-index: 20;
  }

  /* End overlay must fully cover canvas freeze-frame on mobile */
  body.ka-on-end .ka-screen#ka-end {
    background:
      linear-gradient(180deg, rgba(5, 10, 18, 0.92), rgba(5, 10, 18, 0.97)),
      url("assets/killcam-hud/arena/bg-pitch.jpg") center / cover;
  }

  body.ka-on-end .ka-hud {
    display: none !important;
  }

  .ka-deploy {
    width: min(20rem, 100%);
    min-height: 54px;
    position: sticky;
    bottom: 0.5rem;
    z-index: 2;
  }

  .ka-start-dock {
    min-height: 54px;
  }

  .ka-chrome {
    font-size: 0.55rem;
    padding: 0.35rem 0.5rem;
  }

  .ka-controls {
    position: sticky;
    bottom: 0;
    z-index: 15;
    gap: 0.35rem;
    padding: 0.45rem 0.45rem calc(0.45rem + env(safe-area-inset-bottom, 0px));
    background: rgba(5, 8, 14, 0.96);
    backdrop-filter: blur(8px);
  }

  .ka-controls .ka-btn {
    flex: 1 1 calc(50% - 0.4rem);
    min-height: 48px;
    font-size: 0.7rem;
    padding: 0.55rem 0.4rem;
  }

  .ka-hint {
    flex: 1 1 100%;
    text-align: center;
    order: 10;
  }

  .ka-cross {
    width: 56px;
    height: 56px;
    border-width: 2.5px;
  }

  .ka-screen {
    padding: 0.75rem 0.65rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    justify-content: flex-start;
    padding-top: 0.75rem;
  }

  .ka-screen h1,
  .ka-screen h2 {
    font-size: clamp(1.25rem, 6vw, 1.75rem);
  }

  .ka-lead {
    font-size: 0.9rem;
  }

  .ka-howto {
    font-size: 0.65rem;
    text-align: left;
    max-width: 22rem;
  }

  .ka-howto-desk {
    display: none;
  }

  .ka-side {
    padding: 0.55rem 0.7rem 0.85rem;
  }

  .ka-side-details:not([open]) > *:not(summary) {
    display: none;
  }

  .ka-radio {
    bottom: 3.8rem;
    /* Was smaller than the desktop size — the opposite of what a smaller,
       farther-held screen needs. Bump past desktop instead of under it. */
    font-size: 0.85rem;
    max-width: 92%;
  }

  .ka-civ-tip {
    white-space: normal;
    font-size: 0.78rem;
    letter-spacing: 0.05em;
    bottom: 0.35rem;
    padding: 0.25rem 0.5rem;
  }

  .ka-warn-frag {
    bottom: 1.7rem;
    font-size: 0.78rem;
    max-width: min(13rem, 52vw);
  }

  .ka-warn-reload {
    top: 14%;
    font-size: 0.68rem;
    padding: 0.35rem 0.55rem;
  }

  .ka-ammo-stack {
    top: 1.75rem;
  }

  .ka-timer {
    font-size: 1.05rem;
  }

  .ka-brand span {
    max-width: 11rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .ka-nav a:nth-child(n + 3) {
    display: none;
  }

  .ka-scan {
    opacity: 0.18;
  }
}

/* Landscape phones: immersive 16:9 playfield */
@media (max-width: 900px) and (orientation: landscape) {
  body.ka-meg-phase .ka-viewport,
  body.ka-playing.ka-meg-phase .ka-viewport {
    min-height: min(78dvh, 420px);
    max-height: min(82dvh, 480px);
  }

  .ka-top {
    padding: 0.2rem 0.5rem;
    padding-top: max(0.15rem, env(safe-area-inset-top, 0px));
  }

  .ka-brand span {
    max-width: 9rem;
  }

  .ka-main {
    padding: 0.2rem 0.35rem 0.3rem;
    gap: 0.3rem;
    max-width: none;
  }

  .ka-side {
    display: none;
  }

  .ka-chrome {
    padding: 0.25rem 0.45rem;
    font-size: 0.52rem;
  }

  .ka-viewport {
    aspect-ratio: 16 / 9;
    width: min(100%, calc((100dvh - 7.5rem) * 16 / 9));
    max-height: min(calc(100dvh - 7.5rem), calc(100vw * 9 / 16));
    margin-inline: auto;
  }

  .ka-controls {
    position: static;
    padding: 0.3rem 0.35rem calc(0.3rem + env(safe-area-inset-bottom, 0px));
    gap: 0.3rem;
  }

  .ka-controls .ka-btn {
    flex: 1 1 auto;
    min-width: 4.5rem;
    min-height: 42px;
    font-size: 0.65rem;
    padding: 0.4rem 0.35rem;
  }

  .ka-hint {
    font-size: 0.7rem;
  }

  /* During active play: almost full-bleed landscape */
  body.ka-playing.ka-landscape .ka-top {
    display: none;
  }

  body.ka-playing.ka-landscape .ka-viewport {
    width: min(100vw - 0.5rem, calc((100dvh - 3.6rem) * 16 / 9));
    max-height: min(calc(100dvh - 3.6rem), calc(100vw * 9 / 16));
  }

  body.ka-playing.ka-landscape .ka-chrome {
    display: none;
  }
}

@media (min-width: 901px) {
  .ka-howto-touch {
    display: none;
  }

  .ka-side-details > summary {
    pointer-events: none;
  }

  .ka-side-details > summary::before {
    content: none;
  }

  /* Title/end screens carry variable content (loadout picker, unlock banner, etc.) —
     don't lock them to the 16:9 gameplay aspect ratio, or a short/narrow desktop
     window clips content instead of showing it. Mirrors the mobile-only fix below. */
  body.ka-on-title .ka-viewport,
  body.ka-on-end .ka-viewport {
    aspect-ratio: auto;
    width: 100%;
    min-height: min(560px, 80vh);
    max-height: min(780px, 92vh);
    height: auto;
  }

  body.ka-on-title .ka-screen,
  body.ka-on-end .ka-screen {
    position: absolute;
    inset: 0;
    justify-content: flex-start;
    padding-top: 2rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ka-rec-dot,
  .ka-float.is-pop,
  .ka-warn-frag.is-nudge,
  .ka-btn-reload.is-urgent:not(:disabled),
  .ka-rotate-phone,
  .ka-toasty.is-on {
    animation: none !important;
  }
}

@media (hover: none) and (pointer: coarse) {
  .ka-viewport.is-playing .ka-cross {
    /* slightly larger reticle for fingers */
    width: 60px;
    height: 60px;
  }
}

/* Post-killcam: transient "save/share this shot" pill, floats above the radio line */
.ka-save-shot {
  position: absolute;
  left: 50%;
  /* Cap as a % of the viewport's own height too — a fixed rem offset reads fine on a
     tall desktop canvas but can land mid-field on the short mobile "idle" viewport. */
  bottom: 8.2rem;
  bottom: min(8.2rem, 22%);
  z-index: 8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 44px;
  padding: 0.5rem 1.05rem;
  border: 1px solid rgba(56, 189, 248, 0.55);
  border-radius: 999px;
  background: rgba(8, 14, 24, 0.92);
  color: #7dd3fc;
  font-family: "Share Tech Mono", monospace;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  white-space: nowrap;
  cursor: pointer;
  opacity: 0;
  transform: translate(-50%, 10px);
  pointer-events: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45), 0 0 16px rgba(56, 189, 248, 0.25);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.ka-save-shot[hidden] {
  display: none !important;
}

.ka-save-shot.is-on {
  opacity: 1;
  transform: translate(-50%, 0);
  pointer-events: auto;
}

.ka-save-shot:hover {
  border-color: #7dd3fc;
  background: rgba(14, 24, 38, 0.96);
}

@media (max-width: 900px) {
  .ka-save-shot {
    bottom: 6.4rem;
    bottom: min(6.4rem, 20%);
    font-size: 0.66rem;
    padding: 0.5rem 0.85rem;
    max-width: calc(100% - 1.5rem);
  }
}

@media (max-width: 900px) and (orientation: landscape) {
  .ka-save-shot {
    bottom: 4.4rem;
    bottom: min(4.4rem, 18%);
    min-height: 40px;
    font-size: 0.62rem;
    padding: 0.4rem 0.75rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ka-save-shot {
    transition: opacity 0.15s ease;
  }
  .ka-save-shot.is-on {
    transform: translate(-50%, 0);
  }
}

/* Killcam replay: hide the live reticle/HUD text so the cinematic reads clean */
body.ka-killcam .ka-cross,
body.ka-killcam .ka-ammo-stack,
body.ka-killcam .ka-timer,
body.ka-killcam .ka-wave,
body.ka-killcam .ka-combo,
body.ka-killcam .ka-civ-tip,
body.ka-killcam .ka-save-shot {
  opacity: 0 !important;
  pointer-events: none !important;
  transition: opacity 0.15s ease;
}

@media (prefers-reduced-motion: reduce) {
  body.ka-killcam .ka-cross,
  body.ka-killcam .ka-ammo-stack,
  body.ka-killcam .ka-timer,
  body.ka-killcam .ka-wave,
  body.ka-killcam .ka-combo,
  body.ka-killcam .ka-civ-tip {
    transition: none;
  }
}
