/* Flags and Capitals (/flags-and-capitals): the question card and Atlas Pin's world map beside it. Tiles and buttons
   come from the app kit; the map's canvas and zoom buttons from css/apps/atlas-map.css, shared with Atlas Pin. */

.flags-capitals-play {
    display: grid;
    grid-template-columns: minmax(240px, 0.62fr) minmax(0, 1.6fr);
    gap: var(--ak-space-3);
    width: 100%;
    min-height: 440px;
}

/* ----- the card ----- */

.flags-capitals-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--ak-space-2);
    min-width: 0;
    padding: var(--ak-space-4) var(--ak-space-3);
    border-radius: 12px;
    background: var(--ak-panel);
    border: 1px solid var(--ak-border);
    text-align: center;
    overflow: auto;
}

.flags-capitals-prompt {
    margin: 0;
    color: var(--ak-muted);
    font-size: var(--ak-fs-sm);
    font-weight: 600;
}

.flags-capitals-flag-wrap {
    display: flex;
    justify-content: center;
    padding: var(--ak-space-2) 0;
}

.flags-capitals-flag {
    display: block;
    border-radius: 3px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18), 0 6px 16px rgba(0, 0, 0, 0.16);
}

.flags-capitals-name {
    margin: 0;
    font-size: clamp(1.3rem, 2.4vw, 1.9rem);
    font-weight: 800;
    line-height: 1.15;
    color: var(--ak-text);
    overflow-wrap: anywhere;
}

.flags-capitals-sub {
    margin: 0;
    font-weight: 600;
    color: var(--ak-text);
}

.flags-capitals-result {
    margin: var(--ak-space-1) 0 0;
    color: var(--ak-muted);
    font-size: var(--ak-fs-sm);
}

.flags-capitals-result[data-tone="good"] {
    color: var(--ak-success);
    font-weight: 700;
    font-size: var(--ak-fs-md, 1rem);
}

.flags-capitals-result[data-tone="bad"] {
    color: var(--ak-danger);
    font-weight: 700;
    font-size: var(--ak-fs-md, 1rem);
}

/* Four choices: capitals in one column, flags in a two by two grid. */
.flags-capitals-options {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--ak-space-2);
    width: 100%;
    margin-top: var(--ak-space-2);
}

.flags-capitals-options--flags {
    grid-template-columns: 1fr 1fr;
}

.flags-capitals-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-height: 44px;
    padding: 8px 10px;
    border: 2px solid var(--ak-border);
    border-radius: 10px;
    background: var(--ak-field);
    color: var(--ak-text);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.12s, transform 0.12s;
}

.flags-capitals-option:hover:not(:disabled) {
    border-color: var(--ak-accent);
    transform: translateY(-1px);
}

.flags-capitals-option:focus-visible {
    outline: 2px solid var(--ak-accent);
    outline-offset: 2px;
}

.flags-capitals-option:disabled {
    cursor: default;
    opacity: 0.6;
}

.flags-capitals-option.is-right {
    border-color: var(--ak-success);
    background: color-mix(in srgb, var(--ak-success) 14%, var(--ak-field));
    opacity: 1;
}

.flags-capitals-option.is-wrong {
    border-color: var(--ak-danger);
    background: color-mix(in srgb, var(--ak-danger) 12%, var(--ak-field));
    opacity: 1;
}

.flags-capitals-option-flag {
    display: block;
    border-radius: 2px;
}

.flags-capitals-option-name {
    font-size: var(--ak-fs-xs, 0.75rem);
    color: var(--ak-muted);
    line-height: 1.2;
}

/* The results: the countries to practise, each with its flag. */
.flags-capitals-missed {
    width: 100%;
    margin: var(--ak-space-2) 0 0;
    padding: 0;
    list-style: none;
    text-align: start;
}

.flags-capitals-missed li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 2px;
    border-bottom: 1px solid var(--ak-border);
    font-size: var(--ak-fs-sm);
}

.flags-capitals-missed li:last-child {
    border-bottom: 0;
}

.flags-capitals-missed .flags-capitals-missed-head {
    color: var(--ak-muted);
    font-weight: 700;
}

.flags-capitals-missed-flag {
    flex: none;
    display: block;
}

/* On a phone the card goes above the map, and the map takes a shape of its own. */
@media (max-width: 800px) {
    .flags-capitals-play {
        grid-template-columns: 1fr;
        min-height: 0;
    }

    .flags-capitals-card {
        gap: 4px;
        padding: var(--ak-space-2) var(--ak-space-3);
    }

    .flags-capitals-name {
        font-size: 1.25rem;
    }

    .flags-capitals-flag-wrap {
        padding: 2px 0;
    }

    /* Capitals two by two, like the flags. */
    .flags-capitals-options {
        grid-template-columns: 1fr 1fr;
        margin-top: 4px;
    }

    .flags-capitals-option {
        min-height: 40px;
        padding: 6px 8px;
    }

    .flags-capitals-map-wrap {
        aspect-ratio: 4 / 3;
    }
}

/* In the app layout on a computer the card and the map take the stage's whole height under the tiles. */
@media (min-width: 801px) {
    body.filter-app-mode .ak-app > .filter-landing-stage.flags-capitals-stage > .game-board-panel {
        flex: 1 1 0;
        min-height: 0;
    }

    body.filter-app-mode .flags-capitals-stage .flags-capitals-play {
        flex: 1 1 0;
        height: 100%;
        min-height: 400px;
    }
}

/* With the controls shown on a phone or tablet the stage's height follows its content (the shared phone layout), so
   the rules above that let the card and the map take the stage's height left it 0 pixels tall there. Then the card and the map keep their own height and the stage scrolls; with the controls hidden the stage fills the screen and the rules above apply. */
@media (max-width: 960px) {
    body.filter-app-mode .ak-app:not(.is-panel-collapsed) > .filter-landing-stage.flags-capitals-stage > .game-board-panel {
        flex: none;
    }

    body.filter-app-mode .ak-app:not(.is-panel-collapsed) > .flags-capitals-stage .flags-capitals-play {
        flex: none;
        height: auto;
    }
}
