/* ---------- Root layout ---------- */

:root {
    --header-h: 70px;
    --gap: 30px;
    --bottom-pad: 50px;
}

html, body {
    height: 100vh;
    overflow: hidden;
}

body {
    margin: 0;
    display: flex;
    flex-direction: column;
    font-family: 'Golos Text', sans-serif;
    font-weight: 800;
    background: #fff;
    text-align: center;
}

/* ---------- Header ---------- */
h1 {
    padding: 0;
    margin: 0;
}

h1.text-center {
    height: var(--header-h);
    line-height: var(--header-h);
    color: #004359;
    margin: 0;
}

/* ---------- Content area (fills the rest) ---------- */
.content {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding-bottom: var(--bottom-pad);
    box-sizing: border-box;
}

/* ---------- 3x3 grid that always fits ---------- */
.grid-container {
    /* height-based cell: leave header, gaps, and a bit of shrink */
    --cell-h: calc((100vh - var(--header-h) - (var(--gap) * 4) - var(--bottom-pad)) / 3);
    --cell-w: calc((100vw - (var(--gap) * 4)) / 3);
    --cell: min(var(--cell-h), var(--cell-w));

    display: grid;
    grid-template-columns: repeat(3, var(--cell));
    grid-auto-rows: var(--cell);
    gap: var(--gap);
    justify-content: center;
    align-content: center;
}

/* ---------- Tiles ---------- */
.grid-item {
    position: relative;
    width: var(--cell);
    height: var(--cell);
    border-radius: 18px;
    overflow: hidden;
    text-align: left;
    background-color: #E4E9EC;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    border: 2px solid #000;
    box-sizing: border-box;
}

.grid-item:hover {
    background-color: #9bdb7f;
    box-shadow: 2px 2px 4px #33373b;
}

.grid-item .grid-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/*
.grid-title,
.stars {
    position: absolute;
    left: 8px;
    right: 8px;
    color: #004359;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.75);
    pointer-events: none;
    z-index: 4;
}
    */

.grid-title {
    bottom: 35px;
    font-weight: 800;
    font-size: clamp(12px, calc(var(--cell) * 0.09), 20px);
    line-height: 1.2;
}

.stars {
    bottom: 8px;
}

/* footer bar behind text 
.grid-item::after {
    --footer-h: clamp(38px, calc(var(--cell) * 0.26), 70px);
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: var(--footer-h);
    background: rgba(211, 211, 211, 0.95);
    border-bottom-left-radius: 18px;
    border-bottom-right-radius: 18px;
    pointer-events: none;
    z-index: 2;
}
*/

/* stars */
.star-green,
.star-grey-outline {
    font-size: clamp(14px, calc(var(--cell) * 0.12), 26px);
    display: inline-block;
    margin: 0 2px;
    vertical-align: middle;
}
.star-green {
    color: #4caf50;
    text-shadow: 0 0 12px #b6e388;
}
.star-grey-outline {
    color: #bbb;
}
.grid-item.completed .star-green {
    display: inline-block;
}
.grid-item.unlocked .star-grey-outline {
    display: inline-block;
}

/* lock icons */
.lock-icon,
.unlocked-icon {
    display: none;
    position: absolute;
    font-size: clamp(32px, calc(var(--cell) * 0.45), 70px);
    color: #bbb;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    pointer-events: none;
    z-index: 5;
}
.unlocked-icon {
    left: 51.5%;
}

/* clouds (for locked) */
.cloud-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 3;
}
.grid-item.locked .grid-image {
    filter: blur(7px) brightness(0.85);
}
.grid-item.locked .cloud-canvas {
    display: block;
}
.grid-item:not(.locked) .cloud-canvas {
    display: none;
}

/* ---------- SudokuPad Overlay (fullscreen) ---------- */
#sudokuPadOverlay {
    display: none;
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    background: none;
    z-index: 999;
    justify-content: center;
    align-items: center;
}
#sudokuPadOverlay.active {
    display: flex;
}
#sudokuPadOverlay > div {
    border-radius: 0 !important;
    width: 75vw;
    max-width: 75vw;
    min-width: 320px;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}
#sudokuPadFrame {
    width: 100vw;
    height: 100vh;
    border: none;
    background: #fff;
    z-index: 1000;
}
#closeSudokuPad {
    position: fixed;
    top: -8px;
    right: 0;
    font-size: 2.5em;
    z-index: 1001;
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 0 18px;
    height: 56px;
    width: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ---------- Hint / video overlays (kept from your original) ---------- */
#videoHintOverlay {
    position: fixed;
    top: 435px;
    left: 10px;
    width: 340px;
    height: 200px;
    z-index: 2000;
    background: rgba(255,255,255,0.98);
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.18);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 8px;
}
#videoHintOverlay iframe {
    width: 320px;
    height: 180px;
    border: none;
    border-radius: 8px;
}

#hint-buttons-container {
    position: fixed;
    top: 80px;
    right: 40px;
    z-index: 1100;
    display: grid;
    grid-template-columns: repeat(3, 48px);
    grid-template-rows: repeat(3, 48px);
    gap: 12px;
    background: rgba(255,255,255,0.92);
    border-radius: 12px;
    padding: 12px 10px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.10);
}
.hint-btn {
    width: 44px;
    height: 44px;
    font-size: 1.5em;
    border: none;
    border-radius: 8px;
    background: #e4e9ec;
    color: #004359;
    cursor: pointer;
}
.hint-btn:hover {
    background: #d0dde5;
}
#hint-question-btn {
    position: fixed;
    top: -8px;
    right: 56px;
    width: 56px;
    height: 56px;
    background: none;
    border: none;
    color: #fff;
    font-size: 2em;
    cursor: pointer;
    display: none;
    z-index: 1002;
}
#constraints-question-btn {
    position: fixed;
    top: -8px;
    left: 70px;
    width: 56px;
    height: 56px;
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5em;
    cursor: pointer;
    display: none;
    z-index: 1002;
}

/* ---------- Constraints overlay ---------- */
#constraintsOverlay {
    display: none;
    position: fixed;
    top: 40px;
    left: -5px;
    width: 25vw;
    height: 100vh;
    z-index: 2100;
    background: #fff;
    border-radius: 12px;
    padding: 8px 0;
    overflow-y: auto;
}
#closeConstraintsOverlay {
    display: none;
}

.grid-footer {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 8px 8px 6px;
    background: rgba(211, 211, 211, 0.95);
    border-bottom-left-radius: 18px;
    border-bottom-right-radius: 18px;
    z-index: 3;
}

.grid-title,
.stars {
    position: static;
    left: auto;
    right: auto;
    bottom: auto;
    color: #004359;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.75);
    pointer-events: none;
}

.grid-title {
    font-weight: 800;
    font-size: clamp(12px, calc(var(--cell) * 0.09), 20px);
    line-height: 1.2;
}