:root {
  --bg: #0d1021;
  --panel: #171b36;
  --text: #eef0ff;
  --muted: #9aa1d4;
  --accent: #ff3d7f;
  --accent2: #34e0ff;
  --on: #2ee66b;
  --tap: 0.6s;
  --spin: 6s;
}

* { box-sizing: border-box; }

html, body { margin: 0; height: 100%; }

body {
  background: radial-gradient(circle at 50% 20%, #23285a, var(--bg) 70%);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  -webkit-tap-highlight-color: transparent;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
}

h1 { margin: 0; font-size: 1.5rem; letter-spacing: 0.04em; }

button {
  font: inherit;
  color: var(--text);
  background: #262b55;
  border: 1px solid #3a4180;
  border-radius: 10px;
  padding: 8px 14px;
  cursor: pointer;
}

button:hover { background: #30367a; }
button:focus-visible { outline: 3px solid var(--accent2); outline-offset: 2px; }

.icon { font-size: 1.3rem; padding: 6px 10px; }

main {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-areas: "stage counts" "stage panel";
  gap: 20px;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px 30px;
}

.stage {
  grid-area: stage;
  position: relative;
  display: grid;
  place-items: center;
  min-height: 420px;
}

.target {
  position: relative;
  z-index: 1;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  border: 6px solid #fff3;
  background: radial-gradient(circle at 35% 30%, #ff8ab3, var(--accent) 55%, #a3124a);
  box-shadow: 0 0 40px #ff3d7f88, inset 0 -10px 20px #0005;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  transition: transform 0.06s;
}

.target:hover { background: radial-gradient(circle at 35% 30%, #ff9bbe, var(--accent) 55%, #a3124a); }
.target:active, .target.hit { transform: scale(0.94); }

body.auto .target { animation: buzz var(--tap) linear infinite; }

@keyframes buzz {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(0.95); }
}

.orbit {
  position: absolute;
  width: 330px;
  height: 330px;
  animation: spin var(--spin) linear infinite;
}

.cursor {
  position: absolute;
  left: 50%;
  top: 50%;
  font-size: 1.9rem;
  margin: -0.6em 0 0 -0.4em;
}

.cursor span {
  display: inline-block;
  animation: tap var(--tap) ease-in-out infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes tap {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(14px); }
}

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

.pop {
  position: absolute;
  font-weight: 800;
  color: var(--accent2);
  text-shadow: 0 2px 6px #000a;
  white-space: nowrap;
  animation: rise 1s ease-out forwards;
}

@keyframes rise {
  from { opacity: 1; transform: translate(-50%, 0); }
  to { opacity: 0; transform: translate(-50%, -80px); }
}

.counts, .panel {
  background: var(--panel);
  border: 1px solid #2a3070;
  border-radius: 16px;
  padding: 18px 20px;
}

.counts { grid-area: counts; }
.panel { grid-area: panel; display: flex; flex-direction: column; gap: 12px; }

.label { color: var(--muted); font-size: 0.9rem; }

.big {
  font-size: 2.2rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.badge {
  margin: 6px 0;
  padding: 6px 10px;
  border-radius: 8px;
  background: #3b2a00;
  color: #ffd75e;
  font-weight: 700;
}

details { margin: 8px 0; }
summary { cursor: pointer; color: var(--muted); }

.exact {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.85rem;
  overflow-wrap: anywhere;
  max-height: 9em;
  overflow-y: auto;
  padding-top: 6px;
}

.stats { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 8px; font-variant-numeric: tabular-nums; }

.toggle { font-size: 1.2rem; font-weight: 800; padding: 14px; }
.toggle[aria-pressed="true"] { background: #11532c; border-color: var(--on); color: #c9ffd9; }

input[type="range"] { width: 100%; accent-color: var(--accent); }

.quick { display: flex; flex-wrap: wrap; gap: 8px; }
.quick button { flex: 1 1 auto; }
.max { background: linear-gradient(90deg, var(--accent), #ff9a3d); border-color: #ffb36b; font-weight: 800; }

.keys { margin: 0; color: var(--muted); font-size: 0.85rem; }
kbd { background: #262b55; border: 1px solid #3a4180; border-radius: 4px; padding: 0 5px; }

.reset { align-self: flex-start; background: transparent; color: var(--muted); }

@media (max-width: 720px) {
  main { grid-template-columns: 1fr; grid-template-areas: "stage" "counts" "panel"; padding: 0 12px 24px; }
  .stage { min-height: 300px; }
  .target { width: 170px; height: 170px; font-size: 1.6rem; }
  .orbit { width: 260px; height: 260px; }
  .keys { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .orbit, .cursor span, body.auto .target, .pop { animation: none; }
}
