/* ==========================================================================
   Reaction Arena — part of the retrac.space collection
   ========================================================================== */

:root {
  --bg: #0b0a10;
  --surface: rgba(255, 255, 255, 0.035);
  --surface-2: rgba(255, 255, 255, 0.065);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.15);
  --text: #f2f0fb;
  --text-2: #b8b4cc;
  --muted: #7f7a98;
  --lav: #b7adff;
  --lav-muted: #948ec0;
  --violet: #7c6cf0;
  --accent: #b7adff;
  --good: #4ade80;
  --warn: #fbbf24;
  --bad: #f87171;
  --radius: 20px;
  --radius-lg: 28px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Space Grotesk', 'Inter', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'Cascadia Code', Consolas, monospace;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 88px; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; font-family: var(--font-display); font-weight: 700; letter-spacing: -0.025em; line-height: 1.1; }
p { margin: 0; }
::selection { background: rgba(183, 173, 255, 0.35); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.ico { width: 1.15em; height: 1.15em; flex: none; }
.container { width: 100%; max-width: 1160px; margin: 0 auto; padding: 0 24px; }

kbd {
  display: inline-block;
  font: 500 0.8em/1.4 var(--mono);
  padding: 1px 7px;
  border-radius: 6px;
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  vertical-align: 0.08em;
}

/* --- Background ---------------------------------------------------------- */
.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(60rem 38rem at 12% -12%, rgba(124, 108, 240, 0.22), transparent 62%),
    radial-gradient(48rem 32rem at 100% 0%, rgba(183, 173, 255, 0.1), transparent 60%),
    radial-gradient(44rem 30rem at 50% 115%, rgba(124, 108, 240, 0.12), transparent 60%),
    var(--bg);
}
.bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.032) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.032) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 10%, transparent 75%);
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 10%, transparent 75%);
}

/* --- Header -------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(11, 10, 16, 0.62);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  backdrop-filter: blur(16px) saturate(150%);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 68px; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 11px; }
.brand img { width: 34px; height: 34px; border-radius: 10px; box-shadow: 0 6px 24px -8px rgba(124, 108, 240, 0.8); transition: transform 0.4s var(--ease); }
.brand:hover img { transform: rotate(-8deg) scale(1.05); }
.wordmark { font: 700 21px/1 var(--font-display); letter-spacing: -0.035em; color: var(--text); }
.wordmark span { color: var(--lav-muted); }
.brand-sm img { width: 24px; height: 24px; border-radius: 7px; }
.brand-sm .wordmark { font-size: 16px; }

.collection {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  font-size: 12.5px;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  transition: border-color 0.2s, background 0.2s;
}
.collection:hover { border-color: var(--border-strong); background: var(--surface-2); }
.collection b, .footer-collection b { font: 700 14px/1 var(--font-display); letter-spacing: -0.02em; color: var(--text); }
.collection b span, .footer-collection b span { color: var(--lav-muted); }

/* --- Buttons ------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  height: 46px;
  padding: 0 20px;
  border-radius: 14px;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.18s var(--ease), box-shadow 0.25s, background 0.25s, border-color 0.25s;
}
.btn:active { transform: translateY(1px) scale(0.98); }
.btn-lg { height: 54px; padding: 0 26px; font-size: 16px; border-radius: 16px; }
.btn-primary {
  color: #120f1c;
  background: linear-gradient(180deg, #e2ddff, #ab9ff6);
  box-shadow: 0 12px 32px -12px rgba(169, 156, 245, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.7);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 16px 40px -12px rgba(169, 156, 245, 0.95), inset 0 1px 0 rgba(255, 255, 255, 0.7); }
.btn-ghost { color: var(--text); background: var(--surface); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--border-strong); }
.game .btn-primary {
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 55%, #fff), var(--accent));
  box-shadow: 0 12px 32px -12px color-mix(in srgb, var(--accent) 80%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.55);
}
.game .btn-primary:hover { box-shadow: 0 16px 44px -12px var(--accent), inset 0 1px 0 rgba(255, 255, 255, 0.55); }

/* --- Shared animation ---------------------------------------------------- */
.view { animation: rise 0.55s var(--ease) both; }
.tests.view { animation-delay: 0.08s; }
.features.view { animation-delay: 0.16s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes fade-out { to { opacity: 0; transform: scale(0.5); } }
@keyframes shake {
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}
@keyframes pop { from { transform: scale(0.35); opacity: 0; } }

/* --- Hero ---------------------------------------------------------------- */
.hero { position: relative; text-align: center; padding: 104px 0 88px; isolation: isolate; }
.hero-rings { position: absolute; left: 50%; top: 46%; z-index: -1; }
.hero-rings span {
  position: absolute;
  left: 0;
  top: 0;
  width: 720px;
  height: 720px;
  margin: -360px 0 0 -360px;
  border-radius: 50%;
  border: 1px solid rgba(183, 173, 255, 0.22);
  opacity: 0;
  animation: ring 7.5s cubic-bezier(0.25, 0.6, 0.3, 1) infinite;
}
.hero-rings span:nth-child(2) { animation-delay: 2.5s; }
.hero-rings span:nth-child(3) { animation-delay: 5s; }
@keyframes ring {
  0% { transform: scale(0.2); opacity: 0; }
  15% { opacity: 1; }
  100% { transform: scale(1.25); opacity: 0; }
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 7px 16px 7px 13px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  background: rgba(18, 16, 26, 0.7);
  border: 1px solid var(--border-strong);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.pulse-dot { position: relative; width: 8px; height: 8px; border-radius: 50%; background: var(--good); }
.pulse-dot::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--good);
  animation: ping 1.8s ease-out infinite;
}
@keyframes ping { from { transform: scale(0.4); opacity: 1; } to { transform: scale(1.6); opacity: 0; } }
.hero-title {
  max-width: 13ch;
  margin: 28px auto 0;
  font-size: clamp(44px, 7.6vw, 88px);
  letter-spacing: -0.045em;
  line-height: 1.02;
}
.grad {
  background: linear-gradient(100deg, #f2efff 0%, #b7adff 45%, #8574f3 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-sub { max-width: 540px; margin: 24px auto 0; font-size: clamp(16px, 2vw, 18.5px); color: var(--text-2); }
.hero-cta { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 38px; }

/* --- Tests grid ---------------------------------------------------------- */
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.section-head h2 { font-size: clamp(26px, 3.4vw, 34px); }
.section-head p { color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); gap: 16px; }

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 22px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.012));
  overflow: hidden;
  isolation: isolate;
  transition: transform 0.35s var(--ease), border-color 0.3s, box-shadow 0.35s;
}
.card::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(280px circle at var(--mx, 50%) var(--my, 0%), color-mix(in srgb, var(--accent) 20%, transparent), transparent 70%);
  opacity: 0;
  transition: opacity 0.35s;
}
.card::after {
  content: '';
  position: absolute;
  left: 22px;
  right: 22px;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--accent) 70%, transparent), transparent);
  opacity: 0;
  transition: opacity 0.35s;
}
.card:hover {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
  box-shadow: 0 24px 50px -28px color-mix(in srgb, var(--accent) 55%, transparent);
}
.card:hover::before, .card:hover::after { opacity: 1; }
.card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.card-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 13%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 24%, transparent);
  transition: transform 0.35s var(--ease);
}
.card-icon .ico { width: 23px; height: 23px; }
.card:hover .card-icon { transform: scale(1.08) rotate(-4deg); }
.card-num { font: 500 12.5px var(--mono); color: var(--muted); }
.card h3 { font-size: 20px; margin-bottom: 7px; }
.card p { flex: 1; color: var(--text-2); font-size: 14.5px; line-height: 1.5; }
.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 13.5px;
}
.tag { font-size: 11px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.card-go { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--accent); transition: gap 0.25s var(--ease); }
.card:hover .card-go { gap: 10px; }

/* --- Features ------------------------------------------------------------ */
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 72px 0 80px; }
.feature { padding: 24px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); }
.feature-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin-bottom: 16px;
  border-radius: 11px;
  color: var(--lav);
  background: rgba(183, 173, 255, 0.1);
  border: 1px solid rgba(183, 173, 255, 0.18);
}
.feature h3 { font-size: 17px; margin-bottom: 6px; }
.feature p { font-size: 14.5px; color: var(--text-2); line-height: 1.55; }

/* --- Game shell ---------------------------------------------------------- */
.game { padding: 26px 0 64px; }
.back { display: inline-flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 14px; font-weight: 500; color: var(--muted); transition: color 0.2s, gap 0.25s var(--ease); }
.back:hover { color: var(--text); gap: 11px; }
.game-bar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px 24px; margin: 16px 0 20px; }
.game-id { display: flex; align-items: center; gap: 16px; min-width: 0; }
.game-id .card-icon { width: 52px; height: 52px; border-radius: 16px; }
.game-id .card-icon .ico { width: 26px; height: 26px; }
.game-id h1 { font-size: clamp(24px, 3vw, 32px); }
.game-id p { margin-top: 4px; font-size: 14.5px; color: var(--text-2); }

.hud { display: flex; flex-wrap: wrap; gap: 8px; }
.hud-item, .result-stats > div {
  min-width: 96px;
  padding: 8px 14px;
  border-radius: 13px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.hud-item span, .result-stats span {
  display: block;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.hud-item strong, .result-stats strong {
  display: block;
  font: 600 18px/1.35 var(--font-display);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.lives { display: inline-flex; gap: 3px; vertical-align: -2px; }
.lives .ico { width: 17px; height: 17px; }
.lives .on { color: var(--bad); fill: var(--bad); }
.lives .off { color: var(--muted); opacity: 0.4; }

.stage {
  position: relative;
  display: flex;
  min-height: clamp(440px, 64vh, 620px);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.012));
  box-shadow: 0 40px 90px -50px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  overflow: hidden;
  isolation: isolate;
}
.stage::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(70% 55% at 50% 0%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 70%);
}
.stage > * { flex: 1; min-width: 0; }

.screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  animation: rise 0.5s var(--ease) both;
}
.intro-icon {
  display: grid;
  place-items: center;
  width: 88px;
  height: 88px;
  margin-bottom: 26px;
  border-radius: 28px;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
  box-shadow: 0 0 80px -12px color-mix(in srgb, var(--accent) 55%, transparent);
  animation: float 4s ease-in-out infinite;
}
.intro-icon .ico { width: 42px; height: 42px; }
@keyframes float { 50% { transform: translateY(-6px); } }
.screen h2 { font-size: clamp(30px, 4.4vw, 44px); }
.screen.intro > p:not(.hint) { max-width: 470px; margin: 14px 0 32px; font-size: 16.5px; color: var(--text-2); }
.screen b { color: var(--text); font-weight: 600; }
.hint { margin-top: 18px; font-size: 13px; color: var(--muted); }

.result-label { font-size: 12.5px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.result-value { display: flex; align-items: baseline; justify-content: center; flex-wrap: wrap; gap: 4px 12px; margin: 12px 0 16px; }
.result-value .num {
  font: 700 clamp(72px, 12vw, 128px)/1 var(--font-display);
  letter-spacing: -0.05em;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, #fff 20%, color-mix(in srgb, var(--accent) 75%, #fff));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 8px 40px color-mix(in srgb, var(--accent) 35%, transparent));
}
.result-value .unit { font: 600 clamp(18px, 2.4vw, 24px) var(--font-display); color: var(--text-2); }
.rating {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 16px 7px 13px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 13%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  animation: pop 0.5s 0.5s cubic-bezier(0.3, 1.5, 0.5, 1) both;
}
.rating .ico { width: 15px; height: 15px; fill: currentColor; }
.blurb { max-width: 440px; margin-top: 16px; font-size: 15px; color: var(--text-2); }
.result-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 30px 0 34px; }
.result-stats > div { min-width: 124px; padding: 12px 18px; }
.result-gap { height: 32px; }
.result-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }

.game-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
.game-pager a {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  transition: border-color 0.25s, background 0.25s, color 0.25s;
}
.game-pager a:last-child { justify-content: flex-end; text-align: right; }
.game-pager a:hover { color: var(--accent); background: var(--surface-2); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.game-pager small { display: block; font-size: 11px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.game-pager strong { font: 600 16px/1.3 var(--font-display); color: var(--text); }

/* --- Reaction time ------------------------------------------------------- */
.rx-pad {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px;
  text-align: center;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
.rx-pad h2 { font-size: clamp(36px, 6vw, 64px); }
.rx-pad p { font-size: 17px; color: rgba(255, 255, 255, 0.72); }
.rx-ico .ico { width: 54px; height: 54px; }
.rx-pad.wait { background: radial-gradient(circle at 50% 35%, #e11d48, #881337 75%); }
.rx-pad.go { background: radial-gradient(circle at 50% 35%, #4ade80, #15803d 75%); color: #03230f; }
.rx-pad.go .ico { stroke-width: 2.2; }
.rx-pad.early { background: radial-gradient(circle at 50% 35%, rgba(251, 191, 36, 0.24), rgba(251, 191, 36, 0.04) 70%); color: #fde68a; }
.rx-pad.show { background: radial-gradient(circle at 50% 30%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 70%); }
.rx-pad.show .rx-ico { color: var(--accent); }
.rx-big { font-size: clamp(72px, 12vw, 120px) !important; letter-spacing: -0.05em; font-variant-numeric: tabular-nums; }
.rx-big small { margin-left: 8px; font-size: 0.3em; letter-spacing: 0; color: var(--text-2); }

/* --- Aim trainer --------------------------------------------------------- */
.aim-field {
  position: relative;
  cursor: crosshair;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  background-image: radial-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px);
  background-size: 28px 28px;
}
.aim-target {
  position: absolute;
  width: var(--size, 64px);
  height: var(--size, 64px);
  margin: calc(var(--size, 64px) / -2) 0 0 calc(var(--size, 64px) / -2);
  padding: 0;
  border: 0;
  border-radius: 50%;
  cursor: crosshair;
  background: radial-gradient(circle closest-side, #fff 0 18%, var(--accent) 19% 40%, #fff 41% 60%, var(--accent) 61% 100%);
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 16%, transparent), 0 0 44px color-mix(in srgb, var(--accent) 55%, transparent);
}
.aim-target.pop { animation: pop 0.22s cubic-bezier(0.3, 1.6, 0.5, 1); }
.aim-hint {
  position: absolute;
  left: 50%;
  top: calc(50% + 64px);
  transform: translateX(-50%);
  font-size: 15px;
  color: var(--text-2);
  pointer-events: none;
  white-space: nowrap;
}
.aim-burst, .aim-miss { position: absolute; pointer-events: none; border-radius: 50%; }
.aim-burst {
  width: var(--size);
  height: var(--size);
  margin: calc(var(--size) / -2) 0 0 calc(var(--size) / -2);
  border: 2px solid var(--accent);
  animation: burst 0.45s ease-out forwards;
}
@keyframes burst { from { transform: scale(0.6); opacity: 1; } to { transform: scale(1.9); opacity: 0; } }
.aim-miss {
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  border: 2px solid var(--bad);
  animation: fade-out 0.6s 0.1s ease-in forwards;
}

/* --- Typing -------------------------------------------------------------- */
.type-wrap { position: relative; display: flex; flex-direction: column; justify-content: center; gap: 28px; padding: 48px clamp(20px, 6vw, 80px); }
.type-timer { position: absolute; top: 0; left: 0; right: 0; height: 4px; background: var(--surface-2); }
.type-timer span, .mm-timer span {
  display: block;
  height: 100%;
  background: var(--accent);
  box-shadow: 0 0 16px var(--accent);
  transform-origin: left;
}
.type-box {
  position: relative;
  height: calc(3 * 1.9em);
  overflow: hidden;
  font: 400 clamp(19px, 2.4vw, 27px)/1.9 var(--mono);
  cursor: text;
}
.type-inner {
  position: relative;
  white-space: pre-wrap;
  word-break: keep-all;
  overflow-wrap: normal;
  color: color-mix(in srgb, var(--muted) 85%, transparent);
  transition: transform 0.2s var(--ease);
}
.type-inner span { position: relative; border-radius: 3px; }
.type-inner .ok { color: var(--text); }
.type-inner .err { color: var(--bad); background: rgba(248, 113, 113, 0.14); }
.type-inner .cur::before {
  content: '';
  position: absolute;
  left: -1px;
  top: 0.2em;
  bottom: 0.15em;
  width: 2.5px;
  border-radius: 2px;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
  animation: blink 1.05s steps(1) infinite;
}
.typing .type-inner .cur::before { animation: none; }
@keyframes blink { 50% { opacity: 0; } }
.type-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  opacity: 0;
  font-size: 16px;
  cursor: text;
}
.type-blur {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: 14px;
  font: 600 15px var(--font);
  color: var(--text);
  background: rgba(11, 10, 16, 0.55);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.unfocused .type-blur { opacity: 1; }
.type-hint { text-align: center; font-size: 14px; color: var(--muted); }
.type-wrap.done .type-box { opacity: 0.5; transition: opacity 0.3s; }

/* --- Tile grids (sequence, visual memory, color) ------------------------- */
.mem-wrap { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px; padding: 36px 20px; }
.mem-status {
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.mem-status.go { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.mem-status.good { color: var(--good); border-color: rgba(74, 222, 128, 0.4); background: rgba(74, 222, 128, 0.08); }
.mem-status.bad { color: var(--bad); border-color: rgba(248, 113, 113, 0.4); background: rgba(248, 113, 113, 0.08); }

.tile-grid {
  --n: 3;
  display: grid;
  grid-template-columns: repeat(var(--n), 1fr);
  gap: clamp(5px, calc(19px - var(--n) * 1.6px), 14px);
  width: min(440px, 100%);
  aspect-ratio: 1;
}
.tile-grid.enter { animation: pop 0.35s var(--ease); }
.tile-grid.shake { animation: shake 0.4s; }
.tile-grid.win { animation: win 0.5s var(--ease); }
@keyframes win { 40% { transform: scale(1.03); filter: brightness(1.25); } }
.tile {
  padding: 0;
  border: 1px solid var(--border);
  border-radius: clamp(7px, calc(22px - var(--n) * 2px), 16px);
  background: rgba(255, 255, 255, 0.055);
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.16s, box-shadow 0.2s, transform 0.14s var(--ease), border-color 0.2s;
}
.tile-grid.active .tile:hover { background: rgba(255, 255, 255, 0.1); }
.tile-grid.active .tile:active { transform: scale(0.95); }
.tile.lit, .tile.show, .tile.found {
  background: var(--accent);
  border-color: transparent;
  box-shadow: 0 0 34px -4px color-mix(in srgb, var(--accent) 75%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}
.tile.lit { transform: scale(1.04); }
.tile.show, .tile.found { animation: flip 0.32s var(--ease); }
@keyframes flip { from { transform: perspective(400px) rotateY(90deg); } }
.tile-grid.active .tile.found:hover { background: var(--accent); }
.tile.wrong { background: var(--bad) !important; border-color: transparent; box-shadow: 0 0 30px -6px var(--bad); animation: flip 0.32s var(--ease); }
.tile.missed { background: color-mix(in srgb, var(--accent) 18%, transparent); border: 2px dashed var(--accent); }

.clr .tile { border: 0; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12); }
.clr .tile:hover { transform: scale(1.03); filter: brightness(1.05); }
.clr .tile.reveal { position: relative; z-index: 1; transform: scale(1.08); box-shadow: 0 0 0 3px #fff, 0 0 40px rgba(255, 255, 255, 0.45); }
.clr .tile.nope { opacity: 0.35; }

/* --- Click speed --------------------------------------------------------- */
.cps-pad {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  background: radial-gradient(circle at 50% 50%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 60%);
  transition: background 0.4s;
}
.cps-pad.running { background: radial-gradient(circle at 50% 50%, color-mix(in srgb, var(--accent) 20%, transparent), transparent 65%); }
.cps-count {
  font: 700 clamp(104px, 19vw, 190px)/1 var(--font-display);
  letter-spacing: -0.06em;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}
.cps-label { margin-top: 10px; font-size: 17px; color: var(--text-2); pointer-events: none; }
.cps-pad.done .cps-label { color: var(--accent); font-weight: 600; }
.cps-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 6px; background: var(--surface-2); }
.cps-bar span { display: block; height: 100%; background: var(--accent); box-shadow: 0 0 20px var(--accent); transform-origin: left; }
.ripple {
  position: absolute;
  width: 130px;
  height: 130px;
  margin: -65px 0 0 -65px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  pointer-events: none;
  animation: ripple 0.55s ease-out forwards;
}
@keyframes ripple { from { transform: scale(0.15); opacity: 0.9; } to { transform: scale(1.3); opacity: 0; } }

/* --- Time perception ----------------------------------------------------- */
.tp-wrap { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; padding: 40px 20px; text-align: center; }
.tp-wrap .hint { margin-top: -6px; }
.tp-rounds { display: flex; gap: 8px; }
.tp-rounds span { width: 28px; height: 5px; border-radius: 3px; background: var(--surface-2); transition: background 0.3s; }
.tp-rounds .good { background: var(--good); }
.tp-rounds .ok { background: var(--warn); }
.tp-rounds .bad { background: var(--bad); }
.tp-orb {
  position: relative;
  display: grid;
  place-items: center;
  width: min(250px, 62vw);
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: radial-gradient(circle at 50% 30%, color-mix(in srgb, var(--accent) 20%, transparent), transparent 72%);
  transition: border-color 0.3s, box-shadow 0.4s;
}
.tp-orb::before {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0 62%, var(--accent));
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
  opacity: 0;
  transition: opacity 0.3s;
}
.tp-orb.running { animation: breathe 3.7s ease-in-out infinite; }
.tp-orb.running::before { opacity: 1; animation: spin 2.3s cubic-bezier(0.5, 0.1, 0.5, 0.9) infinite; }
@keyframes spin { to { transform: rotate(1turn); } }
@keyframes breathe { 50% { transform: scale(1.035); } }
.tp-orb.good { border-color: var(--good); box-shadow: 0 0 70px -14px var(--good); }
.tp-orb.ok { border-color: var(--warn); box-shadow: 0 0 70px -14px var(--warn); }
.tp-orb.bad { border-color: var(--bad); box-shadow: 0 0 70px -14px var(--bad); }
.tp-readout { display: block; font: 700 clamp(44px, 8vw, 60px)/1 var(--font-display); letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.tp-orb small { display: block; margin-top: 8px; font-size: 11.5px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.tp-msg { min-height: 1.6em; font-size: 17px; color: var(--text-2); }
.tp-msg strong { color: var(--text); }

/* --- Mental math --------------------------------------------------------- */
.mm-wrap { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 26px; padding: 48px 20px; }
.mm-timer { position: absolute; top: 0; left: 0; right: 0; height: 4px; background: var(--surface-2); }
.mm-problem { font: 700 clamp(54px, 10vw, 100px)/1 var(--font-display); letter-spacing: -0.04em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mm-problem.pop { animation: pop 0.25s cubic-bezier(0.3, 1.5, 0.5, 1); }
.mm-input {
  width: min(260px, 80%);
  height: 70px;
  text-align: center;
  font: 600 34px var(--font-display);
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.25s;
}
.mm-input:focus { border-color: color-mix(in srgb, var(--accent) 65%, transparent); box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 16%, transparent); }
.mm-input.ok { animation: ok-flash 0.35s; }
.mm-input.bad { animation: shake 0.35s; border-color: var(--bad); }
@keyframes ok-flash { from { box-shadow: 0 0 0 8px rgba(74, 222, 128, 0.35); border-color: var(--good); } }

/* --- Precision ----------------------------------------------------------- */
.pr-field {
  position: relative;
  overflow: hidden;
  cursor: crosshair;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 40px 40px;
  background-position: center;
}
.pr-target {
  position: absolute;
  left: 0;
  top: 0;
  border-radius: 50%;
  pointer-events: none;
  will-change: transform;
  background: radial-gradient(circle closest-side,
    #1a1625 0 5%, #fff 6% 16%, var(--accent) 17% 33%, #fff 34% 50%,
    var(--accent) 51% 67%, #fff 68% 83%, var(--accent) 84% 100%);
  box-shadow: 0 0 46px -6px color-mix(in srgb, var(--accent) 80%, transparent);
}
.pr-target.in { animation: target-in 0.3s cubic-bezier(0.3, 1.5, 0.5, 1); }
.pr-target.out { opacity: 0; transition: opacity 0.25s; }
@keyframes target-in { from { opacity: 0; scale: 0.3; } }
.pr-mark, .pr-pts { position: absolute; pointer-events: none; }
.pr-mark {
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.45), 0 0 16px #fff;
  animation: fade-out 0.5s 0.9s forwards;
}
.pr-pts {
  transform: translate(-50%, -150%);
  font: 700 22px var(--font-display);
  color: var(--text);
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
  animation: float-up 1.1s ease-out forwards;
}
.pr-pts.great { color: var(--good); }
.pr-pts.miss { color: var(--bad); }
@keyframes float-up { to { transform: translate(-50%, -290%); opacity: 0; } }

/* --- Footer -------------------------------------------------------------- */
.site-footer { margin-top: auto; padding: 28px 0; border-top: 1px solid var(--border); color: var(--muted); font-size: 14px; }
.footer-inner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 14px 24px; }
.footer-collection { transition: color 0.2s; }
.footer-collection:hover { color: var(--text-2); }
.noscript { padding: 80px 0; text-align: center; color: var(--text-2); }

/* --- Responsive ---------------------------------------------------------- */
@media (max-width: 860px) {
  .features { grid-template-columns: 1fr; margin: 56px 0 64px; }
  .hud { width: 100%; }
  .hud-item { flex: 1; min-width: 0; }
}
@media (max-width: 600px) {
  .container { padding: 0 16px; }
  .header-inner { height: 60px; }
  .collection-label { display: none; }
  .hero { padding: 72px 0 64px; }
  .hero-cta .btn { width: 100%; }
  .hero-rings span { width: 480px; height: 480px; margin: -240px 0 0 -240px; }
  .game-id p { display: none; }
  .stage { border-radius: 22px; min-height: 460px; }
  .hud-item { padding: 7px 10px; }
  .hud-item strong { font-size: 16px; }
  .result-actions .btn { width: 100%; }
  .game-pager { grid-template-columns: 1fr; }
  .game-pager a:last-child { justify-content: space-between; }
  .game-pager a:first-child { flex-direction: row; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
}

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