* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #eef1f7;
    color: #333;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 0 2rem;
    overflow-x: hidden;
}

/* Top bar */
.top-bar {
    width: 100%;
    max-width: 800px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
}
.back-link { color: #555; text-decoration: none; }
.back-link:hover { color: #3b82f6; }
.user-info { display: flex; align-items: center; gap: 0.5rem; }
.user-name { font-weight: 600; color: #475569; }
.logout-link { color: #94a3b8; text-decoration: none; font-size: 0.85rem; }
.logout-link:hover { color: #ef4444; }

/* Auth pages */
.back { align-self: flex-start; padding: 1rem; font-size: 0.9rem; }
.back a { color: #555; text-decoration: none; }
.back a:hover { color: #3b82f6; }

.screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}
.hidden { display: none !important; }

/* Buttons */
.btn {
    border: none;
    border-radius: 10px;
    padding: 0.75rem 2rem;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: #3b82f6; color: #fff; }
.btn-primary:hover { background: #2563eb; }
.btn-secondary { background: #e2e8f0; color: #334155; }
.btn-secondary:hover { background: #cbd5e1; }
.btn-sm { font-size: 0.85rem; padding: 0.5rem 1.25rem; }
.btn-lg { font-size: 1.15rem; padding: 0.9rem 3rem; }
.btn-full { width: 100%; }

.input {
    flex: 1;
    border: 2px solid #dde3ed;
    border-radius: 10px;
    padding: 0.7rem 1rem;
    font-size: 1.05rem;
    outline: none;
    transition: border-color 0.15s;
    font-family: inherit;
    width: 100%;
}
.input:focus { border-color: #3b82f6; }

/* ─── Start screen ─── */
#screen-start { padding: 0 1rem; max-width: 480px; }
#screen-start h1 {
    font-size: 2rem;
    margin-bottom: 0.75rem;
    color: #1e293b;
    text-align: center;
}
.intro {
    color: #64748b;
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    text-align: center;
    line-height: 1.5;
}
.stats-summary {
    background: #fff;
    border-radius: 10px;
    padding: 0.75rem 1.25rem;
    font-size: 0.95rem;
    color: #475569;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    text-align: center;
}
.start-buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1rem;
}

/* ─── Game screen ─── */
#screen-game {
    width: 100%;
    max-width: 100%;
}

/* Prompt bar */
.prompt-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: #1e293b;
    color: #fff;
    padding: 0.7rem 1rem;
    font-size: 1.1rem;
    width: 100%;
}
.prompt-flag { font-size: 1.5rem; }
.prompt-text { font-size: 1.1rem; }
.prompt-text strong { font-size: 1.2rem; letter-spacing: 0.03em; }

.attempt-dots {
    display: flex;
    gap: 0.3rem;
    margin-left: 0.75rem;
}
.attempt-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.5);
    background: transparent;
    transition: background 0.2s, border-color 0.2s;
}
.attempt-dot.used {
    background: #ef4444;
    border-color: #ef4444;
}

/* Map */
.map-wrapper {
    position: relative;
    width: 100%;
    flex: 1;
}
.map-container {
    width: 100%;
    height: calc(100vh - 170px);
    min-height: 300px;
    background: #c8daf0;
    overflow: hidden;
    cursor: grab;
    touch-action: none;
    position: relative;
}
.map-container:active { cursor: grabbing; }

#map-svg {
    width: 100%;
    height: 100%;
}

/* Country paths */
.country-path {
    stroke: #fff;
    stroke-width: 0.5;
    cursor: pointer;
    transition: fill 0.15s;
}
.country-eu { fill: #93c5fd; }
.country-eu:hover { fill: #60a5fa; }
.country-non-eu { fill: #d1d5db; stroke: #b0b5bb; cursor: default; }

.country-found { fill: #86efac !important; cursor: default; opacity: 0.7; }
.country-correct {
    fill: #22c55e !important;
    cursor: default;
    animation: correctPulse 0.5s ease;
}
.country-wrong {
    fill: #ef4444 !important;
    animation: wrongFlash 0.4s ease;
}
.country-revealed {
    fill: #f59e0b !important;
    cursor: default;
    animation: revealPulse 1s ease;
}
.country-current { stroke: #1e40af; stroke-width: 1.5; }

/* Hit circles for small countries */
.hit-circle {
    fill: transparent;
    cursor: pointer;
    stroke: none;
}

@keyframes correctPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.03); }
    100% { transform: scale(1); }
}
@keyframes wrongFlash {
    0% { fill: #ef4444; }
    50% { fill: #fca5a5; }
    100% { fill: #93c5fd; }
}
@keyframes revealPulse {
    0% { opacity: 0.5; }
    30% { opacity: 1; }
    60% { opacity: 0.6; }
    100% { opacity: 1; }
}

/* Zoom controls */
.zoom-controls {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    z-index: 10;
}
.btn-zoom {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 8px;
    background: #fff;
    color: #333;
    font-size: 1.3rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.btn-zoom:hover { background: #f1f5f9; }
.btn-zoom:active { background: #e2e8f0; }

/* Game status */
.game-status {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    color: #64748b;
    font-weight: 500;
    width: 100%;
    max-width: 800px;
}

/* ─── Results screen ─── */
#screen-results { padding: 0 1rem; max-width: 480px; }
#screen-results h1 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    color: #1e293b;
    text-align: center;
}
.results-score {
    font-size: 3rem;
    font-weight: 800;
    color: #3b82f6;
    margin: 0.75rem 0 1.5rem;
}
.results-list {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 1.5rem;
}
.result-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    padding: 0.4rem 0.75rem;
    border-radius: 8px;
    background: #f8fafc;
}
.result-row.ok { background: #f0fdf4; }
.result-row.fail { background: #fef2f2; }
.result-icon { font-size: 1.1rem; flex-shrink: 0; width: 1.5rem; text-align: center; }
.result-flag { font-size: 1.2rem; flex-shrink: 0; }
.result-country { font-weight: 600; flex: 1; }
.result-attempts { color: #64748b; font-size: 0.85rem; text-align: right; white-space: nowrap; }

/* ─── Progress screen ─── */
#screen-progress { padding: 0 1rem; max-width: 480px; }
#screen-progress h2 {
    font-size: 1.5rem;
    color: #1e293b;
    margin-bottom: 1rem;
}
.progress-overview {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}
.overview-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #fff;
    border-radius: 12px;
    padding: 0.75rem 1.25rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    min-width: 90px;
}
.overview-num { font-size: 1.5rem; font-weight: 800; color: #3b82f6; }
.overview-label { font-size: 0.8rem; color: #64748b; margin-top: 0.15rem; }

.progress-list {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 1.5rem;
}
.progress-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    padding: 0.45rem 0.75rem;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.prog-flag { font-size: 1.1rem; flex-shrink: 0; }
.prog-country { font-weight: 600; min-width: 85px; white-space: nowrap; }
.pbar { flex: 1; height: 8px; background: #e2e8f0; border-radius: 4px; overflow: hidden; min-width: 40px; }
.pbar-fill { height: 100%; border-radius: 4px; background: #ef4444; transition: width 0.3s ease; }
.pbar-fill.pbar-good { background: #22c55e; }
.pbar-fill.pbar-mid { background: #f59e0b; }
.pbar-fill.pbar-low { background: #ef4444; }
.prog-stats { font-size: 0.8rem; color: #94a3b8; min-width: 70px; text-align: right; white-space: nowrap; }

/* ─── Auth pages ─── */
.auth-box {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    padding: 2rem 1.75rem;
    width: 100%;
    max-width: 380px;
    margin-top: 2rem;
}
.auth-box h1 { font-size: 1.5rem; color: #1e293b; margin-bottom: 0.4rem; text-align: center; }
.auth-subtitle { color: #64748b; font-size: 0.95rem; text-align: center; margin-bottom: 1.5rem; }
.auth-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 0.6rem 0.9rem;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    text-align: center;
}
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 600; color: #475569; margin-bottom: 0.3rem; }

/* ─── Modal ─── */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 1rem;
}
.modal-box {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    padding: 1.75rem;
    width: 100%;
    max-width: 340px;
}
.modal-box h2 { font-size: 1.2rem; color: #1e293b; margin-bottom: 1rem; }
.modal-buttons { display: flex; gap: 0.75rem; margin-top: 0.5rem; }
.modal-buttons .btn { flex: 1; }

/* ─── Country labels on map ─── */
.country-label {
    font-size: 6px;
    fill: #475569;
    text-anchor: middle;
    pointer-events: none;
    font-weight: 600;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ─── Responsive ─── */
@media (max-width: 500px) {
    .prompt-bar { font-size: 0.95rem; padding: 0.6rem 0.75rem; }
    .prompt-flag { font-size: 1.3rem; }
    .prompt-text strong { font-size: 1.05rem; }
    .map-container { height: calc(100vh - 155px); }
    .progress-row { flex-wrap: wrap; }
    .pbar { order: 5; width: 100%; flex: none; }
    .prog-stats { order: 4; margin-left: auto; }
}
