  :root {
    --primary: #1a5276;
    --primary-light: #2980b9;
    --accent: #a0581a;
    --accent-light: #c47020;
    --success: #1e8449;
    --warning: #c47020;
    --danger: #c0392b;
    --bg: #f8f9fa;
    --card-bg: #ffffff;
    --text: #2c3e50;
    /* FIX: #7f8c8d only 4.17:1 on white — changed to #566573 for 5.9:1 */
    --text-light: #566573;
    --border: #dee2e6;
    --shadow: 0 2px 12px rgba(0,0,0,0.08);
    --radius: 12px;
  }

  /* Dark mode */
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
      --primary: #5dade2;
      --primary-light: #85c1e9;
      --accent: #f0b27a;
      --accent-light: #f5cba7;
      --success: #58d68d;
      --warning: #f5cba7;
      --danger: #ec7063;
      --bg: #1a1a2e;
      --card-bg: #222244;
      --text: #e8e8e8;
      --text-light: #e0e0f0;
      --border: #3a3a5c;
      --shadow: 0 2px 12px rgba(0,0,0,0.3);
    }
  }
  [data-theme="dark"] {
    --primary: #5dade2;
    --primary-light: #85c1e9;
    --accent: #f0b27a;
    --accent-light: #f5cba7;
    --success: #58d68d;
    --warning: #f5cba7;
    --danger: #ec7063;
    --bg: #1a1a2e;
    --card-bg: #222244;
    --text: #e8e8e8;
    --text-light: #e0e0f0;
    --border: #3a3a5c;
    --shadow: 0 2px 12px rgba(0,0,0,0.3);
  }

  /* Dark mode: all color:var(--bg) automatically adapts */

  /* Theme toggle */
  .theme-toggle {
    position: fixed;
    top: 72px;
    right: 16px;
    z-index: 10001;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-radius: 24px;
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text);
    box-shadow: var(--shadow);
    transition: all 0.2s;
  }
  .theme-toggle:hover { border-color: var(--primary); }
  .theme-toggle:hover #themeLabel { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 3px; }
  .theme-toggle:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
  .theme-toggle-icon { font-size: 1.1rem; }
  .theme-toggle-inline {
    display: none;
    margin-left: auto;
    padding: 4px 10px;
    font-size: 0.75rem;
    border: 2px solid var(--border);
    border-radius: 20px;
    background: var(--card-bg);
    color: var(--text);
    cursor: pointer;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
  }
  .theme-toggle-inline .theme-label-inline { font-size: 0.7rem; font-weight: 600; }

  /* Back to top */
  .back-to-top {
    position: fixed;
    bottom: 120px;
    right: 24px;
    z-index: 10001;
    width: 88px;
    height: 88px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: var(--card-bg);
    color: var(--text);
    font-size: 2rem;
    cursor: pointer;
    box-shadow: var(--shadow);
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
  }
  .back-to-top.visible { display: flex; }
  body.sim-running .back-to-top { display: none !important; }
  .back-to-top:hover { border-color: var(--primary); background: var(--primary); color: var(--bg); }
  .back-to-top:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
  .back-to-top-tooltip {
    position: absolute;
    right: 0;
    bottom: calc(100% + 8px);
    background: #fff;
    border: 3px solid #000;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 0.75rem;
    color: #000;
    width: 280px;
    max-width: calc(100vw - 48px);
    line-height: 1.5;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s, visibility 0.2s;
    text-align: left;
  }
  .back-to-top:hover .back-to-top-tooltip,
  .back-to-top:focus-visible .back-to-top-tooltip { opacity: 1; visibility: visible; }

  * { margin: 0; padding: 0; box-sizing: border-box; min-width: 0; overflow-wrap: break-word; }

  html, body {
    overflow-x: clip;
    width: 100%;
  }
  body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
  }

  /* ===== SKIP LINKS (WCAG 2.4.1) ===== */
  .skip-links-wrapper {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    padding: 8px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
  }
  .skip-links-label {
    font-size: 0.75rem;
    color: var(--text-light);
  }
  .skip-link {
    padding: 6px 14px;
    background: var(--bg);
    color: var(--primary);
    border: 2px solid var(--border);
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.8rem;
    text-decoration: none;
    white-space: nowrap;
  }
  .skip-link:hover {
    border-color: var(--primary);
    background: var(--bg);
  }
  .skip-link:focus-visible {
    background: var(--primary);
    color: var(--bg);
    outline: 3px solid rgba(52,152,219,0.4);
    outline-offset: 2px;
  }

  /* ===== SEARCH BAR ===== */
  .search-container {
    max-width: 820px;
    margin: 0 auto 16px;
    padding: 0 24px;
  }
  .search-bar {
    display: flex;
    gap: 8px;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 12px 20px;
    align-items: center;
  }
  .search-bar input[type="search"] {
    flex: 1;
    border: 2px solid var(--border);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--text);
    background: var(--bg);
    min-width: 0;
  }
  .search-bar input[type="search"]:focus-visible {
    border-color: var(--primary);
    outline: 3px solid var(--accent);
    outline-offset: 1px;
  }
  .search-bar button {
    padding: 10px 20px;
    background: var(--primary);
    color: var(--bg);
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
  }
  .search-bar button:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 3px;
    background: var(--primary-light);
  }

  /* ===== GLOBAL FOCUS (WCAG 2.4.7) ===== */
  :focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
  }
  :focus:not(:focus-visible) {
    outline: none;
  }

  /* ===== HEADER ===== */
  .hero {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: #f8f9fa;
    text-align: center;
    padding: 48px 24px 40px;
    position: relative;
    overflow: hidden;
  }
  .hero::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0; right: 0;
    height: 40px;
    background: var(--bg);
    border-radius: 50% 50% 0 0;
  }
  .hero h1 { font-size: 2rem; margin-bottom: 8px; font-weight: 800; }
  .hero p { opacity: 0.9; font-size: 1.05rem; max-width: 600px; margin: 0 auto; }

  /* ===== PROGRESS BAR ===== */
  .progress-bar-container {
    max-width: 1100px;
    margin: -8px auto 24px;
    padding: 0 24px;
  }
  .progress-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
  }
  .progress-card .label { font-weight: 600; white-space: nowrap; font-size: 0.9rem; }
  .progress-track {
    flex: 1;
    height: 10px;
    background: #ecf0f1;
    border-radius: 5px;
    overflow: hidden;
  }
  .progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--success), #2ecc71);
    border-radius: 5px;
    transition: width 0.5s ease;
    width: 0%;
  }
  .progress-pct { font-weight: 700; color: var(--success); min-width: 42px; text-align: right; }

  /* ===== NAV TABS ===== */
  .nav-container {
    max-width: 820px;
    margin: 0 auto;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 9990;
    background: var(--bg);
    padding-top: 8px;
    padding-bottom: 8px;
  }
  .nav-mode-info {
    max-height: 60px;
    overflow: hidden;
    transition: max-height 0.3s, opacity 0.3s;
    opacity: 1;
  }
  .nav-container.scrolled .nav-mode-info {
    max-height: 0;
    opacity: 0;
  }
  .nav-tabs {
    display: flex;
    gap: 0;
    overflow-x: auto;
    padding-bottom: 4px;
    position: relative;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .nav-tabs::-webkit-scrollbar { display: none; }
  .nav-tabs-wrapper {
    position: relative;
  }
  .nav-tabs-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 4px;
    width: 40px;
    background: linear-gradient(to right, transparent, var(--bg));
    pointer-events: none;
    z-index: 1;
  }
  .nav-tab {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    border: none;
    background: var(--card-bg);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-light);
    white-space: nowrap;
    transition: all 0.2s;
    position: relative;
    border-bottom: 3px solid transparent;
  }
  .nav-tab:first-child { border-radius: 12px 0 0 12px; }
  .nav-tab:last-child { border-radius: 0 12px 12px 0; }
  .nav-tab + .nav-tab { border-left: 1px solid var(--text-light); }
  .nav-tab:hover .tab-label, .nav-tab:hover .tab-label-short { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 3px; }
  .nav-tab:hover { color: var(--primary); background: var(--bg); }
  .nav-tab[aria-selected="true"],
  .nav-tab[aria-current="page"] {
    background: var(--bg);
    color: var(--primary);
    font-weight: 700;
    border-bottom-color: var(--primary);
  }
  .nav-tab .step-num {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    background: var(--text-light);
    color: var(--bg);
    flex-shrink: 0;
    transition: all 0.3s;
  }
  .nav-tab[aria-selected="true"] .step-num,
  .nav-tab[aria-current="page"] .step-num {
    background: var(--primary);
  }
  .nav-tab.completed .step-num {
    background: var(--success);
  }
  .nav-tab[aria-selected="true"].completed .step-num,
  .nav-tab[aria-current="page"].completed .step-num {
    background: var(--primary);
  }
  .nav-tab:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: -2px;
    z-index: 1;
    position: relative;
  }

  /* ===== SECTIONS ===== */
  .section { max-width: 1100px; margin: 0 auto; padding: 0 24px; display: none; }
  .section.active { display: block; }

  .section-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
  }
  .section-title .icon { font-size: 1.6rem; }

  /* ===== CARDS ===== */
  .card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 16px;
    transition: transform 0.2s;
    max-width: 100%;
    overflow: hidden;
  }
  .card:hover { transform: translateY(-2px); }
  .card h3 {
    font-size: 1.1rem;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .card p { color: var(--text-light); font-size: 0.95rem; }

  /* ===== ROLE CARDS ===== */
  .role-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
  }
  .role-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    cursor: pointer;
    transition: all 0.25s;
    border: 3px solid transparent;
    position: relative;
  }
  .role-card:hover { transform: translateY(-3px); box-shadow: 0 6px 20px rgba(0,0,0,0.12); border-color: var(--accent); }
  .role-card:hover .role-name { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 3px; }
  .role-card[aria-pressed="true"] { border-color: var(--primary); border-width: 3px; box-shadow: 0 0 0 4px rgba(26,82,118,0.2); }
  .role-card .role-icon { font-size: 2.2rem; margin-bottom: 10px; display: block; }
  .role-card .role-name { font-weight: 700; font-size: 1.1rem; margin-bottom: 4px; }
  .role-card .role-desc { color: var(--text-light); font-size: 0.88rem; }
  .role-card .badge-tag {
    position: absolute;
    top: 12px;
    right: 12px;
    background: var(--primary);
    color: var(--bg);
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 10px;
    display: none;
  }
  .role-card[aria-pressed="true"] .badge-tag { display: block; }

  /* ===== PHASE TIMELINE ===== */
  .timeline {
    position: relative;
    padding-left: 36px;
  }
  .timeline::before {
    content: '';
    position: absolute;
    left: 14px;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #dfe6e9;
    border-radius: 2px;
  }
  .timeline-item {
    position: relative;
    margin-bottom: 28px;
  }
  .timeline-dot {
    position: absolute;
    left: -36px;
    top: 4px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--bg);
    z-index: 1;
  }
  .timeline-item .phase-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px 24px;
    cursor: pointer;
    transition: all 0.2s;
  }
  .timeline-item .phase-card:hover { transform: translateX(4px); }
  .phase-card h3 { font-size: 1.05rem; font-weight: 700; margin-bottom: 4px; }
  .phase-card .phase-subtitle { color: var(--text-light); font-size: 0.88rem; }
  .phase-card .tag {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 8px;
  }

  /* ===== CHECKLIST ===== */
  .checklist { list-style: none; }
  .checklist li {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    transition: background 0.15s;
    border-radius: 6px;
  }
  .checklist li:hover { background: #f7f9fc; }
  .checklist li:last-child { border-bottom: none; }
  .checklist li label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    width: 100%;
  }
  .checklist input[type="checkbox"] {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    margin-top: 2px;
    accent-color: var(--success);
    cursor: pointer;
  }
  .checklist li.checked .check-text { text-decoration: line-through; color: var(--text-light); }
  .check-text { font-size: 0.92rem; }
  .check-role-tag {
    display: inline-block;
    font-size: 0.7rem;
    padding: 1px 7px;
    border-radius: 8px;
    margin-left: 6px;
    font-weight: 600;
    vertical-align: middle;
  }

  /* ===== PHASE DETAIL ===== */
  .phase-detail { display: none; }
  .phase-detail.active { display: block; }
  .back-btn {
    background: none;
    border: none;
    color: var(--primary-light);
    font-size: 0.95rem;
    cursor: pointer;
    font-weight: 600;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 6px;
  }
  .back-btn:hover { text-decoration: underline; }

  /* ===== EMPATHY SIMULATION ===== */
  .sim-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
    gap: 16px;
    margin-bottom: 24px;
  }
  .sim-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform 0.2s;
    display: flex;
    flex-direction: column;
  }
  .sim-card:hover { transform: translateY(-2px); }
  .sim-preview {
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: var(--bg);
    text-align: center;
    padding: 20px;
    position: relative;
    overflow: hidden;
  }
  .sim-info { padding: 16px 20px; flex: 1; display: flex; flex-direction: column; }
  .sim-info .sim-btn { margin-top: auto; align-self: flex-start; }
  .sim-info h3 { font-size: 1rem; margin-bottom: 4px; }
  .sim-info p { font-size: 0.85rem; color: var(--text-light); margin-bottom: 12px; }
  .sim-btn {
    display: inline-block;
    padding: 8px 20px;
    border: none;
    border-radius: 20px;
    background: var(--primary);
    color: var(--bg);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
  }
  .sim-btn:hover { background: var(--primary-light); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 3px; }
  .sim-btn:focus { outline: 3px solid var(--accent); outline-offset: 2px; }

  /* Simulation Dialog */
  .sim-dialog {
    border: none;
    border-radius: 16px;
    max-width: 680px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 32px;
    position: relative;
    box-shadow: 0 8px 40px rgba(0,0,0,0.3);
  }
  .sim-dialog::backdrop {
    background: rgba(0,0,0,0.7);
  }
  .sim-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .sim-demo-area {
    min-height: 200px;
    border-radius: var(--radius);
    padding: 24px;
    margin: 16px 0;
    position: relative;
  }

  /* ===== QUIZ ===== */
  .quiz-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 28px;
    margin-bottom: 20px;
  }
  .quiz-q {
    font-weight: 700;
    font-size: 1.05rem;
    margin-bottom: 16px;
    display: flex;
    gap: 10px;
  }
  .quiz-q .q-num {
    background: var(--primary);
    color: var(--bg);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    flex-shrink: 0;
  }
  .quiz-options { display: flex; flex-direction: column; gap: 8px; }
  .quiz-opt {
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.92rem;
    transition: all 0.2s;
    background: var(--card-bg);
    text-align: left;
    width: 100%;
    font-family: inherit;
    color: inherit;
  }
  .quiz-opt:hover { border-color: var(--primary-light); background: var(--bg); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 3px; }
  .quiz-opt:focus-visible { border-color: var(--primary); }
  .quiz-opt[aria-disabled="true"] { pointer-events: none; opacity: 0.7; }
  .quiz-opt.correct { border-color: var(--success); background: var(--bg); opacity: 1; }
  .quiz-opt.wrong { border-color: var(--danger); background: var(--card-bg); opacity: 1; }
  .quiz-explain {
    margin-top: 12px;
    padding: 14px 16px;
    border-radius: 10px;
    font-size: 0.9rem;
    display: none;
  }
  .quiz-explain.show { display: block; }
  .quiz-explain.correct-bg { background: var(--bg); border-left: 4px solid var(--success); }
  .quiz-explain.wrong-bg { background: #fdf2f2; border-left: 4px solid var(--danger); }

  .quiz-score {
    text-align: center;
    padding: 32px;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: none;
  }
  .quiz-score.show { display: block; }
  .quiz-score .score-num { font-size: 3rem; font-weight: 800; color: var(--primary); }
  .quiz-score .score-label { color: var(--text-light); margin-top: 4px; }
  .badge-earned {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 20px;
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    color: var(--bg);
    font-weight: 700;
    font-size: 0.9rem;
    margin-top: 12px;
    animation: badgePop 0.4s ease;
  }
  @keyframes badgePop {
    0% { transform: scale(0); }
    70% { transform: scale(1.15); }
    100% { transform: scale(1); }
  }

  /* ===== FILTER PILLS ===== */
  .filter-pills {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
  }
  .filter-pill {
    padding: 6px 14px;
    border-radius: 16px;
    border: 2px solid var(--text-light);
    background: var(--card-bg);
    color: var(--text);
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
  }
  .filter-pill[aria-pressed="true"] { border-color: var(--primary); background: var(--primary); color: var(--bg); font-weight: 700; box-shadow: 0 0 0 3px rgba(26,82,118,0.2); }
  .filter-pill:hover { border-color: var(--primary); background: var(--primary-light); color: var(--bg); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 3px; }

  /* ===== GAMIFICATION ===== */
  .badges-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 24px;
  }
  .badge-item {
    width: 72px;
    text-align: center;
    opacity: 0.5;
    transition: all 0.3s;
    cursor: help;
  }
  .badge-item:hover { opacity: 0.8; transform: translateY(-2px); }
  .badge-item.earned { opacity: 1; }
  .badge-item.earned:hover { transform: translateY(-4px); }
  .badge-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin: 0 auto 4px;
    border: 3px solid #ddd;
  }
  .badge-item.earned .badge-icon { border: 3px solid #d4a017; box-shadow: 0 0 0 3px rgba(212,160,23,0.3), 0 4px 12px rgba(212,160,23,0.2); }
  .badge-item.earned:hover .badge-icon { box-shadow: 0 0 0 5px rgba(212,160,23,0.4), 0 6px 20px rgba(212,160,23,0.3); }
  .badge-item { position: relative; }
  .badge-item .badge-tip {
    position: absolute;
    bottom: calc(100% + 20px);
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    border: 3px solid #000;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.75rem;
    color: #000;
    width: min(200px, calc(100vw - 24px));
    line-height: 1.5;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s, visibility 0.2s;
    text-align: left;
    z-index: 9000;
  }
  .badge-item:hover .badge-tip,
  .badge-item:focus-within .badge-tip {
    opacity: 1;
    visibility: visible;
  }
  .badge-label { font-size: 0.7rem; color: var(--text-light); }

  /* ===== SHARED FOUNDATION ===== */
  .foundation-box {
    background: var(--bg);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
    border: 2px solid var(--primary);
    position: relative;
  }
  .foundation-box h3 { margin-bottom: 10px; }
  .foundation-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr));
    gap: 10px;
    margin-top: 12px;
  }
  .foundation-item {
    background: var(--card-bg);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.88rem;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    max-width: 100%;
    min-width: 0;
  }
  .foundation-item .fi-icon { font-size: 1.1rem; flex-shrink: 0; }

  /* Role layer diagram */
  .layer-diagram {
    margin-bottom: 24px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
  }
  .layer-ring { display: contents; }
  .layer {
    text-align: center;
    padding: 20px 28px 0;
    border-radius: 50% / 20%;
  }
  .layer-outer {
    background: var(--bg);
    border: 3px dashed var(--primary);
    padding: 24px 32px 0;
  }
  .layer-mid {
    background: var(--card-bg);
    border: 3px dashed var(--accent);
    margin: 20px 8px 0;
    padding: 20px 28px 0;
  }
  .layer-inner {
    background: var(--bg);
    border: 3px solid var(--success);
    margin: 20px 8px 24px;
    padding: 24px 28px;
    border-radius: 50% / 30%;
  }
  .layer-label { font-weight: 700; font-size: 0.88rem; margin-bottom: 6px; }
  .layer-desc { font-size: 0.8rem; color: var(--text-light); padding-bottom: 4px; }

  .role-card .role-a11y {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--border);
    font-size: 0.82rem;
    color: var(--primary);
  }
  .role-card .role-a11y strong { display: block; margin-bottom: 2px; font-size: 0.78rem; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.5px; }

  /* ===== DISCLOSURE (temporary disability cards) ===== */
  details.disclosure-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 12px;
  }
  details.disclosure-card summary {
    padding: 24px;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    list-style: none;
  }
  details.disclosure-card summary::-webkit-details-marker { display: none; }
  details.disclosure-card summary::before {
    content: '\25B6';
    font-size: 0.7rem;
    transition: transform 0.2s;
    flex-shrink: 0;
  }
  details.disclosure-card[open] summary::before {
    transform: rotate(90deg);
  }
  details.disclosure-card .detail-content {
    padding: 0 24px 24px;
  }

  /* ===== UTILITIES ===== */
  .mb-16 { margin-bottom: 16px; }
  .mb-24 { margin-bottom: 24px; }
  .text-sm { font-size: 0.88rem; }
  .text-muted { color: var(--text-light); }
  .flex-center { display: flex; align-items: center; gap: 8px; }
  .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
  }

  /* ===== RESPONSIVE ===== */
  @media (max-width: 640px) {
    .hero h1 { font-size: 1.5rem; }
    .role-grid { grid-template-columns: 1fr; }
    .sim-grid { grid-template-columns: 1fr; }
    .sim-dialog { padding: 20px; }
  }

  /* ===== REDUCED MOTION (WCAG 2.3.3) ===== */
  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
    }
  }

  /* Simulation Effects */
  .blur-sim { filter: blur(3px); }
  .low-contrast-sim { filter: contrast(0.3) brightness(1.2); }
  .color-blind-sim { filter: grayscale(0.8) sepia(0.2); }
  .tremor-text { display: inline-block; }
  .tremor-text.shaking { animation: tremor 0.15s infinite; }
  @keyframes tremor {
    0% { transform: translate(0,0); }
    25% { transform: translate(2px,-1px); }
    50% { transform: translate(-1px,2px); }
    75% { transform: translate(-2px,-1px); }
    100% { transform: translate(1px,1px); }
  }

  .kb-trap-area button:focus {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
  }

  footer {
    text-align: center;
    padding: 40px 24px;
    color: var(--text-light);
    font-size: 0.85rem;
  }

  .live-announcer {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
  }
/* Next step CTA */
.next-step-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  margin-top: 24px;
  background: var(--card-bg);
  border: 2px solid var(--primary);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--primary);
  transition: all 0.2s;
}
.next-step-cta:hover { background: var(--primary); color: var(--bg); }
.next-step-cta:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 3px; }
.next-step-cta:hover .arrow { text-decoration: none; display: inline-block; }
.next-step-cta .arrow { font-size: 1.2rem; }

@media (max-width: 600px) {
  .nav-tabs { flex-wrap: wrap; overflow-x: visible; }
  .nav-tabs-wrapper::after { display: none; }
  .nav-tab { padding: 8px 0; font-size: 0.75rem; gap: 4px; flex: 1 1 30%; text-align: center; justify-content: center; border-bottom: 1px solid var(--border); }
  .nav-tab .step-num { width: 20px; height: 20px; font-size: 0.6rem; }
  .nav-tab .tab-label { display: none; }
  .nav-tab .tab-label-short { display: inline; }
  .nav-mode-info { display: none !important; }
  .theme-toggle-fixed { display: none; }
  .theme-toggle-inline { display: flex; }
  .skip-links-wrapper { padding: 4px 12px 20px; gap: 4px 6px; }
  .skip-links-label { font-size: 0.6rem; line-height: 1.4; flex-basis: 100%; }
  .skip-link { padding: 4px 12px; font-size: 0.7rem; }
  .search-container { padding: 0 12px; }
  .search-bar input[type="search"] { font-size: 0.8rem; padding: 8px; }
  .search-bar button { padding: 8px 12px; font-size: 0.8rem; }
  .search-container p.text-sm { font-size: 0.65rem; }
  .progress-bar-container { margin-top: 0; padding: 0 12px; }
  .badges-row { gap: 6px; }
  .badge-icon { width: 44px; height: 44px; font-size: 1.2rem; }
  .badge-item { width: 60px; }
  .badge-label { font-size: 0.6rem; }
  .section { padding: 0 12px; }
  .card { padding: 14px; }
  .chat-trigger { width: 48px; height: 48px; font-size: 1.2rem; }
  .back-to-top { width: 48px; height: 48px; font-size: 1.2rem; bottom: 108px; }
}
@media (min-width: 601px) {
  .nav-tab .tab-label-short { display: none; }
}

/* ===== IMMERSIVE SIM INFRASTRUCTURE ===== */
.sim-control-panel {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10000;
  background: var(--card-bg);
  border: 3px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  padding: 20px 24px;
  max-width: 340px;
  max-height: 80vh;
  overflow-y: auto;
  width: 90%;
  filter: none !important;
  display: none;
}
.sim-control-panel.active { display: block; }
@keyframes panelFlash {
  0%, 100% { box-shadow: 0 8px 32px rgba(0,0,0,0.2); }
  50% { box-shadow: 0 0 0 8px var(--accent), 0 8px 32px rgba(0,0,0,0.2); }
}
.sim-control-panel h3 { font-size: 1rem; margin-bottom: 8px; }
.sim-control-panel .challenge {
  font-size: 0.85rem;
  color: var(--text-light);
  margin: 12px 0;
  padding: 10px 12px;
  background: var(--bg);
  border-radius: 8px;
  border-left: 3px solid var(--accent);
}
.sim-control-panel .sim-stop-btn {
  width: 100%;
  padding: 10px;
  background: var(--danger);
  color: var(--bg);
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}
.sim-control-panel .sim-stop-btn:hover { opacity: 0.9; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 3px; }
.sim-intensity {
  width: 100%;
  margin: 8px 0;
  accent-color: var(--primary);
}
.sim-mode-btns { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.sim-mode-btn {
  padding: 6px 14px;
  border: 2px solid var(--border);
  border-radius: 16px;
  background: white;
  font-size: 0.78rem;
  cursor: pointer;
}
.sim-mode-btn.active { border-color: var(--primary); background: var(--bg); }

/* Fake cursor for tremor sim */
.fake-cursor {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  width: 20px;
  height: 20px;
  display: none;
}
.fake-cursor::after {
  content: '';
  display: block;
  width: 0; height: 0;
  border-left: 6px solid black;
  border-right: 6px solid transparent;
  border-bottom: 10px solid transparent;
  border-top: 10px solid black;
}

/* Screen reader overlay */
.sr-sim-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: #000;
  color: var(--bg);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  font-family: 'Courier New', monospace;
}
.sr-sim-overlay.active { display: flex; }
.sr-sim-role { color: var(--accent); font-size: 0.85rem; margin-bottom: 8px; }
.sr-sim-text { font-size: 1.4rem; max-width: 600px; text-align: center; line-height: 1.6; }
.sr-sim-hint { position: absolute; top: 40px; color: #888; font-size: 0.85rem; }

/* Education card variant */
.edu-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  border: 2px dashed var(--border);
  opacity: 0.95;
}
.edu-card .edu-header {
  padding: 16px 20px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.edu-card .sim-info { padding: 16px 20px; }

/* Timer banner for anxiety sim */
.anxiety-timer {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9997;
  background: var(--danger);
  color: var(--bg);
  text-align: center;
  padding: 8px;
  font-weight: 700;
  font-size: 0.9rem;
  display: none;
}

/* ADHD distractions */
.adhd-distraction {
  position: fixed;
  z-index: 9996;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 16px;
  font-size: 0.85rem;
  animation: adhd-float 3s ease-in-out infinite alternate;
}
@keyframes adhd-float {
  0% { transform: translateY(0); }
  100% { transform: translateY(-10px); }
}

/* Photosensitivity warning dialog */
.photosens-dialog {
  border: none;
  border-radius: var(--radius);
  padding: 32px;
  max-width: 480px;
  text-align: center;
  box-shadow: 0 8px 40px rgba(0,0,0,0.3);
}
/* High contrast mode (system preference) */
@media (prefers-contrast: more) {
  :root {
    --border: #000;
    --text-light: #333;
    --shadow: 0 2px 8px rgba(0,0,0,0.3);
  }
  /* Dark + high contrast: light text must stay bright */
  [data-theme="dark"] {
    --text-light: #f0f0ff;
    --border: #6a6a8c;
    --shadow: 0 2px 8px rgba(0,0,0,0.5);
  }
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
      --text-light: #f0f0ff;
      --border: #6a6a8c;
      --shadow: 0 2px 8px rgba(0,0,0,0.5);
    }
  }
  .card, .foundation-item, .sim-card, .nav-tab {
    border: 2px solid var(--text);
  }
  .sim-btn { border: 2px solid currentColor; }
}

/* Accessibility Statement toggle */
#a11yDetails[open] .a11y-stmt-header { display: flex; }
#a11yDetails[open] .a11y-stmt-collapsed { display: none !important; }
#a11yDetails:not([open]) .a11y-stmt-header { display: none !important; }
#a11yDetails:not([open]) .a11y-stmt-collapsed { display: flex !important; }
.a11y-stmt-link:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 3px; color: var(--primary); }

/* Accessible webchat demo */
.chat-trigger {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10001;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 2px solid var(--primary);
  background: var(--primary);
  color: var(--bg);
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.chat-trigger:hover { transform: scale(1.1); background: var(--primary-light); }
.chat-trigger:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
body.sim-running .chat-trigger { display: none !important; }

.chat-window {
  position: fixed;
  bottom: 96px;
  right: 24px;
  z-index: 10002;
  width: 360px;
  max-height: 480px;
  background: var(--card-bg);
  border: 2px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.chat-window.open { display: flex; }
.chat-header {
  padding: 12px 16px;
  background: var(--primary);
  color: var(--bg);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  font-size: 0.9rem;
}
.chat-close {
  background: none;
  border: none;
  color: var(--bg);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px;
}
.chat-close:hover { opacity: 0.8; }
.chat-close:focus-visible { outline: 2px solid white; outline-offset: 2px; }
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  max-height: 300px;
}
.chat-msg {
  margin-bottom: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  line-height: 1.5;
  max-width: 85%;
}
.chat-msg.bot {
  background: var(--bg);
  color: var(--text);
  margin-right: auto;
}
.chat-msg.user {
  background: var(--primary);
  color: var(--bg);
  margin-left: auto;
}
.chat-msg .chat-sender {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  margin-bottom: 2px;
  color: var(--text-light);
}
.chat-msg.user .chat-sender { color: rgba(255,255,255,0.7); }
.chat-input-area {
  display: flex;
  padding: 8px;
  border-top: 1px solid var(--border);
  gap: 8px;
}
.chat-input-area input {
  flex: 1;
  padding: 8px 12px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 0.85rem;
  background: var(--card-bg);
  color: var(--text);
}
.chat-input-area input:focus-visible { border-color: var(--primary); outline: none; }
.chat-input-area button {
  padding: 8px 14px;
  background: var(--primary);
  color: var(--bg);
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
}
.chat-input-area button:hover { background: var(--primary-light); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 3px; }
.chat-credit {
  padding: 6px 12px;
  font-size: 0.65rem;
  color: var(--text-light);
  text-align: center;
  border-top: 1px solid var(--border);
}
.chat-credit a { color: var(--text-light); text-decoration: underline; }

/* Mobile: fullscreen chat to avoid keyboard viewport issues */
@media (max-width: 600px) {
  .chat-window {
    inset: 0;
    width: 100%;
    height: 100%;
    max-height: none;
    border-radius: 0;
    border: none;
  }
  .chat-messages { max-height: none; flex: 1; }
  .back-to-top-tooltip {
    right: 0;
    bottom: calc(100% + 8px);
    width: min(280px, calc(100vw - 48px));
  }
}

.photosens-dialog::backdrop { background: rgba(0,0,0,0.7); }

/* Footer highlight */
.footer-highlight {
  display: inline-block;
  padding: 2px 8px;
  border: 2px solid transparent;
  border-radius: 8px;
  transition: all 0.3s;
  cursor: default;
}
a.footer-highlight { cursor: pointer; }
.footer-highlight:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 6px rgba(230,126,34,0.4), 0 0 30px rgba(230,126,34,0.3), 0 0 60px rgba(230,126,34,0.1);
  background: rgba(230,126,34,0.12);
  transform: scale(1.3) rotate(2deg);
  font-weight: 700;
  animation: footerPulse 0.6s ease infinite alternate;
}
@keyframes footerPulse {
  0% { box-shadow: 0 0 0 6px rgba(230,126,34,0.4), 0 0 30px rgba(230,126,34,0.3); }
  100% { box-shadow: 0 0 0 10px rgba(230,126,34,0.2), 0 0 50px rgba(230,126,34,0.4); }
}
@media (prefers-reduced-motion: reduce) {
  .footer-highlight:hover {
    transform: none;
    transition: none;
  }
}
.reduced-motion .footer-highlight:hover {
  transform: none;
  transition: none;
}

/* Footer email tooltip */
.footer-email-link { position: relative; }
.footer-email-tip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  border: 3px solid #000;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.75rem;
  color: #000;
  width: 280px;
  line-height: 1.5;
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s, visibility 0.2s;
  text-align: left;
}
.footer-email-link:hover + .footer-email-tip,
.footer-email-link:focus + .footer-email-tip,
.footer-email-tip:hover {
  opacity: 1;
  visibility: visible;
}

#search-results { max-width: 820px; margin: 0 auto; padding: 0 24px; }
.search-result-item { padding: 10px 14px; background: var(--card-bg); border-radius: 8px; margin-bottom: 6px; cursor: pointer; font-size: 0.85rem; border-left: 3px solid var(--primary); }
.search-result-item:hover { background: var(--bg); }
.search-result-item mark { background: var(--accent); color: var(--bg); padding: 1px 4px; border-radius: 3px; }
