:root {
    --color-bg: #0f172a;
    --color-surface: #ffffff;
    --color-surface-muted: #f1f5f9;
    --color-text: #0f172a;
    --color-text-muted: #475569;
    --color-primary: #2563eb;
    --color-primary-hover: #1d4ed8;
    --color-border: #e2e8f0;
    --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.12);
    --radius-md: 12px;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Pretendard', 'Apple SD Gothic Neo', sans-serif;
    color: var(--color-text);
    background: var(--color-surface-muted);
    height: 100%;
}

.app-header {
    position: relative;
    padding: 18px 28px 18px;
    background:
        radial-gradient(circle at 8% -20%, rgba(37, 99, 235, 0.16), transparent 55%),
        radial-gradient(circle at 95% 120%, rgba(168, 85, 247, 0.12), transparent 50%),
        linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border-bottom: 1px solid var(--color-border);
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04), 0 6px 18px rgba(15, 23, 42, 0.05);
    overflow: hidden;
}

.app-header::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(37, 99, 235, 0.55), rgba(168, 85, 247, 0.45), transparent);
    pointer-events: none;
}

.app-header-main {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.app-header-text { min-width: 0; flex: 1; }

.app-header-titlebar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.app-header h1 {
    margin: 0;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--color-text);
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.app-header h1::before {
    content: "📍";
    font-size: 22px;
    filter: drop-shadow(0 2px 6px rgba(37, 99, 235, 0.35));
}

.app-live-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px 4px 10px;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    border-radius: 999px;
    letter-spacing: 0.08em;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.35);
}

.app-live-badge__dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.7);
    animation: app-live-pulse 1.4s ease-in-out infinite;
}

@keyframes app-live-pulse {
    0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.7); }
    50% { opacity: 0.55; transform: scale(0.8); box-shadow: 0 0 0 6px rgba(255, 255, 255, 0); }
}

.app-header .subtitle {
    margin: 0;
    font-size: 13.5px;
    color: var(--color-text-muted);
    line-height: 1.55;
    max-width: 760px;
}

.view-toggle {
    display: inline-flex;
    padding: 5px;
    background: rgba(241, 245, 249, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 999px;
    border: 1px solid rgba(226, 232, 240, 0.9);
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.04);
    flex-shrink: 0;
}

.view-toggle-btn {
    appearance: none;
    border: none;
    background: transparent;
    padding: 8px 16px;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--color-text-muted);
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, transform 0.1s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    line-height: 1;
}

.view-toggle-icon {
    font-size: 13px;
    line-height: 1;
}

.view-toggle-btn:hover { color: var(--color-text); }

.view-toggle-btn.is-active {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.view-toggle-btn.is-active:hover { color: #fff; }

.app-main {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 12px;
}

@media (min-width: 900px) {
    .app-main {
        grid-template-columns: 1.6fr 1fr;
        height: calc(100vh - 260px);
    }
}

.map-wrap {
    position: relative;
    background: var(--color-surface);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    min-height: 420px;
    height: 100%;
}

.map-canvas {
    width: 100%;
    height: 100%;
    min-height: 420px;
}

.map-floating-controls {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 16px;
    display: flex;
    justify-content: center;
    gap: 8px;
    z-index: 10;
}

.map-top-external {
    position: absolute;
    top: 14px;
    right: 14px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    z-index: 25;
}

.map-top-external .btn {
    padding: 8px 14px;
    font-size: 13px;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.12);
}

.area-select-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    padding: 0 14px 0 16px;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.12);
    cursor: pointer;
    min-height: 38px;
    min-width: 180px;
    max-width: 240px;
}

.area-select-wrap:focus-within {
    border-color: rgba(37, 99, 235, 0.55);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.14),
                0 6px 16px rgba(15, 23, 42, 0.12);
}

.area-select {
    appearance: none;
    -webkit-appearance: none;
    border: none;
    outline: none;
    background: transparent;
    color: var(--color-text);
    font-size: 13px;
    font-weight: 600;
    padding: 8px 2px 8px 0;
    line-height: 1;
    cursor: pointer;
    flex: 1;
    min-width: 0;
    text-overflow: ellipsis;
}

.area-select-icon {
    font-size: 11px;
    color: var(--color-text-muted);
    flex-shrink: 0;
    order: 2;
}

.center-crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 28px;
    font-weight: 900;
    color: var(--color-primary);
    text-shadow: 0 0 4px #fff, 0 0 6px #fff;
    pointer-events: none;
    z-index: 5;
}

.btn {
    appearance: none;
    border: none;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 999px;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: transform 0.1s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    line-height: 1;
}

.btn-external::after {
    content: "↗";
    font-size: 12px;
    opacity: 0.7;
}

.btn:active {
    transform: translateY(1px);
}

.btn-primary {
    background: var(--color-primary);
    color: #fff;
}

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

.btn-accent {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.38);
    position: relative;
    padding-left: 32px;
}

.btn-accent::before {
    content: "";
    position: absolute;
    left: 14px;
    top: 50%;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #fff;
    transform: translateY(-50%);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.45);
    animation: btn-accent-pulse 1.6s ease-in-out infinite;
}

.btn-accent:hover {
    background: linear-gradient(135deg, #059669, #047857);
}

@keyframes btn-accent-pulse {
    0%, 100% { box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.45); }
    50% { box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.15); }
}

.btn-ghost {
    background: #fff;
    color: var(--color-text);
    border: 1px solid var(--color-border);
}

.info-panel {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    padding: 16px;
    box-shadow: var(--shadow-md);
    overflow-y: auto;
    min-height: 200px;
}

.panel-state {
    color: var(--color-text-muted);
    font-size: 14px;
    line-height: 1.5;
    padding: 12px 4px;
}

.panel-state--error {
    color: #b91c1c;
}

.hidden {
    display: none !important;
}

.panel-result .result-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.result-area-name {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
}

.result-area-meta {
    font-size: 12px;
    color: var(--color-text-muted);
    margin: 4px 0 0;
}

.congest-hero {
    --congest-color: #94a3b8;
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    margin: 6px 0 14px;
    border-radius: 16px;
    color: #fff;
    background:
            linear-gradient(135deg,
                color-mix(in srgb, var(--congest-color) 92%, #000) 0%,
                var(--congest-color) 55%,
                color-mix(in srgb, var(--congest-color) 78%, #000) 100%);
    box-shadow:
            0 10px 24px -12px color-mix(in srgb, var(--congest-color) 65%, transparent),
            inset 0 1px 0 rgba(255, 255, 255, 0.18);
    overflow: hidden;
}

.congest-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
            radial-gradient(circle at 0% 0%, rgba(255, 255, 255, 0.22), transparent 55%),
            radial-gradient(circle at 100% 100%, rgba(0, 0, 0, 0.18), transparent 60%);
    pointer-events: none;
}

.congest-hero__indicator {
    position: relative;
    display: inline-flex;
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.congest-hero__dot {
    position: absolute;
    inset: 0;
    background: #fff;
    border-radius: 999px;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.28);
}

.congest-hero__pulse {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.55);
    animation: congestHeroPulse 1.8s ease-out infinite;
}

@keyframes congestHeroPulse {
    0%   { transform: scale(1);   opacity: 0.7; }
    80%  { transform: scale(2.6); opacity: 0; }
    100% { transform: scale(2.6); opacity: 0; }
}

.congest-hero__body {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.congest-hero__label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.88);
}

.congest-hero__level {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.01em;
    line-height: 1.1;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}

@media (prefers-reduced-motion: reduce) {
    .congest-hero__pulse { animation: none; }
}

.result-congest-message {
    font-size: 14px;
    line-height: 1.55;
    color: var(--color-text);
    margin: 0 0 16px;
    padding: 12px 14px;
    background: var(--color-surface-muted);
    border-radius: 10px;
    border-left: 4px solid var(--color-border);
}

.result-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin: 0;
}

.result-stats .stat {
    background: var(--color-surface-muted);
    border-radius: 8px;
    padding: 10px 12px;
}

.result-stats dt {
    font-size: 11px;
    color: var(--color-text-muted);
    margin-bottom: 4px;
}

.result-stats dd {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
}

/* ========= Result flags / section / age bars / forecast list ========= */
.result-title-block { min-width: 0; flex: 1; }

.result-flags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.flag-badge {
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 999px;
    letter-spacing: 0.02em;
    background: var(--color-surface-muted);
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
}

.flag-badge--replace { color: #b91c1c; border-color: #fecaca; background: #fef2f2; }
.flag-badge--fcst { color: #1d4ed8; border-color: #bfdbfe; background: #eff6ff; }

.result-section {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px dashed var(--color-border);
}

.result-section-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--color-text);
    margin: 0 0 10px;
    letter-spacing: -0.01em;
}

.age-rates {
    display: grid;
    grid-template-columns: 52px 1fr 44px;
    row-gap: 6px;
    column-gap: 10px;
    font-size: 12px;
    color: var(--color-text);
}

.age-rates__label {
    font-weight: 600;
    color: var(--color-text-muted);
    align-self: center;
}

.age-rates__bar {
    position: relative;
    height: 8px;
    background: var(--color-surface-muted);
    border-radius: 999px;
    overflow: hidden;
    align-self: center;
}

.age-rates__bar-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(90deg, #60a5fa, #2563eb);
    border-radius: 999px;
    transition: width 0.4s ease;
}

.age-rates__value {
    font-weight: 700;
    text-align: right;
    align-self: center;
    font-variant-numeric: tabular-nums;
}

.forecast-list {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(110px, 1fr);
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
}

.forecast-card {
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 10px 12px;
    background: var(--color-surface);
    min-width: 0;
}

.forecast-card__time {
    font-size: 11px;
    color: var(--color-text-muted);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.forecast-card__level {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    color: #fff;
    background: #94a3b8;
    margin-bottom: 6px;
}

.forecast-card__range {
    font-size: 12px;
    color: var(--color-text);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.forecast-card__unit {
    font-size: 10px;
    color: var(--color-text-muted);
    font-weight: 500;
    margin-left: 2px;
}

/* ========= My Location marker & bubble ========= */
.my-location-marker {
    position: relative;
    width: 24px;
    height: 24px;
    pointer-events: auto;
}

.my-location-marker__ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: rgba(37, 99, 235, 0.18);
    animation: my-location-pulse 1.8s ease-out infinite;
}

.my-location-marker__dot {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #2563eb;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.45);
}

@keyframes my-location-pulse {
    0% { transform: scale(0.6); opacity: 0.9; }
    100% { transform: scale(2.2); opacity: 0; }
}

.my-location-bubble {
    min-width: 180px;
    max-width: 260px;
    padding: 10px 12px;
    font-size: 13px;
    color: var(--color-text);
    line-height: 1.45;
}

.my-location-bubble__title {
    font-size: 11px;
    font-weight: 700;
    color: var(--color-primary);
    letter-spacing: 0.02em;
    margin-bottom: 4px;
    text-transform: uppercase;
}

.my-location-bubble__addr {
    font-size: 13px;
    font-weight: 600;
    word-break: keep-all;
}

/* ========= Site Footer (Desktop) ========= */
.site-footer {
    background:
        radial-gradient(circle at 0% 0%, rgba(37, 99, 235, 0.18), transparent 55%),
        radial-gradient(circle at 100% 100%, rgba(168, 85, 247, 0.14), transparent 55%),
        linear-gradient(180deg, #0f172a 0%, #020617 100%);
    color: #e2e8f0;
    padding: 20px 24px 22px;
    margin-top: 12px;
    border-top: 1px solid rgba(148, 163, 184, 0.18);
    position: relative;
}

.site-footer::before {
    content: "";
    position: absolute;
    top: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(37, 99, 235, 0.6), rgba(168, 85, 247, 0.5), transparent);
    pointer-events: none;
}

.site-footer__inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
}

.site-footer__nav {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 4px 14px;
    font-size: 13.5px;
    font-weight: 600;
    color: #cbd5e1;
}

.site-footer__nav a {
    color: #cbd5e1;
    text-decoration: none;
    padding: 4px 6px;
    border-radius: 6px;
    transition: color 0.15s ease, background 0.15s ease;
}

.site-footer__nav a:hover {
    color: #ffffff;
    background: rgba(148, 163, 184, 0.12);
}

.site-footer__strong {
    color: #ffffff !important;
    font-weight: 800;
}

.site-footer__sep {
    color: rgba(148, 163, 184, 0.55);
    font-weight: 400;
    user-select: none;
}

.site-footer__meta {
    margin: 2px 0 0;
    font-size: 12px;
    color: #94a3b8;
    line-height: 1.5;
}

.site-footer__copyright {
    margin: 4px 0 0;
    font-size: 11.5px;
    color: rgba(148, 163, 184, 0.7);
    letter-spacing: 0.02em;
}

@media (max-width: 640px) {
    .site-footer {
        padding: 22px 16px 24px;
    }
    .site-footer__nav {
        font-size: 13px;
        gap: 4px 10px;
    }
}

/* ========= Map Search (Desktop) ========= */
.map-search {
    position: absolute;
    top: 14px;
    left: 50%;
    transform: translateX(-50%);
    width: min(520px, calc(100% - 32px));
    z-index: 30;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.map-search-form {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 6px 6px 14px;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid var(--color-border);
    border-radius: 999px;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12), 0 2px 6px rgba(15, 23, 42, 0.06);
    backdrop-filter: saturate(140%) blur(4px);
}

.map-search-form:focus-within {
    border-color: rgba(37, 99, 235, 0.55);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.14),
                0 10px 28px rgba(15, 23, 42, 0.12);
}

.map-search-icon {
    font-size: 15px;
    line-height: 1;
    color: var(--color-text-muted);
    flex-shrink: 0;
}

.map-search-input {
    flex: 1;
    min-width: 0;
    appearance: none;
    border: none;
    outline: none;
    background: transparent;
    font-size: 14.5px;
    color: var(--color-text);
    padding: 8px 0;
}

.map-search-input::-webkit-search-cancel-button,
.map-search-input::-webkit-search-decoration {
    appearance: none;
    display: none;
}

.map-search-clear {
    appearance: none;
    border: none;
    background: transparent;
    color: var(--color-text-muted);
    font-size: 20px;
    line-height: 1;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.map-search-clear:hover {
    background: rgba(15, 23, 42, 0.06);
    color: var(--color-text);
}

.map-search-submit {
    appearance: none;
    border: none;
    background: var(--color-primary);
    color: #fff;
    font-size: 13.5px;
    font-weight: 700;
    padding: 8px 16px;
    border-radius: 999px;
    cursor: pointer;
    line-height: 1;
    transition: background 0.15s ease, transform 0.1s ease;
    flex-shrink: 0;
}

.map-search-submit:hover {
    background: var(--color-primary-hover);
}

.map-search-submit:active {
    transform: translateY(1px);
}

.map-search-submit[disabled] {
    opacity: 0.6;
    cursor: progress;
}

.map-search-suggestions {
    list-style: none;
    margin: 0;
    padding: 6px;
    background: #ffffff;
    border: 1px solid var(--color-border);
    border-radius: 14px;
    box-shadow: 0 14px 36px rgba(15, 23, 42, 0.14);
    max-height: 320px;
    overflow-y: auto;
}

.map-search-suggestion {
    padding: 9px 12px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    font-size: 14px;
}

.map-search-suggestion:hover,
.map-search-suggestion.is-active {
    background: rgba(37, 99, 235, 0.08);
    color: var(--color-primary);
}

.map-search-suggestion__name {
    font-weight: 600;
    color: var(--color-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.map-search-suggestion:hover .map-search-suggestion__name,
.map-search-suggestion.is-active .map-search-suggestion__name {
    color: var(--color-primary);
}

.map-search-suggestion__category {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--color-text-muted);
    padding: 3px 8px;
    background: var(--color-surface-muted);
    border-radius: 999px;
    flex-shrink: 0;
}

.map-search-feedback {
    background: #fff7ed;
    color: #9a3412;
    border: 1px solid #fed7aa;
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 13.5px;
    font-weight: 600;
    box-shadow: 0 6px 18px rgba(154, 52, 18, 0.12);
}

.map-search-feedback.is-info {
    background: #eff6ff;
    color: #1d4ed8;
    border-color: #bfdbfe;
    box-shadow: 0 6px 18px rgba(29, 78, 216, 0.12);
}

@media (max-width: 640px) {
    .map-search {
        top: 10px;
        width: calc(100% - 24px);
    }
    .map-search-submit {
        padding: 8px 12px;
        font-size: 13px;
    }
}

/* ========= Cultural Events Section (Desktop) ========= */
.result-events {
    margin: 0 0 14px;
    padding: 12px 12px 10px;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 1px solid #fcd34d;
    border-radius: 14px;
    box-shadow: 0 4px 12px rgba(180, 83, 9, 0.08);
}

.result-events-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.result-events-title {
    margin: 0;
    font-size: 14px;
    font-weight: 800;
    color: #78350f;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.result-events-title::before {
    content: "🎉";
    font-size: 15px;
}

.result-events-count {
    font-size: 12px;
    font-weight: 700;
    color: #92400e;
    background: rgba(255, 255, 255, 0.7);
    padding: 2px 8px;
    border-radius: 999px;
}

.result-events-state {
    font-size: 13px;
    color: #78350f;
    padding: 8px 4px;
}

.result-events-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.result-event {
    display: flex;
    gap: 10px;
    padding: 10px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
    text-decoration: none;
    color: inherit;
    transition: transform 0.1s ease, box-shadow 0.15s ease;
    border: 1px solid rgba(252, 211, 77, 0.5);
}

.result-event:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.12);
}

.result-event__thumb {
    flex-shrink: 0;
    width: 64px;
    height: 64px;
    border-radius: 8px;
    object-fit: cover;
    background: var(--color-surface-muted);
}

.result-event__body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.result-event__title {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--color-text);
    margin: 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.result-event__meta {
    font-size: 11.5px;
    color: var(--color-text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.result-event__badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 2px;
}

.result-event__badge {
    font-size: 10.5px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 999px;
    line-height: 1.4;
}

.result-event__badge--category {
    background: #e0e7ff;
    color: #3730a3;
}

.result-event__badge--gu {
    background: #dbeafe;
    color: #1e40af;
}

.result-event__badge--free {
    background: #dcfce7;
    color: #166534;
}

.result-event__badge--paid {
    background: #fee2e2;
    color: #991b1b;
}

.result-event__badge--distance {
    background: var(--color-surface-muted);
    color: var(--color-text-muted);
}

/* ============= Real-time air quality card (desktop) ============= */
.air-card {
    --air-color: #94a3b8;
    --air-bg: #f1f5f9;
    --air-fg: #334155;
    margin: 0 0 18px;
    padding: 16px;
    border-radius: 14px;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    border-left: 5px solid var(--air-color);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.air-card[data-grade="good"]      { --air-color: #3b82f6; --air-bg: #dbeafe; --air-fg: #1e40af; }
.air-card[data-grade="moderate"]  { --air-color: #10b981; --air-bg: #d1fae5; --air-fg: #065f46; }
.air-card[data-grade="bad"]       { --air-color: #f59e0b; --air-bg: #fef3c7; --air-fg: #92400e; }
.air-card[data-grade="verybad"]   { --air-color: #ef4444; --air-bg: #fee2e2; --air-fg: #991b1b; }
.air-card[data-grade="unknown"]   { --air-color: #94a3b8; --air-bg: #f1f5f9; --air-fg: #475569; }

.air-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.air-card__title-group {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.air-card__icon {
    font-size: 18px;
    line-height: 1;
}

.air-card__title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--color-text);
}

.air-card__district {
    font-size: 13px;
    font-weight: 600;
    color: var(--air-fg);
    background: var(--air-bg);
    padding: 3px 10px;
    border-radius: 999px;
}

.air-card__measured {
    font-size: 12px;
    color: var(--color-text-muted);
    white-space: nowrap;
}

.air-card__state {
    padding: 14px;
    font-size: 13px;
    color: var(--color-text-muted);
    background: var(--color-surface-muted);
    border-radius: 10px;
    text-align: center;
}

.air-card__state--error {
    color: #991b1b;
    background: #fef2f2;
}

.air-summary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 12px;
    background: var(--air-bg);
    border-radius: 10px;
    margin-bottom: 12px;
}

.air-summary__cai,
.air-summary__dominant {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.air-summary__label {
    font-size: 11px;
    color: var(--color-text-muted);
    font-weight: 500;
    letter-spacing: 0.02em;
}

.air-summary__value {
    font-size: 22px;
    font-weight: 800;
    color: var(--air-fg);
    line-height: 1.1;
}

.air-summary__grade {
    display: inline-block;
    align-self: flex-start;
    margin-top: 2px;
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--air-color);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.air-summary__dominant-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-text);
}

.air-metrics {
    display: grid;
    gap: 10px;
}

.air-metrics--primary {
    grid-template-columns: 1fr 1fr;
    margin-bottom: 10px;
}

.air-metrics--secondary {
    grid-template-columns: repeat(4, 1fr);
    margin-bottom: 10px;
}

.air-metric {
    --metric-color: #94a3b8;
    --metric-bg: #f1f5f9;
    --metric-fg: #334155;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    position: relative;
}

.air-metric[data-grade="good"]      { --metric-color: #3b82f6; --metric-bg: #dbeafe; --metric-fg: #1e40af; }
.air-metric[data-grade="moderate"]  { --metric-color: #10b981; --metric-bg: #d1fae5; --metric-fg: #065f46; }
.air-metric[data-grade="bad"]       { --metric-color: #f59e0b; --metric-bg: #fef3c7; --metric-fg: #92400e; }
.air-metric[data-grade="verybad"]   { --metric-color: #ef4444; --metric-bg: #fee2e2; --metric-fg: #991b1b; }

.air-metric--primary {
    background: var(--metric-bg);
    border-color: transparent;
    border-left: 4px solid var(--metric-color);
}

.air-metric__label {
    font-size: 11px;
    color: var(--color-text-muted);
    font-weight: 500;
}

.air-metric--primary .air-metric__label {
    color: var(--metric-fg);
    font-weight: 600;
}

.air-metric__value {
    font-size: 18px;
    font-weight: 800;
    color: var(--color-text);
    line-height: 1.1;
}

.air-metric--primary .air-metric__value {
    color: var(--metric-fg);
    font-size: 22px;
}

.air-metric__unit {
    font-size: 11px;
    color: var(--color-text-muted);
    font-weight: 500;
}

.air-metric__grade {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--metric-color);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
}

.air-card__source {
    margin: 8px 0 0;
    text-align: right;
    font-size: 11px;
    color: var(--color-text-muted);
}

@media (max-width: 540px) {
    .air-metrics--secondary { grid-template-columns: repeat(2, 1fr); }
}
