/*
  Close Reader -- LCA English & Communications.
  Copyright (c) 2017-2026 Coding Ireland. All rights reserved. Ref: CI-english-close-reader

  Layout follows the exam booklet rather than a quiz app: the stimulus sits at the
  top and STAYS there for a text or an image, because the paper leaves the extract
  on the page. For a clip it is replaced by a player that runs out of plays.
*/

/* The activity framework toggles visibility with [hidden]; without this the
   framework's own display rules win and hidden panels still show. */
.cr-activity [hidden] { display: none !important; }

.cr-container {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

/* ------------------------------------------------------------------ top bar */
.cr-topbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    min-height: 1.4rem;
}

.cr-section {
    font-weight: 800;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    font-size: 0.78rem;
    background: #1f3b63;
    color: #fff;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
}

.cr-marks {
    font-weight: 700;
    color: #46505e;
    font-size: 0.85rem;
}

.cr-saved {
    margin-left: auto;
    font-size: 0.82rem;
    color: #5a6472;
    min-height: 1em;
}

.cr-preview-warning {
    margin: 0;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    background: #fff4e5;
    border: 1px solid #f0c27b;
    color: #8a5a00;
    font-weight: 600;
    font-size: 0.88rem;
}

/* ------------------------------------------------------------------- stage */
.cr-stage {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 20rem);
    gap: 1rem;
    align-items: start;
}

/* No notes panel (a text stimulus) -- the source takes the full width. */
.cr-stage:has(> .cr-notes-wrap[hidden]) { grid-template-columns: minmax(0, 1fr); }

@media (max-width: 900px) {
    .cr-stage { grid-template-columns: minmax(0, 1fr); }
}

/* ------------------------------------------------------------------ source */
.cr-source {
    background: #fff;
    border: 1px solid #dde3ea;
    border-radius: 12px;
    padding: 1rem 1.15rem;
    min-width: 0;
}

.cr-source-head {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    margin-bottom: 0.6rem;
}

.cr-source-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 800;
    color: #1f2933;
}

.cr-source-kind {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6b7684;
    border: 1px solid #d6dce4;
    border-radius: 999px;
    padding: 0.1rem 0.5rem;
}

.cr-text { font-size: 1rem; line-height: 1.65; color: #26313c; }
.cr-text p { margin: 0 0 0.8rem; }

/* Lyrics and poetry: the line breaks ARE the text. */
.cr-lyrics {
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.6;
    white-space: pre-wrap;
    margin: 0;
    background: none;
    border: 0;
    padding: 0;
    color: #26313c;
}

.cr-figure { margin: 0; }
.cr-img {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    border: 1px solid #e3e8ee;
}
.cr-caption, .cr-credit {
    font-size: 0.8rem;
    color: #6b7684;
    margin: 0.45rem 0 0;
}

/* ------------------------------------------------------------------ player */
.cr-video {
    width: 100%;
    max-height: 60vh;
    background: #000;
    border-radius: 8px;
    display: block;
}

.cr-player-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 0.6rem;
}

.cr-plays {
    font-weight: 700;
    color: #1f3b63;
    font-size: 0.88rem;
}

.cr-player-note {
    margin: 0.5rem 0 0;
    font-size: 0.82rem;
    color: #6b7684;
}

.btn-control.cr-primary {
    background: #1f3b63;
    border-color: #1f3b63;
    color: #fff;
}
.btn-control.cr-primary:hover:not(:disabled) { background: #295081; }
.btn-control:disabled { opacity: 0.45; cursor: not-allowed; }

/* ------------------------------------------------------------------- notes */
.cr-notes-wrap {
    background: #f7f9fc;
    border: 1px solid #dde3ea;
    border-radius: 12px;
    padding: 0.9rem 1rem;
    min-width: 0;
}

.cr-side-heading {
    margin: 0 0 0.3rem;
    font-size: 0.95rem;
    font-weight: 800;
    color: #1f2933;
}

.cr-side-note {
    margin: 0 0 0.6rem;
    font-size: 0.8rem;
    color: #6b7684;
}

.cr-notes {
    width: 100%;
    border: 1px solid #ccd4de;
    border-radius: 8px;
    padding: 0.6rem;
    font-family: inherit;
    font-size: 0.92rem;
    line-height: 1.5;
    resize: vertical;
}

/* --------------------------------------------------------------- questions */
.cr-locked {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: #f1f4f8;
    border: 1px dashed #b9c4d1;
    border-radius: 12px;
    padding: 1rem 1.15rem;
    color: #46505e;
}
.cr-locked p { margin: 0; font-weight: 600; }

.cr-questions {
    list-style: none;
    counter-reset: crq;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.cr-q {
    counter-increment: crq;
    background: #fff;
    border: 1px solid #dde3ea;
    border-left: 4px solid #c9d3de;
    border-radius: 10px;
    padding: 0.85rem 1rem;
}

.cr-q.is-right { border-left-color: #2e8b57; background: #f4fbf6; }
.cr-q.is-wrong { border-left-color: #c0562f; background: #fdf6f3; }

.cr-q-head { display: flex; gap: 0.6rem; align-items: baseline; }

.cr-q-prompt {
    margin: 0 0 0.55rem;
    font-weight: 700;
    color: #1f2933;
    flex: 1 1 auto;
}
.cr-q-prompt::before {
    content: counter(crq) ". ";
    color: #6b7684;
}

.cr-q-marks {
    font-size: 0.82rem;
    font-weight: 700;
    color: #6b7684;
    white-space: nowrap;
}

/* --------------------------------------------------------------- answering */
.cr-choices { display: flex; flex-direction: column; gap: 0.35rem; }

.cr-choice {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.35rem 0.5rem;
    border-radius: 6px;
    cursor: pointer;
}
.cr-choice:hover { background: #f3f6fa; }
.cr-choice input { width: 1rem; height: 1rem; flex: none; }

.cr-answer {
    width: 100%;
    border: 1px solid #ccd4de;
    border-radius: 8px;
    padding: 0.6rem;
    font-family: inherit;
    font-size: 0.95rem;
    line-height: 1.55;
    resize: vertical;
}
.cr-answer-long { min-height: 11rem; }

.cr-guidance {
    margin-top: 0.6rem;
    font-size: 0.85rem;
    color: #46505e;
}
.cr-guidance summary {
    cursor: pointer;
    font-weight: 700;
    color: #1f3b63;
}
.cr-guidance ul { margin: 0.45rem 0 0; padding-left: 1.1rem; }
.cr-guidance li { margin-bottom: 0.25rem; }

.cr-q-feedback {
    margin: 0.55rem 0 0;
    font-size: 0.88rem;
    font-weight: 600;
    color: #46505e;
}

/* -------------------------------------------------------------------- tail */
.cr-tail {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin-top: 0.9rem;
}

.cr-result {
    margin-top: 0.7rem;
    padding: 0.7rem 0.9rem;
    border-radius: 10px;
    background: #eef3f9;
    border: 1px solid #ccd9e8;
    color: #1f3b63;
    font-weight: 600;
}

/* ------------------------------------------------------- whiteboard display */
body.display-mode .cr-notes-wrap,
body.display-mode .cr-tail { display: none !important; }

body.display-mode .cr-text,
body.display-mode .cr-lyrics { font-size: 1.35rem; line-height: 1.7; }

body.display-mode .cr-q-prompt { font-size: 1.2rem; }
