/* ============================================================
   fmap — Premium Dark UI
   ============================================================ */

/* ── Reset & Base ── */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Color Palette */
    --bg-primary: #0a0e17;
    --bg-secondary: #111827;
    --bg-glass: rgba(17, 24, 39, 0.75);
    --bg-glass-hover: rgba(17, 24, 39, 0.9);
    --border-glass: rgba(255, 255, 255, 0.08);
    --border-glass-hover: rgba(255, 255, 255, 0.15);

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --accent: #f97316;
    --accent-light: #fb923c;
    --accent-glow: rgba(249, 115, 22, 0.25);
    --accent-gradient: linear-gradient(135deg, #f97316 0%, #fb923c 50%, #fdba74 100%);

    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;

    /* Spacing */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px var(--accent-glow);

    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Global utility — hide any element with the hidden class */
.hidden {
    display: none !important;
}

html, body {
    height: 100%;
    width: 100%;
    overflow: hidden;
    font-family: var(--font-family);
    color: var(--text-primary);
    background: var(--bg-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ── Map ── */
#map {
    position: absolute;
    inset: 0;
    z-index: 1;
}

/* Override Leaflet tile layer for dark aesthetic */
.leaflet-tile-pane {
    filter: brightness(0.85) contrast(1.05) saturate(0.9);
}

.leaflet-control-zoom {
    border: none !important;
    box-shadow: var(--shadow-md) !important;
}

.leaflet-control-zoom a {
    background: var(--bg-glass) !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-glass) !important;
    width: 36px !important;
    height: 36px !important;
    line-height: 36px !important;
    font-size: 16px !important;
    transition: all 0.2s ease;
}

.leaflet-control-zoom a:hover {
    background: var(--bg-glass-hover) !important;
    border-color: var(--border-glass-hover) !important;
}

/* Pin placement mode: change the map cursor to a crosshair to cue "click the map to drop a pin" */
.leaflet-container.placing-pin { cursor: crosshair !important; }

/* ── Custom marker pulse animation ── */
.pulse-marker {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 0 var(--accent-glow);
    animation: pulse-ring 2s ease-out infinite;
    position: relative;
}

.pulse-marker::after {
    content: '';
    position: absolute;
    inset: 3px;
    border-radius: 50%;
    background: white;
}

@keyframes pulse-ring {
    0% { box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.5); }
    70% { box-shadow: 0 0 0 12px rgba(249, 115, 22, 0); }
    100% { box-shadow: 0 0 0 0 rgba(249, 115, 22, 0); }
}

/* ── Photo thumbnail marker (when zoomed in) ── */
.pin-thumb {
    width: 46px;
    height: 46px;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid var(--accent);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5);
    background: var(--bg-secondary);
    transition: transform 0.15s;
}
.pin-thumb:hover { transform: scale(1.08); }
.pin-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ── Marker cluster (orange theme override) ── */
.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
    background-color: rgba(249, 115, 22, 0.25);
}
.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div {
    background-color: rgba(249, 115, 22, 0.85);
    color: #fff;
}
.marker-cluster div { font-weight: 700; }
.marker-cluster span { color: #fff; }

/* ── Top Bar ── */
#top-bar {
    position: fixed;
    top: 16px;
    left: 16px;
    right: 16px;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    /* Transparent — the map behind shows fully and only the sub filter floats */
    background: transparent;
    pointer-events: none;
    animation: slideDown 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Only floating child elements are clickable */
#top-bar .top-actions {
    pointer-events: auto;
}

.lang-select {
    padding: 7px 28px 7px 12px;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: var(--font-family);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
    /* Remove the default arrow, then a custom arrow */
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%2394a3b8' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    max-width: 160px;
}
.lang-select:hover {
    color: var(--text-primary);
    border-color: var(--accent);
}
.lang-select option {
    /* The dropdown's expanded list is an OS widget, so set a dark background */
    background: #1e293b;
    color: #e2e8f0;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.coord-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: rgba(249, 115, 22, 0.1);
    border: 1px solid rgba(249, 115, 22, 0.2);
    border-radius: var(--radius-sm);
    font-size: 13px;
    transition: all 0.3s ease;
}

.coord-label {
    color: var(--accent-light);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

#coord-text {
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
    font-size: 13px;
}

/* ── Click Hint Toast ── */
.click-hint {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    padding: 12px 24px;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
    animation: floatUp 0.6s cubic-bezier(0.16, 1, 0.3, 1), floatBounce 3s ease-in-out infinite 0.6s;
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.click-hint.hidden {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
    pointer-events: none;
}

/* ── Timemachine: highlighted-pins-by-date control (bottom-left) ── */
.timemachine {
    position: fixed;
    bottom: 24px;
    left: 16px;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 10px;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}
.tm-icon { font-size: 15px; }
.tm-date {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-family: var(--font-family);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    color-scheme: dark;   /* make the native date widget dark */
}
.tm-date:focus { outline: none; color: var(--text-primary); }
.tm-exit {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 2px 5px;
    border-radius: 6px;
}
.tm-exit:hover { color: var(--accent); background: rgba(249, 115, 22, 0.12); }

/* Highlight (featured pin) star marker */
.highlight-marker { background: transparent; border: none; }
.hl-star {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #fbbf24;
    text-shadow: 0 0 6px rgba(251, 191, 36, 0.9), 0 0 12px rgba(251, 191, 36, 0.6);
    animation: hlPulse 2s ease-in-out infinite;
}
@keyframes hlPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.18); }
}

@keyframes floatUp {
    from { opacity: 0; transform: translateX(-50%) translateY(20px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes floatBounce {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(-4px); }
}

/* ── Modal Overlay ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: fadeIn 0.25s ease;
}

.modal-overlay.hidden {
    display: none;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ── Modal ── */
.modal {
    width: 90%;
    max-width: 480px;
    max-height: 85vh;
    overflow-y: auto;
    background: var(--bg-secondary);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg), 0 0 40px rgba(249, 115, 22, 0.08);
    animation: modalSlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlideUp {
    from { opacity: 0; transform: translateY(30px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 0;
}

.modal-header h2 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.modal-close-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    border-radius: 50%;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-close-btn:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--danger);
}

/* ── Modal Coord Info ── */
.modal-coord-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 24px;
    padding: 12px 16px;
    background: rgba(249, 115, 22, 0.08);
    border: 1px solid rgba(249, 115, 22, 0.15);
    border-radius: var(--radius-md);
}

.coord-pin-icon {
    font-size: 24px;
}

.coord-detail-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent-light);
    margin-bottom: 2px;
}

.coord-detail-value {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

/* ── Form ── */
#post-form {
    padding: 8px 24px 24px;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    letter-spacing: 0.01em;
}

.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 14px;
    transition: all 0.25s ease;
    outline: none;
}

.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
    background: rgba(255, 255, 255, 0.06);
}

.form-group select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-group textarea::placeholder {
    color: var(--text-muted);
}

/* ── File Upload Area ── */
.file-upload-area {
    position: relative;
    border: 2px dashed var(--border-glass);
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.25s ease;
}

.file-upload-area:hover {
    border-color: var(--accent);
    background: rgba(249, 115, 22, 0.04);
}

.file-upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 28px 20px;
    color: var(--text-muted);
    font-size: 14px;
}

.upload-icon {
    font-size: 28px;
    opacity: 0.7;
}

.image-preview {
    width: 100%;
    max-height: 200px;
    object-fit: cover;
    display: block;
}

.image-preview.hidden {
    display: none;
}

/* ── Submit Button ── */
.submit-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    background: var(--accent-gradient);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-family: var(--font-family);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-glow);
    position: relative;
    overflow: hidden;
}

.submit-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent 0%, rgba(255, 255, 255, 0.15) 50%, transparent 100%);
    transform: translateX(-100%);
    transition: transform 0.5s ease;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow), 0 8px 25px rgba(249, 115, 22, 0.3);
}

.submit-btn:hover::before {
    transform: translateX(100%);
}

.submit-btn:active {
    transform: translateY(0);
}

.btn-icon {
    transition: transform 0.3s ease;
}

.submit-btn:hover .btn-icon {
    transform: translateX(4px);
}

/* ── Custom Leaflet Popup ── */
.leaflet-popup-content-wrapper {
    background: var(--bg-glass) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border: 1px solid var(--border-glass) !important;
    border-radius: var(--radius-md) !important;
    box-shadow: var(--shadow-md) !important;
    color: var(--text-primary) !important;
}

.leaflet-popup-tip {
    background: var(--bg-glass) !important;
    border: 1px solid var(--border-glass) !important;
}

.leaflet-popup-close-button {
    color: var(--text-secondary) !important;
}

/* ── Scrollbar ── */
.modal::-webkit-scrollbar {
    width: 6px;
}

.modal::-webkit-scrollbar-track {
    background: transparent;
}

.modal::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.modal::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ── Sidebar Toggle ── */
.sidebar-toggle-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(249, 115, 22, 0.1);
    border: 1px solid rgba(249, 115, 22, 0.2);
    border-radius: var(--radius-sm);
    color: var(--accent-light);
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sidebar-toggle-btn:hover {
    background: rgba(249, 115, 22, 0.2);
}

/* ── Sidebar ── */
.sidebar {
    position: fixed;
    top: 0;
    right: -360px;
    width: 360px;
    max-width: 92vw;
    height: 100%;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-glass);
    z-index: 1500;
    display: flex;
    flex-direction: column;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
    transition: right 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar.open {
    right: 64px;   /* expands to the left of the fixed right rail (64px) */
}

/* ── Fixed right rail (subs / add / settings) ── */
.right-rail {
    position: fixed;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    z-index: 1600;          /* above the panel → always clickable */
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 6px;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-glass);
    border-right: none;
    border-radius: 16px 0 0 16px;
    box-shadow: -8px 0 26px rgba(0, 0, 0, 0.4);
}
.rail-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    width: 52px;
    padding: 9px 4px;
    background: transparent;
    border: none;
    border-radius: 10px;
    color: var(--text-secondary);
    font-family: var(--font-family);
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.rail-btn:hover { background: rgba(255, 255, 255, 0.07); color: var(--text-primary); }
.rail-btn.active { background: var(--accent); color: #fff; }
.rail-icon { font-size: 20px; line-height: 1; }
.rail-label { font-size: 10px; line-height: 1; }

/* When a drawer (sidebar/feed/settings) is open, the 64px gap beside the right rail lets the map
   show through and look messy; cover it with the same color as the panel. The rail (z1600) floats above this. */
.rail-backdrop {
    position: fixed;
    top: 0;
    right: 0;
    width: 64px;
    height: 100%;
    background: var(--bg-secondary);
    z-index: 1450;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}
body:has(.sidebar.open) .rail-backdrop,
body:has(.feed-panel.open) .rail-backdrop,
body:has(.settings-panel.open) .rail-backdrop {
    opacity: 1;
}

/* ── Settings panel (language / account) — same right drawer as the sidebar ── */
.settings-panel {
    position: fixed;
    top: 0;
    right: -320px;
    width: 320px;
    max-width: 92vw;
    height: 100%;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-glass);
    z-index: 1500;
    display: flex;
    flex-direction: column;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
    transition: right 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.settings-panel.open { right: 64px; }
.settings-body { padding: 20px; display: flex; flex-direction: column; gap: 18px; }
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.settings-label { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.settings-account { display: flex; align-items: center; gap: 8px; }

/* ── Top sub filter ── */
.topbar-sub-filter {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px 6px 12px;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    pointer-events: auto;
}
.tsf-icon { font-size: 14px; }
.sub-filter-select {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    max-width: 200px;
}
.sub-filter-select:focus { outline: none; }
.sub-filter-select option { background: #1e293b; color: #e2e8f0; }

/* Close (‹) tab button attached to the left edge */
.sidebar-collapse-btn {
    position: absolute;
    top: 50%;
    left: -34px;
    transform: translateY(-50%);
    width: 34px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border-glass);
    border-right: none;
    border-radius: 12px 0 0 12px;
    color: var(--text-secondary);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    box-shadow: -8px 0 20px rgba(0, 0, 0, 0.35);
    transition: color 0.15s;
}
.sidebar-collapse-btn:hover { color: var(--accent); }

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-glass);
}

.sidebar-header h2 {
    font-size: 18px;
}

.sidebar-search {
    padding: 16px;
    border-bottom: 1px solid var(--border-glass);
}

.sidebar-search input {
    width: 100%;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-family);
    outline: none;
    transition: all 0.2s;
}

.sidebar-search input:focus {
    border-color: var(--accent);
}

.sub-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 14px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sub-section-title {
    padding: 14px 2px 4px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

/* ── Spot card (list card with a "Smart Around" feel) ── */
.spot-card {
    display: flex;
    gap: 12px;
    padding: 10px;
    border-radius: 14px;
    background: var(--bg-primary);
    border: 1px solid var(--border-glass);
    text-decoration: none;
    color: var(--text-primary);
    transition: transform 0.15s, border-color 0.15s, background 0.15s;
}

.spot-card:hover {
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.03);
    transform: translateY(-1px);
}

.spot-thumb {
    position: relative;
    flex: 0 0 64px;
    width: 64px;
    height: 64px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: linear-gradient(135deg,
        hsl(var(--spot-hue, 20) 60% 44%),
        hsl(calc(var(--spot-hue, 20) + 35) 65% 30%));
}

.spot-thumb-icon {
    font-size: 24px;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.45));
}

.spot-thumb-count {
    position: absolute;
    right: 4px;
    bottom: 4px;
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    background: rgba(0, 0, 0, 0.5);
    padding: 1px 6px;
    border-radius: 10px;
}

.spot-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
}

.spot-name {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 15px;
    font-weight: 700;
    color: var(--accent-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.spot-lock { font-size: 11px; }

.spot-cat {
    font-size: 12.5px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.spot-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    color: var(--text-muted);
}

.spot-meta-pins {
    color: var(--accent-light);
    font-weight: 600;
}

.spot-dot { opacity: 0.5; }

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-glass);
}

.create-sub-btn {
    width: 100%;
    padding: 12px;
    background: transparent;
    border: 1px dashed var(--border-glass);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font-family);
}

.create-sub-btn:hover {
    border-color: var(--accent);
    color: var(--accent-light);
    background: rgba(249, 115, 22, 0.05);
}

/* ── Sub Feed Page ── */
.sub-feed-body {
    background: var(--bg-primary);
    overflow-y: auto;
}

.sub-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-glass);
    padding: 20px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sub-header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.back-btn {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.05);
    transition: all 0.2s;
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.sub-title-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sub-title-group h1 {
    font-size: 24px;
}

.sub-header-right {
    display: flex;
    align-items: center;
    gap: 24px;
}

.sub-stats {
    display: flex;
    gap: 24px;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--accent-light);
}

.stat-label {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

.settings-btn {
    background: transparent;
    border: none;
    font-size: 24px;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.settings-btn:hover {
    opacity: 1;
}

.feed-container {
    max-width: 600px;
    margin: 40px auto;
    padding: 0 20px;
}

.feed-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s;
}

.feed-item-clickable { cursor: pointer; }

/* ══════════════════════════════════════════════
   CONFIG PAGE (/sub/:name/config)
   ══════════════════════════════════════════════ */
.config-page {
    min-height: 100vh;
    overflow-y: auto;
    background: var(--bg-primary);
}
.config-header {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 24px;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-glass);
}
.config-h1 {
    flex: 1;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}
.config-h1 #cfg-name { color: var(--accent-light); }
.config-auth { display: flex; align-items: center; gap: 8px; }

.config-main { max-width: 640px; margin: 0 auto; padding: 24px; }
.config-msg { text-align: center; padding: 60px 0; color: var(--text-muted); }

.config-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 20px;
}
.config-card h2 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 18px;
}
.config-count { color: var(--text-muted); font-weight: 500; font-size: 14px; }
.config-card textarea.auth-input { width: 100%; }

.member-list { display: flex; flex-direction: column; gap: 2px; }
.member-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
}
.member-item:hover { background: rgba(255, 255, 255, 0.03); }
.member-name { font-size: 14px; color: var(--text-primary); font-weight: 500; }
.member-role {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 3px 8px;
    border-radius: 999px;
}
.member-role.role-owner { color: #fff; background: var(--accent); }
.member-role.role-moderator { color: var(--accent-light); background: rgba(249, 115, 22, 0.15); }
.member-role.role-member { color: var(--text-muted); background: rgba(255, 255, 255, 0.06); }
.member-right { display: flex; align-items: center; gap: 10px; }
.kick-btn {
    background: transparent;
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--danger);
    font-size: 12px;
    font-weight: 600;
    font-family: var(--font-family);
    padding: 4px 10px;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.15s;
}
.kick-btn:hover { background: rgba(239, 68, 68, 0.12); }

/* ── Vote / Comment ── */
.vote-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
}
.vote-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    color: var(--text-muted);
    width: 28px;
    height: 28px;
    border-radius: 7px;
    cursor: pointer;
    font-size: 12px;
    line-height: 1;
    transition: color 0.12s, background 0.12s, border-color 0.12s;
}
.vote-btn:hover { color: var(--text-primary); }
.vote-btn.up.voted-up { color: #fff; background: var(--accent); border-color: var(--accent); }
.vote-btn.down.voted-down { color: #fff; background: #64748b; border-color: #64748b; }
.vote-score { font-weight: 700; font-size: 14px; min-width: 18px; text-align: center; color: var(--text-primary); }
.comment-toggle {
    margin-left: auto;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 13px;
    font-family: var(--font-family);
}
.comment-toggle:hover { color: var(--accent-light); }

/* Post delete button (author/moderator) */
.post-delete-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 4px 6px;
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
}
.post-delete-btn:hover { color: var(--danger); background: rgba(239, 68, 68, 0.12); }

.comments-box { margin-top: 10px; border-top: 1px solid var(--border-glass); padding-top: 10px; }
.comment-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.comment-item { font-size: 13px; line-height: 1.4; }
.comment-author { color: var(--accent-light); font-weight: 600; margin-right: 6px; }
.comment-text { color: var(--text-secondary); word-break: break-word; }
.comment-empty, .comment-login-hint, .comment-loading { font-size: 12px; color: var(--text-muted); padding: 4px 0; }
.comment-form { display: flex; gap: 6px; }
.comment-input {
    flex: 1;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 13px;
    outline: none;
}
.comment-input:focus { border-color: var(--accent); }
.comment-send {
    padding: 8px 14px;
    background: var(--accent-gradient);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.comment-send:disabled { opacity: 0.5; }

/* Vote row inside the map popup */
.custom-popup .vote-row { margin-top: 8px; }
.custom-popup .comment-chip { margin-left: auto; font-size: 12px; color: #94a3b8; }

.feed-item:hover {
    transform: translateY(-2px);
    border-color: var(--border-glass-hover);
}

.feed-item-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 16px;
    font-size: 13px;
}

.feed-item-date {
    color: var(--text-secondary);
}

.feed-item-status {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.status-active {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
}

.status-expired {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.feed-item-content {
    font-size: 16px;
    line-height: 1.6;
    margin-bottom: 16px;
    word-break: break-word;
}

.feed-item-image {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
}

.feed-item-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 13px;
}

.feed-empty {
    text-align: center;
    padding: 60px 0;
}

.empty-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 16px;
}

.empty-cta {
    display: inline-block;
    margin-top: 24px;
    padding: 12px 24px;
    background: var(--accent-gradient);
    color: white;
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 600;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(249, 115, 22, 0.2);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 40px auto;
}

.load-more-btn {
    display: block;
    margin: 24px auto 8px;
    padding: 12px 28px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.load-more-btn:hover:not(:disabled) {
    background: rgba(249, 115, 22, 0.12);
    border-color: var(--accent);
}

.load-more-btn:disabled {
    opacity: 0.5;
    cursor: default;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.join-btn {
    padding: 8px 16px;
    background: var(--accent-gradient);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-family);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s;
}
.join-btn:hover { opacity: 0.9; }
.join-btn:disabled { opacity: 0.5; cursor: default; }

.modal-sub-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 24px 16px;
    padding: 10px 14px;
    background: rgba(249, 115, 22, 0.08);
    border: 1px solid rgba(249, 115, 22, 0.2);
    border-radius: var(--radius-sm);
}
.modal-sub-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent-light);
}
.modal-sub-value {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}

.sub-policy-hint {
    display: block;
    margin-top: 8px;
    padding: 8px 10px;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: var(--radius-sm);
    color: #f59e0b;
    font-size: 12px;
    line-height: 1.4;
}

/* ══════════════════════════════════════════════
   FEED PANEL (right drawer: a sub's feed over the map)
   ══════════════════════════════════════════════ */
.feed-panel {
    position: fixed;
    top: 0;
    right: 64px;   /* left of the fixed right rail */
    width: 400px;
    max-width: 92vw;
    height: 100vh;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-glass);
    z-index: 1400;
    display: flex;
    flex-direction: column;
    /* push an extra right:64px so it fully leaves the screen when closed
       (translateX(100%) = pushing only the panel width leaves 64px poking out on the right) */
    transform: translateX(calc(100% + 64px));
    transition: transform 0.25s ease;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
}
.feed-panel.open { transform: translateX(0); }

.feed-panel-header {
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--border-glass);
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
}
.fp-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
.fp-close {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    width: 30px;
    height: 30px;
    border-radius: 8px;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s;
}
.fp-close:hover { background: rgba(255, 255, 255, 0.12); }
.fp-title-row h2 {
    flex: 1;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.fp-actions { display: flex; align-items: center; gap: 8px; }

/* ＋ Pin button — shown on mobile only (desktop clicks the map directly) */
.fp-create-btn {
    display: none;
    align-items: center;
    gap: 4px;
    padding: 7px 12px;
    background: var(--accent-gradient, var(--accent));
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-family);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}
.fp-create-btn:active { opacity: 0.85; }
.fp-desc {
    margin-top: 10px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-secondary);
}
.fp-stats {
    display: flex;
    gap: 24px;
    margin-top: 16px;
}

.feed-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px 32px;
}

/* Feed sort toggle (newest / popular) */
.fp-sort {
    position: sticky;
    top: -16px;            /* pull up by the body's top padding to attach */
    z-index: 1;
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    margin-bottom: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
}
.fp-sort-btn {
    padding: 5px 12px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-secondary);
    font-family: var(--font-family);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.fp-sort-btn.active {
    background: var(--accent);
    color: #fff;
}
.fp-sort-btn:not(.active):hover { color: var(--text-primary); }
.fp-error {
    text-align: center;
    padding: 40px 0;
    color: var(--danger);
}

/* Invite section (settings modal) */
.invite-section { padding: 0 24px 24px; }
.invite-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 4px 0 16px;
    color: var(--text-muted);
    font-size: 12px;
}
.invite-divider::before,
.invite-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-glass);
}
.invite-result {
    margin-top: 10px;
    font-size: 13px;
}
.invite-result.invite-ok { color: var(--success); }
.invite-result.invite-err { color: var(--danger); }

/* ══════════════════════════════════════════════
   AUTH (log in / sign up)
   ══════════════════════════════════════════════ */
.auth-area {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-name-label {
    padding: 6px 12px;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-glass);
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    color: var(--accent-light);
}

.auth-btn {
    padding: 8px 18px;
    background: var(--accent-gradient);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-family);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s;
}
.auth-btn:hover { opacity: 0.9; }

.user-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px 6px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    border-radius: 999px;
    font-size: 14px;
    color: var(--text-primary);
}
.user-chip .user-avatar { color: var(--accent); font-size: 10px; }
.user-chip #user-name { font-weight: 600; }

.logout-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    font-family: var(--font-family);
    line-height: 1;
    padding: 5px 10px;
    border-radius: 8px;
    transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.logout-btn:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
}

.auth-tabs {
    display: flex;
    gap: 4px;
    padding: 0 24px;
    margin-bottom: 8px;
}
.auth-tab {
    flex: 1;
    padding: 10px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font-family: var(--font-family);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}
.auth-tab.active {
    color: var(--text-primary);
    border-bottom-color: var(--accent);
}

#auth-form { padding: 8px 24px 16px; }

.auth-input {
    width: 100%;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 14px;
    outline: none;
    transition: border-color 0.15s;
}
.auth-input:focus { border-color: var(--accent); }

.auth-error {
    margin-bottom: 12px;
    padding: 10px 12px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-sm);
    color: var(--danger);
    font-size: 13px;
}

.google-login-wrap { padding: 0 24px 24px; }
.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 4px 0 16px;
    color: var(--text-muted);
    font-size: 12px;
}
.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-glass);
}
.google-btn {
    display: block;
    text-align: center;
    padding: 12px;
    background: rgba(255, 255, 255, 0.95);
    color: #1f2937;
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 14px;
    transition: background 0.15s;
}
.google-btn:hover { background: #ffffff; }

/* Scrim (dim) behind the bottom sheet — shown on mobile only (hidden by default) */
.sheet-scrim { display: none; }

/* ── Responsive ── */
@media (max-width: 640px) {
    #top-bar {
        /* drop below the notch (status bar) so it isn't covered */
        top: calc(8px + env(safe-area-inset-top));
        left: 8px;
        right: 8px;
        padding: 10px 14px;
    }

    /* On mobile the right drawer becomes a bottom sheet, so the rail gap cover isn't needed */
    .rail-backdrop { display: none; }

    /* Scrim: below the sheets (feed 1400 / sidebar 1500), above the map and top bar */
    .sheet-scrim {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1390;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.25s ease;
    }
    .sheet-scrim.visible {
        opacity: 1;
        pointer-events: auto;
    }

    .coord-badge {
        display: none;
    }

    .modal {
        width: 95%;
        max-height: 90vh;
    }

    /* ── Mobile: right drawer → bottom sheet that slides up ── */
    /* Common: fixed to the bottom, full width, rounded top only, slides bottom→up */
    .sidebar,
    .feed-panel {
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        height: 82vh;
        max-height: 82vh;
        border-left: none;
        border-top: 1px solid var(--border-glass);
        border-radius: 18px 18px 0 0;
        box-shadow: 0 -12px 34px rgba(0, 0, 0, 0.55);
        transform: translateY(100%);
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    }
    .sidebar.open,
    .feed-panel.open {
        transform: translateY(0);
    }

    /* Show the top grabber (drag handle) — absolute so it doesn't affect layout */
    .sidebar::before,
    .feed-panel::before {
        content: '';
        position: absolute;
        top: 8px;
        left: 50%;
        transform: translateX(-50%);
        width: 40px;
        height: 4px;
        border-radius: 2px;
        background: var(--border-glass);
        z-index: 2;
        pointer-events: none;
    }
    /* top margin on the header so it doesn't overlap the grabber */
    .sidebar-header { padding-top: 22px; }
    .feed-panel-header { padding-top: 24px; }

    /* Sidebar close tab (‹): left edge → top-right close button of the sheet */
    .sidebar-collapse-btn {
        top: 12px;
        left: auto;
        right: 14px;
        transform: none;
        width: 34px;
        height: 34px;
        border: 1px solid var(--border-glass);
        border-radius: 10px;
        box-shadow: none;
    }

    /* ＋ Pin button: shown on mobile (minimize the feed sheet and create a pin by tapping the map) */
    .fp-create-btn { display: inline-flex; }

    /* Sheet body: padding for the home indicator (bottom safe area) + prevent scroll chaining */
    .sidebar-content,
    .sidebar-list,
    .feed-panel-body {
        overscroll-behavior-y: contain;
        -webkit-overflow-scrolling: touch;
    }
    .feed-panel-body {
        padding-bottom: calc(32px + env(safe-area-inset-bottom));
    }
    .sidebar-footer {
        padding-bottom: calc(16px + env(safe-area-inset-bottom));
    }

    /* Modal: generous side margins on mobile + ensure touch targets */
    .modal { width: 95%; max-height: 88vh; }
    .modal input,
    .modal textarea,
    .modal select,
    .modal .submit-btn {
        font-size: 16px;   /* prevent iOS auto-zoom on input (16px+) */
        min-height: 44px;  /* recommended touch target size */
    }
}
