.number-pad {
  width: min(100%, 560px);
  margin: 14px auto 0;
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 8px;
}

.number-pad button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
  color: var(--ink);
  font-weight: 700;
}

.number-pad button:last-child {
  font-size: 0.82rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.primary-actions {
  justify-content: center;
}

.solve-options {
  max-width: 520px;
  margin: 14px auto 0;
}

.loader-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: stretch;
  margin-bottom: 14px;
}

.checkbox-option {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px;
  background: var(--surface-soft);
  color: var(--ink);
  cursor: pointer;
}

.checkbox-option input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--accent);
}

.checkbox-option span,
.checkbox-option small {
  display: block;
}

.checkbox-option strong {
  display: block;
  font-size: 0.95rem;
}

.checkbox-option small {
  margin-top: 3px;
  color: var(--muted);
  line-height: 1.35;
}

.checkbox-option.compact-option {
  max-width: 420px;
  padding: 10px 12px;
}

.checkbox-option.compact-option strong {
  font-size: 0.9rem;
}

.button {
  border: 1px solid var(--line);
  border-radius: 14px;
  min-height: 44px;
  padding: 11px 14px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
  transition: transform 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}

.button:hover:not(:disabled),
.number-pad button:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: var(--accent);
}

.button:disabled,
.number-pad button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.library-choice-card:disabled,
.library-choice-card.is-disabled {
  cursor: not-allowed;
  opacity: 0.6;
  transform: none;
  box-shadow: none;
}

.library-choice-card:disabled:hover,
.library-choice-card.is-disabled:hover,
.library-choice-card:disabled:focus-visible,
.library-choice-card.is-disabled:focus-visible {
  transform: none;
  border-color: var(--line);
  box-shadow: none;
}

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

.button.primary:hover:not(:disabled) {
  background: var(--accent-strong);
}

.button.ghost {
  background: transparent;
}

.field-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  min-height: 44px;
  padding: 12px;
  background: var(--surface);
  color: var(--ink);
}


.scan-file-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.scan-file-button {
  cursor: pointer;
}

.scan-file-name {
  min-width: 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}



.scan-access-cta {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  border: 1px solid rgba(37, 99, 235, 0.16);
  border-radius: 18px;
  padding: 16px;
  background: radial-gradient(circle at 12% 15%, rgba(37, 99, 235, 0.13), transparent 36%), radial-gradient(circle at 88% 10%, rgba(16, 185, 129, 0.11), transparent 35%), #fff;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.08);
}

.scan-access-cta[hidden] {
  display: none;
}

.scan-access-cta h3 {
  margin: 4px 0 6px;
  font-size: 1.12rem;
  letter-spacing: -0.03em;
}

.scan-access-cta p {
  margin: 0;
  color: var(--muted);
  font-weight: 650;
  line-height: 1.45;
}

.scan-access-cta-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: end;
  gap: 10px;
}

.scan-import-layout[hidden] {
  display: none;
}

@media (max-width: 760px) {
  .scan-access-cta {
    grid-template-columns: 1fr;
  }

  .scan-access-cta-actions {
    justify-content: stretch;
  }

  .scan-access-cta-actions .button {
    flex: 1 1 auto;
  }
}

.scan-source-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
}

.scan-edit-button[hidden] {
  display: none;
}

.scan-import-layout {
  display: grid;
  grid-template-columns: minmax(240px, 0.78fr) minmax(320px, 1.22fr);
  gap: 16px;
  align-items: start;
}

.scan-import-source,
.scan-import-review {
  min-width: 0;
}

.scan-preview {
  display: block;
  width: 100%;
  max-height: 420px;
  object-fit: contain;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-soft);
}

.scan-preview[hidden] {
  display: none;
}


.scan-prep-actions {
  margin-top: 12px;
}

.scan-prep-panel {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 12px;
  background: var(--surface-soft);
}

.scan-prep-panel[hidden] {
  display: none;
}

.scan-prep-heading h3 {
  margin: 0 0 4px;
  font-size: 0.95rem;
  letter-spacing: -0.02em;
}

.scan-detected-canvas {
  display: block;
  width: min(100%, 420px);
  aspect-ratio: 1;
  border: 2px solid var(--line-strong);
  border-radius: 14px;
  background: var(--surface);
  margin: 12px 0;
}

.scan-detected-canvas {
  aspect-ratio: auto;
  max-height: 360px;
  object-fit: contain;
}


.scan-review-heading {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
  margin-bottom: 10px;
}

.scan-review-heading h3 {
  margin: 0;
  font-size: 1rem;
  letter-spacing: -0.02em;
}

.scan-review-count {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 7px 10px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
}

.scan-review-grid {
  width: min(100%, 430px);
  aspect-ratio: 1;
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  grid-template-rows: repeat(9, 1fr);
  border: 3px solid var(--line-strong);
  border-radius: 14px;
  overflow: hidden;
  background: var(--line-strong);
  margin-bottom: 14px;
}

.scan-cell {
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
  border: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  text-align: center;
  font-size: clamp(1rem, 3vw, 1.65rem);
  font-weight: 800;
  outline: none;
  transition: background 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
  touch-action: manipulation;
  -moz-appearance: textfield;
}

.scan-cell::-webkit-outer-spin-button,
.scan-cell::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.scan-cell:nth-child(3n) {
  border-right: 3px solid var(--line-strong);
}

.scan-cell:nth-child(9n) {
  border-right: 0;
}

.scan-cell:nth-child(n + 19):nth-child(-n + 27),
.scan-cell:nth-child(n + 46):nth-child(-n + 54) {
  border-bottom: 3px solid var(--line-strong);
}

.scan-cell:nth-child(n + 73) {
  border-bottom: 0;
}

.scan-cell.is-filled {
  background: var(--given-bg);
  color: var(--given-ink);
}

.scan-cell.is-conflict {
  background: var(--bad);
  color: var(--bad-ink);
}

.scan-cell.is-ocr-recognized {
  box-shadow: inset 0 0 0 2px rgba(124, 58, 237, 0.35);
}

.scan-cell.is-ocr-low-confidence:not(.is-conflict) {
  background: var(--surface);
  color: var(--given-ink);
  box-shadow: inset 0 0 0 3px rgba(245, 158, 11, 0.55);
}

.scan-cell.is-ocr-rule-resolved:not(.is-conflict) {
  box-shadow: inset 0 0 0 2px rgba(22, 163, 74, 0.48);
}

.scan-cell.is-ocr-auto-corrected:not(.is-conflict) {
  background: var(--good);
  color: var(--good-ink);
}

.scan-cell::selection {
  background: rgba(245, 158, 11, 0.22);
  color: var(--given-ink);
}

.scan-cell.is-active {
  box-shadow: inset 0 0 0 4px var(--accent);
  z-index: 2;
}

.scan-actions {
  margin-bottom: 12px;
}

.scan-import-status {
  margin-top: 12px;
}

.status-box {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  background: var(--surface-soft);
  color: var(--muted);
  line-height: 1.55;
}

.status-box.is-ok {
  background: var(--good);
  border-color: #86efac;
  color: var(--good-ink);
}

.status-box.is-warn {
  background: var(--warn);
  border-color: #fde68a;
  color: var(--warn-ink);
}

.status-box.is-bad {
  background: var(--bad);
  border-color: #fecaca;
  color: var(--bad-ink);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0 0;
}

.stats-grid div {
  border: 1px solid var(--line);
  border-radius: 14px;
  min-height: 44px;
  padding: 12px;
  background: var(--surface-soft);
}

.stats-grid dt {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.stats-grid dd {
  margin: 4px 0 0;
  font-size: 1.18rem;
  font-weight: 700;
}

.button.small {
  padding: 8px 12px;
  font-size: 0.82rem;
}


.scan-experiment-panel {
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.scan-experiment-panel[hidden] {
  display: none;
}

.scan-experiment-heading h4 {
  margin: 0 0 4px;
  font-size: 0.9rem;
  letter-spacing: -0.01em;
}


.scan-experiment-path {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.scan-experiment-path > h5 {
  margin: 0;
  font-size: 0.9rem;
  letter-spacing: -0.01em;
}

.scan-experiment-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-top: 0;
}

.scan-experiment-figure {
  margin: 0;
}

.scan-experiment-figure figcaption {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.scan-experiment-canvas {
  display: block;
  width: min(100%, 420px);
  border: 2px dashed var(--line-strong);
  border-radius: 14px;
  background: var(--surface);
}

.scan-experiment-box-section,
.scan-experiment-blankness-section {
  margin-top: 14px;
}

.scan-experiment-box-section h5,
.scan-experiment-blankness-section h5 {
  margin: 0 0 4px;
  font-size: 0.85rem;
  letter-spacing: -0.01em;
}

.scan-experiment-blankness-canvas {
  margin-top: 0;
}

.scan-experiment-box-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  max-width: 420px;
  margin-top: 0;
}

.scan-experiment-box-figure {
  margin: 0;
}

.scan-experiment-box-figure figcaption {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.scan-experiment-box-canvas {
  display: block;
  width: 100%;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
}

@media (max-width: 760px) {
  .scan-experiment-box-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 420px) {
  .scan-experiment-box-grid {
    grid-template-columns: 1fr;
  }
}

.scan-evidence-panel {
  margin: 12px 0 14px;
  padding-top: 4px;
}

.scan-evidence-panel[hidden] {
  display: none;
}

.scan-evidence-grid {
  width: min(100%, 430px);
  aspect-ratio: 1;
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  grid-template-rows: repeat(9, 1fr);
  border: 3px solid var(--line-strong);
  border-radius: 14px;
  overflow: hidden;
  background: var(--line-strong);
  margin-top: 0;
}

.scan-evidence-cell {
  position: relative;
  min-width: 0;
  min-height: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background-color: var(--surface);
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.scan-evidence-cell:nth-child(3n) {
  border-right: 3px solid var(--line-strong);
}

.scan-evidence-cell:nth-child(9n) {
  border-right: 0;
}

.scan-evidence-cell:nth-child(n + 19):nth-child(-n + 27),
.scan-evidence-cell:nth-child(n + 46):nth-child(-n + 54) {
  border-bottom: 3px solid var(--line-strong);
}

.scan-evidence-cell:nth-child(n + 73) {
  border-bottom: 0;
}


.scan-evidence-audit-section[hidden] {
  display: none;
}

.scan-evidence-audit-scroll {
  width: min(100%, 920px);
  max-height: 380px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.scan-evidence-audit-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.72rem;
  line-height: 1.35;
}

.scan-evidence-audit-table th,
.scan-evidence-audit-table td {
  vertical-align: top;
  border-bottom: 1px solid var(--line);
  padding: 7px 8px;
  text-align: left;
}

.scan-evidence-audit-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-soft);
  color: var(--muted);
  font-weight: 700;
}

.scan-evidence-audit-table td:first-child,
.scan-evidence-audit-table th:first-child {
  white-space: nowrap;
  font-weight: 700;
}

.scan-evidence-audit-table .audit-winner {
  color: var(--accent-strong);
  font-weight: 700;
}

.scan-evidence-audit-table .audit-muted {
  color: var(--muted);
}

.material-symbols-outlined {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: "Material Symbols Outlined";
  font-weight: normal;
  font-style: normal;
  font-size: 1.18em;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  font-feature-settings: "liga";
  -webkit-font-feature-settings: "liga";
  -webkit-font-smoothing: antialiased;
  font-variation-settings: "FILL" 0, "wght" 500, "GRAD" 0, "opsz" 24;
}

.install-app-button {
  gap: 8px;
  white-space: nowrap;
}

.install-app-button .install-app-icon {
  flex: 0 0 auto;
}

.install-app-button .install-app-label {
  min-width: 0;
}

.install-app-button.is-ios-install {
  border-color: rgba(37, 99, 235, 0.38);
  color: var(--accent-strong);
}

.install-app-instructions {
  margin-top: 10px;
  border: 1px solid rgba(37, 99, 235, 0.2);
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--ink);
  padding: 11px 13px;
  line-height: 1.45;
}

/* MPA polish: keep Material Symbols vertically centered inside action buttons. */
.material-symbols-outlined {
  display: inline-block;
  width: 1em;
  height: 1em;
  overflow: hidden;
  font-family: "Material Symbols Outlined";
  font-weight: normal;
  font-style: normal;
  font-size: 22px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  white-space: nowrap;
  direction: ltr;
  font-feature-settings: "liga";
  -webkit-font-feature-settings: "liga";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-variation-settings: "FILL" 0, "wght" 500, "GRAD" 0, "opsz" 24;
  vertical-align: -0.125em;
}

.install-app-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  line-height: 1;
}

.install-app-button .install-app-icon {
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  font-size: 22px;
  line-height: 1;
}

.install-app-button .install-app-label {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  line-height: 1;
}

.scan-image-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  line-height: 1;
}

.scan-image-label .scan-image-icon {
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  font-size: 22px;
  line-height: 1;
}

.scan-image-label .scan-image-label-text {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  line-height: 1;
}
