.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 12px 16px;
  margin-top: 22px;
  color: var(--muted);
  font-size: 0.9rem;
}


.api-status-mini {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 10px;
  background: var(--surface-soft);
  white-space: nowrap;
}

.api-status-mini strong {
  color: var(--ink);
}

.footer-action {
  border: 1px solid var(--line);
  border-radius: 999px;
  min-height: 36px;
  padding: 8px 12px;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 800;
}

.footer-action:hover:not(:disabled) {
  border-color: var(--accent);
}

.status-dot {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: #f59e0b;
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.15);
}

.status-dot.is-ok {
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.15);
}

.status-dot.is-bad {
  background: #ef4444;
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.15);
}

@media (max-width: 1100px) {
  .primary-workspace,
  .support-workspace {
    grid-template-columns: 1fr;
  }

  .right-workspace {
    grid-template-rows: auto auto;
  }

  .walkthrough-panel {
    max-height: none;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .help-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .scan-import-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 10px;
  }

  .board-panel,
  .card,
  .walkthrough-panel {
    padding: 14px;
    border-radius: 18px;
  }

  .panel-heading {
    flex-direction: column;
  }

  .status-heading {
    flex-direction: row;
    align-items: center;
  }

  .status-heading .api-status-mini {
    padding: 6px 8px;
    font-size: 0.78rem;
  }

  .board-meta {
    justify-content: flex-start;
    flex-wrap: nowrap;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
  }

  .board-meta > * {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .board-mobile-nav-row:not([hidden]) {
    display: block;
    width: 100%;
    max-width: 100%;
    margin-top: -4px;
  }

  .board-mobile-nav-row .mobile-walkthrough-nav:not([hidden]) {
    display: inline-flex;
    width: 100%;
    max-width: 100%;
  }

  .board-status-pill,
  .pill-toggle,
  .pill-action {
    padding: 6px 8px;
    font-size: 0.76rem;
    min-height: 30px;
  }

  .board-meta.is-mobile-walkthrough {
    width: 100%;
  }

  .board-meta.is-mobile-walkthrough #boardMode {
    display: none;
  }

  .board-panel.is-mobile-review .board-heading {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 10px;
    row-gap: 8px;
  }

  .board-panel.is-mobile-review .board-heading > div:first-child {
    grid-column: 1;
    min-width: 0;
  }

  .board-panel.is-mobile-review .board-meta.is-mobile-walkthrough {
    display: contents;
    width: auto;
    max-width: none;
    overflow: visible;
  }

  .board-panel.is-mobile-review #assistHighlights {
    grid-column: 2;
    justify-self: end;
    min-width: 0;
  }

  .board-panel.is-mobile-review .board-mobile-nav-row:not([hidden]) {
    grid-column: 1 / -1;
    display: block;
    width: 100%;
    max-width: 100%;
    margin-top: 0;
  }

  .board-panel.is-mobile-review .mobile-walkthrough-nav:not([hidden]) {
    display: inline-flex;
    width: 100%;
    max-width: 100%;
  }

  .number-pad {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
  }

  .number-pad button {
    min-height: 48px;
  }

  .actions .button {
    flex: 1 1 auto;
  }

  
.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,
.scan-prepared-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 {
    flex-direction: column;
  }

  .scan-review-grid {
    width: 100%;
  }

  .walkthrough-controls {
    display: none;
  }

  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
    gap: 8px;
  }

  .stats-grid div {
    min-height: 40px;
    padding: 10px;
  }

  .stats-grid dd {
    font-size: 1.05rem;
  }

  .help-grid {
    grid-template-columns: 1fr;
  }

  .assist-help-card {
    grid-column: 1;
  }

  .assist-example-grid {
    grid-template-columns: 1fr;
  }

  .recent-list {
    grid-template-columns: repeat(auto-fill, 154px);
  }

  .recent-item {
    width: 154px;
    min-height: 228px;
  }

  .mini-cell {
    font-size: 0.7rem;
  }

  .recent-panel {
    overflow: hidden;
  }

  .recent-list {
    display: flex;
    flex-wrap: nowrap;
    gap: 12px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-inline: contain;
    scroll-snap-type: x proximity;
    padding-bottom: 8px;
    -webkit-overflow-scrolling: touch;
  }

  .recent-message {
    flex: 1 0 100%;
  }

  .recent-item {
    flex: 0 0 min(164px, 78vw);
    width: min(164px, 78vw);
    min-width: 0;
    min-height: 232px;
    scroll-snap-align: start;
  }

  .board-panel.is-mobile-review #candidateMode,
  .board-panel.is-mobile-review #clearCandidatesButton,
  .board-panel.is-mobile-review .number-pad,
  .board-panel.is-mobile-review .primary-actions {
    display: none;
  }

  .walkthrough-header {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px;
  }

  .walkthrough-timer {
    min-width: 64px;
    padding: 5px 8px;
    font-size: 0.86rem;
  }

  #walkthroughSummary {
    display: none;
  }

  .step-detail {
    min-height: 0;
    padding: 0;
    margin-top: 8px;
    border: 0;
    border-radius: 0;
    background: transparent;
  }

  .step-detail .step-pill {
    min-height: 0;
    padding: 0;
    background: transparent;
    color: var(--accent-strong);
    justify-content: flex-start;
    font-size: 0.8rem;
    letter-spacing: 0.01em;
  }

  .step-detail p,
  .step-detail ul {
    margin-top: 5px;
  }

  .step-detail p {
    line-height: 1.42;
  }

  .logic-detail,
  .contradiction-detail,
  .guess-candidates,
  .guess-combinations {
    margin-top: 7px;
  }

  .logic-detail,
  .contradiction-detail {
    padding: 10px;
    border-radius: 12px;
  }

  .logic-detail strong,
  .contradiction-detail strong,
  .guess-candidates strong,
  .guess-combinations strong {
    margin-bottom: 5px;
  }

  .logic-detail ol {
    gap: 6px;
    padding-left: 20px;
  }

  .timeline {
    flex-wrap: nowrap;
    gap: 6px;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x proximity;
    overscroll-behavior-inline: contain;
    padding: 10px 2px 2px;
    -webkit-overflow-scrolling: touch;
  }

  .timeline button {
    min-width: 44px;
    padding: 7px 10px;
    scroll-snap-align: center;
  }

  .guess-combinations {
    overflow: hidden;
  }

  .combo-grid {
    display: flex;
    flex-wrap: nowrap;
    grid-template-columns: none;
    gap: 10px;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-inline: contain;
    scroll-snap-type: x proximity;
    padding: 2px 2px 8px;
    -webkit-overflow-scrolling: touch;
  }

  .combo-option {
    flex: 0 0 104px;
    width: 104px;
    min-width: 104px;
    scroll-snap-align: start;
  }


  .sudoku-cell-slot.is-value-match::after {
    inset: 4px;
  }
}


@media (hover: none) {
  .button:hover:not(:disabled),
  .number-pad button:hover:not(:disabled) {
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
  }
}

