/* ============================================================
   AllToolio — style wspólne dla narzędzi (tools/*)
   ============================================================ */

.tool-main {
  padding: 2rem 0 3rem;
}

.tool-head {
  margin-bottom: 1.5rem;
}

.tool-head h1 {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 900;
  letter-spacing: -0.01em;
  margin-bottom: 0.35rem;
}

.tool-head p {
  color: var(--text-muted);
}

/* Link powrotu w nagłówku narzędzia */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.92rem;
  text-decoration: none;
}

.back-link:hover {
  color: var(--text);
  text-decoration: none;
}

/* ---------- PANELE ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem;
  box-shadow: var(--shadow);
}

.panel + .panel {
  margin-top: 1.25rem;
}

.panel h2,
.panel h3 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

/* ---------- PRZYCISKI ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  transition: all 0.15s ease;
  text-decoration: none;
}

.btn:hover {
  background: var(--surface-hover);
  transform: translateY(-1px);
}

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

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

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-strong);
  border-color: var(--primary-strong);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-muted);
}

.btn-ghost:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.82rem;
}

.btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* ---------- FORMULARZE ---------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.field label {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-muted);
}

input[type="text"],
input[type="number"],
input[type="search"],
input[type="file"],
input[type="date"],
input[type="datetime-local"],
input[type="time"],
input[type="email"],
input[type="url"],
select,
textarea {
  width: 100%;
  padding: 0.6rem 0.8rem;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

textarea {
  resize: vertical;
  min-height: 120px;
  line-height: 1.5;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

input[type="range"] {
  padding: 0;
  accent-color: var(--primary);
  cursor: pointer;
}

input[type="range"]:focus {
  box-shadow: none;
}

input[type="checkbox"] {
  accent-color: var(--primary);
}

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

/* ---------- TABY (pod-nawigacja narzędzia) ---------- */
.tab-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.tab-btn {
  padding: 0.55rem 1rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.15s ease;
}

.tab-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.tab-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* ---------- KARTY FISZEK ---------- */
.flashcard-box {
  min-height: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  background: var(--bg);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  user-select: none;
  transition: border-color 0.15s ease;
}

.flashcard-box:hover {
  border-color: var(--primary);
}

.flashcard-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.flashcard-value {
  font-size: 1.7rem;
  font-weight: 800;
  line-height: 1.3;
  word-break: break-word;
}

.flashcard-value.answer {
  color: var(--primary);
}

/* ---------- QUIZ ---------- */
.quiz-question {
  font-size: 1.35rem;
  font-weight: 800;
  margin-bottom: 1.25rem;
  line-height: 1.35;
}

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

.answer-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  text-align: left;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 12px;
  cursor: pointer;
  font-family: inherit;
  font-size: 1rem;
  transition: all 0.14s ease;
}

.answer-btn:hover:not(:disabled) {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.answer-btn:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--primary) 45%, transparent);
  outline-offset: 2px;
}

.quiz-timer {
  min-width: 4.5rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.quiz-timer.urgent {
  color: var(--danger);
  animation: quiz-pulse 0.9s ease-in-out infinite alternate;
}

@keyframes quiz-pulse {
  from { opacity: 1; }
  to { opacity: 0.62; }
}

.quiz-feedback {
  margin: 0.85rem 0 0;
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  font-weight: 700;
}

.quiz-feedback.correct {
  background: #dcfce7;
  color: #14532d;
}

.quiz-feedback.wrong {
  background: #fee2e2;
  color: #7f1d1d;
}

[data-theme="dark"] .quiz-feedback.correct {
  background: #052e16;
  color: #bbf7d0;
}

[data-theme="dark"] .quiz-feedback.wrong {
  background: #450a0a;
  color: #fecaca;
}

.answer-letter {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border-radius: 8px;
  background: var(--surface-hover);
  font-weight: 800;
  font-size: 0.9rem;
}

.answer-btn.correct {
  background: #dcfce7;
  border-color: #22c55e;
  color: #14532d;
}

[data-theme="dark"] .answer-btn.correct {
  background: #052e16;
  border-color: #16a34a;
  color: #bbf7d0;
}

.answer-btn.wrong {
  background: #fee2e2;
  border-color: #ef4444;
  color: #7f1d1d;
}

[data-theme="dark"] .answer-btn.wrong {
  background: #450a0a;
  border-color: #dc2626;
  color: #fecaca;
}

/* ---------- WYNIKI ---------- */
.score-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
}

.score-card {
  padding: 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  text-align: center;
}

.score-card .score-rank {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.score-card .score-name {
  margin: 0.2rem 0 0.55rem;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.score-card .value {
  font-size: 1.7rem;
  font-weight: 900;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
}

.score-card .caption {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.score-card .score-details {
  margin-top: 0.35rem;
  line-height: 1.45;
}

.score-card.winner {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 18%, transparent);
}

.score-winner {
  margin-top: 0.65rem;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.results-summary {
  margin: -0.45rem 0 0;
  color: var(--text-muted);
  font-weight: 700;
}

.password-strength {
  margin-top: 0.75rem;
  padding: 0.7rem 0.8rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(79, 70, 229, 0.04);
  color: var(--text);
  font-weight: 700;
  min-height: 2.8rem;
  display: flex;
  align-items: center;
}

.password-strength.empty {
  opacity: 0.65;
  background: transparent;
}

.password-strength.weak {
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.08);
  color: #b91c1c;
}

.password-strength.medium {
  border-color: rgba(245, 158, 11, 0.4);
  background: rgba(245, 158, 11, 0.08);
  color: #92400e;
}

.password-strength.good {
  border-color: rgba(59, 130, 246, 0.4);
  background: rgba(59, 130, 246, 0.08);
  color: #1d4ed8;
}

.password-strength.strong {
  border-color: rgba(34, 197, 94, 0.4);
  background: rgba(34, 197, 94, 0.08);
  color: #166534;
}

.frequency-list {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

.frequency-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.6rem 0.8rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.frequency-rank {
  min-width: 2rem;
  color: var(--primary);
  font-weight: 800;
}

.frequency-word {
  flex: 1;
  font-weight: 700;
}

.frequency-count {
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  font-weight: 800;
}

.frequency-empty {
  color: var(--text-muted);
  padding: 0.8rem;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: transparent;
}

/* ---------- OBRAZ ---------- */
.image-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.image-canvas-wrap {
  width: 100%;
  max-width: 100%;
  overflow: auto;
  background:
    linear-gradient(45deg, var(--surface-hover) 25%, transparent 25%),
    linear-gradient(-45deg, var(--surface-hover) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--surface-hover) 75%),
    linear-gradient(-45deg, transparent 75%, var(--surface-hover) 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

#image-canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

.controls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.control-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
}

.control-group output {
  color: var(--primary);
  font-weight: 700;
}

/* ---------- CSV / EXCEL ---------- */
.csv-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  max-height: 440px;
  overflow-y: auto;
}

.csv-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.88rem;
}

.csv-table th,
.csv-table td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}

.csv-table th {
  position: sticky;
  top: 0;
  background: var(--bg-alt);
  font-weight: 700;
  cursor: pointer;
  user-select: none;
}

.csv-table th:hover {
  color: var(--primary);
}

.csv-table tr:hover td {
  background: var(--surface-hover);
}

.stat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.stat-chip {
  padding: 0.35rem 0.7rem;
  background: var(--primary-soft);
  color: var(--primary);
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
}

.copy-area {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

/* ---------- WSKAZÓWKI / STATUS ---------- */
.hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

.status {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  margin-top: 0.75rem;
}

.status.ok {
  background: #dcfce7;
  color: #14532d;
}

.status.err {
  background: #fee2e2;
  color: #7f1d1d;
}

[data-theme="dark"] .status.ok {
  background: #052e16;
  color: #bbf7d0;
}

[data-theme="dark"] .status.err {
  background: #450a0a;
  color: #fecaca;
}

/* ---------- GRID UKŁADU ---------- */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

/* ---------- LISTA TALII / ELEMENTÓW ---------- */
.list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.list-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 0.8rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.list-item .grow {
  flex-grow: 1;
}

.hidden {
  display: none !important;
}

/* ---------- KALKULATOR ---------- */
.calculator {
  max-width: 440px;
  margin-inline: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.calc-display {
  position: relative;
  padding: 1.25rem 1.5rem;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
  min-height: 120px;
}

.calc-history {
  min-height: 1.4rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  overflow-y: auto;
  max-height: 60px;
}

.calc-history div {
  white-space: pre-wrap;
  word-break: break-all;
}

.calc-input {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  word-break: break-all;
  line-height: 1.2;
  text-align: right;
}

.calc-mode {
  position: absolute;
  top: 0.75rem;
  right: 1rem;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: 0.06em;
}

.calc-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.4rem;
  padding: 0.75rem;
}

.calc-btn {
  height: 52px;
  border: none;
  background: var(--surface-2);
  color: var(--text);
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  border-radius: 11px;
  cursor: pointer;
  transition: background 0.12s ease, transform 0.08s ease;
}

.calc-btn:hover {
  background: var(--surface-hover);
}

.calc-btn:active {
  transform: scale(0.96);
}

.calc-btn.calc-fn {
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 0.85rem;
}

.calc-btn.calc-fn:hover {
  background: color-mix(in srgb, var(--primary-soft) 80%, var(--primary));
  color: #fff;
}

.calc-btn.calc-op {
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 1.2rem;
}

.calc-btn.calc-op:hover {
  background: var(--accent);
  color: #fff;
}

.calc-btn.calc-eq {
  background: var(--primary);
  color: #fff;
  font-size: 1.3rem;
}

.calc-btn.calc-eq:hover {
  background: var(--primary-strong);
}

/* ---------- OCR (FISZKI) ---------- */
.ocr-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
  margin-bottom: 1rem;
}

.ocr-options .field {
  margin-bottom: 0;
}

.ocr-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 1.75rem;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.ocr-drop:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.ocr-drop.dragover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.ocr-progress {
  margin: 1rem 0;
}

.ocr-progress-track {
  width: 100%;
  height: 10px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
}

.ocr-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--primary);
  border-radius: 999px;
  transition: width 0.2s ease;
}

.ocr-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
}

.ocr-preview {
  margin: 1rem 0;
  text-align: center;
}

.ocr-preview img {
  max-height: 260px;
  margin-inline: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

/* Pary rozpoznanych słówek */
.ocr-pairs {
  margin-top: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.ocr-pairs-header {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem;
  background: var(--bg-alt);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.ocr-pair {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 0.5rem;
  align-items: center;
  padding: 0.55rem 0.75rem;
  border-top: 1px solid var(--border);
}

.ocr-pair input {
  font-size: 0.92rem;
}

.ocr-pair .btn {
  padding: 0.35rem 0.6rem;
  font-size: 0.8rem;
}

.ocr-add-all {
  margin-top: 0.9rem;
}

/* ---------- KALKULATOR SYMBOLICZNY ---------- */
.symbolic-input-row {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.symbolic-input {
  flex: 1 1 260px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1.05rem;
}

.symbolic-ops {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.symbolic-op-btn {
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.15s ease;
}

.symbolic-op-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}

.symbolic-output {
  margin: 1rem 0 0.25rem;
  padding: 0.9rem 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1.15rem;
  word-break: break-word;
  white-space: pre-wrap;
}

.symbolic-steps {
  margin: 1rem 0;
}

.symbolic-steps-title {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 0.6rem;
}

.step-item {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.step-item + .step-item {
  margin-top: 0.5rem;
}

.step-num {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 800;
  font-size: 0.78rem;
}

.step-body {
  min-width: 0;
}

.step-text {
  font-size: 0.9rem;
  line-height: 1.45;
}

.step-expr {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9rem;
  color: var(--primary);
  margin-top: 0.15rem;
  word-break: break-word;
}

/* Wykres */
.symbolic-plot {
  margin-top: 1.25rem;
}

.symbolic-plot canvas {
  display: block;
  width: 100%;
  height: auto;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  touch-action: none;
  cursor: grab;
}

.symbolic-plot canvas:active {
  cursor: grabbing;
}

.symbolic-plot-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
}

/* Historia symboliczna */
.symbolic-history {
  margin-top: 1.5rem;
}

.symbolic-history-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.6rem;
}

.symbolic-history-title h3 {
  margin-bottom: 0;
}

.symbolic-history-item {
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.14s ease;
}

.symbolic-history-item:hover {
  border-color: var(--primary);
}

.symbolic-history-item + .symbolic-history-item {
  margin-top: 0.5rem;
}

.symbolic-history-item .op {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.symbolic-history-item .expr {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9rem;
  word-break: break-word;
}

.symbolic-history-item .out {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88rem;
  color: var(--primary);
  word-break: break-word;
}

.symbolic-error {
  color: var(--danger);
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

/* ---------- RESPONSYWNOŚĆ ---------- */
@media (max-width: 800px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }

  .tool-main {
    padding: 1.5rem 0 2.5rem;
  }

  .flashcard-value {
    font-size: 1.3rem;
  }

  .ocr-pairs-header,
  .ocr-pair {
    grid-template-columns: 1fr 1fr auto;
    gap: 0.4rem;
  }
}
/* Diff: side-by-side + unified (MIC-953) */
.diff-sbs-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.6rem;
  align-items: start;
  padding: 0.45rem 0.6rem;
  border-radius: 0.7rem;
  border: 1px solid var(--border);
  background: rgba(148, 163, 184, 0.06);
}

.diff-sbs-side {
  display: flex;
  gap: 0.5rem;
  min-width: 0;
}

.diff-sbs-num {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.78rem;
  user-select: none;
  min-width: 1.5rem;
  text-align: right;
}

.diff-sbs-content {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9rem;
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 1.2em;
}

.diff-sbs-row.added { border-color: rgba(34, 197, 94, 0.45); background: rgba(34, 197, 94, 0.08); }
.diff-sbs-row.removed { border-color: rgba(239, 68, 68, 0.45); background: rgba(239, 68, 68, 0.08); }
.diff-sbs-row.unchanged { background: rgba(148, 163, 184, 0.03); }

.diff-unified-row {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  padding: 0.45rem 0.6rem;
  border-radius: 0.7rem;
  border: 1px solid var(--border);
  background: rgba(148, 163, 184, 0.06);
}

.diff-unified-sign {
  width: 1em;
  flex: 0 0 auto;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9rem;
  user-select: none;
}

.diff-unified-content {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9rem;
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 1.2em;
}

.diff-unified-row.added { border-color: rgba(34, 197, 94, 0.45); background: rgba(34, 197, 94, 0.08); }
.diff-unified-row.removed { border-color: rgba(239, 68, 68, 0.45); background: rgba(239, 68, 68, 0.08); }
.diff-unified-row.unchanged { background: rgba(148, 163, 184, 0.03); }
.diff-unified-row.added .diff-unified-sign { color: #22c55e; }
.diff-unified-row.removed .diff-unified-sign { color: #ef4444; }

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

/* ============ Wayfinding redesign (2026-09-25) ============ */
.back-link {
  display: none;
}

.tool-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: 1.1rem;
  align-items: center;
}

.tool-head > :not(.tool-tile) {
  grid-column: 2;
}

.tool-head .tool-tile {
  grid-row: 1 / span 2;
  width: 64px;
  height: 64px;
  border-radius: 18px;
}

.tool-head h1 {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.035em;
}

@media (max-width: 560px) {
  .tool-head .tool-tile {
    width: 52px;
    height: 52px;
    border-radius: 15px;
  }
}
