body.puzzle-page {
    margin: 0;
    min-height: 100vh;
    padding: clamp(12px, 3vw, 28px);
    background:
        radial-gradient(circle at top left, rgba(255, 255, 255, 0.22), transparent 32%),
        linear-gradient(160deg, #0f172a 0%, #12304b 44%, #1a5f7a 100%);
    color: #102033;
    font-family: "Trebuchet MS", "Avenir Next", sans-serif;
    box-sizing: border-box;
}

body.puzzle-page *,
body.puzzle-page *::before,
body.puzzle-page *::after {
    box-sizing: border-box;
}

.puzzle-shell {
    width: min(100%, 980px);
    margin: 0 auto;
    padding: clamp(16px, 4vw, 32px);
    border-radius: 28px;
    background: rgba(246, 250, 255, 0.96);
    box-shadow:
        0 18px 48px rgba(3, 12, 27, 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.puzzle-header {
    margin-bottom: 1rem;
}

.puzzle-heading h1 {
    margin: 0;
    font-size: clamp(2rem, 4vw, 3rem);
    line-height: 1.05;
    color: #0f2740;
    letter-spacing: -0.04em;
    text-wrap: balance;
}

.info-panel,
.setup-panel,
.instructions,
.puzzle-status {
    border-radius: 20px;
    padding: clamp(14px, 3vw, 20px);
}

.info-panel {
    margin-bottom: 1rem;
    background: linear-gradient(180deg, rgba(226, 238, 255, 0.82), rgba(244, 248, 255, 0.98));
    border: 1px solid rgba(88, 121, 165, 0.18);
}

.info-panel p {
    margin: 0.35rem 0;
    line-height: 1.5;
}

.puzzle-status {
    margin-bottom: 1rem;
    border: 1px solid transparent;
    font-size: 0.98rem;
    line-height: 1.45;
}

.puzzle-status.is-visible {
    display: block;
}

.puzzle-status--info {
    color: #12304b;
    background: rgba(213, 236, 255, 0.9);
    border-color: rgba(73, 132, 194, 0.3);
}

.puzzle-status--success {
    color: #0d3c2f;
    background: rgba(214, 247, 230, 0.92);
    border-color: rgba(44, 137, 91, 0.35);
}

.puzzle-status--warning {
    color: #5e3d05;
    background: rgba(255, 244, 212, 0.96);
    border-color: rgba(209, 163, 40, 0.35);
}

.puzzle-status--error {
    color: #621f24;
    background: rgba(255, 226, 230, 0.95);
    border-color: rgba(194, 76, 91, 0.35);
}

.controls,
.board-selector {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.controls {
    justify-content: space-between;
}

.board-selector {
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 0.25rem;
    scrollbar-width: thin;
}

.board-selector::-webkit-scrollbar {
    height: 8px;
}

.board-selector::-webkit-scrollbar-thumb {
    background: rgba(31, 76, 122, 0.25);
    border-radius: 999px;
}

.puzzle-button,
.board-btn {
    appearance: none;
    border: none;
    min-height: 44px;
    padding: 0.82rem 1rem;
    border-radius: 999px;
    font: inherit;
    font-weight: 700;
    color: #f8fbff;
    background: linear-gradient(135deg, #235d8d, #1d8aa4);
    box-shadow: 0 10px 22px rgba(22, 72, 104, 0.22);
    cursor: pointer;
    touch-action: manipulation;
    transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease, opacity 0.16s ease;
}

.board-btn {
    background: linear-gradient(135deg, #6f7e94, #5a677a);
    flex: 0 0 auto;
}

.board-btn.active {
    background: linear-gradient(135deg, #235d8d, #1d8aa4);
    box-shadow: 0 0 0 3px rgba(64, 158, 190, 0.18), 0 10px 24px rgba(22, 72, 104, 0.25);
}

.puzzle-button:disabled,
.board-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

.control-pill {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0.75rem 1rem;
    border-radius: 999px;
    background: #17324d;
    color: #f8fbff;
    font-weight: 700;
    line-height: 1;
}

.setup-panel {
    margin-bottom: 1rem;
    background: linear-gradient(180deg, rgba(255, 244, 209, 0.92), rgba(255, 248, 229, 0.96));
    border: 1px solid rgba(210, 163, 49, 0.24);
}

.setup-panel p {
    margin: 0.4rem 0;
    line-height: 1.45;
}

.board-stage {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin: 1.25rem 0 1rem;
    overflow: hidden;
}

.instructions {
    margin-top: 1rem;
    background: linear-gradient(180deg, rgba(244, 248, 255, 0.98), rgba(235, 243, 252, 0.95));
    border: 1px solid rgba(88, 121, 165, 0.16);
}

.instructions h3 {
    margin: 0 0 0.8rem;
    color: #12304b;
}

.instructions ul {
    margin: 0;
    padding-left: 1.2rem;
}

.instructions li {
    margin: 0.45rem 0;
    line-height: 1.45;
}

@media (hover: hover) and (pointer: fine) {
    .puzzle-button:hover,
    .board-btn:hover {
        transform: translateY(-1px);
        box-shadow: 0 14px 28px rgba(22, 72, 104, 0.26);
    }
}

.puzzle-button:active,
.board-btn:active {
    transform: translateY(1px);
}

@media (max-width: 640px) {
    body.puzzle-page {
        padding: 8px;
    }

    .puzzle-shell {
        border-radius: 20px;
        padding: 14px;
    }

    .controls {
        justify-content: center;
    }

    .controls .puzzle-button,
    .controls .control-pill {
        width: 100%;
        justify-content: center;
    }

    .board-selector {
        flex-wrap: nowrap;
    }

    .instructions ul {
        padding-left: 1rem;
    }
}
