/* ============================================================================
   BLOB BATTLE - style.css
   The page around the game: it fills the whole window, removes every trace of
   browser furniture, and draws the on-screen joystick and SPLIT button for
   phones and tablets.

   Every colour and shape here is written by hand - no web fonts, no icon
   packs, no images. Nothing in this file asks the network for anything.
   ========================================================================== */

:root {
  --ink: #05080f;
  --panel: #0b1430;
  --cyan: #4fd1ff;
  --green: #37e06a;
  --pink: #ff6ec7;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--ink);
  color: #eaf3ff;
  font-family: Verdana, "Trebuchet MS", Arial, sans-serif;
  /* Stop the browser turning a swipe into a scroll, a pinch into a zoom, or a
     long press into a text selection while somebody is playing. */
  touch-action: none;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* The box the canvas lives in. Phaser sizes the canvas to fill it. */
#game {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
}

#game canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

/* ---------------------------------------------------------------------------
   Touch controls. Everything in here is invisible unless the page has been
   given the .touch class by main.js.
   --------------------------------------------------------------------------- */

#touch-controls {
  position: fixed;
  inset: 0;
  display: none;
  pointer-events: none;
  z-index: 20;
}

body.touch #touch-controls { display: block; }

/* The joystick: a soft ring you drag your thumb inside. It follows wherever
   you first press, so you never have to find it exactly. */
#stick {
  position: absolute;
  left: 24px;
  bottom: 24px;
  width: 148px;
  height: 148px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%,
              rgba(79, 209, 255, 0.16), rgba(79, 209, 255, 0.04) 62%,
              rgba(79, 209, 255, 0) 72%);
  border: 2px solid rgba(79, 209, 255, 0.28);
  pointer-events: auto;
  touch-action: none;
}

#stick-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 62px;
  height: 62px;
  margin: 0;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle at 38% 34%,
              rgba(255, 255, 255, 0.95), rgba(120, 220, 255, 0.55) 60%,
              rgba(60, 140, 220, 0.35));
  border: 2px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  transition: transform 70ms linear;
}

#btn-split {
  position: absolute;
  right: 26px;
  bottom: 62px;
  width: 108px;
  height: 108px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.5);
  background: radial-gradient(circle at 36% 30%, #8bffb0, var(--green) 55%, #1f9c46);
  color: #062012;
  font-family: inherit;
  font-size: 19px;
  font-weight: bold;
  letter-spacing: 1px;
  pointer-events: auto;
  touch-action: none;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45);
}

#btn-split.pressed {
  transform: scale(0.94);
  filter: brightness(1.15);
}

/* A touch device held upright gets a gentle nudge to turn sideways. This is a
   pure CSS media query, so it is always right even mid-resize, with no
   JavaScript to keep in step. */
#rotate-hint {
  position: fixed;
  left: 50%;
  top: 10px;
  transform: translateX(-50%);
  z-index: 40;
  display: none;
  margin: 0;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(11, 20, 48, 0.92);
  border: 2px solid rgba(79, 209, 255, 0.5);
  color: #cfe6ff;
  font-size: 13px;
}

@media (orientation: portrait) and (max-width: 619px) {
  /* A full-width banner across the very top. The game's HUD measures this
     element and moves its own top row down underneath it, so the two can never
     overlap. */
  body.touch #rotate-hint {
    display: block;
    left: 0;
    right: 0;
    top: 0;
    transform: none;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    border-top: 0;
    text-align: center;
  }
}

/* ---------------------------------------------------------------------------
   The moment before the first frame: a wobbling blob, so the page never looks
   broken while the textures are being drawn.
   --------------------------------------------------------------------------- */
#loading {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  background: var(--ink);
  transition: opacity 320ms ease;
}

#loading.hidden {
  opacity: 0;
  pointer-events: none;
}

#loading p {
  margin: 0;
  font-size: 15px;
  letter-spacing: 5px;
  color: #6d88b8;
}

.loading-blob {
  width: 74px;
  height: 74px;
  border-radius: 50%;
  background: radial-gradient(circle at 36% 32%, #d6ffbe, var(--green) 55%, #16843a);
  box-shadow: 0 0 42px rgba(55, 224, 106, 0.5);
  animation: blob-bounce 1.15s ease-in-out infinite;
}

@keyframes blob-bounce {
  0%, 100% { transform: scale(1, 1) translateY(0); }
  35%      { transform: scale(1.12, 0.88) translateY(4px); }
  70%      { transform: scale(0.92, 1.1) translateY(-8px); }
}

/* ---------------------------------------------------------------------------
   The plain-words error box.
   --------------------------------------------------------------------------- */

#load-error {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 80;
  display: none;
  max-width: 460px;
  padding: 22px 26px;
  border-radius: 16px;
  background: #1a0e1c;
  border: 2px solid #ff6ec7;
  color: #ffd9ef;
  font-size: 15px;
  line-height: 1.55;
  text-align: center;
}

#load-error.show { display: block; }

/* Respect anybody who has asked their system to calm animations down. */
@media (prefers-reduced-motion: reduce) {
  .loading-blob { animation: none; }
  #loading { transition: none; }
}

/* On a short, wide phone screen the controls tuck in a little tighter. */
@media (max-height: 430px) {
  #stick { width: 118px; height: 118px; left: 16px; bottom: 16px; }
  #stick-knob { width: 52px; height: 52px; }
  #btn-split { width: 88px; height: 88px; right: 18px; bottom: 34px; font-size: 16px; }
}
