@font-face {
  font-family: 'Madani Arabic';
  src: url('public/fonts/MadaniArabic-Black.ttf') format('truetype');
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'SentaSans';
  src: url('public/fonts/SentaSans-Regular.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #0a0e1a;
  --bg-radial: #131a2a;
  --accent: #FC4C02;
  --accent-glow: rgba(252, 76, 2, 0.45);
  --text: #F2F2F2;
  --text-muted: #8a91a3;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  overflow-x: hidden;
}

body {
  background: radial-gradient(ellipse at center, var(--bg-radial) 0%, var(--bg) 70%);
  color: var(--text);
  font-family: 'SentaSans', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  min-height: 100vh;
  min-height: 100svh;
  padding: clamp(16px, 3vw, 32px) 16px;
  gap: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Subtelne tło: arcade scanlines */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent 0,
    transparent 3px,
    rgba(255, 255, 255, 0.015) 3px,
    rgba(255, 255, 255, 0.015) 4px
  );
  pointer-events: none;
  z-index: 1;
}

.brand {
  display: flex;
  justify-content: center;
  z-index: 2;
}

.brand__logo {
  width: clamp(96px, 14vw, 140px);
  height: auto;
  mix-blend-mode: screen;
  filter: drop-shadow(0 0 32px var(--accent-glow));
}

.game {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  z-index: 2;
}

#game-canvas {
  background: transparent;
  display: block;
  max-width: min(510px, 90vw);
  height: auto;
  aspect-ratio: 1 / 1;
  filter: drop-shadow(0 0 48px rgba(252, 76, 2, 0.18));
  border-radius: 6px;
  touch-action: none;
}

.hud {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-family: 'Madani Arabic', system-ui, sans-serif;
  letter-spacing: 0.08em;
}

.hud__label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.hud__value {
  font-size: 1.15rem;
  color: var(--accent);
  text-shadow: 0 0 12px var(--accent-glow);
}

.instructions {
  color: var(--text-muted);
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  text-align: center;
}

.meta {
  text-align: center;
  z-index: 2;
}

.tagline {
  font-family: 'Madani Arabic', system-ui, sans-serif;
  font-size: clamp(0.95rem, 2.4vw, 1.2rem);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text);
}

.tagline__here {
  color: var(--accent);
  text-shadow: 0 0 16px var(--accent-glow);
}

.launch {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 8px;
  letter-spacing: 0.04em;
}

.launch strong {
  color: var(--text);
  letter-spacing: 0.06em;
  font-weight: 400;
}

/* Victory overlay */
.victory {
  position: fixed;
  inset: 0;
  background: rgba(10, 14, 26, 0.94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
  z-index: 100;
}

.victory.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.victory__confetti {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.victory__content {
  text-align: center;
  padding: 32px 24px;
  position: relative;
  z-index: 2;
  transform: scale(0.85);
  transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.victory.is-visible .victory__content {
  transform: scale(1);
}

.victory__title {
  font-family: 'Madani Arabic', system-ui, sans-serif;
  font-size: clamp(2.5rem, 9vw, 5.5rem);
  letter-spacing: 0.08em;
  color: var(--accent);
  text-shadow: 0 0 50px var(--accent-glow), 0 0 100px var(--accent-glow);
  margin-bottom: 24px;
}

.victory__logo {
  width: clamp(140px, 22vw, 200px);
  height: auto;
  margin: 12px 0 24px;
  mix-blend-mode: screen;
  filter: drop-shadow(0 0 28px var(--accent-glow));
}

.victory__tagline {
  font-family: 'Madani Arabic', system-ui, sans-serif;
  font-size: clamp(1rem, 2.6vw, 1.3rem);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.victory__tagline span {
  color: var(--accent);
}

.victory__launch {
  margin-top: 18px;
  color: var(--text-muted);
  font-size: 1rem;
  letter-spacing: 0.04em;
}

/* Static fallback (reduced motion / no JS) */
.static-fallback {
  display: none;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 16px;
}

.static-fallback h1 {
  font-family: 'Madani Arabic', system-ui, sans-serif;
  font-size: clamp(2rem, 6vw, 3.5rem);
  color: var(--accent);
  letter-spacing: 0.1em;
}

.static-fallback__tagline {
  font-family: 'Madani Arabic', system-ui, sans-serif;
  font-size: clamp(1rem, 2.4vw, 1.2rem);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.static-fallback__tagline span {
  color: var(--accent);
}

.static-fallback__launch {
  color: var(--text-muted);
}

/* prefers-reduced-motion: zero animacji */
@media (prefers-reduced-motion: reduce) {
  .game, .instructions {
    display: none;
  }

  .static-fallback {
    display: flex;
    z-index: 2;
  }

  .victory {
    transition: none;
  }

  body::before {
    display: none;
  }
}

/* Mobile */
@media (max-width: 600px) {
  body {
    padding: 16px 12px;
    gap: 12px;
  }

  .hud {
    font-size: 0.9rem;
  }

  .instructions {
    font-size: 0.75rem;
  }
}

@media (max-width: 380px) {
  #game-canvas {
    max-width: 95vw;
  }
}
