:root {
    font-family: Arial, Helvetica, sans-serif;
    color: #302f39;
    background: #f8f7f2;
    font-synthesis: none;
    --coral: #ffb5b1;
    --honey: #f7d981;
    --mint: #a9dfc6;
    --sky: #acd7f3;
    --lilac: #cbb9f0;
    --ink: #343040;
    --purple: #6c53a1
}

* {
    box-sizing: border-box
}

body {
    margin: 0;
    display: flow-root;
}

button,
input,
summary,
a {
    -webkit-tap-highlight-color: transparent
}

button,
input {
    font: inherit
}

a {
    color: inherit
}

button,
summary {
    cursor: pointer
}

button:focus-visible,
a:focus-visible,
summary:focus-visible {
    outline: 3px solid var(--purple);
    outline-offset: 5px
}

.site-header {
    max-width: 1120px;
    padding: 30px 36px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: auto
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none
}

.brand-mark {
    display: grid;
    grid-template-columns: repeat(2, 12px);
    gap: 3px;
    transform: rotate(-8deg)
}

.brand-tile {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    background: var(--tile)
}

.brand-name {
    font-size: 19px;
    letter-spacing: -.7px;
    font-weight: 750
}

.help {
    position: relative
}

.help-toggle {
    list-style: none;
    font-size: 13px;
    font-weight: 600;
    border: 1px solid #dedbd4;
    border-radius: 30px;
    padding: 11px 17px;
    background: #ffffff55
}

.help-toggle::-webkit-details-marker {
    display: none
}

.help-toggle:before {
    content: '?';
    display: inline-grid;
    place-items: center;
    width: 16px;
    height: 16px;
    border: 1px solid #8c8793;
    border-radius: 50%;
    margin-right: 8px;
    font-size: 11px
}

.help-card {
    position: absolute;
    z-index: 10;
    right: 0;
    top: 50px;
    width: 330px;
    padding: 24px;
    background: #fffefb;
    box-shadow: 0 12px 50px #30283f20;
    border: 1px solid #e5e0d8;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.6
}

.help-card h2 {
    font-size: 18px
}

.game {
    max-width: 730px;
    margin: 15px auto 0;
    padding: 0 24px
}

.intro {
    text-align: center;
    margin-bottom: 28px
}

.eyebrow {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 2.5px;
    color: #8b818d;
    margin: 0 0 26px
}

.theme-label {
    display: block;
    color: #82778b;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 2px
}

.theme-line h1 {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: clamp(42px, 7vw, 62px);
    font-weight: 400;
    letter-spacing: -2px;
    line-height: 1.15;
    margin: 7px 0 13px
}

.subtitle {
    font-size: 14px;
    color: #827c86;
    margin: 0;
    line-height: 1.6
}

.puzzle-card {
    border: 1px solid #e7e3dd;
    border-radius: 20px;
    background: #fffefa;
    box-shadow: 0 4px 20px #40332804;
    padding: 21px 26px 17px
}

.board-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px
}

.puzzle-label {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 10px;
    letter-spacing: 1.4px;
    font-weight: 700;
    color: #7d7385
}

.tiny-star {
    font-size: 20px;
    color: #a590be;
    line-height: 1
}

.no-rush {
    background: #f4f2ed;
    border-radius: 20px;
    padding: 7px 10px;
    font-size: 10px;
    color: #817b84
}

.board-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 30px 0 27px;
    min-height: 265px
}

.crossword {
    display: grid;
    grid-template-columns: repeat(var(--cols), 1fr);
    grid-template-rows: repeat(var(--rows), 1fr);
    gap: 3px;
    width: min(100%, calc(var(--cols) * 37px));
    aspect-ratio: var(--cols) / var(--rows)
}

.cell {
    position: relative;
    background: var(--tile);
    border-radius: 5px;
    min-width: 0;
    min-height: 0;
    transition: filter .15s, box-shadow .15s
}

.colour-0 {
    --tile: var(--coral);
    --dot: #e58080
}

.colour-1 {
    --tile: var(--honey);
    --dot: #c99e33
}

.colour-2 {
    --tile: var(--mint);
    --dot: #64af8e
}

.colour-3 {
    --tile: var(--sky);
    --dot: #699fc8
}

.colour-4 {
    --tile: var(--lilac);
    --dot: #a184cc
}

.cell-number {
    position: absolute;
    top: 2px;
    left: 4px;
    font-size: 8px;
    font-weight: 700;
    color: #302f3980;
    pointer-events: none;
    line-height: 1
}

.cell-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 2px 0 0;
    border: 0;
    border-radius: 5px;
    outline: none;
    background: transparent;
    text-align: center;
    color: #302e38;
    font-size: clamp(13px, 3vw, 21px);
    font-weight: 600;
    caret-color: transparent;
    text-transform: uppercase
}

.cell:has(input:focus) {
    z-index: 1;
    box-shadow: 0 0 0 2px #fffefa, 0 0 0 4px #655184
}

.cell.in-word {
    box-shadow: inset 0 0 0 2px #493b602b
}

.cell.outside-bank:after {
    content: '';
    position: absolute;
    width: 5px;
    height: 5px;
    right: 3px;
    bottom: 3px;
    background: #6e3550;
    border-radius: 50%;
    pointer-events: none
}

.board-bottom {
    display: flex;
    align-items: center;
    font-size: 11px;
    color: #6e6575;
    padding-top: 14px;
    border-top: 1px solid #efede7
}

#filled-count {
    font-weight: 700
}

.count-label {
    white-space: pre;
    color: #98929b
}

.direction-hint {
    margin-left: auto;
    color: #8e8695
}

.banks-section {
    margin-top: 25px
}

.banks-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px
}

.banks-heading h2 {
    font-size: 14px;
    font-weight: 650;
    margin: 0;
    letter-spacing: -.2px
}

.banks-heading>span {
    font-size: 11px;
    color: #938a97
}

.letter-banks {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px
}

.letter-bank {
    background: color-mix(in srgb, var(--tile) 25%, #fffefa);
    border: 1px solid color-mix(in srgb, var(--tile) 65%, #fffefa);
    border-radius: 12px;
    overflow: hidden
}

.bank-title {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 7px;
    padding: 11px 3px;
    border-bottom: 1px solid color-mix(in srgb, var(--tile) 55%, transparent);
    background: color-mix(in srgb, var(--tile) 40%, #fffefa);
    font-size: 11px;
    color: #554951
}

.bank-title strong {
    font-weight: 600
}

.colour-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--dot)
}

.bank-letters {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 9px;
    padding: 13px 0;
    min-height: 183px
}

.bank-letter {
    font-size: 17px;
    font-weight: 600;
    line-height: 19px;
    color: #534b57
}

.feedback {
    text-align: center;
    min-height: 57px;
    margin: 18px 0 5px;
    padding: 8px 12px;
    color: #8e8494;
    font-size: 12px;
    line-height: 1.6;
    border-radius: 10px
}

.feedback p {
    margin: 0
}

.feedback small {
    font-size: 11px;
    display: block;
    margin-top: 3px
}

.feedback.incomplete,
.feedback.incorrect {
    background: #f1ebf6;
    color: #765581
}

.feedback.solved {
    background: #e4f2e7;
    color: #427651
}

.feedback.solved p {
    font-weight: 700;
    font-size: 15px
}

.game-actions {
    display: flex;
    justify-content: center;
    gap: 12px
}

.button {
    border-radius: 10px;
    padding: 14px 23px;
    font-size: 13px;
    font-weight: 600;
    border: 1px solid transparent;
    transition: background .15s, transform .15s
}

.button:active {
    transform: translateY(1px)
}

.button-primary {
    background: #6a5394;
    color: white;
    box-shadow: 0 3px 6px #5f427c15
}

.button-primary:hover {
    background: #59417f
}

.button-secondary {
    background: #fffefa;
    border-color: #ddd7e2;
    color: #71627e
}

.button-secondary:hover {
    background: #f0ebf4
}

.reassurance {
    text-align: center;
    font-size: 10px;
    color: #a29aa6;
    margin: 15px 0 0
}

.site-footer {
    display: flex;
    justify-content: space-between;
    max-width: 1048px;
    margin: 45px auto 0;
    padding: 20px 0 26px;
    border-top: 1px solid #e9e5df;
    font-size: 10px;
    color: #a09aa3;
    gap: 12px
}

.credits a {
    text-decoration: none
}

.credits a:hover {
    text-decoration: underline
}

#connection-status:not([hidden]) {
    position: fixed;
    bottom: 16px;
    left: 16px;
    right: 16px;
    max-width: 600px;
    margin: auto;
    background: #493f57;
    color: white;
    padding: 14px 20px;
    border-radius: 12px;
    font-size: 13px;
    box-shadow: 0 4px 25px #30203c30
}

#connection-status a {
    font-weight: 700
}

@media(min-width:1000px) {
    .game {
        margin-top: 23px
    }

    .board-wrap {
        padding-top: 30px;
        padding-bottom: 30px
    }
}

@media(max-width:600px) {
    .site-header {
        padding: 22px 20px
    }

    .brand-name {
        font-size: 16px
    }

    .help-toggle {
        font-size: 11px;
        padding: 9px 11px
    }

    .help-card {
        width: min(330px, calc(100vw - 40px))
    }

    .game {
        padding: 0 16px;
        margin-top: 18px
    }

    .eyebrow {
        font-size: 9px;
        letter-spacing: 2px;
        margin-bottom: 22px
    }

    .intro {
        margin-bottom: 23px
    }

    .subtitle {
        font-size: 12px
    }

    .puzzle-card {
        padding: 16px 12px 14px;
        border-radius: 16px
    }

    .board-wrap {
        padding: 25px 0;
        min-height: 210px
    }

    .crossword {
        gap: 2px
    }

    .cell,
    .cell-input {
        border-radius: 3px
    }

    .cell-number {
        font-size: 6px;
        top: 2px;
        left: 2px
    }

    .cell-input {
        font-size: clamp(11px, 3.4vw, 19px)
    }

    .banks-heading>span {
        font-size: 9px
    }

    .banks-heading h2 {
        font-size: 13px
    }

    .letter-banks {
        gap: 6px
    }

    .bank-title {
        font-size: 10px;
        gap: 4px
    }

    .bank-letters {
        gap: 9px;
        padding: 12px 0;
        min-height: 180px
    }

    .bank-letter {
        font-size: 16px
    }

    .banks-section {
        margin-top: 21px
    }

    .direction-hint {
        font-size: 9px
    }

    .button {
        padding: 13px 17px;
        font-size: 12px
    }

    .site-footer {
        margin: 32px 20px 0;
        font-size: 9px;
        flex-direction: column;
        align-items: center;
        gap: 8px
    }

    .feedback {
        font-size: 11px
    }

    .no-rush {
        font-size: 9px
    }

    .puzzle-label {
        font-size: 9px
    }
}

.game-actions {
    display: grid;
    grid-template-columns: auto auto auto;
    gap: 12px
}

.button:disabled {
    opacity: .6;
    cursor: default
}

@media(max-width:600px) {
    .game-actions {
        grid-template-columns: .65fr 1fr 1.7fr;
        gap: 6px
    }

    .game-actions .button {
        padding: 13px 6px;
        font-size: 11px
    }
}

@media(prefers-reduced-motion:reduce) {
    * {
        transition: none !important
    }
}

.theme-line h1 {
    font-size: clamp(28px, 5vw, 42px);
    letter-spacing: -1px;
    line-height: 1.2;
    overflow-wrap: anywhere;
    text-wrap: balance
}