:root {
    --bg: #07131f;
    --header-bg: rgba(9, 23, 37, 0.96);
    --panel: rgba(9, 23, 37, 0.88);
    --panel-strong: rgba(11, 28, 45, 0.96);
    --panel-soft: rgba(255, 255, 255, 0.06);
    --line: rgba(255, 255, 255, 0.12);
    --text: #f3f7fb;
    --muted: #9db1c2;
    --accent: #46c7ff;
    --accent-strong: #1ea0dc;
    --quake-low: #59d2ff;
    --quake-mid: #ffd166;
    --quake-high: #ff6b57;
    --volcano: #ff8b3d;
    --success: #53e3a6;
    --danger: #ff7c78;
    --shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    --radius-xl: 28px;
    --radius-lg: 18px;
    --radius-md: 14px;
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    font-family: "Manrope", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(71, 130, 255, 0.2), transparent 28%),
        radial-gradient(circle at top right, rgba(255, 126, 80, 0.16), transparent 24%),
        linear-gradient(180deg, #07111b 0%, #081622 48%, #051019 100%);
}

.page-shell {
    width: 100%;
    margin: 0;
    padding: 0 0 28px;
}

.app-header {
    width: 100%;
    background: var(--header-bg);
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
    padding: 24px max(2.5vw, 20px);
}

.header-top,
.control-row,
.meta-row,
.app-footer {
    display: flex;
    gap: 18px;
    align-items: center;
    justify-content: space-between;
}

.header-top {
    align-items: flex-start;
}

.brand-block {
    max-width: 760px;
}

.eyebrow {
    margin: 0 0 10px;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--accent);
}

.brand-block h1 {
    margin: 0;
    font-size: clamp(2rem, 3vw, 3.4rem);
    line-height: 1;
    letter-spacing: -0.05em;
}

.brand-copy {
    margin: 12px 0 0;
    max-width: 56rem;
    color: var(--muted);
    font-size: 1rem;
    line-height: 1.6;
}

.status-block,
.stats-strip,
.legend-strip {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.status-chip,
.stat-card,
.legend-item,
.control-field,
.message-bar,
.app-footer {
    background: var(--panel-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
}

.status-chip {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    min-height: 52px;
}

.status-chip-live .status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 8px rgba(83, 227, 166, 0.14);
}

.status-label {
    color: var(--muted);
    font-size: 0.84rem;
}

.control-row,
.meta-row {
    margin-top: 20px;
    flex-wrap: wrap;
}

.control-row {
    align-items: stretch;
}

.control-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 14px;
    min-width: 140px;
}

.control-field span {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
}

.control-field select,
.toggle-field input,
.action-button {
    font: inherit;
}

.control-field select {
    appearance: none;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text);
    font-weight: 700;
    padding-right: 12px;
}

.control-field select option,
.control-field select optgroup {
    background: #0b1c2d;
    color: var(--text);
}

.toggle-field {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    min-width: 160px;
}

.toggle-field input {
    width: 48px;
    height: 24px;
    accent-color: var(--accent);
}

.action-button {
    min-width: 128px;
    border: 0;
    border-radius: var(--radius-md);
    padding: 0 20px;
    color: #00141f;
    font-weight: 800;
    letter-spacing: 0.01em;
    background: linear-gradient(135deg, #7de4ff 0%, #29a6e2 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
    cursor: pointer;
}

.action-button:hover {
    filter: brightness(1.04);
}

.action-button-secondary {
    color: var(--text);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--line);
    box-shadow: none;
}

.action-button-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
}

.stat-card,
.legend-item {
    padding: 12px 14px;
}

.stat-card {
    min-width: 146px;
}

.stat-label {
    display: block;
    color: var(--muted);
    font-size: 0.78rem;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--muted);
    font-size: 0.92rem;
}

.legend-swatch {
    width: 14px;
    height: 14px;
    display: inline-block;
    border-radius: 999px;
}

.earthquake-swatch {
    background: linear-gradient(135deg, var(--quake-low), var(--quake-high));
}

.volcano-swatch {
    background: linear-gradient(135deg, #ffb36f, var(--volcano));
    clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
    border-radius: 0;
}

.volcano-active-swatch {
    background: #ff0000;
    clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
    border-radius: 0;
    box-shadow: 0 0 8px rgba(255, 0, 0, 0.45);
}

.message-bar {
    margin-top: 18px;
    padding: 12px 14px;
    color: var(--muted);
    min-height: 48px;
    display: flex;
    align-items: center;
}

.message-bar[data-tone="error"] {
    color: #ffd6d2;
    border-color: rgba(255, 124, 120, 0.34);
    background: rgba(99, 30, 34, 0.45);
}

.message-bar[data-tone="loading"] {
    color: #d8f4ff;
    border-color: rgba(70, 199, 255, 0.28);
}

.map-stage {
    width: min(95vw, 1640px);
    margin: 18px auto 0;
}

.detail-stage,
.activity-stage {
    width: min(95vw, 1640px);
    margin: 16px auto 0;
}

.detail-shell,
.activity-stage {
    padding: 24px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 24px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.detail-header,
.activity-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

.detail-eyebrow,
.activity-eyebrow {
    margin: 0 0 8px;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.detail-eyebrow {
    color: var(--accent);
}

.activity-eyebrow {
    color: var(--volcano);
}

.detail-header h2,
.activity-header h2 {
    margin: 0;
    font-size: clamp(1.4rem, 2vw, 2rem);
    letter-spacing: -0.03em;
}

.detail-empty {
    margin-top: 18px;
    padding: 18px;
    color: var(--muted);
    background: var(--panel-soft);
    border: 1px dashed var(--line);
    border-radius: var(--radius-md);
}

.detail-panel {
    margin-top: 18px;
}

.detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(260px, 0.8fr);
    gap: 18px;
}

.detail-card,
.detail-side {
    padding: 18px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
    border: 1px solid var(--line);
    border-radius: 18px;
}

.detail-kind {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: rgba(70, 199, 255, 0.12);
    color: #9adfff;
    border: 1px solid rgba(70, 199, 255, 0.2);
}

.detail-card h3 {
    margin: 14px 0 8px;
    font-size: 1.35rem;
    letter-spacing: -0.03em;
}

.detail-summary {
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
}

.detail-meta-grid {
    margin-top: 18px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.detail-meta {
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
}

.detail-meta span {
    display: block;
    margin-bottom: 6px;
    font-size: 0.74rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.detail-meta strong {
    display: block;
    line-height: 1.4;
}

.detail-side h4 {
    margin: 0 0 12px;
    font-size: 1rem;
}

.detail-side p {
    margin: 8px 0;
    color: var(--muted);
    line-height: 1.55;
}

.detail-side a {
    color: #8fdfff;
}

.detail-source {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.detail-source strong {
    display: block;
    margin-bottom: 8px;
    font-size: 0.82rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.activity-copy {
    margin: 10px 0 0;
    max-width: 58rem;
    color: var(--muted);
    line-height: 1.6;
}

.activity-badge {
    min-width: 120px;
    padding: 12px 14px;
    background: var(--panel-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
}

.activity-badge span {
    display: block;
    color: var(--muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 6px;
}

.activity-empty {
    margin-top: 18px;
    padding: 18px;
    color: var(--muted);
    background: var(--panel-soft);
    border: 1px dashed var(--line);
    border-radius: var(--radius-md);
}

.activity-list {
    margin-top: 18px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 14px;
}

.activity-card {
    padding: 18px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
    border: 1px solid var(--line);
    border-radius: 18px;
}

.activity-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.activity-card h3 {
    margin: 0;
    font-size: 1.05rem;
}

.activity-card-location {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 0.92rem;
}

.activity-pill {
    flex-shrink: 0;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: rgba(255, 139, 61, 0.16);
    color: #ffc08f;
    border: 1px solid rgba(255, 139, 61, 0.28);
}

.activity-grid {
    margin-top: 14px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 14px;
}

.activity-metric span {
    display: block;
    color: var(--muted);
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 5px;
}

.activity-metric strong {
    display: block;
    line-height: 1.35;
}

.activity-note {
    margin-top: 14px;
    color: var(--muted);
    font-size: 0.88rem;
    line-height: 1.5;
}

.map-frame {
    height: min(74vh, 920px);
    min-height: 520px;
    border-radius: 30px;
    overflow: hidden;
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}

.app-footer {
    width: min(95vw, 1640px);
    margin-top: 16px;
    margin-left: auto;
    margin-right: auto;
    padding: 14px 16px;
    color: var(--muted);
    font-size: 0.9rem;
    flex-wrap: wrap;
}

.leaflet-container {
    background: #06111a;
    font: inherit;
}

.quake-tooltip,
.volcano-tooltip,
.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
    background: rgba(7, 19, 31, 0.96);
    color: var(--text);
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: var(--shadow);
}

.quake-tooltip,
.volcano-tooltip {
    border-radius: 14px;
    padding: 0;
}

.tooltip-shell {
    padding: 12px 14px;
}

.tooltip-title {
    margin: 0 0 6px;
    font-size: 0.94rem;
    font-weight: 800;
}

.tooltip-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    color: var(--muted);
    font-size: 0.82rem;
}

.popup-shell {
    min-width: 220px;
}

.popup-shell h3 {
    margin: 0 0 10px;
    font-size: 1rem;
}

.popup-shell p {
    margin: 6px 0;
    color: var(--muted);
}

.popup-shell a {
    color: #8fdfff;
}

.volcano-icon {
    width: 20px;
    height: 20px;
    transform: translate(-10px, -10px);
}

.volcano-icon::before {
    content: "";
    display: block;
    width: 20px;
    height: 20px;
    background: linear-gradient(180deg, #ffd7a6 0%, #ff8b3d 85%);
    clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
    filter: drop-shadow(0 6px 10px rgba(255, 139, 61, 0.3));
}

.volcano-icon.volcano-icon-active::before {
    background: #ff0000;
    filter: drop-shadow(0 0 14px rgba(255, 0, 0, 0.75));
}

.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
    background: rgba(70, 199, 255, 0.2);
}

.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div {
    background: rgba(31, 160, 220, 0.84);
    color: #fff;
    font-weight: 800;
}

@media (max-width: 900px) {
    .page-shell {
        width: 100%;
        padding-top: 0;
    }

    .app-header {
        padding: 18px;
    }

    .header-top,
    .control-row,
    .meta-row,
    .app-footer {
        flex-direction: column;
        align-items: stretch;
    }

    .status-block {
        justify-content: flex-start;
    }

    .action-button {
        min-height: 56px;
    }

    .map-frame {
        min-height: 460px;
        height: 68vh;
    }

    .map-stage,
    .detail-stage,
    .activity-stage,
    .app-footer {
        width: min(96vw, 1640px);
    }

    .detail-grid,
    .activity-header {
        flex-direction: column;
    }

    .detail-grid,
    .activity-grid {
        grid-template-columns: 1fr;
    }
}
