:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --ink: #132638;
  --muted: #607184;
  --line: #dbe3ea;
  --navy: #17324d;
  --navy-2: #244761;
  --teal: #2b7774;
  --teal-soft: #e8f3f2;
  --green: #2f7a57;
  --green-soft: #e8f4ec;
  --lavender: #6a63a8;
  --lavender-soft: #f0eef8;
  --danger: #a63f45;
  --danger-soft: #faeeee;
  --shadow: 0 18px 48px rgba(25, 50, 73, 0.08);
  --shadow-soft: 0 8px 24px rgba(25, 50, 73, 0.06);
  --radius: 20px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
  font-size: 18px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.skip-link {
  position: absolute;
  inset-inline-start: 18px;
  top: -80px;
  z-index: 100;
  padding: 10px 14px;
  background: var(--navy);
  color: #fff;
  border-radius: 10px;
  text-decoration: none;
}
.skip-link:focus { top: 16px; }

.shell {
  width: min(1120px, calc(100% - 40px));
  margin-inline: auto;
}

.site-header {
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid rgba(219, 227, 234, 0.9);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(10px);
}

.nav-bar {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: var(--navy);
  color: #fff;
  font-size: 27px;
  line-height: 1;
}

.brand-copy {
  display: grid;
  line-height: 1.2;
}

.brand-copy strong {
  font-size: 22px;
  letter-spacing: -0.02em;
}

.brand-copy small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.nav-action {
  color: var(--navy);
  text-decoration: none;
  font-weight: 700;
  font-size: 16px;
  padding: 8px 0;
  border-bottom: 2px solid transparent;
}
.nav-action:hover,
.nav-action:focus-visible { border-color: var(--teal); }

.page-main { padding-block: 64px 42px; }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(320px, 0.82fr);
  gap: 46px;
  align-items: center;
}

.kicker {
  display: inline-block;
  color: var(--teal);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.01em;
  margin-bottom: 10px;
}

.hero h1 {
  margin: 0;
  max-width: 680px;
  color: var(--navy);
  font-size: clamp(48px, 6vw, 72px);
  line-height: 1.14;
  letter-spacing: -0.035em;
}

.hero-copy > p {
  max-width: 670px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 21px;
  line-height: 1.9;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 20px;
  margin-top: 30px;
}

.primary-button,
.secondary-button,
.card-button {
  border: 0;
  border-radius: 12px;
  min-height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 22px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.primary-button,
.card-button {
  background: var(--navy);
  color: #fff;
  box-shadow: 0 8px 18px rgba(23, 50, 77, 0.14);
}

.primary-button:hover,
.card-button:hover { background: var(--navy-2); }
.primary-button:active,
.card-button:active { transform: translateY(1px); }

.secondary-button {
  background: #fff;
  color: var(--navy);
  border: 1px solid var(--line);
}
.secondary-button:hover { background: var(--surface-soft); }

.text-link {
  color: var(--navy);
  font-weight: 800;
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
}

.hero-points {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  margin: 28px 0 0;
  padding: 0;
  color: var(--muted);
  font-size: 15px;
  list-style: none;
}
.hero-points li::before {
  content: "•";
  color: var(--teal);
  margin-inline-end: 8px;
}

.lab-flow {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}

.flow-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.flow-badge {
  color: var(--navy);
  background: #edf2f6;
  border-radius: 999px;
  padding: 4px 10px;
  direction: ltr;
}

.flow-step {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 14px;
  align-items: center;
}

.flow-number {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: var(--teal-soft);
  color: var(--teal);
  font-weight: 900;
}

.flow-step strong { display: block; color: var(--navy); font-size: 18px; }
.flow-step small { color: var(--muted); font-size: 14px; }

.flow-line {
  display: block;
  width: 1px;
  height: 24px;
  background: var(--line);
  margin: 5px 20px;
}

.experiments-section { padding-top: 86px; }

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 24px;
}
.section-heading h2 {
  margin: 0;
  color: var(--navy);
  font-size: 34px;
  line-height: 1.3;
}
.section-heading p {
  margin: 0;
  max-width: 510px;
  color: var(--muted);
  font-size: 16px;
}

.experiment-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.experiment-card {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  min-height: 330px;
  box-shadow: var(--shadow-soft);
}

.available-card {
  border-color: #bdd9d6;
  box-shadow: 0 14px 34px rgba(43, 119, 116, 0.09);
}

.muted-card { box-shadow: none; }

.card-topline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.experiment-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  background: var(--surface-soft);
  border-radius: 14px;
  color: var(--navy);
  font-size: 24px;
}

.status {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 13px;
  font-weight: 800;
}
.status-ready { background: var(--green-soft); color: var(--green); }
.status-soon { background: #eef2f5; color: #6c7885; }

.card-content { margin-top: 24px; }
.card-category { color: var(--teal); font-size: 13px; font-weight: 800; }
.experiment-card h3 {
  margin: 5px 0 10px;
  color: var(--navy);
  font-size: 24px;
  line-height: 1.4;
}
.experiment-card p {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.8;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
  padding-top: 24px;
}
.card-meta span {
  background: var(--surface-soft);
  border: 1px solid #e8edf1;
  color: var(--muted);
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
}
.card-button { margin-top: 16px; width: 100%; min-height: 46px; }

.analysis-note {
  margin-top: 36px;
  background: #eef4f5;
  border: 1px solid #d8e7e6;
  border-radius: 18px;
  padding: 24px 26px;
  display: flex;
  align-items: center;
  gap: 18px;
}
.analysis-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: #fff;
  color: var(--teal);
  font-size: 24px;
  flex: 0 0 auto;
}
.analysis-note h2 { margin: 0; color: var(--navy); font-size: 21px; }
.analysis-note p { margin: 3px 0 0; color: var(--muted); font-size: 15px; }
.analysis-format {
  margin-inline-start: auto;
  background: #fff;
  border: 1px solid #d7e5e4;
  border-radius: 999px;
  color: var(--teal);
  padding: 7px 12px;
  font-weight: 800;
  font-size: 14px;
  white-space: nowrap;
}

.site-footer { margin-top: 34px; border-top: 1px solid var(--line); background: #fff; }
.footer-inner {
  min-height: 84px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  color: var(--muted);
  font-size: 14px;
}
.footer-inner strong { color: var(--navy); }

/* Experiment page */
.experiment-page { padding-block: 34px 56px; }

.back-link {
  display: inline-block;
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  margin-bottom: 26px;
}
.back-link:hover { color: var(--navy); }

.experiment-title-row {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 30px;
  margin-bottom: 28px;
}
.experiment-title-row h1 {
  margin: 0;
  color: var(--navy);
  font-size: clamp(38px, 5vw, 54px);
  line-height: 1.2;
  letter-spacing: -0.025em;
}
.experiment-title-row p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 18px;
}

.experiment-summary {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.experiment-summary span {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 11px;
  color: var(--muted);
  font-size: 12px;
}
.experiment-summary strong {
  display: block;
  color: var(--navy);
  font-size: 16px;
  line-height: 1.2;
}

.experiment-layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.72fr) minmax(0, 1.28fr);
  gap: 22px;
  align-items: start;
}

.instructions-card,
.session-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.instructions-card { padding: 26px; }
.instructions-card h2 { margin: 0 0 20px; color: var(--navy); font-size: 26px; }

.instruction-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 18px;
}
.instruction-list li {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 12px;
  align-items: start;
}
.instruction-list li > span {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--teal-soft);
  color: var(--teal);
  font-weight: 900;
}
.instruction-list strong { color: var(--navy); font-size: 17px; }
.instruction-list p { margin: 2px 0 0; color: var(--muted); font-size: 14px; line-height: 1.7; }

.tip-box {
  margin-top: 24px;
  padding: 16px;
  background: var(--lavender-soft);
  border-radius: 14px;
}
.tip-box strong { color: var(--lavender); font-size: 15px; }
.tip-box p { margin: 3px 0 0; color: #68657a; font-size: 14px; line-height: 1.7; }

.session-card {
  min-width: 0;
  min-height: 500px;
  padding: 32px;
  box-shadow: var(--shadow-soft);
}

#startScreen h2,
#results h2 {
  margin: 14px 0 8px;
  color: var(--navy);
  font-size: 31px;
}

.session-description {
  color: var(--muted);
  margin: 0 0 24px;
  font-size: 16px;
  max-width: 620px;
}

.field-label {
  display: block;
  color: var(--navy);
  font-weight: 800;
  font-size: 15px;
  margin-bottom: 7px;
}

.participant-input {
  width: 100%;
  border: 1px solid #cfd9e1;
  background: #fff;
  color: var(--ink);
  border-radius: 12px;
  padding: 13px 14px;
  font-size: 18px;
  outline: 0;
}
.participant-input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 4px rgba(43, 119, 116, 0.11);
}

.wide-button { width: 100%; margin-top: 16px; }
.keyboard-hint { color: var(--muted); text-align: center; font-size: 13px; margin: 13px 0 0; }
kbd {
  font-family: inherit;
  border: 1px solid #cdd6de;
  border-bottom-width: 2px;
  background: #f8fafc;
  border-radius: 6px;
  padding: 1px 7px;
  font-size: 12px;
  direction: ltr;
}

#experiment,
#results { display: none; }

.trial-screen { min-height: 436px; }
.trial-header {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 18px;
  color: var(--muted);
  font-size: 14px;
}

progress {
  width: 100%;
  height: 8px;
  border: 0;
  border-radius: 999px;
  overflow: hidden;
  background: #e8edf1;
}
progress::-webkit-progress-bar { background: #e8edf1; }
progress::-webkit-progress-value { background: var(--teal); }
progress::-moz-progress-bar { background: var(--teal); }

.stimulus-stage {
  min-height: 318px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.trial-message {
  color: var(--navy);
  font-size: clamp(30px, 5vw, 44px);
  font-weight: 900;
  text-align: center;
  min-height: 68px;
}
.active-message { color: var(--teal); }
.success-message { color: var(--green); }
.error-message { color: var(--danger); }

.stimulus {
  display: none;
  width: 156px;
  height: 156px;
  margin-top: 24px;
  border-radius: 28px;
  background: #31b768;
  box-shadow: 0 16px 34px rgba(49, 183, 104, 0.22);
}

.response-button {
  width: 100%;
  min-height: 54px;
  border: 1px solid #bddad7;
  border-radius: 12px;
  background: var(--teal-soft);
  color: var(--teal);
  font-weight: 900;
  cursor: pointer;
}
.response-button:active { background: #d9ecea; }
.response-note { margin: 9px 0 0; color: var(--muted); text-align: center; font-size: 12px; }

.result-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 22px 0 12px;
}
.result-stats div {
  background: var(--surface-soft);
  border: 1px solid #e6ebef;
  border-radius: 14px;
  padding: 14px;
}
.result-stats span { display: block; color: var(--muted); font-size: 12px; }
.result-stats strong { display: block; margin-top: 4px; color: var(--navy); font-size: 22px; direction: ltr; }

.results-summary { color: var(--muted); margin: 8px 0 18px; font-size: 14px; }

.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
caption { text-align: start; color: var(--muted); font-size: 13px; margin-bottom: 8px; }
th, td { border-bottom: 1px solid #e6ebef; padding: 11px 8px; text-align: center; }
th { color: var(--muted); font-size: 12px; background: var(--surface-soft); }
td { color: var(--ink); }

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}
.jamovi-note { margin: 10px 0 0; color: var(--muted); font-size: 12px; }

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(43, 119, 116, 0.24);
  outline-offset: 3px;
}

@media (hover: hover) and (pointer: fine) {
  .experiment-card { transition: transform 0.18s ease, box-shadow 0.18s ease; }
  .available-card:hover { transform: translateY(-3px); box-shadow: 0 18px 38px rgba(43, 119, 116, 0.12); }
}

@media (max-width: 980px) {
  .hero { grid-template-columns: 1fr; }
  .lab-flow { max-width: 620px; }
  .experiment-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .experiment-layout { grid-template-columns: 1fr; }
  .instructions-card { order: 2; }
  .session-card { order: 1; }
}

@media (max-width: 680px) {
  body { font-size: 17px; }
  .shell { width: min(100% - 28px, 1120px); }
  .site-header { position: static; }
  .nav-bar { min-height: 72px; }
  .brand-copy small { display: none; }
  .brand-copy strong { font-size: 20px; }
  .brand-mark { width: 40px; height: 40px; }
  .page-main { padding-top: 42px; }
  .hero { gap: 28px; }
  .hero h1 { font-size: 46px; }
  .hero-copy > p { font-size: 18px; }
  .hero-actions { align-items: stretch; flex-direction: column; }
  .primary-button, .text-link { width: 100%; text-align: center; }
  .hero-points { gap: 8px 14px; }
  .lab-flow { padding: 22px; }
  .experiments-section { padding-top: 62px; }
  .section-heading { align-items: start; flex-direction: column; gap: 8px; }
  .experiment-grid { grid-template-columns: 1fr; }
  .experiment-card { min-height: auto; }
  .analysis-note { align-items: start; flex-wrap: wrap; }
  .analysis-format { margin-inline-start: 0; }
  .footer-inner { align-items: start; flex-direction: column; justify-content: center; padding-block: 18px; }

  .experiment-title-row { align-items: start; flex-direction: column; }
  .experiment-summary { justify-content: flex-start; }
  .session-card, .instructions-card { padding: 22px; }
  .trial-header { grid-template-columns: 1fr; gap: 8px; }
  .stimulus-stage { min-height: 290px; }
  .stimulus { width: 138px; height: 138px; border-radius: 24px; }
  .result-stats { grid-template-columns: 1fr; }
  .result-actions { flex-direction: column; }
  .result-actions button { width: 100%; }
}

@media (min-width: 900px) and (pointer: fine) {
  .response-button { display: none; }
  .response-note { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}
