/*
 * practice-bundle.css
 * Auto-generated practice CSS bundle
 * Build version: 1775858583367-2c76b307
 * Generated on: 2026-04-10T22:03:03.401Z
 *
 * Included files (in order):
 *   - sidebar-toggle.css
 *   - practice-keypoints.css
 *   - answer-diff.css
 *   - practice-hints.css
 *   - practice-progress.css
 *   - practice-difficulty-filter.css
 *   - practice-bookmarks.css
 *   - practice-dashboard.css
 *   - practice-code-editor.css
 *   - practice-shortcuts.css
 *   - auto-save-answer.css
 *   - practice-sessions.css
 */

/* === sidebar-toggle.css === */
/* ============================================================================
 * sidebar-toggle.css
 * Collapse/expand toggle for sidebar on practice and study pages.
 * Works with both .app-shell (practice) and .layout (study) grid parents.
 * ============================================================================ */

/* --- Toggle Button (expanded state) --- */
.sidebar-toggle-btn {
  position: absolute;
  top: 50%;
  right: -18px;
  transform: translateY(-50%);
  z-index: 100;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border-soft, rgba(148, 163, 184, 0.2));
  background: var(--surface-muted, rgba(148, 163, 184, 0.08));
  color: var(--text-muted, #94a3b8);
  font-size: 14px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
  padding: 0;
  font-family: inherit;
}

.sidebar-toggle-btn:hover {
  background: var(--primary-soft, rgba(255, 138, 91, 0.15));
  color: var(--text-main, #f1f5f9);
}

.sidebar-toggle-btn:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

/* --- Transitions (only after initial load to avoid flash) --- */
.sidebar-toggle-ready .app-shell {
  transition: grid-template-columns 0.3s ease;
}

.sidebar-toggle-ready .layout {
  transition: grid-template-columns 0.3s ease;
}

.sidebar-toggle-ready .sidebar {
  transition: width 0.3s ease, min-width 0.3s ease, opacity 0.3s ease,
              padding 0.3s ease, border-color 0.3s ease;
}

/* --- Collapsed State (practice pages — .app-shell parent) --- */
.sidebar-collapsed .app-shell {
  grid-template-columns: 0px minmax(0, 1fr);
}

.sidebar-collapsed .app-shell > .sidebar {
  width: 0;
  min-width: 0;
  overflow: hidden;
  padding: 0;
  border-color: transparent;
  opacity: 0;
  pointer-events: none;
}

/* --- Collapsed State (study pages — .layout parent) --- */
.sidebar-collapsed .layout {
  grid-template-columns: 0px 1fr;
}

.sidebar-collapsed .layout > .sidebar {
  width: 0;
  min-width: 0;
  overflow: hidden;
  padding: 0;
  border-color: transparent;
  opacity: 0;
  pointer-events: none;
}

/* --- Toggle button when collapsed: reposition to viewport edge --- */
.sidebar-collapsed .sidebar-toggle-btn {
  position: fixed;
  top: 50%;
  left: 8px;
  right: auto;
  transform: translateY(-50%);
  z-index: 100;
  pointer-events: auto;
  opacity: 1;
}

/* --- Hide toggle on mobile (sidebar already collapsed via single-column layout) --- */
@media (max-width: 960px) {
  .sidebar-toggle-btn {
    display: none !important;
  }
}

/* === practice-keypoints.css === */
/* ============================================================================
 * Practice Key Points Checklist
 *
 * Shown after an answer is revealed in practice mode.
 * Uses design tokens from theme.css — no hardcoded colors.
 * ============================================================================ */

.keypoints-panel {
  margin-top: 1.25rem;
  padding: 1rem 1.25rem;
  border: 1px solid var(--border-soft, rgba(148, 163, 184, 0.2));
  border-radius: var(--radius-md, 0.625rem);
  background: var(--card, var(--bg-secondary, #1e293b));
}

.keypoints-panel.is-hidden {
  display: none;
}

.keypoints-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.keypoints-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main, #f8fafc);
  letter-spacing: 0.01em;
}

.keypoints-summary {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted, #94a3b8);
  white-space: nowrap;
}

.keypoints-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.keypoints-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.35rem 0.5rem;
  min-height: var(--touch-min, 2.75rem);
  border-radius: var(--radius-sm, 0.375rem);
  transition: background 0.15s ease;
}

.keypoints-item:hover {
  background: var(--bg-hover, rgba(148, 163, 184, 0.08));
}

.keypoints-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 1.1rem;
  height: 1.1rem;
  min-width: 1.1rem;
  border: 2px solid var(--border-soft, rgba(148, 163, 184, 0.3));
  border-radius: var(--radius-sm, 0.25rem);
  background: transparent;
  cursor: pointer;
  position: relative;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.keypoints-checkbox:focus-visible {
  outline: 2px solid var(--focus-ring, rgba(59, 130, 246, 0.6));
  outline-offset: 2px;
}

.keypoints-checkbox:checked {
  background: var(--status-success, #22c55e);
  border-color: var(--status-success, #22c55e);
}

.keypoints-checkbox:checked::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 0px;
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.keypoints-label {
  font-size: 0.85rem;
  color: var(--text-main, #f8fafc);
  cursor: pointer;
  user-select: none;
  line-height: 1.4;
}

/* Covered / uncovered visual feedback */
.keypoints-item[data-covered="true"] .keypoints-label {
  color: var(--status-success-text, var(--status-success, #22c55e));
}

.keypoints-item[data-covered="false"] .keypoints-label {
  color: var(--status-error, #ef4444);
}

/* Summary bar coloring */
.keypoints-summary[data-coverage="full"] {
  color: var(--status-success-text, var(--status-success, #22c55e));
}

.keypoints-summary[data-coverage="partial"] {
  color: var(--status-warning-text, var(--status-warning, #f59e0b));
}

.keypoints-summary[data-coverage="none"] {
  color: var(--text-muted, #94a3b8);
}

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  .keypoints-panel {
    padding: 0.85rem 1rem;
  }

  .keypoints-item {
    gap: 0.5rem;
    padding: 0.35rem 0.4rem;
  }
}

@media (max-width: 640px) {
  .keypoints-panel {
    padding: 0.75rem 0.85rem;
  }

  .keypoints-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.3rem;
  }

  .keypoints-label {
    font-size: 0.82rem;
  }
}

@media (max-width: 480px) {
  .keypoints-panel {
    padding: 0.65rem 0.75rem;
    margin-top: 1rem;
  }

  .keypoints-title {
    font-size: 0.85rem;
  }

  .keypoints-label {
    font-size: 0.8rem;
  }

  .keypoints-item {
    gap: 0.4rem;
    padding: 0.3rem 0.35rem;
  }
}

/* ── Reduced motion ──────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .keypoints-item,
  .keypoints-checkbox {
    transition-duration: 0.01ms !important;
  }
}

/* === answer-diff.css === */
/* ============================================================================
 * Answer Diff / Comparison View
 *
 * Visual side-by-side comparison of user's answer vs expected key terms.
 * Shows after "Check Answer" or "Reveal Answer" on practice pages.
 * Uses design tokens from theme.css — no hardcoded colors.
 * ============================================================================ */

.answer-diff-panel {
  margin-top: 1.25rem;
  padding: 1rem 1.25rem;
  border: 1px solid var(--border-soft, rgba(148, 163, 184, 0.2));
  border-radius: var(--radius-md, 0.625rem);
  background: var(--card, var(--bg-secondary, #1e293b));
}

.answer-diff-panel.is-hidden {
  display: none;
}

/* -- Summary bar ----------------------------------------------------------- */

.answer-diff-summary {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.answer-diff-summary-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main, #f8fafc);
  white-space: nowrap;
}

.answer-diff-progress-track {
  flex: 1;
  min-width: 80px;
  max-width: 240px;
  height: 8px;
  border-radius: 4px;
  background: var(--bg-hover, rgba(148, 163, 184, 0.15));
  overflow: hidden;
}

.answer-diff-progress-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--primary, #ff8a5b);
  transition: width 0.4s ease;
}

.answer-diff-summary-pct {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted, #94a3b8);
  white-space: nowrap;
}

/* -- Two-column layout ----------------------------------------------------- */

.answer-diff-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.answer-diff-col {
  min-width: 0; /* allow text wrapping in grid child */
}

.answer-diff-col-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted, #94a3b8);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.5rem;
}

.answer-diff-body {
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--text-main, #f8fafc);
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm, 0.375rem);
  background: var(--bg-secondary, rgba(148, 163, 184, 0.06));
  border: 1px solid var(--border-soft, rgba(148, 163, 184, 0.12));
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* -- Highlighted terms ----------------------------------------------------- */

.answer-diff-match {
  background: var(--status-success-soft, rgba(34, 197, 94, 0.15));
  color: var(--status-success-text, var(--status-success, #22c55e));
  border-radius: 3px;
  padding: 0.05em 0.25em;
}

.answer-diff-miss {
  background: var(--status-error-soft, rgba(239, 68, 68, 0.15));
  color: var(--status-error, #ef4444);
  text-decoration: line-through;
  border-radius: 3px;
  padding: 0.05em 0.25em;
}

/* -- Key terms list (right column) ----------------------------------------- */

.answer-diff-terms {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.answer-diff-term {
  display: inline-block;
  font-size: 0.82rem;
  padding: 0.2em 0.5em;
  border-radius: var(--radius-sm, 0.375rem);
  font-weight: 500;
  line-height: 1.4;
}

.answer-diff-term.matched {
  background: var(--status-success-soft, rgba(34, 197, 94, 0.15));
  color: var(--status-success-text, var(--status-success, #22c55e));
}

.answer-diff-term.missed {
  background: var(--status-error-soft, rgba(239, 68, 68, 0.15));
  color: var(--status-error, #ef4444);
  text-decoration: line-through;
}

/* -- Responsive ------------------------------------------------------------ */

@media (max-width: 768px) {
  .answer-diff-columns {
    grid-template-columns: 1fr;
  }

  .answer-diff-panel {
    padding: 0.85rem 1rem;
  }
}

@media (max-width: 640px) {
  .answer-diff-panel {
    padding: 0.75rem 0.85rem;
  }

  .answer-diff-summary {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
  }

  .answer-diff-progress-track {
    max-width: 100%;
    width: 100%;
  }

  .answer-diff-body {
    font-size: 0.82rem;
    padding: 0.5rem 0.6rem;
  }
}

@media (max-width: 480px) {
  .answer-diff-panel {
    padding: 0.65rem 0.75rem;
    margin-top: 1rem;
  }

  .answer-diff-summary-label {
    font-size: 0.82rem;
  }

  .answer-diff-term {
    font-size: 0.78rem;
    padding: 0.15em 0.4em;
  }
}

/* -- Reduced motion -------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .answer-diff-progress-fill {
    transition-duration: 0.01ms !important;
  }
}

/* === practice-hints.css === */
/* ==========================================================================
 * Practice Hints — Progressive hint display for practice questions.
 * Uses design tokens from theme.css.
 * ========================================================================== */

/* Hint button — sits alongside existing .btn elements in .card-actions */
.btn.hint {
  min-height: var(--touch-min, 2.75rem);
  background: var(--status-warning-soft, rgba(245, 158, 11, 0.15));
  border-color: var(--status-warning, #f59e0b);
  color: var(--status-warning-text, #fbbf24);
}

.btn.hint:hover {
  background: rgba(245, 158, 11, 0.25);
  border-color: var(--status-warning-text, #fbbf24);
}

.btn.hint:focus-visible {
  outline: 2px solid var(--focus-ring, rgba(59, 130, 246, 0.6));
  outline-offset: 2px;
}

.btn.hint:disabled {
  opacity: 0.45;
  cursor: default;
  transform: none;
}

/* Hint display container */
.hint-box {
  margin: 1rem 0;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md, 0.75rem);
  border: 1px solid var(--status-warning, #f59e0b);
  background: var(--status-warning-soft, rgba(245, 158, 11, 0.15));
  color: var(--text-main, #f2f5fb);
  font-size: 0.92rem;
  line-height: 1.55;
  animation: hintFadeIn 0.25s ease-out;
}

.hint-box[hidden] {
  display: none;
}

@keyframes hintFadeIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Hint header with lightbulb icon */
.hint-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  font-weight: 600;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--status-warning-text, #fbbf24);
}

.hint-header::before {
  content: "\1F4A1"; /* lightbulb emoji */
  font-size: 1.1rem;
}

/* Individual hint text lines */
.hint-text {
  padding: 0.35rem 0;
}

.hint-text + .hint-text {
  border-top: 1px solid rgba(245, 158, 11, 0.2);
  margin-top: 0.35rem;
  padding-top: 0.55rem;
}

/* Hint step indicator */
.hint-step {
  display: inline-block;
  min-width: 1.35rem;
  height: 1.35rem;
  line-height: 1.35rem;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 50%;
  background: var(--status-warning, #f59e0b);
  color: #000;
  margin-right: 0.5rem;
  flex-shrink: 0;
}

/* Hint usage badge (shown in sidebar question list) */
.hint-used-badge {
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--status-warning, #f59e0b);
  margin-left: 0.35rem;
  flex-shrink: 0;
  vertical-align: middle;
  opacity: 0.7;
}

/* Light/dark handled automatically via theme.css variables (--status-warning-*) */

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  .hint-box {
    padding: 0.85rem 1rem;
    font-size: 0.88rem;
  }

  .btn.hint {
    min-height: 44px;
  }
}

@media (max-width: 640px) {
  .hint-box {
    padding: 0.75rem 0.85rem;
    font-size: 0.85rem;
    margin: 0.75rem 0;
  }

  .hint-header {
    font-size: 0.78rem;
    gap: 0.4rem;
  }

  .hint-step {
    min-width: 1.2rem;
    height: 1.2rem;
    line-height: 1.2rem;
    font-size: 0.68rem;
  }
}

@media (max-width: 480px) {
  .hint-box {
    padding: 0.65rem 0.75rem;
    font-size: 0.82rem;
    border-radius: var(--radius-sm, 0.5rem);
  }

  .hint-header {
    font-size: 0.75rem;
  }

  .hint-text {
    padding: 0.25rem 0;
  }
}

/* ── Reduced motion ──────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .hint-box {
    animation-duration: 0.01ms !important;
  }
}

/* === practice-progress.css === */
/* ============================================================================
   Practice Progress & Self-Rating Styles
   ============================================================================ */

/* ── Progress bar (top of main panel) ─────────────────────────────────────── */

.pp-progress {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--panel, var(--bg-secondary));
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md, 0.75rem);
  margin-bottom: 0.5rem;
}

.pp-progress-track {
  display: flex;
  width: 100%;
  height: 8px;
  background: var(--bg-primary);
  border-radius: var(--radius-sm, 4px);
  overflow: hidden;
}

.pp-progress-segment {
  height: 100%;
  transition: width 0.4s ease;
  min-width: 0;
}

.pp-progress-segment.pp-confident {
  background: var(--status-success);
  border-radius: var(--radius-sm, 4px) 0 0 var(--radius-sm, 4px);
}

.pp-progress-segment.pp-partial {
  background: var(--status-warning);
}

.pp-progress-segment.pp-missed {
  background: var(--status-error);
}

.pp-progress-segment.pp-unattempted {
  background: var(--border-soft);
  border-radius: 0 var(--radius-sm, 4px) var(--radius-sm, 4px) 0;
}

.pp-progress-labels {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.pp-label {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.pp-label::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.pp-label-confident::before {
  background: var(--status-success);
}

.pp-label-partial::before {
  background: var(--status-warning);
}

.pp-label-missed::before {
  background: var(--status-error);
}

.pp-label-unattempted::before {
  background: var(--border-soft);
}

/* ── Self-rating buttons (shown after answer reveal) ──────────────────────── */

.pp-rating {
  display: none;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem;
  background: var(--panel, var(--bg-secondary));
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md, 0.85rem);
}

.pp-rating.pp-visible {
  display: flex;
}

.pp-rating-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.pp-rating-buttons {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.pp-rate-btn {
  flex: 1;
  min-width: 120px;
  min-height: var(--touch-min, 2.75rem);
  padding: 0.65rem 1rem;
  border-radius: var(--radius-md, 0.7rem);
  border: 2px solid transparent;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.15s ease;
  font-family: inherit;
  text-align: center;
}

.pp-rate-btn:hover {
  transform: translateY(-1px);
}

.pp-rate-btn:active {
  transform: translateY(0);
}

.pp-rate-btn:focus-visible {
  outline: 2px solid var(--focus-ring, rgba(59, 130, 246, 0.6));
  outline-offset: 2px;
}

/* Nailed It - green */
.pp-rate-btn.pp-btn-confident {
  background: var(--status-success-soft);
  color: var(--status-success-text, var(--status-success));
  border-color: var(--status-success);
}

.pp-rate-btn.pp-btn-confident:hover {
  background: var(--status-success);
  color: #fff;
}

/* Partially Knew - yellow */
.pp-rate-btn.pp-btn-partial {
  background: var(--status-warning-soft);
  color: var(--status-warning-text, var(--status-warning));
  border-color: var(--status-warning);
}

.pp-rate-btn.pp-btn-partial:hover {
  background: var(--status-warning);
  color: #fff;
}

/* Missed It - red */
.pp-rate-btn.pp-btn-missed {
  background: var(--status-error-soft);
  color: var(--status-error-text, var(--status-error));
  border-color: var(--status-error);
}

.pp-rate-btn.pp-btn-missed:hover {
  background: var(--status-error);
  color: #fff;
}

/* Selected state (after rating) */
.pp-rate-btn.pp-selected {
  opacity: 1;
  transform: scale(1.03);
}

.pp-rate-btn.pp-dimmed {
  opacity: 0.4;
  cursor: default;
  pointer-events: none;
}

/* ── Sidebar question indicators (dots) ───────────────────────────────────── */

.question-link {
  position: relative;
}

.pp-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-right: 0.4rem;
  vertical-align: middle;
}

.pp-dot-confident {
  background: var(--status-success);
}

.pp-dot-partial {
  background: var(--status-warning);
}

.pp-dot-missed {
  background: var(--status-error);
}

.pp-dot-unattempted {
  background: var(--border-soft);
}

/* ── Rating confirmation feedback ─────────────────────────────────────────── */

.pp-feedback {
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.4rem 0;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.pp-feedback.pp-show {
  opacity: 1;
}

.pp-feedback.pp-feedback-confident {
  color: var(--status-success-text, var(--status-success));
}

.pp-feedback.pp-feedback-partial {
  color: var(--status-warning-text, var(--status-warning));
}

.pp-feedback.pp-feedback-missed {
  color: var(--status-error-text, var(--status-error));
}

/* ── Responsive ───────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  .pp-rating-buttons {
    flex-direction: column;
  }

  .pp-rate-btn {
    min-width: unset;
  }

  .pp-progress-labels {
    gap: 0.35rem 0.75rem;
    font-size: 0.7rem;
  }
}

@media (max-width: 640px) {
  .pp-progress {
    padding: 0.6rem 0.85rem;
  }

  .pp-rate-btn {
    font-size: 0.85rem;
    padding: 0.6rem 0.85rem;
  }
}

@media (max-width: 480px) {
  .pp-progress {
    padding: 0.5rem 0.75rem;
  }

  .pp-rate-btn {
    padding: 0.55rem 0.75rem;
    font-size: 0.82rem;
  }
}

/* ── Reduced motion ───────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .pp-progress-segment,
  .pp-rate-btn,
  .pp-feedback {
    transition-duration: 0.01ms !important;
  }
}

/* ── Print ────────────────────────────────────────────────────────────────── */

@media print {
  .pp-rating,
  .pp-progress {
    display: none;
  }
}

/* === practice-difficulty-filter.css === */
/* ============================================================================
 * Practice Difficulty Filter Styles
 * Filter bar for practice pages to toggle question visibility by difficulty.
 * Reuses existing difficulty color variables from theme.css.
 * ============================================================================ */

/* ---------------------------------------------------------------------------
 * Filter Bar
 * --------------------------------------------------------------------------- */

.practice-difficulty-filter-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem;
  margin-bottom: 0.75rem;
  background: var(--surface-muted, rgba(148, 163, 184, 0.08));
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md, 0.75rem);
  flex-wrap: wrap;
}

.practice-difficulty-filter-bar .filter-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-right: 0.15rem;
  white-space: nowrap;
}

/* ---------------------------------------------------------------------------
 * Toggle Buttons
 * --------------------------------------------------------------------------- */

.practice-difficulty-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.45rem 0.75rem;
  min-height: var(--touch-min, 2.75rem);
  font-size: 0.78rem;
  font-weight: 500;
  border: 1.5px solid var(--border-soft);
  border-radius: 2rem;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  font-family: inherit;
  line-height: 1.4;
}

.practice-difficulty-btn:hover {
  border-color: var(--text-muted);
  color: var(--text-main);
}

.practice-difficulty-btn:focus-visible {
  outline: 2px solid var(--focus-ring, rgba(59, 130, 246, 0.6));
  outline-offset: 1px;
}

/* Active states use difficulty color variables */
.practice-difficulty-btn.active.beginner {
  background: var(--diff-beginner-soft);
  border-color: var(--diff-beginner);
  color: var(--diff-beginner);
}

.practice-difficulty-btn.active.intermediate {
  background: var(--diff-intermediate-soft);
  border-color: var(--diff-intermediate);
  color: var(--diff-intermediate);
}

.practice-difficulty-btn.active.advanced {
  background: var(--diff-advanced-soft);
  border-color: var(--diff-advanced);
  color: var(--diff-advanced);
}

.practice-difficulty-btn .filter-count {
  font-size: 0.72rem;
  opacity: 0.8;
}

/* Inactive (toggled off) buttons appear dimmed */
.practice-difficulty-btn:not(.active) {
  opacity: 0.55;
}

.practice-difficulty-btn:not(.active):hover {
  opacity: 0.8;
}

/* ---------------------------------------------------------------------------
 * Hidden Questions & Groups
 * --------------------------------------------------------------------------- */

.question-link.difficulty-hidden {
  display: none !important;
}

.topic-group.difficulty-hidden {
  display: none !important;
}

/* ---------------------------------------------------------------------------
 * Responsive
 * --------------------------------------------------------------------------- */

@media (max-width: 768px) {
  .practice-difficulty-filter-bar {
    padding: 0.5rem 0.6rem;
    gap: 0.4rem;
  }

  .practice-difficulty-btn {
    padding: 0.4rem 0.65rem;
    font-size: 0.75rem;
  }
}

@media (max-width: 640px) {
  .practice-difficulty-filter-bar {
    padding: 0.5rem;
    gap: 0.35rem;
  }

  .practice-difficulty-btn {
    padding: 0.4rem 0.6rem;
    font-size: 0.73rem;
    min-height: var(--touch-min, 2.75rem);
  }

  .practice-difficulty-filter-bar .filter-label {
    font-size: 0.73rem;
  }
}

@media (max-width: 480px) {
  .practice-difficulty-filter-bar {
    padding: 0.4rem;
    gap: 0.3rem;
  }

  .practice-difficulty-btn {
    padding: 0.35rem 0.55rem;
    font-size: 0.7rem;
  }

  .practice-difficulty-filter-bar .filter-label {
    font-size: 0.7rem;
    width: 100%;
    margin-bottom: 0.15rem;
  }
}

/* === practice-bookmarks.css === */
/* ==========================================================================
   Practice Bookmarks — Styles
   Adds star/bookmark functionality to practice question cards and sidebar.
   Supports dark and light themes via existing CSS custom properties.
   ========================================================================== */

/* ---------------------------------------------------------------------------
   Bookmark button on question card (top-right of .card-panel)
   --------------------------------------------------------------------------- */

.bookmark-btn {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: var(--surface-muted, rgba(148, 163, 184, 0.08));
  border: 1px solid var(--border-soft, rgba(148, 163, 184, 0.2));
  border-radius: var(--radius-sm, 0.5rem);
  color: var(--text-muted, #94a3b8);
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
  min-width: var(--touch-min, 2.75rem);
  min-height: var(--touch-min, 2.75rem);
  padding: 0.35rem 0.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
  z-index: 2;
  font-family: inherit;
}

.bookmark-btn:hover {
  color: #f59e0b;
  border-color: var(--button-border-hover, rgba(148, 163, 184, 0.5));
  transform: scale(1.1);
}

.bookmark-btn:focus-visible {
  outline: 2px solid var(--focus-ring, rgba(59, 130, 246, 0.6));
  outline-offset: 2px;
}

.bookmark-btn.bookmarked {
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.3);
}

.bookmark-btn.bookmarked:hover {
  background: rgba(245, 158, 11, 0.2);
}

/* Make card-panel relative for the absolute-positioned bookmark button */
.card-panel {
  position: relative;
}

/* ---------------------------------------------------------------------------
   Sidebar bookmark star indicator on question links
   --------------------------------------------------------------------------- */

.question-link .bookmark-star {
  display: none;
  margin-right: 0.35rem;
  color: #f59e0b;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.question-link.is-bookmarked .bookmark-star {
  display: inline;
}

.question-link.is-bookmarked {
  display: flex;
  align-items: flex-start;
  gap: 0;
}

/* ---------------------------------------------------------------------------
   Bookmark filter bar (above sidebar topic list)
   --------------------------------------------------------------------------- */

.bookmark-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-soft, rgba(148, 163, 184, 0.2));
}

.bookmark-count {
  font-size: 0.8rem;
  color: #f59e0b;
  font-weight: 600;
  white-space: nowrap;
}

.bookmark-count:empty {
  display: none;
}

.bookmark-filter-toggle {
  background: var(--button-bg, rgba(148, 163, 184, 0.1));
  border: 1px solid var(--border-soft, rgba(148, 163, 184, 0.2));
  border-radius: var(--radius-sm, 0.5rem);
  color: var(--text-muted, #94a3b8);
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 600;
  min-height: var(--touch-min, 2.75rem);
  padding: 0.3rem 0.65rem;
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
  font-family: inherit;
}

.bookmark-filter-toggle:hover {
  border-color: var(--button-border-hover, rgba(148, 163, 184, 0.5));
  color: var(--text-main, #f8fafc);
}

.bookmark-filter-toggle:focus-visible {
  outline: 2px solid var(--focus-ring, rgba(59, 130, 246, 0.6));
  outline-offset: 2px;
}

.bookmark-filter-toggle.active {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.4);
  color: #f59e0b;
}

/* ---------------------------------------------------------------------------
   Bookmark actions row (category bookmark + clear all)
   --------------------------------------------------------------------------- */

.bookmark-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.bookmark-action-btn {
  background: var(--button-bg, rgba(148, 163, 184, 0.1));
  border: 1px solid var(--border-soft, rgba(148, 163, 184, 0.2));
  border-radius: var(--radius-sm, 0.4rem);
  color: var(--text-muted, #94a3b8);
  cursor: pointer;
  font-size: 0.7rem;
  font-weight: 600;
  min-height: var(--touch-min, 2.75rem);
  padding: 0.2rem 0.5rem;
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
  font-family: inherit;
  white-space: nowrap;
}

.bookmark-action-btn:hover {
  border-color: var(--button-border-hover, rgba(148, 163, 184, 0.5));
  color: var(--text-main, #f8fafc);
}

.bookmark-action-btn:focus-visible {
  outline: 2px solid var(--focus-ring, rgba(59, 130, 246, 0.6));
  outline-offset: 2px;
}

.bookmark-action-btn.clear-all {
  color: var(--bad-color, #ef4444);
  border-color: rgba(239, 68, 68, 0.2);
}

.bookmark-action-btn.clear-all:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.4);
}

/* ---------------------------------------------------------------------------
   Empty state when bookmark filter is active but nothing is bookmarked
   --------------------------------------------------------------------------- */

.bookmark-empty-state {
  padding: 1rem 0.75rem;
  text-align: center;
  color: var(--text-muted, #94a3b8);
  font-size: 0.85rem;
  line-height: 1.5;
}

.bookmark-empty-state .empty-star {
  font-size: 1.5rem;
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text-muted, #94a3b8);
  opacity: 0.5;
}

/* ---------------------------------------------------------------------------
   Hiding non-bookmarked questions when filter is active
   --------------------------------------------------------------------------- */

.topic-list.bookmark-filter-active .question-link:not(.is-bookmarked) {
  display: none;
}

.topic-list.bookmark-filter-active .topic-group.has-no-bookmarks {
  display: none;
}

/* ---------------------------------------------------------------------------
   Confirm dialog overlay
   --------------------------------------------------------------------------- */

.bookmark-confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.bookmark-confirm-overlay.visible {
  opacity: 1;
  visibility: visible;
}

.bookmark-confirm-dialog {
  background: var(--bg-secondary, #1e293b);
  border: 1px solid var(--border-soft, rgba(148, 163, 184, 0.2));
  border-radius: var(--radius-md, 1rem);
  padding: 1.5rem;
  max-width: 360px;
  width: 90%;
  text-align: center;
}

.bookmark-confirm-dialog h3 {
  margin: 0 0 0.75rem 0;
  font-size: 1.1rem;
  color: var(--text-main, #f8fafc);
}

.bookmark-confirm-dialog p {
  margin: 0 0 1.25rem 0;
  font-size: 0.9rem;
  color: var(--text-muted, #94a3b8);
  line-height: 1.5;
}

.bookmark-confirm-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

.bookmark-confirm-actions button {
  padding: 0.5rem 1.25rem;
  min-height: var(--touch-min, 2.75rem);
  border-radius: var(--radius-md, 0.6rem);
  border: 1px solid var(--border-soft, rgba(148, 163, 184, 0.2));
  background: var(--button-bg, rgba(148, 163, 184, 0.1));
  color: var(--text-main, #f8fafc);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
  font-family: inherit;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.bookmark-confirm-actions button:hover {
  border-color: var(--button-border-hover, rgba(148, 163, 184, 0.5));
}

.bookmark-confirm-actions button:focus-visible {
  outline: 2px solid var(--focus-ring, rgba(59, 130, 246, 0.6));
  outline-offset: 2px;
}

.bookmark-confirm-actions .confirm-danger {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
  color: var(--bad-color, #ef4444);
}

.bookmark-confirm-actions .confirm-danger:hover {
  background: rgba(239, 68, 68, 0.25);
}

/* ---------------------------------------------------------------------------
   Responsive
   --------------------------------------------------------------------------- */

@media (max-width: 960px) {
  .bookmark-filter-bar {
    padding: 0.4rem 0;
  }
}

@media (max-width: 768px) {
  .bookmark-btn {
    min-width: 44px;
    min-height: 44px;
    font-size: 1.15rem;
  }

  .bookmark-filter-toggle {
    min-height: 44px;
    padding: 0.4rem 0.75rem;
    font-size: 0.78rem;
  }

  .bookmark-action-btn {
    min-height: 44px;
    padding: 0.35rem 0.6rem;
    font-size: 0.73rem;
  }
}

@media (max-width: 640px) {
  .bookmark-confirm-dialog {
    padding: 1.25rem;
  }

  .bookmark-confirm-actions {
    flex-direction: column;
    gap: 0.5rem;
  }

  .bookmark-confirm-actions button {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .bookmark-filter-bar {
    gap: 0.35rem;
    padding: 0.35rem 0;
  }

  .bookmark-count {
    font-size: 0.75rem;
  }

  .bookmark-empty-state {
    padding: 0.75rem 0.5rem;
    font-size: 0.8rem;
  }
}

/* ---------------------------------------------------------------------------
   Reduced motion
   --------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .bookmark-btn,
  .bookmark-filter-toggle,
  .bookmark-action-btn,
  .bookmark-confirm-overlay {
    transition-duration: 0.01ms !important;
  }
}

/* === practice-dashboard.css === */
/* ============================================================================
   Practice Dashboard — Collapsible stats panel for practice pages
   ============================================================================ */

/* ── Wrapper ─────────────────────────────────────────────────────────────── */

.pd-wrapper {
  max-width: 1200px;
  margin: 0 auto 1rem;
  padding: 0 clamp(1.5rem, 3vw, 3rem);
}

/* ── Dashboard container ─────────────────────────────────────────────────── */

.pd-dashboard {
  background: var(--panel, var(--bg-secondary));
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md, 1rem);
  overflow: hidden;
  transition: box-shadow 0.2s ease;
}

.pd-dashboard:hover {
  box-shadow: var(--shadow-sm, 0 4px 12px rgba(0, 0, 0, 0.15));
}

/* ── Toggle button (header bar) ──────────────────────────────────────────── */

.pd-toggle-btn {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  min-height: var(--touch-min, 2.75rem);
  padding: 0.85rem 1.25rem;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.95rem;
  text-align: left;
  transition: background 0.15s ease;
}

.pd-toggle-btn:hover {
  background: var(--bg-hover, rgba(148, 163, 184, 0.08));
}

.pd-toggle-btn:focus-visible {
  outline: 2px solid var(--focus-ring, rgba(59, 130, 246, 0.6));
  outline-offset: -2px;
  border-radius: var(--radius-md, 1rem);
}

.pd-toggle-arrow {
  font-size: 0.7rem;
  color: var(--text-muted);
  transition: transform 0.2s ease;
  flex-shrink: 0;
  width: 1rem;
  text-align: center;
}

.pd-toggle-title {
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
}

.pd-toggle-summary {
  margin-left: auto;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 400;
}

/* ── Collapsible body ────────────────────────────────────────────────────── */

.pd-body {
  padding: 0 1.25rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  max-height: 800px;
  overflow: hidden;
  transition: max-height 0.35s ease, padding 0.35s ease, opacity 0.25s ease;
  opacity: 1;
}

.pd-collapsed .pd-body {
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  opacity: 0;
  pointer-events: none;
}

/* ── Summary cards row ───────────────────────────────────────────────────── */

.pd-summary-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 0.75rem;
}

.pd-summary-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.85rem 0.5rem;
  background: var(--card-inner, rgba(11, 18, 26, 0.4));
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md, 0.75rem);
  text-align: center;
  transition: transform 0.15s ease;
}

.pd-summary-card:hover {
  transform: translateY(-1px);
}

.pd-summary-value {
  font-family: 'Fraunces', 'Space Grotesk', serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.pd-summary-value .pd-pct {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-muted);
}

.pd-summary-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

/* Color accents for rating cards */
.pd-card-confident {
  border-left: 3px solid var(--status-success);
}

.pd-card-partial {
  border-left: 3px solid var(--status-warning);
}

.pd-card-missed {
  border-left: 3px solid var(--status-error);
}

/* ── Section titles ──────────────────────────────────────────────────────── */

.pd-section {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.pd-section-title {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ── Category coverage ───────────────────────────────────────────────────── */

.pd-category-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.pd-category-row {
  display: grid;
  grid-template-columns: minmax(100px, 160px) 1fr auto;
  gap: 0.6rem;
  align-items: center;
}

.pd-category-name {
  font-size: 0.82rem;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}

.pd-category-bar-track {
  display: flex;
  width: 100%;
  height: 10px;
  background: var(--border-soft, rgba(148, 163, 184, 0.12));
  border-radius: var(--radius-sm, 5px);
  overflow: hidden;
}

.pd-category-bar-seg {
  height: 100%;
  transition: width 0.4s ease;
  min-width: 0;
}

.pd-seg-confident {
  background: var(--status-success);
}

.pd-seg-partial {
  background: var(--status-warning);
}

.pd-seg-missed {
  background: var(--status-error);
}

.pd-category-count {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  min-width: 3.5rem;
  text-align: right;
}

/* ── Recent activity ─────────────────────────────────────────────────────── */

.pd-activity-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.pd-activity-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 0.5rem;
  align-items: center;
  padding: 0.4rem 0.6rem;
  background: var(--card-inner, rgba(11, 18, 26, 0.3));
  border-radius: var(--radius-sm, 0.5rem);
  transition: background 0.15s ease;
}

.pd-activity-row:hover {
  background: var(--bg-hover, rgba(148, 163, 184, 0.08));
}

.pd-activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.pd-activity-dot.pd-confident {
  background: var(--status-success);
}

.pd-activity-dot.pd-partial {
  background: var(--status-warning);
}

.pd-activity-dot.pd-missed {
  background: var(--status-error);
}

.pd-activity-dot.pd-unrated {
  background: var(--border-soft);
}

.pd-activity-snippet {
  font-size: 0.82rem;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
}

.pd-activity-badge {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.pd-activity-badge.pd-confident {
  background: var(--status-success-soft);
  color: var(--status-success-text, var(--status-success));
}

.pd-activity-badge.pd-partial {
  background: var(--status-warning-soft);
  color: var(--status-warning-text, var(--status-warning));
}

.pd-activity-badge.pd-missed {
  background: var(--status-error-soft);
  color: var(--status-error-text, var(--status-error));
}

.pd-activity-badge.pd-unrated {
  background: var(--border-soft);
  color: var(--text-muted);
}

.pd-activity-time {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ── Strength indicator ──────────────────────────────────────────────────── */

.pd-strength-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.pd-strength-bar-track {
  flex: 1;
  height: 12px;
  background: var(--border-soft, rgba(148, 163, 184, 0.12));
  border-radius: var(--radius-sm, 6px);
  overflow: hidden;
}

.pd-strength-bar-fill {
  height: 100%;
  border-radius: var(--radius-sm, 6px);
  transition: width 0.5s ease;
}

.pd-fill-green {
  background: linear-gradient(90deg, var(--status-success), #4ade80);
}

.pd-fill-yellow {
  background: linear-gradient(90deg, var(--status-warning), #fbbf24);
}

.pd-fill-orange {
  background: linear-gradient(90deg, #f97316, var(--status-warning));
}

.pd-fill-red {
  background: linear-gradient(90deg, var(--status-error), #f87171);
}

.pd-strength-label {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
  min-width: 4.5rem;
  text-align: right;
}

.pd-strength-hint {
  margin: 0;
  font-size: 0.7rem;
  color: var(--text-muted);
  font-style: italic;
}

/* ── Empty state ─────────────────────────────────────────────────────────── */

.pd-empty-state {
  padding: 1.5rem;
  text-align: center;
}

.pd-empty-text {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  .pd-wrapper {
    padding: 0 1rem;
  }

  .pd-summary-row {
    grid-template-columns: repeat(3, 1fr);
  }

  .pd-category-row {
    grid-template-columns: minmax(80px, 120px) 1fr auto;
  }

  .pd-activity-row {
    grid-template-columns: auto 1fr auto;
  }

  .pd-activity-time {
    display: none;
  }

  .pd-toggle-summary {
    display: none;
  }
}

@media (max-width: 640px) {
  .pd-wrapper {
    padding: 0 0.85rem;
  }

  .pd-summary-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .pd-summary-value {
    font-size: 1.3rem;
  }

  .pd-toggle-btn {
    min-height: 44px;
    padding: 0.75rem 1rem;
  }

  .pd-category-row {
    grid-template-columns: minmax(70px, 100px) 1fr auto;
    gap: 0.4rem;
  }

  .pd-category-name {
    font-size: 0.78rem;
  }

  .pd-body {
    padding: 0 1rem 1rem;
    gap: 1rem;
  }
}

@media (max-width: 480px) {
  .pd-wrapper {
    padding: 0 0.75rem;
  }

  .pd-summary-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .pd-summary-value {
    font-size: 1.2rem;
  }

  .pd-activity-badge {
    display: none;
  }

  .pd-category-name {
    font-size: 0.75rem;
  }
}

/* ── Reduced motion ──────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .pd-body,
  .pd-category-bar-seg,
  .pd-strength-bar-fill,
  .pd-summary-card,
  .pd-toggle-arrow {
    transition-duration: 0.01ms !important;
  }
}

/* ── Print ────────────────────────────────────────────────────────────────── */

@media print {
  .pd-wrapper {
    display: none;
  }
}

/* === practice-code-editor.css === */
/* ============================================================
   Practice Code Editor — enhanced code input for practice pages
   Replaces plain textarea with line-numbered, language-aware editor
   when the current question's answer contains code blocks.
   ============================================================ */

/* ---- Editor wrapper ---- */
.pce-editor-wrap {
  position: relative;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md, 0.625rem);
  overflow: hidden;
  background: var(--code-editor-bg);
  transition: border-color 0.2s;
}

.pce-editor-wrap:focus-within {
  border-color: var(--primary, rgba(74, 144, 217, 0.6));
  box-shadow: 0 0 0 2px var(--primary-soft, rgba(74, 144, 217, 0.15));
}

/* Language badge */
.pce-lang-badge {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  padding: 0.15rem 0.5rem;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-family: 'Space Grotesk', 'Inter', system-ui, sans-serif;
  color: var(--text-accent, #ff8a5b);
  background: var(--chip-bg, rgba(15, 23, 42, 0.55));
  border: 1px solid var(--chip-border, rgba(148, 163, 184, 0.3));
  border-radius: var(--radius-sm, 0.3rem);
  z-index: 3;
  pointer-events: none;
  line-height: 1.4;
}

/* Editor body: line numbers + textarea side by side */
.pce-editor-body {
  display: flex;
  min-height: 10rem;
  max-height: 60vh;
  overflow: auto;
}

/* Line numbers gutter */
.pce-line-numbers {
  flex: 0 0 auto;
  min-width: 2.5rem;
  padding: 0.75rem 0.5rem 0.75rem 0.25rem;
  font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', 'Cascadia Code', Consolas, monospace;
  font-size: 0.82rem;
  line-height: 1.6;
  text-align: right;
  color: var(--text-muted, #94a3b8);
  background: var(--code-bg, #101925);
  border-right: 1px solid var(--border-soft, rgba(148, 163, 184, 0.12));
  user-select: none;
  white-space: pre-line;
  pointer-events: none;
}

/* The actual textarea */
.pce-textarea {
  flex: 1 1 auto;
  display: block;
  width: 100%;
  padding: 0.75rem 0.75rem 0.75rem 0.6rem;
  margin: 0;
  font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', 'Cascadia Code', Consolas, monospace;
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--code-text, #e2e8f0);
  background: transparent;
  border: none;
  resize: none;
  outline: none;
  tab-size: 2;
  white-space: pre;
  overflow: hidden;
  min-height: 10rem;
  box-sizing: border-box;
}

.pce-textarea::placeholder {
  color: var(--text-muted, #94a3b8);
  opacity: 0.6;
}

.pce-textarea:focus-visible {
  outline: none;
}

/* ---- Run Code button ---- */
.pce-run-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.5rem;
  padding: 0.4rem 0.85rem;
  min-height: var(--touch-min, 2.75rem);
  font-size: 0.78rem;
  font-weight: 600;
  font-family: 'Space Grotesk', 'Inter', system-ui, sans-serif;
  color: var(--status-success-text, #4ade80);
  background: var(--status-success-soft, rgba(34, 197, 94, 0.15));
  border: 1px solid rgba(34, 197, 94, 0.35);
  border-radius: var(--radius-sm, 0.375rem);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  line-height: 1.4;
}

.pce-run-btn:hover {
  background: rgba(34, 197, 94, 0.25);
  border-color: rgba(34, 197, 94, 0.5);
  transform: translateY(-1px);
}

.pce-run-btn:active {
  transform: translateY(0);
}

.pce-run-btn:focus-visible {
  outline: 2px solid var(--focus-ring, rgba(59, 130, 246, 0.6));
  outline-offset: 2px;
}

.pce-run-btn::before {
  content: '\25B6';
  font-size: 0.65rem;
}

/* Run output */
.pce-run-output {
  margin-top: 0.5rem;
  padding: 0.6rem 0.75rem;
  font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', Consolas, monospace;
  font-size: 0.78rem;
  line-height: 1.5;
  border-radius: var(--radius-sm, 0.375rem);
  background: rgba(0, 0, 0, 0.25);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 200px;
  overflow-y: auto;
  color: var(--code-text, #e2e8f0);
}

.pce-run-output.pce-output-hidden {
  display: none;
}

.pce-run-output.pce-output-success {
  color: var(--status-success-text, #4ade80);
  border-left: 3px solid var(--status-success, #22c55e);
}

.pce-run-output.pce-output-error {
  color: var(--status-error-text, #f87171);
  border-left: 3px solid var(--status-error, #ef4444);
}

.pce-run-output.pce-output-muted {
  color: var(--text-secondary, #94a3b8);
  font-style: italic;
}

/* ---- Side-by-side comparison ---- */
.pce-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1rem;
  animation: pce-fade-in 0.3s ease;
}

@keyframes pce-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.pce-compare-pane {
  border: 1px solid var(--border-soft, rgba(148, 163, 184, 0.12));
  border-radius: var(--radius-md, 0.625rem);
  overflow: hidden;
  background: var(--code-editor-bg, #0d1117);
}

.pce-compare-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.35rem 0.75rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-family: 'Space Grotesk', 'Inter', system-ui, sans-serif;
  border-bottom: 1px solid var(--border-soft, rgba(148, 163, 184, 0.12));
}

.pce-compare-header--user {
  color: var(--status-info-text, #93c5fd);
  background: var(--status-info-soft, rgba(59, 130, 246, 0.15));
}

.pce-compare-header--expected {
  color: var(--status-success-text, #4ade80);
  background: var(--status-success-soft, rgba(34, 197, 94, 0.15));
}

.pce-compare-code {
  padding: 0.75rem;
  margin: 0;
  font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', 'Cascadia Code', Consolas, monospace;
  font-size: 0.8rem;
  line-height: 1.6;
  overflow-x: auto;
  max-height: 400px;
  overflow-y: auto;
  color: var(--code-text, #e2e8f0);
  background: var(--code-editor-bg, #0d1117);
}

.pce-compare-code code {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

/* ---- Responsive: stack on narrow screens ---- */

@media (max-width: 768px) {
  .pce-compare {
    gap: 0.75rem;
  }

  .pce-compare-code {
    font-size: 0.75rem;
    max-height: 300px;
  }
}

@media (max-width: 640px) {
  .pce-compare {
    grid-template-columns: 1fr;
  }

  .pce-line-numbers {
    min-width: 2rem;
    font-size: 0.72rem;
  }

  .pce-textarea {
    font-size: 0.75rem;
  }

  .pce-lang-badge {
    font-size: 0.6rem;
    padding: 0.1rem 0.35rem;
  }

  .pce-run-btn {
    min-height: 44px;
    padding: 0.45rem 1rem;
  }
}

@media (max-width: 480px) {
  .pce-editor-body {
    min-height: 8rem;
  }

  .pce-textarea {
    font-size: 0.72rem;
    padding: 0.6rem 0.6rem 0.6rem 0.5rem;
    min-height: 8rem;
  }

  .pce-line-numbers {
    min-width: 1.8rem;
    font-size: 0.68rem;
    padding: 0.6rem 0.35rem 0.6rem 0.2rem;
  }

  .pce-compare-code {
    font-size: 0.72rem;
    padding: 0.6rem;
  }
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  .pce-editor-wrap,
  .pce-run-btn,
  .pce-compare {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---- Print: hide interactive parts ---- */
@media print {
  .pce-editor-wrap,
  .pce-run-btn,
  .pce-run-output,
  .pce-compare {
    display: none !important;
  }
}

/* === practice-shortcuts.css === */
/* ============================================================================
   Practice Page Keyboard Shortcuts — Styles
   ============================================================================ */

/* ── Help Overlay ────────────────────────────────────────────────────────── */

.ps-help-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.ps-help-overlay.ps-visible {
  opacity: 1;
  visibility: visible;
}

.ps-help-modal {
  background: var(--panel, var(--bg-secondary, #1e293b));
  border: 1px solid var(--border-soft, rgba(148, 163, 184, 0.2));
  border-radius: var(--radius-md, 1rem);
  padding: 1.5rem 2rem;
  max-width: 480px;
  width: 90vw;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  transform: translateY(12px) scale(0.97);
  transition: transform 0.25s ease;
}

.ps-help-overlay.ps-visible .ps-help-modal {
  transform: translateY(0) scale(1);
}

.ps-help-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.ps-help-header h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main, #f8fafc);
}

.ps-help-close {
  background: none;
  border: none;
  color: var(--text-muted, #94a3b8);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  min-width: var(--touch-min, 2.75rem);
  min-height: var(--touch-min, 2.75rem);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm, 0.4rem);
  transition: color 0.15s ease, background 0.15s ease;
}

.ps-help-close:hover {
  color: var(--text-main, #f8fafc);
  background: var(--bg-hover, rgba(148, 163, 184, 0.12));
}

.ps-help-close:focus-visible {
  outline: 2px solid var(--focus-ring, rgba(59, 130, 246, 0.6));
  outline-offset: 2px;
}

/* ── Shortcuts Table ────────────────────────────────────────────────────── */

.ps-help-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.ps-help-table thead th {
  text-align: left;
  font-weight: 600;
  color: var(--text-muted, #94a3b8);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--border-soft, rgba(148, 163, 184, 0.2));
}

.ps-help-table tbody td {
  padding: 0.55rem 0.6rem;
  color: var(--text-main, #f8fafc);
  border-bottom: 1px solid var(--border-soft, rgba(148, 163, 184, 0.08));
}

.ps-help-table tbody tr:last-child td {
  border-bottom: none;
}

.ps-help-table tbody tr:hover {
  background: var(--bg-hover, rgba(148, 163, 184, 0.06));
}

.ps-help-table kbd {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-main, #f8fafc);
  background: var(--bg-primary, #0f172a);
  border: 1px solid var(--border-soft, rgba(148, 163, 184, 0.25));
  border-radius: var(--radius-sm, 0.35rem);
  white-space: nowrap;
  line-height: 1.6;
}

.ps-help-footer {
  margin: 1rem 0 0;
  font-size: 0.78rem;
  color: var(--text-muted, #94a3b8);
  text-align: center;
}

/* ── Shortcuts Button (bottom-right corner) ─────────────────────────────── */

.ps-shortcuts-btn {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  z-index: 900;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.85rem;
  min-height: var(--touch-min, 2.75rem);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted, #94a3b8);
  background: var(--panel, var(--bg-secondary, #1e293b));
  border: 1px solid var(--border-soft, rgba(148, 163, 184, 0.2));
  border-radius: var(--radius-md, 0.6rem);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.ps-shortcuts-btn:hover {
  color: var(--text-main, #f8fafc);
  border-color: var(--primary, rgba(148, 163, 184, 0.5));
  background: var(--bg-hover, rgba(148, 163, 184, 0.12));
}

.ps-shortcuts-btn:focus-visible {
  outline: 2px solid var(--focus-ring, rgba(59, 130, 246, 0.6));
  outline-offset: 2px;
}

.ps-shortcuts-icon {
  font-size: 1rem;
  line-height: 1;
}

/* ── First-Visit Tooltip ────────────────────────────────────────────────── */

.ps-first-visit-tooltip {
  position: fixed;
  bottom: 3.5rem;
  right: 1rem;
  z-index: 950;
  padding: 0.6rem 1rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main, #f8fafc);
  background: var(--primary, var(--accent-strong, #3b82f6));
  border-radius: var(--radius-md, 0.6rem);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.35s ease, transform 0.35s ease;
  pointer-events: none;
  white-space: nowrap;
}

.ps-first-visit-tooltip::after {
  content: '';
  position: absolute;
  bottom: -6px;
  right: 1.5rem;
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid var(--primary, var(--accent-strong, #3b82f6));
}

.ps-first-visit-tooltip.ps-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ── Toast Notification ─────────────────────────────────────────────────── */

.ps-toast {
  position: fixed;
  bottom: 4rem;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  z-index: 9999;
  padding: 0.55rem 1.2rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main, #f8fafc);
  background: var(--panel, var(--bg-secondary, #1e293b));
  border: 1px solid var(--border-soft, rgba(148, 163, 184, 0.2));
  border-radius: var(--radius-md, 0.6rem);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
  white-space: nowrap;
}

.ps-toast.ps-toast-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Bookmark Indicator ─────────────────────────────────────────────────── */

.ps-bookmark-indicator {
  display: none;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--status-warning-text, var(--status-warning, #f59e0b));
  background: var(--status-warning-soft, rgba(245, 158, 11, 0.15));
  padding: 0.15rem 0.55rem;
  border-radius: var(--radius-sm, 0.4rem);
  margin-left: 0.5rem;
  white-space: nowrap;
}

.ps-bookmark-indicator.ps-active {
  display: inline-block;
}

/* ── Hint Container ─────────────────────────────────────────────────────── */

.ps-hint-container {
  display: none;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.75rem 1rem;
  background: var(--panel, var(--bg-secondary, #1e293b));
  border: 1px solid var(--border-soft, rgba(148, 163, 184, 0.2));
  border-left: 3px solid var(--primary, var(--status-info, #3b82f6));
  border-radius: var(--radius-md, 0.6rem);
  margin-bottom: 0.75rem;
}

.ps-hint-container.ps-visible {
  display: flex;
}

.ps-hint {
  font-size: 0.88rem;
  color: var(--text-main, #f8fafc);
  line-height: 1.5;
  animation: ps-hint-fade-in 0.3s ease;
}

.ps-hint-label {
  font-weight: 700;
  color: var(--primary, var(--text-accent, #3b82f6));
  margin-right: 0.3rem;
}

@keyframes ps-hint-fade-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Responsive ─────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  .ps-help-modal {
    padding: 1.25rem 1.25rem;
    max-width: 95vw;
  }

  .ps-shortcuts-btn {
    bottom: 0.75rem;
    right: 0.75rem;
    padding: 0.35rem 0.65rem;
    font-size: 0.72rem;
    min-height: 44px;
  }

  .ps-first-visit-tooltip {
    bottom: 3rem;
    right: 0.75rem;
    font-size: 0.75rem;
  }
}

@media (max-width: 640px) {
  .ps-help-modal {
    padding: 1rem;
    max-width: 98vw;
    border-radius: var(--radius-md, 0.75rem);
  }

  .ps-help-table {
    font-size: 0.84rem;
  }

  .ps-shortcuts-btn {
    padding: 0.3rem 0.55rem;
    font-size: 0.7rem;
  }

  .ps-shortcuts-btn .ps-shortcuts-label {
    display: none;
  }

  .ps-toast {
    font-size: 0.8rem;
    padding: 0.5rem 1rem;
  }
}

@media (max-width: 480px) {
  .ps-help-table {
    font-size: 0.82rem;
  }

  .ps-help-table kbd {
    font-size: 0.72rem;
    padding: 0.1rem 0.35rem;
  }

  .ps-first-visit-tooltip {
    font-size: 0.7rem;
    right: 0.5rem;
  }
}

/* ── Reduced motion ─────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .ps-help-overlay,
  .ps-help-modal,
  .ps-first-visit-tooltip,
  .ps-toast,
  .ps-hint {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* ── Print ──────────────────────────────────────────────────────────────── */

@media print {
  .ps-help-overlay,
  .ps-shortcuts-btn,
  .ps-first-visit-tooltip,
  .ps-toast,
  .ps-bookmark-indicator,
  .ps-hint-container {
    display: none !important;
  }
}

/* === practice-sessions.css === */
/* ============================================================================
   Practice Sessions — Mode Selector, Session Bar, Rating, Summary
   Uses only CSS custom properties from theme.css for dark/light support.
   ============================================================================ */

/* ==========================================================================
   Mode selector bar (row of cards at top of practice page)
   ========================================================================== */

.ps-mode-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  max-width: 1200px;
  margin: 0 auto 1rem;
  padding: 0;
}

.ps-mode-card {
  flex: 1 1 160px;
  min-width: 140px;
  min-height: var(--touch-min, 2.75rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.75rem 0.6rem;
  background: var(--card, var(--bg-secondary));
  border: 2px solid var(--border-soft);
  border-radius: var(--radius-md, 0.85rem);
  cursor: pointer;
  font-family: inherit;
  text-align: center;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.15s ease;
  color: var(--text-main);
}

.ps-mode-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
}

.ps-mode-card:focus-visible {
  outline: 2px solid var(--focus-ring, rgba(59, 130, 246, 0.6));
  outline-offset: 2px;
}

.ps-mode-card.ps-mode-active {
  border-color: var(--primary);
  background: var(--primary-soft, var(--status-info-soft));
}

.ps-mode-icon {
  font-size: 1.3rem;
  line-height: 1;
}

.ps-mode-label {
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--text-main);
}

.ps-mode-desc {
  font-size: 0.7rem;
  color: var(--text-muted);
  line-height: 1.3;
}

.ps-mode-count {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--chip-bg, var(--bg-primary));
  border: 1px solid var(--border-soft);
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  margin-top: 0.15rem;
}

/* ==========================================================================
   Session progress bar (injected at top of card-panel)
   ========================================================================== */

.ps-session-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  background: var(--panel, var(--bg-secondary));
  border: 1px solid var(--primary);
  border-radius: var(--radius-md, 0.75rem);
  margin-bottom: 0.75rem;
}

.ps-session-info {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.ps-session-mode {
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.ps-session-progress {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
}

.ps-session-track {
  flex: 1;
  height: 6px;
  background: var(--border-soft);
  border-radius: var(--radius-sm, 3px);
  overflow: hidden;
  min-width: 60px;
}

.ps-session-fill {
  height: 100%;
  background: var(--primary);
  border-radius: var(--radius-sm, 3px);
  transition: width 0.4s ease;
  min-width: 0;
}

.ps-session-actions {
  flex-shrink: 0;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.ps-btn {
  padding: 0.5rem 1rem;
  min-height: var(--touch-min, 2.75rem);
  border-radius: var(--radius-md, 0.6rem);
  border: 1px solid var(--border-soft);
  background: var(--chip-bg, var(--bg-primary));
  color: var(--text-main);
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.15s ease;
}

.ps-btn:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
}

.ps-btn:focus-visible {
  outline: 2px solid var(--focus-ring, rgba(59, 130, 246, 0.6));
  outline-offset: 2px;
}

.ps-btn-end {
  background: var(--status-error-soft);
  color: var(--status-error-text, var(--status-error));
  border-color: var(--status-error);
}

.ps-btn-end:hover {
  background: var(--status-error);
  color: #fff;
}

.ps-btn-done {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  padding: 0.65rem 2rem;
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

.ps-btn-done:hover {
  background: var(--accent-strong, var(--primary));
}

/* ==========================================================================
   Session self-rating panel
   ========================================================================== */

.ps-rating {
  display: none;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem;
  background: var(--panel, var(--bg-secondary));
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md, 0.85rem);
}

.ps-rating.ps-rating-visible {
  display: flex;
}

.ps-rating-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.ps-rating-buttons {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.ps-rate-btn {
  flex: 1;
  min-width: 110px;
  min-height: var(--touch-min, 2.75rem);
  padding: 0.6rem 1rem;
  border-radius: var(--radius-md, 0.7rem);
  border: 2px solid transparent;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  font-family: inherit;
  text-align: center;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.15s ease;
}

.ps-rate-btn:hover {
  transform: translateY(-1px);
}

.ps-rate-btn:active {
  transform: translateY(0);
}

.ps-rate-btn:focus-visible {
  outline: 2px solid var(--focus-ring, rgba(59, 130, 246, 0.6));
  outline-offset: 2px;
}

.ps-rate-confident {
  background: var(--status-success-soft);
  color: var(--status-success-text, var(--status-success));
  border-color: var(--status-success);
}

.ps-rate-confident:hover {
  background: var(--status-success);
  color: #fff;
}

.ps-rate-partial {
  background: var(--status-warning-soft);
  color: var(--status-warning-text, var(--status-warning));
  border-color: var(--status-warning);
}

.ps-rate-partial:hover {
  background: var(--status-warning);
  color: #fff;
}

.ps-rate-missed {
  background: var(--status-error-soft);
  color: var(--status-error-text, var(--status-error));
  border-color: var(--status-error);
}

.ps-rate-missed:hover {
  background: var(--status-error);
  color: #fff;
}

.ps-rate-selected {
  opacity: 1;
  transform: scale(1.03);
}

.ps-rate-dimmed {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
}

/* ==========================================================================
   Overlay + Modal (category picker, summary)
   ========================================================================== */

.ps-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.ps-overlay.ps-overlay-visible {
  opacity: 1;
  pointer-events: auto;
}

.ps-modal {
  background: var(--bg-secondary, #1e293b);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md, 1rem);
  max-width: 520px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  transform: translateY(20px);
  transition: transform 0.3s ease;
}

.ps-overlay.ps-overlay-visible .ps-modal {
  transform: translateY(0);
}

.ps-modal-header {
  padding: 1.25rem 1.5rem 0.75rem;
  text-align: center;
  border-bottom: 1px solid var(--border-soft);
}

.ps-modal-header h3 {
  margin: 0 0 0.25rem;
  font-size: 1.25rem;
  color: var(--text-main);
}

.ps-modal-header p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.ps-modal-cancel {
  display: block;
  width: calc(100% - 3rem);
  margin: 0.75rem 1.5rem 1.25rem;
  padding: 0.6rem;
  min-height: var(--touch-min, 2.75rem);
  background: var(--chip-bg, var(--bg-primary));
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md, 0.6rem);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  text-align: center;
  transition: border-color 0.2s;
}

.ps-modal-cancel:hover {
  border-color: var(--text-muted);
}

.ps-modal-cancel:focus-visible {
  outline: 2px solid var(--focus-ring, rgba(59, 130, 246, 0.6));
  outline-offset: 2px;
}

/* ==========================================================================
   Category picker
   ========================================================================== */

.ps-category-list {
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.ps-category-btn {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.65rem 0.85rem;
  min-height: var(--touch-min, 2.75rem);
  background: var(--card-inner, var(--bg-primary));
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md, 0.6rem);
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.2s ease, background 0.2s ease;
  color: var(--text-main);
  text-align: left;
}

.ps-category-btn:hover {
  border-color: var(--primary);
  background: var(--primary-soft, var(--status-info-soft));
}

.ps-category-btn:focus-visible {
  outline: 2px solid var(--focus-ring, rgba(59, 130, 246, 0.6));
  outline-offset: 2px;
}

.ps-category-name {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text-main);
}

.ps-category-count {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ==========================================================================
   Completion summary
   ========================================================================== */

.ps-summary-modal {
  text-align: center;
}

.ps-summary-header {
  padding: 1.5rem 1.5rem 1rem;
  border-bottom: 1px solid var(--border-soft);
}

.ps-summary-header h3 {
  margin: 0;
  font-size: 1.35rem;
  color: var(--text-main);
}

.ps-summary-body {
  padding: 1.5rem;
}

.ps-summary-score {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.1;
  margin-bottom: 0.2rem;
}

.ps-summary-score-label {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.ps-summary-breakdown {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.ps-summary-stat {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.ps-stat-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.ps-stat-confident .ps-stat-dot {
  background: var(--status-success);
}

.ps-stat-partial .ps-stat-dot {
  background: var(--status-warning);
}

.ps-stat-missed .ps-stat-dot {
  background: var(--status-error);
}

.ps-stat-unrated .ps-stat-dot {
  background: var(--border-soft);
}

.ps-summary-time {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.ps-summary-message {
  font-size: 1rem;
  color: var(--text-main);
  margin-bottom: 1.25rem;
  line-height: 1.5;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 768px) {
  .ps-mode-selector {
    gap: 0.4rem;
  }

  .ps-mode-card {
    flex: 1 1 120px;
    min-width: 100px;
    padding: 0.6rem 0.4rem;
  }

  .ps-mode-icon {
    font-size: 1.1rem;
  }

  .ps-mode-label {
    font-size: 0.75rem;
  }

  .ps-mode-desc {
    display: none;
  }

  .ps-session-bar {
    flex-direction: column;
    gap: 0.5rem;
    align-items: stretch;
  }

  .ps-session-info {
    justify-content: space-between;
  }

  .ps-rating-buttons {
    flex-direction: column;
  }

  .ps-rate-btn {
    min-width: unset;
  }
}

@media (max-width: 640px) {
  .ps-mode-selector {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.4rem;
  }

  .ps-mode-card {
    flex: unset;
    min-width: unset;
    padding: 0.55rem 0.4rem;
  }

  .ps-btn,
  .ps-rate-btn,
  .ps-category-btn,
  .ps-modal-cancel {
    min-height: 44px;
  }
}

@media (max-width: 480px) {
  .ps-mode-selector {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }

  .ps-mode-card {
    flex-direction: row;
    justify-content: flex-start;
    gap: 0.5rem;
    padding: 0.55rem 0.75rem;
    scroll-snap-align: start;
  }

  .ps-mode-icon {
    font-size: 1.1rem;
  }

  .ps-modal {
    max-width: 100%;
    border-radius: var(--radius-md, 0.75rem);
  }
}

/* ==========================================================================
   Reduced motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  .ps-mode-card,
  .ps-session-fill,
  .ps-rate-btn,
  .ps-overlay,
  .ps-modal,
  .ps-btn {
    transition-duration: 0.01ms !important;
  }
}

/* ==========================================================================
   Print — hide session UI
   ========================================================================== */

@media print {
  .ps-mode-selector,
  .ps-session-bar,
  .ps-rating,
  .ps-overlay {
    display: none !important;
  }
}
