:root {
  --bg-1: #07111f;
  --bg-2: #140c2d;
  --panel: rgba(9, 18, 34, 0.74);
  --panel-border: rgba(127, 231, 255, 0.24);
  --text: #e9f7ff;
  --muted: rgba(233, 247, 255, 0.72);
  --accent: #54f1ff;
  --accent-2: #ff4fd8;
  --accent-3: #8dff62;
  --danger: #ff7769;
  --shadow: 0 18px 80px rgba(0, 0, 0, 0.44);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top, rgba(84, 241, 255, 0.16), transparent 28%),
    radial-gradient(circle at 80% 15%, rgba(255, 79, 216, 0.2), transparent 22%),
    linear-gradient(135deg, var(--bg-1), var(--bg-2));
  color: var(--text);
  font-family: "Trebuchet MS", "Arial Black", sans-serif;
  overflow-x: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: -20%;
  pointer-events: none;
  z-index: 0;
}

body::before {
  background:
    repeating-linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.03) 0,
      rgba(255, 255, 255, 0.03) 2px,
      transparent 2px,
      transparent 12px
    );
  animation: drift 22s linear infinite;
  opacity: 0.28;
}

body::after {
  background:
    radial-gradient(circle at 10% 20%, rgba(84, 241, 255, 0.14), transparent 20%),
    radial-gradient(circle at 88% 72%, rgba(255, 79, 216, 0.1), transparent 18%),
    radial-gradient(circle at 50% 100%, rgba(141, 255, 98, 0.08), transparent 22%);
  animation: pulse 14s ease-in-out infinite alternate;
}

@keyframes drift {
  from { transform: translateY(-2%) rotate(0.2deg); }
  to { transform: translateY(2%) rotate(-0.2deg); }
}

@keyframes pulse {
  from { transform: scale(1); opacity: 0.62; }
  to { transform: scale(1.08); opacity: 0.94; }
}

.app-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
}

.game-layout {
  width: min(1180px, 100%);
  display: grid;
  gap: 16px;
  flex: 1;
}

.ad-banner {
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed rgba(255, 255, 255, 0.24);
  border-radius: 18px;
  background: rgba(7, 14, 28, 0.5);
  backdrop-filter: blur(10px);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.ad-banner.hidden,
.interstitial.hidden {
  opacity: 0;
  transform: scale(0.96);
  pointer-events: none;
  display: none;
}

.hud-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  border: 1px solid var(--panel-border);
  border-radius: 22px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.brand h1 {
  margin: 0;
  font-size: clamp(1.4rem, 2.8vw, 2.2rem);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.scoreboard {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
}

.score-box {
  min-width: 126px;
  text-align: center;
}

.score-box span {
  display: block;
  font-size: 0.76rem;
  color: var(--muted);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.score-box strong {
  display: block;
  margin-top: 2px;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  color: var(--accent);
  text-shadow: 0 0 18px rgba(84, 241, 255, 0.55);
}

.versus {
  font-size: 0.92rem;
  letter-spacing: 0.4em;
  color: var(--muted);
  text-transform: uppercase;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}

button {
  border: 0;
  border-radius: 14px;
  padding: 12px 16px;
  font: inherit;
  font-size: 0.9rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text);
  background: linear-gradient(135deg, rgba(84, 241, 255, 0.18), rgba(255, 79, 216, 0.18));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12), 0 10px 24px rgba(0, 0, 0, 0.22);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

button:hover,
button:focus-visible {
  transform: translateY(-1px);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18), 0 14px 28px rgba(0, 0, 0, 0.3);
  outline: none;
}

button.secondary {
  background: rgba(255, 255, 255, 0.05);
}

.arena-card {
  position: relative;
  border-radius: 28px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background:
    linear-gradient(180deg, rgba(6, 13, 24, 0.96), rgba(3, 7, 14, 0.92)),
    linear-gradient(120deg, rgba(84, 241, 255, 0.08), transparent 40%, rgba(255, 79, 216, 0.08));
  box-shadow: var(--shadow);
}

.canvas-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 260px;
  overflow: hidden;
  touch-action: none;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at center, rgba(19, 27, 49, 0.92), rgba(4, 8, 15, 0.98));
}

.overlay,
.winner-modal {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: linear-gradient(180deg, rgba(2, 6, 12, 0.54), rgba(2, 6, 12, 0.82));
  backdrop-filter: blur(10px);
  transition: opacity 0.2s ease;
}

.overlay.hidden,
.winner-modal.hidden {
  opacity: 0;
  pointer-events: none;
}

.panel {
  width: min(560px, 100%);
  padding: 26px 24px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  background: rgba(4, 10, 20, 0.88);
  box-shadow: var(--shadow);
  text-align: center;
}

.panel h2 {
  margin: 0 0 10px;
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.panel p {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.55;
}

.difficulty-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 20px 0 16px;
}

.difficulty-button {
  padding: 18px 12px;
}

.difficulty-button span {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  letter-spacing: 0.12em;
  margin-top: 6px;
}

.info-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 16px;
}

.info-chip {
  padding: 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

.status-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px 18px;
  color: var(--muted);
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.status-group {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.status-pill {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
}

.winner-modal .panel {
  width: min(620px, 100%);
}

.winner-modal h2 strong {
  color: var(--accent);
  text-shadow: 0 0 18px rgba(84, 241, 255, 0.48);
}

.interstitial {
  margin: 18px 0 0;
  padding: 18px;
  border-radius: 18px;
  border: 1px dashed rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.winner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 18px;
}

.footer-note {
  text-align: center;
  color: rgba(233, 247, 255, 0.55);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.site-footer {
  width: 100%;
  padding: 1.75rem 1.5rem;
  background: rgba(0, 0, 0, 0.35);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  text-align: center;
  margin-top: 2rem;
  font-family: 'Inter', system-ui, sans-serif;
  letter-spacing: normal;
  text-transform: none;
}

.site-footer .footer-content {
  max-width: 1180px;
  margin: 0 auto;
}

.site-footer .footer-content p {
  color: rgba(233, 247, 255, 0.45);
  margin-bottom: 0.85rem;
  font-size: 0.88rem;
}

.site-footer .footer-links {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  flex-wrap: wrap;
}

.site-footer .footer-links a {
  color: #a78bfa;
  text-decoration: none;
  font-size: 0.88rem;
  transition: color 0.25s;
}

.site-footer .footer-links a:hover {
  color: #c4b5fd;
}

@media (max-width: 860px) {
  .hud-panel {
    justify-content: center;
  }

  .scoreboard,
  .toolbar {
    width: 100%;
    justify-content: center;
  }

  .difficulty-grid,
  .info-grid {
    grid-template-columns: 1fr;
  }

  button,
  .toggle {
    min-height: 48px;
  }
}

@media (max-width: 560px) {
  .app-shell {
    padding: 12px;
  }

  .ad-banner {
    min-height: 72px;
  }

  .canvas-wrap {
    min-height: 220px;
  }

  .status-bar {
    justify-content: center;
  }
}
