:root {
  --bg: #fbfbfa;
  --text: #0a0a0a;
  --muted: #6f6f6f;
  --line: #e6e3dd;
  --card: #878471;
  --card-text: #080808;
  --soft: #f2f0eb;
  --shadow: 0 24px 70px rgba(18, 18, 18, 0.2);
  --accent: #111111;
  --success: #12945f;
  --danger: #dd3f3f;
}

body.dark {
  --bg: #0d0f12;
  --text: #f7f6f2;
  --muted: #9a9a94;
  --line: #24272c;
  --card: #262a31;
  --card-text: #f7f6f2;
  --soft: #15181d;
  --shadow: 0 24px 76px rgba(0, 0, 0, 0.45);
  --accent: #f7f6f2;
}

* {
  box-sizing: border-box;
}

::selection {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  transition: background 180ms ease, color 180ms ease;
}

button,
input,
select {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

.site-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 0 28px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(18px);
}

.left-nav,
.game-tabs,
.header-actions,
.game-actions,
.session-bar {
  display: flex;
  align-items: center;
}

.left-nav {
  gap: 34px;
}

.brand {
  font-size: 1.45rem;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.game-tabs {
  gap: 26px;
}

.tab-button {
  position: relative;
  border: 0;
  padding: 7px 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.96rem;
  font-weight: 750;
}

.tab-button.active {
  color: var(--text);
}

.tab-button.active::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -3px;
  left: 0;
  height: 3px;
  background: var(--accent);
}

.new-badge {
  position: absolute;
  top: -12px;
  right: -26px;
  padding: 3px 7px;
  border-radius: 999px;
  background: #ff483d;
  color: #fff;
  font-size: 0.62rem;
  font-style: italic;
  font-weight: 900;
}

.header-actions {
  gap: 12px;
}

.discord-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 40px;
  padding: 0 4px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 900;
  transition:
    transform 180ms cubic-bezier(0.16, 1, 0.3, 1),
    color 180ms ease,
    opacity 180ms ease;
}

.discord-link:hover {
  transform: translateY(-1px);
  opacity: 0.82;
}

.discord-link img {
  display: block;
  width: 20px;
  height: auto;
  flex: 0 0 auto;
}

.volume-control {
  position: relative;
  display: grid;
  place-items: center;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.icon-button:hover {
  background: var(--soft);
}

.icon-button svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.volume-popover {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  z-index: 30;
  display: grid;
  place-items: center;
  width: 132px;
  min-height: 42px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.13);
  backdrop-filter: blur(18px);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -6px) scale(0.96);
  transition:
    opacity 160ms ease,
    transform 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

.volume-control:hover .volume-popover,
.volume-control:focus-within .volume-popover {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0) scale(1);
}

.volume-popover input {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto auto minmax(430px, 1fr) auto auto;
  padding: 104px 24px 58px;
}

.legal-shell {
  min-height: 100vh;
  padding: 118px 24px 86px;
}

.legal-card {
  width: min(860px, 100%);
  margin: 0 auto;
  padding: clamp(28px, 5vw, 58px);
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    radial-gradient(circle at 18% 8%, rgba(112, 201, 176, 0.14), transparent 28%),
    color-mix(in srgb, var(--bg) 86%, #fff 14%);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.08);
}

body.dark .legal-card {
  background:
    radial-gradient(circle at 18% 8%, rgba(112, 201, 176, 0.1), transparent 28%),
    color-mix(in srgb, var(--soft) 88%, #000 12%);
}

.legal-kicker {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.legal-card h1 {
  margin: 0 0 24px;
  font-size: clamp(2.4rem, 7vw, 5rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.legal-card h2 {
  margin: 34px 0 10px;
  font-size: 1.05rem;
  line-height: 1.25;
}

.legal-card p {
  max-width: 720px;
  margin: 0 0 12px;
  color: var(--muted);
  font-weight: 650;
  line-height: 1.62;
}

.legal-card a {
  color: var(--text);
  font-weight: 850;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.game-meta,
.config-bar,
.game-actions,
.session-bar {
  width: min(760px, 100%);
  margin: 0 auto;
}

.game-meta {
  display: grid;
  justify-items: center;
  gap: 4px;
  min-height: 92px;
  padding-top: 8px;
  text-align: center;
}

.game-meta p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 750;
}

.game-meta h1 {
  margin: 0;
  font-size: clamp(2.2rem, 6vw, 4.4rem);
  line-height: 1.08;
  letter-spacing: 0;
}

.config-bar {
  min-height: 42px;
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 8px;
}

.config-bar[hidden] {
  display: none;
}

.game-actions[hidden] {
  display: none;
}

.config-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--soft);
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.stepper {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.stepper button {
  width: 26px;
  height: 26px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  font-weight: 900;
}

.stepper strong {
  min-width: 18px;
  color: var(--text);
  text-align: center;
}

.difficulty-tabs {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg) 78%, var(--line));
}

.difficulty-tabs button {
  min-height: 26px;
  border: 0;
  border-radius: 999px;
  padding: 0 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 900;
  transition:
    background 160ms ease,
    color 160ms ease,
    transform 160ms cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 160ms ease;
}

.difficulty-tabs button:hover {
  transform: translateY(-1px);
}

.difficulty-tabs button.active {
  background: var(--accent);
  color: var(--bg);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.play-zone {
  display: grid;
  place-items: center;
  min-height: 590px;
  padding: 8px 0 20px;
}

.game-card {
  position: relative;
  width: min(760px, calc(100vw - 42px));
  min-height: 560px;
  display: grid;
  align-content: center;
  gap: 20px;
  padding: 34px;
  border-radius: 16px;
  background: var(--card);
  color: var(--card-text);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: background 260ms ease, color 260ms ease, box-shadow 260ms ease, transform 260ms cubic-bezier(0.22, 1, 0.36, 1);
  animation: cardEnter 420ms cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform;
}

.info-page {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 22px;
  width: 100%;
  min-height: 492px;
  align-content: center;
  color: var(--text);
  animation: screenReveal 430ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.info-page::before {
  content: "";
  position: absolute;
  inset: -34px;
  z-index: -1;
  background:
    radial-gradient(circle at 18% 18%, rgba(112, 201, 176, 0.18), transparent 26%),
    radial-gradient(circle at 82% 8%, rgba(145, 128, 255, 0.14), transparent 28%),
    linear-gradient(145deg, color-mix(in srgb, var(--bg) 82%, #fff 18%), color-mix(in srgb, var(--soft) 80%, #fff 20%));
}

body.dark .info-page::before {
  background:
    radial-gradient(circle at 18% 18%, rgba(112, 201, 176, 0.15), transparent 26%),
    radial-gradient(circle at 82% 8%, rgba(145, 128, 255, 0.16), transparent 28%),
    linear-gradient(145deg, #12161d, #15191f);
}

.info-kicker {
  width: fit-content;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.info-page h2 {
  max-width: 620px;
  margin: 0;
  font-size: clamp(2.2rem, 6vw, 4.9rem);
  line-height: 0.94;
  letter-spacing: 0;
}

.info-lead {
  max-width: 650px;
  margin: 0;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.18rem);
  font-weight: 750;
  line-height: 1.5;
}

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

.info-grid section,
.faq-list details {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: color-mix(in srgb, var(--bg) 76%, transparent);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.06);
  backdrop-filter: blur(14px);
}

.info-grid section {
  padding: 18px;
  animation: tactilePop 360ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.info-grid section:nth-child(2) { animation-delay: 50ms; }
.info-grid section:nth-child(3) { animation-delay: 100ms; }
.info-grid section:nth-child(4) { animation-delay: 150ms; }

.info-grid span {
  display: block;
  margin-bottom: 8px;
  color: var(--text);
  font-weight: 950;
}

.info-grid p,
.faq-list p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.48;
}

.faq-list {
  display: grid;
  gap: 10px;
}

.faq-list details {
  overflow: hidden;
  animation: softRise 360ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.faq-list details:nth-child(2) { animation-delay: 45ms; }
.faq-list details:nth-child(3) { animation-delay: 90ms; }
.faq-list details:nth-child(4) { animation-delay: 135ms; }
.faq-list details:nth-child(5) { animation-delay: 180ms; }
.faq-list details:nth-child(6) { animation-delay: 225ms; }

.faq-list summary {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 54px;
  padding: 0 18px;
  cursor: pointer;
  color: var(--text);
  font-weight: 900;
  list-style: none;
}

.faq-list summary::-webkit-details-marker {
  display: none;
}

.faq-list summary::after {
  content: "+";
  color: var(--muted);
  font-size: 1.2rem;
  font-weight: 600;
}

.faq-list details[open] summary::after {
  content: "-";
}

.faq-list details p {
  padding: 0 18px 18px;
}

.card-topline {
  position: absolute;
  top: 32px;
  left: 34px;
  color: color-mix(in srgb, var(--card-text) 75%, transparent);
  font-size: 0.9rem;
  font-weight: 800;
  z-index: 5;
  animation: softDrop 420ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.game-card:has(.shape-memory-screen) .card-topline,
.game-card:has(.shape-builder) .card-topline,
.game-card:has(.shape-round-result) .card-topline {
  display: grid;
  place-items: center;
  min-width: 48px;
  min-height: 34px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  color: rgba(255, 255, 255, 0.9);
  font-weight: 900;
}

.card-brand {
  position: absolute;
  right: 34px;
  bottom: 12px;
  color: color-mix(in srgb, var(--card-text) 60%, transparent);
  font-size: 0.78rem;
  font-weight: 900;
  pointer-events: none;
  animation: softRise 520ms cubic-bezier(0.16, 1, 0.3, 1) 80ms both;
}

.memory-number {
  position: absolute;
  top: 38px;
  right: 34px;
  font-size: clamp(4.4rem, 11vw, 6.2rem);
  line-height: 0.8;
  font-weight: 900;
  letter-spacing: -0.08em;
}

.small-label {
  position: absolute;
  top: 124px;
  right: 36px;
  font-size: 0.8rem;
  font-weight: 800;
}

.card-message {
  max-width: 300px;
  margin: auto;
  text-align: center;
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.5;
  animation: softRise 440ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.color-idle-demo {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 82% 18%, rgba(255, 255, 255, 0.16), transparent 20%),
    linear-gradient(120deg, #139169, #2c9f94 44%, #a94771 100%);
  background-size: 160% 160%;
  animation: colorIdleDrift 8s ease-in-out infinite;
}

.color-idle-demo,
.shape-idle-demo,
.sound-idle-demo,
.color-memory-screen,
.color-picker-layout,
.round-result,
.multi-round-result,
.final-result,
.shape-memory-screen,
.shape-builder,
.shape-round-result,
.sound-memory-screen,
.sound-choice-screen,
.sound-result-screen {
  animation: screenReveal 430ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.color-idle-demo .idle-rails,
.color-idle-demo .idle-preview,
.shape-idle-object,
.shape-idle-caption,
.sound-idle-copy,
.sound-idle-meta,
.memory-timer,
.picker-rails,
.target-button,
.chosen-row,
.result-score,
.result-label,
.comparison-pair,
.multi-result-head,
.final-score,
.final-meter,
.final-meta,
.round-breakdown,
.shape-builder-controls,
.shape-builder .shape-canvas,
.shape-reset-button,
.shape-points-toggle,
.shape-lock-button,
.shape-comparison-card,
.sound-frequency-readout,
.sound-tuner-hint,
.sound-submit-button,
.sound-result-copy,
.sound-result-meta,
.number-idle-copy,
.number-input-copy,
.number-input-wrap,
.number-submit-button,
.number-result-score,
.number-compare,
.choice-grid,
.pattern-grid,
.reaction-hit,
.answer-input {
  animation: softRise 520ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.target-button,
.next-round-button,
.sound-submit-button,
.play-again-button,
.primary-button,
.secondary-button,
.icon-button,
.stepper button,
.choice-button,
.sound-button,
.pattern-cell,
.shape-reset-button,
.shape-points-toggle {
  transition:
    transform 180ms cubic-bezier(0.16, 1, 0.3, 1),
    background 180ms ease,
    color 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease,
    opacity 180ms ease;
}

.color-idle-demo {
  animation:
    screenReveal 430ms cubic-bezier(0.16, 1, 0.3, 1) both,
    colorIdleDrift 8s ease-in-out infinite;
}

.shape-memory-screen {
  animation:
    screenReveal 430ms cubic-bezier(0.16, 1, 0.3, 1) both,
    colorIdleDrift 9s ease-in-out infinite;
}

.round-breakdown span,
.sound-idle-meta span {
  animation: tactilePop 340ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.comparison-pair:nth-child(2),
.shape-comparison-card:nth-child(2),
.round-breakdown span:nth-child(2),
.sound-idle-meta span:nth-child(2) {
  animation-delay: 70ms;
}

.comparison-pair:nth-child(3),
.shape-comparison-card:nth-child(3),
.round-breakdown span:nth-child(3),
.sound-idle-meta span:nth-child(3) {
  animation-delay: 120ms;
}

.comparison-pair:nth-child(4),
.shape-comparison-card:nth-child(4),
.round-breakdown span:nth-child(4) {
  animation-delay: 170ms;
}

.comparison-pair:nth-child(5),
.shape-comparison-card:nth-child(5),
.round-breakdown span:nth-child(5) {
  animation-delay: 220ms;
}

.shape-idle-demo {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 36%, rgba(255, 255, 255, 0.55), transparent 18%),
    radial-gradient(circle at 22% 76%, rgba(67, 212, 172, 0.34), transparent 24%),
    radial-gradient(circle at 84% 18%, rgba(130, 151, 255, 0.26), transparent 24%),
    linear-gradient(135deg, #f7fbff 0%, #dff5ed 45%, #c7e8dd 100%);
  color: #17352c;
  isolation: isolate;
}

.shape-idle-object {
  position: absolute;
  top: 45%;
  left: 50%;
  width: min(245px, 34%);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  animation: shapeFloat 4.2s ease-in-out infinite;
  z-index: 2;
}

.shape-idle-object .shape-canvas {
  filter: drop-shadow(0 28px 44px rgba(24, 85, 70, 0.24));
}

.shape-idle-ghost {
  position: absolute;
  top: 45%;
  left: 50%;
  width: min(245px, 34%);
  aspect-ratio: 1;
  opacity: 0.24;
  z-index: 1;
}

.shape-idle-ghost .shape-canvas polygon {
  fill: transparent;
  stroke-width: 4;
}

.ghost-one {
  transform: translate(-58%, -46%) rotate(-13deg);
  animation: ghostDriftOne 6s ease-in-out infinite;
}

.ghost-one .shape-canvas polygon {
  stroke: rgba(19, 92, 77, 0.42);
}

.ghost-two {
  transform: translate(-43%, -54%) rotate(15deg);
  animation: ghostDriftTwo 7s ease-in-out infinite;
}

.ghost-two .shape-canvas polygon {
  stroke: rgba(118, 142, 255, 0.38);
}

.shape-idle-caption {
  position: absolute;
  left: 50%;
  bottom: 46px;
  display: grid;
  gap: 8px;
  width: min(470px, calc(100% - 60px));
  text-align: center;
  transform: translateX(-50%);
  z-index: 3;
}

.shape-idle-caption strong {
  color: rgba(17, 47, 40, 0.94);
  font-size: clamp(1.35rem, 4vw, 2.2rem);
  font-weight: 900;
  letter-spacing: 0;
}

.shape-idle-caption span {
  height: auto;
  color: rgba(17, 47, 40, 0.62);
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1.45;
  background: none;
}

.idle-rails {
  position: absolute;
  inset: 0 auto 0 0;
  display: grid;
  grid-template-columns: repeat(3, 42px);
}

.idle-rail {
  position: relative;
  overflow: hidden;
}

.idle-hue {
  background: linear-gradient(to bottom, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00);
}

.idle-sat {
  background: linear-gradient(to top, #597468, #24d798);
}

.idle-bright {
  background: linear-gradient(to top, #020403, #17754e, #39d08d);
}

.idle-rail i {
  position: absolute;
  left: 50%;
  width: 18px;
  height: 18px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.32);
  transform: translateX(-50%);
}

.idle-hue i {
  animation: hueDot 5.6s ease-in-out infinite;
}

.idle-sat i {
  animation: satDot 6.2s ease-in-out infinite;
}

.idle-bright i {
  animation: brightDot 5.1s ease-in-out infinite;
}

.idle-preview {
  position: absolute;
  inset: 38px 34px auto 156px;
  display: grid;
  justify-items: end;
}

.idle-counter {
  justify-self: start;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.86rem;
  font-weight: 900;
}

.idle-preview strong {
  margin-top: 12px;
  color: rgba(0, 0, 0, 0.88);
  font-size: clamp(4.4rem, 10vw, 6.4rem);
  line-height: 0.78;
  font-weight: 900;
  letter-spacing: -0.08em;
  animation: idleTimerPulse 2.4s ease-in-out infinite;
}

.idle-preview em {
  color: rgba(0, 0, 0, 0.84);
  font-style: normal;
  font-size: 0.82rem;
  font-weight: 850;
}

.idle-target {
  position: absolute;
  right: 30px;
  bottom: 42px;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: #0a0a0a;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.16);
}

.idle-target svg {
  width: 29px;
  height: 29px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@keyframes hueDot {
  0%, 100% { top: 18%; }
  35% { top: 72%; }
  68% { top: 44%; }
}

@keyframes satDot {
  0%, 100% { top: 58%; }
  50% { top: 22%; }
}

@keyframes brightDot {
  0%, 100% { top: 74%; }
  42% { top: 34%; }
  76% { top: 58%; }
}

@keyframes idleTimerPulse {
  0%, 100% {
    transform: translateY(0);
    opacity: 0.96;
  }
  50% {
    transform: translateY(4px);
    opacity: 0.72;
  }
}

@keyframes colorIdleDrift {
  0%, 100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

@keyframes soundWaveBreathe {
  0%, 100% {
    transform: translateX(-50%) scaleX(0.92) rotate(-1deg);
  }
  50% {
    transform: translateX(-50%) scaleX(1.1) rotate(1.2deg);
  }
}

@keyframes soundCorePulse {
  0%, 100% {
    opacity: 0.62;
    filter: blur(0);
  }
  50% {
    opacity: 1;
    filter: blur(1px);
  }
}

@keyframes soundLinePulse {
  0%, 100% {
    opacity: calc(var(--o) * 0.72);
    transform: translateX(calc(-50% + var(--x))) rotate(calc(var(--i) * 7deg)) scaleX(0.96);
  }
  50% {
    opacity: var(--o);
    transform: translateX(calc(-50% + var(--x))) rotate(calc(var(--i) * 7deg)) scaleX(1.08);
  }
}

@keyframes soundTunerFlow {
  0%, 100% {
    filter: drop-shadow(0 0 24px var(--sound-glow)) saturate(1.08);
  }
  50% {
    filter: drop-shadow(0 0 46px var(--sound-glow)) saturate(1.42);
  }
}

@keyframes cardEnter {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.985);
    filter: blur(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

@keyframes screenReveal {
  from {
    opacity: 0;
    transform: scale(1.018);
    filter: blur(10px);
  }
  to {
    opacity: 1;
    transform: scale(1);
    filter: blur(0);
  }
}

@keyframes softRise {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
    filter: blur(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

@keyframes softDrop {
  from {
    opacity: 0;
    transform: translateY(-10px);
    filter: blur(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

@keyframes tactilePop {
  0% {
    opacity: 0;
    transform: translateY(10px) scale(0.9);
  }
  70% {
    opacity: 1;
    transform: translateY(-1px) scale(1.025);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes digitZoom {
  0% {
    opacity: 0;
    transform: scale(0.58) translateY(18px);
    filter: blur(16px);
  }
  62% {
    opacity: 1;
    transform: scale(1.08) translateY(0);
    filter: blur(0);
  }
  100% {
    opacity: 1;
    transform: scale(1);
    filter: blur(0);
  }
}

@keyframes prepZoom {
  0% {
    opacity: 0;
    transform: scale(0.5) translateY(20px);
    filter: blur(18px);
  }
  58% {
    opacity: 1;
    transform: scale(1.1) translateY(0);
    filter: blur(0);
  }
  100% {
    opacity: 1;
    transform: scale(1);
    filter: blur(0);
  }
}

@keyframes prepPulse {
  0%, 100% {
    transform: translate(-50%, -50%) scale(0.9);
    opacity: 0.38;
  }
  50% {
    transform: translate(-50%, -50%) scale(1.08);
    opacity: 0.68;
  }
}

@keyframes numberFloat {
  0%, 100% {
    transform: translateY(0) rotate(-4deg);
    opacity: 0.12;
  }
  50% {
    transform: translateY(-18px) rotate(5deg);
    opacity: 0.28;
  }
}

@keyframes numberTilePulse {
  0%, 100% {
    transform: scale(0.96);
    opacity: 0.42;
  }
  50% {
    transform: scale(1.04);
    opacity: 1;
  }
}

@keyframes meterSweep {
  from {
    transform: scaleX(0);
    transform-origin: left;
  }
  to {
    transform: scaleX(1);
    transform-origin: left;
  }
}

@keyframes panelReveal {
  from {
    opacity: 0;
    transform: scaleY(0.98);
  }
  to {
    opacity: 1;
    transform: scaleY(1);
  }
}

@keyframes resultSlideIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes swatchRise {
  from {
    transform: translateY(10px);
  }
  to {
    transform: translateY(0);
  }
}

@keyframes meterFill {
  from {
    width: 0;
  }
}

@keyframes shapeFloat {
  0%, 100% {
    transform: translate(-50%, -50%) rotate(-2deg);
  }
  50% {
    transform: translate(-50%, calc(-50% - 8px)) rotate(3deg);
  }
}

@keyframes ghostDriftOne {
  0%, 100% {
    transform: translate(-58%, -46%) rotate(-13deg);
  }
  50% {
    transform: translate(-61%, -49%) rotate(-8deg);
  }
}

@keyframes ghostDriftTwo {
  0%, 100% {
    transform: translate(-43%, -54%) rotate(15deg);
  }
  50% {
    transform: translate(-39%, -51%) rotate(9deg);
  }
}

.color-memory-screen {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.memory-color-panels {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(var(--panel-count, 1), 1fr);
}

.memory-color-panels span {
  position: relative;
  min-width: 0;
  animation: panelReveal 420ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.memory-color-panels em {
  position: absolute;
  top: 42px;
  left: 22px;
  color: rgba(255, 255, 255, 0.66);
  font-style: normal;
  font-size: 0.78rem;
  font-weight: 900;
}

.memory-timer {
  --progress: 1;
  --timer-ink: rgba(0, 0, 0, 0.9);
  position: absolute;
  top: 36px;
  right: 48px;
  display: grid;
  justify-items: end;
  color: var(--timer-ink);
  filter: saturate(calc(0.65 + var(--progress) * 0.35));
  transform: translateY(calc((1 - var(--progress)) * 7px));
}

body.dark .memory-timer {
  --timer-ink: rgba(255, 255, 255, 0.92);
}

.memory-timer strong {
  position: relative;
  display: inline-block;
  font-size: clamp(4.1rem, 10vw, 6.4rem);
  line-height: 0.78;
  font-weight: 900;
  letter-spacing: -0.08em;
  font-variant-numeric: tabular-nums;
  color: transparent;
  background:
    linear-gradient(
      to bottom,
      var(--timer-ink) 0 calc((1 - var(--progress)) * 100%),
      color-mix(in srgb, var(--timer-ink) 22%, transparent) calc((1 - var(--progress)) * 100%) 100%
    );
  -webkit-background-clip: text;
  background-clip: text;
  transition: background 16ms linear;
}

.memory-timer span {
  margin-top: 10px;
  color: currentColor;
  font-size: 0.82rem;
  font-weight: 850;
}

.color-picker-layout {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 0;
  padding: 0;
}

.picker-rails {
  display: grid;
  grid-template-columns: repeat(3, 40px);
  height: 100%;
}

.picker-rail {
  position: relative;
  width: 40px;
  height: 100%;
  border: 0;
  padding: 0;
  cursor: ns-resize;
  touch-action: none;
}

.hue-rail {
  background: linear-gradient(to bottom, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00);
}

.picker-dot {
  position: absolute;
  left: 50%;
  width: 18px;
  height: 18px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.28);
  transform: translate(-50%, -50%);
  pointer-events: none;
  transition: top 90ms linear, transform 160ms cubic-bezier(0.16, 1, 0.3, 1), box-shadow 160ms ease;
}

.picker-rail:active .picker-dot {
  transform: translate(-50%, -50%) scale(1.08);
}

.picker-progress {
  position: absolute;
  top: 30px;
  left: 160px;
  color: rgba(255, 255, 255, 0.72);
  font-weight: 900;
}

.target-button {
  position: absolute;
  right: 30px;
  bottom: 30px;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: #0a0a0a;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.16);
}

.target-button svg {
  width: 29px;
  height: 29px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.round-result {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-rows: 1fr 1fr;
  animation: resultSlideIn 360ms cubic-bezier(0.22, 1, 0.36, 1);
}

.result-half {
  position: relative;
  overflow: hidden;
}

.result-selection {
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
}

.result-swatches {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(var(--panel-count, 1), 1fr);
}

.result-swatches span {
  min-width: 0;
  animation: swatchRise 360ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.result-copy {
  position: absolute;
  left: 32px;
  bottom: 30px;
  display: grid;
  gap: 4px;
}

.result-copy span {
  color: rgba(255, 255, 255, 0.42);
  font-size: 0.82rem;
  font-weight: 900;
}

.result-copy strong {
  color: rgba(255, 255, 255, 0.94);
  font-size: 0.9rem;
  font-weight: 900;
}

.result-score {
  position: absolute;
  top: 28px;
  right: 32px;
  display: grid;
  justify-items: end;
  max-width: 240px;
  color: #fff;
  text-align: right;
}

.result-score strong {
  font-size: clamp(4.2rem, 11vw, 6.5rem);
  line-height: 0.78;
  font-weight: 900;
  letter-spacing: -0.08em;
}

.next-round-button {
  position: absolute;
  right: 30px;
  bottom: 28px;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: #0a0a0a;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.16);
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.target-button:hover,
.next-round-button:hover,
.idle-target:hover {
  transform: translateY(-1px) scale(1.03);
}

.target-button:active,
.next-round-button:active,
.idle-target:active {
  transform: scale(0.96);
}

.next-round-button svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.multi-round-result {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 12px;
  padding: 24px;
  overflow: hidden;
  background:
    radial-gradient(circle at 82% 16%, rgba(255, 255, 255, 0.16), transparent 22%),
    linear-gradient(135deg, #16795f, #2b8c96 46%, #95506f);
  background-size: 160% 160%;
  color: #fff;
  animation: colorIdleDrift 9s ease-in-out infinite, resultSlideIn 360ms cubic-bezier(0.22, 1, 0.36, 1);
}

.multi-result-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  min-height: 54px;
}

.multi-result-head span {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.multi-result-head strong {
  font-size: clamp(2.5rem, 7vw, 3.8rem);
  line-height: 0.8;
  font-weight: 900;
  letter-spacing: -0.08em;
}

.comparison-stack {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  grid-auto-rows: minmax(126px, auto);
  align-content: start;
  gap: 10px;
  min-height: 0;
  overflow: auto;
  padding: 2px 4px 2px 0;
}

.comparison-pair {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 8px;
  min-height: 126px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(12px);
  animation: swatchRise 360ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.comparison-pair header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.comparison-pair header span,
.comparison-pair header strong {
  color: rgba(255, 255, 255, 0.84);
  font-size: 0.68rem;
  font-weight: 900;
  white-space: nowrap;
}

.pair-body {
  display: grid;
  grid-template-rows: 1fr 1fr;
  gap: 6px;
  min-height: 0;
}

.pair-swatch-card {
  position: relative;
  min-height: 38px;
  overflow: hidden;
  border-radius: 11px;
}

.pair-label {
  position: absolute;
  top: 7px;
  left: 9px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.62rem;
  font-weight: 900;
  z-index: 1;
}

.pair-color {
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
}

.pair-swatch-card strong {
  position: absolute;
  right: 9px;
  bottom: 7px;
  color: rgba(255, 255, 255, 0.96);
  font-size: 0.58rem;
  font-weight: 900;
  z-index: 1;
  max-width: calc(100% - 18px);
  overflow: hidden;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pair-divider {
  display: none;
}

.next-round-floating {
  position: static;
  justify-self: end;
}

.final-result {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 34px;
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 18%, rgba(255, 255, 255, 0.2), transparent 22%),
    linear-gradient(135deg, #169168, #2a9d98 45%, #a94877);
  background-size: 170% 170%;
  color: #fff;
  animation: colorIdleDrift 8s ease-in-out infinite, resultSlideIn 360ms cubic-bezier(0.22, 1, 0.36, 1);
}

.final-ambient {
  position: absolute;
  inset: 28px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 22px;
  pointer-events: none;
}

.final-score {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  margin-top: 8px;
}

.final-score span,
.final-score em,
.final-meta span {
  color: rgba(255, 255, 255, 0.72);
  font-style: normal;
  font-weight: 900;
}

.final-score span {
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.final-score strong {
  margin-top: 8px;
  font-size: clamp(5.2rem, 14vw, 8rem);
  line-height: 0.78;
  font-weight: 900;
  letter-spacing: -0.09em;
}

.final-score em {
  margin-top: 8px;
  font-size: 1rem;
}

.final-meter {
  position: relative;
  z-index: 1;
  width: min(310px, 74%);
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.24);
}

.final-meter span {
  display: block;
  width: calc(var(--score) * 100%);
  height: 100%;
  border-radius: inherit;
  background: rgba(255, 255, 255, 0.92);
  animation:
    meterFill 760ms cubic-bezier(0.22, 1, 0.36, 1) both,
    meterSweep 760ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.final-meta {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 5px;
  text-align: center;
}

.final-meta strong {
  font-size: 1.1rem;
  font-weight: 900;
  text-transform: capitalize;
}

.round-breakdown {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  width: min(350px, 100%);
}

.round-breakdown span {
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 10px 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(10px);
  animation: swatchRise 420ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.round-breakdown em {
  color: rgba(255, 255, 255, 0.62);
  font-style: normal;
  font-size: 0.72rem;
  font-weight: 900;
}

.round-breakdown strong {
  font-size: 0.95rem;
  font-weight: 900;
}

.play-again-button {
  position: relative;
  z-index: 1;
  min-height: 42px;
  border: 0;
  border-radius: 999px;
  padding: 0 18px;
  background: rgba(255, 255, 255, 0.92);
  color: #0a0a0a;
  cursor: pointer;
  font-weight: 900;
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.play-again-button:hover {
  transform: translateY(-1px) scale(1.03);
}

.play-again-button:active {
  transform: scale(0.96);
}

.chosen-row {
  position: absolute;
  right: 30px;
  bottom: 100px;
  display: flex;
  justify-content: center;
  gap: 8px;
  min-height: 34px;
}

.chosen-dot {
  width: 28px;
  height: 28px;
  border: 2px solid rgba(255, 255, 255, 0.72);
  border-radius: 999px;
  animation: tactilePop 320ms cubic-bezier(0.16, 1, 0.3, 1) both;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.shape-demo,
.choice-grid,
.pattern-grid,
.sound-grid {
  display: grid;
  gap: 12px;
}

.sound-idle-demo,
.sound-memory-screen,
.sound-choice-screen,
.sound-result-screen {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 58% 44%, var(--sound-glow, rgba(0, 224, 198, 0.28)), transparent 25%),
    radial-gradient(circle at 82% 72%, rgba(143, 61, 255, 0.2), transparent 24%),
    radial-gradient(circle at 16% 16%, rgba(255, 255, 255, 0.055), transparent 22%),
    linear-gradient(115deg, #020405 0%, #040809 48%, #0b0612 100%);
  color: #f8f8f4;
}

.sound-idle-demo {
  --sound-primary: #00e0c6;
  --sound-secondary: #8f3dff;
  --sound-glow: rgba(0, 224, 198, 0.28);
}

.sound-wave {
  position: absolute;
  top: -12%;
  bottom: -12%;
  left: 62%;
  width: 285px;
  transform: translateX(-50%);
  filter: drop-shadow(0 0 30px var(--sound-glow));
  opacity: 0.92;
  animation: soundWaveBreathe 4.8s ease-in-out infinite;
}

.sound-wave span {
  position: absolute;
  top: calc(var(--i) * 1.62%);
  left: 50%;
  width: var(--w);
  height: 38px;
  border: 1px solid color-mix(in srgb, var(--sound-primary) 64%, var(--sound-secondary));
  border-radius: 50%;
  box-shadow:
    0 0 12px color-mix(in srgb, var(--sound-primary) 32%, transparent),
    inset 0 0 8px color-mix(in srgb, var(--sound-secondary) 26%, transparent);
  transform: translateX(calc(-50% + var(--x))) rotate(calc(var(--i) * 7deg));
  opacity: var(--o);
  animation: soundLinePulse 3.6s ease-in-out infinite;
  animation-delay: var(--d);
}

.sound-wave::before {
  content: "";
  position: absolute;
  inset: 0;
  left: 50%;
  width: 4px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: linear-gradient(180deg, var(--sound-secondary), var(--sound-primary), var(--sound-secondary));
  box-shadow:
    0 0 34px var(--sound-primary),
    0 0 78px var(--sound-glow);
  animation: soundCorePulse 2.2s ease-in-out infinite;
}

.sound-wave::after {
  content: "";
  position: absolute;
  inset: 4% 42%;
  border-radius: 999px;
  background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--sound-primary) 35%, transparent), transparent);
  filter: blur(18px);
}

.sound-idle-copy {
  position: absolute;
  top: 58px;
  left: 42px;
  width: min(330px, 58%);
  z-index: 2;
}

.sound-idle-copy strong {
  display: block;
  font-size: clamp(4.2rem, 12vw, 7.3rem);
  line-height: 0.8;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.sound-idle-copy p {
  margin: 28px 0 0;
  color: rgba(255, 255, 255, 0.66);
  font-size: 1rem;
  line-height: 1.35;
  font-weight: 800;
}

.sound-idle-meta {
  position: absolute;
  left: 42px;
  bottom: 46px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  z-index: 2;
}

.sound-idle-meta span {
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.78rem;
  font-weight: 900;
}

.sound-memory-screen .sound-wave {
  left: 48%;
  width: 330px;
  opacity: 0.96;
}

.sound-memory-timer {
  --timer-ink: rgba(255, 255, 255, 0.96);
  color: rgba(255, 255, 255, 0.96);
  text-shadow: 0 12px 36px rgba(0, 0, 0, 0.4);
}

.sound-memory-timer strong {
  background:
    linear-gradient(
      to bottom,
      rgba(255, 255, 255, 0.96) 0 calc(var(--progress) * 100%),
      rgba(255, 255, 255, 0.32) calc(var(--progress) * 100%) 100%
    );
  -webkit-background-clip: text;
  background-clip: text;
}

.sound-memory-timer span {
  color: rgba(255, 255, 255, 0.92);
}

.sound-choice-screen {
  --tune: 0.5;
  display: block;
  padding: 42px;
  cursor: ns-resize;
  touch-action: none;
}

.sound-choice-screen .sound-wave {
  left: 50%;
  width: 330px;
  opacity: 0.9;
  transform: translateX(-50%) translateY(calc((0.5 - var(--tune)) * 150px)) scaleX(calc(0.78 + var(--tune) * 0.58));
  animation: soundTunerFlow 3.8s ease-in-out infinite;
}

.sound-frequency-readout {
  position: absolute;
  left: 42px;
  bottom: 34px;
  display: flex;
  align-items: flex-end;
  gap: 5px;
  z-index: 2;
  pointer-events: none;
}

.sound-frequency-readout strong {
  font-size: clamp(4.6rem, 13vw, 7rem);
  line-height: 0.78;
  font-weight: 900;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  color: #fff;
}

.sound-frequency-readout span {
  margin-bottom: 7px;
  font-size: clamp(1.2rem, 4vw, 1.9rem);
  font-weight: 900;
  color: rgba(255, 255, 255, 0.9);
}

.sound-tuner-hint {
  position: absolute;
  top: 50px;
  left: 42px;
  z-index: 2;
  color: rgba(255, 255, 255, 0.52);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sound-submit-button {
  position: absolute;
  right: 32px;
  bottom: 32px;
  z-index: 3;
  width: 58px;
  height: 58px;
  border: 0;
  border-radius: 999px;
  background: #fff;
  color: #0b0b0b;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.28);
  cursor: pointer;
}

.sound-result-screen {
  display: grid;
  place-items: center;
  padding: 42px;
}

.sound-result-screen .sound-wave {
  left: 50%;
  width: 320px;
  opacity: 0.42;
}

.sound-result-copy,
.sound-result-meta {
  position: relative;
  z-index: 2;
}

.sound-result-copy {
  display: grid;
  justify-items: center;
}

.sound-result-copy span {
  color: var(--sound-primary);
  font-size: 0.82rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.sound-result-copy strong {
  font-size: clamp(5rem, 15vw, 8rem);
  line-height: 0.82;
  font-weight: 900;
}

.sound-result-copy em {
  color: rgba(255, 255, 255, 0.58);
  font-style: normal;
  font-weight: 900;
}

.sound-result-meta {
  display: grid;
  gap: 10px;
  width: min(360px, 100%);
  margin-top: 20px;
}

.sound-result-meta p {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin: 0;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
}

.sound-result-meta span {
  color: rgba(255, 255, 255, 0.54);
  font-weight: 800;
}

.sound-final {
  background:
    radial-gradient(circle at 50% 45%, rgba(0, 224, 198, 0.24), transparent 30%),
    linear-gradient(145deg, #020405, #080713);
  color: #fff;
}

.sound-final .sound-wave {
  left: 50%;
  opacity: 0.28;
}

.number-idle-demo,
.number-memory-screen,
.number-input-screen,
.number-result-screen {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 36%, rgba(135, 115, 255, 0.24), transparent 24%),
    radial-gradient(circle at 18% 82%, rgba(0, 208, 170, 0.14), transparent 22%),
    linear-gradient(145deg, #111019 0%, #171820 54%, #0f1515 100%);
  color: #f8f5ee;
}

.number-idle-demo,
.number-memory-screen,
.number-input-screen,
.number-result-screen {
  animation: screenReveal 430ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.number-idle-copy {
  position: absolute;
  left: 42px;
  bottom: 46px;
  z-index: 2;
  width: min(420px, calc(100% - 84px));
}

.number-idle-copy span,
.number-input-copy span,
.number-result-score span {
  color: #71f4d2;
  font-size: 0.78rem;
  font-weight: 950;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.number-idle-copy strong {
  display: block;
  margin-top: 10px;
  font-size: clamp(2.4rem, 7vw, 4.6rem);
  line-height: 0.92;
  font-weight: 950;
}

.number-idle-copy p {
  max-width: 360px;
  margin: 16px 0 0;
  color: rgba(248, 245, 238, 0.62);
  font-weight: 800;
  line-height: 1.45;
}

.number-stream {
  position: absolute;
  inset: 0;
  opacity: 0.44;
  pointer-events: none;
}

.number-stream span,
.number-idle-grid i,
.number-memory-orbit span {
  position: absolute;
  color: rgba(255, 255, 255, 0.2);
  font-size: clamp(2rem, 8vw, 5.8rem);
  font-style: normal;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
  animation: numberFloat 7s ease-in-out infinite;
  animation-delay: calc(var(--i) * -0.42s);
}

.number-stream span:nth-child(1) { top: 8%; left: 10%; }
.number-stream span:nth-child(2) { top: 15%; left: 72%; }
.number-stream span:nth-child(3) { top: 34%; left: 18%; }
.number-stream span:nth-child(4) { top: 36%; left: 58%; }
.number-stream span:nth-child(5) { top: 58%; left: 76%; }
.number-stream span:nth-child(6) { top: 72%; left: 12%; }
.number-stream span:nth-child(7) { top: 72%; left: 48%; }
.number-stream span:nth-child(8) { top: 6%; left: 42%; }
.number-stream span:nth-child(9) { top: 48%; left: 38%; }
.number-stream span:nth-child(10) { top: 78%; left: 82%; }

.number-idle-grid {
  position: absolute;
  inset: 44px;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  opacity: 0.2;
  mask-image: radial-gradient(circle at 50% 46%, #000, transparent 70%);
}

.number-idle-grid i {
  position: static;
  display: grid;
  place-items: center;
  min-height: 52px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  font-size: 1.2rem;
  animation: numberTilePulse 4s ease-in-out infinite;
  animation-delay: calc(var(--i) * -0.14s);
}

.number-focus {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
}

.number-focus strong {
  font-size: clamp(8rem, 26vw, 15rem);
  line-height: 0.8;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 30px 80px rgba(0, 0, 0, 0.42);
}

.number-focus em,
.number-round-label {
  position: absolute;
  color: rgba(255, 255, 255, 0.62);
  font-style: normal;
  font-weight: 900;
}

.number-round-label {
  top: 34px;
  left: 36px;
}

.number-focus em {
  right: 42px;
  bottom: 38px;
}

.number-memory-orbit {
  position: absolute;
  inset: 0;
}

.number-memory-orbit span {
  font-size: clamp(1.2rem, 4vw, 3rem);
}

.number-memory-orbit span:nth-child(3n+1) { left: 12%; top: 18%; }
.number-memory-orbit span:nth-child(3n+2) { left: 78%; top: 28%; }
.number-memory-orbit span:nth-child(3n) { left: 42%; top: 78%; }

.prep-screen {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  isolation: isolate;
  color: #fff;
  text-align: center;
  animation: screenReveal 430ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.prep-screen::before,
.prep-screen::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  border-radius: 999px;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.prep-screen::before {
  width: min(360px, 72%);
  aspect-ratio: 1;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.2), transparent 64%);
  filter: blur(2px);
  animation: prepPulse 2.1s ease-in-out infinite;
  z-index: -2;
}

.prep-screen::after {
  width: min(210px, 48%);
  aspect-ratio: 1;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: inset 0 0 70px rgba(255, 255, 255, 0.08);
  z-index: -1;
}

.prep-color {
  background:
    radial-gradient(circle at 22% 78%, rgba(255, 80, 170, 0.34), transparent 24%),
    radial-gradient(circle at 78% 18%, rgba(45, 220, 190, 0.36), transparent 28%),
    linear-gradient(135deg, #292033 0%, #2a7a76 50%, #927666 100%);
}

.prep-shape {
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 251, 240, 0.3), transparent 25%),
    linear-gradient(135deg, #7295a5 0%, #7f8aa0 48%, #9a7f92 100%);
}

.prep-sound {
  background:
    radial-gradient(circle at 50% 8%, rgba(0, 245, 210, 0.22), transparent 30%),
    radial-gradient(circle at 54% 86%, rgba(154, 73, 255, 0.28), transparent 28%),
    linear-gradient(145deg, #030408 0%, #080b12 100%);
}

.prep-number {
  background:
    radial-gradient(circle at 50% 44%, rgba(125, 105, 255, 0.24), transparent 28%),
    radial-gradient(circle at 18% 82%, rgba(84, 230, 196, 0.18), transparent 22%),
    linear-gradient(145deg, #111019 0%, #141a1b 100%);
}

.prep-screen strong {
  font-size: clamp(4.4rem, 16vw, 9.8rem);
  line-height: 0.82;
  font-weight: 950;
  letter-spacing: 0;
  text-shadow: 0 32px 86px rgba(0, 0, 0, 0.36);
  will-change: transform, opacity, filter;
}

.prep-screen em {
  position: absolute;
  left: 36px;
  top: 32px;
  color: rgba(255, 255, 255, 0.62);
  font-style: normal;
  font-size: 0.86rem;
  font-weight: 900;
  text-transform: lowercase;
}

.prep-orbit {
  position: absolute;
  inset: 0;
  opacity: 0.16;
  pointer-events: none;
}

.prep-orbit span {
  position: absolute;
  color: #fff;
  font-size: clamp(1.3rem, 4vw, 3.4rem);
  font-weight: 950;
  text-transform: lowercase;
  animation: numberFloat 5.8s ease-in-out infinite;
  animation-delay: calc(var(--i) * -0.36s);
}

.prep-orbit span:nth-child(1) { left: 13%; top: 22%; }
.prep-orbit span:nth-child(2) { left: 76%; top: 32%; }
.prep-orbit span:nth-child(3) { left: 43%; top: 76%; }

.number-input-screen {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 22px;
  padding: 44px;
  background:
    radial-gradient(circle at 50% 42%, rgba(113, 244, 210, 0.16), transparent 24%),
    linear-gradient(145deg, #11131a, #161922 52%, #101515);
}

.number-input-copy {
  text-align: center;
}

.number-input-copy strong {
  display: block;
  margin-top: 8px;
  font-size: clamp(2rem, 6vw, 3.8rem);
  line-height: 1;
  font-weight: 950;
}

.number-input-copy p {
  margin: 10px 0 0;
  color: rgba(248, 245, 238, 0.56);
  font-weight: 850;
}

.number-input-wrap {
  width: min(460px, 100%);
}

.number-answer-input {
  min-height: 76px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04), 0 24px 80px rgba(0, 0, 0, 0.24);
  font-size: clamp(1.7rem, 5vw, 3.1rem);
  font-weight: 950;
  letter-spacing: 0.16em;
}

.number-answer-input::placeholder {
  color: rgba(255, 255, 255, 0.2);
}

.number-submit-button {
  min-width: 144px;
  background: #f8f5ee;
  color: #101318;
}

.number-result-screen {
  display: grid;
  place-items: center;
  padding: 44px;
}

.number-result-score {
  display: grid;
  justify-items: center;
}

.number-result-score strong {
  margin-top: 10px;
  font-size: clamp(5.5rem, 16vw, 9rem);
  line-height: 0.82;
  font-weight: 950;
}

.number-result-score em {
  color: rgba(255, 255, 255, 0.58);
  font-style: normal;
  font-weight: 900;
}

.number-compare {
  display: grid;
  gap: 10px;
  width: min(430px, 100%);
  margin-top: 24px;
}

.number-compare p {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr);
  gap: 12px;
  margin: 0;
  padding: 14px 16px;
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.08);
}

.number-compare span {
  color: rgba(255, 255, 255, 0.54);
  font-weight: 850;
}

.number-compare strong {
  overflow-wrap: anywhere;
  color: #fff;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

.number-final {
  background:
    radial-gradient(circle at 50% 44%, rgba(135, 115, 255, 0.22), transparent 28%),
    linear-gradient(145deg, #111019, #141a1b);
  color: #fff;
}

.final-number-stream {
  opacity: 0.18;
}

.shape-memory-screen,
.shape-builder,
.shape-round-result {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.shape-memory-screen {
  display: grid;
  place-items: center;
  padding: 34px;
  background:
    radial-gradient(circle at 20% 18%, rgba(255, 255, 255, 0.16), transparent 22%),
    linear-gradient(135deg, #5aaa84, #62b28d 52%, #4f9f79);
  background-size: 160% 160%;
  animation:
    screenReveal 430ms cubic-bezier(0.16, 1, 0.3, 1) both,
    colorIdleDrift 9s ease-in-out infinite;
}

.shape-memory-grid {
  width: min(620px, 86%);
  display: grid;
  grid-template-columns: repeat(var(--shape-count, 1), minmax(0, 1fr));
  gap: clamp(14px, 2.4vw, 24px);
  align-items: center;
}

.shape-memory-item {
  position: relative;
  min-width: 0;
  aspect-ratio: 1;
  border-radius: 18px;
  background: transparent;
}

.shape-memory-item > span {
  position: absolute;
  top: 4px;
  left: 6px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.72rem;
  font-weight: 900;
}

.shape-canvas {
  width: 100%;
  height: 100%;
  overflow: visible;
  filter: drop-shadow(0 18px 34px rgba(0, 0, 0, 0.14));
}

.shape-canvas polygon {
  fill: rgba(255, 249, 239, 0.94);
  stroke: rgba(255, 249, 239, 0.98);
  stroke-width: 2;
  stroke-linejoin: round;
}

.shape-canvas circle {
  fill: #fff;
  stroke: rgba(45, 45, 45, 0.72);
  stroke-width: 2.4;
}

.shape-canvas .shape-center-dot {
  fill: rgba(95, 116, 151, 0.9);
  stroke: rgba(255, 255, 255, 0.86);
  stroke-width: 1.8;
}

.display-shape polygon,
.memory-display-shape polygon {
  fill: rgba(255, 247, 238, 0.96);
  stroke: rgba(255, 247, 238, 0.96);
}

.display-shape .shape-center-dot,
.memory-display-shape .shape-center-dot {
  display: block;
}

.editable-shape polygon {
  fill: rgba(255, 248, 238, 0.96);
  stroke: rgba(255, 248, 238, 0.98);
}

.editable-shape circle {
  fill: #fffaf1;
  stroke: rgba(45, 60, 70, 0.72);
  cursor: grab;
  touch-action: none;
}

.editable-shape circle:active {
  cursor: grabbing;
}

.shape-builder {
  display: grid;
  place-items: center;
  padding: 34px;
  background:
    radial-gradient(circle at 50% 48%, rgba(255, 255, 255, 0.18), transparent 24%),
    linear-gradient(135deg, #6fa68e, #8bb297 48%, #b7a36f);
}

.shape-builder-controls {
  position: absolute;
  top: 28px;
  left: 34px;
  right: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  z-index: 6;
}

.shape-builder-count {
  display: grid;
  place-items: center;
  min-width: 48px;
  min-height: 34px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  color: rgba(255, 255, 255, 0.88);
  font-weight: 900;
}

.shape-builder .shape-canvas {
  width: min(310px, 68%);
  height: min(310px, 68%);
}

.shape-lock-button {
  bottom: 30px;
  right: 34px;
}

.shape-points-toggle {
  min-height: 36px;
  border: 1px solid rgba(255, 248, 238, 0.32);
  border-radius: 999px;
  padding: 0 16px;
  background: rgba(255, 248, 238, 0.14);
  color: rgba(255, 248, 238, 0.96);
  cursor: pointer;
  font-weight: 900;
}

.shape-points-toggle:hover {
  background: rgba(255, 248, 238, 0.22);
}

.editable-shape.points-hidden circle {
  opacity: 0;
}

.shape-reset-button {
  position: absolute;
  left: 34px;
  bottom: 30px;
  min-width: 112px;
  min-height: 44px;
  border: 1px solid rgba(255, 248, 238, 0.32);
  border-radius: 7px;
  background: rgba(255, 248, 238, 0.1);
  color: rgba(255, 248, 238, 0.96);
  cursor: pointer;
  font-weight: 900;
}

.shape-reset-button:hover {
  background: rgba(255, 248, 238, 0.18);
}

.shape-round-result {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 12px;
  padding: 24px;
  background:
    radial-gradient(circle at 80% 18%, rgba(255, 255, 255, 0.14), transparent 22%),
    linear-gradient(135deg, #1d2430, #48667a 50%, #9b6f88);
  background-size: 160% 160%;
  color: #fff;
  animation: colorIdleDrift 9s ease-in-out infinite, resultSlideIn 360ms cubic-bezier(0.22, 1, 0.36, 1);
}

.shape-comparison-stack {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(136px, 1fr));
  gap: 10px;
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
}

.shape-comparison-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 8px;
  min-height: 170px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(12px);
}

.shape-comparison-card header,
.shape-legend {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.68rem;
  font-weight: 900;
}

.shape-legend span:first-child {
  color: rgba(0, 0, 0, 0.78);
}

.shape-legend span:last-child {
  color: rgba(255, 255, 255, 0.92);
}

.shape-overlay {
  position: relative;
  min-height: 94px;
}

.shape-overlay .shape-canvas {
  position: absolute;
  inset: 0;
}

.shape-overlay .target-shape polygon {
  fill: rgba(255, 255, 255, 0.34);
  stroke: rgba(255, 255, 255, 0.86);
}

.shape-overlay .guess-shape polygon {
  fill: rgba(0, 0, 0, 0.34);
  stroke: rgba(0, 0, 0, 0.72);
}

.shape-overlay .shape-canvas circle {
  display: none;
}

.shape-final {
  background:
    radial-gradient(circle at 20% 18%, rgba(255, 255, 255, 0.18), transparent 22%),
    linear-gradient(135deg, #20242d, #466579 48%, #9b6b84);
}

.shape-demo,
.choice-grid,
.sound-grid {
  grid-template-columns: repeat(3, 1fr);
}

.choice-button,
.sound-button,
.pattern-cell,
.answer-input {
  border: 2px solid color-mix(in srgb, var(--card-text) 16%, transparent);
  border-radius: 13px;
  background: color-mix(in srgb, var(--card) 78%, #fff 22%);
  color: var(--card-text);
  font-weight: 900;
}

.choice-button,
.sound-button,
.pattern-cell {
  min-height: 76px;
  cursor: pointer;
}

.choice-button.active,
.sound-button.active,
.pattern-cell.active {
  background: color-mix(in srgb, var(--card-text) 18%, var(--card));
  animation: tactilePop 260ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.choice-grid > *,
.pattern-grid > *,
.sound-grid > * {
  animation: tactilePop 340ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.choice-grid > *:nth-child(2),
.pattern-grid > *:nth-child(2),
.sound-grid > *:nth-child(2) {
  animation-delay: 40ms;
}

.choice-grid > *:nth-child(3),
.pattern-grid > *:nth-child(3),
.sound-grid > *:nth-child(3) {
  animation-delay: 80ms;
}

.choice-grid > *:nth-child(4),
.pattern-grid > *:nth-child(4),
.sound-grid > *:nth-child(4) {
  animation-delay: 120ms;
}

.pattern-grid > *:nth-child(n+5) {
  animation-delay: 160ms;
}

.shape-token {
  display: inline-block;
  width: 52px;
  height: 52px;
  background: var(--card-text);
}

.shape-circle {
  border-radius: 50%;
}

.shape-square {
  border-radius: 9px;
}

.shape-diamond {
  transform: rotate(45deg) scale(0.82);
}

.shape-pill {
  width: 74px;
  border-radius: 999px;
}

.shape-triangle {
  width: 0;
  height: 0;
  border-right: 29px solid transparent;
  border-bottom: 54px solid var(--card-text);
  border-left: 29px solid transparent;
  background: transparent;
}

.pattern-grid {
  grid-template-columns: repeat(4, 1fr);
}

.pattern-cell {
  aspect-ratio: 1;
  min-height: 0;
}

.reaction-hit {
  min-height: 220px;
  border: 0;
  border-radius: 16px;
  background: transparent;
  color: var(--card-text);
  cursor: pointer;
  font-size: clamp(2.4rem, 8vw, 5.4rem);
  font-weight: 900;
  letter-spacing: -0.07em;
}

.reaction-hit.go {
  background: rgba(18, 148, 95, 0.24);
}

.answer-input {
  width: 100%;
  min-height: 58px;
  padding: 0 16px;
  outline: 0;
  text-align: center;
  font-size: 1.3rem;
}

.game-actions {
  justify-content: center;
  gap: 12px;
}

.primary-button,
.secondary-button {
  min-height: 44px;
  border-radius: 999px;
  padding: 0 18px;
  cursor: pointer;
  font-weight: 900;
}

.primary-button {
  border: 0;
  background: var(--accent);
  color: var(--bg);
}

.secondary-button {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
}

.primary-button:hover,
.secondary-button:hover,
.stepper button:hover,
.choice-button:hover,
.sound-button:hover,
.pattern-cell:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.1);
}

.primary-button:active,
.secondary-button:active,
.stepper button:active,
.choice-button:active,
.sound-button:active,
.pattern-cell:active {
  transform: translateY(0) scale(0.97);
}

.score-readout {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 850;
}

.score-readout strong {
  color: var(--text);
}

.session-bar {
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.score-chip {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--soft);
}

.site-footer {
  position: fixed;
  left: 28px;
  bottom: 24px;
  display: flex;
  gap: 8px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.site-footer span {
  display: none;
}

@media (max-width: 760px) {
  .site-header {
    position: static;
    align-items: flex-start;
    gap: 16px;
    padding: 18px;
  }

  .left-nav {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .game-tabs {
    flex-wrap: wrap;
    gap: 16px;
  }

  .header-actions {
    margin-left: auto;
  }

  .discord-link {
    min-height: 36px;
    padding: 0 11px;
    font-size: 0.8rem;
  }

  .tab-button {
    font-size: 0.88rem;
  }

  .app-shell {
    padding-top: 18px;
  }

  .game-card {
    min-height: 520px;
    padding: 26px;
  }

  .info-page {
    min-height: 468px;
    align-content: start;
    gap: 18px;
  }

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

  .info-page h2 {
    font-size: clamp(2rem, 12vw, 3.7rem);
  }

  .choice-grid,
  .shape-demo,
  .sound-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .color-picker-layout {
    grid-template-columns: 102px 1fr;
    gap: 0;
  }

  .picker-rails {
    grid-template-columns: repeat(3, 34px);
  }

  .picker-rail {
    width: 34px;
  }

  .picker-progress {
    left: 136px;
  }

  .site-footer {
    position: static;
    justify-content: center;
    flex-wrap: wrap;
    padding: 20px;
  }
}

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