/* Task Switching — only test-specific overrides */
:root { --test-accent: #e76f51; }

.t-intro-icon::before {
  content: 'sync';
}

.ts-rule-badge {
  position: absolute;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  color: var(--text-muted) !important;
  font-family: 'Lexend', sans-serif;
  font-size: 13.5px;
  font-weight: 500;
  text-align: center;
  transition: opacity 0.2s;
  white-space: nowrap;
}

/* ── INTRO VISUAL MAPPING ── */
.ts-intro-visual {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: var(--test-accent-soft);
  border: 2px dashed var(--test-accent-border);
  border-radius: 16px;
  padding: 16px 8px;
  margin-bottom: 24px;
  box-sizing: border-box;
}

.ts-intro-rule {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.ts-intro-shape {
  width: 44px;
  height: 44px;
  fill: var(--test-accent);
}

.ts-intro-text {
  font-family: 'Lexend', sans-serif;
  font-size: 12.5px;
  color: var(--text);
  text-align: center;
  white-space: nowrap;
}

.ts-intro-divider {
  width: 2px;
  height: 60px;
  background: var(--test-accent-border);
}

/* Keyboard Hint */
.ts-keyboard-hint {
  font-family: 'Lexend', sans-serif;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
  margin-top: 12px;
  opacity: 0.85;
}

/* ── SCORE RANGE TABLE ── */

.ts-box {
  border-radius: 18px;
  min-height: 280px !important;
  background: var(--color-surface-container-low);
  border: 2.5px dashed var(--color-outline-variant);
  position: relative;
  overflow: hidden;
  margin-bottom: 24px;
}

.ts-shape-container {
  position: absolute;
  top: 46%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.ts-box[data-state="hit"]  { background: #edfaf4; border: 2.5px solid #2ecc71; }
.ts-box[data-state="miss"] { background: #fef2f1; border: 2.5px solid #e74c3c; }

/* SVGs for shapes instead of CSS borders */
.ts-shape {
  width: 120px;
  height: 120px;
  aspect-ratio: 1 / 1;
  display: block;
  fill: var(--test-accent);
  transition: transform 0.1s;
}
.ts-box[data-state="hit"] .ts-shape { fill: #2ecc71; transform: scale(1.1); }
.ts-box[data-state="miss"] .ts-shape { fill: #e74c3c; }

/* Switch Overlay */
.ts-overlay {
  position: absolute;
  inset: 0;
  background: rgba(231,111,81, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Manrope', sans-serif;
  font-size: 28px;
  font-weight: 900;
  color: #fff;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  letter-spacing: -0.02em;
}
.ts-box[data-state="switch"] .ts-overlay { opacity: 1; }

/* ── CONTROLS ── */
.ts-controls-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.ts-controls {
  display: flex;
  justify-content: center;
  gap: 16px;
  width: 100%;
}

.ts-btn {
  width: 160px;
  height: 56px;
  background: #fff;
  border: 2px solid var(--color-outline-variant);
  border-bottom-width: 4px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-family: 'Lexend', sans-serif;
  font-weight: 800;
  font-size: 15px;
  color: var(--text);
  cursor: pointer;
  transition: all 0.1s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.ts-btn:hover {
  border-color: var(--test-accent);
  background: var(--test-accent-soft);
  transform: translateY(-1px);
}

.ts-btn:active {
  transform: translateY(2px);
  border-bottom-width: 2px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

.ts-btn-shape {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ts-btn-shape svg { width: 100%; height: 100%; fill: var(--test-accent); }

/* ── DARK MODE OVERRIDES ── */
html.dark .ts-btn {
  background: var(--color-surface-container-high) !important;
  border-color: var(--color-outline) !important;
  color: var(--text) !important;
}
html.dark .ts-btn:hover {
  background: var(--test-accent-soft) !important;
  border-color: var(--test-accent) !important;
}
html.dark .ts-btn-shape svg {
  fill: var(--test-accent) !important;
}

/* ── KEYBOARD KEYS & ARROW STYLES ── */
.ts-arrow-connector {
  font-weight: 800;
  font-size: 15px;
  margin: 0 3px;
  color: var(--test-accent);
  display: inline-block;
  vertical-align: middle;
  line-height: 1;
}

.t-kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 26px;
  padding: 0 5px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
  background: var(--color-surface-container-high);
  border: 1.5px solid var(--color-outline);
  border-bottom-width: 3.5px;
  border-radius: 6px;
  margin: 0 3px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
  vertical-align: middle;
  line-height: 1;
}

html.dark .t-kbd {
  background: var(--color-surface-container);
  border-color: var(--color-outline-variant);
  color: var(--text);
}

@media (max-width: 480px) {
  .ts-box {
    min-height: 200px !important;
  }
  .ts-shape {
    width: 90px;
    height: 90px;
  }
  .ts-btn {
    width: 130px;
    height: 48px;
    font-size: 13px;
    border-radius: 12px;
    gap: 8px;
  }
  .ts-btn-shape {
    width: 16px;
    height: 16px;
  }
  .t-kbd {
    min-width: 20px;
    height: 20px;
    font-size: 12px;
    border-radius: 4px;
    border-bottom-width: 2.5px;
    margin: 0 1px;
    padding: 0 3px;
  }
  .ts-arrow-connector {
    font-size: 16px;
    margin: 0 4px;
  }
}

/* ── TASK SWITCHING PREVIEW ANIMATIONS ── */
.ts-preview-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 24px;
}

.ts-preview-arena {
  position: relative;
  width: 280px;
  height: 120px;
  background: color-mix(in srgb, var(--test-accent) 2%, rgba(0,0,0,0.35));
  border: 1.5px solid var(--color-outline);
  border-radius: 12px;
  overflow: hidden;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  box-sizing: border-box;
}

html.light .ts-preview-arena {
  background: color-mix(in srgb, var(--test-accent) 4%, rgba(0,0,0,0.04));
}

.ts-preview-rule {
  background: var(--color-surface-container-high);
  border: 1px solid var(--color-outline);
  border-radius: 4px;
  padding: 2px 8px;
  font-family: var(--font-b);
  font-size: 8px;
  font-weight: 700;
  color: var(--text-muted);
}

.ts-preview-rule::after {
  content: 'Rule: Circle=Left, Square=Right';
  animation: tsRuleTextAnimate 5.5s infinite steps(1);
}

@keyframes tsRuleTextAnimate {
  0%, 48% { content: 'Rule: Circle=Left, Square=Right'; }
  49%, 100% { content: 'Rule: Circle=Right, Square=Left'; }
}

.ts-preview-stimulus {
  width: 28px;
  height: 28px;
  border: 2.5px solid var(--test-accent);
  box-sizing: border-box;
  animation: tsStimulusAnimate 5.5s infinite steps(1);
}

@keyframes tsStimulusAnimate {
  0%, 5% { opacity: 0; }
  6%, 19% { opacity: 1; border-radius: 50%; background: color-mix(in srgb, var(--test-accent) 15%, transparent); border-color: var(--test-accent); transform: scale(1); }
  20%, 30% { opacity: 1; border-radius: 50%; background: rgba(46, 204, 113, 0.15); border-color: #2ecc71; transform: scale(1.1); }
  31%, 35% { opacity: 1; border-radius: 50%; background: color-mix(in srgb, var(--test-accent) 15%, transparent); border-color: var(--test-accent); transform: scale(1); }
  36%, 51% { opacity: 0; }
  52%, 69% { opacity: 1; border-radius: 2px; background: color-mix(in srgb, var(--test-accent) 15%, transparent); border-color: var(--test-accent); transform: scale(1); }
  70%, 80% { opacity: 1; border-radius: 2px; background: rgba(46, 204, 113, 0.15); border-color: #2ecc71; transform: scale(1.1); }
  81%, 85% { opacity: 1; border-radius: 2px; background: color-mix(in srgb, var(--test-accent) 15%, transparent); border-color: var(--test-accent); transform: scale(1); }
  86%, 100% { opacity: 0; }
}

.ts-preview-overlay {
  position: absolute;
  top: 38%; left: 50%;
  transform: translate(-50%, -50%);
  background: #ef4444;
  color: #ffffff;
  font-family: var(--font-h);
  font-size: 10px;
  font-weight: 900;
  padding: 3px 10px;
  border-radius: 4px;
  box-shadow: 0 4px 10px rgba(239, 68, 68, 0.4);
  opacity: 0;
  z-index: 5;
  animation: tsOverlayAnimate 5.5s infinite ease-in-out;
}

@keyframes tsOverlayAnimate {
  0%, 36% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
  38%, 46% { opacity: 1; transform: translate(-50%, -50%) scale(1.05); }
  48%, 100% { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
}

.ts-preview-controls {
  display: flex;
  gap: 20px;
  width: 100%;
  justify-content: center;
}

.ts-preview-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--color-surface-container-high);
  border: 1px solid var(--color-outline);
  border-radius: 6px;
  padding: 4px 10px;
  font-family: var(--font-b);
  font-size: 9px;
  font-weight: 700;
  color: var(--text-muted);
}

.ts-preview-btn-shape {
  width: 10px;
  height: 10px;
  border: 1px solid var(--text-muted);
  box-sizing: border-box;
}

.ts-preview-btn.btn-left {
  animation: tsLeftBtnActive 5.5s infinite ease-in-out;
}

@keyframes tsLeftBtnActive {
  0%, 19% { transform: scale(1); background: var(--color-surface-container-high); border-color: var(--color-outline); }
  20%, 28% { transform: scale(0.95); background: rgba(46, 204, 113, 0.1); border-color: #2ecc71; }
  29%, 69% { transform: scale(1); background: var(--color-surface-container-high); border-color: var(--color-outline); }
  70%, 78% { transform: scale(0.95); background: rgba(46, 204, 113, 0.1); border-color: #2ecc71; }
  79%, 100% { transform: scale(1); background: var(--color-surface-container-high); border-color: var(--color-outline); }
}

.ts-preview-btn.btn-left .left-shape {
  animation: tsLeftShapeAnimate 5.5s infinite steps(1);
}

.ts-preview-btn.btn-right .right-shape {
  animation: tsRightShapeAnimate 5.5s infinite steps(1);
}

@keyframes tsLeftShapeAnimate {
  0%, 48% { border-radius: 50%; }
  49%, 100% { border-radius: 2px; }
}

@keyframes tsRightShapeAnimate {
  0%, 48% { border-radius: 2px; }
  49%, 100% { border-radius: 50%; }
}

.ts-preview-click {
  position: absolute;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  pointer-events: none;
  z-index: 10;
  opacity: 0;
  animation: tsClickAnimate 5.5s infinite linear;
}

.ts-preview-click span {
  font-size: 20px;
  line-height: 1;
  display: block;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

@keyframes tsClickAnimate {
  0% { left: 140px; top: 60px; opacity: 0; transform: translate(-35%, -15%) scale(1.2); }
  5% { left: 140px; top: 60px; opacity: 0; }
  10% { left: 90px; top: 90px; opacity: 1; transform: translate(-35%, -15%) scale(1.2); }
  19% { left: 90px; top: 90px; opacity: 1; transform: translate(-35%, -15%) scale(1); }
  20% { left: 90px; top: 90px; opacity: 1; transform: translate(-35%, -15%) scale(0.8); }
  22% { left: 90px; top: 90px; opacity: 1; transform: translate(-35%, -15%) scale(1.1); }
  28% { left: 140px; top: 60px; opacity: 0; transform: translate(-35%, -15%) scale(1.2); }
  
  48% { left: 140px; top: 60px; opacity: 0; }
  56% { left: 90px; top: 90px; opacity: 1; transform: translate(-35%, -15%) scale(1.2); }
  69% { left: 90px; top: 90px; opacity: 1; transform: translate(-35%, -15%) scale(1); }
  70% { left: 90px; top: 90px; opacity: 1; transform: translate(-35%, -15%) scale(0.8); }
  72% { left: 90px; top: 90px; opacity: 1; transform: translate(-35%, -15%) scale(1.1); }
  78% { left: 140px; top: 60px; opacity: 0; transform: translate(-35%, -15%) scale(1.2); }
  100% { left: 140px; top: 60px; opacity: 0; }
}

.ts-preview-caption {
  font-family: var(--font-b);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-muted);
  text-align: center;
  width: 100%;
  line-height: 1.4;
}

.ts-preview-caption .ts-highlight {
  color: var(--test-accent);
  font-weight: 700;
}
