/* =========================================================
   Stroop Test — tool-specific styles.
   Layered on /tools/_shared/tool.css.
   ----------------------------------------------------------
   The four color buttons and the stimulus text use literal
   color values rather than the theme's accent — that's the
   whole point of the test. Each color has a light-mode and
   dark-mode value so the swatches stay distinguishable on
   both backgrounds without losing identity.
   ========================================================= */

:root {
  /* Light-theme stimulus + button hues. Saturated enough to
     be clearly distinct; not so saturated they bleed on screen. */
  --st-red:    #DC2626;
  --st-blue:   #2563EB;
  --st-green:  #16A34A;
  --st-yellow: #CA8A04;
  --st-purple: #9333EA;
  --st-orange: #EA580C;
}

/* Dark theme overrides — brighten the hues so they stay
   readable on the dark surface. Yellow especially needs a
   lift, since dim yellow on dark grey looks brown. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --st-red:    #F87171;
    --st-blue:   #60A5FA;
    --st-green:  #4ADE80;
    --st-yellow: #FACC15;
    --st-purple: #C084FC;
    --st-orange: #FB923C;
  }
}
:root[data-theme="dark"] {
  --st-red:    #F87171;
  --st-blue:   #60A5FA;
  --st-green:  #4ADE80;
  --st-yellow: #FACC15;
  --st-purple: #C084FC;
  --st-orange: #FB923C;
}

/* ---------- Stats row ---------- */
.st-stats {
  display: flex;
  justify-content: center;
  gap: var(--space-8);
  margin-bottom: var(--space-6);
  background: var(--surface-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-4);
}
.st-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  min-width: 80px;
}
.st-stat-num {
  font-size: 26px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  line-height: 1.1;
}
.st-stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ---------- Screens (start / trial / results) ---------- */
.st-screen { display: none; }
.st-screen[data-active="true"] { display: block; }

/* ---------- Start screen ---------- */
.st-intro {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: var(--space-6);
  text-align: center;
  line-height: 1.6;
}

.st-options {
  border: none;
  padding: 0;
  margin-bottom: var(--space-6);
}
.st-options legend {
  margin-bottom: var(--space-3);
}
.st-options-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
  gap: var(--space-3);
}
.st-options-note {
  margin: var(--space-3) 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
}
.st-option {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: var(--space-3) var(--space-4);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: var(--transition-colors);
}
.st-option:hover { border-color: var(--border-strong); }
.st-option:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft-bg);
  color: var(--accent-soft-fg);
}
.st-option:has(input:focus-visible) {
  outline: 2px solid var(--accent-ring);
  outline-offset: 2px;
}
.st-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
}

/* ---------- Trial screen ---------- */
.st-progress {
  width: 100%;
  height: 4px;
  background: var(--surface-2);
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin-bottom: var(--space-6);
}
.st-progress-bar {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.2s ease;
}

.st-stim-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 140px;
  margin-bottom: var(--space-5);
  background: var(--surface-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
}
.st-stim {
  font-size: 52px;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1;
  text-align: center;
  font-variant: small-caps;
  transition: color 0.05s ease;
}
@media (min-width: 640px) {
  .st-stim { font-size: 64px; }
  .st-stim-wrap { min-height: 168px; }
}

/* Stimulus ink-color classes — set the literal color on the
   text node. The class corresponds to the *ink*, not the word. */
.st-ink-red    { color: var(--st-red); }
.st-ink-blue   { color: var(--st-blue); }
.st-ink-green  { color: var(--st-green); }
.st-ink-yellow { color: var(--st-yellow); }
.st-ink-purple { color: var(--st-purple); }
.st-ink-orange { color: var(--st-orange); }

.st-prompt {
  text-align: center;
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: var(--space-4);
}

/* ---------- Color buttons ---------- */
.st-color-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
@media (min-width: 540px) {
  .st-color-grid { grid-template-columns: repeat(4, 1fr); }
  .st-color-grid.has-five { grid-template-columns: repeat(5, 1fr); }
  .st-color-grid.has-six  { grid-template-columns: repeat(3, 1fr); }
}

.st-color-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 76px;
  padding: var(--space-3) var(--space-2);
  border: 2px solid transparent;
  border-radius: var(--radius);
  background: var(--st-color, var(--surface-2));
  color: #FFFFFF;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.06s ease, filter 0.15s ease,
              box-shadow 0.15s ease, border-color 0.15s ease;
}
.st-color-btn[data-color="red"]    { --st-color: var(--st-red); }
.st-color-btn[data-color="blue"]   { --st-color: var(--st-blue); }
.st-color-btn[data-color="green"]  { --st-color: var(--st-green); }
.st-color-btn[data-color="yellow"] { --st-color: var(--st-yellow); color: #1F1300; }
.st-color-btn[data-color="purple"] { --st-color: var(--st-purple); }
.st-color-btn[data-color="orange"] { --st-color: var(--st-orange); }

.st-color-btn:hover:not(:disabled) {
  filter: brightness(1.08);
  transform: translateY(-1px);
}
.st-color-btn:active:not(:disabled) { transform: translateY(1px); }
.st-color-btn:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}
.st-color-btn:disabled {
  cursor: not-allowed;
  filter: saturate(0.8);
}

.st-color-name { font-size: 13px; }
.st-color-key {
  font-size: 11px;
  font-weight: 600;
  opacity: 0.8;
  letter-spacing: 0.12em;
  font-variant-numeric: tabular-nums;
}

/* Brief correct / incorrect flashes on the stimulus card. */
.st-stim-wrap.is-correct {
  border-color: var(--success);
  background: rgba(22, 163, 74, 0.08);
}
.st-stim-wrap.is-wrong {
  border-color: var(--danger);
  background: rgba(220, 38, 38, 0.08);
  animation: st-shake 0.32s ease;
}
@keyframes st-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.st-feedback {
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  min-height: 1.4em;
  color: var(--text-muted);
}
.st-feedback.is-correct { color: var(--success); }
.st-feedback.is-wrong   { color: var(--danger); }

/* ---------- Results screen ---------- */
.st-results-title {
  text-align: center;
  font-size: 22px;
  margin-bottom: var(--space-6);
  color: var(--text);
}

.st-results-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}
@media (min-width: 540px) {
  .st-results-grid { grid-template-columns: repeat(3, 1fr); }
}
.st-result {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--space-4);
  background: var(--surface-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.st-result-delta {
  background: var(--accent-soft-bg);
  border-color: var(--accent);
  color: var(--accent-soft-fg);
}
.st-result-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.st-result-delta .st-result-label { color: var(--accent-soft-fg); }
.st-result-value {
  font-size: 26px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  line-height: 1.1;
}
.st-result-delta .st-result-value { color: var(--accent-soft-fg); }
.st-result-sub {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted);
}
.st-result-delta .st-result-sub { color: var(--accent-soft-fg); opacity: 0.85; }

.st-interpretation {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: var(--space-6);
  padding: 0 var(--space-2);
}

.st-results-controls {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

/* ---------- Mobile ---------- */
@media (max-width: 480px) {
  .st-stats { gap: var(--space-6); }
  .st-stat-num { font-size: 22px; }
  .st-color-btn { min-height: 64px; }
}
