* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    background: linear-gradient(180deg, #eef3fb 0%, #f8fafc 100%);
    color: #1e293b;
    min-height: 100vh;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px 20px 40px;
}

header {
    text-align: center;
    margin-bottom: 20px;
}

h1 {
    margin: 0 0 8px;
    font-size: 2rem;
    font-weight: 700;
}

.subtitle {
    margin: 0;
    color: #64748b;
}

.controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

#country-select {
    padding: 12px 14px;
    border: 2px solid #cbd5e1;
    border-radius: 10px;
    font-size: 1rem;
    background: #fff;
    color: #1e293b;
    cursor: pointer;
    min-width: 170px;
}

#country-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

#country-select:disabled {
    background: #f1f5f9;
    cursor: not-allowed;
}

#state-input {
    width: min(320px, 100%);
    padding: 12px 14px;
    border: 2px solid #cbd5e1;
    border-radius: 10px;
    font-size: 1rem;
    background: #fff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

#state-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

#state-input:disabled {
    background: #f1f5f9;
    cursor: not-allowed;
}

.timer {
    min-width: 72px;
    padding: 12px 16px;
    border-radius: 10px;
    background: #0f172a;
    color: #f8fafc;
    font-size: 1.1rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    text-align: center;
}

.timer.warning {
    background: #b45309;
}

.timer.critical {
    background: #b91c1c;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.04); }
}

#start-btn,
#restart-btn,
#close-btn {
    padding: 12px 18px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}

#start-btn,
#close-btn {
    background: #2563eb;
    color: #fff;
}

#restart-btn {
    background: #fff;
    color: #2563eb;
    border: 2px solid #2563eb;
}

#start-btn:hover,
#close-btn:hover {
    background: #1d4ed8;
}

#restart-btn:hover {
    background: #eff6ff;
}

#start-btn:active,
#restart-btn:active,
#close-btn:active {
    transform: translateY(1px);
}

.hidden {
    display: none;
}

.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    min-height: 24px;
    font-size: 0.95rem;
}

#score {
    font-weight: 600;
}

.feedback {
    color: #64748b;
}

.feedback.success {
    color: #15803d;
    font-weight: 600;
}

.feedback.error {
    color: #b91c1c;
    font-weight: 600;
}

.map-wrapper {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
    padding: 16px;
}

#map {
    display: block;
    width: 100%;
    height: auto;
    user-select: none;
}

.state {
    fill: #f8fafc;
    stroke: #475569;
    stroke-width: 0.8;
    cursor: pointer;
    transition: fill 0.2s ease;
}

.state:not(.guessed):not(.wrong):hover {
    fill: #e2e8f0;
}

.state.guessed {
    fill: #22c55e;
    stroke: #15803d;
    cursor: default;
}

.state.wrong {
    fill: #ef4444;
    stroke: #b91c1c;
    cursor: default;
}

.state.disabled {
    cursor: not-allowed;
}

.state-label {
    font-size: 9px;
    font-weight: 700;
    pointer-events: none;
    text-anchor: middle;
    dominant-baseline: middle;
}

.state-label.correct {
    fill: #14532d;
}

.state-label.incorrect {
    fill: #fff;
}

.overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 10;
}

.overlay.hidden {
    display: none;
}

.overlay-card {
    background: #fff;
    border-radius: 16px;
    padding: 28px 32px;
    max-width: 420px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.2);
}

.overlay-card h2 {
    margin: 0 0 12px;
}

.overlay-percent {
    margin: 0 0 8px;
    font-size: 3rem;
    font-weight: 800;
    color: #2563eb;
    line-height: 1;
}

.overlay-percent.perfect {
    color: #15803d;
}

.overlay-time {
    margin: 0 0 12px;
    font-size: 1.1rem;
    font-weight: 600;
    color: #64748b;
}

.overlay-card p {
    margin: 0 0 20px;
    color: #475569;
    line-height: 1.5;
}

#confetti-canvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 20;
}
