/* ტვინის ვარჯიში (js/brain-game.js). Always the night sky, whatever the site's
   theme: it opens over a bedtime story, often in a dark room. */

.game {
    --game-text: rgba(236, 240, 255, 0.86);
    --game-line: rgba(255, 255, 255, 0.16);
    --game-glass: rgba(255, 255, 255, 0.08);
    --game-gold: #FFD27A;
    --game-yes: #2FA36B;

    position: fixed;
    inset: 0;
    width: 100%;
    max-width: none;
    height: 100%;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    color: #fff;
    background:
        radial-gradient(120% 70% at 85% 0%, rgba(109, 74, 255, 0.5) 0%, transparent 60%),
        linear-gradient(170deg, #0B1026 0%, #151B52 60%, #231C66 100%);
    font-family: inherit;
}

.game::backdrop { background: #0B1026; }

.game-close {
    position: fixed;
    z-index: 1;
    top: max(14px, env(safe-area-inset-top));
    right: 14px;
    display: grid;
    width: 48px;
    height: 48px;
    place-items: center;
    border: 1px solid var(--game-line);
    border-radius: 50%;
    background: var(--game-glass);
    color: #fff;
    cursor: pointer;
}

.game-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    width: 100%;
    max-width: 560px;
    min-height: 100%;
    margin: 0 auto;
    padding: max(28px, env(safe-area-inset-top)) 16px max(28px, env(safe-area-inset-bottom));
    box-sizing: border-box;
    justify-content: center;
    text-align: center;
}

.game-owl {
    font-size: 4.5rem;
    line-height: 1;
}

.game-owl.small { font-size: 3rem; }

.game-question {
    margin: 0;
    color: #fff;
    font-size: clamp(1.35rem, 4.6vw, 1.8rem);
    font-weight: 800;
    line-height: 1.35;
}

.game-lede,
.game-score {
    margin: 0;
    color: var(--game-text);
    font-size: 1.05rem;
    line-height: 1.55;
}

.game-kind {
    margin: 0;
    color: var(--game-gold);
    font-size: 0.95rem;
    font-weight: 700;
}

.game-ask {
    display: flex;
    align-items: center;
    gap: 12px;
}

.game-listen {
    display: grid;
    flex: none;
    width: 48px;
    height: 48px;
    place-items: center;
    border: 1px solid var(--game-line);
    border-radius: 50%;
    background: var(--game-glass);
    color: var(--game-gold);
    cursor: pointer;
}

/* Rounds so far: a gold star for a first-try answer, a plain dot for the rest. */
.game-dots {
    display: flex;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.game-dots li {
    width: 14px;
    height: 14px;
    border: 2px solid var(--game-line);
    border-radius: 50%;
    box-sizing: border-box;
}

.game-dots li.now { border-color: var(--game-gold); }
.game-dots li.done { border-color: transparent; background: rgba(255, 255, 255, 0.5); }
.game-dots li.star { border-color: transparent; background: var(--game-gold); }

.game-options,
.game-board {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

.game-option {
    min-height: 64px;
    padding: 14px 18px;
    border: 1px solid var(--game-line);
    border-radius: 18px;
    background: var(--game-glass);
    color: #fff;
    font: inherit;
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.4;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s;
}

.game-option:disabled { cursor: default; }

@media (hover: hover) {
    .game-option:not(:disabled):hover { background: rgba(255, 255, 255, 0.16); }
}

.game-option.yes {
    border-color: transparent;
    background: var(--game-yes);
}

.game-option.no { opacity: 0.5; }
.game-option.miss { animation: game-no 0.35s; }

.game-option.hint { border-color: var(--game-gold); animation: game-hint 1.2s infinite; }

.game-slots {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0;
    padding: 0;
    counter-reset: slot;
    list-style: none;
}

.game-slots li {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 8px 14px;
    border: 1px dashed var(--game-line);
    border-radius: 14px;
    box-sizing: border-box;
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    text-align: left;
    counter-increment: slot;
}

.game-slots li::before {
    flex: none;
    color: var(--game-gold);
    font-weight: 800;
    content: counter(slot);
}

.game-slots li.yes {
    border-style: solid;
    border-color: transparent;
    background: rgba(47, 163, 107, 0.35);
}

.game-feedback {
    min-height: 1.6em;
    margin: 0;
    color: var(--game-text);
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.5;
}

.game-feedback.done { color: var(--game-gold); }

.game-next {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    width: 100%;
    min-height: 56px;
}

.game-btn {
    min-height: 56px;
    padding: 12px 36px;
    border: 0;
    border-radius: 16px;
    background: linear-gradient(135deg, #FFE08A, #FFB547);
    color: #1B1F3B;
    font: inherit;
    font-size: 1.1rem;
    font-weight: 800;
    cursor: pointer;
}

.game-btn.ghost {
    border: 1px solid var(--game-line);
    background: var(--game-glass);
    color: #fff;
}

.game-question:focus { outline: none; }

.game :focus-visible {
    outline: 3px solid var(--game-gold);
    outline-offset: 2px;
}

.game-stars {
    display: flex;
    gap: 8px;
    color: rgba(255, 255, 255, 0.2);
    font-size: 4rem;
    line-height: 1;
}

.game-stars .on {
    color: var(--game-gold);
    animation: game-star 0.5s calc(var(--n) * 0.25s) backwards;
}

.game-talk {
    width: 100%;
    padding: 14px 18px;
    border: 1px solid var(--game-line);
    border-radius: 18px;
    box-sizing: border-box;
    background: var(--game-glass);
    text-align: left;
}

.game-talk strong { color: var(--game-gold); }

.game-talk p {
    margin: 6px 0 0;
    color: var(--game-text);
    line-height: 1.55;
}

.game-tiles {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    width: 100%;
}

.game-tile {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 12px 6px;
    border: 1px solid var(--game-line);
    border-radius: 16px;
    background: var(--game-glass);
}

.game-tile strong {
    color: var(--game-gold);
    font-size: 1.6rem;
}

.game-tile span {
    color: var(--game-text);
    font-size: 0.85rem;
}

.game-daily {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 18px;
    border: 1px solid rgba(255, 210, 122, 0.45);
    border-radius: 18px;
    box-sizing: border-box;
    background: rgba(255, 210, 122, 0.08);
}

.game-daily strong { font-size: 1.15rem; }

.game-daily p {
    margin: 0;
    color: var(--game-text);
}

.game-list-title {
    align-self: flex-start;
    margin: 8px 0 0;
    color: #fff;
    font-size: 1.05rem;
}

.game-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.game-row {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 64px;
    padding: 8px 12px 8px 8px;
    border: 1px solid var(--game-line);
    border-radius: 14px;
    background: var(--game-glass);
    color: #fff;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.game-row img {
    flex: none;
    width: 48px;
    height: 48px;
    border-radius: 10px;
    object-fit: cover;
}

.game-row-name {
    flex: 1;
    min-width: 0;
    font-weight: 700;
    overflow-wrap: break-word;
}

.game-row-side {
    flex: none;
    color: var(--game-text);
    font-size: 0.85rem;
}

.game-row-side.stars {
    color: var(--game-gold);
    font-size: 1rem;
    letter-spacing: 1px;
}

.game-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--game-line);
    border-top-color: var(--game-gold);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

@keyframes game-no {
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}

@keyframes game-hint {
    50% { background: rgba(255, 210, 122, 0.22); }
}

@keyframes game-star {
    from { transform: scale(0.2); opacity: 0; }
    70% { transform: scale(1.2); }
}

/* The reader's row now holds three buttons. */
/* ძველი ასოები. The only font here with Asomtavruli: Noto Sans Georgian Bold
   (OFL, its licence kept inside the file), cut to the 33 letters, 2.5 KB, and
   fetched only when one of them is on screen. */
@font-face {
    font-family: 'ZgAsomtavruli';
    font-weight: 700;
    font-display: block;   /* a moment blank rather than a fallback's empty boxes */
    src: url('/fonts/asomtavruli.woff2') format('woff2');
    unicode-range: U+10A0-10C0;
}

.game-glyph {
    font-family: 'ZgAsomtavruli', 'Noto Sans Georgian', serif;
    font-size: 132px;
    font-weight: 700;
    line-height: 1.05;
    color: var(--game-gold);
    text-shadow: 0 0 36px rgba(255, 210, 122, 0.35);
}

.game-options.letters {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    max-width: 380px;
}

.game-options.letters .game-option {
    min-height: 84px;
    padding: 8px;
    font-size: 2.4rem;
    line-height: 1;
    text-align: center;
}

.game-letters {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--game-line);
    border-radius: 18px;
    box-sizing: border-box;
    background: var(--game-glass);
    text-align: left;
}

.game-letters .game-glyph {
    flex: none;
    width: 56px;
    font-size: 54px;
    text-align: center;
}

.game-letters-copy { flex: 1; min-width: 0; }

.game-letters-copy strong { font-size: 1.05rem; }

.game-letters-copy p {
    margin: 2px 0 0;
    color: var(--game-text);
    font-size: 0.92rem;
    line-height: 1.4;
}

.game-letters .game-btn { flex: none; padding: 12px 24px; }

/* Samani's card after the letters: its own yellow. */
.game-samani {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 14px 16px;
    border: 1px solid rgba(255, 213, 79, 0.5);
    border-radius: 18px;
    box-sizing: border-box;
    background: rgba(255, 213, 79, 0.1);
    color: #fff;
    text-align: left;
    text-decoration: none;
    transition: background 0.15s;
}

.game-samani:hover,
.game-samani:focus-visible { background: rgba(255, 213, 79, 0.18); }

.game-samani img {
    flex: none;
    width: 56px;
    height: 56px;
    border-radius: 13px;
}

.game-samani-text {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.game-samani-text span {
    color: var(--game-text);
    font-size: 0.9rem;
    line-height: 1.4;
}

.game-samani-go {
    flex: none;
    color: var(--game-gold);
    font-weight: 800;
    white-space: nowrap;
}

@media (max-width: 480px) {
    .game-letters { flex-wrap: wrap; }
    .game-letters .game-btn { width: 100%; }
    .game-samani { flex-wrap: wrap; }
    .game-samani-go { width: 100%; text-align: right; }
}

@media (max-width: 480px) {
    #read-modal .bk-actions { flex-wrap: wrap; }
    #read-modal .share-btn-aesthetic { white-space: nowrap; }
}

/* The card on the home page. */
.game-teaser {
    display: flex;
    align-items: center;
    gap: 18px;
    margin: 28px 0;
    padding: 20px 24px;
    border-radius: 22px;
    color: #fff;
    background:
        radial-gradient(120% 120% at 90% 0%, rgba(109, 74, 255, 0.55) 0%, transparent 60%),
        linear-gradient(150deg, #0B1026, #231C66);
}

.game-teaser-owl {
    flex: none;
    font-size: 3.2rem;
    line-height: 1;
}

.game-teaser-copy { flex: 1; min-width: 0; }

.game-teaser-copy h2 {
    margin: 0 0 4px;
    color: #fff;
    font-size: 1.35rem;
}

.game-teaser-copy p {
    margin: 0;
    color: rgba(236, 240, 255, 0.86);
    line-height: 1.5;
}

@media (max-width: 600px) {
    .game-teaser {
        display: grid;
        grid-template-columns: auto 1fr;
        padding: 18px 16px;
        text-align: left;
    }
    .game-teaser .hero-cta {
        grid-column: 1 / -1;
        justify-content: center;
    }
}

@media (prefers-reduced-motion: reduce) {
    .game-option.miss,
    .game-option.hint,
    .game-stars .on { animation: none; }
}
