/* Homework one task at a time, teens and adults (2026-11-03). See homework-steps.js.
   Everything here sits under .hws-on (one at a time) or .hws-all (the whole page),
   so the normal homework page and the kids screens are never touched. */

/* ── The page makes room: one column, no side panel ── */
.hw-layout:has(.hws-on) { display: block; }
.hw-layout:has(.hws-on) > .hw-side { display: none; }
.hws-on { max-width: 780px; margin: 0 auto; }

/* Hidden tasks, the page's own title (the start screen shows it) and the page's own
   buttons (Finish presses them) */
.hws-on > .hw-title,
.hws-on .hws-off,
.hws-on .hw-footer,
.hws-on .hw-foot-submit { display: none !important; }
.hws-pop[hidden], .hws-start[hidden], .hws-btn[hidden] { display: none !important; }

/* Before Start only the start screen shows */
.hws-on:not(.hws-started) .hw-card,
.hws-on:not(.hws-started) .hws-controls,
.hws-on:not(.hws-started) .hws-dots,
.hws-on:not(.hws-started) .hws-dot-labels,
.hws-on:not(.hws-started) .hws-track,
.hws-on:not(.hws-started) .hws-count { display: none !important; }

/* The whole page (adults only): our extras step aside */
.hws-all .hws-controls, .hws-all .hws-dots, .hws-all .hws-dot-labels,
.hws-all .hws-track, .hws-all .hws-count, .hws-all .hws-start { display: none !important; }
.hws-all .hws-bar { justify-content: flex-end; }

/* ── Start screen ── */
.hws-start {
    background: #fff; border: 1px solid #E7E3DC; border-radius: 20px;
    padding: 32px 36px; margin: 8px 0 20px; display: flex; flex-direction: column; gap: 18px;
    box-shadow: 0 2px 10px rgba(42,33,24,.05);
}
.hws-start-title { margin: 0; font-size: 28px; font-weight: 800; letter-spacing: -0.02em; color: #1F1D1A; line-height: 1.2; }
.hws-start-meta { margin: -10px 0 0; font-size: 15px; color: #6B665E; }
.hws-start-list { display: flex; flex-direction: column; gap: 10px; }
.hws-start-row { display: flex; align-items: center; gap: 14px; padding: 13px 16px; border-radius: 14px; border: 1px solid var(--g-edge); background: var(--g-bg); }
.hws-start-num { width: 36px; height: 36px; border-radius: 10px; background: var(--g-tint); color: var(--g-ink); font-weight: 800; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.hws-start-txt { display: flex; flex-direction: column; }
.hws-start-txt b { font-size: 16px; color: #1F1D1A; }
.hws-start-txt small { font-size: 13px; color: #6B665E; }
.hws-start .hws-btn--big { align-self: flex-start; }

/* The three parts of the homework, the same colours everywhere */
.hws-start-row--words,     .hws-dot--words,     .hws-dl--words     { --g-ink: #C26A00; --g-tint: #FFF1DC; --g-bg: #FFFBF4; --g-edge: #F0E2CC; --g-solid: #F5A623; --g-soft: #F7D9A8; }
.hws-start-row--listening, .hws-dot--listening, .hws-dl--listening { --g-ink: #2F5FA8; --g-tint: #E7F0FC; --g-bg: #F7FAFE; --g-edge: #DCE7F7; --g-solid: #3B7DD8; --g-soft: #BBD0EE; }
.hws-start-row--turn,      .hws-dot--turn,      .hws-dl--turn      { --g-ink: #1F7A48; --g-tint: #E6F4EC; --g-bg: #F6FBF8; --g-edge: #D6EEDF; --g-solid: #2E9E5E; --g-soft: #B9DEC8; }

/* ── Progress along the top ── */
.hws-bar { display: flex; align-items: center; gap: 14px; margin: 4px 0 16px; }
.hws-track { flex: 1; height: 8px; border-radius: 99px; background: #EFE3D2; overflow: hidden; }
.hws-fill { height: 8px; width: 0; border-radius: 99px; background: #F5A623; transition: width .25s ease; }
.hws-count { font-size: 14px; font-weight: 700; color: #8A5A10; white-space: nowrap; }
.hws-switch {
    border: 0; background: none; font-family: inherit; font-size: 13px; font-weight: 600;
    color: #6B665E; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; padding: 6px 2px; white-space: nowrap;
}
.hws-switch:hover { color: #1F1D1A; }

/* ── The task card: chunky edge in its part's colour, easy to read ── */
.hws-on .hw-card.hws-now {
    border: 2px solid var(--hws-edge, #F5A623); border-radius: 18px;
    box-shadow: 0 4px 0 var(--hws-edge, #D98A12) !important;   /* replaces the old left stripe */
    padding: 26px 30px;
}
.hws-on .hw-card.hws-now[data-hws-group="words"]     { --hws-edge: #F5A623; }
.hws-on .hw-card.hws-now[data-hws-group="listening"] { --hws-edge: #3B7DD8; }
.hws-on .hw-card.hws-now[data-hws-group="turn"]      { --hws-edge: #2E9E5E; }
.hws-on .hw-card.hws-now .hw-sec-title { font-size: 13px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: #6B665E; }
.hws-on .hw-card.hws-now .hw-sec-hint { font-size: 15px; color: #4A463F; }
.hws-on .hw-card.hws-now .mc-question,
.hws-on .hw-card.hws-now .lst-q { font-size: 19px; line-height: 1.5; }
.hws-on .hw-card.hws-now .mc-option { font-size: 16px; min-height: 48px; }
.hws-on .hw-card.hws-now textarea,
.hws-on .hw-card.hws-now .blank-input { font-size: 16px; }

/* ── Back, Save, Next / Finish ── */
.hws-controls { display: flex; align-items: center; gap: 10px; margin: 18px 0 0; flex-wrap: wrap; }
.hws-gap { flex: 1; }
.hws-btn {
    font-family: inherit; font-size: 15px; font-weight: 700; cursor: pointer;
    height: 46px; padding: 0 22px; border-radius: 12px; white-space: nowrap;
}
.hws-btn--go { background: #F5A623; color: #fff; border: 0; box-shadow: 0 3px 0 #D98A12; }
.hws-btn--go:hover { background: #E8991B; }
.hws-btn--go:active { transform: translateY(2px); box-shadow: 0 1px 0 #D98A12; }
.hws-btn--quiet { background: #fff; color: #5C564C; border: 1px solid #E7DAC6; }
.hws-btn--quiet:hover { background: #FBF8F4; border-color: #D9CBB4; }
.hws-btn--big { height: 52px; padding: 0 34px; font-size: 17px; font-weight: 800; }
.hws-btn:focus-visible, .hws-dot:focus-visible, .hws-switch:focus-visible { outline: 3px solid #F5A623; outline-offset: 2px; }

/* ── One dot per task ── */
.hws-dots { display: flex; gap: 6px; margin: 22px 0 6px; }
.hws-dot {
    flex: 1; min-width: 10px; height: 8px; border: 0; padding: 0; border-radius: 99px; cursor: pointer;
    background: var(--g-soft); opacity: .55; transition: opacity .15s, transform .15s;
}
.hws-dot.is-done { background: var(--g-solid); opacity: 1; }
.hws-dot.is-now { opacity: 1; transform: scaleY(1.6); background: var(--g-solid); }
.hws-dot:disabled { cursor: default; }
.hws-dot-labels { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; font-weight: 700; }
.hws-dl { color: var(--g-ink); }

/* ── All done? ── */
.hws-pop { position: fixed; inset: 0; z-index: 9999; background: rgba(20,15,5,.55); display: flex; align-items: center; justify-content: center; padding: 16px; }
.hws-pop-box {
    background: #fff; border: 2px solid #F5A623; border-radius: 18px; box-shadow: 0 5px 0 #D98A12, 0 12px 32px rgba(0,0,0,.16);
    padding: 26px 28px 22px; max-width: 440px; width: 100%;
}
.hws-pop-box h2 { margin: 0 0 8px; font-size: 20px; font-weight: 800; color: #1F1D1A; }
.hws-pop-box p { margin: 0 0 20px; font-size: 15px; color: #4A463F; line-height: 1.5; }
.hws-pop-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }

/* ── Phones ── */
@media (max-width: 600px) {
    .hws-start { padding: 24px 20px; }
    .hws-start-title { font-size: 23px; }
    .hws-on .hw-card.hws-now { padding: 20px 18px; }
    .hws-btn { padding: 0 16px; }
    .hws-controls .hws-btn--go { flex: 1; }
    .hws-dot-labels { font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
    .hws-fill, .hws-dot { transition: none; }
}

/* ── 2026-11-03 round 2: the task dots are the progress bar, at the top ── */
.hws-bar { flex-direction: column; align-items: stretch; gap: 6px; margin: 4px 0 18px; }
.hws-bar-row { display: flex; align-items: center; gap: 14px; }
.hws-bar .hws-track { display: none; }            /* OLD plain bar, replaced by the dots */
.hws-bar .hws-dots { flex: 1; margin: 0; }
.hws-bar .hws-dot { height: 10px; }
.hws-bar .hws-dot.is-now { transform: none; box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--g-solid); }
.hws-bar .hws-dot-labels { justify-content: flex-start; gap: 6px; padding-right: 64px; }
.hws-bar .hws-dl { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hws-bar .hws-switch { align-self: flex-end; margin-top: -2px; }

/* The words in this homework, tap one to put it in the box */
.hws-words { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px;
             padding: 12px 14px; background: #fff; border: 1px solid #EFE3D2; border-radius: 14px; }
.hws-words[hidden] { display: none !important; }
.hws-words-label { font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: #8A6A3A; margin-right: 4px; }
.hws-word { font-family: inherit; font-size: 15px; font-weight: 600; color: #7A4A00; background: #FFF3E2;
            border: 1px solid #F3C98A; border-radius: 999px; padding: 6px 14px; cursor: pointer; }
.hws-word:hover { background: #FFE7C4; border-color: #F5A623; }
.hws-word:focus-visible { outline: 3px solid #F5A623; outline-offset: 2px; }

/* Before Start and on the whole page, the bar only keeps the switch */
.hws-on:not(.hws-started) .hws-bar-row,
.hws-on:not(.hws-started) .hws-words,
.hws-all .hws-bar-row, .hws-all .hws-words { display: none !important; }

@media (max-width: 600px) {
    .hws-bar .hws-dot-labels { padding-right: 0; }
    .hws-word { font-size: 14px; padding: 5px 12px; }
}

/* ── Focus view (2026-11-03): after Start the homework fills the screen, big and in the middle.
   Only pages that ask for it get the hws-focus class (the share link for now). ── */
.hws-focus-head { display: none; }
body.hws-focus-open { overflow: hidden; }
.hw-note-questions.hws-focus {
    position: fixed; inset: 0; z-index: 1000; display: flex !important;
    overflow-y: auto; padding: 20px 16px 32px; background: #F8F7F5;
}
/* margin: auto puts it in the middle, and it still scrolls when it is taller than the screen */
.hws-focus > .hw-layout { display: block; width: 100%; max-width: 920px; margin: auto; }
.hws-focus .hw-side { display: none; }
.hws-focus .hws-focus-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.hws-focus-title { min-width: 0; font-size: 14px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: #A35A00; }
.hws-focus-close { flex: none; }

/* Bigger writing */
.hws-focus .hws-on .hw-card.hws-now { padding: 30px 34px; }
.hws-focus .hw-sec-title { font-size: 18px; }
.hws-focus .hw-sec-hint { font-size: 17px; }
.hws-focus .mc-question { font-size: 23px; line-height: 1.4; }
.hws-focus .mc-option { padding: 15px 18px; font-size: 18px; }
.hws-focus .fill-row { font-size: 20px; line-height: 2; }
.hws-focus .blank-input { font-size: 18px; }
.hws-focus .create-ta { font-size: 18px; }
.hws-focus .w-token { padding: 8px 16px; font-size: 17px; }
.hws-focus .hws-btn { min-height: 48px; font-size: 16px; }

/* Phones and tablets (2026-11-04): keep clear of the notch and the home bar,
   and scrolling the homework never scrolls the page behind it */
.hw-note-questions.hws-focus {
    padding-top: max(20px, env(safe-area-inset-top, 0px));
    padding-bottom: max(32px, env(safe-area-inset-bottom, 0px));
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 900px) {
    .hws-focus .hws-on .hw-card.hws-now { padding: 24px 22px; }
    .hws-focus .mc-question { font-size: 21px; }
}

@media (max-width: 600px) {
    .hw-note-questions.hws-focus { padding: max(12px, env(safe-area-inset-top, 0px)) 10px max(24px, env(safe-area-inset-bottom, 0px)); }
    .hws-focus .hws-on .hw-card.hws-now { padding: 20px 18px; }
    .hws-focus .mc-question { font-size: 19px; }
    .hws-focus .mc-option { font-size: 16px; }
    /* The title and Close share one line; a long title wraps rather than squash Close */
    .hws-focus .hws-focus-head { align-items: flex-start; }
    .hws-focus .hws-focus-title { font-size: 12.5px; }
    /* Back and Next side by side, both easy to tap */
    .hws-focus .hws-controls { gap: 8px; }
    .hws-focus .hws-btn { min-height: 46px; }
    .hws-focus .fill-row { font-size: 18px; }
    .hws-focus .w-token { font-size: 15px; padding: 7px 12px; }
}

/* Listen and Complete: one recording, all its rows on one screen (2026-11-03).
   Only the first row keeps a play button, which plays the whole recording. */
.hws-on .hws-group-rest .lst-again,
.hws-on .hws-group-rest .lst-play,
.hws-on .hws-group-rest audio { display: none !important; }
.hws-on .hws-group-rest { margin-top: 12px; }

/* Focus view: the title, and under it the warning that nothing is saved until Finish */
.hws-focus-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.hws-focus-note { font-size: 13px; color: #8A5A10; }

/* The question on show (2026-11-03): no divider or gap above it, whatever its place in
   the list, so the card is the same size for question 1, 2 and 6. A grouped timetable
   keeps the gaps between its own rows. */
.hws-on .hws-cur-first { border-top: 0 !important; margin-top: 0 !important; padding-top: 0 !important; }
.hws-on .hws-cur-first::before { display: none !important; }
