.speaker-round-review-message { margin: 70px auto; color: #687386; text-align: center; }
.speaker-round-review-error { color: #b3261e; }

.speaker-review-evaluation-status {
    padding: 24px 16px;
    color: #687386;
    font-size: 12px;
    line-height: 1.5;
    text-align: center;
}
.speaker-review-retry {
    margin-top: 14px;
    padding: 7px 16px;
    border: 1px solid #a9cbfb;
    border-radius: 6px;
    color: #1769d2;
    background: #fff;
}

/* Review sheet used after each GPT round. */
.dialog:has(.speaker-round-review-content) {
    align-items: center;
    padding: 18px;
    background: rgba(17, 24, 39, .42);
}

.speaker-round-review-content {
    --speaker-review-preview-size: clamp(300px, min(52vw, calc(100vh - 260px)), 560px);
    --speaker-review-detail-width: clamp(240px, 24vw, 320px);
    --speaker-review-gap: 16px;
    display: flex;
    flex-direction: column;
    width: min(
        calc(100vw - 36px),
        calc(var(--speaker-review-preview-size) + var(--speaker-review-detail-width) + var(--speaker-review-gap) + 32px)
    );
    max-width: none;
    height: auto;
    max-height: calc(100vh - 36px);
    min-height: 0;
    padding: 0;
    overflow-x: hidden;
    overflow-y: auto;
    border-radius: 12px;
    background: #fff;
}

.speaker-round-review-header {
    position: relative;
    display: block;
    padding: 14px 18px 12px;
    border-bottom: 0;
    text-align: center;
}

.speaker-round-review-header h3 {
    margin: 0;
    color: #202124;
    font-size: 21px;
    font-weight: 720;
    letter-spacing: -.02em;
}

.speaker-round-review-body {
    /* Inline containment keeps responsive widths without collapsing auto height. */
    container-type: inline-size;
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    align-items: stretch;
    height: auto;
    min-height: 0;
    overflow: visible;
    padding: 0 16px 14px;
}

.speaker-round-review-layout {
    display: grid;
    flex: 0 0 auto;
    align-self: center;
    width: calc(var(--speaker-review-preview-size) + var(--speaker-review-detail-width) + var(--speaker-review-gap));
    height: calc(var(--speaker-review-preview-size) + 44px);
    min-height: 0;
    overflow: hidden;
    grid-template-columns: var(--speaker-review-preview-size) var(--speaker-review-detail-width);
    grid-template-rows: calc(var(--speaker-review-preview-size) + 44px);
    align-items: stretch;
    gap: var(--speaker-review-gap);
}

.speaker-round-review-detail-column {
    display: grid;
    min-width: 0;
    min-height: 0;
    height: 100%;
    grid-template-rows: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.speaker-round-review-panel {
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    border: 3px solid #2b2d31;
    border-radius: 10px;
    background: #fff;
}

.speaker-round-review-preview-panel,
.speaker-round-review-result-panel {
    display: grid;
    grid-template-rows: 50px minmax(0, 1fr);
}

.speaker-round-review-preview-stack {
    display: block;
    width: var(--speaker-review-preview-size);
    height: calc(var(--speaker-review-preview-size) + 44px);
    min-width: 0;
    min-height: 0;
}

.speaker-round-review-stage-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-width: 0;
    margin-top: 10px;
}

#speaker-review-change-stage {
    flex: 0 0 auto;
    padding: 8px 14px;
    border: 2px solid #2b2d31;
    border-radius: 8px;
    background: #fff;
    color: #36383d;
    font-weight: 600;
    cursor: pointer;
}

#speaker-review-change-stage:disabled {
    opacity: .5;
    cursor: default;
}

.speaker-round-review-rating-slot {
    display: flex;
    flex: 1 1 auto;
    justify-content: center;
    min-width: 0;
}

.speaker-round-review-rating-slot[hidden] { display: none; }

.speaker-round-review-rating-slot .speaker-round-review-rating { width: 100%; }

.speaker-round-review-rating-slot:not(:has(:not(.hidden))) {
    display: none;
}

.speaker-round-review-rating-slot .speaker-round-review-rating,
.speaker-round-review-rating-slot .structure-program-review-rating {
    margin-left: 0;
}

.speaker-round-review-preview-panel {
    position: relative;
    align-self: stretch;
    box-sizing: border-box;
    width: var(--speaker-review-preview-size);
    height: calc(var(--speaker-review-preview-size) + 44px);
    min-height: 0;
    flex: 0 0 auto;
    /* The remaining track is square after the panel border is accounted for. */
    grid-template-rows: 44px minmax(0, 1fr) 62px;
}

.speaker-round-review-panel-heading {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 0 14px;
    border-bottom: 3px solid #2b2d31;
    color: #36383d;
    font-size: 17px;
    font-weight: 800;
    letter-spacing: .025em;
}

.speaker-round-review-combined-heading {
    gap: 18px;
}

.speaker-round-review-legend {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.speaker-round-review-legend i {
    width: 22px;
    height: 4px;
    border-radius: 2px;
    background: #202124;
}

.speaker-round-review-legend i.is-target {
    background: #ff7a00;
}

.speaker-round-review-panel-heading strong {
    position: absolute;
    right: 15px;
    padding: 3px 8px;
    border-radius: 999px;
    background: #f0f2f5;
    color: #5c6471;
    font-size: 11px;
    letter-spacing: 0;
}

.speaker-round-review-preview-panel svg {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 0;
}

.speaker-round-review-overlay-toggle {
    position: static;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 12px;
    border: 1px solid #d5dae3;
    border-radius: 6px;
    background: #fff;
    color: #667083;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: none;
}

.speaker-round-review-overlay-toggle.active {
    border-color: #e3a45e;
    background: #fff7ed;
    color: #b65e00;
}

.speaker-round-review-overlay-icon {
    position: relative;
    display: inline-block;
    width: 14px;
    height: 10px;
}

.speaker-round-review-overlay-icon::before,
.speaker-round-review-overlay-icon::after {
    position: absolute;
    left: 1px;
    width: 12px;
    height: 2px;
    border-radius: 2px;
    content: "";
    transform: rotate(-28deg);
}

.speaker-round-review-overlay-icon::before { top: 2px; background: #e37400; }
.speaker-round-review-overlay-icon::after { bottom: 2px; background: #202124; }

.speaker-round-review-list {
    min-height: 0;
    overflow: auto;
    padding: 4px 8px 8px;
}

.speaker-round-review-row {
    display: flex;
    width: 100%;
    min-height: 42px;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 6px 10px;
    border: 1px solid transparent;
    border-bottom-color: #e5e8ed;
    border-radius: 0;
    background: #fff;
    text-align: left;
}

.speaker-round-review-row:hover { background: #f7f9fc; }
.speaker-round-review-row.selected {
    border-color: #f3b4b4;
    border-radius: 8px;
    background: #fdecec;
}

.speaker-round-review-row.is-inactive .speaker-round-review-row-identity strong {
    color: #a4abb6;
}

.speaker-round-review-row.is-inactive .speaker-round-review-kind-badge {
    background: #b8bec7;
}

.speaker-round-review-row.is-active .speaker-round-review-row-identity strong {
    color: #252b36;
}

.speaker-round-review-row-copy {
    display: flex;
    min-width: 0;
    flex: 1;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
}

.speaker-round-review-row-copy > small {
    color: #687386;
    font-size: 11px;
    padding-left: 27px;
    white-space: normal;
}

.speaker-score-details {
    display: flex;
    flex-direction: column;
    gap: 7px;
    padding: 10px;
    margin-top: 5px;
    border: 1px solid #d6e1ee;
    border-radius: 7px;
    background: #f7faff;
    color: #354056;
    font-size: 11px;
    line-height: 1.5;
    white-space: normal;
    overflow-wrap: anywhere;
}

.speaker-score-toggle { color: #2764ab !important; }

.speaker-round-review-row-identity {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 7px;
}

.speaker-round-review-row-identity strong {
    overflow: hidden;
    color: #252b36;
    font-size: 12px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.speaker-round-review-kind-badge {
    display: inline-flex;
    width: 20px;
    height: 17px;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    background: #626a75;
    color: #fff;
    font-size: 10px;
    font-style: normal;
    font-weight: 800;
}

.speaker-round-review-result-panel:last-child .speaker-round-review-kind-badge { background: #2374e1; }
.speaker-round-review-result-panel:last-child .speaker-round-review-row.is-inactive .speaker-round-review-kind-badge { background: #b8bec7; }

.speaker-round-review-status-badge {
    flex: 0 0 auto;
    padding: 4px 7px;
    border-radius: 999px;
    background: #18864b;
    color: #fff;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .035em;
}

.speaker-round-review-empty {
    display: flex;
    height: 100%;
    min-height: 180px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 28px;
    color: #87909e;
    text-align: center;
}

.speaker-round-review-empty i { color: #c4cad3; font-size: 30px; font-style: normal; }
.speaker-round-review-empty strong { margin-top: 8px; color: #606a79; font-size: 12px; }
.speaker-round-review-empty p { max-width: 260px; margin: 5px 0 0; font-size: 10px; line-height: 1.45; }

.speaker-round-review-curve-layer { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.curve-speaker-target-base { stroke: #ff7a00; stroke-width: .34; opacity: 1; }
.curve-speaker-target-overlay { stroke: #ff7a00; stroke-width: .58; opacity: .78; }
.curve-speaker-current-base { stroke: #202124; stroke-width: .28; opacity: 1; }
.curve-speaker-current-aligned { stroke: #18864b; stroke-width: .5; opacity: 1; }
.curve-speaker-target-hot { stroke: #e10600; stroke-width: .48; opacity: 1; }
.curve-speaker-current-hot { stroke: #e10600; stroke-width: .36; opacity: 1; }

.speaker-round-review-footer {
    display: flex;
    min-height: 66px;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 10px 20px 14px;
    border-top: 0;
    background: #fff;
}

.speaker-review-edit-toolbar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border-top: 2px solid #34383e;
    background: white;
    padding: 6px;
}
#speaker-review-drag-status { font-size: 12px; max-width: 65%; color: #52605a; }

#speaker-review-edit-points {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 2px solid #34383e;
    border-radius: 9px;
    background: white;
    color: #34383e;
    cursor: pointer;
}

#speaker-review-edit-points svg { width: 23px; height: 23px; }
#speaker-review-edit-points:disabled {
    background: #e9ecef;
    color: #a1a7af;
    border-color: #cbd0d6;
    cursor: not-allowed;
}
#speaker-review-edit-points[aria-pressed="true"] {
    color: #17653a;
    background: #dcf5e6;
    border-color: #18864b;
}
#speaker-review-edit-points:focus-visible { outline: 3px solid #4285f4; outline-offset: 2px; }
#speaker-round-review-compare-svg { touch-action: none; user-select: none; }

.speaker-review-visibility-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.speaker-review-visibility-toggle {
    display: inline-flex;
    min-width: 82px;
    height: 40px;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 0 10px;
    border: 2px solid #cbd0d6;
    border-radius: 9px;
    background: #f1f3f4;
    color: #7d848c;
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    font-weight: 750;
}

.speaker-review-visibility-toggle.is-visible {
    border-color: #34383e;
    background: #fff;
    color: #202124;
}

.speaker-review-visibility-toggle.is-target.is-visible {
    border-color: #ff7a00;
    color: #b85400;
}

.speaker-review-visibility-toggle:focus-visible {
    outline: 3px solid #4285f4;
    outline-offset: 2px;
}

.speaker-review-visibility-symbol {
    position: relative;
    width: 22px;
    height: 12px;
    flex: 0 0 22px;
}

.speaker-review-visibility-symbol i {
    position: absolute;
    top: 5px;
    left: 2px;
    width: 18px;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
}

.speaker-review-visibility-symbol b {
    position: absolute;
    top: 3px;
    width: 6px;
    height: 6px;
    border: 1.5px solid currentColor;
    border-radius: 50%;
    background: #fff;
}

.speaker-review-visibility-symbol b:first-of-type { left: 0; }
.speaker-review-visibility-symbol b:last-of-type { right: 0; }

.speaker-review-target-control-points,
.speaker-review-current-control-points {
    pointer-events: none;
}

.speaker-review-target-control-point {
    fill: #fff;
    stroke: #ff7a00;
    stroke-width: .15;
}

.speaker-review-current-control-point {
    fill: #202124;
    stroke: #fff;
    stroke-width: .08;
}

.speaker-review-current-control-point.is-interactive {
    pointer-events: auto;
    cursor: pointer;
}

.speaker-review-current-control-point.is-aligned {
    opacity: .25;
    pointer-events: none;
    cursor: default;
}

.speaker-review-current-control-point.is-selected {
    fill: #18864b;
    stroke: #fff;
    stroke-width: .1;
}

.speaker-review-target-snap {
    fill: #ff7a00;
    fill-opacity: .18;
    stroke: #ff7a00;
    stroke-width: .2;
    cursor: pointer;
}
.speaker-review-target-snap:hover {
    fill-opacity: .38;
}

.speaker-round-review-footer:not(:has(:not(.hidden))) {
    display: none;
}

.speaker-round-review-stop-status { color: #a14b37; font-size: 11px; font-weight: 650; }
.speaker-round-review-stop-status.is-ready { color: #188038; }

.speaker-round-review-rating {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    width: min(100%, 900px);
    padding: 10px 14px;
    border: 2px solid #2b2d31;
    border-radius: 10px;
    background: #fff;
}

.speaker-round-review-guidance-copy {
    min-width: 0;
    color: #3f4650;
}

.speaker-round-review-guidance-copy strong {
    display: block;
    margin-bottom: 3px;
    font-size: 13px;
    font-weight: 800;
}

.speaker-round-review-guidance-copy p {
    margin: 0;
    font-size: 12px;
    line-height: 1.45;
}

.speaker-round-review-rating .speaker-round-review-continue {
    flex: 0 0 auto;
    min-width: 138px;
    min-height: 40px;
    padding: 8px 16px;
    border: 2px solid #2b2d31;
    border-radius: 8px;
    background: #fff;
    color: #202124;
    font-size: 13px;
    font-weight: 800;
}

.speaker-round-review-rating .speaker-round-review-continue:hover,
.speaker-round-review-rating .speaker-round-review-continue:focus-visible {
    border-color: #1a73e8;
    box-shadow: 0 0 0 3px rgba(26, 115, 232, .18);
}

@media (max-width: 1080px) {
    .speaker-round-review-content { max-height: calc(100vh - 20px); min-height: 0; }
    .speaker-round-review-panel-heading { font-size: 14px; }
}

@media (max-width: 820px) {
    .dialog:has(.speaker-round-review-content) { align-items: flex-start; padding: 8px; }
    .speaker-round-review-content {
        width: calc(100vw - 16px);
        height: auto;
        max-height: calc(100dvh - 16px);
        min-height: 0;
        overflow-x: hidden;
        overflow-y: auto;
    }
    .speaker-round-review-body { container-type: normal; overflow: visible; height: auto; }
    .speaker-round-review-layout { width: auto; height: auto; overflow: visible; grid-template-columns: 1fr; grid-template-rows: auto; }
    .speaker-round-review-preview-stack { width: var(--speaker-review-preview-size); height: calc(var(--speaker-review-preview-size) + 44px); margin: 0 auto; }
    .speaker-round-review-preview-panel { width: var(--speaker-review-preview-size); height: calc(var(--speaker-review-preview-size) + 44px); }
    .speaker-round-review-detail-column { min-height: 640px; }
    .speaker-round-review-footer { align-items: flex-start; flex-direction: column; }
    .speaker-round-review-rating { align-items: stretch; flex-direction: column; margin-left: 0; }
    .speaker-round-review-stage-actions { align-items: stretch; flex-direction: column; }
}

/* COMICA uses this same review sheet as its only page. */
.structure-program-review-content:has(.is-comica-tree-review):has(.comica-target-review-page) {
    --speaker-review-preview-size: clamp(300px, min(52vw, calc(100vh - 260px)), 560px);
    --speaker-review-detail-width: clamp(240px, 24vw, 320px);
    --speaker-review-gap: 16px;
    width: min(
        calc(100vw - 48px),
        calc(var(--speaker-review-preview-size) + var(--speaker-review-detail-width) + var(--speaker-review-gap) + 48px)
    );
    max-width: none;
    height: auto;
    max-height: calc(100vh - 48px);
}
.comica-target-review-page {
    display: flex;
    flex-direction: column;
    flex: 0 0 auto;
    min-height: 0;
    overflow: hidden;
}
.comica-target-review-page .speaker-round-review-body { flex: 0 0 auto; min-height: 0; padding: 0 0 14px; }
.comica-target-review-page .speaker-round-review-footer { display: none; }
.structure-program-review-content:has(.comica-target-review-page) .structure-program-review-actions:not(:has(button:not(.hidden))) {
    display: none;
}

@media (max-width: 820px) {
    .structure-program-review-content:has(.is-comica-tree-review):has(.comica-target-review-page) {
        --speaker-review-preview-size: min(70vh, calc(100vw - 80px));
        width: calc(100vw - 16px);
        max-height: none;
        overflow: visible;
    }

    .comica-target-review-page .speaker-round-review-body {
        padding-inline: 0;
    }
}
