:root {
    --cell-size: 44px;
    --gap-size: 4px;
    --border-radius: 10px;
    --wrap-offset: 48px;
    --pane-gap: 18px;
    --clue-stack-track-size: 1fr;
    --viewport-height: 100vh;
    --full-size: 100%;
    --wrap-max-width: calc(100vw - var(--wrap-offset));
    --narrow-screen-width: 800px;
    --phone-screen-width: 500px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 24px;
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    background-image: radial-gradient(at 20% 10%, #1f2440 0%, #0f1222 55%, #0b0d18 100%);
    background-repeat: no-repeat;
    background-attachment: fixed;
    background-size: cover;
    color: #e9edff;
    display: grid;
    place-items: start center;
    min-height: var(--viewport-height);
}


.wrap {
    width: fit-content;
    max-width: var(--wrap-max-width);
    height: calc(var(--viewport-height) - var(--wrap-offset));
    overflow: hidden;
    background: rgba(255, 255, 255, .06);
    border: 1px solid rgba(255, 255, 255, .15);
    border-radius: 16px;
    padding: var(--pane-gap);
    box-shadow: 0 10px 30px rgba(0, 0, 0, .4);
    backdrop-filter: blur(6px);
    display: grid;
    grid-template-rows: auto 1fr auto;
    gap: var(--pane-gap);
}

.hdr {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

h1 {
    margin: 0;
    font-size: 22px;
}

.sub {
    opacity: .8;
    font-size: 13px;
}

select {
    background: #0f142a;
    color: #e9edff;
    border: 1px solid #2a2f45;
    border-radius: var(--border-radius);
    padding: 8px 10px;
}


.pane {
    display: flex;
    flex-direction: row;
    gap: var(--pane-gap);
    height: 100%;
    min-height: 0;
    max-width: var(--full-size);
    overflow: hidden;
    flex: 1 1 auto;
}

/* Viewport: keep scrolling/panning, but no panel look */
.gridViewport {
    max-width: var(--full-size);
    overflow: auto;
    background: transparent;
    border: 0;
    border-radius: 0;
    height: var(--full-size);
    flex: 0 0 auto;
    min-width: 0;
    min-height: 0;
}

.gridViewport.dragging {
    cursor: grabbing;
}

/* The grid itself should also be transparent & panel-less */
.grid {
    display: grid;
    gap: var(--gap-size);
    /* remove panel visuals */
    background: transparent;
    border: 0;
    border-radius: 0;
    padding: 0;
}

/* Individual cells keep the dark style */
.cell {
    width: var(--cell-size);
    height: var(--cell-size);
    position: relative;
    border-radius: 6px;
    border: 1px solid #2a2f45;
    background: #0b1022;
    display: grid;
    place-items: center;
}

.blk {
    background: #0f142a;
    border-color: #202743;
}

/* (kept for safety) */

.cell input {
    width: 100%;
    height: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    text-align: center;
    font: 700 18px/1.1 system-ui;
    color: #dce5ff;
    text-transform: uppercase;
}

.num {
    position: absolute;
    top: 2px;
    left: 4px;
    font-size: 10px;
    color: #aab4dd;
    opacity: .9;
    pointer-events: none;
}

.correct {
    box-shadow: inset 0 0 0 2px rgba(55, 211, 154, .28);
    border-color: #34d399;
}

.wrong {
    box-shadow: inset 0 0 0 2px rgba(255, 107, 107, .28);
    border-color: #ff6b6b;
}

.clues {
    display: grid;
    grid-template-columns: var(--clue-stack-track-size);
    gap: 12px 18px;
    overflow: auto;
    max-height: var(--full-size);
    flex: 0 0 auto;
    width: max-content;
    margin-left: var(--pane-gap);
    align-self: flex-start;
}

@media (max-width: 800px) {
    .wrap {
        height: auto;
        overflow-y: auto;
        overflow-x: auto;
    }

    .pane {
        flex-direction: column;
        overflow-y: auto;
        overflow-x: visible;
    }

    .gridViewport {
        flex: 0 0 auto;
        height: auto;
        overflow: visible;
    }

    .clues {
        flex: 0 0 auto;
        width: 100%;
        margin-left: 0;
        align-self: stretch;
    }
}

.cluegrp h3 {
    margin: 0 0 6px;
    font-size: 16px;
}

ol {
    list-style: none;
    padding-left: 0;
    margin: 0;
    display: grid;
    gap: 6px;
}

li {
    padding: 8px 10px;
    background: rgba(255, 255, 255, .05);
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: var(--border-radius);
}

.controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

button {
    background: #3b82f6;
    color: #fff;
    border: 0;
    border-radius: var(--border-radius);
    padding: 10px 14px;
    font-weight: 700;
    cursor: pointer;
}

button.secondary {
    background: #334155;
}

@media (max-width: var(--phone-screen-width)) {
    :root {
        --wrap-offset: 24px;
        --pane-gap: 12px;
    }

    body {
        padding: 12px;
    }

    .controls {
        flex-direction: column;
    }

    button {
        width: 100%;
    }
}

.status {
    margin-left: auto;
    align-self: center;
    font-size: 14px;
    opacity: .95;
}

.ok {
    color: #34d399;
    font-weight: 700;
}

.error {
    flex-basis: 100%;
    padding: 10px 12px;
    border-radius: var(--border-radius);
    background: rgba(255, 107, 107, .1);
    border: 1px solid rgba(255, 107, 107, .35);
    color: #ffd0d0;
    display: none;
}

/* Word/cell highlighting */
.cell.hl {
    box-shadow: inset 0 0 0 2px rgba(99, 102, 241, .45); /* subtle indigo glow */
    border-color: #6366f1;
}

.clueHL {
    background: rgba(99, 102, 241, .12);
    border-color: rgba(99, 102, 241, .5);
}

.clueSolved {
    background: rgba(52, 211, 153, .12);
    border-color: rgba(52, 211, 153, .5);
}

.hintControls {
    display: inline-block;
    float: right;
    margin-left: 4px;
    padding: 0;
}

.hintButton {
    padding: 0 4px;
    font-size: 12px;
    line-height: 1;
    min-width: 0;
    border-radius: 4px;
}

.hintText {
    margin-top: 4px;
    font-size: 13px;
    opacity: .9;
}

