* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    margin: 0;
    background-color: #0f172a;
    color: #f1f5f9;
    font-family: ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
    -webkit-font-smoothing: antialiased;
}

.page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #334155;
}

header h1 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

header p {
    margin: 0.25rem 0 0;
    font-size: 0.875rem;
    color: #94a3b8;
}

.layout {
    flex: 1;
    display: flex;
    flex-direction: column;
}

aside {
    flex-shrink: 0;
    border-bottom: 1px solid #334155;
    padding: 1rem;
}

main {
    flex: 1;
    position: relative;
    padding: 1rem;
}

@media (min-width: 768px) {
    .layout {
        flex-direction: row;
    }

    aside {
        width: 18rem;
        border-bottom: none;
        border-right: 1px solid #334155;
    }
}

details {
    margin-bottom: 1rem;
    border: 1px solid #334155;
    border-radius: 0.375rem;
}

summary {
    cursor: pointer;
    user-select: none;
    padding: 0.375rem 0.5rem;
    font-size: 0.875rem;
    color: #cbd5e1;
}

.customize-body {
    padding: 0.25rem 0.5rem 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

#country-input {
    width: 100%;
    font-size: 0.875rem;
    border-radius: 0.375rem;
    background-color: #1e293b;
    border: 1px solid #475569;
    padding: 0.5rem;
    color: #f1f5f9;
    font-family: inherit;
    resize: vertical;
}

#country-input::placeholder {
    color: #64748b;
}

#input-error {
    font-size: 0.75rem;
    color: #f87171;
    margin: 0;
    min-height: 1em;
}

button {
    font: inherit;
    border: none;
    border-radius: 0.375rem;
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #fff;
    cursor: pointer;
}

#start-btn {
    width: 100%;
    background-color: #059669;
}

#start-btn:hover {
    background-color: #10b981;
}

.controls-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.controls-row button {
    flex: 1;
    background-color: #334155;
}

.controls-row button:hover {
    background-color: #475569;
}

.score-row {
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.score-row .label {
    font-size: 0.875rem;
    color: #94a3b8;
}

.score-row .value {
    font-size: 0.875rem;
    font-weight: 500;
}

#country-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

#map-wrapper {
    width: 100%;
    height: 100%;
    min-height: 400px;
}

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

#map .country {
    fill: #334155;
    stroke: #1e293b;
    stroke-width: 0.5;
    cursor: pointer;
    transition: fill 0.15s ease;
}

#map .country:hover {
    fill: #475569;
}

#map .country.found {
    fill: #16a34a;
    cursor: default;
}

#map .country.found:hover {
    fill: #16a34a;
}

#map .country.wrong {
    fill: #dc2626;
    cursor: default;
}

#map .country.wrong:hover {
    fill: #dc2626;
}

#map .country.flash-already {
    fill: #d97706;
}

.country-item {
    color: #cbd5e1;
    background-color: rgba(148, 163, 184, 0.08);
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
}

.country-item.found {
    color: #64748b;
    text-decoration: line-through;
    background-color: transparent;
}

.country-item.pulse {
    animation: pulse-found 0.6s ease;
}

@keyframes pulse-found {
    0% { background-color: rgba(34, 197, 94, 0.35); }
    100% { background-color: transparent; }
}

.feedback {
    position: absolute;
    top: 1rem;
    left: 50%;
    transform: translate(-50%, -12px);
    z-index: 10;
    padding: 0.6rem 1.25rem;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: #f8fafc;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.feedback.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

.feedback.correct {
    background-color: #16a34a;
}

.feedback.wrong {
    background-color: #dc2626;
}

.feedback.already {
    background-color: #d97706;
}
