/* quiz-layout.css — Layout and component styles for quiz app
   All rules organized into @layer layout (structural) and @layer components (visual).
   Design tokens are in quiz-theme.css — reference via var(--token). */

@layer layout {
  html {
    width: 100%;
    overflow-x: clip;
    overscroll-behavior-x: none;
  }

  body {
    margin: 0;
    min-height: 100vh;
    font-family: 'Inter', sans-serif;
    overflow-x: hidden;
    max-width: 100%;
    overscroll-behavior-x: none;
    display: flex;
    flex-direction: column;
  }

  body.session-page {
    overflow: hidden;
    height: 100vh;
    overscroll-behavior: none;
    touch-action: pan-y;
  }

  /* ── Site Navbar ────────────────────────────────── */
  .site-navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 52px;
    padding: 0 20px;
    background: #1a1a2e;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    position: sticky;
    top: 0;
    z-index: 100;
    flex-shrink: 0;
  }

  .navbar-brand {
    color: #5a9aff;
    font-weight: 700;
    font-size: 1.1rem;
    text-decoration: none;
    letter-spacing: -0.01em;
  }

  .navbar-brand:hover { opacity: 0.85; }

  .navbar-login-link {
    color: #5a9aff;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    padding: 8px 16px;
    border: 1px solid rgba(90,154,255,0.3);
    border-radius: 6px;
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  .navbar-login-link:hover { background: rgba(90,154,255,0.1); }

  /* ── User Menu Dropdown ────────────────────────── */
  .user-menu {
    position: relative;
  }

  .user-menu-trigger {
    background: none;
    border: none;
    color: #e1e2eb;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
  }

  .user-menu-trigger:hover,
  .user-menu-trigger:focus-visible {
    background: rgba(255,255,255,0.08);
  }

  .user-menu-trigger:focus-visible {
    outline: 2px solid #5a9aff;
    outline-offset: 2px;
  }

  .user-menu-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 4px;
    background: #1e2a3a;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 8px;
    min-width: 220px;
    padding: 8px 0;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    z-index: 200;
  }

  .user-menu.open .user-menu-dropdown {
    display: block;
  }

  .user-menu-header {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
  }

  .user-menu-name {
    display: block;
    color: #e1e2eb;
    font-weight: 600;
    font-size: 14px;
  }

  .user-menu-email {
    display: block;
    color: #8c919e;
    font-size: 12px;
    margin-top: 2px;
  }

  .user-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 16px;
    min-height: 44px;
    background: none;
    border: none;
    color: #e1e2eb;
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
    text-align: left;
    text-decoration: none;
    box-sizing: border-box;
  }

  .user-menu-item:hover,
  .user-menu-item:focus-visible {
    background: rgba(255,255,255,0.06);
  }

  .user-menu-item:focus-visible {
    outline: 2px solid #5a9aff;
    outline-offset: -2px;
  }

  .user-menu-item--danger {
    color: #e55a5a;
  }

  .user-menu-item .material-symbols-outlined {
    font-size: 20px;
  }

  .start-page .top-shell {
    position: fixed;
    top: 52px;
    left: 0;
    right: 0;
    z-index: 20;
  }

  .start-page .page {
    padding-top: 138px;
  }

  .session-page .top-shell {
    position: fixed;
    top: 52px;
    left: 0;
    right: 0;
    z-index: 20;
  }

  .session-page .quiz-shell {
    padding-top: 117px;
  }

  .top-shell {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    height: 65px;
    padding: 0 22px 0 23px;
  }

  .page {
    max-width: 1180px;
    margin: 0 auto;
    padding: 20px 18px 42px;
  }

  .quiz-shell {
    flex: 1;
    width: 100%;
    margin: 0;
    padding: 0 22px 0 23px;
    display: flex;
    flex-direction: column;
    min-height: 0;
  }

  .dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .session-main-column {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
    min-height: 0;
    padding-bottom: 65px;
  }

  .setup-card {
    display: grid;
    gap: 16px;
  }

  .launch-actions {
    display: grid;
    gap: 10px;
  }

  #scope-selector {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin: 8px 0 14px;
  }

  .range-tools-grid {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 8px;
    align-items: end;
  }

  .scope-section-grid {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }

  .bottom-shell {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 3;
    padding: 0;
  }

  .bottom-actions {
    display: flex;
    gap: 12px;
    justify-content: space-between;
    align-items: center;
  }

  /* --- Layout media queries --- */

  @media (min-width: 768px) {
    .page {
      padding: 24px;
    }

    .dashboard-grid {
      grid-template-columns: minmax(0, 1fr) 320px;
    }

    .launch-actions {
      grid-template-columns: minmax(0, 1fr) auto;
    }

    .bottom-actions {
      position: relative;
    }
  }

  @media (max-width: 767px) {
    .start-page .page {
      padding-top: 74px;
    }

    .session-page .top-shell {
      padding: 8px 10px;
      height: auto;
      min-height: 45px;
      align-items: center;
      gap: 8px;
      display: flex;
      flex-wrap: wrap;
    }

    .quiz-shell {
      padding: 0 10px;
    }

    .session-page .session-progress {
      width: 100%;
      padding: 2px 0 0;
      gap: 8px;
    }

    .session-page .session-progress-label {
      min-width: 0;
      white-space: normal;
      line-height: 1.2;
      font-size: 12px;
      max-width: 40%;
      text-align: right;
    }

    .session-page #quit-quiz {
      margin-left: auto;
      min-height: 36px;
      padding: 9px 12px;
      font-size: 13px;
    }

    .session-page .session-timer {
      grid-area: timer;
      font-size: 0.9rem;
      min-height: 32px;
      padding: 3px 8px;
    }

    .session-page .session-timer[hidden] {
      display: none;
    }

    .session-page .session-main-column {
      padding-bottom: 72px;
    }

    .session-page .quiz-shell {
      padding-top: 84px;
    }

    .question-meta-row {
      flex-direction: column;
      align-items: flex-start;
    }

    .bottom-actions {
      position: relative;
    }
  }

  @media (max-width: 640px) {
    .range-tools-grid {
      grid-template-columns: 1fr;
    }

    .launch-actions {
      grid-template-columns: 1fr;
    }
  }
}

@layer components {
  body {
    color: var(--shell-text);
    background: linear-gradient(180deg, var(--shell) 0%, var(--shell-strong) 100%);
  }

  .top-shell {
    color: var(--shell-text);
    background: var(--panel);
    border-bottom: 1px solid rgba(255,255,255,0.10);
    position: relative;
    z-index: 4;
  }

  .session-page .top-shell {
    position: fixed;
    top: 52px;
    left: 0;
    right: 0;
    z-index: 20;
  }

  .shortcuts-help-btn,
  #theme-toggle {
    display: none;
  }

  /* --- Brand --- */

  .brand-block {
    display: flex;
    gap: 10px;
    align-items: center;
    min-width: 0;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
    object-fit: contain;
    flex: 0 0 auto;
  }

  .brand-copy {
    min-width: 0;
  }

  .brand-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--accent-strong);
  }

  .brand-subtitle {
    font-size: 0.82rem;
    color: var(--shell-text-82);
  }

  /* --- Typography --- */

  h1 {
    margin: 0 0 24px;
    font-family: 'Inter', sans-serif;
    font-size: 17px;
    line-height: 25px;
    font-weight: 600;
    color: var(--ink);
  }

  p {
    margin: 0 0 8px;
    color: var(--muted);
    line-height: 1.5;
  }

  /* --- Panels --- */

  .panel {
    background: var(--panel);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5);
    padding: 32px;
    color: var(--ink);
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    max-width: 640px;
    margin: 0 auto;
    width: 100%;
  }

  .session-page .panel {
    -webkit-overflow-scrolling: auto;
  }

  /* === Start page only === */

  .course-pill {
    justify-self: end;
    min-height: 40px;
    border: 1px solid var(--shell-surface-14);
    border-radius: 4px;
    background: var(--shell-surface-08);
    color: var(--accent-strong);
    font: inherit;
    font-weight: 700;
    padding: 0 16px;
  }

  .start-page .top-shell #start-quiz {
    min-height: 38px;
    width: auto;
    border: 1px solid color-mix(in srgb, var(--shell-text) 24%, transparent);
    background: var(--action);
    color: var(--shell-text);
    font-size: 0.9rem;
    font-weight: 700;
    padding: 0 14px;
    cursor: pointer;
  }

  .start-page .top-shell #start-quiz:disabled {
    opacity: 0.72;
    filter: none;
    cursor: not-allowed;
  }

  .page h1 {
    margin: 0 0 8px;
    font-size: clamp(1.85rem, 1.3rem + 1vw, 2.8rem);
    line-height: 1.12;
  }

  .hero-card {
    background: var(--shell-surface-06);
    border: 1px solid var(--shell-surface-08);
    border-radius: 4px;
    padding: 24px 22px;
    margin-bottom: 18px;
    box-shadow: var(--shadow-card-medium);
    color: var(--shell-text-88);
  }

  .hero-card h1 {
    color: var(--shell-text);
  }

  .hero-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 999px;
    background: var(--warm-accent-soft-14);
    color: var(--accent-strong);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 14px;
  }

  .card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 4px;
    box-shadow: var(--shadow-card-strong);
    padding: 20px;
    color: var(--ink);
  }

  #content-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 10px;
    padding: 8px 12px;
    background: var(--panel-soft);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 0.86rem;
    color: var(--muted);
    font-weight: 700;
  }

  .selection-note {
    margin-bottom: 10px;
    font-size: 0.95rem;
    color: var(--muted);
  }

  .launch-card {
    background: var(--shell-surface-08);
    border: 1px solid var(--shell-surface-10);
    color: var(--shell-text);
    display: grid;
    gap: 14px;
    align-content: start;
  }

  .launch-card h2 {
    margin: 0 0 10px;
    font-size: 1.15rem;
  }

  .launch-card p {
    color: var(--shell-text-78);
  }

  .launch-card .tip-card {
    padding: 12px 14px;
    border-radius: 4px;
    background: var(--shell-surface-08);
    color: var(--shell-text-82);
    line-height: 1.45;
  }

  .launch-summary {
    display: grid;
    gap: 8px;
    padding: 14px;
    border-radius: 4px;
    background: var(--panel-soft);
    border: 1px solid var(--border);
  }

  .launch-summary-kicker {
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent-strong);
  }

  .launch-summary-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--ink);
  }

  .launch-summary-meta {
    font-size: 0.9rem;
    color: var(--muted);
  }

  .selection-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .selection-pill {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0 10px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--ink) 8%, transparent);
    color: var(--ink);
    font-size: 0.82rem;
    font-weight: 700;
  }

  .selection-pill-muted {
    color: var(--muted);
    background: color-mix(in srgb, var(--ink) 6%, transparent);
  }

  .secondary-action {
    min-height: 46px;
    border-radius: 4px;
    border: 1px solid var(--border);
    background: var(--option-bg);
    color: var(--ink);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
  }

  .range-tools {
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--panel-soft);
    padding: 14px 16px;
    margin: 6px 0 0;
  }

  .range-tools-title {
    margin: 0 0 6px;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
  }

  .range-field {
    display: flex;
    flex-direction: column;
    gap: 3px;
  }

  .range-field label {
    font-size: 0.78rem;
    color: var(--muted);
    font-weight: 600;
  }

  .range-field input,
  .range-exceptions input {
    min-height: 44px;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 8px 10px;
    font: inherit;
    color: var(--ink);
    background: var(--option-bg);
  }

  #add-chapter-range {
    min-height: 44px;
    border: 1px solid var(--border-action);
    border-radius: 4px;
    background: var(--option-bg);
    color: var(--action);
    font: inherit;
    font-weight: 700;
    padding: 8px 12px;
    cursor: pointer;
  }

  .range-exceptions {
    margin-top: 6px;
  }

  .range-exceptions label {
    display: block;
    font-size: 0.78rem;
    color: var(--muted);
    font-weight: 600;
    margin-bottom: 3px;
  }

  .scope-section-heading {
    margin: 0 0 4px;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
  }

  .scope-option {
    min-height: 56px;
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--option-bg);
    color: var(--ink);
    font: inherit;
    font-weight: 600;
    padding: 12px 14px;
    text-align: left;
    cursor: pointer;
    display: grid;
    gap: 4px;
    align-content: start;
    position: relative;
    transition: border-color 120ms ease, background-color 120ms ease,
      transform 120ms ease, box-shadow 120ms ease;
  }

  .scope-option::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: transparent;
    transition: background-color 120ms ease;
  }

  .scope-option-eyebrow {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
  }

  .scope-option-title {
    font-size: 0.98rem;
    line-height: 1.25;
    color: var(--ink);
  }

  .scope-option-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 2px;
    font-size: 0.8rem;
    color: var(--muted);
  }

  .scope-option-count {
    font-weight: 700;
  }

  .scope-option[aria-pressed="true"] {
    border-color: var(--accent-border);
    box-shadow: 0 14px 28px color-mix(in srgb, var(--shell) 28%, transparent),
      inset 0 0 0 1px var(--selected-active-ring);
  }

  .scope-option[aria-pressed="true"]::before {
    background: linear-gradient(180deg, var(--accent), var(--accent-deep));
  }

  .scope-option[aria-pressed="true"]::after {
    content: "\2713";
    position: absolute;
    top: 10px;
    right: 10px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--accent-ink);
    background: var(--accent-wash);
    border: 1px solid var(--warm-accent-border);
  }

  .scope-option[aria-pressed="true"] .scope-option-eyebrow,
  .scope-option[aria-pressed="true"] .scope-option-count {
    color: var(--accent-text);
  }

  .scope-option:hover {
    transform: translateY(-1px);
    border-color: var(--border-hover);
    box-shadow: 0 12px 22px color-mix(in srgb, var(--shell) 18%, transparent);
  }

  #scope-selector > .scope-option {
    width: 100%;
  }

  .scope-option.scope-complete {
    border-color: var(--good-border);
  }

  .scope-option.scope-partial {
    border-color: var(--warn-border);
  }

  #start-quiz {
    min-height: 54px;
    width: 100%;
    border: none;
    border-radius: 4px;
    background: var(--action);
    color: var(--shell-text);
    font: inherit;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 120ms ease;
  }

  #start-quiz:disabled {
    cursor: not-allowed;
    opacity: 0.38;
    filter: grayscale(0.4);
  }

  /* === Session page only === */

  .session-progress {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 0 1 auto;
    min-width: 0;
    padding: 0 16px;
  }

  .session-progress-segments {
    order: 1;
    flex: 0 0 160px;
    max-width: 200px;
  }

  .session-progress-label {
    order: 2;
    display: block;
    color: var(--shell-text-85);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    min-width: max-content;
    text-align: right;
  }

  .session-progress-track {
    display: none;
  }

  .session-progress-segments {
    display: block;
    height: 4px;
    width: 100%;
    background: #243042;
    border-radius: 0;
    overflow: hidden;
  }

  .progress-fill {
    height: 100%;
    background: var(--accent-strong);
    border-radius: 0;
    min-width: 0;
  }

  .session-progress-fill {
    display: none;
  }

  /* ── Exam Timer ────────────────────────────────────── */
  .session-timer[hidden] {
    display: none;
  }

  .session-timer {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 6px;
    background: var(--warm-accent-soft-14, rgba(200,160,80,0.14));
    color: var(--shell-text, #fff);
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    font-size: 1.05rem;
    white-space: nowrap;
    min-height: 36px;
    transition: background 0.3s, color 0.3s;
  }

  .session-timer .timer-icon {
    font-size: 1.1rem;
    line-height: 1;
  }

  .session-timer .timer-display {
    min-width: 3.6ch;
    text-align: center;
  }

  .session-timer[data-urgency="warning"] {
    background: rgba(255, 180, 0, 0.22);
    color: #ffc107;
  }

  .session-timer[data-urgency="critical"] {
    background: rgba(220, 53, 69, 0.22);
    color: #ff4d4d;
    animation: timer-pulse 1s ease-in-out infinite;
  }

  .session-timer[data-urgency="expired"] {
    background: rgba(220, 53, 69, 0.35);
    color: #ff4d4d;
  }

  .session-timer.timer-warning {
    /* warning class applied once at threshold */
  }

  @keyframes timer-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.55; }
  }

  .shell-button {
    min-height: 36px;
    border: 1px solid #424752;
    border-radius: 4px;
    background: transparent;
    color: #8c919e;
    font: inherit;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 6px 12px;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
  }

  .shell-button:hover {
    color: var(--ink);
    border-color: #8c919e;
  }

  #theme-toggle {
    min-width: 40px;
    min-height: 40px;
    font-size: 1.2rem;
    padding: 0;
    display: grid;
    place-items: center;
    transition: border-color 0.2s;
  }
  #theme-toggle:hover { border-color: var(--accent); }

  .session-nav {
    display: none;
  }

  .session-nav-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }

  .session-nav-title {
    font-size: 1rem;
    font-weight: 700;
  }

  .nav-panel-toggle {
    min-height: 38px;
    border-radius: 4px;
    border: 1px solid var(--shell-surface-16);
    background: var(--shell-surface-08);
    color: var(--shell-text);
    font: inherit;
    font-weight: 700;
    padding: 0 12px;
    cursor: pointer;
  }

  .nav-summary {
    display: grid;
    gap: 6px;
    padding: 12px 14px;
    border-radius: 4px;
    background: var(--shell-surface-06);
    border: 1px solid var(--shell-surface-08);
  }

  .nav-summary-label {
    font-size: 0.76rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent-strong);
    font-weight: 800;
  }

  .nav-summary-stats {
    font-size: 0.9rem;
    color: var(--shell-text-82);
    font-weight: 700;
  }

  .question-nav-list {
    display: grid;
    gap: 8px;
    max-height: min(60vh, 680px);
    overflow: auto;
    padding-right: 4px;
  }

  .question-nav-item {
    width: 100%;
    min-height: 44px;
    border-radius: 4px;
    border: 1px solid var(--shell-surface-10);
    background: var(--shell-surface-06);
    color: var(--shell-text);
    padding: 10px 12px;
    text-align: left;
    display: grid;
    gap: 3px;
    cursor: pointer;
  }

  .question-nav-number {
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--shell-text-72);
  }

  .question-nav-label {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--shell-text);
  }

  .question-nav-status {
    font-size: 0.78rem;
    color: var(--shell-text-72);
  }

  .question-nav-item.current {
    border-color: var(--warm-accent-border);
    background: var(--warm-accent-soft);
    box-shadow: inset 0 0 0 1px var(--warm-accent-ring);
  }

  .question-nav-item.answered-correct {
    border-color: color-mix(in srgb, var(--good) 42%, transparent);
  }

  .question-nav-item.answered-incorrect {
    border-color: color-mix(in srgb, var(--bad) 42%, transparent);
  }

  .question-nav-item.flagged {
    box-shadow: inset 0 0 0 1px var(--warm-accent-ring);
  }

  /* === Phase 8-01: compact mini-map — non-interactive dots === */
  .question-nav-list.compact .question-nav-item {
    pointer-events: none;
    cursor: default;
  }

  .session-nav-tip {
    color: var(--shell-text-78);
    font-size: 0.92rem;
    line-height: 1.5;
    padding: 2px 2px 0;
  }

  .session-nav-tip strong {
    color: var(--accent-strong);
  }

  .session-nav[data-collapsed="true"] .nav-summary,
  .session-nav[data-collapsed="true"] .session-nav-tip,
  .session-nav[data-collapsed="true"] .question-nav-label,
  .session-nav[data-collapsed="true"] .question-nav-status,
  .session-nav[data-collapsed="true"] .session-nav-title {
    display: none;
  }

  .session-nav[data-collapsed="true"] .question-nav-item {
    justify-items: center;
    padding: 10px 8px;
  }

  .session-nav[data-collapsed="true"] .question-nav-number {
    font-size: 0.9rem;
    color: var(--shell-text);
  }

  /* --- Question & Answers --- */

  #question-progress {
    margin: 0 0 8px;
    color: var(--accent-strong);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    text-align: left;
  }

  .question-meta-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
  }

  #score-progress {
    display: none;
    margin: 0 0 8px;
    font-size: 0.86rem;
    font-weight: 700;
    color: var(--muted);
    text-align: left;
  }

  #question-prompt {
    margin: 0;
    text-align: right;
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  /* Report button (inline with QID in question-meta-row) */
  .meta-report-btn {
    width: 24px;
    height: 24px;
    min-width: 24px;
    border: none;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    padding: 0;
    display: grid;
    place-items: center;
    border-radius: 50%;
    transition: color 120ms ease, background-color 120ms ease;
    flex-shrink: 0;
  }
  .meta-report-btn svg {
    display: block;
    width: 18px;
    height: 18px;
  }
  @media (hover: hover) and (pointer: fine) {
    .meta-report-btn:hover {
      background: var(--surface-10, rgba(0,0,0,0.08));
      color: var(--warm-accent, #e57c2f);
    }
  }

  #question-text {
    margin: 0 0 18px;
    line-height: 1.45;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
    text-align: left;
  }

  #feedback-body,
  #selected-answer,
  #correct-answer {
    overflow-wrap: anywhere;
  }

  #answer-list {
    display: grid;
    gap: 16px;
    margin-bottom: 14px;
    padding-left: 0;
  }

  .answer-option-btn {
    min-height: 45px;
    border: 1px solid #424752;
    border-radius: 8px;
    overflow: visible;
    background: #243042;
    color: var(--ink);
    font: inherit;
    font-size: 16px;
    font-weight: 400;
    line-height: 1.6;
    text-align: left;
    padding: 14px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
    flex: 1;
    box-shadow: none;
    outline: none;
    transition: border-color 0.15s, background-color 0.15s;
  }

  .answer-option-btn::after {
    content: "";
    position: absolute;
    inset: -1px;
    border: 2px solid transparent;
    border-radius: 8px;
    pointer-events: none;
    transition: border-color 0.15s;
  }

  .answer-option-btn:hover {
    cursor: pointer;
    border-color: var(--accent-strong);
    background: #2a3a4e;
  }

  .answer-option-btn:hover::after {
    border-color: transparent;
  }

  .option-letter {
    position: static;
    transform: none;
    width: 24px;
    height: auto;
    border-radius: 0;
    border: none;
    background: transparent;
    color: var(--accent-strong);
    display: block;
    font-weight: 700;
    font-size: 16px;
    line-height: 1;
    flex: 0 0 auto;
    text-align: center;
    left: auto;
    top: auto;
  }

  .option-content {
    display: grid;
    gap: 6px;
    min-width: 0;
    flex: 1;
  }

  .option-label {
    line-height: 1.45;
    word-break: normal;
    overflow-wrap: normal;
    hyphens: none;
  }

  .answer-option-btn.feedback-correct {
    border-color: #049875;
    background: rgba(4,152,117,0.12);
  }

  .answer-option-btn.feedback-correct::after {
    border: 2px solid #049875;
  }

  .answer-option-btn.feedback-correct .option-letter {
    color: #049875;
    font-size: 16px;
    font-weight: 700;
  }

  .answer-option-btn.feedback-selected-wrong {
    border-color: #e52525;
    background: rgba(229,37,37,0.12);
  }

  .answer-option-btn.feedback-selected-wrong::after {
    border: 2px solid #e52525;
  }

  .answer-option-btn.feedback-selected-wrong .option-letter {
    color: #e52525;
  }

  /* Unselected distractors in graded state — dimmed */
  .answer-option-btn[disabled]:not(.feedback-correct):not(.feedback-selected-wrong) {
    opacity: 0.5;
    border-color: #424752;
  }

  .answer-option-btn[disabled]:not(.feedback-correct):not(.feedback-selected-wrong)::after {
    border-color: rgba(88,113,131,0.25);
  }

  /* Wrong-selected must override .selected border */
  .answer-option-btn.selected.feedback-selected-wrong::after {
    border: 1px solid rgba(88,113,131,0.5);
  }

  .answer-option-btn.selected.feedback-selected-wrong .option-letter {
    color: #e52525;
  }

  .option-status-marker {
    font-weight: 700;
    width: auto;
    height: auto;
    min-width: 0;
    display: inline;
    text-align: left;
    line-height: 1;
    font-size: 1.05rem;
  }

  .option-status-marker.correct {
    color: var(--good);
    width: 20px;
    height: 20px;
    min-width: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
  }

  .option-status-marker.wrong {
    color: var(--bad);
    width: 20px;
    height: 20px;
    min-width: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 1.2rem;
    font-weight: 800;
    line-height: 0.9;
  }

  .question-explanation-toggle {
    margin: 6px 0 10px;
  }

  .question-explanation-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
  }

  .question-explanation-link {
    border: none;
    background: transparent;
    color: var(--accent);
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
    padding: 0;
  }

  .question-explanation-link:hover {
    color: var(--accent-deep);
  }

  .option-explanation {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    line-height: 1.45;
    color: var(--muted);
    white-space: normal;
    overflow: visible;
    max-height: none;
    text-overflow: unset;
  }

  .option-explanation[hidden] {
    display: none !important;
  }

  .option-explanation-link {
    border: none;
    background: transparent;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    padding: 4px 0;
    margin: 6px 0 2px;
    width: auto;
    text-align: left;
    align-self: flex-start;
  }

  .option-explanation-link:hover {
    color: var(--ink);
  }

  .answer-option-btn.selected {
    border-color: var(--accent-strong);
    background: #2a3a4e;
  }

  .answer-option-btn.selected::after {
    border: 2px solid var(--accent-strong);
  }

  .answer-option-btn.selected .option-letter {
    background: transparent;
    border-color: transparent;
    color: var(--accent-strong);
  }

  .answer-option-btn[disabled] {
    cursor: default;
    opacity: 1;
  }

  /* === Phase 8-02: Answer Elimination === */

  .option-row {
    position: relative;
    display: flex;
    align-items: stretch;
    margin-bottom: 10px;
  }

  .eliminate-btn {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    width: 28px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--muted);
    font-size: 0.85rem;
    cursor: pointer;
    border-radius: 50%;
    padding: 0;
    line-height: 1;
  }

  .eliminate-btn::after {
    content: "\2298"; /* strikethrough circle ⊘ */
    font-size: 1.125rem;
  }

  .eliminate-btn:hover {
    background: transparent;
    font-weight: bold;
  }

  .eliminate-btn[aria-pressed="true"] {
    color: var(--incorrect);
  }

  .option-row.struck .answer-option-btn .option-label {
    text-decoration: line-through;
    opacity: 0.45;
  }

  .option-row.struck .answer-option-btn .option-letter {
    opacity: 0.45;
  }

  .option-row.struck .answer-option-btn {
    cursor: not-allowed;
  }

  /* --- Feedback --- */

  #validation-prompt {
    min-height: 24px;
    margin: 0;
    font-weight: 600;
    color: var(--muted);
  }

  #feedback-panel {
    margin-top: 16px;
    border-top: none;
    padding-top: 0;
    line-height: 1.4;
    display: flex;
    flex-direction: column;
    gap: 16px;
  }

  #feedback-panel[hidden] {
    display: none;
  }

  #feedback-panel > .explanation-card {
    display: none;
  }

  .feedback-heading {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 18px;
    font-weight: 700;
    margin: 0;
  }

  .feedback-heading.correct {
    color: #049875;
  }

  .feedback-heading.incorrect {
    color: #e52525;
  }

  #feedback-title {
    margin: 0 0 8px;
    font-size: 1rem;
  }

  #feedback-title.correct {
    color: var(--good);
    font-weight: 700;
  }

  #feedback-title.incorrect {
    color: var(--bad);
    font-weight: 700;
  }

  .option-check-icon {
    font-size: 20px;
    flex-shrink: 0;
    margin-left: auto;
  }

  .quiz-complete-header {
    text-align: center;
    margin-bottom: 16px;
  }

  .quiz-complete-icon {
    font-size: 48px;
    color: var(--accent-strong);
    display: block;
    margin-bottom: 8px;
  }

  .quiz-complete-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--ink);
    margin: 0;
  }

  .quiz-complete-score {
    text-align: center;
    font-size: 16px;
    color: #c2c6d5;
    margin-bottom: 24px;
  }

  #feedback-panel > .explanation-card,
  #feedback-panel > .exam-pearl,
  #feedback-panel > .citation,
  #feedback-panel > .protocol-review-card,
  #feedback-panel > div.explanation-card.correct {
    display: none !important;
  }

  .selected-answer {
    color: var(--bad);
  }

  .correct-answer {
    color: var(--good);
  }

  /* --- Feedback explanation card with inline tables --- */

  .feedback-explanation-card {
    line-height: 1.5;
  }

  .feedback-explanation-text {
    display: none;
  }

  .feedback-table-figure {
    margin: 12px 0;
    padding: 0;
  }

  .feedback-table-caption {
    font-weight: 700;
    font-size: 0.85rem;
    margin-bottom: 6px;
    color: var(--text);
  }

  .feedback-table-image {
    display: block;
    max-width: 100%;
    height: auto;
    border: 1px solid var(--border);
    border-radius: 4px;
    margin-bottom: 4px;
  }

  .feedback-citation {
    margin: 10px 0 0;
    font-size: 13px;
    font-style: italic;
    color: #8c919e;
  }

  .feedback-exam-pearl {
    margin: 8px 0 0;
    font-size: 14px;
    padding: 12px 16px;
    background: transparent;
    border-left: 3px solid var(--accent-strong);
    border-radius: 0;
    color: var(--ink);
    line-height: 1.5;
  }

  .review-item {
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 8px 10px;
    background: var(--panel);
  }

  .review-item + .review-item {
    margin-top: 8px;
  }

  .review-item summary {
    cursor: pointer;
    font-weight: 700;
  }

  .check-answer-button {
    min-height: 48px;
    width: 100%;
    margin-top: 18px;
    border: none;
    border-radius: 8px;
    background: var(--accent-strong);
    color: #003169;
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    cursor: pointer;
    transition: filter 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
  }

  .check-answer-button:hover {
    filter: brightness(1.1);
  }

  .check-answer-button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
  }

  /* --- Bottom navigation (PocketPrep parity) --- */

  .bottom-shell {
    background: var(--shell);
    border-top: none;
    border-radius: 0;
    box-shadow: none;
    padding: 0 22px;
  }

  .bottom-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 65px;
    color: var(--shell-text);
  }

  .nav-controls-center {
    display: flex;
    align-items: center;
    gap: 24px;
    margin: 0 auto;
  }

  .nav-arrow {
    width: 48px;
    height: 48px;
    border: none;
    background: transparent;
    color: var(--shell-text);
    cursor: pointer;
    padding: 0;
    display: grid;
    place-items: center;
    border-radius: 50%;
    transition: opacity 120ms ease, background-color 120ms ease;
  }

  @media (hover: hover) and (pointer: fine) {
    .nav-arrow:hover {
      background: var(--shell-surface-10);
    }
  }

  .nav-arrow:disabled {
    opacity: 0.35;
    cursor: default;
    pointer-events: none;
  }

  .nav-arrow svg {
    display: block;
  }

  .nav-flag-toggle {
    width: 48px;
    height: 48px;
    border: none;
    background: transparent;
    color: var(--shell-text);
    cursor: pointer;
    padding: 0;
    display: grid;
    place-items: center;
    border-radius: 50%;
    transition: color 120ms ease, background-color 120ms ease;
    margin: 0 56px;
  }

  @media (hover: hover) and (pointer: fine) {
    .nav-flag-toggle:hover {
      background: var(--shell-surface-10);
    }
  }

  .nav-flag-toggle[aria-pressed="true"] {
    color: var(--warm-accent);
  }

  .nav-flag-toggle svg {
    display: block;
  }

  .nav-keyboard-btn {
    position: absolute;
    right: 0;
    border: none;
    background: transparent;
    color: var(--shell-text);
    cursor: pointer;
    padding: 8px;
    display: grid;
    place-items: center;
    border-radius: 4px;
    opacity: 0.6;
    transition: opacity 120ms ease;
    display: none !important;
  }

  .nav-keyboard-btn:hover {
    opacity: 1;
  }

  .nav-keyboard-btn svg {
    display: block;
  }

  .check-answer-button[hidden] {
    display: none;
  }

  /* --- Component media queries --- */

  @media (min-width: 768px) {
    .page h1 {
      font-size: clamp(2.1rem, 1.5rem + 1vw, 3rem);
    }

    .card {
      padding: 24px;
    }

    .panel {
      padding: 32px 42px 28px;
    }

    .nav-controls-center {
      gap: 80px;
    }
  }

  @media (max-width: 767px) {
    .session-page .quiz-shell {
      padding: 0 8px;
    }

    .session-page .panel {
      padding: 18px 12px 16px;
    }

    #question-prompt {
      text-align: left;
      margin-top: 10px;
    }

    .session-page #answer-list {
      padding-left: 0;
      gap: 6px;
    }

    .session-page .answer-option-btn {
      padding: 10px;
      gap: 6px;
    }

    .session-page .option-letter {
      display: none;
    }

    .session-page .option-label {
      line-height: 1.4;
    }

    .session-page .eliminate-btn {
      right: 2px;
      width: 16px;
      min-height: 32px;
    }

    .nav-controls-center {
      gap: 12px;
    }

    .nav-flag-toggle {
      margin: 0 8px;
    }

    .bottom-shell {
      padding: 0 8px;
    }
  }
}

/* === Phase 7: Question Count Controller === */
.count-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
}

.count-slider {
  width: 100%;
  min-height: 44px;
  accent-color: var(--accent);
  cursor: pointer;
}

.count-input {
  width: 72px;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px 10px;
  font: inherit;
  color: var(--ink);
  background: var(--option-bg);
  text-align: center;
}

.count-preset-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.count-preset-pill {
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--option-bg);
  color: var(--ink);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 120ms, background-color 120ms;
}

.count-preset-pill[aria-pressed="true"] {
  border-color: var(--accent-border);
  background: var(--accent-wash);
  color: var(--accent-text);
}

/* === Phase 7: Display Mode Selector === */
.display-mode-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.display-mode-btn {
  min-height: 70px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--option-bg);
  color: var(--ink);
  font: inherit;
  padding: 12px 14px;
  text-align: left;
  cursor: pointer;
  display: grid;
  gap: 4px;
  transition: border-color 120ms, background-color 120ms;
}

.display-mode-btn[aria-pressed="true"] {
  border-color: var(--selected-active-border);
  background: var(--selected-active-bg);
  box-shadow: inset 0 0 0 1px var(--selected-active-ring);
}

.display-mode-label {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--ink);
}

.display-mode-desc {
  font-size: 0.82rem;
  color: var(--muted);
}

.display-mode-btn[aria-pressed="true"] .display-mode-label {
  color: var(--selected-active-text);
}

.display-mode-note {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 4px;
  background: var(--selected-active-bg);
  border: 1px solid var(--selected-active-border);
  font-size: 0.86rem;
  color: var(--selected-active-text);
}

/* === Phase 7: Config Layout (Start Page) === */

/* Quiz Start shell — full-bleed centered layout */
.quiz-start-shell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 16px;
}

.quiz-start-card {
  width: 100%;
  max-width: 480px;
  background: var(--panel);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  padding: 32px;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5);
}

.quiz-start-header {
  text-align: center;
  margin-bottom: 24px;
}

.quiz-start-icon {
  font-size: 20px;
  color: var(--ink);
  margin-bottom: 8px;
  display: block;
}

.quiz-start-title {
  font-size: 24px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink);
  margin: 0 0 4px;
}

.quiz-start-subtitle {
  font-size: 13px;
  color: #8c919e;
  margin: 0;
  line-height: 1.4;
}

.quiz-start-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.quiz-start-form fieldset {
  border: none;
  padding: 0;
  margin: 0;
}

.scope-radios {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.scope-radio-label {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.scope-radio-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.scope-radio-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid #424752;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: border-color 0.15s, background-color 0.15s;
}

.scope-radio-fill {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--panel);
  opacity: 0;
  transition: opacity 0.15s;
}

.scope-radio-input:checked ~ .scope-radio-dot {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
}

.scope-radio-input:checked ~ .scope-radio-dot .scope-radio-fill {
  opacity: 1;
}

.scope-radio-text {
  font-size: 16px;
  color: #8c919e;
  line-height: 1.6;
}

.scope-radio-input:checked ~ .scope-radio-text {
  color: var(--ink);
}

.quiz-start-hint {
  font-size: 13px;
  color: #8c919e;
  text-align: center;
  margin: 8px 0 0;
  line-height: 1.4;
}

.config-layout {
  display: grid;
  gap: 14px;
}

.config-card {
  display: grid;
  gap: 8px;
}

.config-card-heading {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #c2c6d5;
}

.count-input {
  width: 100%;
  background: #243042;
  border: 1px solid #424752;
  border-radius: 8px;
  padding: 10px 16px;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  transition: border-color 0.15s;
}

.count-input:focus {
  outline: none;
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 1px var(--accent-strong);
}

.range-field input {
  width: 100%;
  background: #243042;
  border: 1px solid #424752;
  border-radius: 8px;
  padding: 10px 16px;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
}

.range-field input:focus {
  outline: none;
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 1px var(--accent-strong);
}

/* === Phase 8-03: Rich Explanation Panel === */

.explanation-panel {
  padding: 0;
}

.explanation-card {
  padding: 14px 16px;
  border-radius: 4px;
    background: var(--panel-soft);
  color: var(--ink);
  margin-bottom: 12px;
}

.explanation-card.correct {
  border-left-color: var(--correct);
  background: color-mix(in srgb, var(--correct) 8%, var(--panel));
}

.exam-pearl {
  padding: 12px 16px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--accent) 12%, var(--panel));
  border-left: 4px solid var(--accent);
  font-size: 0.88rem;
  color: var(--ink);
  margin-bottom: 12px;
}

.exam-pearl::before {
  content: "Exam Pearl: ";
  font-weight: 700;
  color: var(--accent-text);
}

.citation {
  font-size: 0.8rem;
  color: var(--muted);
  padding: 4px 0;
  margin-bottom: 8px;
}

/* State protocol review card */
.protocol-review-card {
  padding: 12px 16px;
  border-radius: 4px;
  background: color-mix(in srgb, #e65100 10%, var(--panel));
  border-left: 4px solid #e65100;
  font-size: 0.88rem;
  color: var(--ink);
  margin-bottom: 12px;
  line-height: 1.45;
}

.protocol-review-card strong {
  display: block;
  margin-bottom: 6px;
  color: #e65100;
  font-size: 0.92rem;
}

.protocol-review-card .protocol-summary {
  margin: 0 0 8px;
}

.protocol-review-card .protocol-quote {
  margin: 8px 0;
  padding: 8px 12px;
  border-left: 3px solid var(--muted);
  font-style: italic;
  color: var(--muted);
}

.protocol-review-card .protocol-citation {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 4px 0;
}

.protocol-review-card .protocol-source-link {
  display: inline-block;
  margin-top: 4px;
  font-size: 0.8rem;
  color: var(--accent);
  text-decoration: underline;
}

/* Responsive explanation layout — feedback panel inside the panel */

/* === Phase 8-04: Exam Mode & Review Screen === */

.exam-review-summary {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--ink);
  padding: 12px 0;
  text-align: center;
}

.review-filter-bar {
  display: flex;
  gap: 8px;
  padding: 8px 0;
  flex-wrap: wrap;
}

.review-filter-btn {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.85rem;
  cursor: pointer;
  min-height: 44px;
}

.exam-review-list {
  list-style: none;
  padding: 0;
  margin: 12px 0;
  display: grid;
  gap: 6px;
}

.review-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.review-item.correct {
  border-color: var(--correct);
}

.review-item.incorrect {
  border-color: var(--incorrect);
}

.review-item-num {
  font-weight: 700;
  font-size: 0.9rem;
  min-width: 32px;
}

.review-item-result {
  font-size: 0.85rem;
  color: var(--muted);
}

.review-item-flag {
  font-size: 0.8rem;
  color: var(--accent-text);
}

.submit-all-btn {
  width: 100%;
  padding: 14px;
  border-radius: 4px;
  font-size: 1rem;
  font-weight: 700;
  min-height: 56px;
  border: none;
  cursor: pointer;
  margin-top: 16px;
  background: var(--accent);
  color: var(--on-accent);
}

/* === Phase 8-05: A11Y Utilities === */

.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;
}

/* Touch swipe — Phase 9 */
.session-main-column {
  touch-action: pan-y;
}
.session-main-column.swiping {
  transition: transform 0.2s ease-out;
}

/* Shortcuts help modal — Phase 9 */
.shortcuts-help-dialog {
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 1.5rem;
  max-width: 420px;
  width: 90vw;
  background: var(--surface-color);
  color: var(--text-color);
}
.shortcuts-help-dialog::backdrop {
  background: var(--overlay-backdrop);
}
.shortcuts-help-dialog h2 {
  margin: 0 0 1rem 0;
  font-size: 1.25rem;
}
.shortcuts-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.25rem;
}
.shortcuts-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border-color);
}
.shortcuts-table td:first-child {
  white-space: nowrap;
  width: 40%;
}
.shortcuts-table kbd {
  display: inline-block;
  padding: 0.15em 0.5em;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: var(--kbd-bg);
  font-family: inherit;
  font-size: 0.9em;
  min-width: 1.5em;
  text-align: center;
}
.shortcuts-help-close {
  display: block;
  margin: 0 auto;
  padding: 0.5rem 2rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: var(--surface-color);
  color: var(--text-color);
  font-size: 1rem;
  cursor: pointer;
  min-height: 44px;
}
.shortcuts-help-btn,
#theme-toggle {
  display: none;
}

/* === Phase 10: Micro-Interaction Animations === */

@keyframes anim-select {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.03); }
  100% { transform: scale(1); }
}

@keyframes anim-correct {
  0%   { transform: scale(1); }
  30%  { transform: scale(1.04); }
  100% { transform: scale(1); }
}

@keyframes anim-shake {
  0%, 100% { transform: translateX(0); }
  20%      { transform: translateX(-4px); }
  40%      { transform: translateX(4px); }
  60%      { transform: translateX(-3px); }
  80%      { transform: translateX(3px); }
}

.answer-option-btn.anim-select {
  animation: anim-select 200ms ease-out;
}

.answer-option-btn.feedback-correct {
  animation: anim-correct 300ms ease-out;
}

.answer-option-btn.feedback-selected-wrong {
  animation: anim-shake 400ms ease-out;
}

.answer-option-btn:active,
.check-answer-button:active,
.nav-button:active {
  transform: scale(0.96);
}

/* === Passage block === */
.passage-block {
  background: var(--panel-soft, #243042);
  border-left: 3px solid var(--accent, #4a90e2);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  border-radius: 6px;
  font-size: 0.95rem;
  line-height: 1.6;
  white-space: pre-line;
  color: var(--ink, #e8ecf0);
}

/* === Matrix Radio Table — PocketPrep visual parity === */
/* Unified radio table for ALL column counts (binary + 3-col).
   DOM: .matrix-question > .matrix-table-wrapper[role=group] > table.matrix-table
     thead: th.matrix-corner + th.matrix-col-header × N
     tbody: tr.matrix-row > th.matrix-row-label + td.matrix-cell > input.matrix-radio
   Graded: tr.matrix-correct / tr.matrix-wrong
           input.matrix-radio-correct / input.matrix-radio-wrong */

.matrix-question .matrix-table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 5px;                          /* PP exact */
  border: 1px solid var(--border, rgba(136,163,182,0.85));
}

.matrix-question .matrix-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 0;
}

.matrix-table th,
.matrix-table td {
  border: none;
  border-bottom: 1px solid var(--border, rgba(136,163,182,0.25));
  text-align: center;
  vertical-align: middle;
  color: var(--ink, #e8ecf0);
}

/* ── Column headers — PP: 12px, weight 500, ~56px wide ── */
.matrix-table thead th {
  background: var(--panel-soft, #243042);
  font-weight: 500;                            /* PP exact */
  font-size: 12px;                             /* PP exact */
  color: var(--muted, #8899aa);
  text-transform: none;
  white-space: normal;
  line-height: 1.3;
  padding: 10px 6px;
  min-width: 56px;                             /* PP exact */
}

.matrix-table thead th:first-child {
  border-top-left-radius: 4px;
}

.matrix-table thead th:last-child {
  border-top-right-radius: 4px;
}

/* ── Corner cell ── */
.matrix-table .matrix-corner {
  text-align: left;
  padding-left: 12px;
  color: var(--muted, #8899aa);
  font-size: 12px;                             /* PP exact */
  font-weight: 500;
  min-width: 200px;
}

/* ── Body rows ── */
.matrix-table tbody tr {
  background: var(--option-bg, #1e2d3d);
  transition: background 0.15s ease;
}

.matrix-table tbody tr:nth-child(even) {
  background: var(--panel, #1e2a3a);
}

.matrix-table tbody tr:hover:not(.matrix-correct):not(.matrix-wrong) {
  background: var(--surface-hover, rgba(255,255,255,0.05));
}

.matrix-table tbody tr:last-child td:first-child,
.matrix-table tbody tr:last-child th:first-child {
  border-bottom-left-radius: 4px;
}

.matrix-table tbody tr:last-child td:last-child {
  border-bottom-right-radius: 4px;
}

.matrix-table tbody tr:last-child td,
.matrix-table tbody tr:last-child th {
  border-bottom: none;
}

/* ── Row labels — PP: 16.5px, weight 500, ~279px wide, line-height 23px ── */
.matrix-table .matrix-row-label {
  text-align: left;
  font-weight: 500;                            /* PP exact */
  font-size: 16.5px;                           /* PP exact */
  line-height: 23px;                           /* PP exact */
  min-width: 200px;
  max-width: 320px;
  color: var(--ink, #e8ecf0);
  background: transparent;
  padding: 12px 12px;
}

/* ── Radio cells ── */
.matrix-table .matrix-cell {
  padding: 10px 6px;
}

/* ── Radio inputs — PP exact: 18px diameter, 1px border, 12px inner dot ── */
.matrix-table input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;                                 /* PP exact */
  height: 18px;                                /* PP exact */
  border: 1px solid var(--pp-neutral, #708e9d); /* PP exact: 1px */
  border-radius: 50%;
  background: var(--surface, #fff);             /* PP exact: white bg */
  cursor: pointer;
  transition: border-color 0.15s ease;
  position: relative;
  box-sizing: border-box;                       /* PP exact */
  flex-shrink: 0;
}

.matrix-table input[type="radio"]::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 12px;                                 /* PP exact: 12px inner dot */
  height: 12px;
  border-radius: 50%;
  background: var(--pp-blue-action, #0064ff);   /* PP pre-submit: blue */
  transform: translate(-50%, -50%);
  display: none;                                /* PP: hidden until selected */
}

.matrix-table input[type="radio"]:checked::before {
  display: block;                               /* PP: show on selected */
}

.matrix-table input[type="radio"]:hover {
  border-color: var(--pp-blue-action, #0064ff);
}

.matrix-table input[type="radio"]:checked {
  border-color: var(--pp-blue-action, #0064ff); /* PP pre-submit: blue border */
  background: transparent;                      /* PP: transparent when selected */
}

.matrix-table input[type="radio"]:focus-visible {
  outline: 2px solid var(--pp-blue-action, #0064ff);
  outline-offset: 2px;
}

.matrix-table input[type="radio"]:disabled {
  cursor: default;
  opacity: 0.7;
}

/* ── Graded: correct radio — PP teal border + fill ── */
.matrix-table input[type="radio"].matrix-radio-correct {
  border-color: var(--good, #049875);          /* PP exact teal */
}

.matrix-table input[type="radio"].matrix-radio-correct:checked {
  border-color: var(--good, #049875);
}

.matrix-table input[type="radio"].matrix-radio-correct:checked::before {
  background: var(--good, #049875);            /* PP graded: teal dot */
}

/* ── Graded: wrong selected radio — PP red border + fill ── */
.matrix-table input[type="radio"].matrix-radio-wrong {
  border-color: var(--bad, #e52525);           /* PP exact red */
}

.matrix-table input[type="radio"].matrix-radio-wrong:checked {
  border-color: var(--bad, #e52525);
}

.matrix-table input[type="radio"].matrix-radio-wrong:checked::before {
  background: var(--bad, #e52525);             /* PP graded: red dot */
}

/* ── Graded: correct row — teal left border (no bg fill) ── */
.matrix-table tbody tr.matrix-correct {
  border-left: 3px solid var(--good, #049875);
}

/* ── Graded: wrong row — red left border (no bg fill) ── */
.matrix-table tbody tr.matrix-wrong {
  border-left: 3px solid var(--bad, #e52525);
}

/* === Build List (ordering) === */
/* PocketPrep visual parity: circular position badges, arrow buttons, teal/red feedback.
   DOM: .build-list-question > .build-list > li.build-list-item
   Each item: .build-list-position-badge + .build-list-text + .build-list-arrow-up + .build-list-arrow-down
   Graded: .build-correct / .build-wrong + .build-list-correct-badge */

.build-list-question .build-list-instruction {
  font-size: 0.9rem;
  color: var(--text-secondary, #666);
  margin-bottom: 0.5rem;
}

.build-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.build-list-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 14px 16px;                    /* PP exact */
  margin-bottom: 0.35rem;
  border: 1px solid var(--border, rgba(136, 163, 182, 0.85));
  border-radius: 5px;                    /* PP exact */
  background: var(--surface, #fff);
  cursor: grab;
  transition: box-shadow 0.15s, background 0.15s, border-color 0.15s;
  min-height: 44px;
  user-select: none;
  touch-action: none;
  font-size: 16.5px;                     /* PP exact */
  font-weight: 500;                      /* PP exact */
}

.build-list-item:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.build-list-item:focus {
  outline: 2px solid var(--accent, #0070f3);
  outline-offset: 1px;
}

.build-list-item.dragging {
  opacity: 0.4;
  background: var(--surface-alt, #f0f0f0);
}

.build-list-item.drop-above {
  border-top: 3px solid var(--accent, #0070f3);
}

.build-list-item.drop-below {
  border-bottom: 3px solid var(--accent, #0070f3);
}

.build-list-ghost {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  border-radius: 5px;                    /* PP exact */
  background: var(--surface, #1e1e2e);
}

/* Circular position badge — PP uses 24px badges */
.build-list-position-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;                           /* PP exact */
  height: 24px;                          /* PP exact */
  min-width: 24px;
  border-radius: 50%;
  background: var(--pp-neutral, #587181);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  flex-shrink: 0;
}

.build-list-text {
  flex: 1;
}

/* Arrow buttons — PP uses blue action color #0064ff */
.build-list-arrow-up,
.build-list-arrow-down {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  border: none;
  border-radius: 5px;                    /* PP exact */
  background: transparent;
  color: #0064ff;                        /* PP exact blue action */
  font-size: 14px;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: background-color 0.15s, opacity 0.15s;
}

.build-list-arrow-up:hover,
.build-list-arrow-down:hover {
  background: rgba(0, 100, 255, 0.1);
}

.build-list-arrow-up:disabled,
.build-list-arrow-down:disabled {
  opacity: 0.25;
  cursor: default;
  pointer-events: none;
}

/* Graded states — PP exact teal/red, border-only */
.build-list-item.build-correct {
  border-color: var(--good, #049875);       /* PP exact teal */
  border-left: 3px solid var(--good, #049875);
}

.build-list-item.build-wrong {
  border-color: var(--bad, #e52525);        /* PP exact red */
  border-left: 3px solid var(--bad, #e52525);
}

/* Correct position badge on wrong items */
.build-list-correct-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;                           /* PP exact */
  height: 24px;                          /* PP exact */
  min-width: 24px;
  border-radius: 50%;
  background: var(--good, #049875);      /* PP exact teal */
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  flex-shrink: 0;
  margin-left: auto;
}

/* Correct item position badge inherits PP teal */
.build-list-item.build-correct .build-list-position-badge {
  background: var(--good, #049875);      /* PP exact teal */
}

/* Wrong item position badge uses PP red */
.build-list-item.build-wrong .build-list-position-badge {
  background: var(--bad, #e52525);       /* PP exact red */
}

/* === Multiple Correct Response (MCR) — Checkbox + Letter Badge UI === */
/* PocketPrep visual parity: custom checkboxes, 4-state graded feedback.
   DOM: .type-mcr > .mcr-row > (button.mcr-option + button.mcr-eliminate-btn)
   Each .mcr-option: .mcr-checkbox + .mcr-letter + .mcr-content > (.mcr-label + .mcr-explanation) */

.type-mcr {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.mcr-row {
  display: flex;
  align-items: stretch;
}

.mcr-option {
  display: flex;
  align-items: center;
  flex: 1;
  gap: 0.625rem;
  padding: 0.8125rem 2.875rem 0.9375rem 0.9375rem; /* PP: 13px 46px 15px 15px */
  border: 1px solid var(--border, rgba(255,255,255,0.12));
  border-radius: 5px;
  background: var(--panel, #1e2a3a);
  cursor: pointer;
  font-family: var(--pp-font, 'Mulish', sans-serif);
  font-size: 1rem;
  font-weight: 500;
  text-align: left;
  color: var(--ink, #e8ecf0);
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
  position: relative;
}

.mcr-option:hover:not(:disabled) {
  background: var(--panel-soft, #243042);
  border-color: var(--accent, #4a90e2);
}

.mcr-option:focus-visible {
  outline: 2px solid var(--accent, #4a90e2);
  outline-offset: -2px;
}

/* ── Checkbox indicator ── */
.mcr-checkbox {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.125rem;   /* 18px */
  height: 1.125rem;
  min-width: 1.125rem;
  border: 2px solid var(--pp-neutral, rgba(88,113,131,0.5));
  border-radius: 3px;
  background: transparent;
  transition: background 0.15s, border-color 0.15s;
  flex-shrink: 0;
}

.mcr-checkbox--checked {
  background: var(--accent, #0064ff);
  border-color: var(--accent, #0064ff);
}

/* Checkmark via pseudo-element */
.mcr-checkbox--checked::after {
  content: "\2713";
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
}

/* 4-state graded checkbox */
.mcr-checkbox--correct-selected {
  background: var(--good, #049875);
  border-color: var(--good, #049875);
}
.mcr-checkbox--correct-selected::after {
  content: "\2713";
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
}

.mcr-checkbox--correct-missed {
  background: transparent;
  border-color: var(--good, #049875);
}
.mcr-checkbox--correct-missed::after {
  content: "\2713";
  color: var(--good, #049875);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
}

.mcr-checkbox--wrong-selected {
  background: rgba(88,113,131,0.5);
  border-color: rgba(88,113,131,0.5);
}
.mcr-checkbox--wrong-selected::after {
  content: "\00D7";
  color: #fff;
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1;
}

.mcr-checkbox--neutral {
  background: transparent;
  border-color: rgba(88,113,131,0.35);
}

/* ── Letter badge ── */
.mcr-letter {
  font-weight: 500;
  color: var(--pp-neutral, #708e9d);
  min-width: 1rem;
  flex-shrink: 0;
}

/* ── Content ── */
.mcr-content {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  flex: 1;
  min-width: 0;
}

.mcr-label {
  line-height: 1.4;
  word-wrap: break-word;
}

/* ── Selection state ── */
.mcr-option--selected {
  border-color: var(--accent, #4a90e2);
  background: rgba(74,144,226,0.12);
}

/* ── Graded feedback classes ── */
/* PP palette: teal (#049875) for correct, muted gray (#587181/#708e9d) for wrong.
   PP never uses red on individual option cards. */
.mcr-option--answer {
  border-color: var(--good, #049875);
}
.mcr-option--answer.mcr-option--selected {
  border-color: var(--good, #049875);
  border-width: 2px;
}

.mcr-option--distractor {
  border-color: var(--pp-neutral, rgba(88,113,131,0.35));
  opacity: 0.7;
}
.mcr-option--distractor.mcr-option--selected {
  border-color: var(--pp-neutral, #708e9d);
  background: rgba(88,113,131,0.1);
  opacity: 0.8;
}

.mcr-option--strike {
  background: rgba(88,113,131,0.1);
}
.mcr-option--strike .mcr-label {
  text-decoration: line-through;
  opacity: 0.65;
  color: var(--muted, #8899aa);
}

/* ── Pre-submit strikethrough ── */
.mcr-option--struck {
  opacity: 0.45;
}
.mcr-option--struck .mcr-label {
  text-decoration: line-through;
}

/* ── Report button (action bar) ── */
.nav-report-btn {
  width: 48px;
  height: 48px;
  border: none;
  background: transparent;
  color: var(--shell-text);
  cursor: pointer;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  transition: color 120ms ease, background-color 120ms ease;
  margin: 0 4px;
}
@media (hover: hover) and (pointer: fine) {
  .nav-report-btn:hover {
    background: var(--shell-surface-10);
    color: var(--warm-accent);
  }
}
.nav-report-btn svg {
  display: block;
}

/* ── Report modal ── */
.report-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.55);
  padding: 16px;
}
.report-overlay[hidden] {
  display: none;
}
.report-dialog {
  background: var(--panel-bg, #fff);
  color: var(--panel-text, #1a1a2e);
  border-radius: 12px;
  padding: 24px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}
[data-theme="dark"] .report-dialog {
  background: var(--panel-bg, #1e1e2e);
  color: var(--panel-text, #e0e0e0);
}
.report-dialog h2 {
  margin: 0 0 16px;
  font-size: 1.15rem;
  font-weight: 600;
}
.report-dialog label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin: 12px 0 4px;
}
.report-dialog select,
.report-dialog textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--shell-surface-20, #ccc);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--input-bg, #fff);
  color: inherit;
  box-sizing: border-box;
}
[data-theme="dark"] .report-dialog select,
[data-theme="dark"] .report-dialog textarea {
  background: var(--input-bg, #2a2a3e);
  border-color: var(--shell-surface-20, #444);
}
.report-dialog textarea {
  resize: vertical;
  min-height: 80px;
}
.report-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 20px;
}
.report-btn {
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  min-height: 44px;
  min-width: 44px;
}
.report-btn-cancel {
  background: transparent;
  color: #333;
  border: 1px solid #999;
}
.report-btn-submit {
  background: var(--brand-accent, #4a69bd);
  color: #fff;
}
.report-btn-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.report-status {
  margin: 12px 0 0;
  font-size: 0.85rem;
  text-align: center;
}
.report-status.success {
  color: var(--correct-green, #27ae60);
}
.report-status.error {
  color: var(--incorrect-red, #e74c3c);
}

/* ── Eliminate button ── */
.mcr-eliminate-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  min-width: 2rem;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--pp-neutral, #708e9d);
  font-size: 0.875rem;
  padding: 0;
  flex-shrink: 0;
}
.mcr-eliminate-btn::after {
  content: "\2298"; /* strikethrough circle */
  font-size: 1.125rem;
}
.mcr-eliminate-btn:hover {
  color: var(--bad, #e52525);
}
.mcr-eliminate-btn[aria-pressed="true"] {
  color: var(--bad, #e52525);
}

/* ── Rationale / explanation ── */
.mcr-explanation {
  display: block;
  font-size: 0.875rem;
  color: var(--muted, #8899aa);
  line-height: 1.5;
  margin-top: 0.25rem;
}
.mcr-explanation[hidden] {
  display: none;
}

.mcr-explanation-link {
  display: inline-block;
  background: none;
  border: none;
  color: var(--accent, #0064ff);
  cursor: pointer;
  font-size: 0.8125rem;
  padding: 0.125rem 0;
  text-decoration: underline;
}
.mcr-explanation-link:hover {
  color: var(--good, #049875);
}

/* ── Disabled state ── */
.mcr-option:disabled {
  cursor: default;
  opacity: 1; /* Keep full opacity for graded readability */
}

/* ── MCR responsive (mobile) ── */
@media (max-width: 600px) {
  .mcr-option {
    padding: 0.75rem 0.5rem 0.75rem 0.75rem;
    gap: 0.5rem;
    font-size: 0.9375rem;
    min-height: 44px; /* touch target */
  }

  .mcr-eliminate-btn {
    min-width: 2.75rem; /* 44px touch target */
    min-height: 44px;
  }
}

/* === Multi-Part Multiple Choice (MPMC) — Accordion + Radio UI === */
/* PocketPrep visual parity: exact colors, sizes, border-radius from their production CSS.
   DOM: .mpmc-question > .mpmc-part > (button.mpmc-part-header + .mpmc-part-body)
   Each .mpmc-part-body contains .mpmc-radio-option > input[radio] + span.mpmc-radio-label */

.mpmc-question {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;  /* PP uses ~10px between parts */
}

/* ── Part card — PP uses 1px border, 5px radius ── */
.mpmc-part {
  border: 1px solid var(--border, rgba(136,163,182,0.85));
  border-radius: 5px;
  overflow: hidden;
  background: var(--panel, #1e2a3a);
  transition: border-color 0.2s, box-shadow 0.2s;  /* PP exact: box-shadow 0.2s */
}

.mpmc-part-correct {
  border-color: var(--good, #049875);
}

.mpmc-part-wrong {
  border-color: var(--bad, #e52525);
}

/* ── Accordion header button — PP: 500 weight, 16px, generous padding ── */
.mpmc-part-header {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 0.875rem 1rem;  /* PP ~14px 16px */
  border: 0;
  background: transparent;
  color: var(--ink, #e8ecf0);
  font: inherit;
  font-size: 1rem;          /* PP: 16px */
  font-weight: 500;         /* PP: 500 */
  cursor: pointer;
  text-align: left;
  gap: 0.5rem;
  min-height: 48px;         /* touch target */
  transition: background 0.15s;
}

.mpmc-part-header:hover {
  background: var(--panel-soft, #243042);
}

.mpmc-part-header:focus-visible {
  outline: 2px solid var(--accent, #4a90e2);
  outline-offset: -2px;
}

.mpmc-part-label {
  flex: 1;
}

/* Status icon — PP uses SVG, we approximate with text; PP teal #049875 */
.mpmc-status-icon {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1;
}

.mpmc-part-correct .mpmc-status-icon {
  color: var(--good, #049875);
}

.mpmc-part-wrong .mpmc-status-icon {
  color: var(--bad, #e52525);
}

/* Chevron toggle — PP uses a thin SVG chevron */
.mpmc-part-toggle-icon {
  font-size: 0.65rem;
  transition: transform 0.2s;
  color: var(--pp-neutral, #708e9d);
}

.mpmc-part-header[aria-expanded="true"] .mpmc-part-toggle-icon {
  transform: rotate(180deg);
}

/* ── Accordion body (radio options) ── */
.mpmc-part-body {
  padding: 0.25rem 0.75rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;  /* PP: tight spacing between radio rows */
}

/* hidden attribute must win over display:flex */
.mpmc-part-body[hidden] {
  display: none;
}

/* ── Individual radio option row — PP: 16.5px font, flex, generous padding ── */
.mpmc-radio-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;            /* PP: ~12px gap between radio and text */
  padding: 0.625rem 0.5rem; /* PP: ~10px 8px */
  border-radius: 5px;       /* PP: 5px */
  cursor: pointer;
  min-height: 44px;         /* touch target */
  border-left: 3px solid transparent; /* reserve space for feedback border */
  transition: background-color 0.2s;    /* PP exact transition */
}

.mpmc-radio-option:hover {
  background: var(--accent-soft, #33495f);
}

/* Radio input — PP exact: 18px diameter, 1px border, 12px inner dot */
.mpmc-radio-option input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;              /* PP exact: 18px */
  height: 18px;             /* PP exact: 18px */
  min-width: 18px;
  border: 1px solid var(--pp-neutral, #708e9d); /* PP exact: 1px */
  border-radius: 50%;
  background: var(--surface, #fff);             /* PP: white bg */
  cursor: pointer;
  position: relative;
  transition: border-color 0.15s;
  box-sizing: border-box;   /* PP exact */
  flex-shrink: 0;
}

.mpmc-radio-option input[type="radio"]::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 12px;              /* PP exact: 12px inner dot */
  height: 12px;
  border-radius: 50%;
  background: var(--pp-blue-action, #0064ff);   /* PP pre-submit: blue */
  transform: translate(-50%, -50%);
  display: none;            /* PP: hidden until selected */
}

.mpmc-radio-option input[type="radio"]:checked::before {
  display: block;           /* PP: show on selected */
}

.mpmc-radio-option input[type="radio"]:checked {
  border-color: var(--pp-blue-action, #0064ff); /* PP pre-submit: blue border */
  background: transparent;                      /* PP: transparent when selected */
}

.mpmc-radio-option input[type="radio"]:disabled {
  cursor: default;
  opacity: 0.7;
}

/* PP: option text 16.5px, weight 400 */
.mpmc-radio-label {
  font-size: 1.03125rem;    /* 16.5px */
  font-weight: 400;
  color: var(--ink, #e8ecf0);
  line-height: 1.4;
}

/* ── Graded feedback — PP exact colors ── */
.mpmc-radio-correct {
  border-left-color: var(--good, #049875);
}
.mpmc-radio-correct input[type="radio"] {
  border-color: var(--good, #049875);
}
.mpmc-radio-correct input[type="radio"]:checked {
  border-color: var(--good, #049875);
}
.mpmc-radio-correct input[type="radio"]:checked::before {
  background: var(--good, #049875);  /* graded: teal dot */
}

.mpmc-radio-wrong {
  border-left-color: var(--bad, #e52525);
}
.mpmc-radio-wrong input[type="radio"] {
  border-color: var(--bad, #e52525);
}
.mpmc-radio-wrong input[type="radio"]:checked {
  border-color: var(--bad, #e52525);
}
.mpmc-radio-wrong input[type="radio"]:checked::before {
  background: var(--bad, #e52525);   /* graded: red dot */
}

/* ── Mobile — PP: same layout just tighter padding ── */
@media (max-width: 480px) {
  .mpmc-part-header {
    padding: 0.7rem 0.75rem;
    font-size: 0.9rem;
    min-height: 44px;
  }
  .mpmc-radio-option {
    padding: 0.5rem 0.375rem;
  }
  .mpmc-radio-label {
    font-size: 0.9375rem;    /* 15px */
  }
}

/* === Matrix responsive (mobile) — PP card transformation === */
/* PP uses uikit-question-mobile-matrix-choices-container which transforms
   the table into stacked cards. Each row becomes a card with the row label
   at top and radio options with column labels below. */
@media (max-width: 480px) {
  .matrix-question .matrix-table-wrapper {
    border-radius: 0;
    border: none;
    overflow: visible;
  }

  .matrix-table {
    display: block;
  }

  .matrix-table thead {
    display: none;          /* column headers hidden — shown per cell via data-label */
  }

  .matrix-table tbody {
    display: flex;
    flex-direction: column;
    gap: 12px;              /* PP: gap between cards */
  }

  .matrix-table tbody tr.matrix-row {
    display: block;
    border: 1px solid var(--border, rgba(136,163,182,0.85));
    border-radius: 5px;     /* PP exact */
    padding: 12px 14px;     /* PP: 12px 10px 0px 14px */
    background: var(--option-bg, #1e2d3d);
  }

  .matrix-table tbody tr.matrix-row:nth-child(even) {
    background: var(--option-bg, #1e2d3d); /* uniform bg in card mode */
  }

  .matrix-table .matrix-row-label {
    display: block;
    min-width: unset;
    max-width: unset;
    font-size: 16.5px;      /* PP exact */
    font-weight: 500;
    line-height: 23px;
    padding: 0 0 10px 0;
    border-bottom: 1px solid var(--border, rgba(136,163,182,0.25));
    margin-bottom: 8px;
  }

  .matrix-table .matrix-cell {
    display: flex;
    align-items: center;
    gap: 10px;              /* PP: gap 10px */
    padding: 8px 0;
  }

  .matrix-table .matrix-cell::before {
    content: attr(data-label);
    font-size: 14px;
    font-weight: 500;
    color: var(--muted, #8899aa);
    min-width: 80px;
    flex-shrink: 0;
  }

  .matrix-table input[type="radio"] {
    width: 22px;            /* slightly larger on mobile for touch (44px tap zone via cell) */
    height: 22px;
  }

  .matrix-table input[type="radio"]::before {
    width: 14px;            /* proportional inner dot for 22px button */
    height: 14px;
  }

  /* Graded card states — border-only, no bg fill */
  .matrix-table tbody tr.matrix-correct {
    border-left: 3px solid var(--good, #049875);
  }

  .matrix-table tbody tr.matrix-wrong {
    border-left: 3px solid var(--bad, #e52525);
  }
}

/* prefers-reduced-motion suppression — disables all animations and view transitions */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }

}

/* --- Custom scrollbar — thin, themed, professional --- */

/* Firefox */
.panel,
.question-nav-list,
.session-main-column {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

/* WebKit (Chrome, Edge, Safari) */
.panel::-webkit-scrollbar,
.question-nav-list::-webkit-scrollbar,
.session-main-column::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.panel::-webkit-scrollbar-track,
.question-nav-list::-webkit-scrollbar-track,
.session-main-column::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
}

.panel::-webkit-scrollbar-thumb,
.question-nav-list::-webkit-scrollbar-thumb,
.session-main-column::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 3px;
}

.panel::-webkit-scrollbar-thumb:hover,
.question-nav-list::-webkit-scrollbar-thumb:hover,
.session-main-column::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}

/* ── Flashcard Renderer ──────────────────────────────────────────────── */

.type-flashcard {
  display: flex;
  justify-content: center;
  padding: 1rem 0;
}

.flashcard {
  width: 100%;
  max-width: 480px;
  min-height: 200px;
  border-radius: 16px;
  background: var(--card-bg, #ffffff);
  border: 2px solid var(--border-color, #e0e0e0);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
  overflow: hidden;
  cursor: pointer;
  outline: none;
}

.flashcard:focus-visible {
  border-color: var(--accent, #4a90d9);
  box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.3);
}

.flashcard__front {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  padding: 2rem;
}

.flashcard__reveal-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 2rem;
  border: 2px dashed var(--accent, #4a90d9);
  border-radius: 12px;
  background: transparent;
  color: var(--accent, #4a90d9);
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, border-style 0.15s ease;
  min-height: 44px;
  min-width: 44px;
}

.flashcard__reveal-btn:hover {
  background: rgba(74, 144, 217, 0.08);
  border-style: solid;
}

.flashcard__reveal-btn:active {
  background: rgba(74, 144, 217, 0.15);
}

.flashcard__back {
  padding: 1.5rem 2rem 2rem;
}

.flashcard__answer-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--correct-green, #27ae60);
  margin-bottom: 0.75rem;
}

.flashcard__answer {
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--text-primary, #1a1a1a);
  white-space: pre-wrap;
}

.flashcard--revealed {
  border-color: var(--correct-green, #27ae60);
  box-shadow: 0 4px 16px rgba(39, 174, 96, 0.12);
}

/* Dark theme adjustments */
[data-theme="dark"] .flashcard {
  background: var(--card-bg, #1e1e1e);
  border-color: var(--border-color, #333);
}

[data-theme="dark"] .flashcard--revealed {
  border-color: var(--correct-green, #2ecc71);
}

[data-theme="dark"] .flashcard__answer {
  color: var(--text-primary, #e0e0e0);
}

/* Display mode selector: 3-column layout */
.display-mode-toggle {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 0.5rem;
}

.display-mode-note--flashcard {
  color: var(--accent, #4a90d9);
  font-size: 0.85rem;
  margin-top: 0.5rem;
}

/* === Flag & Report buttons === */
.meta-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-left: auto;
}

.meta-flag-btn,
.meta-report-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  color: #8c919e;
  cursor: pointer;
  padding: 6px;
  min-width: 36px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, border-color 0.15s;
}

.meta-flag-btn:hover,
.meta-report-btn:hover {
  color: #e1e2eb;
  border-color: rgba(255,255,255,0.24);
}

.meta-flag-btn.flagged {
  color: #f0a030;
  border-color: #f0a030;
}

.meta-flag-btn:focus-visible,
.meta-report-btn:focus-visible {
  outline: 2px solid #5a9aff;
  outline-offset: 2px;
}

/* === Report inline form === */
.report-success {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(4,152,117,0.15);
  color: #049875;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 12px;
}

.report-inline-form {
  background: #243042;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
}

.report-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #8c919e;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
  margin-top: 12px;
}

.report-label:first-of-type {
  margin-top: 0;
}

.report-select,
.report-textarea {
  width: 100%;
  background: #1a1a2e;
  color: #e1e2eb;
  border: 1px solid #424752;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: 'Inter', sans-serif;
}

.report-select:focus,
.report-textarea:focus {
  outline: none;
  border-color: #5a9aff;
  box-shadow: 0 0 0 2px rgba(90,154,255,0.2);
}

.report-textarea {
  resize: vertical;
  min-height: 72px;
}

.report-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 14px;
}

.report-submit-btn {
  background: #5a9aff;
  color: #003169;
  border: none;
  border-radius: 8px;
  padding: 8px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  min-height: 40px;
}

.report-submit-btn:hover {
  background: #7ab3ff;
}

.report-cancel-btn {
  background: transparent;
  color: #8c919e;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 14px;
  cursor: pointer;
  min-height: 40px;
}

.report-cancel-btn:hover {
  color: #e1e2eb;
  border-color: rgba(255,255,255,0.24);
}

/* === Account Manage page === */
.manage-page {
  max-width: 560px;
  margin: 40px auto;
  padding: 0 20px;
}

.manage-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.manage-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #e1e2eb;
  margin: 0;
}

.manage-alert {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 20px;
}

.manage-alert--success {
  background: rgba(4,152,117,0.15);
  color: #049875;
}

.manage-alert--error {
  background: rgba(229,37,37,0.15);
  color: #e54545;
}

.manage-section {
  background: #1e2a3a;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 20px;
}

.manage-section-title {
  font-size: 1rem;
  font-weight: 600;
  color: #e1e2eb;
  margin: 0 0 16px 0;
}

.manage-field {
  margin-bottom: 16px;
}

.manage-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #8c919e;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.manage-value {
  color: #e1e2eb;
  font-size: 14px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.04);
  border-radius: 8px;
}

.manage-input {
  width: 100%;
  background: #243042;
  color: #e1e2eb;
  border: 1px solid #424752;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  box-sizing: border-box;
}

.manage-input:focus {
  outline: none;
  border-color: #5a9aff;
  box-shadow: 0 0 0 2px rgba(90,154,255,0.2);
}

.manage-save-btn {
  background: #5a9aff;
  color: #003169;
  border: none;
  border-radius: 8px;
  padding: 10px 24px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  min-height: 40px;
}

.manage-save-btn:hover {
  background: #7ab3ff;
}

.manage-info {
  color: #8c919e;
  font-size: 14px;
  margin: 0;
}
