/*
GeoRankle Style 7.0

Global application shell only.

Module ownership:
- ui.css             Game controls and in-game UI
- autocomplete.css   Country autocomplete
- map-engine.css     Map Engine 7.0
- results.css        Guess/result rows
- popup.css          Game-over modal
- stats.css          Statistics
- share.css          Share controls
*/

/* =========================================================
   Design tokens
   ========================================================= */

:root {
    --gr-font-family:
        "Nunito",
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    --gr-color-text: #111827;
    --gr-color-text-soft: #64748b;
    --gr-color-white: #ffffff;
    --gr-color-yellow: #ffd400;
    --gr-color-yellow-dark: #ffc400;
    --gr-color-blue: #1292f2;
    --gr-color-blue-light: #8fd3ff;

    --gr-page-width: 1440px;
    --gr-content-width: 1100px;
    --gr-side-ad-width: 160px;

    --gr-radius-card: 34px;
    --gr-radius-medium: 22px;
    --gr-radius-small: 16px;

    --gr-shadow-card:
        0 26px 70px rgba(0, 54, 116, 0.22),
        0 8px 24px rgba(0, 0, 0, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 1);

    --gr-shadow-soft:
        0 12px 30px rgba(15, 23, 42, 0.08);

    color-scheme: light;
}

/* =========================================================
   Reset
   ========================================================= */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    min-height: 100%;

    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body,
h1,
h2,
h3,
h4,
p,
figure {
    margin: 0;
}

button,
input,
select,
textarea {
    font: inherit;
}

button,
input {
    min-width: 0;
}

img,
svg {
    display: block;
    max-width: 100%;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

/* =========================================================
   Document
   ========================================================= */

body {
    position: relative;

    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;

    overflow-x: hidden;

    background:
        radial-gradient(
            circle at 50% 0%,
            rgba(255, 255, 255, 0.22),
            transparent 28%
        ),
        radial-gradient(
            circle at 20% 35%,
            rgba(0, 140, 255, 0.28),
            transparent 32%
        ),
        linear-gradient(
            180deg,
            var(--gr-color-blue) 0%,
            #5bbcff 45%,
            var(--gr-color-blue-light) 100%
        );

    color: var(--gr-color-text);

    font-family: var(--gr-font-family);
    line-height: 1.5;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body.modal-open {
    overflow: hidden;
}

::selection {
    background: rgba(255, 212, 0, 0.72);
    color: #171717;
}

/* =========================================================
   Background decoration
   ========================================================= */

.background-map {
    position: fixed;
    inset: 0;
    z-index: -1;

    width: 100%;
    height: 100%;

    pointer-events: none;

    background-image:
        url("https://upload.wikimedia.org/wikipedia/commons/8/80/World_map_-_low_resolution.svg");
    background-repeat: no-repeat;
    background-position: center;
    background-size: min(90%, 1500px);

    opacity: 0.22;
    filter: contrast(1.15) saturate(1.2);
}

/* =========================================================
   Accessibility and utilities
   ========================================================= */

[hidden] {
    display: none !important;
}

.hidden,
.is-hidden {
    display: none !important;
}

.visually-hidden {
    position: absolute !important;

    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;

    overflow: hidden !important;

    clip: rect(0, 0, 0, 0) !important;
    clip-path: inset(50%) !important;

    white-space: nowrap !important;

    border: 0 !important;
}

.skip-link {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 10000;

    padding: 10px 14px;

    border-radius: 12px;

    background: #111827;
    color: #ffffff;

    font-weight: 900;
    text-decoration: none;

    transform: translateY(-160%);
    transition: transform 0.18s ease;
}

.skip-link:focus {
    transform: translateY(0);
}

/* =========================================================
   Header
   ========================================================= */

header {
    position: relative;

    padding: 24px 20px 2px;

    text-align: center;
}

header::before {
    content: "🌍 Daily Geography Challenge";

    display: inline-flex;
    align-items: center;
    justify-content: center;

    margin-bottom: 14px;
    padding: 8px 16px;

    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 999px;

    background: rgba(255, 255, 255, 0.22);
    color: #ffffff;

    font-size: 14px;
    font-weight: 900;
    letter-spacing: 0.3px;
    line-height: 1.2;

    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);

    box-shadow:
        0 8px 24px rgba(0, 0, 0, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

header::after {
    content: "";

    position: absolute;
    top: 52px;
    left: 50%;
    z-index: -1;

    width: min(520px, 72vw);
    height: 120px;

    transform: translateX(-50%);

    background:
        radial-gradient(
            circle,
            rgba(255, 212, 0, 0.32),
            transparent 64%
        );

    filter: blur(18px);
    pointer-events: none;
}

.logo {
    color: #ffffff;

    font-size: clamp(58px, 8vw, 92px);
    font-weight: 900;
    line-height: 0.95;
    letter-spacing: -2px;

    text-shadow:
        0 8px 0 rgba(0, 0, 0, 0.04),
        0 18px 38px rgba(0, 0, 0, 0.22);
}

.geo {
    color: #ffffff;
}

.rankle {
    color: var(--gr-color-yellow);

    text-shadow:
        0 6px 18px rgba(255, 212, 0, 0.35);
}

.tagline {
    margin-top: 12px;

    color: rgba(255, 255, 255, 0.92);

    font-size: clamp(16px, 2vw, 21px);
    font-weight: 800;
    line-height: 1.35;

    text-shadow:
        0 6px 18px rgba(0, 0, 0, 0.18);
}

.tagline::after {
    content: "#Daily · 6 guesses · World map clues";

    display: block;

    margin-top: 10px;

    color: rgba(255, 255, 255, 0.82);

    font-size: 14px;
    font-weight: 900;
    line-height: 1.35;
}

/* =========================================================
   Main page layout
   ========================================================= */

main {
    display: block;
    width: 100%;
}

.page-layout {
    display: grid;
    grid-template-columns:
        var(--gr-side-ad-width)
        minmax(0, 1fr)
        var(--gr-side-ad-width);
    align-items: start;
    gap: 24px;

    width: min(var(--gr-page-width), 96%);
    margin: 8px auto 0;
}

.page-layout > * {
    min-width: 0;
}

.page-layout .game-card {
    width: 100%;
    max-width: var(--gr-content-width);
    margin: 0 auto 30px;
}

/* =========================================================
   Advertising containers
   ========================================================= */

.ad-banner {
    display: none;
}

.side-ad {
    position: sticky;
    top: 20px;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    min-height: 600px;
    padding: 20px;

    border: 2px dashed rgba(255, 255, 255, 0.65);
    border-radius: 18px;

    background:
        linear-gradient(
            180deg,
            rgba(255, 255, 255, 0.16),
            rgba(255, 255, 255, 0.05)
        );

    color: #ffffff;

    font-size: 14px;
    font-weight: 900;
    line-height: 1.4;
    text-align: center;

    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);

    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.35),
        0 18px 44px rgba(0, 68, 140, 0.18);
}

.side-ad::before {
    content: "✦";

    display: block;

    margin-bottom: 20px;

    color: var(--gr-color-yellow);

    font-size: 34px;
    line-height: 1;

    text-shadow:
        0 0 18px rgba(255, 212, 0, 0.65);
}

.side-ad::after {
    content: "160 × 600";

    display: block;

    margin-top: 16px;

    font-size: 18px;
    opacity: 0.72;
}

/* =========================================================
   Primary game shell
   ========================================================= */

.game-card {
    position: relative;

    width: 95%;
    max-width: var(--gr-content-width);
    margin: 30px auto;
    padding: 42px 35px 35px;

    overflow: visible;

    border: 1px solid rgba(255, 255, 255, 0.9);
    border-radius: var(--gr-radius-card);

    background:
        linear-gradient(
            180deg,
            rgba(255, 255, 255, 0.98),
            rgba(250, 253, 255, 0.96)
        );

    box-shadow: var(--gr-shadow-card);

    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);

    transition:
        transform 0.28s ease,
        box-shadow 0.28s ease;
}

.game-card:hover {
    transform: translateY(-2px);

    box-shadow:
        0 30px 76px rgba(0, 54, 116, 0.25),
        0 10px 28px rgba(0, 0, 0, 0.09),
        inset 0 1px 0 rgba(255, 255, 255, 1);
}

/*
The current interface uses .game-badge as its visible game heading.
Old duplicate headings remain hidden for compatibility with older markup.
*/

.game-card .game-title,
.game-card .round-title,
#gameTitle {
    display: none !important;
}

.game-badge {
    width: fit-content;
    max-width: 100%;

    margin: 0 auto 28px;
    padding: 16px 34px;

    border: 1px solid rgba(219, 234, 254, 0.85);
    border-radius: 24px;

    background:
        linear-gradient(
            180deg,
            #f2f9ff,
            #dcefff
        );

    color: #1f2937;

    font-size: clamp(22px, 2vw, 32px);
    font-weight: 900;
    line-height: 1.2;
    letter-spacing: -0.5px;
    text-align: center;

    box-shadow:
        0 16px 38px rgba(0, 102, 255, 0.16),
        inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

.game-badge span {
    color: #111827;
}

/*
The legacy flag block is no longer part of the visible 7.0 interface.
The rule remains only to prevent old markup from creating duplicate content.
*/

.flag-container {
    display: none !important;
}

/* =========================================================
   Footer
   ========================================================= */

footer {
    width: min(var(--gr-content-width), 94%);
    margin: 0 auto;
    padding: 32px 20px 40px;

    color: rgba(255, 255, 255, 0.88);

    font-size: 14px;
    font-weight: 700;
    line-height: 1.6;
    text-align: center;

    text-shadow:
        0 4px 14px rgba(0, 0, 0, 0.18);
}

footer a {
    color: #ffffff;
    font-weight: 900;
    text-underline-offset: 3px;
}

footer a:hover {
    color: #fff4a8;
}

/*
The columns remain reserved so the game stays centred, but empty
advertising placeholders are not shown in the production release.
Remove is-inactive only after the advertising and consent setup is live.
*/
.side-ad.is-inactive {
    visibility: hidden;
    pointer-events: none;
}

.footer-copyright {
    margin-bottom: 8px;
}

.footer-links {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px 18px;
}

/* =========================================================
   Site navigation and editorial content
   ========================================================= */

.site-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;

    width: min(760px, 94%);
    margin: 18px auto 8px;
}

.site-nav a {
    padding: 7px 12px;

    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 999px;

    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;

    font-size: 13px;
    font-weight: 900;
    text-decoration: none;

    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

.site-nav a:hover,
.site-nav a:focus-visible {
    background: rgba(255, 255, 255, 0.28);
}

.site-content {
    width: min(var(--gr-content-width), 94%);
    margin: 18px auto 0;
    padding: clamp(28px, 5vw, 58px);

    border: 1px solid rgba(255, 255, 255, 0.82);
    border-radius: var(--gr-radius-card);

    background: rgba(255, 255, 255, 0.96);
    color: var(--gr-color-text);

    box-shadow: var(--gr-shadow-card);
}

/* Compact, crawlable game explanation below the primary game interface. */
.how-it-works {
    width: min(var(--gr-content-width), 94%);
    margin: 18px auto 0;
    padding: clamp(22px, 3vw, 30px);

    border: 1px solid rgba(255, 255, 255, 0.82);
    border-radius: 26px;

    background: rgba(255, 255, 255, 0.96);
    color: var(--gr-color-text);

    box-shadow: var(--gr-shadow-card);
}

.how-it-works-intro {
    max-width: 780px;
    margin: 0 auto;
    text-align: center;
}

.how-it-works h2 {
    margin: 0;
    font-size: clamp(25px, 3vw, 34px);
    line-height: 1.15;
    letter-spacing: -0.5px;
}

.how-it-works-intro p {
    margin: 9px auto 0;
    color: #526078;
    font-size: 14px;
    line-height: 1.55;
}

.how-it-works-steps {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;

    margin: 20px 0 14px;
    padding: 0;

    list-style: none;
}

.how-it-works-steps li {
    position: relative;

    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    column-gap: 10px;

    min-height: 94px;
    padding: 15px 16px 14px;

    border: 1px solid #dbeafe;
    border-radius: 16px;

    background: #ffffff;
    box-shadow: 0 8px 22px rgba(0, 73, 137, 0.06);
}

.step-number {
    position: absolute;
    top: 10px;
    left: 11px;

    display: grid;
    place-items: center;

    width: 25px;
    height: 25px;

    border-radius: 50%;

    background: #e4f4ff;
    color: #0878bd;

    font-size: 13px;
    font-weight: 900;
}

.step-icon {
    grid-row: 1 / span 2;

    padding-left: 27px;

    font-size: 26px;
    line-height: 1;
}

.how-it-works-steps strong {
    align-self: end;
    font-size: 15px;
    line-height: 1.2;
}

.how-it-works-steps li > span:last-child {
    align-self: start;

    margin-top: 3px;

    color: #64748b;
    font-size: 11px;
    line-height: 1.35;
}

.example-clue {
    margin: 0;
    padding: 11px 14px;

    border: 1px solid #cde9fa;
    border-radius: 13px;

    background: #edf8ff;
    color: #0878bd;

    font-size: 13px;
    line-height: 1.45;
    text-align: center;
}

.example-clue strong {
    color: #075985;
}

.home-resource-links {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;

    margin-top: 14px;
}

.home-resource-links a {
    display: inline-flex;
    align-items: center;
    gap: 6px;

    padding: 7px 12px;

    border: 1px solid rgba(18, 146, 242, 0.2);
    border-radius: 999px;

    background: #f7fbff;
    color: #0878bd;

    font-size: 12px;
    font-weight: 900;
    text-decoration: none;
}

.home-resource-links a:hover,
.home-resource-links a:focus-visible {
    border-color: rgba(18, 146, 242, 0.55);
    background: #eef8ff;
}

.site-content h2,
.site-content h3 {
    line-height: 1.18;
}

.site-content h2 {
    font-size: clamp(28px, 4vw, 44px);
    letter-spacing: -0.8px;
}

.site-content h3 {
    font-size: 20px;
}

.site-content p,
.site-content li {
    color: #475569;
    font-size: 16px;
    line-height: 1.75;
}

.site-content-intro {
    max-width: 850px;
    margin: 0 auto;
    text-align: center;
}

.site-content-intro p:not(.content-eyebrow) {
    margin-top: 18px;
}

.content-eyebrow {
    margin-bottom: 10px;

    color: #0878bd !important;

    font-size: 13px !important;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.content-feature-grid,
.content-two-column,
.content-link-grid {
    display: grid;
    gap: 18px;
}

.content-feature-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 42px;
}

.content-feature-card {
    padding: 24px;

    border: 1px solid #dbeafe;
    border-radius: 22px;

    background: #f7fbff;
}

.content-feature-card h3 {
    margin: 12px 0 8px;
}

.content-feature-icon {
    display: grid;
    place-items: center;

    width: 46px;
    height: 46px;

    border-radius: 14px;

    background: #e2f3ff;

    font-size: 24px;
}

.content-guide,
.content-links-panel {
    margin-top: 42px;
    padding: clamp(24px, 4vw, 38px);

    border-radius: 26px;

    background:
        linear-gradient(135deg, #eef8ff, #fffbea);
}

.content-steps {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px 30px;

    margin: 28px 0 0;
    padding-left: 24px;
}

.content-steps strong {
    display: block;
    margin-bottom: 4px;

    color: #172033;
}

.content-two-column {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 42px;
}

.content-two-column article {
    padding: 26px;

    border-top: 4px solid var(--gr-color-yellow);
    border-radius: 18px;

    background: #ffffff;
    box-shadow: var(--gr-shadow-soft);
}

.content-two-column h2 {
    margin-bottom: 10px;

    font-size: 27px;
}

.content-link-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 24px;
}

.content-link-grid a {
    display: flex;
    flex-direction: column;
    gap: 5px;

    padding: 18px;

    border: 1px solid rgba(18, 146, 242, 0.16);
    border-radius: 16px;

    background: rgba(255, 255, 255, 0.86);
    color: #0878bd;

    text-decoration: none;
}

.content-link-grid a:hover {
    border-color: rgba(18, 146, 242, 0.48);
    transform: translateY(-1px);
}

.content-link-grid strong {
    font-size: 17px;
}

.content-link-grid span {
    color: #64748b;
    font-size: 14px;
    line-height: 1.5;
}

/* Production layout while side ads are inactive. */
.page-layout {
    grid-template-columns: minmax(0, 1fr);
    width: min(var(--gr-content-width), 95%);
}

.side-ad.is-inactive {
    display: none;
}

.page-layout .game-card {
    width: 100%;
    max-width: var(--gr-content-width);
}

/* =========================================================
   Wide and medium screens
   ========================================================= */

@media (max-width: 1280px) {
    .page-layout {
        grid-template-columns: minmax(0, 1fr);
        width: 95%;
    }

    .side-ad {
        display: none;
    }
}

/* =========================================================
   Tablet
   ========================================================= */

@media (max-width: 768px) {
    header {
        padding: 26px 14px 10px;
    }

    header::before {
        padding: 7px 12px;

        font-size: 12px;
    }

    header::after {
        top: 46px;

        width: 82vw;
        height: 100px;
    }

    .logo {
        font-size: clamp(48px, 15vw, 68px);
        letter-spacing: -1px;
    }

    .tagline {
        margin-top: 10px;

        font-size: clamp(15px, 4.5vw, 18px);
    }

    .tagline::after {
        margin-top: 8px;

        font-size: 12px;
    }

    .page-layout {
        width: 100%;
        margin-top: 0;
        padding: 0 10px;
    }

    .game-card {
        width: 100%;
        margin: 10px auto 24px;
        padding: 26px 18px 22px;

        border-radius: 24px;
    }

    .game-card:hover {
        transform: none;
    }

    .game-badge {
        margin-bottom: 20px;
        padding: 13px 22px;

        border-radius: 20px;
    }

    footer {
        width: 100%;
        padding: 26px 18px 32px;
    }

    .site-nav {
        margin-top: 14px;
    }

    .site-content {
        width: calc(100% - 20px);
        padding: 26px 18px;
        border-radius: 24px;
    }

    .how-it-works {
        width: calc(100% - 20px);
        padding: 22px 16px;
        border-radius: 22px;
    }

    .how-it-works-steps {
        grid-template-columns: minmax(0, 1fr);
    }

    .how-it-works-steps li {
        min-height: 82px;
    }

    .home-resource-links a {
        flex: 1 1 135px;
        justify-content: center;
    }

    .content-feature-grid,
    .content-steps,
    .content-two-column,
    .content-link-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* =========================================================
   Small mobile screens
   ========================================================= */

@media (max-width: 420px) {
    header {
        padding-right: 10px;
        padding-left: 10px;
    }

    header::before {
        max-width: 100%;

        white-space: normal;
    }

    .page-layout {
        padding-right: 7px;
        padding-left: 7px;
    }

    .game-card {
        padding: 22px 13px 18px;

        border-radius: 20px;
    }

    .game-badge {
        width: 100%;
        padding: 12px 14px;

        font-size: 21px;
    }
}

/* =========================================================
   High contrast
   ========================================================= */

@media (prefers-contrast: more) {
    .game-card,
    .game-badge,
    .side-ad {
        border-width: 2px;
    }

    header::before {
        border-width: 2px;
    }
}

/* =========================================================
   Reduced motion
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    .game-card,
    .skip-link {
        transition: none;
    }

    .game-card:hover {
        transform: none;
    }
}

/* =========================================================
   Print
   ========================================================= */

@media print {
    body {
        background: #ffffff;
        color: #000000;
    }

    .background-map,
    header::before,
    header::after,
    .side-ad,
    .ad-banner {
        display: none !important;
    }

    header {
        padding: 0 0 20px;
    }

    .geo,
    .rankle,
    .tagline,
    footer,
    footer a {
        color: #000000;
        text-shadow: none;
    }

    .page-layout {
        display: block;

        width: 100%;
        margin: 0;
    }

    .game-card {
        max-width: none;
        margin: 0;
        padding: 20px;

        border: 1px solid #cccccc;

        background: #ffffff;
        box-shadow: none;
    }
}
