:root {
  color-scheme: dark;
  --bg: #120d16;
  --panel: rgba(26, 22, 32, 0.88);
  --panel-strong: #21182a;
  --text: #fff7ec;
  --muted: #cdbbc5;
  --hot: #ff4f7b;
  --warm: #ffb23f;
  --mint: #4de2b0;
  --blue: #64b5ff;
  --bad: #ff5c5c;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 18% 16%, rgba(255, 79, 123, 0.26), transparent 28%),
    radial-gradient(circle at 82% 10%, rgba(77, 226, 176, 0.18), transparent 24%),
    linear-gradient(135deg, #100a16 0%, #231129 48%, #16171f 100%);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button {
  border: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

input {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  position: relative;
  isolation: isolate;
}

.app-shell::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: 0.34;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 46px 46px;
  animation: drift 18s linear infinite;
}

.screen {
  min-height: 100vh;
  display: none;
  padding: clamp(18px, 4vw, 44px);
}

.screen.is-active {
  display: grid;
}

.screen--menu,
.screen--result {
  place-items: center;
}

.menu-layout {
  width: min(1120px, 100%);
  display: grid;
  grid-template-columns: minmax(260px, 0.84fr) minmax(300px, 1.16fr);
  gap: clamp(24px, 5vw, 64px);
  align-items: center;
}

.sign-wrap {
  min-height: 430px;
  display: grid;
  place-items: center;
  position: relative;
}

.sign-steam {
  position: absolute;
  width: min(64vw, 360px);
  aspect-ratio: 1;
  border: 2px solid rgba(255, 178, 63, 0.45);
  border-radius: 50%;
  filter: blur(1px);
  animation: pulseGlow 2.8s ease-in-out infinite;
}

.sign-plate {
  width: min(70vw, 330px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 6px solid var(--warm);
  background: radial-gradient(circle, #3b1f28 0 42%, #1b1220 43% 100%);
  box-shadow:
    0 0 28px rgba(255, 178, 63, 0.68),
    inset 0 0 34px rgba(255, 79, 123, 0.28);
  font-size: clamp(7rem, 20vw, 12rem);
  animation: floatPlate 3.8s ease-in-out infinite;
}

.menu-copy {
  background: linear-gradient(180deg, rgba(37, 24, 45, 0.86), rgba(20, 15, 24, 0.74));
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(22px, 4vw, 38px);
  backdrop-filter: blur(14px);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--mint);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.neon-title {
  margin: 0;
  font-size: clamp(3rem, 10vw, 6.8rem);
  line-height: 0.9;
  letter-spacing: 0;
  text-transform: uppercase;
  text-shadow:
    0 0 10px rgba(255, 79, 123, 0.95),
    0 0 30px rgba(255, 79, 123, 0.68),
    0 0 54px rgba(255, 178, 63, 0.34);
  animation: neonFlicker 4.5s infinite;
}

.subtitle {
  max-width: 56ch;
  margin: 18px 0 24px;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.2rem);
  line-height: 1.55;
}

.player-field {
  display: grid;
  gap: 8px;
  margin-bottom: 20px;
}

.player-field span {
  color: var(--text);
  font-weight: 800;
}

.player-field input {
  width: 100%;
  min-height: 52px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  padding: 0 14px;
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.player-field input::placeholder {
  color: rgba(205, 187, 197, 0.72);
}

.player-field input:focus {
  border-color: var(--mint);
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 0 0 3px rgba(77, 226, 176, 0.14);
}

.difficulty-card {
  margin: 0 0 20px;
  padding: 0;
  border: 0;
}

.difficulty-card legend {
  margin-bottom: 12px;
  color: var(--text);
  font-weight: 800;
}

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

.difficulty,
.secondary-action {
  min-height: 70px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 12px;
  text-align: left;
  transition: transform 150ms ease, background 150ms ease, border-color 150ms ease;
}

.difficulty:hover,
.difficulty:focus-visible,
.secondary-action:hover,
.secondary-action:focus-visible {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.13);
  outline: none;
}

.difficulty.is-selected {
  border-color: var(--warm);
  background: linear-gradient(135deg, rgba(255, 178, 63, 0.3), rgba(255, 79, 123, 0.18));
  box-shadow: 0 0 20px rgba(255, 178, 63, 0.18);
}

.difficulty span {
  display: block;
  font-weight: 850;
}

.difficulty small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.35;
}

.primary-action {
  width: 100%;
  min-height: 56px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--hot), var(--warm));
  color: #1b0c10;
  font-weight: 900;
  box-shadow: 0 16px 36px rgba(255, 79, 123, 0.25);
  transition: transform 150ms ease, filter 150ms ease;
}

.primary-action:hover,
.primary-action:focus-visible {
  transform: translateY(-2px) scale(1.01);
  filter: saturate(1.12);
  outline: none;
}

.how-to {
  margin-top: 18px;
  color: var(--muted);
  line-height: 1.5;
}

.how-to p {
  margin: 0 0 8px;
}

.microcopy {
  color: var(--warm);
  font-weight: 800;
}

.leaderboard {
  margin-top: 18px;
  padding: 14px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.11);
}

.leaderboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.leaderboard-header h2 {
  margin: 0;
  font-size: 1rem;
  text-transform: uppercase;
}

.leaderboard-header span {
  color: var(--mint);
  font-size: 0.82rem;
  font-weight: 850;
}

.leaderboard-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 0;
  list-style: none;
}

.leaderboard-list li {
  min-height: 38px;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius);
  background: rgba(18, 10, 24, 0.48);
}

.leaderboard-rank {
  color: var(--warm);
  font-weight: 950;
}

.leaderboard-name {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard-score {
  color: var(--mint);
  font-weight: 950;
}

.leaderboard-empty {
  color: var(--muted);
}

.screen--game {
  grid-template-rows: auto minmax(420px, 1fr);
  gap: 14px;
}

.hud {
  width: min(1180px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: rgba(16, 12, 22, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.26);
}

.hud h2 {
  margin: 0;
  font-size: clamp(1.1rem, 3vw, 1.6rem);
  text-transform: uppercase;
}

.hud-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(86px, auto));
  gap: 8px;
}

.hud-stats span {
  min-height: 48px;
  display: grid;
  place-items: center;
  padding: 7px 10px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 0.74rem;
  text-transform: uppercase;
}

.hud-stats strong {
  color: var(--text);
  font-size: 1.15rem;
  line-height: 1;
}

.stop-action {
  min-height: 48px;
  border-radius: var(--radius);
  background: rgba(255, 92, 92, 0.16);
  border: 1px solid rgba(255, 92, 92, 0.5);
  color: #ffdede;
  padding: 0 14px;
  font-weight: 900;
  white-space: nowrap;
  transition: transform 150ms ease, background 150ms ease;
}

.stop-action:hover,
.stop-action:focus-visible {
  transform: translateY(-2px);
  background: rgba(255, 92, 92, 0.24);
  outline: none;
}

.game-board {
  width: min(1180px, 100%);
  height: min(76vh, 720px);
  min-height: 420px;
  margin: 0 auto;
  overflow: hidden;
  position: relative;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.14);
  background:
    linear-gradient(180deg, rgba(18, 10, 24, 0.25), rgba(18, 10, 24, 0.82)),
    repeating-linear-gradient(90deg, #271629 0 38px, #321a30 38px 76px);
  box-shadow: var(--shadow);
  touch-action: manipulation;
  user-select: none;
}

.shop-backdrop {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.neon-line {
  position: absolute;
  left: -10%;
  width: 120%;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, var(--mint), var(--hot), transparent);
  filter: drop-shadow(0 0 12px currentColor);
  animation: scanLine 5s linear infinite;
}

.neon-line--one {
  top: 18%;
}

.neon-line--two {
  top: 33%;
  animation-delay: -2s;
}

.counter {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 28%;
  background:
    linear-gradient(180deg, rgba(255, 178, 63, 0.15), rgba(0, 0, 0, 0.24)),
    repeating-linear-gradient(90deg, #39202c 0 44px, #2a1822 44px 88px);
  border-top: 4px solid rgba(255, 178, 63, 0.58);
}

.menu-sign {
  position: absolute;
  right: clamp(12px, 4vw, 42px);
  top: clamp(16px, 5vw, 46px);
  max-width: 230px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: #160e1d;
  border: 1px solid rgba(77, 226, 176, 0.55);
  color: var(--mint);
  font-size: clamp(0.78rem, 2.2vw, 1rem);
  font-weight: 850;
  text-align: center;
  box-shadow: 0 0 18px rgba(77, 226, 176, 0.24);
}

.target {
  position: absolute;
  display: grid;
  place-items: center;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.72), rgba(255, 178, 63, 0.16) 32%, rgba(31, 14, 24, 0.84) 72%);
  border: 2px solid rgba(255, 255, 255, 0.44);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.34), 0 0 22px var(--glow);
  font-size: calc(var(--size) * 0.58);
  transform: translate(-50%, -50%) scale(0.3) rotate(-8deg);
  animation: popIn 160ms ease-out forwards, wiggle 840ms ease-in-out infinite;
  touch-action: manipulation;
}

.target.is-bad {
  background: radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.65), rgba(255, 92, 92, 0.18) 34%, rgba(38, 12, 16, 0.9) 72%);
}

.target.is-hit {
  animation: hitPop 240ms ease-out forwards;
  pointer-events: none;
}

.target.is-missed {
  animation: missOut 220ms ease-in forwards;
  pointer-events: none;
}

.target-label {
  position: absolute;
  top: -28px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  padding: 4px 7px;
  border-radius: 999px;
  background: rgba(9, 7, 12, 0.84);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 900;
}

.floating-score {
  position: absolute;
  z-index: 5;
  color: var(--mint);
  font-size: 1.1rem;
  font-weight: 950;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
  animation: scoreFloat 620ms ease-out forwards;
  pointer-events: none;
}

.floating-score.is-negative {
  color: var(--bad);
}

.toast {
  position: absolute;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  width: min(92%, 440px);
  min-height: 42px;
  display: grid;
  place-items: center;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: rgba(18, 10, 24, 0.78);
  color: var(--warm);
  font-weight: 850;
  text-align: center;
  opacity: 0;
  transition: opacity 180ms ease, transform 180ms ease;
  pointer-events: none;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, -4px);
}

.result-panel {
  width: min(680px, 100%);
  padding: clamp(24px, 5vw, 42px);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(37, 24, 45, 0.94), rgba(18, 13, 22, 0.9));
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: var(--shadow);
  animation: resultIn 360ms ease-out;
}

.result-panel h2 {
  margin: 0;
  font-size: clamp(2.5rem, 10vw, 5.5rem);
  line-height: 0.95;
  text-transform: uppercase;
}

.result-text {
  margin: 16px 0 24px;
  color: var(--muted);
  font-size: 1.12rem;
  line-height: 1.55;
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 0 0 22px;
}

.result-stats div {
  min-height: 92px;
  display: grid;
  place-items: center;
  padding: 12px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.08);
}

.result-stats dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.result-stats dd {
  margin: 0;
  color: var(--text);
  font-size: 1.8rem;
  font-weight: 950;
}

.result-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.secondary-action {
  text-align: center;
  font-weight: 850;
}

@keyframes drift {
  to {
    background-position: 92px 46px;
  }
}

@keyframes pulseGlow {
  50% {
    transform: scale(1.06);
    opacity: 0.62;
  }
}

@keyframes floatPlate {
  50% {
    transform: translateY(-14px) rotate(2deg);
  }
}

@keyframes neonFlicker {
  0%, 94%, 100% {
    opacity: 1;
  }

  95% {
    opacity: 0.72;
  }

  97% {
    opacity: 0.96;
  }
}

@keyframes scanLine {
  from {
    transform: translateX(-20%);
  }

  to {
    transform: translateX(20%);
  }
}

@keyframes popIn {
  to {
    transform: translate(-50%, -50%) scale(1) rotate(0deg);
  }
}

@keyframes wiggle {
  50% {
    transform: translate(-50%, -50%) scale(1.04) rotate(5deg);
  }
}

@keyframes hitPop {
  to {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.6) rotate(16deg);
  }
}

@keyframes missOut {
  to {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.2) rotate(-22deg);
  }
}

@keyframes scoreFloat {
  to {
    opacity: 0;
    transform: translateY(-44px);
  }
}

@keyframes resultIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }
}

@media (max-width: 820px) {
  .menu-layout {
    grid-template-columns: 1fr;
  }

  .sign-wrap {
    min-height: 230px;
  }

  .sign-plate {
    width: min(58vw, 220px);
  }

  .hud {
    grid-template-columns: 1fr;
  }

  .hud-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .game-board {
    height: 70vh;
    min-height: 430px;
  }
}

@media (max-width: 560px) {
  .screen {
    padding: 14px;
  }

  .menu-copy {
    padding: 18px;
  }

  .difficulty-grid,
  .result-stats,
  .result-actions {
    grid-template-columns: 1fr;
  }

  .difficulty {
    min-height: 62px;
  }

  .hud-stats span {
    min-height: 44px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
