/* ============================================================
   DOT STRATEGY — style.css
   Clean, minimal, no-framework stylesheet.
   All visual elements live here; no inline styles in HTML/JS.
   ============================================================ */
@font-face {
  font-family: 'RobotoBold';
  src: url('typo/subset-Roboto-Bold.woff2') format('woff2');
  font-weight: bold;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'RobotoLight';
  src: url('typo/subset-Roboto-Light.woff2') format('woff2');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Perfograma';
  src: url('typo/perfograma.regular.woff2') format('opentype');
}

body,
html {
  height: 100%;
  max-width: 100vw;
  overflow: hidden;
}

body.home {
  display: grid;
  place-items: center;
}

#intro {
  position: relative;
}

.home-intro {
  img {
    width: 96vw;
    height: auto;
  }
}

a.home-btn {
  position: absolute;
  top: 68%;
  left: 50%;
  transform: translateX(-50%) translateY(-50%);
  font-size: 2rem;
  animation: pulsate-fwd 1s ease-in-out infinite both;

  font-size: 3rem;
}

@keyframes pulsate-fwd {
  0% {
    transform: translateX(-50%) translateY(-50%) scale(1)
  }

  50% {
    transform: translateX(-50%) translateY(-50%) scale(1.1)
  }

  100% {
    transform: translateX(-50%) translateY(-50%) scale(1)
  }
}

@keyframes pulsate-scale {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.1);
  }

  100% {
    transform: scale(1);
  }
}

/* ------------------------------------------------------------
   RESET & BASE
   ------------------------------------------------------------ */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;

  display: flex;
  flex-direction: column;
  align-items: center;

  background: #f2f2f2;
}

#arena {
  margin-top: auto;
  margin-bottom: auto;
}

/* ------------------------------------------------------------
   TYPOGRAPHY
   ------------------------------------------------------------ */
h1 {
  font-family: 'Perfograma', sans-serif;
  font-size: 3rem;
  letter-spacing: 0.375rem;
  font-weight: bold;
  margin: 0;
}

.title-dots {
  color: #4a90e2;
  /* blue */
}

.title-war {
  color: #e24a4a;
  /* red */
}

.subtitle {
  font-size: 0.8rem;
  letter-spacing: 0.1875rem;
  color: #888888;
}

/* ------------------------------------------------------------
   HEADS-UP DISPLAY (HUD)
   ------------------------------------------------------------ */
#header {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0.1rem 1.5rem;
  background: #ffffff;
  border-bottom: 1px solid #e0e0e0;
}

#hud {
  position: static;
  display: flex;
  justify-content: flex-start;
  gap: 1.5rem;
  z-index: 500;
}

/* ------------------------------------------------------------
   TOP-RIGHT CORNER (Energy + Buy)
   ------------------------------------------------------------ */
#corner {
  position: static;
  display: flex;
  justify-content: flex-end;
  z-index: 500;
}

#buy-group {
  display: flex;
  align-items: center;
  gap: 2rem;
}


.home-btn,
#corner button {
  font-family: 'RobotoBold', sans-serif;
  transition: background 0.15s, transform 0.1s, opacity 0.15s;

  padding: 0.6rem 1.2rem;
  text-decoration: none;
  font-size: 1.4rem;
  /* same as .hud-value */
  letter-spacing: 0;

  background: #2f6df6;
  color: #ffffff;

  border: none;
  border-radius: 0.6rem;

  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.home-btn:hover,
#corner button:hover,
#overlay-box button:hover {
  opacity: 0.6;
}


#corner button:hover {
  background: #2459c7;
}

#corner button:active {
  transform: scale(0.95);
}

.hud-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}

.hud-label {
  font-family: 'RobotoLight', sans-serif;
  font-size: 0.65rem;
  letter-spacing: 0.125rem;
  color: #888888;
  text-transform: uppercase;
}

.hud-value {
  font-family: 'RobotoBold', sans-serif;
  font-size: 1.4rem;
  font-weight: bold;
}

/* ------------------------------------------------------------
   STATUS LOG
   ------------------------------------------------------------ */
#log {
  font-family: 'RobotoLight', sans-serif;
  font-size: 0.8rem;
  color: #555555;
  letter-spacing: 0.0625rem;
  height: 1.125rem;
  text-align: center;
}

/* ------------------------------------------------------------
   CONTROLS
   ------------------------------------------------------------ */
#controls {
  display: flex;
  gap: 0.75rem;
}

#controls button {
  padding: 0.5rem 1.25rem;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.85rem;
  letter-spacing: 0.125rem;
  background: #111111;
  color: #ffffff;
  border: none;
  cursor: pointer;
  /* Smooth colour transition on hover */
  transition: background 0.15s;
}

#controls button:hover:not(:disabled) {
  opacity: 0.3;
}

#controls button:disabled {
  background: #aaaaaa;
  cursor: default;
}

/* ------------------------------------------------------------
   ARENA
   No grid — dots move freely in this open rectangle.
   ------------------------------------------------------------ */
#arena {
  position: relative;
  width: 40rem;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  background: #ffffff;
  overflow: hidden;
  cursor: crosshair;

  margin: auto 0;
  /* vertical centering only */
}

/* ------------------------------------------------------------
   DOTS
   All dot types (blue, red, plus) share these base rules.
   transition handles smooth movement; .attacking shortens
   the duration for the lunge animation.
   ------------------------------------------------------------ */
.dot {
  position: absolute;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  /* Centre the dot on its coordinates */
  transform: translate(-50%, -50%) rotate(var(--angle, 0deg));
  cursor: pointer;
  transition: none;
  z-index: 1;
}

/* Blue dots — player units */
.dot.blue {
  background: url('assets/blue-dot.svg') center/cover no-repeat;
}

/* Red dots — enemy units */
.dot.red {
  background: url('assets/red-dot.svg') center/cover no-repeat;
}

.dot.bigred {
  width: 7rem;
  height: 7rem;
  background: url('assets/red-dot.svg') center/cover no-repeat;
}

.dot.bigred .hp-bar-wrap {
  width: 7rem;
  position: absolute;
  z-index: 10;
}

/* "+" pickup — gives the player bonus dots */
.dot.plus {
  cursor: not-allowed;
  background: url('assets/plus-button.svg') center/cover no-repeat;
  color: #111111;
  font-size: 1rem;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Speed up the transition during an attack lunge
   so the dot feels snappy rather than floaty */
.dot.attacking {
  transition:
    left 0.10s linear,
    top 0.10s linear;
}

/* ------------------------------------------------------------
   HP BARS
   Float above every blue and red dot.
   ------------------------------------------------------------ */
.hp-bar-wrap {
  position: absolute;
  width: 2rem;
  height: 0.25rem;
  background: #dddddd;
  transform: translate(-50%, -50%);
  z-index: 100;
  pointer-events: none;
}

.bigred-hp {
  width: 7rem;
}

.hp-bar {
  height: 100%;
  background: #44cc44;
  /* Smooth width change as HP drops */
  transition: width 0.2s;
}

/* PLUS HP bar (yellow) */
.plus-hp .hp-bar {
  background: #ffcc00;
}

/* ------------------------------------------------------------
   GAME OVER / VICTORY OVERLAY
   ------------------------------------------------------------ */
#overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

/* Hidden by default; JS toggles this class */
#overlay.hidden {
  display: none;
}

#overlay-box {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

#overlay-title {
  font-size: 3rem;
  letter-spacing: 0.5rem;
  font-weight: bold;
  font-family: 'Perfograma', sans-serif;
}

#overlay-sub {
  font-size: 1rem;
  color: #555555;
  letter-spacing: 0.125rem;
}

#overlay-box button {
  animation: pulsate-scale 1s ease-in-out infinite both;
  width: 5rem;
  height: 5rem;

  background: url('assets/restart.svg') center/contain no-repeat;
  background-color: transparent;

  border: none;
  cursor: pointer;

  transition: transform 0.15s, opacity 0.15s;
}

#overlay-box button:hover {
  opacity: 0.3;
}

#overlay-box button:hover {
  transform: scale(1.1);
  opacity: 0.8;
}

/* --- BUY BUTTON (keeps it consistent with existing controls) --- */
#btn-buy:disabled {
  opacity: 0.6;
}

.aoe-ring {
  position: absolute;
  width: 12rem;
  height: 12rem;
  border-radius: 50%;
  border: 3rem solid rgba(83, 83, 83, 0.45);
  transform: translate(-50%, -50%);
  pointer-events: none;
  clip-path: polygon(50% 0%, 50% 50%, 100% 50%, 100% 0%);
  opacity: 0.4;
  transition: left 0.06s linear, top 0.06s linear, transform 0.15s ease-out;
}

@keyframes aoe-pulse {
  0% {
    opacity: 0.8;
  }

  100% {
    opacity: 0.3;
  }
}

/* ============================================================
   AOE RING LABEL
   ============================================================ */
.aoe-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.7rem;
  font-weight: bold;
  color: #ffffff;
  letter-spacing: 0.0625rem;
  text-shadow: 0 0 0.1875rem rgba(0, 0, 0, 0.8);
  pointer-events: none;
  white-space: nowrap;
}

#buy-group #energy {
  font-size: 1.4rem;
}

/* ------------------------------------------------------------
   RESTART TITLE (overlay)
   ------------------------------------------------------------ */
.restart-title {
  font-family: 'Perfograma', sans-serif;
  font-size: 3rem;
  letter-spacing: 0.375rem;
}

.restart-blue {
  color: #4a90e2;
}

.restart-red {
  color: #e24a4a;
}

.hud-icon {
  width: 2rem;
  height: 2rem;
  object-fit: contain;
}

.dots-count {
  font-size: 2.2rem;
}

#buy-group img {
  width: 5rem;
  height: 5rem;
}

#game-title {
  display: block;
  margin: 1rem auto;
  width: 30rem;
}

/* --- FORCE TOUR GUIDE FONT --- */
.tg-dialog,
.tg-dialog * {
  font-family: 'RobotoLight', sans-serif !important;
}

.tg-dialog .tg-title {
  font-family: 'RobotoBold', sans-serif !important;
}

.tg-dialog .tg-button {
  font-family: 'RobotoBold', sans-serif !important;
}