:root {
  --bg: #0f1117;
  --panel: #181b24;
  --panel-2: #20242f;
  --text: #e8eaf0;
  --muted: #8b90a0;
  --accent: #ff5a5f;
  --radius: 24px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.top { padding: 20px 16px 0; max-width: 1120px; margin: 0 auto; }
h1 { margin: 0 0 16px; font-size: 1.5rem; }
.badge {
  font-size: .7rem; vertical-align: middle; padding: 2px 8px;
  border-radius: 999px; background: var(--accent); color: #fff;
}
.tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.tab {
  border: 0; cursor: pointer; padding: 10px 16px; border-radius: 999px;
  background: var(--panel); color: var(--muted); font: inherit;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { background: var(--accent); color: #fff; }
.view { max-width: 1120px; margin: 0 auto; padding: 24px 16px 48px; }
.placeholder { text-align: center; padding: 64px 16px; color: var(--muted); }
.placeholder h2 { color: var(--text); margin-bottom: 8px; }

/* CPS */
.click-area {
  display: flex; align-items: center; justify-content: center;
  height: 320px; border-radius: var(--radius);
  background: var(--panel); border: 2px solid var(--panel-2);
  user-select: none; -webkit-user-select: none; touch-action: manipulation;
  cursor: pointer; color: var(--muted); font-size: 1.25rem;
  transition: transform .05s, background .1s;
}
.click-area:active, .click-area.hit { transform: scale(.985); background: var(--panel-2); }
.stats { display: flex; gap: 16px; margin-top: 16px; }
.stat { flex: 1; background: var(--panel); border-radius: 16px; padding: 16px; text-align: center; }
.stat .label { color: var(--muted); font-size: .85rem; }
.stat .value { font-size: 2.5rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat.record .value { color: var(--accent); }
.reset {
  margin-top: 12px; border: 0; background: none; color: var(--muted);
  cursor: pointer; text-decoration: underline; font: inherit;
}

.controls { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 12px; flex-wrap: wrap; }
.controls label { color: var(--muted); display: flex; align-items: center; gap: 8px; }
.controls select {
  background: var(--panel); color: var(--text); border: 2px solid var(--panel-2);
  border-radius: 10px; padding: 6px 10px; font: inherit;
}
.controls .reset { margin-top: 0; }

/* Celność */
.arena {
  position: relative; height: 420px; overflow: hidden;
  border-radius: var(--radius); background: var(--panel); border: 2px solid var(--panel-2);
  cursor: crosshair; user-select: none; -webkit-user-select: none; touch-action: manipulation;
}
.arena-msg {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 16px; text-align: center;
  padding: 16px; color: var(--muted); cursor: default; z-index: 1;
}
.arena-msg[hidden] { display: none; }
.arena-msg .result { font-size: 1.15rem; color: var(--text); }
.start {
  border: 0; cursor: pointer; padding: 12px 32px; border-radius: 999px;
  background: var(--accent); color: #fff; font: inherit; font-size: 1.1rem;
}
.target {
  position: absolute; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 6px rgba(255, 90, 95, .25); cursor: pointer;
}
.stats.compact .stat .value { font-size: 2rem; }

/* Czas reakcji */
.reaction {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; height: 320px; border-radius: var(--radius); text-align: center; padding: 16px;
  user-select: none; -webkit-user-select: none; touch-action: manipulation; cursor: pointer;
  background: var(--panel); border: 2px solid var(--panel-2); color: var(--text);
  transition: background .08s;
}
.reaction.waiting { background: #7a1f24; border-color: #7a1f24; }
.reaction.ready { background: #1f8a4c; border-color: #1f8a4c; }
.reaction-title { font-size: 2.5rem; font-weight: 700; }
.reaction-sub { color: var(--muted); }
.reaction.waiting .reaction-sub, .reaction.ready .reaction-sub { color: rgba(255, 255, 255, .8); }

/* Układ z panelem „Jak grać” */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: start; }
.tab-content { min-width: 0; }
.help {
  background: var(--panel); border-radius: 16px; padding: 4px; max-width: 280px;
}
.help summary {
  cursor: pointer; list-style: none; padding: 8px 14px; border-radius: 12px;
  color: var(--muted); font-size: .95rem; white-space: nowrap;
}
.help summary::-webkit-details-marker { display: none; }
.help summary::before { content: '▸ '; }
.help[open] summary::before { content: '▾ '; }
.help summary:hover { color: var(--text); }
.help h3 { margin: 4px 14px 8px; font-size: 1rem; }
.help ul { margin: 0 14px 12px 32px; padding: 0; color: var(--muted); font-size: .9rem; line-height: 1.5; }
.help li { margin-bottom: 6px; }
@media (max-width: 760px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .help { max-width: none; order: 2; }
}

/* Wspólne dla zakładek z wieloma statystykami */
.stats.compact { flex-wrap: wrap; }
.stats.compact .stat { min-width: 120px; }
.reaction.armed { background: #8a6a1f; border-color: #8a6a1f; }
.reaction.armed .reaction-sub { color: rgba(255, 255, 255, .8); }

/* Małe cele: cele do przytrzymania */
.target.hold { background: #3b82f6; box-shadow: 0 0 0 6px rgba(59, 130, 246, .25); }
.target.hold::after {
  content: ''; position: absolute; inset: -10px; border-radius: 50%; pointer-events: none;
  background: conic-gradient(#fff calc(var(--p, 0) * 1turn), rgba(255, 255, 255, .18) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px));
}
.target.holding { box-shadow: 0 0 0 6px rgba(59, 130, 246, .5); }
