*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary: #4a90d9;
  --primary-dark: #3a7bc8;
  --success: #27ae60;
  --warning: #f39c12;
  --danger: #e74c3c;
  --bg: #f5f5f5;
  --card: #ffffff;
  --text: #333333;
  --text-secondary: #666666;
  --border: #e0e0e0;
  --radius: 12px;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);

  /* Fast mode palette */
  --fast-accent: #2997c5;
  --fast-accent-light: #5bc0de;
  --fast-accent-dark: #1a7fa8;
  --fast-bg: rgba(41, 151, 197, 0.06);

  /* Precise mode palette */
  --precise-accent: #3d4f63;
  --precise-accent-light: #5a6a7e;
  --precise-accent-dark: #2c3e50;
  --precise-bg: rgba(61, 79, 99, 0.06);

  /* Active mode (defaults to fast, overridden by data-mode) */
  --mode-accent: var(--fast-accent);
  --mode-accent-light: var(--fast-accent-light);
  --mode-accent-dark: var(--fast-accent-dark);
  --mode-bg: var(--fast-bg);
}

[data-mode="fast"] {
  --mode-accent: var(--fast-accent);
  --mode-accent-light: var(--fast-accent-light);
  --mode-accent-dark: var(--fast-accent-dark);
  --mode-bg: var(--fast-bg);
}

[data-mode="precise"] {
  --mode-accent: var(--precise-accent);
  --mode-accent-light: var(--precise-accent-light);
  --mode-accent-dark: var(--precise-accent-dark);
  --mode-bg: var(--precise-bg);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1a2e;
    --card: #16213e;
    --text: #e0e0e0;
    --text-secondary: #aaaaaa;
    --border: #2a2a4a;
    --shadow: 0 2px 8px rgba(0,0,0,0.3);
    --fast-accent: #5bc0de;
    --fast-accent-light: #7ed4ec;
    --fast-accent-dark: #2997c5;
    --fast-bg: rgba(91, 192, 222, 0.1);
    --precise-accent: #8fa4b8;
    --precise-accent-light: #a8c0d4;
    --precise-accent-dark: #5a6a7e;
    --precise-bg: rgba(143, 164, 184, 0.1);
  }
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

#app {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px;
}

/* Screen transitions */
#main-content {
  transition: opacity 0.22s ease, transform 0.22s ease;
}

#main-content.screen-exit {
  opacity: 0;
  transform: translateY(6px);
}

#main-content.screen-enter {
  opacity: 0;
  transform: translateY(-6px);
}

.hidden {
  display: none !important;
}

/* ====================== UPLOAD SECTION ====================== */
.upload-section {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 20px 0;
}

.upload-header h1 {
  font-size: 1.5rem;
  text-align: center;
  margin-bottom: 8px;
}

.upload-subtitle {
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.preview-area {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 2px solid var(--border);
}

.preview-area img {
  width: 100%;
  display: block;
  max-height: 300px;
  object-fit: contain;
  background: var(--card);
}

.clear-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.6);
  color: white;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.upload-buttons {
  display: flex;
  gap: 12px;
}

.upload-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 16px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--card);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  color: var(--text);
}

.upload-btn:hover {
  border-color: var(--primary);
  background: rgba(74, 144, 217, 0.05);
}

.upload-btn svg {
  color: var(--primary);
}

.upload-btn span {
  font-size: 0.9rem;
  font-weight: 500;
}

/* Mode segmented control */
.mode-toggle-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mode-segment {
  display: flex;
  background: var(--card);
  border-radius: var(--radius);
  border: 2px solid var(--border);
  overflow: hidden;
  position: relative;
}

.mode-seg-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 10px;
  cursor: pointer;
  transition: all 0.25s ease;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  position: relative;
  z-index: 1;
}

.mode-seg-icon {
  font-size: 1.4rem;
  line-height: 1;
}

.mode-seg-label {
  font-size: 0.9rem;
  font-weight: 600;
}

.mode-seg-sub {
  font-size: 0.72rem;
  opacity: 0.7;
}

.mode-seg-item.active {
  color: white;
}

.mode-seg-fast.active {
  background: var(--fast-accent);
}

.mode-seg-precise.active {
  background: var(--precise-accent);
}

.mode-seg-item:not(.active):hover {
  background: var(--mode-bg);
}

.mode-features {
  display: flex;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}

.mode-feat-tag {
  font-size: 0.7rem;
  padding: 3px 8px;
  border-radius: 10px;
  background: var(--mode-bg);
  color: var(--mode-accent);
  font-weight: 500;
}

.mode-feat-tag.feat-off {
  opacity: 0.35;
  text-decoration: line-through;
}

/* Start button */
.start-btn {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: var(--radius);
  background: var(--mode-accent);
  color: white;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
}

.start-btn:hover:not(:disabled) {
  background: var(--mode-accent-dark);
}

.start-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ====================== LOADING ====================== */
.loading-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  gap: 20px;
}

/* Fast mode: bouncing dots */
.loading-dots {
  display: flex;
  gap: 8px;
}

.loading-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--fast-accent);
  animation: dot-bounce 1.2s ease-in-out infinite;
}

.loading-dot:nth-child(2) { animation-delay: 0.15s; }
.loading-dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes dot-bounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* Precise mode: spinner */
.spinner {
  width: 44px;
  height: 44px;
  border: 3px solid var(--border);
  border-top-color: var(--precise-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 500;
}

.loading-timer {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-top: 4px;
}

.slow-warning {
  color: var(--warning);
  font-size: 0.85rem;
  margin-top: 8px;
  padding: 8px 16px;
  background: rgba(255, 152, 0, 0.08);
  border-radius: 8px;
  text-align: center;
}

/* Precise mode: vertical stepper */
.loading-stepper {
  display: flex;
  flex-direction: column;
  gap: 0;
  width: 100%;
  max-width: 280px;
}

.loading-step-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  opacity: 0.3;
  transition: opacity 0.3s;
}

.loading-step-row.active {
  opacity: 1;
}

.loading-step-row.done {
  opacity: 0.55;
}

.loading-step-marker {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  flex-shrink: 0;
  margin-top: 1px;
}

.loading-step-row.active .loading-step-marker {
  border-color: var(--precise-accent);
  background: var(--precise-bg);
  animation: step-pulse 1.5s ease-in-out infinite;
}

.loading-step-row.done .loading-step-marker {
  border-color: var(--success);
  background: rgba(39, 174, 96, 0.1);
  color: var(--success);
}

@keyframes step-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

.loading-step-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.loading-step-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
}

.loading-step-row.active .loading-step-name {
  color: var(--precise-accent-dark);
}

.loading-step-desc {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.loading-step-connector {
  width: 2px;
  height: 12px;
  background: var(--border);
  margin-left: 11px;
}

.loading-step-row.done + .loading-step-connector {
  background: var(--success);
}

/* ====================== ERROR ====================== */
.error-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  gap: 16px;
  text-align: center;
}

.error-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--danger);
  color: white;
  font-size: 2rem;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ====================== CONFIRMING ====================== */
.confirming-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-bottom: 100px;
}

.confirm-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  background: var(--bg);
  padding: 8px 0;
  z-index: 10;
}

.confirm-header h2 {
  font-size: 1.1rem;
}

.confirm-back {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--card);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: var(--text-secondary);
  transition: background 0.2s;
}

.confirm-back:hover {
  background: var(--mode-bg);
}

.attempt-badge {
  background: var(--warning);
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
}

/* Confirm image preview - collapsible */
.confirm-image-toggle {
  width: 100%;
  padding: 10px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  color: var(--text);
  transition: background 0.2s;
}

.confirm-image-toggle:hover {
  background: var(--mode-bg);
}

.confirm-image-toggle .toggle-arrow {
  transition: transform 0.2s;
  color: var(--text-secondary);
}

.confirm-image-toggle.open .toggle-arrow {
  transform: rotate(180deg);
}

.confirm-image-body {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

.confirm-image-body img {
  width: 100%;
  display: block;
  max-height: 250px;
  object-fit: contain;
  background: var(--card);
}

/* Confirm info cards */
.circuit-info {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px;
  border: 1px solid var(--border);
}

.circuit-info h3,
.branches-card h3,
.components-list h3,
.original-image-preview h3 {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.info-row {
  display: flex;
  gap: 8px;
  padding: 5px 0;
  font-size: 0.88rem;
}

.info-label {
  color: var(--text-secondary);
  white-space: nowrap;
  min-width: 72px;
}

.info-value {
  flex: 1;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.branches-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px;
  border: 1px solid var(--border);
}

.branches-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.branch-item {
  font-size: 0.88rem;
  padding: 8px 10px;
  background: var(--mode-bg);
  border-radius: 8px;
  border-left: 3px solid var(--mode-accent);
  line-height: 1.5;
}

.components-list {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px;
  border: 1px solid var(--border);
}

.component-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.component-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--mode-bg);
  border-radius: 10px;
  padding: 8px 12px;
  min-width: 80px;
}

.component-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--mode-accent);
}

.component-type {
  font-size: 0.76rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.info-block {
  background: var(--card);
  border-radius: var(--radius);
  padding: 12px 14px;
  border: 1px solid var(--border);
  font-size: 0.88rem;
  line-height: 1.6;
}

.parse-note-line {
  margin: 3px 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Confirm actions - sticky bottom */
.confirm-actions {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  padding: 12px 16px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
  background: var(--bg);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 20;
}

/* ====================== BUTTONS ====================== */
.btn {
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  width: 100%;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--mode-accent);
  color: white;
}

.btn-primary:hover {
  background: var(--mode-accent-dark);
}

.btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: rgba(0,0,0,0.03);
}

/* ====================== FEEDBACK MODAL ====================== */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}

.modal-content {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 360px;
  width: 100%;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.modal-content h3 {
  font-size: 1rem;
  margin-bottom: 16px;
}

.feedback-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.feedback-option {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  cursor: pointer;
}

.feedback-option input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ====================== RESULT SECTION ====================== */
.result-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-bottom: 20px;
}

/* Mode strip header */
.result-mode-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 0.85rem;
}

.result-mode-strip.strip-fast {
  background: var(--fast-bg);
  border: 1px solid rgba(41, 151, 197, 0.2);
}

.result-mode-strip.strip-precise {
  background: var(--precise-bg);
  border: 1px solid rgba(61, 79, 99, 0.2);
}

.strip-icon {
  font-size: 1.1rem;
}

.strip-name {
  font-weight: 700;
}

.strip-fast .strip-name { color: var(--fast-accent-dark); }
.strip-precise .strip-name { color: var(--precise-accent-dark); }

.strip-note {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-left: auto;
}

.strip-verified {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.72rem;
  font-weight: 600;
  background: rgba(39, 174, 96, 0.12);
  color: #1e8449;
  padding: 2px 8px;
  border-radius: 10px;
}

/* Confidence badge */
.confidence-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 16px;
  font-size: 0.75rem;
  font-weight: 600;
}

.confidence-high { background: rgba(39,174,96,0.15); color: var(--success); }
.confidence-medium { background: rgba(243,156,18,0.15); color: var(--warning); }
.confidence-low { background: rgba(231,76,60,0.15); color: var(--danger); }

.low-confidence-warning {
  background: rgba(243,156,18,0.1);
  border: 1px solid var(--warning);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.6;
}

/* Fast result: answer hero */
.answer-hero {
  background: var(--card);
  border: 2px solid var(--mode-accent);
  border-radius: var(--radius);
  padding: 20px 16px;
  text-align: center;
}

.answer-hero-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.answer-hero-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--mode-accent-dark);
}

.answer-hero-meta {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 8px;
  line-height: 1.5;
}

/* Fast result: compact steps */
.steps-compact {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.step-compact-item {
  padding: 10px 12px;
  border-left: 3px solid var(--mode-accent-light);
  background: var(--card);
  font-size: 0.88rem;
  line-height: 1.6;
  cursor: pointer;
  transition: background 0.2s;
}

.step-compact-item:first-child {
  border-radius: var(--radius) var(--radius) 0 0;
}

.step-compact-item:last-child {
  border-radius: 0 0 var(--radius) var(--radius);
}

.step-compact-item:only-child {
  border-radius: var(--radius);
}

.step-compact-item:not(:last-child) {
  border-bottom: 1px solid var(--border);
}

.step-compact-item:hover {
  background: var(--mode-bg);
}

.step-compact-num {
  display: inline-block;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--mode-bg);
  color: var(--mode-accent);
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
  line-height: 20px;
  margin-right: 8px;
  flex-shrink: 0;
}

.step-compact-detail {
  display: inline;
}

.step-compact-math {
  display: block;
  margin-top: 6px;
  padding: 4px 8px;
  background: var(--mode-bg);
  border-radius: 6px;
  font-size: 0.9rem;
  overflow-x: auto;
  line-height: 1.8;
}

/* Precise result: full steps */
.steps-section {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px;
  border: 1px solid var(--border);
}

.steps-section h3,
.formulas-section h3,
.answer-section h3,
.verification-section h3,
.symbol-legend-section h3,
.var-defs-section h3,
.circuit-info h3,
.original-image-preview h3 {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.steps-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.step-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--card);
  border-left: 3px solid var(--mode-accent-light);
}

.step-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.step-detail {
  font-size: 0.88rem;
  line-height: 1.6;
  margin-bottom: 6px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.step-math-line {
  font-size: 0.92rem;
  padding: 5px 8px;
  margin: 4px 0;
  border-radius: 8px;
  background: var(--mode-bg);
  border: 1px solid var(--border);
  overflow-x: auto;
  line-height: 1.8;
}

.math-inline {
  display: inline;
  vertical-align: middle;
}

.step-plain-hint {
  font-size: 0.82rem;
  line-height: 1.6;
  padding: 7px 10px;
  border-radius: 8px;
  background: rgba(243, 156, 18, 0.1);
  color: #8a5a00;
}

/* Question / target sections */
.question-text-section,
.target-section {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px;
  border: 1px solid var(--border);
}

.question-text-section p,
.target-section p {
  font-size: 0.88rem;
  line-height: 1.6;
}

/* Original image preview in result */
.original-image-preview {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px;
  border: 1px solid var(--border);
}

.original-image-preview img {
  width: 100%;
  border-radius: 8px;
  max-height: 180px;
  object-fit: contain;
  background: var(--card);
  margin-top: 8px;
}

/* Symbol legend */
.symbol-legend-section {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px;
  border: 1px solid var(--border);
}

.symbol-legend-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.symbol-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 5px 8px;
  background: var(--mode-bg);
  border-radius: 8px;
}

.symbol-latex {
  font-size: 0.95rem;
  min-width: 55px;
  color: var(--mode-accent);
  font-weight: 500;
}

.symbol-cn {
  font-size: 0.82rem;
  color: var(--text-secondary);
  flex: 1;
}

/* Variable definitions */
.var-defs-section {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--mode-accent);
}

.var-defs-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.var-def-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 7px 8px;
  background: var(--mode-bg);
  border-radius: 8px;
  line-height: 1.6;
}

.var-def-symbol {
  font-size: 0.95rem;
  min-width: 48px;
  color: var(--mode-accent);
  font-weight: 600;
  flex-shrink: 0;
  padding-top: 1px;
}

.var-def-body {
  font-size: 0.85rem;
  color: var(--text);
  flex: 1;
}

.var-def-name {
  font-weight: 600;
  color: var(--text);
}

.var-def-step {
  display: inline-block;
  font-size: 0.72rem;
  background: var(--mode-bg);
  color: var(--mode-accent);
  padding: 1px 6px;
  border-radius: 10px;
  margin-left: 4px;
  vertical-align: middle;
}

.var-defs-extra {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.var-defs-toggle {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 8px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--mode-accent);
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.2s;
}

.var-defs-toggle:hover {
  background: var(--mode-bg);
}

/* Formulas section */
.formulas-section {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px;
  border: 1px solid var(--border);
  overflow-x: auto;
}

.formulas-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.formula-item {
  font-size: 0.92rem;
  padding: 6px 0;
  overflow-x: auto;
  border-bottom: 1px dashed var(--border);
}

.formula-line-no {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 3px;
}

.formula-body {
  background: var(--mode-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 8px;
  overflow-x: auto;
}

.formula-body.formula-fallback {
  font-family: 'Courier New', monospace;
  color: var(--text-secondary);
  font-size: 0.88rem;
}

/* Answer section (precise mode) */
.answer-section {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px;
  border: 2px solid var(--mode-accent);
}

.answer-box {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--mode-accent-dark);
}

/* Verification */
.verification-section {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px;
  border: 1px solid var(--border);
}

.verification-banner {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 10px;
}

.verification-banner.vb-pass {
  background: rgba(39, 174, 96, 0.1);
  color: var(--success);
  border: 1px solid rgba(39, 174, 96, 0.2);
}

.verification-banner.vb-warn {
  background: rgba(243, 156, 18, 0.1);
  color: var(--warning);
  border: 1px solid rgba(243, 156, 18, 0.2);
}

.verification-banner.vb-fail {
  background: rgba(231, 76, 60, 0.1);
  color: var(--danger);
  border: 1px solid rgba(231, 76, 60, 0.2);
}

.verification-items {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.verification-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.verification-label {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.verification-status {
  font-size: 1.1rem;
}

.status-icon.pass { color: var(--success); }
.status-icon.warn { color: var(--warning); }
.status-icon.fail { color: var(--danger); }

.consistency-notes {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 8px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.consistency-notes-list {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.consistency-note-item {
  font-size: 0.78rem;
  color: var(--text-secondary);
  padding: 4px 8px;
  background: rgba(0,0,0,0.02);
  border-radius: 6px;
  line-height: 1.5;
}

/* Switch mode hint card */
.switch-mode-card {
  background: var(--card);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
}

.switch-mode-card p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 10px;
  line-height: 1.5;
}

.switch-mode-btn {
  display: inline-block;
  padding: 8px 22px;
  border: 1px solid var(--mode-accent);
  border-radius: 20px;
  background: transparent;
  color: var(--mode-accent);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.switch-mode-btn:hover {
  background: var(--mode-bg);
}

/* Result actions */
.result-actions {
  padding-top: 4px;
}
