:root {
  --bg: #070b10;
  --panel: rgba(10, 17, 25, .86);
  --line: rgba(133, 255, 181, .18);
  --green: #8dff9e;
  --cyan: #7ef6ff;
  --danger: #ff5e75;
  --text: #eefcf2;
  --muted: #8fa6a0;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 10%, #18352a 0, transparent 36%),
    linear-gradient(160deg, #05080c 0%, #0a1318 55%, #05080c 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  user-select: none;
}

body {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 18px;
}

button { font: inherit; }

.scanlines {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  opacity: .11;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 3px,
    rgba(255,255,255,.16) 4px
  );
}

#fxCanvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 15;
}

.game-shell {
  width: min(1100px, 100%);
  border: 1px solid var(--line);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(11, 20, 28, .96), rgba(5, 10, 15, .95));
  box-shadow:
    0 30px 90px rgba(0,0,0,.55),
    0 0 70px rgba(42, 255, 128, .08),
    inset 0 1px 0 rgba(255,255,255,.05);
  overflow: hidden;
  backdrop-filter: blur(12px);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 19px 22px 14px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--green);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .28em;
}

h1 {
  margin: 0;
  font-size: clamp(19px, 3vw, 34px);
  line-height: 1;
  letter-spacing: .035em;
  text-shadow: 0 0 22px rgba(141, 255, 158, .22);
}

.icon-btn {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,.035);
  color: white;
  cursor: pointer;
  transition: transform .15s, background .15s;
}

.icon-btn:hover { transform: translateY(-2px); background: rgba(255,255,255,.08); }

.hud {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--line);
  border-bottom: 1px solid var(--line);
}

.stat {
  min-width: 0;
  padding: 13px 18px;
  background: #091018;
}

.stat span {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.stat strong {
  color: var(--cyan);
  font-size: clamp(20px, 3vw, 30px);
  font-variant-numeric: tabular-nums;
}

.arena {
  position: relative;
  height: min(62vh, 620px);
  min-height: 390px;
  overflow: hidden;
  cursor: crosshair;
  isolation: isolate;
}

.arena::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(rgba(126, 246, 255, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(126, 246, 255, .045) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, transparent, #000 18%, #000);
}

.arena-bg {
  position: absolute;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(circle at 50% 55%, rgba(74, 255, 129, .11), transparent 30%),
    radial-gradient(circle at 20% 20%, rgba(82, 227, 255, .07), transparent 25%),
    linear-gradient(180deg, #071016, #05090e);
}

.message {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-content: center;
  justify-items: center;
  padding: 30px;
  text-align: center;
  background: radial-gradient(circle, rgba(9, 20, 26, .72), rgba(5, 9, 14, .94));
  transition: opacity .25s, visibility .25s;
}

.message.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.message h2 {
  margin: 0 0 8px;
  font-size: clamp(32px, 7vw, 68px);
  line-height: .95;
  text-transform: uppercase;
  text-shadow: 0 0 35px rgba(141, 255, 158, .28);
}

.message p {
  max-width: 600px;
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 16px;
}

.start-btn {
  position: relative;
  min-width: 190px;
  padding: 14px 28px;
  border: 1px solid rgba(141,255,158,.55);
  border-radius: 14px;
  background: linear-gradient(180deg, #9affaa, #48c76d);
  color: #031108;
  font-weight: 950;
  letter-spacing: .11em;
  cursor: pointer;
  box-shadow: 0 0 34px rgba(77, 255, 131, .24);
  transition: transform .15s, filter .15s;
}

.start-btn:hover { transform: translateY(-2px) scale(1.02); filter: brightness(1.08); }
.start-btn:active { transform: scale(.97); }

.target {
  position: absolute;
  width: 118px;
  height: 118px;
  padding: 0;
  border: 0;
  border-radius: 20px;
  background: transparent;
  cursor: crosshair;
  transform: translate(-50%, -50%);
  transition: left .09s ease-out, top .09s ease-out, transform .09s ease-out;
  filter: drop-shadow(0 15px 14px rgba(0,0,0,.5));
  z-index: 4;
}

.target.hidden { display: none; }

.target img {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  pointer-events: none;
}

.target-glow {
  position: absolute;
  inset: 13%;
  border-radius: 50%;
  background: rgba(100,255,138,.25);
  filter: blur(17px);
  animation: pulse 1s infinite alternate ease-in-out;
}

.target.hit { animation: hit .13s ease-out; }

.combo-bar {
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: 16px;
  height: 7px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 999px;
  background: rgba(255,255,255,.055);
}

.combo-bar > div {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--cyan));
  box-shadow: 0 0 16px rgba(126,246,255,.55);
  transition: width .05s linear;
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 11px 20px 13px;
  border-top: 1px solid var(--line);
  color: #718984;
  font-size: 12px;
}

.floating-score {
  position: fixed;
  z-index: 30;
  pointer-events: none;
  color: white;
  font-size: 25px;
  font-weight: 950;
  text-shadow: 0 2px 12px #000, 0 0 16px rgba(141,255,158,.9);
  animation: floatUp .75s ease-out forwards;
}

.miss-text {
  color: var(--danger);
  text-shadow: 0 2px 12px #000, 0 0 15px rgba(255,94,117,.7);
}

@keyframes pulse {
  from { transform: scale(.85); opacity: .55; }
  to { transform: scale(1.25); opacity: 1; }
}

@keyframes hit {
  0% { transform: translate(-50%, -50%) scale(1); }
  45% { transform: translate(-50%, -50%) scale(.74) rotate(-5deg); }
  100% { transform: translate(-50%, -50%) scale(1.06); }
}

@keyframes floatUp {
  0% { transform: translate(-50%, -20%) scale(.7); opacity: 0; }
  15% { opacity: 1; }
  100% { transform: translate(-50%, -125%) scale(1.2); opacity: 0; }
}

@media (max-width: 650px) {
  body { padding: 0; }
  .game-shell { min-height: 100vh; border: 0; border-radius: 0; }
  .topbar { padding: 15px; }
  .hud { grid-template-columns: repeat(2, 1fr); }
  .stat { padding: 9px 13px; }
  .arena { min-height: 440px; height: calc(100vh - 245px); }
  .footer { display: none; }
  .target { width: 104px; height: 104px; }
}
