
:root {
--brand: #174a78;
--brand-dark: #103657;
--board-gap: 2px;
--cell-bg: #fff;
--fixed-bg: #eaf3fb;
--focus-bg: #fff4d6;
--error-bg: #ffe1e1;
--same-bg: #e9f2ff;
}

body {
background: #f4f7fa;
color: #263442;
font-family: Arial, Helvetica, sans-serif;
}

.site-header {
background: #fff;
border-bottom: 1px solid #dce5ed;
}

.site-logo {
display: block;
max-width: 100%;
height: auto;
}

.navbar {
background: var(--brand);
}

.navbar .nav-link {
color: #fff;
font-weight: 500;
}

.navbar .nav-link:hover,
.navbar .nav-link:focus {
color: #d7eaff;
}

.page-shell {
max-width: 1180px;
}

.content-card,
.sidebar-card {
background: #fff;
border: 1px solid #e1e8ef;
border-radius: 14px;
box-shadow: 0 5px 18px rgba(26, 54, 80, .05);
}

.section-heading {
color: var(--brand-dark);
font-family: Georgia, "Times New Roman", serif;
font-size: clamp(1.2rem, 2vw, 1.55rem);
font-weight: 600;
}

.sudoku-toolbar {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: .5rem;
}

.sudoku-toolbar .form-select {
width: auto;
min-width: 130px;
}

.sudoku-board-wrap {
width: min(100%, 540px);
margin-inline: auto;
}

.sudoku-board {
display: grid;
grid-template-columns: repeat(9, minmax(0, 1fr));
gap: var(--board-gap);
width: 100%;
aspect-ratio: 1;
padding: 3px;
background: #31475b;
border: 1px solid #31475b;
border-radius: 8px;
touch-action: manipulation;
}

.sudoku-cell {
min-width: 0;
min-height: 0;
display: flex;
align-items: center;
justify-content: center;
padding: 0;
border: 0;
border-radius: 0;
background: var(--cell-bg);
color: #173c61;
font-size: clamp(1rem, 4.2vw, 1.65rem);
font-weight: 600;
text-align: center;
outline-offset: -3px;
}

.sudoku-cell.fixed {
background: var(--fixed-bg);
color: #123c63;
}

.sudoku-cell.related {
background: var(--same-bg);
}

/* Само избраното квадратче */
.sudoku-cell.selected {
background: #f7bfd5;
outline: 2px solid #d94f8b;
z-index: 1;
}



.sudoku-cell.related {
background: var(--same-bg);
}

.sudoku-cell.error {
background: var(--error-bg);
color: #a11b1b;
}

.sudoku-cell:nth-child(3n):not(:nth-child(9n)) {
border-right: 2px solid #31475b;
}

.sudoku-cell:nth-child(n+19):nth-child(-n+27),
.sudoku-cell:nth-child(n+46):nth-child(-n+54) {
border-bottom: 2px solid #31475b;
}

.sudoku-cell:focus-visible {
outline: 3px solid #e0a526;
z-index: 2;
}

.number-pad {
display: grid;
grid-template-columns: repeat(9, minmax(0, 1fr));
gap: .35rem;
max-width: 540px;
margin: .85rem auto 0;
}

.number-pad .btn {
padding: .55rem 0;
font-weight: 600;
}

.legend {
color: #5d6b78;
font-size: .9rem;
}

.sidebar-links a {
display: block;
padding: .35rem .35rem;
color: var(--brand);
text-decoration: none;
border-radius: 7px;
}

.sidebar-links a:hover {
background: #edf4fa;
text-decoration: underline;
}

.site-footer {
color: #5e6b76;
font-size: .9rem;
}

@media (max-width: 575.98px) {
.content-card {
padding: 1rem !important;
}

.sudoku-toolbar {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
}

.sudoku-toolbar .form-select,
.sudoku-toolbar .btn {
width: 100%;
min-width: 0;
}

.sudoku-toolbar .btn {
white-space: normal;
}

.sudoku-cell {
font-size: clamp(.85rem, 6vw, 1.3rem);
}

.number-pad {
gap: .25rem;
}

.number-pad .btn {
padding: .5rem 0;
font-size: .9rem;
}
}





/* =========================================
   KAKURO
========================================= */

.kakuro-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
}

.kakuro-toolbar .form-select {
    width: auto;
    min-width: 130px;
}

.kakuro-board-wrap {
    width: min(100%, 620px);
    margin-inline: auto;
}

.kakuro-board {
    display: grid;
    width: 100%;
    aspect-ratio: 1;
    gap: 2px;
    padding: 3px;
    background: #31475b;
    border: 1px solid #31475b;
    border-radius: 8px;
    overflow: hidden;
    touch-action: manipulation;
}

.kakuro-cell {
    position: relative;
    min-width: 0;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 0;
    overflow: hidden;
}

.kakuro-block {
    position: relative;
    background: linear-gradient(
        to top right,
        #263d53 49.3%,
        #aebdca 49.7%,
        #aebdca 50.3%,
        #263d53 50.7%
    );
}

.kakuro-white {
    background: #fff;
    color: #173c61;
    font-size: clamp(1rem, 4vw, 1.7rem);
    font-weight: 600;
    cursor: pointer;
    outline-offset: -3px;
}

.kakuro-white:hover {
    background: #edf4fa;
}

.kakuro-white.selected {
    background: #f7bfd5;
    outline: 2px solid #d94f8b;
    z-index: 2;
}

.kakuro-white.related {
    background: #e9f2ff;
}

.kakuro-white.error {
    background: #ffe1e1;
    color: #a11b1b;
}

.kakuro-white.revealed {
    background: #eaf3fb;
    color: #174a78;
}

.kakuro-white:focus-visible {
    outline: 3px solid #e0a526;
    z-index: 3;
}

/* Подсказки за сумите */


.kakuro-clue-down {
    position: absolute;
    top: 8%;
    right: 10%;
    color: #fff;
    font-size: clamp(.5rem, 1.5vw, .85rem);
    font-weight: 600;
    line-height: 1;
}

.kakuro-clue-right {
    position: absolute;
    bottom: 8%;
    left: 10%;
    color: #fff;
    font-size: clamp(.5rem, 1.5vw, .85rem);
    font-weight: 600;
    line-height: 1;
}


.kakuro-clue-down {
    top: 9%;
    left: 12%;
}

.kakuro-clue-right {
    right: 10%;
    bottom: 9%;
}

/* Цифров панел */

.kakuro-number-pad {
    display: grid;
    grid-template-columns: repeat(9, minmax(0, 1fr));
    gap: .35rem;
    max-width: 620px;
    margin: .85rem auto 0;
}

.kakuro-number-pad .btn {
    padding: .55rem 0;
    font-weight: 600;
}

/* Мобилни устройства */

@media (max-width: 575.98px) {

    .kakuro-toolbar {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .kakuro-toolbar .form-select,
    .kakuro-toolbar .btn {
        width: 100%;
        min-width: 0;
    }

    .kakuro-toolbar .btn {
        white-space: normal;
    }

    .kakuro-white {
        font-size: clamp(.8rem, 5vw, 1.3rem);
    }

    .kakuro-clue-down,
    .kakuro-clue-right {
        font-size: clamp(.42rem, 1.8vw, .7rem);
    }

    .kakuro-number-pad {
        gap: .25rem;
    }

    .kakuro-number-pad .btn {
        padding: .5rem 0;
        font-size: .9rem;
    }
}
