﻿:root {
  --bg: #040914;
  --panel: rgba(11, 22, 48, 0.72);
  --panel-border: rgba(115, 169, 255, 0.36);
  --text: #eaf1ff;
  --accent: #6fc2ff;
  --accent-2: #ffd95c;
}

* {
  box-sizing: border-box;
}

@keyframes fogShift {
  0% { background-position: 0% 0%, 100% 100%, 0 0; }
  100% { background-position: 100% 0%, 0% 100%, 0 0; }
}

@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 0 rgba(111, 194, 255, 0.18), 0 24px 44px rgba(0, 0, 0, 0.5); }
  50% { box-shadow: 0 0 34px rgba(111, 194, 255, 0.2), 0 28px 52px rgba(0, 0, 0, 0.55); }
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  font-family: "Trebuchet MS", "Franklin Gothic Medium", Verdana, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 20% 12%, rgba(42, 96, 182, 0.45), transparent 34%),
    radial-gradient(circle at 82% 80%, rgba(24, 56, 126, 0.55), transparent 36%),
    linear-gradient(180deg, #030713, #02040b 55%, #020308);
  background-size: 160% 160%, 160% 160%, 100% 100%;
  animation: fogShift 18s linear infinite alternate;
}

.game-wrap {
  text-align: center;
  background: var(--panel);
  backdrop-filter: blur(6px);
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  padding: 18px;
  animation: glowPulse 4.8s ease-in-out infinite;
}

h1 {
  margin: 0 0 12px;
  letter-spacing: 1px;
  font-weight: 800;
  text-transform: uppercase;
  text-shadow: 0 0 14px rgba(111, 194, 255, 0.35);
}

.hud {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 18px;
  margin-bottom: 12px;
  font-weight: 700;
}

button {
  border: 1px solid rgba(130, 185, 255, 0.6);
  border-radius: 10px;
  padding: 8px 12px;
  font-weight: 800;
  letter-spacing: 0.3px;
  cursor: pointer;
  color: #021025;
  background: linear-gradient(180deg, #a7d8ff, #66b8ff);
  transition: transform 0.15s ease, filter 0.15s ease;
}

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

button:active {
  transform: translateY(0);
  filter: brightness(0.96);
}

canvas {
  border: 2px solid #4f8fff;
  border-radius: 10px;
  background: #050a16;
  max-width: min(92vw, 560px);
  height: auto;
  box-shadow:
    inset 0 0 22px rgba(101, 161, 255, 0.18),
    0 0 26px rgba(70, 130, 255, 0.2);
}

.help {
  margin: 10px 0 0;
  opacity: 0.95;
  color: var(--accent-2);
  font-weight: 700;
  letter-spacing: 0.3px;
}


.tablet-btn.active {
  background: linear-gradient(180deg, #8dffc0, #59d892);
  color: #042014;
  border-color: rgba(141, 255, 192, 0.7);
}

.touch-controls {
  display: none;
  width: min(92vw, 320px);
  margin: 12px auto 2px;
  grid-template-columns: repeat(3, 1fr);
  grid-template-areas:
    ". up ."
    "left . right"
    ". down .";
  gap: 10px;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

body.tablet-mode .touch-controls {
  display: grid;
}

.touch-btn {
  border: 1px solid rgba(150, 205, 255, 0.65);
  border-radius: 12px;
  min-height: 56px;
  font-size: 24px;
  font-weight: 900;
  color: #d9ecff;
  background: linear-gradient(180deg, rgba(73, 128, 214, 0.8), rgba(35, 77, 148, 0.88));
  box-shadow: inset 0 0 10px rgba(173, 220, 255, 0.2);
  touch-action: none;
}

.touch-btn.up { grid-area: up; }
.touch-btn.left { grid-area: left; }
.touch-btn.right { grid-area: right; }
.touch-btn.down { grid-area: down; }

.touch-btn.active,
.touch-btn:active {
  transform: scale(0.98);
  filter: brightness(1.12);
  box-shadow: inset 0 0 14px rgba(214, 239, 255, 0.34);
}

@media (max-width: 900px) {
  .hud {
    gap: 10px;
    flex-wrap: wrap;
  }

  .touch-controls {
    width: min(95vw, 340px);
  }
}


.fullscreen-btn.active {
  background: linear-gradient(180deg, #ffe4a8, #f0b65f);
  color: #2b1800;
  border-color: rgba(255, 221, 153, 0.7);
}

.fullscreen-hint {
  position: fixed;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  max-width: min(92vw, 560px);
  background: rgba(6, 15, 36, 0.9);
  color: #d9ebff;
  border: 1px solid rgba(121, 177, 255, 0.55);
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.2px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 30;
}

.fullscreen-hint.visible {
  opacity: 1;
}
