/* Vattenkrig – the HUD, the menus and the touch controls over the 3D picture. The box itself, the corner buttons and
   the start screen's frame come from css/game-stage.css; everything HTML grows with the box (--ui, .ui-grows). */

.vk-stage {
  cursor: default;
}

.vk-stage.is-playing canvas {
  cursor: crosshair;
}

/* ---------- The HUD ---------- */

.vk-hud {
  align-items: flex-start;
}

.vk-points strong {
  color: var(--yellow);
}

.vk-time {
  font-size: 1.6rem;
  color: var(--cyan);
  text-shadow: 0 0 10px rgba(94, 240, 255, 0.6);
  font-variant-numeric: tabular-nums;
}

.vk-time.is-low {
  color: var(--magenta);
  animation: vk-blink 0.5s steps(2) infinite;
}

@keyframes vk-blink {
  to { opacity: 0.4; }
}

/* the battery (green) and the shield (turquoise), bottom left: an icon, a slanted bar and the number (owner,
   2026-10-16: "Grönt batteri, Turkos sköld"). The battery's number blinks magenta when low; over 100 (overladdat) the
   bar glows white; no shield = the shield's row is dim. */
.vk-charge {
  position: absolute;
  left: calc(0.9rem + var(--safe-left));
  bottom: calc(0.7rem + var(--safe-bottom));
  display: grid;
  gap: calc(0.25rem * var(--ui, 1));
  pointer-events: none;
  --battery: #ff3fb4;                 /* magenta = the hit indicator's colour (owner, 2026-10-20; was lime) */
  --shield: #22e6b0;
}

.vk-battery,
.vk-shield {
  display: flex;
  align-items: center;
  gap: calc(0.35rem * var(--ui, 1));
  color: var(--battery);
  font-weight: 900;
  font-style: italic;
  font-size: calc(1.15rem * var(--ui, 1));
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 8px currentColor;
}

.vk-shield {
  color: var(--shield);
  font-size: calc(0.95rem * var(--ui, 1));
}

.vk-charge svg {
  width: calc(1.3rem * var(--ui, 1));
  height: calc(1.3rem * var(--ui, 1));
  fill: currentColor;
  filter: drop-shadow(0 0 4px currentColor);
}

.vk-charge svg .vk-line {
  fill: none;
  stroke: #0e0a24;
  stroke-width: 2;
  stroke-linecap: round;
}

.vk-bar {
  position: relative;
  width: calc(7rem * var(--ui, 1));
  height: calc(0.85rem * var(--ui, 1));
  border: 2px solid currentColor;
  background: rgba(14, 10, 36, 0.55);
  transform: skewX(-12deg);
  overflow: hidden;
}

.vk-shield .vk-bar {
  height: calc(0.6rem * var(--ui, 1));
}

.vk-bar-fill {
  position: absolute;
  inset: 0;
  background: currentColor;
  box-shadow: 0 0 10px currentColor;
  transform: scaleX(1);
  transform-origin: left center;
  transition: transform 0.15s ease-out;
}

.vk-number {
  min-width: 2.2em;
}

.vk-charge.is-low .vk-battery .vk-number {
  color: #ffffff;
  animation: vk-blink 0.5s steps(2) infinite;
}

.vk-charge.is-over .vk-battery .vk-bar {
  border-color: #ffffff;
  box-shadow: 0 0 12px var(--battery);
}

.vk-shield.is-none {
  opacity: 0.35;
}

/* the weapons (bottom middle): only the ones you have show; the one in your hand is lit yellow; a tap/click chooses
   (touch screens too); the small number top right = its ammo, magenta when it is empty */
.vk-weapons {
  position: absolute;
  left: 50%;
  bottom: calc(0.9rem + var(--safe-bottom));
  display: flex;
  gap: calc(0.5rem * var(--ui, 1));
  transform: translateX(-50%);
  z-index: 2;
}

.vk-weapons[hidden] {
  display: none;
}

.vk-weapon {
  position: relative;
  width: calc(2.8rem * var(--ui, 1));
  height: calc(2.8rem * var(--ui, 1));
  padding: calc(0.35rem * var(--ui, 1));
  border: 2px solid rgba(94, 240, 255, 0.4);
  border-radius: 0.4rem;
  background: rgba(14, 10, 36, 0.55);
  color: rgba(94, 240, 255, 0.55);
  cursor: pointer;
  touch-action: none;
}

.vk-weapon svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.vk-weapon .vk-shine,
.vk-weapon .vk-spray {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
}

.vk-weapon.is-chosen {
  border-color: var(--yellow);
  color: var(--yellow);
  box-shadow: 0 0 10px rgba(255, 233, 77, 0.55);
}

.vk-weapon:not(.is-owned) {
  display: none;
}

.vk-weapon.is-empty {
  opacity: 0.45;
}

.vk-ammo {
  position: absolute;
  right: 0.15rem;
  top: 0;
  font-size: calc(0.72rem * var(--ui, 1));
  font-weight: 900;
  color: #ffffff;
  text-shadow: 0 0 4px #0e0a24, 0 0 2px #0e0a24;
}

.vk-weapon.is-empty .vk-ammo {
  color: var(--magenta);
}

.vk-weapon-key {
  position: absolute;
  left: 0.2rem;
  bottom: 0;
  font-size: calc(0.7rem * var(--ui, 1));
  font-weight: 900;
  color: inherit;
}

.vk-crosshair {
  position: absolute;
  left: 50%;
  top: 50%;
  width: calc(1.4rem * var(--ui, 1));
  height: calc(1.4rem * var(--ui, 1));
  margin: calc(-0.7rem * var(--ui, 1)) 0 0 calc(-0.7rem * var(--ui, 1));
  border: 2px solid rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(94, 240, 255, 0.6), inset 0 0 4px rgba(94, 240, 255, 0.6);
  pointer-events: none;
  display: none;
}

.vk-crosshair::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 3px;
  height: 3px;
  margin: -1.5px 0 0 -1.5px;
  background: var(--yellow);
  border-radius: 50%;
}

.is-playing .vk-crosshair {
  display: block;
}

/* the water pistol: a tighter crosshair (it sprays straight); a hit makes it flash */
.is-pistol .vk-crosshair {
  transform: scale(0.6);
}

.vk-crosshair.is-hit {
  animation: vk-hit 0.14s ease-out;
}

@keyframes vk-hit {
  from { border-color: var(--yellow); box-shadow: 0 0 14px var(--yellow); }
}

/* THE HIT MARK (owner, 2026-10-16: "svårt att se om man träffar"): an X round the crosshair, yellow for a hit, big
   and magenta when it soaked someone – shown on the room's word in a match together */
.vk-hitmark {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 2.2rem;
  height: 2.2rem;
  margin: -1.1rem 0 0 -1.1rem;
  pointer-events: none;
  opacity: 0;
  --mark: var(--yellow);
  background:
    linear-gradient(45deg, transparent 46%, var(--mark) 46% 54%, transparent 54%),
    linear-gradient(-45deg, transparent 46%, var(--mark) 46% 54%, transparent 54%);
  /* (the middle cut out, so the X stands round the crosshair, not over it) */
  -webkit-mask: radial-gradient(circle, transparent 0.45rem, #000 0.5rem);
  mask: radial-gradient(circle, transparent 0.45rem, #000 0.5rem);
  filter: drop-shadow(0 0 4px var(--mark));
}

.vk-hitmark.is-on {
  animation: vk-hitmark 0.28s ease-out;
}

.vk-hitmark.is-soak {
  --mark: var(--magenta);
  width: 3.4rem;
  height: 3.4rem;
  margin: -1.7rem 0 0 -1.7rem;
  animation-duration: 0.6s;
}

@keyframes vk-hitmark {
  from { opacity: 1; transform: scale(1.35); }
  25% { opacity: 1; transform: scale(1); }
  to { opacity: 0; transform: scale(1); }
}

/* short-circuited: VK: Labyrint's glitch over the picture (../vk-labyrint/breakdown.js, no crack), under the HUD */
.vk-stage .lb-breakdown {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* the cyan edge when you are wet (stronger the wetter), a flash when a balloon lands on you, a drip for a spray */
.vk-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 229, 255, 0.5) 100%);
  transition: opacity 0.4s;
}

.vk-vignette.is-flash {
  background: radial-gradient(ellipse at center, rgba(94, 240, 255, 0.25) 0%, rgba(0, 229, 255, 0.75) 100%);
  transition: none;
}

.vk-vignette.is-drip {
  background: radial-gradient(ellipse at center, transparent 45%, rgba(0, 229, 255, 0.65) 100%);
  transition: none;
}

/* WHERE a hit came from (owner, 2026-10-20, like VK: Labyrint): the edge glows on that side, 8 ways (vattenkrig.js
   showHitSide). Pure damage = a soft MAGENTA glow (the battery's colour); the shield took some = a faint magenta under
   a turquoise HONEYCOMB along the edge (the shield). A drip (a jet, a splash's edge) is weaker. */
.vk-hit-sides {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.vk-hit-side {
  --hit: rgba(255, 63, 180, 0.75);
  --hit-soft: rgba(255, 63, 180, 0.3);
  position: absolute;
  inset: 0;
  animation: vk-hit-side 0.7s ease-out forwards;
}

/* a drip: weaker and shorter */
.vk-hit-side.is-light {
  --peak: 0.5;
  animation-duration: 0.45s;
}

@keyframes vk-hit-side {
  0%, 25% { opacity: var(--peak, 1); }
  100% { opacity: 0; }
}

/* pure damage: soft and feathered */
.vk-hit-side.is-front { background: linear-gradient(to bottom, var(--hit), var(--hit-soft) 6%, transparent 15%); }
.vk-hit-side.is-back { background: linear-gradient(to top, var(--hit), var(--hit-soft) 6%, transparent 15%); }
.vk-hit-side.is-left { background: linear-gradient(to right, var(--hit), var(--hit-soft) 4%, transparent 10%); }
.vk-hit-side.is-right { background: linear-gradient(to left, var(--hit), var(--hit-soft) 4%, transparent 10%); }
.vk-hit-side.is-front-left { background: radial-gradient(22% 34% at 0 0, var(--hit), var(--hit-soft) 45%, transparent); }
.vk-hit-side.is-front-right { background: radial-gradient(22% 34% at 100% 0, var(--hit), var(--hit-soft) 45%, transparent); }
.vk-hit-side.is-back-left { background: radial-gradient(22% 34% at 0 100%, var(--hit), var(--hit-soft) 45%, transparent); }
.vk-hit-side.is-back-right { background: radial-gradient(22% 34% at 100% 100%, var(--hit), var(--hit-soft) 45%, transparent); }
.vk-hit-side.is-all { background: radial-gradient(ellipse at center, transparent 70%, var(--hit) 100%); }

/* the shield took some: a FAINT magenta (what still reached the battery) under a HONEYCOMB core in the shield's
   turquoise right along the edge – the Fribot's "Bikupa" pattern, so it reads as a shield (owner, 2026-10-20) */
.vk-hit-side.is-shield {
  --hit: rgba(255, 63, 180, 0.32);
  --hit-soft: rgba(255, 63, 180, 0.12);
  animation-duration: 0.55s;
}

.vk-hit-side.is-shield::after {
  content: "";
  position: absolute;
  inset: 0;
  background: url("images/skold-bikupa.png") repeat, rgba(34, 230, 176, 0.14);
  background-size: calc(3.4rem * var(--ui, 1)), auto;
  filter: drop-shadow(0 0 4px #22e6b0);
  -webkit-mask-image: var(--shield-band);
  mask-image: var(--shield-band);
}

.vk-hit-side.is-shield.is-front { --shield-band: linear-gradient(to bottom, #000, transparent 9%); }
.vk-hit-side.is-shield.is-back { --shield-band: linear-gradient(to top, #000, transparent 9%); }
.vk-hit-side.is-shield.is-left { --shield-band: linear-gradient(to right, #000, transparent 6%); }
.vk-hit-side.is-shield.is-right { --shield-band: linear-gradient(to left, #000, transparent 6%); }
.vk-hit-side.is-shield.is-front-left { --shield-band: radial-gradient(16% 25% at 0 0, #000 30%, transparent); }
.vk-hit-side.is-shield.is-front-right { --shield-band: radial-gradient(16% 25% at 100% 0, #000 30%, transparent); }
.vk-hit-side.is-shield.is-back-left { --shield-band: radial-gradient(16% 25% at 0 100%, #000 30%, transparent); }
.vk-hit-side.is-shield.is-back-right { --shield-band: radial-gradient(16% 25% at 100% 100%, #000 30%, transparent); }
.vk-hit-side.is-shield.is-all { --shield-band: radial-gradient(ellipse at center, transparent 78%, #000 100%); }

@media (prefers-reduced-motion: reduce) {
  .vk-hit-side { animation-timing-function: steps(2); }
}

/* big texts in the middle ("TRÄFF!", "GENOMBLÖT!", the countdown) and a smaller note under them */
.vk-big {
  position: absolute;
  left: 0;
  right: 0;
  top: 32%;
  margin: 0;
  text-align: center;
  font-style: italic;
  font-weight: 900;
  font-size: calc(2.6rem * var(--ui, 1));
  text-transform: uppercase;
  color: var(--yellow);
  text-shadow: 0 0 18px rgba(255, 233, 77, 0.7), 0 2px 0 rgba(14, 10, 36, 0.8);
  pointer-events: none;
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.2s, transform 0.2s;
}

.vk-big.is-shown {
  opacity: 1;
  transform: scale(1);
}

.vk-big.is-blue {
  color: var(--cyan);
  text-shadow: 0 0 18px rgba(94, 240, 255, 0.8), 0 2px 0 rgba(14, 10, 36, 0.8);
}

.vk-note {
  position: absolute;
  left: 0;
  right: 0;
  top: 44%;
  margin: 0;
  text-align: center;
  font-weight: 800;
  font-size: calc(1.1rem * var(--ui, 1));
  color: var(--text);
  text-shadow: 0 1px 0 rgba(14, 10, 36, 0.9);
  pointer-events: none;
}

.vk-note:empty {
  display: none;
}

/* the debug mode's corner (admin page -> Felsökning): small numbers under the points, for the owner to glance at */
.vk-debug {
  position: absolute;
  z-index: 6;
  top: calc(3.2rem + var(--safe-top));
  left: calc(0.6rem + var(--safe-left));
  margin: 0;
  padding: 0.2rem 0.4rem;
  font: 600 10px/1.25 ui-monospace, "Cascadia Mono", Consolas, "DejaVu Sans Mono", monospace;
  white-space: pre;
  color: #eafff9;
  background: rgba(8, 12, 36, 0.72);
  border-left: 2px solid #7ff2e2;
  pointer-events: none;
}

.vk-perf {
  top: auto;
  bottom: calc(5.2rem + var(--safe-bottom));   /* over the battery bars, bottom left */
  color: rgba(94, 240, 255, 0.85);
}

/* ---------- The menus ---------- */

.vk-overlay {
  z-index: 3;
}

/* the corner buttons (fullscreen, sound, pause) stay reachable over the menus (owner, 2026-10-15: they were behind
   the dark menu, only the keys F and M worked) */
.vk-stage .icon-button {
  z-index: 4;
}

.vk-overlay h2 {
  color: var(--cyan);
  text-shadow: 0 0 14px rgba(94, 240, 255, 0.6);
}

.vk-overlay p {
  margin-bottom: 1rem;
}

.vk-menu {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  width: min(100%, 30rem);
}

.vk-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.6rem;
}

.vk-label {
  margin: 0;
  color: var(--text-muted);
  font-weight: 800;
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
}

/* a choice row: small buttons, the chosen one yellow */
.vk-choice {
  font: inherit;
  font-weight: 800;
  padding: 0.35rem 0.8rem;
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(94, 240, 255, 0.4);
  cursor: pointer;
}

.vk-choice.is-chosen {
  color: var(--yellow);
  border-color: var(--yellow);
  box-shadow: 0 0 10px rgba(255, 233, 77, 0.35);
}

.vk-choice:disabled {
  opacity: 0.5;
  cursor: default;
}

/* the keys on the "how to play" screen */
.vk-keys {
  display: grid;
  grid-template-columns: auto auto;
  gap: 0.4rem 1rem;
  align-items: center;
  margin: 0;
  text-align: left;
}

.vk-keys dt {
  display: flex;
  gap: 0.25rem;
  justify-content: flex-end;
}

.vk-keys dd {
  margin: 0;
  color: var(--text-muted);
}

.vk-key {
  display: inline-block;
  min-width: 1.8rem;
  padding: 0.15rem 0.45rem;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-bottom-width: 4px;
  border-radius: 0.3rem;
  font-weight: 800;
  font-size: 0.85rem;
  text-align: center;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

/* the picture code (a match together): the four pictures with their names */
.vk-code {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
}

.vk-code .picture {
  width: 3.4rem;
  height: 3.4rem;
}

.vk-code-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* the players in the waiting room / the results */
.vk-players {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 22rem;
}

.vk-players li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.5rem;
  border-bottom: 1px solid rgba(94, 240, 255, 0.2);
  text-align: left;
}

.vk-players li.is-you {
  color: var(--yellow);
}

.vk-players li.is-gone {
  opacity: 0.5;
}

.vk-players .vk-dot {
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 50%;
  flex: none;
}

.vk-players .vk-name {
  flex: 1;
  font-weight: 800;
}

.vk-players .vk-about {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.vk-players .vk-score {
  font-weight: 900;
  color: var(--cyan);
  font-variant-numeric: tabular-nums;
}

.vk-kick {
  font: inherit;
  width: 1.6rem;
  height: 1.6rem;
  padding: 0;
  color: var(--magenta);
  background: transparent;
  border: 2px solid rgba(255, 63, 180, 0.5);
  cursor: pointer;
}

.vk-status {
  margin: 0;
  color: var(--yellow);
  font-weight: 800;
}

.vk-privacy {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.vk-privacy a {
  color: var(--cyan);
}

.vk-pad .picture-pad {
  max-width: 17rem;
}

.vk-pad .picture-button {
  padding: 0.4rem;
}

/* the written help under the box is for grown-ups (the game shows itself) */
.vk-about {
  max-width: 60rem;
  margin: 0.5rem auto 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* phones held upright: the box is 3:4 (the yard is tall enough to aim in); the HUD a little smaller */
@media (max-width: 600px) and (orientation: portrait) {
  .vk-stage {
    --aspect: 3 / 4;
  }
}
