﻿:root {
  color-scheme: dark;
  --panel: rgba(7, 13, 20, 0.72);
  --panel-strong: rgba(7, 13, 20, 0.9);
  --line: rgba(255, 255, 255, 0.14);
  --text: #f6fbff;
  --muted: #a8bac8;
  --accent: #39d0ff;
  --accent-2: #7cf78b;
  --danger: #ff5c70;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  background: #071016;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

canvas {
  display: block;
  width: 100vw;
  height: 100vh;
  cursor: crosshair;
  background: #183d31;
}

button {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  background: linear-gradient(135deg, var(--accent), #6fffe0);
  color: #041218;
  font: inherit;
  font-weight: 800;
  padding: 13px 24px;
  box-shadow: 0 12px 34px rgba(57, 208, 255, 0.24);
  transition: transform 140ms ease, filter 140ms ease;
}

button:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

button:active {
  transform: translateY(1px) scale(0.99);
}

#hud {
  position: fixed;
  top: 16px;
  left: 16px;
  width: min(470px, calc(100vw - 32px));
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(14px);
  z-index: 10;
}

.hud-top {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.label {
  display: block;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hud-top strong {
  display: block;
  margin-top: 2px;
  font-size: 22px;
  line-height: 1;
}

.bar {
  height: 8px;
  margin-top: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
}

.bar span {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, var(--accent-2), #ffe66d, var(--danger));
  border-radius: inherit;
  transition: width 120ms ease;
}

.small {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.screen {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 22px;
  background:
    radial-gradient(circle at 50% 38%, rgba(57, 208, 255, 0.16), transparent 30%),
    linear-gradient(135deg, rgba(5, 12, 18, 0.94), rgba(4, 9, 13, 0.98));
  z-index: 20;
}

.hidden {
  display: none;
}

.menu-card {
  width: min(560px, 100%);
  padding: 34px;
  text-align: center;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.38);
}

.menu-card.compact {
  width: min(430px, 100%);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1;
}

h1 {
  font-size: clamp(42px, 8vw, 76px);
}

h2 {
  font-size: clamp(30px, 6vw, 48px);
}

.intro {
  max-width: 42rem;
  margin: 18px auto 26px;
  color: #c8d8e3;
  font-size: 17px;
  line-height: 1.55;
}

@media (max-width: 650px) {
  #hud {
    top: 8px;
    left: 8px;
    width: calc(100vw - 16px);
    padding: 7px 8px 6px;
    border-radius: 8px;
  }

  .hud-top {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 5px;
  }

  .label {
    font-size: 8px;
    letter-spacing: 0.04em;
  }

  .hud-top strong {
    margin-top: 1px;
    font-size: 14px;
  }

  .bar {
    height: 4px;
    margin-top: 6px;
  }

  #hud .small {
    display: none;
  }

  .small {
    font-size: 12px;
  }

  .menu-card {
    padding: 26px 20px;
  }
}


.match-toast {
  position: fixed;
  left: 50%;
  top: 18%;
  transform: translateX(-50%);
  z-index: 30;
  min-width: min(420px, calc(100vw - 32px));
  padding: 18px 24px;
  text-align: center;
  color: #f6fbff;
  background: linear-gradient(135deg, rgba(5, 12, 18, 0.78), rgba(19, 39, 56, 0.72));
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(16px);
  animation: matchToast 1.8s ease forwards;
  pointer-events: none;
}

.match-toast span {
  display: block;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.match-toast strong {
  display: block;
  margin-top: 5px;
  font-size: clamp(28px, 7vw, 52px);
  line-height: 1;
}

@keyframes matchToast {
  0% { opacity: 0; transform: translate(-50%, -18px) scale(0.96); }
  16% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  76% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -12px) scale(0.98); }
}

#mobileControls {
  position: fixed;
  inset: auto 0 0 0;
  display: none;
  justify-content: space-between;
  align-items: end;
  padding: 18px;
  z-index: 15;
  pointer-events: none;
}

.touch-stick {
  position: relative;
  width: 118px;
  height: 118px;
  border-radius: 50%;
  background: rgba(7, 13, 20, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(10px);
  pointer-events: auto;
  touch-action: none;
}

.touch-stick span {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: linear-gradient(135deg, #39d0ff, #0066ff);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.32);
}

.touch-actions {
  display: grid;
  grid-template-columns: repeat(2, 58px);
  grid-template-rows: repeat(2, 58px);
  gap: 12px;
  pointer-events: auto;
}

.touch-actions button {
  width: 58px;
  height: 58px;
  padding: 0;
  border-radius: 50%;
  font-size: 18px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
  touch-action: manipulation;
}

#btnFire {
  grid-column: 2;
  grid-row: 1 / span 2;
  width: 72px;
  height: 72px;
  align-self: center;
  justify-self: center;
  font-size: 28px;
}

@media (pointer: coarse), (max-width: 900px) {
  #mobileControls {
    display: flex;
  }

  #hud {
    width: min(520px, calc(100vw - 16px));
  }
}



@media (pointer: coarse), (max-height: 520px) {
  #hud {
    top: 8px;
    left: 8px;
    width: min(430px, calc(100vw - 16px));
    padding: 6px 8px 5px;
  }

  .hud-top {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 5px;
  }

  .label {
    font-size: 8px;
    letter-spacing: 0.04em;
  }

  .hud-top strong {
    margin-top: 1px;
    font-size: 14px;
  }

  .bar {
    height: 4px;
    margin-top: 5px;
  }

  #hud .small {
    display: none;
  }
}

@media (orientation: landscape) and (max-height: 520px) {
  #hud {
    width: min(360px, calc(100vw - 16px));
    padding: 5px 7px 4px;
  }

  .hud-top strong {
    font-size: 13px;
  }

  .label {
    font-size: 7px;
  }

  .bar {
    height: 3px;
    margin-top: 4px;
  }
}
