#allaround:has(#crosswordActivity) {
    background-color: #0b9795 !important;
    background-image: var(--ct-master-background-image) !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    background-size: cover !important;
}

.centre-column:has(#crosswordActivity) > .page_title { box-sizing: border-box; height: 10%; padding-inline-start: 0; }
.centre-column:has(#crosswordActivity) > .shared_body { height: 90%; padding-bottom: 0; }
.crossword-main-panel, #crosswordActivity { box-sizing: border-box; width: 100%; height: 100%; min-height: 0; }
#crosswordActivity { padding: clamp(8px,1.3vh,15px) clamp(10px,1.3vw,20px) clamp(10px,1.5vh,18px); }

.crossword-activity-card {
    display: flex; box-sizing: border-box; width: 100%; height: 100%; min-height: 0;
    padding: clamp(12px,1.6vh,20px) clamp(14px,1.6vw,24px); flex-direction: column; overflow: hidden;
    border: 1px solid rgba(0,128,125,.16); border-radius: var(--ct-radius-panel);
    background: linear-gradient(145deg,var(--ct-surface) 0%,#fffdf8 100%); box-shadow: var(--ct-shadow-panel);
}

.crossword-summary { display: flex; flex: 0 0 auto; gap: clamp(18px,3vw,44px); align-items: flex-start; justify-content: space-between; padding: 0 4px clamp(8px,1.2vh,14px); }
.crossword-heading-row { display: flex; gap: 10px; align-items: center; }
.crossword-instruction-block h1 { margin: 0; color: #007f7c; font-size: clamp(24px,2.5vw,34px); font-weight: 780; line-height: 1.08; }
.crossword-instruction-block p { margin: 4px 0 0; color: var(--ct-muted); font-size: clamp(16px,1.55vw,22px); font-weight: 560; }

.crossword-audio-button {
    display: grid; width: var(--ct-audio-prompt-size); min-width: var(--ct-audio-prompt-size); height: var(--ct-audio-prompt-size);
    padding: 0; place-items: center; border: 1px solid rgba(231,51,82,.24); border-radius: 50%; background: #fff3f4;
    cursor: pointer; transition: transform var(--ct-transition-quick),box-shadow var(--ct-transition-quick),opacity var(--ct-transition-quick);
}
.crossword-audio-button img { width: var(--ct-audio-inline-size); height: var(--ct-audio-inline-size); pointer-events: none; }
.crossword-audio-button:hover:not(:disabled), .crossword-audio-button.is-playing { box-shadow: 0 4px 10px rgba(32,53,72,.16); transform: translateY(-2px); }
.crossword-audio-button:disabled { cursor: default; opacity: .42; }

.crossword-progress { width: min(30%,280px); min-width: 210px; padding-top: 2px; }
.crossword-progress > div { display: flex; align-items: baseline; justify-content: space-between; color: var(--ct-ink); font-size: clamp(16px,1.4vw,20px); font-weight: 650; }
.crossword-progress strong { color: #007f7c; font-size: clamp(18px,1.7vw,24px); }
.crossword-progress-track { display: block; height: 10px; margin-top: 7px; overflow: hidden; border-radius: 999px; background: #dfe4e3; }
.crossword-progress-track i { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--ct-brand-teal); transition: width 320ms ease; }

.crossword-content { display: grid; min-height: 0; flex: 1 1 auto; grid-template-columns: minmax(0,1.7fr) minmax(300px,1fr); gap: clamp(12px,1.6vw,24px); }
.crossword-grid-panel, .crossword-support-panel { position: relative; min-width: 0; min-height: 0; overflow: hidden; border: 1px solid rgba(0,128,125,.16); border-radius: var(--ct-radius-card); background: rgba(255,255,255,.84); box-shadow: var(--ct-shadow-card); }
.crossword-grid-panel { display: grid; padding: clamp(9px,1.2vh,15px); place-items: center; }
.crossword { display: flex; width: 100%; height: 100%; min-height: 0; align-items: center; justify-content: center; overflow: hidden; }
.crossword table { width: auto; height: auto; max-width: 100%; max-height: 100%; margin: auto; border: 0; border-collapse: separate; border-spacing: clamp(2px,.25vmin,4px); table-layout: fixed; }
.crossword td { position: relative; box-sizing: border-box; min-width: 0; min-height: 0; padding: 0; border: 1px solid rgba(32,53,72,.17); border-radius: clamp(3px,.45vmin,7px); background: #fbfcfb; color: var(--ct-ink-strong); cursor: pointer; text-align: center; transition: background-color 150ms ease,box-shadow 150ms ease,transform 150ms ease; }
.crossword td.blackout { border-color: transparent; background: transparent; box-shadow: none; cursor: default; }
.crossword td.is-active-word { border-color: rgba(0,177,173,.42); background: rgba(0,177,173,.13); }
.crossword td.is-current-cell { z-index: 2; border-color: #007f7c; background: rgba(0,177,173,.24); box-shadow: 0 0 0 2px rgba(0,177,173,.24); }
.crossword td.is-complete { background: rgba(0,177,173,.11); }
.crossword td.is-hinted { animation: crossword-hint-pulse 850ms ease-in-out 2; border-color: #d69d00; background: rgba(253,198,82,.42); box-shadow: 0 0 0 4px rgba(253,198,82,.22); }
.crossword .answer_space { display: grid; width: 100%; height: 100%; place-items: center; font-size: var(--crossword-letter-size, 58%); font-weight: 760; line-height: 1; }
.crossword .question_number { position: absolute; z-index: 2; top: 1px; left: 2px; font-size: var(--crossword-number-size, 8px); font-weight: 720; line-height: 1; }
#crosswordActivity.crossword-uppercase .answer_space, #crosswordActivity.crossword-uppercase .crossword-choice { text-transform: uppercase; }
#crosswordActivity.crossword-lowercase .answer_space, #crosswordActivity.crossword-lowercase .crossword-choice { text-transform: lowercase; }

.crossword-support-panel { display: flex; padding: clamp(10px,1.25vh,16px) clamp(11px,1.2vw,18px); flex-direction: column; gap: clamp(7px,.9vh,11px); }
.crossword-support-options { display: grid; flex: 0 0 auto; align-items: center; grid-template-columns: auto 1fr; gap: 6px 12px; }
.crossword-support-options h2 { margin: 0; color: #007f7c; font-size: clamp(16px,1.45vw,20px); }
.crossword-toggle-row { display: flex; justify-self: end; align-items: center; gap: 8px; color: var(--ct-ink); font-size: clamp(14px,1.15vw,17px); font-weight: 650; cursor: pointer; }
.crossword-toggle-row input { position: absolute; opacity: 0; pointer-events: none; }
.crossword-toggle-row i { position: relative; width: 43px; height: 24px; border-radius: 999px; background: #d7dfde; box-shadow: inset 0 0 0 1px rgba(32,53,72,.12); transition: background-color 180ms ease; }
.crossword-toggle-row i::after { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(32,53,72,.25); content: ""; transition: transform 180ms ease; }
.crossword-toggle-row input:checked + i { background: var(--ct-brand-teal); }
.crossword-toggle-row input:checked + i::after { transform: translateX(19px); }
.crossword-toggle-row input:focus-visible + i { outline: 3px solid rgba(0,134,205,.38); outline-offset: 2px; }

.crossword-case-selector { display: flex; margin: 0; padding: 0; grid-column: 1/-1; align-items: center; justify-content: space-between; border: 0; }
.crossword-case-selector legend { float: left; padding: 0; color: var(--ct-muted); font-size: clamp(13px,1.1vw,16px); font-weight: 650; }
.crossword-case-selector > div { display: inline-flex; padding: 3px; border: 1px solid rgba(0,128,125,.2); border-radius: 999px; background: #e8eeee; }
.crossword-case-selector button { min-height: 32px; padding: 4px 10px; border: 0; border-radius: 999px; background: transparent; color: var(--ct-muted); cursor: pointer; font-size: clamp(13px,1.05vw,16px); font-weight: 740; }
.crossword-case-selector button.is-selected { background: var(--ct-brand-teal); box-shadow: 0 2px 6px rgba(0,94,91,.22); color: #fff; }

.crossword-current-clue { flex: 0 0 auto; padding: clamp(9px,1.1vh,14px); border: 1px solid rgba(0,128,125,.19); border-radius: 15px; background: #e6f4f2; }
.crossword-current-heading { display: flex; align-items: center; justify-content: space-between; }
.crossword-current-heading > div { display: flex; flex-direction: column; }
.crossword-current-heading span { color: #38706f; font-size: clamp(12px,.95vw,14px); font-weight: 700; }
.crossword-current-heading strong { color: #006f6c; font-size: clamp(17px,1.5vw,22px); }
#crosswordCurrentText { margin: 5px 0 0; color: var(--ct-ink-strong); font-size: clamp(14px,1.18vw,18px); font-weight: 600; line-height: 1.2; }
.crossword-current-length { margin: 3px 0 0; color: var(--ct-muted); font-size: clamp(12px,1vw,15px); font-weight: 650; }
.crossword-answer-entry { margin-top: 6px; }
.crossword-answer-entry > label { display: block; margin-bottom: 4px; color: #145955; font-size: clamp(13px,1vw,15px); font-weight: 720; }
#answer_boxes { display: flex; flex-wrap: wrap; gap: 3px; }
#answer_boxes input { box-sizing: border-box; width: clamp(25px,2.2vw,34px); height: clamp(29px,2.5vw,38px); padding: 0; border: 1px solid rgba(0,128,125,.32); border-radius: 6px; background: #fff; color: var(--ct-ink-strong); font-size: clamp(16px,1.35vw,20px); font-weight: 740; text-align: center; }
#answer_boxes input:focus { outline: 3px solid rgba(0,177,173,.28); border-color: #007f7c; }
.crossword-answer-gap { width: 7px; }
.crossword-choices { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 5px; }
.crossword-choice { min-height: 35px; padding: 5px 7px; border: 1px solid rgba(0,128,125,.24); border-radius: 10px; background: #fff; color: var(--ct-ink); cursor: pointer; font-size: clamp(13px,1.05vw,16px); font-weight: 680; }
.crossword-choice:hover { background: #f3fbfa; border-color: rgba(0,128,125,.48); }

.crossword-clue-browser { display: flex; min-height: 0; flex: 1 1 auto; flex-direction: column; }
.crossword-tabs { display: grid; flex: 0 0 auto; grid-template-columns: repeat(2,1fr); border-bottom: 2px solid rgba(0,128,125,.16); }
.crossword-tabs button { padding: 6px 8px; border: 0; border-bottom: 3px solid transparent; background: transparent; color: var(--ct-muted); cursor: pointer; font-size: clamp(14px,1.2vw,17px); font-weight: 720; }
.crossword-tabs button[aria-selected="true"] { border-color: var(--ct-brand-teal); color: #007f7c; }
.crossword-clue-lists { min-height: 0; flex: 1 1 auto; overflow: auto; }
.crossword-clue-lists ul { margin: 0; padding: 5px 0 0; list-style: none; }
.crossword-clue-row { display: grid; min-height: 45px; margin-bottom: 4px; padding: 6px 7px; align-items: center; grid-template-columns: 27px minmax(0,1fr) 34px 20px; border: 1px solid rgba(32,53,72,.1); border-radius: 10px; background: rgba(255,255,255,.72); cursor: pointer; }
.crossword-clue-row:hover, .crossword-clue-row.is-active { border-color: rgba(0,177,173,.38); background: rgba(0,177,173,.09); }
.crossword-clue-row.is-complete { background: rgba(0,177,173,.08); }
.crossword-clue-number { color: #007f7c; font-weight: 780; }
.crossword-clue-copy { min-width: 0; }
.crossword-clue-copy strong { display: block; overflow: hidden; color: var(--ct-ink); font-size: clamp(12px,1vw,15px); font-weight: 620; line-height: 1.15; text-overflow: ellipsis; white-space: nowrap; }
.crossword-clue-copy small { color: var(--ct-muted); font-size: clamp(10px,.82vw,12px); }
.crossword-clue-audio { display: grid; width: 31px; height: 31px; padding: 0; place-items: center; border: 0; border-radius: 50%; background: rgba(0,177,173,.1); cursor: pointer; }
.crossword-clue-audio img { width: 23px; height: 23px; pointer-events: none; }
.crossword-clue-status { display: none; color: #008f8b; font-weight: 800; }
.crossword-clue-row.is-complete .crossword-clue-status { display: inline; }

.crossword-hint-button { min-height: 48px; padding: 8px 18px; flex: 0 0 auto; border: 0; border-radius: 999px; background: var(--ct-brand-yellow); box-shadow: 0 5px 12px rgba(99,78,9,.18); color: #145955; cursor: pointer; font-size: clamp(16px,1.4vw,20px); font-weight: 760; }
.crossword-hint-button:disabled { cursor: default; filter: saturate(.45); opacity: .55; }
.crossword-audio-button:focus-visible,.crossword-case-selector button:focus-visible,.crossword-tabs button:focus-visible,.crossword-clue-row:focus-visible,.crossword-clue-audio:focus-visible,.crossword-choice:focus-visible,.crossword-hint-button:focus-visible { outline: 3px solid rgba(0,134,205,.38); outline-offset: 2px; }

#crosswordCelebration { position: absolute; inset: 0; overflow: hidden; border-radius: inherit; pointer-events: none; }
#crosswordCelebration i { position: absolute; top: var(--sparkle-top); left: var(--sparkle-left); color: var(--ct-brand-yellow); font-size: clamp(17px,2vw,27px); opacity: 0; animation: crossword-sparkle 800ms ease-out forwards; }

/* Older curriculum sets include genuine 20–27-cell spans. Give those grids
   priority without removing clues, answers or support controls. */
#crosswordActivity.crossword-large-grid .crossword-activity-card {
    padding-block: clamp(8px, 1.05vh, 12px);
}

#crosswordActivity.crossword-large-grid .crossword-summary {
    padding-bottom: clamp(5px, .7vh, 8px);
}

#crosswordActivity.crossword-large-grid .crossword-instruction-block h1 {
    font-size: clamp(22px, 3vh, 29px);
}

#crosswordActivity.crossword-large-grid .crossword-instruction-block p {
    margin-top: 2px;
    font-size: clamp(14px, 1.9vh, 18px);
}

#crosswordActivity.crossword-large-grid .crossword-grid-panel {
    padding: clamp(5px, .7vh, 8px);
}

#crosswordActivity.crossword-large-grid .crossword-support-panel {
    padding-block: clamp(7px, .85vh, 10px);
    gap: clamp(5px, .65vh, 8px);
}

.crossword-exit-dialog {
    display: grid; position: fixed; z-index: 10020; inset: 0; padding: 24px; place-items: center;
    background: rgba(15,45,53,.58); backdrop-filter: blur(4px);
}
.crossword-exit-dialog[hidden] { display: none !important; }
.crossword-exit-card {
    box-sizing: border-box; width: min(92vw,480px); padding: clamp(24px,3vw,36px); border: 1px solid rgba(0,128,125,.18);
    border-radius: var(--ct-radius-panel); background: linear-gradient(145deg,var(--ct-surface) 0%,#fffdf8 100%);
    box-shadow: 0 22px 58px rgba(14,48,57,.32); color: var(--ct-ink); text-align: center;
}
.crossword-exit-symbol {
    display: grid; width: 58px; height: 58px; margin: 0 auto 13px; place-items: center; border-radius: 50%;
    background: rgba(0,177,173,.13); color: #007f7c; font-size: 34px; font-weight: 760;
}
.crossword-exit-card h2 { margin: 0; color: var(--ct-ink-strong); font-size: clamp(25px,2.6vw,34px); font-weight: 780; }
.crossword-exit-card p { margin: 10px auto 22px; color: var(--ct-muted); font-size: clamp(17px,1.55vw,21px); line-height: 1.35; }
.crossword-exit-card > div { display: flex; gap: 12px; justify-content: center; }
.crossword-stay-button,.crossword-exit-button {
    min-height: 48px; padding: 9px 20px; border-radius: 999px; cursor: pointer; font-size: clamp(16px,1.3vw,19px); font-weight: 750;
}
.crossword-stay-button { border: 0; background: var(--ct-brand-teal); box-shadow: 0 5px 12px rgba(0,94,91,.2); color: #fff; }
.crossword-exit-button { border: 1px solid rgba(32,53,72,.22); background: #fff; color: var(--ct-ink); }
.crossword-stay-button:focus-visible,.crossword-exit-button:focus-visible { outline: 4px solid rgba(0,134,205,.38); outline-offset: 3px; }
@keyframes crossword-hint-pulse { 50% { transform: scale(1.08); } }
@keyframes crossword-sparkle { 18%,64% { opacity: 1; transform: translateY(-5px) scale(1.1) rotate(12deg); } 100% { opacity: 0; transform: translateY(-20px) scale(.5) rotate(38deg); } }

@media (max-width:900px) { .crossword-content { grid-template-columns: minmax(0,1.45fr) minmax(285px,1fr); gap: 10px; } .crossword-activity-card { padding-inline: 10px; } }
@media (max-width:700px) and (orientation:portrait) { .crossword-content { grid-template-columns: 1fr; grid-template-rows: minmax(0,1.45fr) minmax(300px,1fr); } .crossword-support-panel { padding: 9px 12px; } }
@media (max-height:650px) { .crossword-activity-card { padding-block: 8px; } .crossword-summary { padding-bottom: 6px; } .crossword-support-panel { gap: 5px; padding-block: 7px; } .crossword-current-clue { padding-block: 7px; } .crossword-clue-row { min-height: 38px; padding-block: 4px; } }
@media (max-width:520px) { .crossword-exit-card > div { flex-direction: column; } }
@media (prefers-reduced-motion:reduce) { .crossword td.is-hinted,#crosswordCelebration i { animation-duration: 1ms; animation-iteration-count: 1; } }
