:root {
    color-scheme: light;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    overflow-x: hidden;
    background: var(--cr-bg, #f5f5f7);
    color: var(--cr-text, #1d1d1f);
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

button,
input,
select {
    font: inherit;
}

button,
.capture-button,
.manual-link,
.back-link {
    min-height: 44px;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.capture-button:focus-within,
.manual-link:focus-visible,
.back-link:focus-visible,
#cropCanvas:focus-visible {
    outline: 3px solid rgba(0, 113, 227, 0.38);
    outline-offset: 3px;
}

.recognition-header {
    width: min(100% - 24px, 960px);
    margin: 0 auto;
    min-height: 76px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 14px;
    align-items: center;
}

.recognition-header h1 {
    margin: 0;
    font-size: clamp(22px, 5vw, 30px);
    line-height: 1.1;
}

.eyebrow,
.step-label {
    margin: 0 0 3px;
    color: var(--cr-accent, #0071e3);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.back-link {
    display: inline-flex;
    align-items: center;
    color: var(--cr-text-secondary, #68686d);
    font-weight: 800;
    text-decoration: none;
}

.lab-badge {
    border: 1px solid rgba(245, 166, 35, 0.35);
    border-radius: 999px;
    padding: 5px 9px;
    background: #fff8ec;
    color: #9a5b00;
    font-size: 12px;
    font-weight: 800;
}

.recognition-shell {
    width: min(100% - 24px, 960px);
    margin: 0 auto;
    padding: 4px 0 48px;
}

.flow-summary {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 4px 0 14px;
}

.flow-step {
    flex: 0 0 auto;
    padding: 7px 11px;
    border-radius: 999px;
    background: #e9e9ec;
    color: var(--cr-text-secondary, #68686d);
    font-size: 12px;
    font-weight: 800;
}

.flow-step.is-active {
    background: #e6f2ff;
    color: #0064c8;
}

.panel {
    margin-bottom: 14px;
    padding: 18px;
    border: 1px solid var(--cr-border, #e5e5e7);
    border-radius: var(--cr-radius, 18px);
    background: var(--cr-bg-card, #fff);
}

.panel[hidden] {
    display: none;
}

.panel-heading {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: start;
}

.panel h2 {
    margin: 0;
    font-size: 20px;
}

.panel-heading p:not(.step-label),
.capture-note,
.canvas-help,
.terminal-control p,
.status-panel p {
    margin: 6px 0 0;
    color: var(--cr-text-secondary, #68686d);
    font-size: 13px;
    line-height: 1.5;
}

.page-count {
    flex: 0 0 auto;
    color: var(--cr-text-secondary, #68686d);
    font-size: 13px;
    font-weight: 800;
}

.capture-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 16px;
}

.capture-button,
.primary-action,
.manual-link,
.page-actions button,
.page-tabs button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--cr-border, #e5e5e7);
    border-radius: 12px;
    background: #fff;
    color: var(--cr-text, #1d1d1f);
    cursor: pointer;
    font-weight: 800;
    text-align: center;
    text-decoration: none;
}

.capture-button--primary,
.primary-action {
    border-color: var(--cr-accent, #0071e3);
    background: var(--cr-accent, #0071e3);
    color: #fff;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.page-list {
    display: grid;
    gap: 10px;
    margin-top: 16px;
}

.page-card {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 12px;
    padding: 10px;
    border: 1px solid var(--cr-border, #e5e5e7);
    border-radius: 14px;
}

.page-thumbnail {
    width: 76px;
    height: 100px;
    border-radius: 8px;
    background: #efeff2;
    object-fit: cover;
}

.page-card__body {
    min-width: 0;
}

.page-name {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.quality-warnings {
    margin: 6px 0 0;
    padding-left: 18px;
    color: #9a5b00;
    font-size: 12px;
    line-height: 1.45;
}

.page-actions {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 7px;
}

.page-actions button {
    min-height: 44px;
    padding: 6px;
    font-size: 12px;
}

.page-actions .danger-button {
    color: #b42318;
}

.page-tabs {
    display: flex;
    gap: 8px;
    margin: 16px 0 12px;
}

.page-tabs button {
    min-width: 96px;
    padding: 0 14px;
}

.page-tabs button[aria-selected="true"] {
    border-color: var(--cr-accent, #0071e3);
    color: var(--cr-accent, #0071e3);
    background: #f0f7ff;
}

.layout-choice {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 9px;
    margin: 0 0 14px;
    padding: 0;
    border: 0;
}

.layout-choice legend {
    grid-column: 1 / -1;
    margin-bottom: 7px;
    font-weight: 800;
}

.layout-choice label {
    min-height: 68px;
    padding: 11px;
    border: 1px solid var(--cr-border, #e5e5e7);
    border-radius: 12px;
    cursor: pointer;
}

.layout-choice span {
    font-weight: 800;
}

.layout-choice small {
    display: block;
    margin: 4px 0 0 22px;
    color: var(--cr-text-secondary, #68686d);
}

.canvas-card {
    padding: 10px;
    border-radius: 14px;
    background: #f0f0f2;
}

.geometry-layer-tabs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    margin-bottom: 8px;
}

.geometry-layer-tabs button,
.geometry-nudge-controls button {
    min-height: 48px;
    border: 1px solid var(--cr-border, #d2d2d7);
    border-radius: 10px;
    background: #fff;
    color: var(--cr-text, #1d1d1f);
    font: inherit;
    font-weight: 800;
}

.geometry-layer-tabs button[aria-selected="true"] {
    border-color: #0071e3;
    background: #eaf4ff;
    color: #0057ad;
}

.geometry-layer-tabs button[data-unused="true"] {
    color: var(--cr-text-secondary, #68686d);
}

.geometry-layer-status,
.geometry-unused-hint {
    margin: 6px 2px;
    color: var(--cr-text-secondary, #68686d);
    font-size: 0.9rem;
    font-weight: 700;
}

.geometry-unused-hint {
    color: #9a5b00;
}

.geometry-stage {
    position: relative;
    width: 100%;
    line-height: 0;
}

#cropCanvas {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 10px;
    background: #d8d8dc;
    touch-action: none;
}

.geometry-handles {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.geometry-handle {
    position: absolute;
    width: 48px;
    height: 48px;
    padding: 0;
    transform: translate(-50%, -50%);
    border: 3px solid #f5a623;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 2px 9px rgba(0, 0, 0, 0.3);
    pointer-events: auto;
    touch-action: none;
}

.geometry-handle[aria-pressed="true"] {
    border-color: #fff;
    background: #0071e3;
    box-shadow: 0 0 0 3px #0071e3, 0 2px 9px rgba(0, 0, 0, 0.3);
}

.geometry-handle[hidden] {
    display: none;
}

.geometry-nudge-controls {
    display: grid;
    grid-template-columns: repeat(4, minmax(48px, 1fr));
    gap: 6px;
    margin-top: 10px;
}

.geometry-nudge-controls button:active {
    background: #eaf4ff;
}

.terminal-control {
    margin-top: 14px;
}

.terminal-control label {
    display: block;
    margin-bottom: 6px;
    font-weight: 800;
}

.terminal-control select {
    width: 100%;
    min-height: 44px;
    padding: 0 11px;
    border: 1px solid var(--cr-border, #e5e5e7);
    border-radius: 10px;
    background: #fff;
}

.primary-action {
    width: 100%;
    margin-top: 16px;
    padding: 0 18px;
}

.status-track {
    height: 8px;
    margin-top: 14px;
    overflow: hidden;
    border-radius: 999px;
    background: #e9e9ec;
}

.status-track span {
    display: block;
    width: 15%;
    height: 100%;
    background: var(--cr-accent, #0071e3);
    transition: width 180ms ease;
}

.manual-link {
    margin-top: 14px;
    padding: 0 16px;
    color: var(--cr-accent, #0071e3);
}

.live-status {
    min-height: 24px;
    margin: 0;
    color: #8a4d00;
    font-size: 13px;
    font-weight: 700;
    text-align: center;
}

.review-panel {
    padding: 22px;
}

.recognition-stage-callout {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: 16px;
    padding: 13px 15px;
    border: 1px solid #cbd8ea;
    border-radius: 12px;
    background: #f2f7fd;
}

.recognition-stage-callout[data-stage="grid_failed"] {
    border-color: #e2b36c;
    background: #fff8eb;
}

.recognition-stage-callout p {
    margin: 4px 0 0;
    color: var(--cr-text-secondary, #68686d);
    font-size: 13px;
    line-height: 1.5;
}

.recognition-stage-callout button {
    flex: 0 0 auto;
}

.review-heading,
.section-heading-inline,
.manual-tail,
.commit-section,
.post-commit {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.review-heading h2,
.review-workspace h3,
.metadata-section h3,
.manual-tail h3,
.review-transcript h3,
.commit-section h3,
.post-commit h3 {
    margin: 0;
}

.review-heading p,
.metadata-section p,
.manual-tail p,
.review-transcript p,
.commit-section p,
.post-commit p {
    margin: 5px 0 0;
    color: var(--cr-text-secondary, #68686d);
    font-size: 13px;
    line-height: 1.5;
}

.current-ply-label {
    flex: 0 0 auto;
    border-radius: 999px;
    padding: 6px 10px;
    background: #fff4df;
    color: #8a4d00;
    font-size: 13px;
    font-weight: 800;
}

.review-workspace {
    display: grid;
    grid-template-columns: minmax(190px, 0.8fr) minmax(280px, 1fr) minmax(230px, 0.85fr);
    gap: 18px;
    margin-top: 20px;
}

.review-workspace > section {
    min-width: 0;
}

.review-evidence {
    grid-column: 1;
    grid-row: 1;
}

.review-crop {
    grid-column: 1;
    grid-row: 2;
}

.review-position {
    grid-column: 2;
    grid-row: 1 / span 2;
}

.review-candidates {
    grid-column: 3;
    grid-row: 1 / span 2;
}

.review-page-frame {
    position: relative;
    width: fit-content;
    max-width: 100%;
    margin: 10px auto 0;
    overflow: hidden;
    border-radius: 10px;
    background: #efeff2;
}

#reviewPageImage {
    display: block;
    width: auto;
    max-width: 100%;
    max-height: 420px;
}

#reviewCellMarker {
    position: absolute;
    min-width: 8px;
    min-height: 8px;
    border-radius: 4px;
    outline: 3px solid #c4322b;
    outline-offset: 1px;
    background: rgba(255, 226, 77, 0.24);
    pointer-events: none;
}

#reviewCellCrop {
    display: block;
    width: 100%;
    min-height: 112px;
    margin-top: 10px;
    border-radius: 10px;
    background: #efeff2;
    object-fit: contain;
}

.ocr-raw {
    margin: 8px 0 0;
    overflow-wrap: anywhere;
    color: var(--cr-text, #1d1d1f);
    font-size: 14px;
    font-weight: 800;
}

.review-note,
.section-heading-inline span {
    margin: 7px 0 0;
    color: var(--cr-text-secondary, #68686d);
    font-size: 12px;
    line-height: 1.45;
}

.review-board {
    width: min(100%, 520px);
    aspect-ratio: 1;
    margin: 10px auto 0;
    overflow: hidden;
    border-radius: 10px;
    background: #d8d8dc;
}

.candidate-list {
    display: grid;
    gap: 8px;
    margin-top: 12px;
}

.candidate-list button,
.promotion-choices button,
.secondary-action,
.danger-action,
.inline-confirm button,
.manual-tail button,
.committed-share-result button,
.secondary-link {
    min-height: 44px;
    border: 1px solid var(--cr-border, #e5e5e7);
    border-radius: 10px;
    background: #fff;
    color: var(--cr-text, #1d1d1f);
    cursor: pointer;
    font-weight: 800;
}

.candidate-list button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    padding: 8px 11px;
    text-align: left;
}

.candidate-list button:hover,
.candidate-list button:focus-visible {
    border-color: var(--cr-accent, #0071e3);
    background: #f0f7ff;
}

.candidate-score {
    color: var(--cr-text-secondary, #68686d);
    font-size: 12px;
    font-weight: 700;
}

.san-fallback {
    margin-top: 16px;
}

.san-fallback label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 800;
}

.san-fallback > div {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 7px;
}

.san-fallback input,
.metadata-grid input,
.metadata-grid select {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--cr-border, #e5e5e7);
    border-radius: 10px;
    background: #fff;
    padding: 0 11px;
}

.secondary-action {
    width: 100%;
    margin-top: 12px;
    padding: 0 12px;
    color: #8a4d00;
}

.promotion-choices {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    align-items: center;
    margin-top: 12px;
    padding: 10px;
    border-radius: 10px;
    background: #f0f7ff;
}

.promotion-choices[hidden] {
    display: none;
}

.promotion-choices span {
    margin-right: 2px;
    font-weight: 800;
}

.promotion-choices button {
    min-width: 44px;
}

.inline-confirm {
    margin-top: 10px;
    padding: 12px;
    border-radius: 10px;
    background: #fff4df;
    color: #6f3e00;
}

.inline-confirm p {
    margin: 0 0 8px;
    font-size: 13px;
    line-height: 1.45;
}

.inline-confirm > div {
    display: flex;
    gap: 8px;
}

.inline-confirm button {
    flex: 1;
}

.inline-confirm .danger-action {
    border-color: #c4322b;
    background: #c4322b;
    color: #fff;
}

.manual-tail,
.review-transcript,
.metadata-section,
.commit-section,
.post-commit {
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid var(--cr-border, #e5e5e7);
}

.manual-tail button {
    flex: 0 0 auto;
    padding: 0 14px;
}

.review-move-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    margin-top: 14px;
}

.review-move-row {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) minmax(0, 1fr);
    gap: 7px;
    min-width: 0;
    padding: 8px 10px;
    border-radius: 9px;
    background: #f6f6f8;
    font-variant-numeric: tabular-nums;
}

.review-move-row span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.draft-pgn-label {
    display: block;
    margin-top: 14px;
    font-size: 13px;
    font-weight: 800;
}

.draft-pgn {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    margin-top: 6px;
    border: 1px solid var(--cr-border, #e5e5e7);
    border-radius: 10px;
    padding: 10px;
    resize: vertical;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.share-tag-options,
.image-retention-actions {
    flex: 1 0 100%;
    min-width: 0;
    border: 0;
    padding: 0;
}

.share-tag-options legend {
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 800;
}

.share-tag-options label {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    margin-right: 14px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
}

.share-tag-options input {
    width: 20px;
    height: 20px;
    margin: 0 7px 0 0;
}

.image-retention-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.image-retention-actions .danger-action {
    flex: 0 0 auto;
    min-height: 44px;
    border: 1px solid #c4322b;
    border-radius: 10px;
    background: #fff;
    padding: 0 14px;
    color: #a51f1a;
    cursor: pointer;
    font-weight: 800;
}

.metadata-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 11px;
    margin-top: 14px;
}

.metadata-grid label {
    min-width: 0;
    font-size: 13px;
    font-weight: 800;
}

.metadata-grid input,
.metadata-grid select {
    display: block;
    margin-top: 5px;
    font-weight: 600;
}

.confirmation-check {
    display: flex;
    gap: 9px;
    align-items: center;
    min-height: 44px;
    margin-top: 10px;
    cursor: pointer;
    font-weight: 800;
}

.confirmation-check input {
    width: 22px;
    height: 22px;
    margin: 0;
}

.commit-section .primary-action,
.post-commit .primary-action {
    width: auto;
    min-width: 190px;
    margin-top: 0;
}

.primary-action:disabled,
button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.secondary-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 160px;
    padding: 0 14px;
    text-decoration: none;
}

.committed-share-result {
    flex: 1 0 100%;
    padding: 12px;
    border-radius: 10px;
    background: #eef8f1;
}

.committed-share-result p {
    overflow-wrap: anywhere;
    color: #245c36;
    font-weight: 800;
}

.committed-share-result textarea {
    width: 100%;
    min-height: 84px;
    margin-top: 6px;
    resize: vertical;
}

@media (max-width: 900px) {
    .review-workspace {
        grid-template-columns: minmax(180px, 0.75fr) minmax(300px, 1.25fr);
    }

    .review-evidence,
    .review-crop {
        grid-column: 1;
    }

    .review-position {
        grid-column: 2;
        grid-row: 1 / span 2;
    }

    .review-candidates {
        grid-column: 1 / -1;
        grid-row: 3;
    }

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

    .review-move-list {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 719px) {
    .review-panel {
        padding: 15px;
    }

    .review-heading,
    .manual-tail,
    .commit-section,
    .post-commit {
        display: block;
    }

    .current-ply-label {
        display: inline-block;
        margin-top: 10px;
    }

    .review-workspace {
        display: flex;
        flex-direction: column;
        gap: 18px;
    }

    .review-evidence,
    .review-crop,
    .review-position,
    .review-candidates {
        width: 100%;
    }

    #reviewPageImage {
        max-height: 360px;
    }

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

    .image-retention-actions {
        display: block;
    }

    .image-retention-actions .danger-action {
        width: 100%;
        margin-top: 12px;
    }

    .manual-tail button,
    .commit-section .primary-action,
    .post-commit .primary-action,
    .secondary-link {
        width: 100%;
        margin-top: 12px;
    }
}

@media (min-width: 720px) {
    .page-list {
        grid-template-columns: 1fr 1fr;
    }

    .structure-panel {
        padding: 24px;
    }
}

@media (max-width: 520px) {
    .recognition-header {
        grid-template-columns: auto 1fr;
    }

    .lab-badge {
        display: none;
    }

    .panel {
        padding: 15px;
        border-radius: 14px;
    }

    .panel-heading {
        display: block;
    }

    .page-count {
        display: block;
        margin-top: 8px;
    }

    .capture-actions,
    .layout-choice {
        grid-template-columns: 1fr;
    }

    .layout-choice legend,
    .layout-choice label {
        grid-column: auto;
    }
}

.manual-entry [hidden],
.manual-entry .review-evidence,
.manual-entry .review-crop,
.manual-entry #recognitionStageCallout,
.manual-entry .image-retention-actions {
    display: none !important;
}

@media (min-width: 769px) {
    .manual-entry .review-workspace {
        grid-template-columns: minmax(0, 1.2fr) minmax(260px, 0.8fr);
    }
    .manual-entry .review-position {
        grid-column: 1;
        grid-row: 1;
    }
    .manual-entry .review-candidates {
        grid-column: 2;
        grid-row: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
.free-ocr-notice, .rule-preview-panel {
    padding: 14px 18px;
    border: 1px solid #c7d9ca;
    border-radius: 12px;
    background: #f3f8f3;
    color: #26412d;
    line-height: 1.65;
}
.rule-preview-panel { margin-bottom: 18px; }
.rule-preview-panel h3 { margin: 0 0 6px; }
.rule-preview-panel p { margin: 6px 0; }
.rule-preview-moves { overflow-wrap: anywhere; max-height: 160px; overflow-y: auto; }

/* Explicit component displays must still respect their lifecycle visibility. */
#postCommitActions[hidden],
.free-ocr-notice[hidden],
.rule-preview-panel[hidden] {
    display: none !important;
}

/* Focused recording screen and a separate information route, on all devices. */
.record-navigation{display:flex;gap:8px;flex-wrap:wrap;margin:12px 0 16px}
.record-navigation button{min-height:40px;border:1px solid #d9e2e9;background:#fff;color:#37516b;padding:8px 12px;border-radius:7px;font:inherit;font-size:14px}
.record-navigation button:first-child{margin-right:auto}
.record-navigation button span{margin-left:14px}
.recording-flow[data-record-view="record"] .metadata-section{display:none}
.recording-flow[data-record-view="info"] #reviewPanel> :not(.metadata-section){display:none!important}
.recording-flow[data-record-view="info"] .flow-summary,.recording-flow[data-record-view="info"] #capturePanel,.recording-flow[data-record-view="info"] #structurePanel,.recording-flow[data-record-view="info"] #recognitionStatusPanel,.recording-flow[data-record-view="info"] #freeOcrNotice{display:none!important}
.recording-flow[data-record-view="info"] #reviewPanel{max-width:680px;margin:auto}
.metadata-section .metadata-back{border:0;background:none;color:#37516b;padding:0;min-height:42px;font:inherit;margin-bottom:12px}
.metadata-section .metadata-done{margin-top:20px;width:100%}
.manual-entry .recognition-shell{max-width:960px;padding-top:16px}
.manual-entry #reviewPanel{padding:18px;border-radius:10px}
.manual-entry .review-heading{margin-bottom:10px}
.manual-entry .review-heading h2{font-size:19px}
.manual-entry .review-heading p{font-size:13px;margin:4px 0}
.manual-entry .review-workspace{display:block}
.manual-entry .review-position{max-width:440px;margin:0 auto}
.manual-entry .review-position .review-note,.manual-entry #manualProvenance,.manual-entry #manualTailTitle,.manual-entry .review-transcript>div:first-child,.manual-entry .draft-pgn-label,.manual-entry #draftPgn{display:none}
.manual-entry .review-position h3{font-size:14px}
.manual-entry .review-position .section-heading-inline{margin-bottom:8px}
.manual-entry .review-candidates{margin-top:14px}
.manual-entry .review-candidates[hidden]{display:none!important}
.manual-entry .manual-tail{margin:10px 0 0;padding:0;border:0;background:none;justify-content:flex-end}
.manual-entry .manual-tail button{margin:0;width:auto;min-height:38px;padding:6px 12px;font-size:13px}
.manual-entry .review-transcript{padding:0;border:0;margin:12px 0}
.manual-entry .review-move-list{max-height:90px;overflow:auto;min-height:35px;border-radius:6px}
.manual-entry .commit-section{margin-top:12px;padding:12px;gap:10px;align-items:center}
.manual-entry #commitTitle{display:none}
.manual-entry .commit-section .confirmation-check{font-size:13px}
.manual-entry .commit-section p{font-size:12px;margin:4px 0 0}
.manual-entry .commit-section .primary-action{min-height:42px;font-size:15px;margin:0}
.manual-entry .recognition-header .community-header-actions button[data-community-entry]{display:none}
.photo-thumbnail-button{border:0;padding:0;background:none;cursor:zoom-in;align-self:start;line-height:0;min-width:0}
.photo-thumbnail-button .page-thumbnail{width:100%;height:auto;max-height:180px;object-fit:contain}
#reviewPageImage{cursor:zoom-in}
.photo-preview{width:min(960px,100vw);height:90dvh;max-height:90vh;padding:0;border:0;border-radius:10px;box-shadow:0 8px 40px #0006}
.photo-preview::backdrop{background:#000b}
.photo-preview-toolbar{height:58px;display:flex;align-items:center;justify-content:space-between;gap:10px;padding:8px 14px;box-sizing:border-box;background:#fff}
.photo-preview-toolbar label{display:flex;gap:6px;align-items:center;font-size:13px}
.photo-preview-toolbar input{width:100px}
.photo-preview-toolbar button{min-height:40px;border:1px solid #ccd6df;background:#fff;border-radius:6px;padding:6px 12px}
.photo-preview-scroll{height:calc(100% - 58px);overflow:auto;overscroll-behavior:contain;touch-action:pan-x pan-y pinch-zoom;background:#202934}
.photo-preview-scroll img{display:block;max-width:none;min-width:100%;height:auto;object-fit:contain}
@media(max-width:600px){
 .manual-entry .recognition-header{padding:12px 14px;grid-template-columns:auto 1fr auto;gap:8px}
 .manual-entry .recognition-header h1{font-size:20px}.manual-entry .recognition-header .eyebrow{display:none}
 .manual-entry .recognition-shell{padding:8px}.manual-entry #reviewPanel{padding:12px}
 .manual-entry .review-heading{display:none}.manual-entry .record-navigation{margin:0 0 8px;gap:6px}
 .manual-entry .record-navigation button{font-size:12px;padding:6px 8px;min-height:36px}
 .manual-entry .commit-section{display:block}.manual-entry .commit-section .primary-action{width:100%;margin-top:8px}
 .manual-entry .review-move-list{max-height:72px}.manual-entry .section-heading-inline{margin-bottom:6px}
 .photo-preview{width:100vw;max-width:100vw;margin:5vh 0;border-radius:0}
}

.layout-detection{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:12px}.layout-detection p{flex-basis:100%;margin:0;color:var(--text-secondary,#555);line-height:1.5}
.layout-options{margin:12px 0}.layout-options summary{cursor:pointer;padding:10px 0;font-weight:600}
.custom-layout{display:flex;gap:8px;flex-wrap:wrap;align-items:end}.custom-layout label{display:grid;gap:4px}.custom-layout input{width:88px;min-height:40px;padding:6px}.custom-layout button{min-height:40px}
.manual-entry .review-workspace{margin-top:0}.manual-entry .review-board{max-width:400px}
.manual-entry .review-panel{max-width:650px;margin-inline:auto}.manual-entry .recognition-shell{max-width:720px}
.manual-entry [data-record-view="info"]{max-width:800px}

.manual-entry .review-heading,.manual-entry .recognition-header .eyebrow{display:none}
.manual-entry .recognition-header{padding:12px 20px}.manual-entry .recognition-shell{padding-top:10px}
.manual-entry .commit-section{padding:8px 10px}.manual-entry #commitHint{display:none}
.recording-flow[data-record-view="info"] #liveStatus{display:none}
.manual-entry .live-status{min-height:0;margin:8px auto;padding:6px 12px}
.layout-detection button,.custom-layout button{appearance:none;background:#fff;border:1px solid #cddbea;border-radius:8px;color:#0064c8;min-height:44px;padding:9px 12px;font:inherit;cursor:pointer}
.layout-detection button:disabled{opacity:.55;cursor:wait}.layout-detection button:focus-visible,.custom-layout button:focus-visible{outline:3px solid #8ac0ff;outline-offset:2px}

/* Upload is the only setup step. Old calibration markup stays inert for
   backwards-compatible scripts and cannot enter the current photo flow. */
#structurePanel{display:none!important}
.auto-photo-actions{display:flex;gap:10px;flex-wrap:wrap;margin-top:14px}
.auto-photo-actions button{min-height:44px;padding:8px 14px;border:1px solid #cddbea;border-radius:8px;background:#fff;color:#0064c8;font:inherit}
.auto-photo-actions button[hidden]{display:none}

.manual-entry #recognitionStatusPanel,.manual-entry #capturePanel{display:none!important}
/* Portrait phones keep the board above a scrollable move list. Landscape
   tablets place that list and saving beside the board. */
@media(min-width:700px) and (orientation:landscape){
 .manual-entry .recognition-shell{max-width:1100px}
 .manual-entry #reviewPanel{max-width:1020px;display:grid;grid-template-columns:minmax(240px,1.15fr) minmax(230px,.85fr);gap:12px 22px}
 .manual-entry .record-navigation{grid-column:1/-1;margin:0}
 .manual-entry .review-workspace{grid-column:1;grid-row:2/span 3;margin:0}
 .manual-entry .review-position{max-width:480px}
 .manual-entry .review-board{width:min(100%,calc(100dvh - 190px),440px);min-width:180px;max-width:440px}
 .manual-entry .manual-tail{grid-column:2;grid-row:2;margin:0;align-self:start}
 .manual-entry .review-transcript{grid-column:2;grid-row:3;margin:0;min-height:0}
 .manual-entry .review-move-list{max-height:max(90px,calc(100dvh - 350px));margin:0;overscroll-behavior:contain}
 .manual-entry .commit-section{grid-column:2;grid-row:4;display:block;margin:0;padding:10px;align-self:end}
 .manual-entry .commit-section .primary-action{width:100%;margin-top:8px}
 .manual-entry .review-candidates{margin-top:8px}
 .manual-entry .post-commit{grid-column:1/-1}
 .manual-entry[data-record-view="info"] #reviewPanel{display:block;max-width:680px}
}
@media(max-width:699px) and (orientation:portrait){
 .manual-entry .review-move-list{max-height:72px;overscroll-behavior:contain}
 .manual-entry .review-board{max-width:400px}
}
body[data-ocr-active="true"] .capture-actions,body[data-ocr-active="true"] .page-actions{display:none}

.recognition-stage-callout{flex-wrap:wrap}.recognition-stage-callout>div{flex:1 0 100%;min-width:0}.recognition-stage-callout button{flex:1 1 150px;width:auto;margin:0;min-height:44px}
