:root {
    --mmn-bg: #f5f6fb;
    --mmn-surface: #ffffff;
    --mmn-ink: #1f2533;
    --mmn-muted: #6b7280;
    --mmn-line: #e8eaf2;
    --mmn-primary: #6366f1;
    --mmn-primary-700: #4f46e5;
    --mmn-accent: #14b8a6;
    --mmn-radius: 16px;
    --mmn-radius-sm: 10px;
    --mmn-shadow: 0 10px 30px rgba(31, 37, 51, .08);
    --mmn-shadow-sm: 0 2px 10px rgba(31, 37, 51, .06);
    --i1: #22c55e;
    --i2: #84cc16;
    --i3: #eab308;
    --i4: #f97316;
    --i5: #ef4444;
}

html { font-size: 15px; position: relative; min-height: 100%; }
@media (min-width: 768px) { html { font-size: 16px; } }

body {
    background: var(--mmn-bg);
    color: var(--mmn-ink);
    font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--mmn-primary-700); }
.text-muted { color: var(--mmn-muted) !important; }

/* ---------- Navbar ---------- */
.mmn-nav {
    background: var(--mmn-surface);
    box-shadow: var(--mmn-shadow-sm);
    border-bottom: 1px solid var(--mmn-line);
    padding-top: .6rem;
    padding-bottom: .6rem;
}
.mmn-brand {
    font-weight: 800;
    letter-spacing: -.02em;
    color: var(--mmn-ink);
    display: inline-flex;
    align-items: center;
    gap: .55rem;
}
.mmn-brand:hover { color: var(--mmn-primary-700); }
.mmn-nav .nav-link { color: #3b4252; font-weight: 600; }
.mmn-nav .nav-link:hover { color: var(--mmn-primary-700); }
.mmn-nav-right .navbar-nav { flex-direction: row; align-items: center; gap: .25rem; }
.mmn-nav-right .nav-link { padding: .25rem .5rem; }

/* Equalizer brand mark */
.mmn-brand-mark { display: inline-flex; align-items: flex-end; gap: 3px; height: 22px; }
.mmn-brand-mark span {
    width: 4px; border-radius: 2px;
    background: linear-gradient(180deg, var(--mmn-primary), var(--mmn-accent));
    animation: mmn-eq 1.1s ease-in-out infinite;
}
.mmn-brand-mark span:nth-child(1) { height: 9px;  animation-delay: 0s; }
.mmn-brand-mark span:nth-child(2) { height: 18px; animation-delay: .18s; }
.mmn-brand-mark span:nth-child(3) { height: 13px; animation-delay: .36s; }
.mmn-brand-mark span:nth-child(4) { height: 20px; animation-delay: .54s; }
@keyframes mmn-eq { 0%, 100% { transform: scaleY(.45); } 50% { transform: scaleY(1); } }

/* ---------- Layout ---------- */
.mmn-main { flex: 1 0 auto; padding: 2rem 0 3rem; }
.mmn-footer {
    flex-shrink: 0;
    border-top: 1px solid var(--mmn-line);
    background: var(--mmn-surface);
    color: var(--mmn-muted);
    padding: 1rem 0;
    font-size: .9rem;
}
.mmn-footer .container { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

.mmn-page-title { font-weight: 800; letter-spacing: -.02em; font-size: 1.9rem; }

/* ---------- Buttons ---------- */
.btn { border-radius: 999px; font-weight: 600; }
.mmn-btn-primary {
    background: linear-gradient(135deg, var(--mmn-primary), var(--mmn-primary-700));
    border: none; color: #fff;
    box-shadow: 0 6px 16px rgba(79, 70, 229, .28);
}
.mmn-btn-primary:hover { color: #fff; filter: brightness(1.05); }
.btn-outline-secondary { border-color: var(--mmn-line); color: #3b4252; background: #fff; }
.btn-outline-secondary:hover { background: #f1f2f8; color: var(--mmn-ink); border-color: #d8dbe8; }

/* ---------- Cards ---------- */
.mmn-card {
    background: var(--mmn-surface);
    border: 1px solid var(--mmn-line);
    border-radius: var(--mmn-radius);
    box-shadow: var(--mmn-shadow);
    padding: 1.5rem;
}
.mmn-card-title { font-size: 1.15rem; font-weight: 700; margin-bottom: 1rem; }

/* ---------- Hero / landing ---------- */
.mmn-hero {
    position: relative; overflow: hidden;
    border-radius: 24px;
    background: radial-gradient(1200px 400px at 10% -20%, #818cf8 0%, transparent 60%),
                linear-gradient(135deg, #4f46e5 0%, #6366f1 40%, #14b8a6 120%);
    color: #fff;
    padding: 3.5rem 2rem;
    box-shadow: var(--mmn-shadow);
}
.mmn-hero h1 { font-weight: 800; font-size: 2.6rem; letter-spacing: -.03em; margin-bottom: .75rem; }
.mmn-hero p { font-size: 1.15rem; max-width: 40rem; opacity: .95; }
.mmn-hero .btn { margin-top: 1.25rem; }
.mmn-hero-eq { display: flex; align-items: flex-end; gap: 6px; height: 64px; margin-bottom: 1.5rem; }
.mmn-hero-eq span {
    width: 8px; border-radius: 4px; background: rgba(255, 255, 255, .85);
    animation: mmn-eq 1.4s ease-in-out infinite;
}
.mmn-hero-eq span:nth-child(odd) { background: rgba(255, 255, 255, .55); }
.mmn-hero-eq span:nth-child(1) { height: 30%; animation-delay: 0s; }
.mmn-hero-eq span:nth-child(2) { height: 70%; animation-delay: .1s; }
.mmn-hero-eq span:nth-child(3) { height: 45%; animation-delay: .2s; }
.mmn-hero-eq span:nth-child(4) { height: 90%; animation-delay: .3s; }
.mmn-hero-eq span:nth-child(5) { height: 55%; animation-delay: .4s; }
.mmn-hero-eq span:nth-child(6) { height: 80%; animation-delay: .5s; }
.mmn-hero-eq span:nth-child(7) { height: 35%; animation-delay: .6s; }
.mmn-hero-eq span:nth-child(8) { height: 65%; animation-delay: .7s; }

.mmn-section-title { font-weight: 800; letter-spacing: -.02em; margin: 2.5rem 0 1.25rem; }
.mmn-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.25rem; }
.mmn-feature { background: var(--mmn-surface); border: 1px solid var(--mmn-line); border-radius: var(--mmn-radius); padding: 1.5rem; box-shadow: var(--mmn-shadow-sm); }
.mmn-feature-ico { font-size: 1.8rem; }
.mmn-feature h3 { font-size: 1.1rem; font-weight: 700; margin: .6rem 0 .35rem; }
.mmn-feature p { color: var(--mmn-muted); margin: 0; font-size: .95rem; }

/* Privacy pledge block */
.mmn-pledge { background: linear-gradient(135deg, #ecfdf5, #eff6ff); border: 1px solid #d4f1e6; border-radius: var(--mmn-radius); padding: 1.75rem; }
.mmn-pledge h2 { font-weight: 800; font-size: 1.4rem; }
.mmn-pledge-list { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem 2rem; margin-top: 1rem; }
@media (max-width: 640px) { .mmn-pledge-list { grid-template-columns: 1fr; } }
.mmn-pledge-list li { list-style: none; padding-left: 1.9rem; position: relative; }
.mmn-pledge-yes::before { content: "✓"; position: absolute; left: 0; top: -1px; color: #059669; font-weight: 800; }
.mmn-pledge-no::before  { content: "✕"; position: absolute; left: 0; top: -1px; color: #dc2626; font-weight: 800; }

/* ---------- Forms ---------- */
.mmn-form-head { margin-bottom: 1.25rem; }
.mmn-form .form-label { font-weight: 600; font-size: .92rem; }
.mmn-form .form-control, .mmn-form .form-select { border-radius: var(--mmn-radius-sm); border-color: var(--mmn-line); padding: .55rem .75rem; }
.mmn-form .form-control:focus, .mmn-form .form-select:focus { border-color: var(--mmn-primary); box-shadow: 0 0 0 .2rem rgba(99, 102, 241, .15); }
.mmn-form-actions { display: flex; justify-content: flex-end; gap: .75rem; margin-top: 1.25rem; padding-top: 1.25rem; border-top: 1px solid var(--mmn-line); }
input[type="range"] { accent-color: var(--mmn-primary); }
.form-check-input:checked { background-color: var(--mmn-primary); border-color: var(--mmn-primary); }

.intensity-input { display: flex; align-items: center; gap: .75rem; }
.intensity-input .form-range { flex: 1; }
.intensity-out { font-weight: 700; white-space: nowrap; padding: .15rem .6rem; border-radius: 999px; background: #f1f2f8; font-size: .85rem; }
.intensity-out[data-level="1"] { background: rgba(34,197,94,.15); color: #15803d; }
.intensity-out[data-level="2"] { background: rgba(132,204,22,.18); color: #4d7c0f; }
.intensity-out[data-level="3"] { background: rgba(234,179,8,.18); color: #a16207; }
.intensity-out[data-level="4"] { background: rgba(249,115,22,.18); color: #c2410c; }
.intensity-out[data-level="5"] { background: rgba(239,68,68,.18); color: #b91c1c; }

.picker-map { height: 360px; border-radius: var(--mmn-radius-sm); border: 1px solid var(--mmn-line); }
.detail-map { height: 240px; border-radius: var(--mmn-radius-sm); border: 1px solid var(--mmn-line); margin: 1.25rem 0; }

/* ---------- Intensity meter ---------- */
.intensity-meter { display: inline-flex; align-items: flex-end; gap: 3px; height: 18px; vertical-align: middle; }
.intensity-bar { width: 5px; border-radius: 2px; background: #e2e4ee; }
.intensity-bar[data-level="1"] { height: 7px; }
.intensity-bar[data-level="2"] { height: 10px; }
.intensity-bar[data-level="3"] { height: 13px; }
.intensity-bar[data-level="4"] { height: 16px; }
.intensity-bar[data-level="5"] { height: 18px; }
.intensity-bar.on[data-level="1"] { background: var(--i1); }
.intensity-bar.on[data-level="2"] { background: var(--i2); }
.intensity-bar.on[data-level="3"] { background: var(--i3); }
.intensity-bar.on[data-level="4"] { background: var(--i4); }
.intensity-bar.on[data-level="5"] { background: var(--i5); }

/* ---------- Type pill ---------- */
.mmn-type-pill {
    display: inline-flex; align-items: center; gap: .3rem;
    font-size: .8rem; font-weight: 700;
    padding: .2rem .6rem; border-radius: 999px;
    color: var(--mmn-type, #64748b);
    background: color-mix(in srgb, var(--mmn-type, #64748b) 14%, white);
    border: 1px solid color-mix(in srgb, var(--mmn-type, #64748b) 30%, white);
}

/* ---------- Log list ---------- */
.mmn-log { display: flex; flex-direction: column; gap: .9rem; }
.mmn-log-row { display: flex; align-items: center; gap: 1rem; padding: 1rem 1.25rem; }
.mmn-log-emoji {
    flex: none; width: 46px; height: 46px; border-radius: 14px;
    display: grid; place-items: center; font-size: 1.4rem;
    background: color-mix(in srgb, var(--mmn-type, #64748b) 14%, white);
    border: 1px solid color-mix(in srgb, var(--mmn-type, #64748b) 28%, white);
}
.mmn-log-main { flex: 1; min-width: 0; }
.mmn-log-head { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.mmn-log-time { color: var(--mmn-muted); font-size: .85rem; }
.mmn-log-desc { font-weight: 600; margin: .25rem 0; overflow-wrap: anywhere; }
.mmn-log-meta { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; color: var(--mmn-muted); font-size: .88rem; }
.mmn-meta-item { display: inline-flex; align-items: center; gap: .3rem; }
.mmn-log-actions { display: flex; gap: .4rem; flex: none; }
@media (max-width: 640px) {
    .mmn-log-row { flex-wrap: wrap; }
    .mmn-log-actions { width: 100%; }
}

/* ---------- Empty state ---------- */
.mmn-empty { text-align: center; padding: 3rem 1.5rem; }
.mmn-empty-icon { font-size: 3rem; line-height: 1; margin-bottom: .5rem; }
.mmn-empty h3 { font-weight: 700; }

/* ---------- Detail ---------- */
.mmn-detail-head { display: flex; gap: 1rem; align-items: flex-start; }
.mmn-detail-title { font-weight: 800; font-size: 1.5rem; margin: .35rem 0 .15rem; }
.mmn-detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; margin: 1.5rem 0 0; }
.mmn-detail-grid dt { color: var(--mmn-muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.mmn-detail-grid dd { font-weight: 600; margin: .15rem 0 0; }
.mmn-notes { margin-top: 1.25rem; }
.mmn-notes dt { color: var(--mmn-muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }

/* ---------- Confirm ---------- */
.mmn-confirm { max-width: 560px; }
.mmn-confirm-summary { background: #f8f9fd; border: 1px solid var(--mmn-line); border-radius: var(--mmn-radius-sm); padding: 1rem 1.25rem; margin: 1rem 0 1.5rem; }

/* ---------- Map dashboard ---------- */
.mmn-map-shell { padding: 0; overflow: hidden; }
.mmn-map-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; padding: 1rem 1.25rem; border-bottom: 1px solid var(--mmn-line); }
.mmn-toggle { display: flex; gap: 1.25rem; }
.mmn-toggle label { display: inline-flex; align-items: center; gap: .4rem; font-weight: 600; font-size: .9rem; cursor: pointer; }
.mmn-legend { display: flex; flex-wrap: wrap; gap: .5rem .9rem; }
.mmn-legend-item { display: inline-flex; align-items: center; gap: .35rem; font-size: .82rem; color: #475569; }
.mmn-legend-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--mmn-type, #64748b); display: inline-block; }
.noise-map { height: 62vh; min-height: 440px; width: 100%; }

/* ---------- Custom pins ---------- */
.mmn-pin { background: transparent; border: none; }
.mmn-pin-inner {
    display: grid; place-items: center;
    width: 30px; height: 30px; border-radius: 50% 50% 50% 50%;
    background: #fff;
    border: 3px solid var(--mmn-type, #64748b);
    box-shadow: 0 3px 8px rgba(0, 0, 0, .25);
}
.mmn-pin-emoji { font-size: 15px; line-height: 1; }
.mmn-pin-pick {
    width: 24px; height: 24px;
    background: var(--mmn-primary); border-color: #fff;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, .3);
    animation: mmn-pulse 1.6s ease-out infinite;
}
@keyframes mmn-pulse { 0% { box-shadow: 0 0 0 0 rgba(99,102,241,.45); } 70% { box-shadow: 0 0 0 12px rgba(99,102,241,0); } 100% { box-shadow: 0 0 0 0 rgba(99,102,241,0); } }

/* ---------- Map popup ---------- */
.mmn-popup { min-width: 180px; }
.mmn-popup-type { font-weight: 800; color: var(--mmn-type, #334155); margin-bottom: .25rem; }
.mmn-popup-desc { font-weight: 600; margin-bottom: .35rem; }
.mmn-popup-meta { color: var(--mmn-muted); font-size: .82rem; }
.mmn-popup-intensity { display: inline-flex; align-items: flex-end; gap: 3px; height: 16px; margin-top: .5rem; }
.mmn-popup-intensity .pp-bar { width: 5px; height: 100%; border-radius: 2px; background: #e2e4ee; }
.mmn-popup-intensity .pp-bar.on { background: var(--mmn-accent); }
.mmn-popup-notes { margin-top: .5rem; padding-top: .5rem; border-top: 1px solid var(--mmn-line); font-size: .85rem; color: #475569; }

/* ---------- Timeline ---------- */
.mmn-chart-card { margin-bottom: 1.5rem; }
.mmn-chart-wrap { position: relative; height: 300px; }
.mmn-timeline { display: flex; flex-direction: column; gap: 1.5rem; }
.mmn-timeline-date { font-weight: 800; color: #334155; margin-bottom: .6rem; }
.mmn-timeline-items { display: flex; flex-direction: column; gap: .35rem; border-left: 2px solid var(--mmn-line); padding-left: 0; margin-left: 6px; }
.mmn-timeline-item { display: flex; align-items: flex-start; gap: .85rem; position: relative; padding: .65rem 0 .65rem 1.1rem; }
.mmn-timeline-time { flex: none; width: 3.1rem; text-align: right; color: var(--mmn-muted); font-size: .85rem; font-variant-numeric: tabular-nums; padding-top: .1rem; }
.mmn-timeline-dot { flex: none; width: 13px; height: 13px; border-radius: 50%; background: var(--mmn-type, #64748b); border: 3px solid #fff; box-shadow: 0 0 0 2px var(--mmn-type, #64748b); margin-left: -1.65rem; margin-top: .25rem; }
.mmn-timeline-body { flex: 1; background: var(--mmn-surface); border: 1px solid var(--mmn-line); border-radius: var(--mmn-radius-sm); padding: .65rem .85rem; box-shadow: var(--mmn-shadow-sm); }
.mmn-timeline-row1 { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.mmn-timeline-desc { font-weight: 600; margin-top: .3rem; overflow-wrap: anywhere; }
.mmn-timeline-meta { color: var(--mmn-muted); font-size: .85rem; margin-top: .15rem; }

/* ---------- Misc ---------- */
.mmn-flash { border: none; border-radius: var(--mmn-radius-sm); background: #ecfdf5; color: #065f46; }
.leaflet-container { font: inherit; }

/* ---------- Community: visibility badges ---------- */
.mmn-vis { font-size: .72rem; font-weight: 700; padding: .12rem .5rem; border-radius: 999px; text-transform: uppercase; letter-spacing: .03em; }
.mmn-vis-public { background: rgba(20, 184, 166, .15); color: #0f766e; }
.mmn-vis-private { background: #eef0f6; color: #5b6472; }

/* ---------- Community: hero + footnotes ---------- */
.mmn-hero-compact { padding: 2.5rem 2rem; }
.mmn-hero-compact h1 { font-size: 2.2rem; }
.mmn-hero-note { margin-top: .75rem; font-size: .9rem; opacity: .9; }
.mmn-community-foot { margin-top: .75rem; font-size: .85rem; }

/* ---------- Endorse button (map popups) ---------- */
.mmn-mine { font-weight: 600; opacity: .8; }
.mmn-endorse {
    display: inline-flex; align-items: center; gap: .4rem;
    margin-top: .65rem; padding: .35rem .7rem;
    border: 1px solid var(--mmn-line); border-radius: 999px;
    background: #fff; color: #475569; font-weight: 700; font-size: .82rem; cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
}
.mmn-endorse:hover { border-color: #fca5b5; color: #e11d48; }
.mmn-endorse .mmn-endorse-ico::before { content: "\2665"; }
.mmn-endorse .mmn-endorse-ico { color: #cbd5e1; transition: color .15s; }
.mmn-endorse:hover .mmn-endorse-ico { color: #e11d48; }
.mmn-endorse.on { background: #fff1f2; border-color: #fecdd3; color: #e11d48; }
.mmn-endorse.on .mmn-endorse-ico { color: #e11d48; }
.mmn-endorse .mmn-endorse-count { background: #f1f2f8; border-radius: 999px; padding: 0 .45rem; min-width: 1.4rem; text-align: center; }
.mmn-endorse.on .mmn-endorse-count { background: #ffe4e6; }

/* ---------- Public/private toggle on the form ---------- */
.mmn-public-check { background: #f8f9fd; border: 1px solid var(--mmn-line); border-radius: var(--mmn-radius-sm); padding: .85rem 1rem; }
.mmn-public-check .form-check-input { margin-top: .2rem; }
.mmn-public-check .form-check-input:checked { background-color: var(--mmn-primary); border-color: var(--mmn-primary); }
.mmn-public-check .form-check-label { font-weight: 600; }
