/* Solver page v2 */
.solver-page {
  max-width: 720px;
}

.solver-intro {
  margin-bottom: 1.5rem;
  color: var(--text-muted);
}

.solver-controls {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.solver-controls label {
  font-weight: 500;
}

.hint {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.solver-controls select {
  padding: 0.6rem 1rem;
  font-size: 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text);
  max-width: 400px;
}

.quick-input label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}

.or-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.25rem 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.or-divider::before,
.or-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* Examples */
.examples-area {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  min-height: 1.5rem;
}

.examples-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.example-btn {
  padding: 0.25rem 0.6rem;
  font-size: 0.82rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  font-family: 'Cambria Math', 'Times New Roman', serif;
}

.example-btn:hover {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}

/* Manual inputs */
.manual-inputs {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.input-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.input-row label {
  min-width: 180px;
  font-size: 0.95rem;
}

.input-row .input-answer {
  max-width: 200px;
}

/* Solution output */
.solution-output {
  margin-top: 1.5rem;
}

/* Step timeline */
.solution-step {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--bg);
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
  position: relative;
}

.step-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  min-width: 1.75rem;
  border-radius: 50%;
  background: var(--border);
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 600;
}

.step-badge.final {
  background: var(--correct);
  color: white;
}

.step-content {
  flex: 1;
  min-width: 0;
}

.step-text {
  font-family: 'Cambria Math', 'Times New Roman', serif;
  font-size: 1rem;
  line-height: 1.5;
  word-wrap: break-word;
}

.solution-step.highlight {
  background: rgba(46, 204, 113, 0.1);
  border: 1px solid var(--correct);
}

.solution-step.highlight .step-text {
  font-weight: 600;
}

/* Why toggle */
.why-toggle {
  display: inline-block;
  margin-top: 0.35rem;
  padding: 0.15rem 0.5rem;
  font-size: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.2s;
}

.why-toggle:hover {
  background: var(--border);
}

.why-box {
  display: none;
  margin-top: 0.35rem;
  padding: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.why-box.show {
  display: block;
}

/* Copy button */
.copy-btn {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  align-self: center;
}

.copy-btn:hover {
  background: var(--border);
}

/* Synthetic division table */
.solution-step-table {
  margin-bottom: 0.5rem;
  overflow-x: auto;
}

.synth-table {
  border-collapse: collapse;
  font-family: 'Cambria Math', 'Times New Roman', serif;
  font-size: 1rem;
  margin: 0.5rem auto;
}

.synth-table td {
  padding: 0.4rem 0.75rem;
  text-align: center;
  min-width: 2.5rem;
}

.synth-table .synth-c {
  border-right: 2px solid var(--text);
  font-weight: 600;
}

.synth-table .synth-divisor td {
  border-bottom: none;
}

.synth-table .synth-mults td {
  color: var(--accent);
  font-size: 0.9rem;
}

.synth-table .synth-result td {
  border-top: 2px solid var(--text);
  font-weight: 600;
}

.synth-table .synth-remainder {
  color: var(--correct);
  border-left: 2px solid var(--text);
}

/* Error message */
.error-msg {
  color: var(--incorrect);
  line-height: 1.8;
}
.error-msg code {
  background: var(--bg);
  padding: 0.15em 0.4em;
  border-radius: 3px;
  font-size: 0.9em;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

/* History */
.history-section {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.history-section h3 {
  font-size: 1rem;
  margin: 0 0 0.75rem 0;
  color: var(--text-muted);
}

#history-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.history-item {
  padding: 0.3rem 0.7rem;
  font-size: 0.8rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-item:hover {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}

.solution-placeholder {
  color: var(--text-muted);
  font-style: italic;
}

@media (max-width: 600px) {
  .input-row { flex-direction: column; align-items: flex-start; }
  .input-row label { min-width: auto; }
  .input-row .input-answer { max-width: 100%; }
}
