:root {
    --bg: #0f172a;
    --panel: #1e293b;
    --text: #f1f5f9;
    --muted: #cbd5e1;
    --line: #334155;
    --accent: #60a5fa;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
}

.page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

.header {
    margin-bottom: 1rem;
}

.back-link {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

.layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 1rem;
}

h1,
h2 {
    margin: 0 0 0.75rem;
}

p {
    margin: 0.25rem 0 0.75rem;
    color: var(--muted);
}

.daily-status {
    font-size: 0.92rem;
}

.hint {
    font-size: 0.92rem;
}

.error {
    color: #fca5a5;
}

.success {
    color: #86efac;
}

form {
    display: grid;
    gap: 0.5rem;
}

input,
button {
    font: inherit;
    padding: 0.65rem 0.75rem;
    border-radius: 6px;
    border: 1px solid var(--line);
}

input {
    background: #0b1220;
    color: var(--text);
}

button {
    background: var(--accent);
    color: #0b1220;
    font-weight: 700;
    border: none;
    cursor: pointer;
}

.btn-secondary {
    background: var(--bg-tertiary, #334155);
    color: var(--text);
    border: 1px solid var(--line);
    font-weight: 600;
}

.btn-secondary:hover {
    background: var(--border-light, #475569);
}

.actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.actions button {
    flex: 1;
    padding: 0.5rem;
    font-size: 0.85rem;
}

.map-container {
    width: 100%;
    height: auto;
    min-height: 400px;
    background: #0b1220;
    border: 1px solid var(--line);
    border-radius: 6px;
}

.municipality {
    fill: var(--bg-tertiary, #334155);
    stroke: var(--line);
    stroke-width: 0.5;
    transition: fill 0.3s ease;
}

.municipality:hover {
    fill: var(--border-light, #475569);
}

.municipality.guessed {
    stroke-width: 1;
}

.municipality.correct {
    fill: #22c55e;
    stroke: #16a34a;
}

.municipality.very-close {
    fill: #84cc16;
}

.municipality.close {
    fill: #eab308;
}

.municipality.far {
    fill: #f97316;
}

.municipality.very-far {
    fill: #ef4444;
}

.legend {
    margin-top: 1rem;
    padding: 0.75rem;
    background: var(--bg-tertiary, #334155);
    border-radius: 6px;
    border: 1px solid var(--line);
}

.legend-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text);
}

.legend-items {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.legend-color {
    width: 24px;
    height: 16px;
    border-radius: 3px;
    border: 1px solid var(--line);
}

.legend-color.correct {
    background: #22c55e;
}

.legend-color.very-close {
    background: #84cc16;
}

.legend-color.close {
    background: #eab308;
}

.legend-color.far {
    background: #f97316;
}

.legend-color.very-far {
    background: #ef4444;
}

.legend-label {
    font-size: 0.85rem;
    color: var(--muted);
}

.guess-list {
    margin: 0;
    padding-left: 1.25rem;
}

@media (min-width: 980px) {
    .layout {
        grid-template-columns: 340px 1fr;
        grid-template-areas:
            'guess map'
            'list map';
    }

    .layout .panel:nth-child(1) {
        grid-area: guess;
    }

    .layout .panel:nth-child(2) {
        grid-area: map;
    }

    .layout .panel:nth-child(3) {
        grid-area: list;
    }
}

@media (max-width: 979px) {
    .legend-items {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.6rem;
    }

    .legend-item {
        flex: 1 1 45%;
        font-size: 0.8rem;
    }

    .map-container {
        min-height: 300px;
    }

    .actions button {
        font-size: 0.8rem;
        padding: 0.5rem 0.4rem;
    }
}