.page-compare {
    overflow-x: hidden;
}

.page-compare .compare-table-wrap {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
    overflow-x: auto;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.page-compare .compare-table {
    table-layout: fixed;
    border-collapse: collapse;
    font-size: 14px;
    /* width:100%; min-width:… set inline — fill wrap when narrow table, scroll when min wider than wrap. */
    box-sizing: border-box;
}

.page-compare .compare-table th, .page-compare .compare-table td {
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
}

.page-compare .compare-table th {
    background: #f8f9fa;
    font-weight: 600;
}

.page-compare .compare-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.page-compare .compare-table .compare-annotator-note-row th,
.page-compare .compare-table .compare-annotator-note-row td {
    position: static;
    background: #f1f5f9;
    font-weight: 400;
    vertical-align: top;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
    border-bottom: 1px solid #e2e8f0;
}

.page-compare .compare-table tbody td.compare-cell-ann,
.page-compare .compare-table thead th.compare-cell-ann {
    text-align: center;
}

.page-compare .compare-table .compare-note-label {
    font-weight: 600;
    white-space: nowrap;
    max-width: none;
}

.page-compare .compare-table .compare-note-summary {
    color: #94a3b8;
}

.page-compare .compare-table .note-wrap {
    max-width: 100%;
}

.page-compare .compare-table .note-visible {
    white-space: pre-wrap;
    word-break: break-word;
}

.page-compare .compare-table .note-toggle {
    display: inline-block;
    margin-top: 6px;
    padding: 2px 0;
    border: none;
    background: none;
    color: #1967d2;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    font-family: inherit;
}

.page-compare .compare-table .note-toggle:hover {
    color: #1557b0;
}

.page-compare .compare-table .cat-row td {
    background: #f0f2f5;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #666;
}

.page-compare .check-yes { color: #34a853; font-weight: 700; }
.page-compare .check-no { color: #ccc; }
.page-compare .conflict { background: #fef7e0; }

.page-compare .compare-layout {
    display: grid;
    /* Single column: image on top, comparison table full width below (all /compare/{id} pages). */
    grid-template-columns: 1fr;
    gap: 24px;
    align-items: start;
}

.page-compare .compare-layout > div {
    min-width: 0;
}

/* Right column: full width under image panel */
.page-compare .compare-layout > div:last-child {
    width: 100%;
    min-width: 0;
}

.page-compare .compare-image-panel {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
    position: static;
    text-align: center;
    width: 100%;
    max-width: 100%;
    margin: 0;
    box-sizing: border-box;
}

/* Carousel + image (same idea as annotate page) */
.page-compare .compare-image-carousel {
    display: grid;
    grid-template-rows: auto auto;
    gap: 12px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/*
 * max-height on the <img> with height:auto shrinks the rendered width to keep aspect ratio,
 * which leaves empty space on the sides. Cap height on the wrapper and scroll instead.
 */
.page-compare .compare-image-frame {
    width: 100%;
    max-width: 100%;
    max-height: min(70vh, 880px);
    overflow-y: auto;
    overflow-x: hidden;
    border-radius: 8px;
    line-height: 0;
    box-sizing: border-box;
}

.page-compare .compare-form-image {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    margin: 0;
    object-position: top center;
    border-radius: 8px;
    vertical-align: middle;
}

.page-compare .compare-image-carousel-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.page-compare .compare-image-carousel-bar[hidden] {
    display: none !important;
}

.page-compare .compare-image-carousel-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 8px 14px;
    border-radius: 10px;
    border: 1px solid #d2e3fc;
    background: #e8f0fe;
    color: #1967d2;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color .15s, border-color .15s, transform .15s;
    white-space: nowrap;
    font-family: inherit;
}

.page-compare .compare-image-carousel-btn:hover {
    background: #d2e3fc;
    border-color: #c3d8fd;
    transform: translateY(-1px);
}

.page-compare .compare-image-carousel-btn:focus-visible {
    outline: 2px solid #1967d2;
    outline-offset: 2px;
}

.page-compare .compare-image-carousel-counter {
    font-size: 13px;
    font-weight: 600;
    color: #3f4f74;
    min-width: 7.5rem;
    text-align: center;
}

.page-compare .select-best-section {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    border: 2px solid #e0e0e0;
}

.page-compare .select-best-section h4 {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: #555;
    margin-bottom: 12px;
}

.page-compare .select-best-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin: 0;
}

.page-compare .select-best-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border: 0;
    background: transparent;
    color: #555;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    cursor: pointer;
    padding: 8px 10px;
    border-radius: 8px;
    transition: background-color .15s, color .15s;
}

.page-compare .select-best-toggle:hover {
    background: #edf2ff;
    color: #284b87;
}

.page-compare .select-best-toggle:focus-visible {
    outline: 2px solid #1967d2;
    outline-offset: 2px;
}

.page-compare .select-best-chevron {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    flex: 0 0 18px;
    font-size: 14px;
    color: #6b7280;
}

.page-compare .select-best-content {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e3e6ef;
}

.page-compare .select-best-content-hidden {
    display: none;
}

.page-compare .select-best-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.page-compare .export-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.page-compare .export-row-users {
    margin-top: -2px;
}

.page-compare .export-user-btn {
    font-size: 12px;
}

.page-compare .select-best-btn {
    padding: 10px 20px;
    border: 2px solid #d0d0d0;
    border-radius: 8px;
    background: #fff;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all .15s;
}

.page-compare .select-best-btn:hover {
    border-color: #1967d2;
    background: #e8f0fe;
}

.page-compare .select-best-btn.selected {
    border-color: #34a853;
    background: #e6f4ea;
    color: #1e7e34;
    font-weight: 700;
}

.page-compare .review-notes-save {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.page-compare .review-notes-save input {
    flex: 1;
    padding: 10px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 13px;
    outline: none;
    transition: border-color .2s;
}

.page-compare .review-notes-save input:focus { border-color: #1967d2; }

.page-compare .review-save-btn {
    padding: 10px 24px;
    background: #34a853;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
    white-space: nowrap;
}

.page-compare .review-save-btn:hover { background: #2d8e47; }

/* Image panel: single-line review under carousel. */
.page-compare .compare-image-panel .review-info--compact {
    margin-top: 10px;
    margin-bottom: 0;
    padding: 6px 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    text-align: left;
}

.page-compare .compare-image-panel .review-info--compact .review-info-line {
    margin: 0;
    font-size: 12px;
    line-height: 1.45;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.page-compare .compare-image-panel .review-info--compact .review-info-k {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
    color: #94a3b8;
}

.page-compare .compare-image-panel .review-info--compact .review-info-line strong {
    font-weight: 600;
    color: #0f172a;
}

.page-compare .compare-image-panel .review-info--compact .review-info-em {
    font-style: italic;
    color: #64748b;
}

.page-compare .compare-image-panel .review-info--compact .review-info-sep {
    margin: 0 0.15em;
    color: #cbd5e1;
    font-weight: 400;
}

.page-compare .compare-image-panel .review-info--compact .review-info-by {
    color: #94a3b8;
    font-size: 11px;
}

.page-compare .best-badge {
    display: inline-block;
    background: #34a853;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 4px;
    vertical-align: middle;
}

.page-compare .summary-none { color: #888; }
.page-compare .summary-agree { color: #34a853; }
.page-compare .summary-conflict { color: #ea4335; }
.page-compare .compare-image-title { margin-top: 12px; }

.page-compare .compare-note {
    margin-top: 6px;
    display: grid;
    gap: 4px;
    font-size: 11px;
    color: #5f6b85;
    background: #f6f8fe;
    border: 1px solid #dde5f7;
    border-radius: 6px;
    padding: 5px 7px;
}

/* Desktop: wide table. Smaller viewports: card list (breakpoint matches common tablet / narrow windows). */
.page-compare .compare-table-desktop {
    display: block;
}

.page-compare .compare-cards-mobile {
    display: none;
}

.page-compare .compare-cards-mobile-heading {
    display: none;
    font-size: 13px;
    font-weight: 700;
    color: #334155;
    margin: 0 0 14px;
    letter-spacing: 0.02em;
    line-height: 1.3;
}

.page-compare .compare-card-group {
    margin-bottom: 22px;
}

.page-compare .compare-card-cat {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
    margin: 0 0 10px;
    padding-bottom: 6px;
    border-bottom: 2px solid #e2e8f0;
    font-weight: 700;
}

.page-compare .compare-card-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.page-compare .compare-test-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 14px 16px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.07);
}

.page-compare .compare-test-card.conflict {
    background: #fefce8;
    border-color: #fde68a;
    box-shadow: 0 2px 10px rgba(234, 179, 8, 0.12);
}

.page-compare .compare-test-card-title {
    margin: 0 0 10px;
    font-size: 15px;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.3;
}

.page-compare .compare-test-card-anns {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.page-compare .compare-test-card-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 13px;
    padding: 6px 8px;
    background: #f8fafc;
    border-radius: 8px;
}

.page-compare .compare-test-card-label {
    color: #334155;
    word-break: break-word;
    text-align: left;
}

.page-compare .compare-test-card-row .check-yes,
.page-compare .compare-test-card-row .check-no {
    flex-shrink: 0;
}

.page-compare .compare-test-card-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e2e8f0;
    font-size: 13px;
}

.page-compare .compare-test-card-summary-k {
    flex-shrink: 0;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
}

.page-compare .compare-test-card-summary-v {
    font-weight: 600;
    text-align: right;
    line-height: 1.3;
}

.page-compare .compare-note-card {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 10px 12px;
    background: #f8fafc;
}

.page-compare .compare-note-card-name {
    font-size: 12px;
    font-weight: 600;
    color: #334155;
    margin-bottom: 6px;
}

.page-compare .compare-note-card-text {
    font-size: 12px;
    color: #475569;
    line-height: 1.45;
}

.page-compare .compare-note-card-text .note-wrap {
    max-width: 100%;
}

.page-compare .compare-totals-wrap .compare-totals-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.page-compare .compare-totals-wrap .compare-totals-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    padding: 8px 10px;
    background: #f1f5f9;
    border-radius: 8px;
}

.page-compare .compare-totals-val {
    font-weight: 700;
    color: #0f172a;
    flex-shrink: 0;
}

.page-compare .compare-totals-foot {
    margin-top: 4px;
    padding-top: 10px;
    border-top: 1px solid #cbd5e1;
    font-weight: 600;
}

@media (max-width: 1024px) {
    .page-compare .compare-table-desktop {
        display: none;
    }

    .page-compare .compare-cards-mobile {
        display: block;
    }

    .page-compare .compare-cards-mobile-heading {
        display: block;
    }

    .page-compare .compare-table-wrap {
        overflow-x: visible;
    }
}

@media (max-width: 640px) {
    .page-compare .compare-table-wrap {
        padding: 14px;
    }

    .page-compare .compare-test-card-row {
        min-height: 40px;
        padding: 8px 10px;
    }

    .page-compare .select-best-section {
        padding: 14px;
    }

    .page-compare .select-best-toggle {
        padding: 10px;
    }

    .page-compare .select-best-btn,
    .page-compare .review-save-btn {
        width: 100%;
    }
}
