:root {
  --bg: #f4f6f8;
  --bg-strong: #ebeff5;
  --panel: rgba(255, 255, 255, 0.9);
  --panel-strong: #ffffff;
  --line: rgba(15, 23, 42, 0.12);
  --line-soft: rgba(15, 23, 42, 0.08);
  --text: #111827;
  --muted: #526071;
  --accent: #2563eb;
  --accent-soft: rgba(37, 99, 235, 0.12);
  --success: #15803d;
  --danger: #dc2626;
  --warning: #b45309;
  --shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  background: linear-gradient(180deg, #f7f9fb 0%, #eef3f8 100%);
  color: var(--text);
  font-family: Inter, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  border: none;
  cursor: pointer;
}

.app {
  position: relative;
  min-height: 100vh;
  padding: 28px clamp(20px, 4vw, 56px) 24px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.top-bar,
.progress-indicator,
.footer-bar,
.screen {
  position: relative;
  z-index: 1;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

.logo {
  font-size: clamp(0.95rem, 1.2vw, 1.3rem);
  letter-spacing: 0.18rem;
  font-weight: 800;
  text-transform: uppercase;
}

.logo span {
  color: var(--accent);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.64rem;
  letter-spacing: 0.18rem;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.75);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse 1.8s ease-in-out infinite;
}

.progress-indicator {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 18px;
  opacity: 0;
  transform: translateY(-10px);
  max-height: 0;
  overflow: hidden;
  transition: opacity 0.4s ease, transform 0.4s ease, max-height 0.4s ease;
}

.progress-indicator.visible {
  opacity: 1;
  transform: translateY(0);
  max-height: 60px;
}

.progress-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.58rem;
  letter-spacing: 0.16rem;
  background: rgba(255, 255, 255, 0.7);
  transition: all 0.25s ease;
}

.progress-step.active {
  color: var(--text);
  border-color: rgba(37, 99, 235, 0.4);
  background: rgba(37, 99, 235, 0.06);
}

.progress-step.complete {
  color: var(--accent);
  border-color: rgba(37, 99, 235, 0.4);
}

.screen {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 0 20px;
}

.hero,
.experiment-shell,
.result-shell,
.final-shell {
  width: min(100%, 980px);
  animation: riseIn 0.55s ease;
}

.hero {
  max-width: 860px;
  padding-top: clamp(32px, 7vh, 72px);
}

.eyebrow {
  color: var(--accent);
  font-size: 0.7rem;
  letter-spacing: 0.28rem;
  text-transform: uppercase;
  margin-bottom: 22px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.hero h1 {
  font-size: clamp(3rem, 7vw, 6.4rem);
  line-height: 0.94;
  letter-spacing: -0.07em;
  margin-bottom: 26px;
  max-width: 820px;
}

.hero h1 .accent {
  color: var(--accent);
}

.hero .description {
  max-width: 620px;
  color: var(--muted);
  line-height: 1.7;
  font-size: clamp(1rem, 1.8vw, 1.12rem);
  margin-bottom: 34px;
}

.action-btn,
.inline-btn,
.option-btn,
.focus-node,
.small-btn {
  transition: transform 0.22s ease, box-shadow 0.22s ease, background 0.22s ease, border-color 0.22s ease;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 17px 24px;
  min-width: 236px;
  border: 1px solid rgba(37, 99, 235, 0.25);
  background: var(--accent);
  color: #ffffff;
  letter-spacing: 0.08rem;
  text-transform: uppercase;
  border-radius: 12px;
  box-shadow: 0 12px 22px rgba(37, 99, 235, 0.18);
}

.action-btn span {
  color: #ffffff;
  font-size: 1.3rem;
}

.action-btn:hover,
.action-btn:focus-visible,
.inline-btn:hover,
.inline-btn:focus-visible,
.option-btn:hover,
.option-btn:focus-visible,
.small-btn:hover,
.small-btn:focus-visible,
.focus-node:hover,
.focus-node:focus-visible {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.experiment-shell {
  display: grid;
  gap: 22px;
}

.experiment-panel,
.result-panel,
.final-card,
.metric-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  backdrop-filter: blur(6px);
  box-shadow: 0 14px 35px rgba(15, 23, 42, 0.06);
}

.experiment-panel {
  padding: clamp(20px, 3vw, 32px);
  border-radius: 20px;
}

.experiment-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 18px;
}

.experiment-header h2 {
  font-size: clamp(1.5rem, 2.5vw, 2.5rem);
  letter-spacing: -0.04em;
}

.experiment-header .meta {
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.18rem;
  text-transform: uppercase;
}

.test-copy {
  font-size: 1rem;
  color: var(--muted);
  line-height: 1.7;
  margin-bottom: 18px;
}

.reaction-stage {
  display: grid;
  place-items: center;
  width: min(100%, 660px);
  min-height: 220px;
  margin: 0 auto;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: #f8fafc;
  font-size: clamp(2.6rem, 8vw, 5rem);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text);
  user-select: none;
  transition: all 0.25s ease;
}

.reaction-stage.waiting {
  background: #f8fafc;
  color: var(--text);
  border-color: var(--line);
}

.reaction-stage.ready {
  color: #ffffff;
  background: linear-gradient(135deg, #1d4ed8, #2563eb);
  border-color: rgba(37, 99, 235, 0.6);
  box-shadow: 0 16px 28px rgba(37, 99, 235, 0.18);
}

.reaction-stage.early {
  background: rgba(220, 38, 38, 0.06);
  border-color: rgba(220, 38, 38, 0.3);
  color: #991b1b;
}

.test-tip {
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.14rem;
  text-transform: uppercase;
}

.memory-grid,
.stroop-options,
.logic-options,
.focus-board {
  display: grid;
  gap: 12px;
}

.memory-grid {
  grid-template-columns: repeat(auto-fit, minmax(68px, 1fr));
  margin-top: 12px;
}

.memory-card,
.option-btn {
  border: 1px solid var(--line);
  background: #f8fafc;
  color: var(--text);
  min-height: 72px;
  border-radius: 16px;
  font-size: clamp(1.8rem, 5vw, 2.5rem);
}

.memory-card.selected {
  border-color: rgba(37, 99, 235, 0.5);
  background: rgba(37, 99, 235, 0.08);
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.1);
}

.memory-actions,
.result-actions,
.final-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 20px;
}

.inline-btn,
.small-btn {
  padding: 13px 18px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--text);
  letter-spacing: 0.12rem;
  text-transform: uppercase;
  border-radius: 12px;
}

.inline-btn.primary,
.small-btn.primary {
  border-color: rgba(37, 99, 235, 0.4);
  background: var(--accent);
  color: #ffffff;
}

.stroop-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 26px;
}

.stroop-word {
  min-height: 170px;
  display: grid;
  place-items: center;
  width: min(100%, 620px);
  text-align: center;
  font-size: clamp(3rem, 8vw, 6rem);
  font-weight: 800;
  letter-spacing: -0.06em;
  text-transform: uppercase;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #f8fafc;
}

.stroop-options {
  grid-template-columns: repeat(2, minmax(160px, 1fr));
  width: min(100%, 520px);
}

.option-btn {
  min-height: 76px;
  border-radius: 14px;
  padding: 12px 15px;
  font-size: 1.06rem;
  letter-spacing: 0.12rem;
  font-weight: 700;
  text-transform: uppercase;
}

.option-btn[data-color="red"] { color: #b91c1c; }
.option-btn[data-color="blue"] { color: #1d4ed8; }
.option-btn[data-color="green"] { color: #166534; }
.option-btn[data-color="yellow"] { color: #a16207; }

.logic-panel {
  display: grid;
  gap: 18px;
}

.logic-question {
  display: grid;
  gap: 18px;
  padding: 18px 0 4px;
}

.logic-question .prompt {
  font-size: clamp(1.7rem, 3vw, 2.8rem);
  letter-spacing: -0.05em;
}

.logic-options {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.focus-board {
  grid-template-columns: repeat(4, minmax(70px, 1fr));
  gap: 10px;
  width: min(100%, 520px);
  margin: 0 auto;
}

.focus-node {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #e5e7eb;
}

.focus-node.target {
  background: radial-gradient(circle at 30% 30%, #dcfce7 0%, #4ade80 30%, #16a34a 100%);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.55);
}

.focus-node.distractor {
  background: radial-gradient(circle at 30% 30%, #fecaca 0%, #f87171 35%, #b91c1c 100%);
}

.focus-node.neutral {
  background: radial-gradient(circle at 30% 30%, #e2e8f0 0%, #94a3b8 45%, #475569 100%);
}

.focus-node.hit {
  opacity: 0.4;
  transform: scale(0.9);
}

.focus-status {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.12rem;
  text-transform: uppercase;
}

.result-shell {
  max-width: 760px;
}

.result-panel {
  border-radius: 22px;
  padding: clamp(22px, 3vw, 34px);
  animation: riseIn 0.5s ease;
}

.result-panel h2 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  letter-spacing: -0.06em;
  margin-bottom: 18px;
}

.result-number {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 18px;
  font-size: clamp(2.8rem, 7vw, 5rem);
  font-weight: 800;
  letter-spacing: -0.06em;
}

.result-number small {
  font-size: 0.35em;
  color: var(--muted);
  letter-spacing: 0.14rem;
  text-transform: uppercase;
}

.result-message {
  color: var(--muted);
  line-height: 1.7;
  font-size: 1.05rem;
  margin-bottom: 10px;
}

.final-shell {
  max-width: 980px;
}

.final-card {
  border-radius: 24px;
  padding: clamp(20px, 3vw, 36px);
}

.final-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.final-header h2 {
  font-size: clamp(2.1rem, 5vw, 3.6rem);
  letter-spacing: -0.06em;
}

.profile-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border: 1px solid rgba(37, 99, 235, 0.2);
  background: rgba(37, 99, 235, 0.06);
  border-radius: 999px;
  font-size: 0.7rem;
  letter-spacing: 0.18rem;
  text-transform: uppercase;
  color: var(--accent);
}

.score-grid {
  display: grid;
  gap: 26px;
  margin-top: 16px;
}

.score-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line-soft);
}

.score-hero .score-label {
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.22rem;
  text-transform: uppercase;
}

.score-hero .big-score {
  font-size: clamp(3.6rem, 9vw, 7rem);
  letter-spacing: -0.09em;
  font-weight: 800;
}

.score-hero .brain-type {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  letter-spacing: -0.05em;
  margin-top: 8px;
}

.score-hero .profile-copy {
  max-width: 680px;
  color: var(--muted);
  line-height: 1.7;
}

.metric-list {
  display: grid;
  gap: 18px;
}

.metric-row {
  display: grid;
  gap: 8px;
}

.metric-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 0.7rem;
  letter-spacing: 0.16rem;
  text-transform: uppercase;
  color: var(--muted);
}

.bar-track {
  position: relative;
  height: 12px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.05);
  border: 1px solid var(--line-soft);
  overflow: hidden;
}

.bar-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #93c5fd, #2563eb);
  transition: width 0.8s ease;
}

.final-actions {
  justify-content: center;
  margin-top: 26px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.footer-bar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding-top: 12px;
  color: rgba(17, 24, 39, 0.45);
  font-size: 0.62rem;
  letter-spacing: 0.18rem;
  text-transform: uppercase;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.8; }
}

@keyframes riseIn {
  0% {
    opacity: 0;
    transform: translateY(18px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 700px) {
  .app {
    padding-left: 18px;
    padding-right: 18px;
  }

  .top-bar,
  .footer-bar,
  .experiment-header,
  .final-header,
  .focus-status {
    flex-direction: column;
    align-items: flex-start;
  }

  .status-pill {
    font-size: 0.52rem;
    letter-spacing: 0.16rem;
  }

  .progress-step {
    min-width: 42px;
    padding: 7px 8px;
    letter-spacing: 0.12rem;
  }

  .stroop-options,
  .logic-options,
  .focus-board {
    grid-template-columns: 1fr 1fr;
  }

  .action-btn,
  .inline-btn,
  .small-btn {
    width: 100%;
    justify-content: center;
  }

  .memory-actions,
  .result-actions,
  .final-actions {
    display: grid;
    grid-template-columns: 1fr;
  }
}

@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;
  }
}