.ccl-crossword-wrapper {
    width: 100%;
    max-width: 900px;
    min-width: 0;
    box-sizing: border-box;
    margin: 30px auto;
    padding: 24px;
    border: 1px solid #ddd;
    border-radius: 12px;
    background: #fff;
}

.ccl-crossword-wrapper h2 {
    margin-top: 0;
    color: #7a0000;
}


/* Board sizing belongs here; JavaScript supplies only the row/column count. */
#ccl-crossword.ccl-grid {
    display: grid;
    width: 100%;
    max-width: 720px;
    min-width: 0;
    height: auto;
    min-height: 0;
    aspect-ratio: 1 / 1;
    box-sizing: border-box;
    margin: 20px auto;
    padding: 0;
    border: 2px solid #111;
    background: #111;
    gap: 1px;
    align-content: stretch;
    justify-content: stretch;
}

.ccl-grid > .ccl-cell {
    position: relative;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    box-sizing: border-box;
    overflow: hidden;
    margin: 0;
    padding: 0;
    border: 0;
}

.ccl-cell {
    background: #fff;
}

.ccl-cell-black {
    background: #111;
}

.ccl-cell {
    position: relative;
}

.ccl-cell-number {
    position: absolute;
    top: 2px;
    left: 3px;
    font-size: 10px;
    line-height: 1;
    font-weight: 700;
    color: #111;
    pointer-events: none;
    z-index: 1;
}

.ccl-grid .ccl-cell-input {
    display: block;
    position: absolute;
    inset: 0;
    min-width: 0;
    min-height: 0;
    max-width: 100%;
    max-height: 100%;
    box-sizing: border-box;
    border-radius: 0;
    box-shadow: none;
    appearance: none;
    width: 100%;
    height: 100%;
    border: 0;
    padding: 0;
    margin: 0;
    background: transparent;
    text-align: center;
    text-transform: uppercase;
    font-size: clamp(16px, 3vw, 24px);
    font-weight: 700;
    color: #111;
    outline: none;
    font-family: Arial, Helvetica, sans-serif;
}

.ccl-cell-input:focus {
    background: #fff3b0;
}

.ccl-cell-black .ccl-cell-input {
    display: none;
}

.ccl-crossword-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
    min-width: 0;
    gap: 28px;
    align-items: start;
}

.ccl-crossword-board {
    width: 100%;
    min-width: 0;
    max-width: 100%;
}

.ccl-clues-panel {
    width: 100%;
    min-width: 0;
    grid-template-columns: minmax(0, 1fr);
    display: grid;
    gap: 22px;
}

.ccl-clue-section {
    min-width: 0;
    overflow-wrap: anywhere;
    box-sizing: border-box;
    border: 1px solid #ddd;
    border-radius: 10px;
    background: #fafafa;
    padding: 16px;
}

.ccl-clue-section h3 {
    margin: 0 0 12px;
    color: #7a0000;
    font-size: 20px;
}

.ccl-clue-list,
#ccl-across-clues,
#ccl-down-clues {
    margin: 0;
    padding-left: 0;
    list-style: none;
}

.ccl-clue-item {
    margin-bottom: 10px;
    line-height: 1.45;
    font-size: 15px;
}

@media (max-width: 800px) {
    .ccl-crossword-layout {
        grid-template-columns: 1fr;
    }
}

.ccl-clue-item {
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 6px;
}

.ccl-clue-item:hover {
    background: #f4e6e6;
}

.ccl-clue-item .ccl-clue-button {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    color: inherit;
    font: inherit;
    text-align: left;
    text-transform: none;
    white-space: normal;
    cursor: pointer;
}

.ccl-clue-item .ccl-clue-button:focus {
    outline: 2px solid #005a9c;
    outline-offset: 2px;
}

.ccl-clue-active {
    background: #fff3b0;
    font-weight: 700;
}

.ccl-cell-word-active {
    background: #fff7cf;
}

.ccl-cell-active {
    background: #ffd966;
}

.ccl-cell-active .ccl-cell-input,
.ccl-cell-word-active .ccl-cell-input {
    background: transparent;
}

.ccl-crossword-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin: 18px 0 12px;
}

.ccl-button {
    border: 0;
    border-radius: 8px;
    padding: 11px 18px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
}

.ccl-button-primary {
    background: #7a0000;
    color: #fff;
}

.ccl-button-primary:hover {
    background: #990000;
}

.ccl-button-secondary {
    background: #eeeeee;
    color: #111;
}

.ccl-button-secondary:hover {
    background: #dddddd;
}

.ccl-message {
    display: none;
    margin: 12px auto 0;
    padding: 12px 14px;
    border-radius: 8px;
    font-weight: 700;
    text-align: center;
    max-width: 520px;
}

.ccl-message-success {
    background: #e8f7e8;
    color: #155724;
    border: 1px solid #b9e6b9;
}

.ccl-message-error {
    background: #fff1f1;
    color: #7a0000;
    border: 1px solid #f1b5b5;
}

.ccl-cell-correct {
    background: #d9f7d9;
}

.ccl-cell-wrong {
    background: #ffd6d6;
}

.ccl-cell-correct .ccl-cell-input,
.ccl-cell-wrong .ccl-cell-input {
    background: transparent;
}

.ccl-crossword-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin: 10px 0 20px;
}

.ccl-timer-box {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 999px;
    background: #f4e6e6;
    color: #7a0000;
    font-weight: 700;
    font-size: 15px;
}

#ccl-timer,
#ccl-best-time {
    font-family: Consolas, Monaco, monospace;
}

.ccl-celebration {
    position: fixed;
    inset: 0;
    z-index: 999999;
    pointer-events: none;
    overflow: hidden;
}

.ccl-celebration--motion {
    background: radial-gradient(ellipse at 50% 12%, rgba(255, 217, 102, 0.16), transparent 65%);
}

.ccl-celebration-message {
    position: absolute;
    z-index: 1;
    top: clamp(48px, 14vh, 150px);
    left: 50%;
    transform: translateX(-50%);
    box-sizing: border-box;
    width: min(420px, calc(100% - 32px));
    overflow: hidden;
    padding: 28px 22px 30px;
    border: 2px solid #f4ce75;
    border-radius: 24px;
    background: linear-gradient(145deg, #8f1736, #570d24 75%);
    color: #fff;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    text-align: center;
    box-shadow: 0 22px 65px rgba(55, 9, 25, 0.32), 0 0 0 6px rgba(244, 206, 117, 0.16);
}

.ccl-celebration-badge {
    display: grid;
    place-items: center;
    width: 74px;
    height: 74px;
    margin: 0 auto 16px;
    border: 1px solid #fff1c2;
    border-radius: 50%;
    background: linear-gradient(145deg, #fff1c2, #eab64d);
    font-size: 42px;
    line-height: 1;
    box-shadow: 0 5px 24px rgba(255, 217, 102, 0.22);
}

.ccl-celebration-heading {
    display: block;
    margin-bottom: 10px;
    font-size: clamp(24px, 6vw, 36px);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.03em;
    overflow-wrap: anywhere;
}

.ccl-celebration-detail {
    display: block;
    max-width: 30ch;
    margin: 0 auto;
    color: #ffedc5;
    font-size: clamp(14px, 3.6vw, 17px);
    line-height: 1.5;
}

.ccl-celebration--motion .ccl-celebration-message {
    animation: ccl-celebration-enter 650ms cubic-bezier(0.22, 1, 0.36, 1) both,
        ccl-celebration-exit 700ms ease-in 9300ms forwards;
}

.ccl-celebration--motion .ccl-celebration-message::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(110deg, transparent 30%, rgba(255, 244, 204, 0.13) 50%, transparent 70%);
    transform: translateX(-120%);
    animation: ccl-celebration-shimmer 3200ms ease-in-out 650ms infinite;
}

.ccl-celebration--motion .ccl-celebration-badge {
    animation: ccl-celebration-float 2800ms ease-in-out 650ms infinite;
}

.ccl-confetti-piece {
    position: absolute;
    top: -24px;
    width: 9px;
    height: 15px;
    border-radius: 2px;
    background: #ffd966;
}

.ccl-celebration--motion .ccl-confetti-piece {
    animation-name: ccl-confetti-fall;
    animation-timing-function: linear;
    animation-fill-mode: both;
    animation-iteration-count: infinite;
}

.ccl-confetti-piece:nth-child(3n) {
    background: #e85d92;
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.ccl-confetti-piece:nth-child(4n) {
    background: #4ecdc4;
}

.ccl-confetti-piece:nth-child(5n) {
    background: #fff4d5;
    width: 6px;
    height: 20px;
}

.ccl-confetti-piece:nth-child(7n) {
    background: #b6a1f0;
}

@keyframes ccl-confetti-fall {
    0% {
        transform: translate3d(-18px, 0, 0) rotate(0deg);
        opacity: 0;
    }
    8%, 80% {
        opacity: 1;
    }
    100% {
        transform: translate3d(36px, 110vh, 0) rotate(720deg);
        opacity: 0;
    }
}

@keyframes ccl-celebration-enter {
    from { opacity: 0; transform: translate(-50%, 22px) scale(0.92); }
    to { opacity: 1; transform: translate(-50%, 0) scale(1); }
}

@keyframes ccl-celebration-exit {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes ccl-celebration-shimmer {
    0%, 20% { transform: translateX(-120%); }
    70%, 100% { transform: translateX(120%); }
}

@keyframes ccl-celebration-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px) rotate(-4deg); }
}

@media (prefers-reduced-motion: reduce) {
    .ccl-celebration--motion {
        background: none;
    }
    .ccl-celebration .ccl-celebration-message,
    .ccl-celebration .ccl-celebration-message::after,
    .ccl-celebration .ccl-celebration-badge,
    .ccl-celebration .ccl-confetti-piece {
        animation: none;
    }
    .ccl-celebration .ccl-confetti-piece {
        display: none;
    }
}

.ccl-button-share {
    background: #2e7d32;
    color: #fff;
}

.ccl-button-share:hover {
    background: #256628;
}

.ccl-crossword-header {
    text-align: center;
    margin-bottom: 14px;
}

.ccl-crossword-header h2 {
    margin: 0 0 8px;
    color: #7a0000;
    font-size: clamp(24px, 4vw, 34px);
    line-height: 1.2;
}

.ccl-puzzle-instructions {
    max-width: 760px;
    margin: 0 auto;
    color: #333;
    font-size: 16px;
    line-height: 1.5;
}

.ccl-progress-wrap {
    max-width: 520px;
    margin: 0 auto 20px;
}

.ccl-progress-label {
    text-align: center;
    font-weight: 700;
    color: #333;
    margin-bottom: 7px;
}

.ccl-progress-bar {
    height: 12px;
    border-radius: 999px;
    background: #eeeeee;
    overflow: hidden;
}

.ccl-progress-fill {
    width: 0%;
    height: 100%;
    background: #7a0000;
    border-radius: 999px;
    transition: width 0.2s ease;
}

.ccl-puzzle-completed .ccl-cell-input {
    cursor: default;
}

.ccl-button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.ccl-puzzle-error {
    display: none;
    max-width: 760px;
    margin: 0 auto 18px;
    padding: 14px 16px;
    border: 1px solid #f1b5b5;
    border-radius: 10px;
    background: #fff1f1;
    color: #7a0000;
    font-weight: 700;
    text-align: center;
}

.ccl-puzzle-details {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 10px 0 18px;
}

.ccl-difficulty-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    border: 1px solid transparent;
}

.ccl-difficulty-easy {
    background: #edfaef;
    border-color: #46b450;
    color: #155724;
}

.ccl-difficulty-medium {
    background: #fff8e5;
    border-color: #dba617;
    color: #6b4f00;
}

.ccl-difficulty-hard {
    background: #fcf0f1;
    border-color: #d63638;
    color: #7a0000;
}

.ccl-puzzle-date-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border: 1px solid #8c8f94;
    border-radius: 999px;
    background: #f6f7f7;
    color: #2c3338;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
}

.ccl-puzzle-date-badge[hidden] {
    display: none;
}

.ccl-today-no-puzzle {
    max-width: 720px;
    margin: 24px auto;
    padding: 24px;
    border: 1px solid #dcdcde;
    border-radius: 10px;
    background: #ffffff;
    text-align: center;
}

.ccl-today-no-puzzle h3 {
    margin-top: 0;
    margin-bottom: 10px;
}

.ccl-today-no-puzzle p:last-child {
    margin-bottom: 0;
}

.ccl-crossword-archive {
    max-width: 1100px;
    margin: 30px auto;
}

.ccl-archive-header {
    margin-bottom: 24px;
    text-align: center;
}

.ccl-archive-header h2 {
    margin-bottom: 8px;
}

.ccl-archive-grid {
    display: grid;
    grid-template-columns: repeat(
        auto-fit,
        minmax(260px, 1fr)
    );
    gap: 18px;
}

.ccl-archive-card {
    display: flex;
    flex-direction: column;
    padding: 20px;
    border: 1px solid #dcdcde;
    border-radius: 10px;
    background: #ffffff;
}

.ccl-archive-card-title {
    margin: 0 0 12px;
    font-size: 20px;
    line-height: 1.3;
}

.ccl-archive-card-title a {
    color: inherit;
    text-decoration: none;
}

.ccl-archive-card-title a:hover {
    text-decoration: underline;
}

.ccl-archive-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-bottom: 14px;
}

.ccl-archive-date,
.ccl-archive-difficulty,
.ccl-archive-word-count {
    display: inline-flex;
    align-items: center;
    padding: 5px 9px;
    border: 1px solid #dcdcde;
    border-radius: 999px;
    background: #f6f7f7;
    font-size: 12px;
    font-weight: 700;
}

.ccl-archive-difficulty-easy {
    border-color: #46b450;
    background: #edfaef;
    color: #155724;
}

.ccl-archive-difficulty-medium {
    border-color: #dba617;
    background: #fff8e5;
    color: #6b4f00;
}

.ccl-archive-difficulty-hard {
    border-color: #d63638;
    background: #fcf0f1;
    color: #7a0000;
}

.ccl-archive-excerpt {
    margin-bottom: 16px;
}

.ccl-archive-view-button {
    display: inline-flex;
    justify-content: center;
    margin-top: auto;
    padding: 9px 14px;
    border-radius: 6px;
    background: #2271b1;
    color: #ffffff;
    font-weight: 700;
    text-decoration: none;
}

.ccl-archive-view-button:hover {
    background: #135e96;
    color: #ffffff;
}

.ccl-archive-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 14px;
    margin-top: 28px;
}

.ccl-archive-page-link {
    padding: 8px 14px;
    border: 1px solid #2271b1;
    border-radius: 6px;
    text-decoration: none;
}

.ccl-archive-page-status {
    font-weight: 700;
}

.ccl-archive-empty {
    padding: 24px;
    border: 1px solid #dcdcde;
    border-radius: 10px;
    background: #ffffff;
    text-align: center;
}

@media (max-width: 600px) {
    .ccl-archive-pagination {
        flex-wrap: wrap;
    }
}

.ccl-archive-filters {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 22px;
    padding: 18px;
    border: 1px solid #dcdcde;
    border-radius: 10px;
    background: #ffffff;
}

.ccl-archive-filter-field {
    display: flex;
    flex: 1 1 190px;
    flex-direction: column;
    gap: 6px;
}

.ccl-archive-filter-field label {
    font-size: 13px;
    font-weight: 700;
}

.ccl-archive-filter-field select,
.ccl-archive-filter-field input {
    width: 100%;
    min-height: 40px;
    padding: 7px 10px;
    border: 1px solid #8c8f94;
    border-radius: 6px;
    background: #ffffff;
    font-size: 15px;
}

.ccl-archive-filter-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.ccl-archive-filter-button {
    min-height: 40px;
    padding: 8px 16px;
    border: 0;
    border-radius: 6px;
    background: #2271b1;
    color: #ffffff;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

.ccl-archive-filter-button:hover {
    background: #135e96;
}

.ccl-archive-clear-link {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 7px 12px;
    border: 1px solid #8c8f94;
    border-radius: 6px;
    color: #2c3338;
    font-weight: 700;
    text-decoration: none;
}

.ccl-archive-clear-link:hover {
    border-color: #2271b1;
    color: #2271b1;
}

.ccl-archive-results-summary {
    margin-bottom: 14px;
    color: #50575e;
    font-size: 14px;
    font-weight: 700;
}

@media (max-width: 600px) {
    .ccl-archive-filter-actions {
        width: 100%;
    }

    .ccl-archive-filter-button,
    .ccl-archive-clear-link {
        justify-content: center;
        width: 100%;
    }
}

.ccl-archive-search-field {
    flex-basis: 260px;
}

.ccl-archive-search-field input[type="search"] {
    width: 100%;
}

@media (max-width: 600px) {
    .ccl-archive-search-field {
        flex-basis: 100%;
    }
}

/* Crossword archive filter layout fix */

.ccl-archive-filters {
    display: grid;
    grid-template-columns:
        minmax(240px, 2fr)
        minmax(160px, 1fr)
        minmax(180px, 1fr)
        auto;
    align-items: end;
    gap: 14px;
    width: 100%;
    box-sizing: border-box;
}

.ccl-archive-filter-field {
    min-width: 0;
    width: 100%;
}

.ccl-archive-filter-field select,
.ccl-archive-filter-field input {
    display: block;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.ccl-archive-search-field {
    min-width: 0;
    width: 100%;
}

.ccl-archive-filter-actions {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 10px;
    min-width: max-content;
}

.ccl-archive-filter-button,
.ccl-archive-clear-link {
    width: auto;
    max-width: none;
    white-space: nowrap;
    box-sizing: border-box;
}

/* Tablet layout */

@media (max-width: 950px) {
    .ccl-archive-filters {
        grid-template-columns:
            minmax(220px, 1fr)
            minmax(180px, 1fr);
    }

    .ccl-archive-search-field {
        grid-column: 1 / -1;
    }

    .ccl-archive-filter-actions {
        grid-column: 1 / -1;
        justify-content: flex-start;
        min-width: 0;
    }
}

/* Mobile layout */

@media (max-width: 600px) {
    .ccl-archive-filters {
        grid-template-columns: 1fr;
    }

    .ccl-archive-search-field,
    .ccl-archive-filter-actions {
        grid-column: auto;
    }

    .ccl-archive-filter-actions {
        display: grid;
        grid-template-columns: 1fr;
        width: 100%;
    }

    .ccl-archive-filter-button,
    .ccl-archive-clear-link {
        justify-content: center;
        width: 100%;
    }
}

/* Final archive filter layout fix */

.ccl-archive-filters {
    display: grid;
    grid-template-columns:
        minmax(220px, 2fr)
        minmax(150px, 1fr)
        minmax(170px, 1fr);
    align-items: end;
    gap: 14px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.ccl-archive-search-field,
.ccl-archive-filter-field {
    min-width: 0;
    width: 100%;
}

.ccl-archive-filter-field select,
.ccl-archive-filter-field input {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

.ccl-archive-filter-actions {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 10px;
    width: 100%;
    min-width: 0;
}

.ccl-archive-filter-button,
.ccl-archive-clear-link {
    width: auto;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    white-space: nowrap;
}

/* Tablet */

@media (max-width: 850px) {
    .ccl-archive-filters {
        grid-template-columns: 1fr 1fr;
    }

    .ccl-archive-search-field {
        grid-column: 1 / -1;
    }

    .ccl-archive-filter-actions {
        grid-column: 1 / -1;
    }
}

/* Mobile */

@media (max-width: 600px) {
    .ccl-archive-filters {
        grid-template-columns: 1fr;
    }

    .ccl-archive-search-field,
    .ccl-archive-filter-actions {
        grid-column: auto;
    }

    .ccl-archive-filter-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .ccl-archive-filter-button,
    .ccl-archive-clear-link {
        justify-content: center;
        width: 100%;
        white-space: normal;
    }
}

/* Archive sorting layout */

.ccl-archive-filters {
    grid-template-columns:
        minmax(220px, 2fr)
        minmax(140px, 1fr)
        minmax(170px, 1fr)
        minmax(150px, 1fr);
}

.ccl-archive-filter-actions {
    grid-column: 1 / -1;
}

@media (max-width: 1050px) {
    .ccl-archive-filters {
        grid-template-columns: 1fr 1fr;
    }

    .ccl-archive-search-field {
        grid-column: 1 / -1;
    }

    .ccl-archive-filter-actions {
        grid-column: 1 / -1;
    }
}

@media (max-width: 600px) {
    .ccl-archive-filters {
        grid-template-columns: 1fr;
    }

    .ccl-archive-search-field,
    .ccl-archive-filter-actions {
        grid-column: auto;
    }
}

/* Final public archive sorting layout */

.ccl-archive-filters {
    display: grid;
    grid-template-columns:
        minmax(140px, 1fr)
        minmax(170px, 1fr)
        minmax(150px, 1fr);
    align-items: end;
    gap: 14px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Search uses a complete row */

.ccl-archive-search-field {
    grid-column: 1 / -1;
    width: 100%;
    min-width: 0;
}

/* Prevent every field from overflowing */

.ccl-archive-filter-field {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

.ccl-archive-filter-field select,
.ccl-archive-filter-field input {
    display: block;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

/* Buttons use their own complete row */

.ccl-archive-filter-actions {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 10px;
    width: 100%;
    min-width: 0;
}

/* Tablet */

@media (max-width: 850px) {
    .ccl-archive-filters {
        grid-template-columns: 1fr 1fr;
    }

    .ccl-archive-search-field,
    .ccl-archive-filter-actions {
        grid-column: 1 / -1;
    }
}

/* Mobile */

@media (max-width: 600px) {
    .ccl-archive-filters {
        grid-template-columns: 1fr;
    }

    .ccl-archive-search-field,
    .ccl-archive-filter-actions {
        grid-column: auto;
    }

    .ccl-archive-filter-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .ccl-archive-filter-button,
    .ccl-archive-clear-link {
        justify-content: center;
        width: 100%;
    }
}

/* Previous and next crossword navigation */

.ccl-puzzle-navigation {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    max-width: 900px;
    margin: 30px auto;
}

.ccl-puzzle-navigation-item {
    min-width: 0;
}

.ccl-puzzle-navigation-next {
    text-align: right;
}

.ccl-puzzle-navigation-link {
    display: flex;
    flex-direction: column;
    gap: 5px;
    height: 100%;
    padding: 18px;
    border: 1px solid #dcdcde;
    border-radius: 10px;
    background: #ffffff;
    color: #1d2327;
    text-decoration: none;
    box-sizing: border-box;
}

.ccl-puzzle-navigation-link:hover {
    border-color: #2271b1;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.08);
    color: #135e96;
}

.ccl-puzzle-navigation-direction {
    color: #2271b1;
    font-size: 13px;
    font-weight: 700;
}

.ccl-puzzle-navigation-title {
    font-size: 17px;
    font-weight: 700;
    line-height: 1.3;
}

.ccl-puzzle-navigation-date {
    color: #646970;
    font-size: 12px;
    font-weight: 600;
}

@media (max-width: 600px) {
    .ccl-puzzle-navigation {
        grid-template-columns: 1fr;
    }

    .ccl-puzzle-navigation-next {
        text-align: left;
    }
}

/* Keep room for the board on small screens. */
@media (max-width: 600px) {
    .ccl-crossword-wrapper {
        padding: 10px;
    }
    .ccl-clue-section {
        padding: 12px;
    }
}

/* Tentative entries remain separate from checked Pen letters. */
.ccl-entry-panel { margin: 0 0 16px; padding: 14px; border: 1px solid #ddd; border-radius: 8px; background: #fafafa; }
.ccl-entry-modes { display: flex; flex-wrap: wrap; gap: 8px; }
.ccl-entry-panel .ccl-button { white-space: normal; max-width: 100%; }
.ccl-entry-panel .ccl-button[aria-pressed="true"] { background: #6b2035; color: #fff; border-color: #6b2035; }
.ccl-entry-panel .ccl-button:focus-visible { outline: 3px solid #176b95; outline-offset: 3px; }
.ccl-entry-help, .ccl-entry-count, .ccl-entry-status { margin: 8px 0 0; font-size: 14px; line-height: 1.5; }
.ccl-grid .ccl-cell-pencil .ccl-cell-input { color: #595959; font-size: clamp(16px, 2.2vw, 19px); font-weight: 400; font-style: italic; }

/* Lessons 523–527: optional readable cells, local scrolling and explicit focus. */
.ccl-source-passage { margin: 16px 0; border: 1px solid #b8bcc2; border-radius: 6px; padding: 12px 16px; min-width: 0; }
.ccl-source-passage > summary { cursor: pointer; min-height: 44px; display: list-item; font-weight: 600; line-height: 1.5; overflow-wrap: anywhere; }
.ccl-source-passage > summary:focus-visible { outline: 3px solid #005a9c; outline-offset: 3px; }
.ccl-source-passage-text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.7; margin-top: 8px; }
.ccl-source-passage-text > p { margin: 0 0 1em; }
.ccl-source-help { padding: 10px 12px; background: #edf5fc; border-left: 3px solid #246391; line-height: 1.5; }
.ccl-player-account-help { display: block; font-size: 0.9em; line-height: 1.5; }
.ccl-easy-ad { margin: 16px 0; max-width: 100%; min-width: 0; white-space: normal; }
.ccl-ad-label { display: block; font-size: 12px; color: #595959; margin-bottom: 4px; }
.ccl-easy-ad img, .ccl-easy-ad iframe { max-width: 100%; }
.ccl-grid-view-controls { margin: 12px 0; overflow-wrap: anywhere; }
.ccl-grid-view-help, .ccl-grid-view-status { margin: 8px 0; font-size: 14px; line-height: 1.5; }
.ccl-grid-viewport { width: 100%; max-width: 100%; min-width: 0; box-sizing: border-box; padding: 3px; overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; }
.ccl-grid-viewport.ccl-grid-enlarged #ccl-crossword.ccl-grid { width: var(--ccl-readable-grid-width); min-width: 100%; max-width: none; }
.ccl-crossword-wrapper button, .ccl-crossword-wrapper .ccl-button { min-height: 44px; max-width: 100%; box-sizing: border-box; white-space: normal; }
.ccl-crossword-wrapper select { min-height: 44px; max-width: 100%; box-sizing: border-box; font-size: 16px; }
.ccl-clue-item .ccl-clue-button { min-height: 44px; }
.ccl-crossword-wrapper button:focus-visible, .ccl-crossword-wrapper a:focus-visible, .ccl-grid-viewport:focus-visible { outline: 3px solid #005a9c; outline-offset: 3px; }
.ccl-crossword-wrapper select:focus-visible { outline: 3px solid #005a9c; outline-offset: 3px; }
.ccl-grid .ccl-cell-input:focus-visible { outline: 3px solid #005a9c; outline-offset: -3px; box-shadow: inset 0 0 0 5px #fff; }
.ccl-player-account-link a { display: inline-flex; align-items: center; min-height: 44px; overflow-wrap: anywhere; }
.ccl-crossword-wrapper h2, .ccl-crossword-wrapper p, .ccl-crossword-wrapper .ccl-button { overflow-wrap: anywhere; }
@media (forced-colors: active) {
    .ccl-grid .ccl-cell-input:focus-visible { outline-color: Highlight; }
    .ccl-clue-active { outline: 2px solid Highlight; }
}

/* Explicitly formatted custom passages; legacy plain-text whitespace stays unchanged. */
.ccl-source-passage-text.ccl-source-passage-formatted { white-space: normal; }
.ccl-source-passage-formatted :is(h2,h3,h4) { line-height:1.35; margin:1em 0 .5em; }
.ccl-source-passage-formatted :is(ul,ol) { padding-inline-start:1.8em; margin:0 0 1em; }
.ccl-source-passage-formatted ul { list-style:disc; }
.ccl-source-passage-formatted ol { list-style:decimal; }
.ccl-source-passage-formatted li { margin:.3em 0; }
.ccl-source-passage-formatted blockquote { margin:1em 0; padding-inline-start:1em; border-inline-start:3px solid #b8bcc2; }

/* Direction is explicit on touch screens; controls remain keyboard accessible. */
.ccl-direction-controls{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin:12px 0}
.ccl-direction-controls button{min-width:96px;min-height:44px;padding:8px 12px;border:2px solid #767676;border-radius:6px;background:#fff;color:#222;font-size:16px;cursor:pointer}
.ccl-direction-controls button[aria-pressed="true"]{background:#742037;border-color:#742037;color:#fff;font-weight:bold}
.ccl-direction-controls button:disabled{opacity:.5;cursor:default}
.ccl-direction-controls span{flex-basis:100%;font-size:14px}

/* Keep crossword action labels readable when a theme overrides link colors. */
.ccl-archive-card a.ccl-archive-view-button,
.ccl-archive-card a.ccl-archive-view-button:link,
.ccl-archive-card a.ccl-archive-view-button:visited,
.ccl-archive-card a.ccl-archive-view-button:hover,
.ccl-archive-card a.ccl-archive-view-button:focus,
.ccl-archive-card a.ccl-archive-view-button:active {
    color: #fff !important;
    background-color: #2271b1 !important;
    text-decoration: none;
}
.ccl-archive-card a.ccl-archive-view-button:hover,
.ccl-archive-card a.ccl-archive-view-button:focus {
    background-color: #135e96 !important;
}
.ccl-archive-card a.ccl-archive-view-button:focus-visible {
    outline: 3px solid #005a9c;
    outline-offset: 3px;
}