:root {
    --game-primary: #c90c0f;
    --game-secondary: #67e8f9;
}

body.sk-page {
    margin: 0;
    min-height: 100vh;
    font-family: "Rockwell", "Rockwell Nova", "Roboto Slab", serif;
    color: #e2e8f0;
    overflow-x: hidden;
    background:
        radial-gradient(circle at 12% 8%, rgba(103, 232, 249, 0.16), transparent 42%),
        radial-gradient(circle at 88% 10%, rgba(201, 12, 15, 0.18), transparent 46%),
        linear-gradient(180deg, #071018 0%, #123047 48%, #061018 100%);
}

body.sk-page.game-menu-active {
    overflow-y: auto;
    overflow-x: hidden;
}

body.sk-page.game-menu-active #game-header {
    display: none !important;
}

.sk-page .game-screen {
    display: none;
    min-height: 100vh;
}

.sk-page .game-screen.active {
    display: block;
}

body.sk-page.with-game-header .sk-shell {
    padding-top: 5.5rem;
}

.sk-shell {
    max-width: min(760px, 96vw);
    margin: 0 auto;
    padding: 1.1rem 0.75rem 2.5rem;
}

.sk-hud {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    max-width: 560px;
    margin: 0 auto 0.85rem;
    padding: 0.55rem 0.7rem;
    background: linear-gradient(180deg, #1e3a4d, #0b1c2c);
    border: 3px solid #061018;
    border-radius: 12px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 10px 24px rgba(0, 0, 0, 0.35);
}

.sk-lcd {
    min-width: 4.6rem;
    padding: 0.2rem 0.45rem;
    background: #061018;
    color: #67e8f9;
    font-family: "Courier New", ui-monospace, monospace;
    font-size: 1.15rem;
    font-weight: 700;
    text-align: center;
    border-radius: 6px;
    box-shadow: inset 0 0 0 2px #7f1d1d, inset 0 8px 16px rgba(0, 0, 0, 0.45);
}

.sk-lcd span {
    display: block;
    font-size: 0.62rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #f4c430;
}

.sk-chip {
    padding: 0.45rem 0.7rem;
    border-radius: 999px;
    background: rgba(103, 232, 249, 0.12);
    color: #a5f3fc;
    font-weight: 700;
}

.sk-toolbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.45rem;
    margin: 0 auto 0.85rem;
    max-width: 560px;
}

.sk-tool-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.75rem;
    min-height: 44px;
    border-radius: 999px;
    border: 1px solid rgba(103, 232, 249, 0.28);
    background: rgba(6, 16, 24, 0.75);
    color: #e2e8f0;
    font-weight: 700;
    cursor: pointer;
}

.sk-tool-btn:hover {
    border-color: #67e8f9;
    color: #67e8f9;
}

.sk-tool-btn:disabled {
    opacity: 0.45;
    cursor: default;
}

.sk-status {
    text-align: center;
    min-height: 1.4rem;
    margin: 0 auto 0.75rem;
    color: #fde68a;
    font-weight: 700;
}

.sk-board-wrap {
    display: flex;
    justify-content: center;
    padding: 0.35rem 0.25rem 0.5rem;
}

.sk-board {
    --sk-n: 4;
    --sk-cell: min(68px, calc((min(94vw, 520px) - 12px) / (var(--sk-n) + 1.3)));
    display: grid;
    grid-template-columns: var(--sk-cell) repeat(var(--sk-n), var(--sk-cell)) var(--sk-cell);
    grid-template-rows: var(--sk-cell) repeat(var(--sk-n), var(--sk-cell)) var(--sk-cell);
    background: #0b1c2c;
    border: 4px solid #061018;
    border-radius: 14px;
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.4);
    padding: 4px;
    gap: 3px;
}

.sk-clue,
.sk-corner {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    min-height: 36px;
    color: #f4c430;
    font-weight: 800;
    font-size: clamp(0.95rem, 3.4vw, 1.25rem);
}

.sk-clue.is-bad {
    color: #fecaca;
    text-shadow: 0 0 8px rgba(201, 12, 15, 0.65);
}

.sk-cell {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    border: 1px solid rgba(14, 26, 36, 0.35);
    border-radius: 8px;
    background: #e8f4ff;
    color: #0b1c2c;
    font-size: clamp(1.15rem, 4.4vw, 1.7rem);
    font-weight: 800;
    cursor: pointer;
    touch-action: manipulation;
    user-select: none;
}

.sk-cell[data-h="1"] { background: #dbeafe; }
.sk-cell[data-h="2"] { background: #a5f3fc; }
.sk-cell[data-h="3"] { background: #86efac; }
.sk-cell[data-h="4"] { background: #fde68a; }
.sk-cell[data-h="5"] { background: #fdba74; }
.sk-cell[data-h="6"] { background: #fca5a5; }

.sk-cell.is-given {
    box-shadow: inset 0 0 0 2px #1e3a4d;
    cursor: default;
}

.sk-cell.is-selected {
    box-shadow: inset 0 0 0 3px #c90c0f;
    z-index: 1;
}

.sk-cell.is-hint {
    box-shadow: inset 0 0 0 3px #f4c430;
}

.sk-cell.is-bad {
    background: #fecaca !important;
    color: #7f1d1d;
}

.sk-cell.is-won {
    box-shadow: inset 0 0 0 2px #16a34a;
}

.sk-notes {
    position: absolute;
    inset: 3px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    pointer-events: none;
    font-size: clamp(0.48rem, 1.8vw, 0.62rem);
    font-weight: 700;
    color: #334155;
    line-height: 1.1;
}

.sk-pad {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.4rem;
    max-width: 420px;
    margin: 0.85rem auto 0;
}

.sk-pad-btn {
    min-width: 44px;
    min-height: 44px;
    padding: 0.45rem 0.75rem;
    border-radius: 10px;
    border: 2px solid #c90c0f;
    background: #fff !important;
    color: #c90c0f !important;
    font-weight: 800;
    font-size: 1.1rem;
    cursor: pointer;
}

.sk-pad-btn:hover,
.sk-pad-btn.is-active {
    background: #c90c0f !important;
    color: #fff !important;
}

.sk-hint {
    text-align: center;
    color: #94a3b8;
    font-size: 0.92rem;
    margin: 0.85rem auto 0;
    max-width: 36rem;
}

.sk-settings-panel__label {
    margin: 0 0 0.45rem;
    color: #1a120c;
    font-weight: 600;
}

.sk-settings-panel__buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-bottom: 0.85rem;
}

#settingsModal .sk-settings-panel__note {
    margin: 0.75rem 0 0;
    color: #7f1d1d;
    font-size: 0.9rem;
}

.difficulty-pill {
    padding: 0.45rem 0.75rem;
    min-height: 44px;
    border-radius: 999px;
    border: 2px solid #c90c0f;
    background: #fff !important;
    color: #c90c0f !important;
    font-weight: 700;
    cursor: pointer;
}

.difficulty-pill.is-selected,
.difficulty-pill:hover {
    background: #c90c0f !important;
    color: #fff !important;
}

.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    z-index: 12000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: #fff;
    color: #1a1a1a;
    border-radius: 1rem;
    max-width: 640px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-large {
    max-width: 760px;
}

.modal-header,
.modal-footer {
    padding: 1.1rem 1.4rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.modal-header {
    border-bottom: 2px solid #eee;
}

.modal-header h2 {
    margin: 0;
    color: #c90c0f;
    font-size: 1.35rem;
}

.modal-close {
    background: #fff !important;
    border: 2px solid #c90c0f;
    color: #c90c0f !important;
    border-radius: 8px;
    cursor: pointer;
    padding: 0.35rem 0.55rem;
}

.modal-close:hover {
    background: #c90c0f !important;
    color: #fff !important;
}

.modal-body {
    padding: 1.2rem 1.4rem;
}

.modal-footer {
    border-top: 2px solid #eee;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.help-section {
    margin-bottom: 1.1rem;
}

.help-section h3 {
    color: #c90c0f;
    margin: 0 0 0.4rem;
}

.help-section ul {
    margin: 0.3rem 0 0;
    padding-left: 1.2rem;
}

.sk-help-city {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 6px;
    min-height: 88px;
    margin: 0.7rem auto 0;
}

.sk-help-tower {
    width: 28px;
    border-radius: 4px 4px 0 0;
    background: #67e8f9;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    color: #0b1c2c;
    font-weight: 800;
    font-size: 0.85rem;
    padding-bottom: 4px;
}

.sk-help-tower.h1 { height: 28px; background: #dbeafe; }
.sk-help-tower.h2 { height: 42px; background: #a5f3fc; }
.sk-help-tower.h3 { height: 56px; background: #86efac; }
.sk-help-tower.h4 { height: 72px; background: #fde68a; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.stat-card {
    background: #f8fafc;
    border-radius: 12px;
    padding: 0.85rem;
    text-align: center;
}

.stat-value {
    font-size: 1.6rem;
    color: #c90c0f;
    font-weight: 700;
}

.stat-label {
    color: #64748b;
    font-size: 0.85rem;
}

.difficulty-stats {
    display: grid;
    gap: 0.45rem;
}

.difficulty-stats div {
    display: flex;
    justify-content: space-between;
    padding: 0.45rem 0.55rem;
    background: #f8fafc;
    border-radius: 8px;
}

.result-message {
    font-size: 1.05rem;
    margin: 0 0 1rem;
}

.win-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.6rem;
    text-align: center;
}

.win-stat strong {
    display: block;
    font-size: 1.35rem;
    color: #c90c0f;
}

.win-stat span {
    color: #64748b;
    font-size: 0.82rem;
}

.sk-page .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.65rem 1.1rem;
    border-radius: 0.55rem;
    border: 2px solid transparent;
    font-weight: 700;
    cursor: pointer;
}

.sk-page .btn-primary {
    background: #c90c0f !important;
    color: #fff !important;
    border-color: #c90c0f;
}

.sk-page .btn-secondary {
    background: #fff !important;
    color: #c90c0f !important;
    border-color: #c90c0f;
}

.sk-page .btn-secondary:hover {
    background: #c90c0f !important;
    color: #fff !important;
}

@media (max-width: 640px) {
    body.sk-page.with-game-header .sk-shell {
        padding-top: 0.75rem;
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    .sk-hud {
        max-width: 100%;
    }

    .sk-lcd {
        min-width: 0;
        flex: 1 1 0;
    }

    .sk-cell,
    .sk-clue,
    .sk-corner {
        min-width: 32px;
        min-height: 32px;
    }
}
