:root {
    --bg-dark: #0b1420;
    --card-color: #142238;
    --card-border: #223350;
    --accent: #3ddc97;
    --accent-hover: #2fc282;
    --text-main: #e8edf4;
    --text-dim: #8fa0b8;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Segoe UI", Helvetica, Arial, sans-serif;
    color: var(--text-main);
    background: var(--bg-dark);
    min-height: 100vh;
}

.topbar {
    background: var(--card-color);
    border-bottom: 1px solid var(--card-border);
    padding: 14px 20px;
    display: flex;
    align-items: baseline;
    gap: 14px;
    flex-wrap: wrap;
}

.brand {
    font-size: 20px;
    font-weight: 700;
    color: var(--accent);
    text-decoration: none;
}

.tagline {
    color: var(--text-dim);
    font-size: 13px;
}

.page {
    max-width: 1000px;
    margin: 0 auto;
    padding: 24px 16px 60px;
}

.intro {
    color: var(--text-dim);
    font-size: 15px;
    max-width: 700px;
}

h1 {
    margin: 8px 0 4px;
    font-size: 28px;
}

.back-link {
    color: var(--text-dim);
    text-decoration: none;
    font-size: 14px;
}

.back-link:hover { color: var(--accent); }

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.tile {
    background: var(--card-color);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    padding: 20px;
    text-decoration: none;
    color: var(--text-main);
    transition: border-color 0.15s, transform 0.15s;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tile:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.tile-more {
    opacity: 0.6;
}

.tile-icon { font-size: 32px; }
.tile-name { font-size: 18px; font-weight: 700; }
.tile-count { color: var(--accent); font-size: 13px; font-weight: 600; }
.tile-blurb { color: var(--text-dim); font-size: 13px; margin-top: 4px; }

.mode-tabs {
    display: flex;
    gap: 8px;
    margin: 20px 0;
}

.mode-tab {
    background: var(--card-color);
    border: 1px solid var(--card-border);
    color: var(--text-dim);
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
}

.mode-tab.active {
    color: var(--bg-dark);
    background: var(--accent);
    border-color: var(--accent);
    font-weight: 600;
}

.entry {
    display: flex;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid var(--card-border);
}

.entry:last-child { border-bottom: none; }

.entry-flag { font-size: 28px; line-height: 1; flex-shrink: 0; }
.entry-image { width: 56px; height: 56px; object-fit: contain; flex-shrink: 0; border-radius: 6px; background: #0b1420; }
.entry-country { font-weight: 700; margin-bottom: 4px; }
.entry-text { color: var(--text-dim); font-size: 14.5px; line-height: 1.5; }

.quiz-card {
    background: var(--card-color);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    padding: 32px;
    text-align: center;
    max-width: 560px;
    margin: 20px auto 0;
}

.quiz-flag { font-size: 48px; margin-bottom: 16px; }
.quiz-image { max-width: 100%; max-height: 240px; margin-bottom: 16px; border-radius: 8px; }
.quiz-text { font-size: 16px; line-height: 1.6; min-height: 4.8em; }
.quiz-answer { font-size: 20px; font-weight: 700; color: var(--accent); margin: 12px 0; }

.quiz-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 16px;
    flex-wrap: wrap;
}

.btn {
    background: var(--accent);
    color: var(--bg-dark);
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
}

.btn:hover { background: var(--accent-hover); }

.btn.secondary {
    background: transparent;
    color: var(--text-main);
    border: 1px solid var(--card-border);
}

.btn.secondary:hover { border-color: var(--accent); }

img.zoomable { cursor: zoom-in; }

.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(5, 9, 16, 0.9);
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 24px;
    cursor: zoom-out;
}

/* [hidden]'s default `display: none` from the browser gets beaten by any author rule that
   also sets `display` on the same element -- scoping `display: flex` to :not([hidden]) keeps
   the overlay truly invisible (and non-blocking) until JS actually opens it. */
.lightbox:not([hidden]) {
    display: flex;
}

.lightbox img {
    max-width: min(90vw, 800px);
    max-height: 90vh;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    cursor: default;
}

@media (max-width: 480px) {
    .grid { grid-template-columns: 1fr 1fr; }
    .quiz-card { padding: 20px; }
}
