/* Mobile adaptation of the approved sand-and-clay design.
   Photo markers retain their measured geometry; the question browser supplies
   generously sized alternative controls for every photographed row. */
@media screen {
  body { padding-inline: env(safe-area-inset-left) env(safe-area-inset-right); }
  .skip-link:not(:focus) { clip-path: inset(50%); width: 1px; height: 1px; padding: 0; overflow: hidden; }
  .hero-inner > *, .review-layout > *, .review-controls, .form-row > * { min-width: 0; }
  .button, .option-button, .text-button { min-height: 44px; min-width: 44px; }
  .text-button { display: inline-flex; align-items: center; justify-content: center; }
  .site-header a, .site-footer nav a, .quiet-link, .text-link, .back-link {
    display: inline-flex; align-items: center; min-height: 44px; min-width: 44px;
  }
  .question-grid { grid-template-columns: repeat(auto-fit, minmax(44px, 1fr)); gap: 8px; }
  .question-button { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 52px; font-size: 14px; line-height: 1.3; }
  .question-state { display: block; font-size: 11px; margin-top: 2px; }
  .option-button { min-width: 44px; }
  .question-list > summary { cursor: pointer; min-height: 44px; font-size: 14px; font-weight: 600; align-content: center; }
  .question-list-body { padding-top: 14px; }
  .sheet-jump { display: none; }
  .question-detail, #review-paper { scroll-margin-top: 24px; }
  .paper-toolbar label { min-height: 44px; flex-wrap: wrap; }
  input[type="range"] { min-height: 44px; cursor: pointer; }
  input[type="checkbox"] { width: 22px; height: 22px; vertical-align: middle; flex-shrink: 0; }
  .notice label { min-height: 44px; }
  .paper-toolbar output { min-width: 4ch; font-variant-numeric: tabular-nums; }
  .calibration canvas { max-width: none; width: 100%; height: auto; }
  .paper-scroll, .calibration-image { touch-action: pan-x pan-y pinch-zoom; }
  .alignment-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 20px; }
  .alignment-toolbar label { display: grid; grid-template-columns: auto minmax(70px, 1fr) 5ch; align-items: center; gap: 12px; flex: 1 1 270px; font-size: 14px; }
  .alignment-toolbar input { width: 100%; min-width: 0; }
  .alignment-toolbar output { font-variant-numeric: tabular-nums; text-align: end; }
  .consent-banner { bottom: max(16px, env(safe-area-inset-bottom)); max-height: calc(100svh - 32px); overflow-y: auto; }
  .toast { bottom: max(24px, env(safe-area-inset-bottom)); }
  .paper-scroll:focus-visible, .calibration-image:focus-visible, .question-detail h3:focus-visible { outline: 3px solid #99794f; outline-offset: 4px; }
}

@media screen and (pointer: coarse) {
  .question-list select, .form-row select, .photo-options select, .calibration-layout-label select { min-height: 48px; font-size: 16px; }
  .detail-nav .text-button { padding-inline: 6px; }
}

@media screen and (max-width: 1050px) {
  select { font-size: 16px; }
  .site-header nav { gap: 16px; }
  .review-layout { grid-template-columns: minmax(0, .9fr) minmax(0, 1fr); }
  .question-list-top { align-items: start; flex-wrap: wrap; gap: 8px; }
  .question-list select { font-size: 16px; min-height: 48px; flex: 1 1 155px; }
  .answer-edit > span { flex-basis: 100%; }
  .option-button { flex: 1 0 44px; }
  .option-button:last-child { flex-basis: 100%; }
}

@media screen and (max-width: 900px) {
  html { scroll-padding-top: 20px; }
  body { font-size: 16px; }
  .shell { width: calc(100% - 32px); }
  .site-header {
    display: grid; grid-template-columns: 1fr auto; align-items: center;
    margin-top: 12px; min-height: 0; padding: 8px 16px;
    border-radius: 18px; gap: 4px 12px;
  }
  .site-header .wordmark { font-size: 25px; grid-column: 1; grid-row: 1; }
  .site-header .header-source { display: inline-flex; justify-content: end; font-size: 14px; grid-column: 2; grid-row: 1; }
  .site-header nav {
    position: static; transform: none; grid-column: 1 / -1;
    display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 8px;
    border-top: 1px solid var(--line); width: 100%; white-space: normal;
  }
  .site-header nav a { font-size: 14px; text-align: center; justify-content: center; line-height: 1.3; padding: 8px 0; }
  .hero { padding: 24px 0; }
  .hero-inner { grid-template-columns: minmax(0, 1fr); gap: 22px; }
  .hero-copy { width: 100%; max-width: 640px; margin-inline: auto; padding: 0 4px; }
  .hero-copy h1 { font-size: 36px; max-width: 22ch; }
  .hero-copy h1 br { display: none; }
  .hero-copy > p { font-size: 16px; line-height: 1.65; margin-top: 16px; max-width: 56ch; }
  .independent { font-size: 13px; gap: 10px; margin-top: 16px; }
  .independent span { width: 24px; }
  .quiet-link { font-size: 14px; margin-top: 6px; }
  .botanical { width: 250px; height: 380px; left: auto; right: -180px; top: -10px; opacity: .1; }
  .checker { width: 100%; max-width: 640px; margin-inline: auto; padding: 24px; }
  .form-row { grid-template-columns: 132px minmax(0, 1fr); gap: 12px; margin-bottom: 16px; }
  .form-row label, .upload-label { font-size: 14px; font-weight: 600; }
  .form-row select { font-size: 16px; min-height: 48px; }
  .source-line { font-size: 13px; margin: 0 0 16px 144px; overflow-wrap: anywhere; }
  .source-line a { min-height: 44px; }
  .upload-label { margin-top: 20px; }
  .dropzone { min-height: 140px; padding: 18px 12px; }
  .dropzone strong { font-size: 16px; }
  .dropzone > span { font-size: 13px; max-width: 30ch; }
  .photo-options { font-size: 14px; }
  .photo-options summary { min-height: 44px; align-content: center; }
  .photo-options label { align-items: start; flex-direction: column; gap: 6px; }
  .photo-options select { width: 100%; font-size: 16px; min-height: 48px; }
  .button { min-height: 48px; font-size: 15px; padding: 12px 18px; }
  .button.primary { min-height: 50px; }
  .form-foot { font-size: 13px; flex-wrap: wrap; gap: 0 12px; align-items: start; }
  .form-foot > span { padding-top: 12px; }
  .catalogue-status, .refresh-button, .error-message { font-size: 13px; }
  .catalogue-status { margin-top: 12px; }
  .refresh-button { margin-top: 0; }
  h2 { font-size: 30px; }
  h3 { font-size: 16px; }
  .photo-guide { grid-template-columns: minmax(0, 1fr); gap: 28px; padding: 26px; border-radius: 20px; margin-top: 8px; }
  .photo-column > p { font-size: 16px; }
  .guide-photo { margin-top: 20px; }
  .photo-caption { font-size: 13px; }
  .photo-instructions { padding-top: 0; }
  .photo-steps { gap: 24px; }
  .photo-steps li { gap: 14px; }
  .photo-steps h3 { font-size: 16px; }
  .photo-steps p { font-size: 15px; }
  .photo-examples { margin-top: 28px; padding-top: 20px; }
  .photo-examples > h3 { font-size: 22px; }
  .example-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 16px; }
  .sample-frame { height: 145px; padding: 10px 16px; }
  .photo-example figcaption { font-size: 13px; }
  .original-tip { font-size: 14px; margin-top: 24px; }
  .text-link { font-size: 14px; }
  .how-section { padding: 36px 4px 24px; }
  .process { grid-template-columns: minmax(0, 1fr); gap: 24px; margin-block: 24px; }
  .process li { gap: 16px; }
  .process h3 { font-size: 16px; }
  .process p { font-size: 15px; max-width: 55ch; }
  .reassurance { display: block; font-size: 14px; text-align: start; }
  .reassurance::before, .reassurance::after { display: none; }
  .advertisement { padding: 12px 16px 16px; margin-block: 16px 28px; }
  .advertisement > span, .ad-space span { font-size: 12px; }
  .ad-space { min-height: 90px; }
  .faq-section { grid-template-columns: minmax(0, 1fr); gap: 20px; padding: 32px 4px; }
  .faq-section > div > p, .faq-list p { font-size: 15px; }
  .faq-list summary { font-size: 16px; min-height: 44px; align-content: center; }
  .faq-list details { padding-block: 12px; }
  .site-footer { flex-direction: column; gap: 12px; padding: 24px 0 max(24px, env(safe-area-inset-bottom)); text-align: center; }
  .site-footer > p { display: block; font-size: 13px; }
  .site-footer nav { flex-wrap: wrap; justify-content: center; gap: 0 20px; }
  .site-footer nav a, .site-footer nav button { font-size: 14px; }
  .review-section { padding: 28px 0; }
  .section-heading { flex-direction: column; align-items: start; gap: 14px; }
  .section-heading h2 { font-size: 30px; }
  .section-heading p { font-size: 15px; overflow-wrap: anywhere; }
  .section-heading > .button { font-size: 14px; min-height: 44px; }
  .notice { font-size: 14px; padding: 16px; }
  .result-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-block: 20px; }
  .summary-item { padding: 14px 16px; border: 0; border-bottom: 1px solid var(--line); }
  .summary-item:first-child, .summary-item:last-child { grid-column: 1 / -1; }
  .summary-item:nth-child(even) { border-right: 1px solid var(--line); }
  .summary-item:last-child { border: 0; }
  .summary-item strong { font-size: 28px; }
  .summary-item span { font-size: 14px; }
  .summary-item small { font-size: 12px; }
  .review-layout { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .review-controls { order: 1; }
  .review-paper { order: 2; }
  .question-detail, .question-list { padding: 18px; }
  .question-detail { min-height: 0; margin-bottom: 0; }
  .detail-heading { align-items: start; }
  .detail-heading h3 { font-size: 26px; }
  .status-label { font-size: 12px; }
  .answer-pair span { font-size: 14px; }
  .answer-pair strong { font-size: 28px; }
  .question-crop { width: 100%; height: auto; max-height: 105px; }
  .detected-note, .correction-note { font-size: 14px; }
  .answer-edit { gap: 6px; }
  .answer-edit > span { font-size: 14px; }
  .option-button { font-size: 16px; min-height: 44px; }
  .detail-nav { gap: 12px; }
  .detail-nav button { font-size: 14px; }
  .sheet-jump { display: flex; align-items: center; justify-content: space-between; min-height: 48px; font-size: 14px; margin: 8px 4px 16px; }
  .question-list > summary { font-size: 16px; }
  .question-list-top { gap: 12px; margin-bottom: 16px; }
  .question-list-top h3 { font-size: 15px; }
  .question-list select { width: 100%; flex-basis: 100%; }
  .question-grid { gap: 8px; }
  .legend { font-size: 13px; gap: 10px 16px; }
  .export-actions { flex-wrap: wrap; gap: 4px 20px; margin-top: 20px; }
  .export-actions .button, .export-actions .text-button { font-size: 14px; min-height: 48px; }
  .result-disclaimer { font-size: 13px; }
  .paper-toolbar { flex-wrap: wrap; font-size: 14px; padding: 12px 16px; gap: 0 12px; }
  .paper-toolbar input { width: 95px; }
  .paper-scroll { height: min(65svh, 560px); min-height: 240px; padding: 12px; }
  .paper-help { font-size: 13px; padding: 14px 16px; }
  .calibration { padding: 24px; margin-block: 24px; }
  .calibration > p { font-size: 15px; }
  .calibration-layout-label { display: grid; gap: 6px; font-size: 14px; }
  .calibration-layout-label select { font-size: 16px; min-height: 48px; width: 100%; }
  .calibration-image { max-height: 65svh; padding: 8px; }
  .calibration-actions { flex-direction: column; align-items: stretch; gap: 10px; }
  .calibration-actions .button { font-size: 14px; }
  .calibration-actions #apply-calibration { order: -1; }
  .content-page { padding: 32px 4px 40px; }
  .content-page h1 { font-size: 36px; }
  .content-page .intro { font-size: 17px; line-height: 1.7; margin-block: 20px 28px; }
  .content-page h2 { font-size: 26px; }
  .content-page p, .content-page li { font-size: 16px; line-height: 1.8; overflow-wrap: anywhere; }
  .content-page > .small-note, .sources a, .back-link { font-size: 14px; }
  .consent-banner { flex-direction: column; align-items: stretch; gap: 16px; padding: 20px; }
  .consent-banner strong { font-size: 16px; }
  .consent-banner p { font-size: 14px; }
  .consent-actions { width: 100%; flex-wrap: wrap; }
  .consent-actions .button { flex: 1 1 130px; min-height: 48px; font-size: 14px; }
}

@media screen and (max-width: 600px) {
  .hero-copy h1 { font-size: clamp(30px, 8.5vw, 36px); }
  .checker { padding: 20px; }
  .form-row { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .source-line { margin-left: 0; }
  .form-foot { flex-direction: column; align-items: start; }
  .photo-guide { padding: 24px 20px; }
  .sample-frame { height: 125px; padding-inline: 10px; }
  .table-scroll { overflow: visible; border: 0; margin-block: 24px; }
  .table-scroll table, .table-scroll tbody { display: block; }
  .table-scroll caption { display: block; border-radius: 12px; font-size: 14px; margin-bottom: 16px; }
  .table-scroll thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .table-scroll tbody tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 12px; margin-top: 12px; padding: 16px; gap: 14px 16px; background: var(--surface); }
  .table-scroll td { display: block; padding: 0; border: 0; white-space: normal; font-size: 16px; overflow-wrap: anywhere; }
  .table-scroll td::before { content: attr(data-label); display: block; font-size: 13px; color: var(--muted); margin-bottom: 2px; }
  .table-scroll td:last-child { grid-column: 1 / -1; }
  .table-scroll td a { display: inline-flex; align-items: center; min-height: 44px; font-size: 15px; }
  .key-version { font-size: 12px; }
  .calibration { padding: 20px; }
}

@media screen and (max-width: 359px) {
  .site-header { padding-inline: 12px; }
  .site-header .wordmark { font-size: 23px; }
  .site-header nav { gap: 6px; }
  .checker, .photo-guide, .calibration { padding: 18px 16px; }
  .question-detail, .question-list { padding: 16px; }
  .question-grid { gap: 6px; }
  .sample-frame { height: 110px; }
  .status-label { padding-inline: 6px; }
}
