/* =================================================================
   COMPOSER REVIEW — the teacher reads and marks students' writing

   A list of handed-in sets, then one set at a time: the sentence, the
   student's English, a player, and two 1-5 scales.
   ================================================================= */

.module-review {
    display: flex;
    flex-direction: column;
    gap: 18px;
    max-width: 960px;
    margin: 0 auto;
    padding: 16px;
}

.cr-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.cr-head h4 {
    margin: 0;
}

.cr-sub {
    color: var(--text-secondary);
    font-size: 0.88rem;
}

.cr-filter {
    display: flex;
    gap: 6px;
    margin-left: auto;
}

.cr-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cr-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    border-radius: 11px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    text-align: left;
    cursor: pointer;
}

.cr-row:hover {
    border-color: var(--primary);
}

.cr-row-done {
    opacity: 0.7;
}

.cr-row-who {
    min-width: 140px;
    font-weight: 700;
}

.cr-row-what,
.cr-row-n,
.cr-row-when {
    color: var(--text-secondary);
    font-size: 0.86rem;
}

.cr-badge {
    margin-left: auto;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--primary);
    color: var(--as-on-brand, #fff);
    font-size: 0.75rem;
    font-weight: 700;
}

.cr-badge-done {
    background: var(--success, #16a34a);
}

.cr-sentences {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cr-sentence {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-secondary);
}

.cr-sentence-head {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cr-n {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    font-size: 0.78rem;
    font-weight: 700;
}

.cr-formula {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.cr-text {
    font-size: 1.1rem;
    font-weight: 600;
}

.cr-english {
    color: var(--text-secondary);
}

.cr-audio {
    max-width: 340px;
}

.cr-noaudio {
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--text-secondary);
    font-size: 0.84rem;
}

.cr-marks {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    padding-top: 6px;
    border-top: 1px solid var(--border-color);
}

.cr-scale {
    display: flex;
    align-items: center;
    gap: 7px;
}

.cr-scale-label {
    color: var(--text-secondary);
    font-size: 0.82rem;
}

.cr-dot {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.86rem;
    font-weight: 600;
    cursor: pointer;
}

.cr-dot.on {
    border-color: var(--primary);
    background: var(--primary);
    color: var(--as-on-brand, #fff);
}

.cr-dot:disabled {
    cursor: default;
    opacity: 0.65;
}

.cr-by {
    color: var(--text-secondary);
    font-size: 0.76rem;
    font-style: italic;
}

.cr-finish {
    display: flex;
    flex-direction: column;
    gap: 7px;
    align-items: flex-start;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.cr-finish-note,
.cr-note {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.84rem;
}

.cr-note {
    padding: 10px 14px;
    border-radius: 9px;
    background: var(--bg-tertiary);
}

.cr-error {
    padding: 10px 14px;
    border: 1px solid var(--danger, #dc2626);
    border-radius: 9px;
    color: var(--danger, #dc2626);
    font-size: 0.88rem;
}

.cr-empty,
.cr-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 40px 20px;
    color: var(--text-secondary);
    text-align: center;
}

@media (width <= 640px) {
    .cr-row-who {
        min-width: 0;
        flex-basis: 100%;
    }

    .cr-filter {
        margin-left: 0;
    }
}

/* Per-sentence save state (v0.25.0.1): a mark saves in place, and says so
   beside the sentence rather than in a banner at the top of the page. */
.cr-savestate { display: block; min-height: 1.2em; margin-top: 6px; font-size: 13px; color: var(--text-secondary); }
.cr-savestate[data-state="saved"] { color: var(--success, #0f7a5f); }
.cr-savestate[data-state="error"] { color: var(--danger, #b42318); font-weight: 600; }

/* Small buttons (v0.25.9.0). Students' Writing used to borrow .btn-sm from
   teacher-dashboard.css, which styled it on every page. That rule now stays
   on the Dashboard, so this screen keeps its own copy — and never wraps. */
.module-review .btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    white-space: nowrap;
}

/* The queue and the note for the student (v0.25.19.0, T6). */
ol.cr-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.cr-list .cr-row {
    width: 100%;
    min-height: 44px;
}

.cr-start {
    align-self: flex-start;
    min-height: 44px;
}

.cr-pos {
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
}

.cr-row-note {
    color: var(--primary);
}

.cr-dot {
    width: 40px;
    height: 40px;
}

.cr-comment {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cr-comment label {
    font-weight: 600;
}

.cr-optional,
.cr-comment-hint {
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 400;
}

.cr-comment textarea {
    width: 100%;
    min-height: 5.5em;
    resize: vertical;
    font: inherit;
}

.cr-comment-foot {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px;
}

.cr-comment-foot .cr-savestate {
    min-height: 0;
    margin-top: 0;
}

.cr-savestate[data-state="pending"] {
    color: var(--text-secondary);
    font-style: italic;
}

.cr-finish-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.cr-finish-btns .btn {
    min-height: 44px;
}

@media (max-width: 768px) {
    .cr-dot {
        width: 44px;
        height: 44px;
    }

    .cr-marks {
        gap: 12px;
    }

    .cr-scale {
        flex-wrap: wrap;
    }

    .cr-scale-label {
        flex-basis: 100%;
    }

    /* Finish stays in reach at the bottom of a long set. */
    .cr-finish {
        position: sticky;
        bottom: 0;
        z-index: 2;
        padding: 10px 0 calc(10px + env(safe-area-inset-bottom));
        background: var(--bg-primary);
    }

    .cr-finish-btns .btn {
        flex: 1 1 100%;
    }

    .cr-finish-note {
        display: none;
    }
}
