        :root {
            --paper: #e8e4db;
            --ink: #1a1a1a;
            --accent: #2d5a27;
            --river-blue: #3a5a78;
            --grain-intensity: 0.15;
            --topo-line: rgba(26, 26, 26, 0.08);
            --highlight: #28a745;
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            -webkit-font-smoothing: antialiased;
        }

        body {
            background: var(--paper);
            color: var(--ink);
            font-family: 'Inter', sans-serif;
            height: 100vh;
            overflow: hidden;
            display: flex;
        }

        body::before {
            content: "";
            position: fixed;
            inset: 0;
            pointer-events: none;
            z-index: 9999;
            opacity: var(--grain-intensity);
            background: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
        }

        .topo-canvas {
            position: fixed;
            inset: 0;
            z-index: 0;
            background-image: radial-gradient(circle at 2px 2px, var(--topo-line) 1px, transparent 0);
            background-size: 40px 40px;
        }

        .sidebar {
            width: 420px;
            height: 100vh;
            background: var(--paper);
            border-right: 1.5px solid var(--ink);
            z-index: 10;
            display: flex;
            flex-direction: column;
            box-shadow: 10px 0 30px rgba(0, 0, 0, 0.05);
        }

        .header {
            padding: 40px 40px 20px;
            border-bottom: 1.5px solid var(--ink);
            display: flex;
            align-items: flex-start;
            justify-content: space-between;
        }

        .header-text {
            flex: 1;
        }

        .header h1 {
            font-size: 11px;
            text-transform: uppercase;
            letter-spacing: 0.5em;
            font-weight: 800;
            margin-bottom: 8px;
        }

        .header p {
            font-family: 'Space Mono', monospace;
            font-size: 12px;
            opacity: 0.7;
        }

        /* ─── LIST TOGGLE BUTTON (mobile only) ──────────────── */
        .list-toggle-btn {
            display: none;
            /* hidden on desktop */
            flex-shrink: 0;
            margin-top: 2px;
            margin-left: 16px;
            width: 36px;
            height: 36px;
            background: var(--ink);
            color: var(--paper);
            border: none;
            border-radius: 4px;
            cursor: pointer;
            font-size: 18px;
            line-height: 1;
            align-items: center;
            justify-content: center;
            transition: background 0.2s, transform 0.2s;
        }

        .list-toggle-btn:hover {
            background: #444;
            transform: scale(1.08);
        }

        /* river-list collapse */
        .river-list {
            flex: 1;
            overflow-y: auto;
            padding-bottom: 40px;
            scrollbar-width: none;
            transition: max-height 0.35s ease, opacity 0.3s ease;
        }

        .river-list.collapsed {
            max-height: 0 !important;
            overflow: hidden;
            opacity: 0;
        }

        .river-list::-webkit-scrollbar {
            display: none;
        }

        .river-item {
            padding: 28px 40px;
            border-bottom: 1px solid rgba(0, 0, 0, 0.05);
            cursor: pointer;
            transition: all 0.35s ease;
        }

        .river-item:hover {
            background: rgba(0, 0, 0, 0.025);
            padding-left: 52px;
        }

        .river-item.active {
            background: var(--ink);
            color: var(--paper);
        }

        .river-item .meta {
            font-family: 'Space Mono', monospace;
            font-size: 10px;
            margin-bottom: 6px;
            opacity: 0.75;
            display: block;
        }

        .river-item .name {
            font-size: 23px;
            font-weight: 800;
            display: flex;
            justify-content: space-between;
            align-items: baseline;
        }

        .river-item .length {
            font-family: 'Space Mono', monospace;
            font-size: 13px;
        }

        /* ─── MAP AREA ──────────────────────────────────────── */
        .viewport {
            flex: 1;
            position: relative;
            z-index: 5;
        }

        #map {
            width: 100%;
            height: 100%;
        }

        /* ─── RIVER CARD ────────────────────────────────────── */
        .river-card {
            position: absolute;
            top: 40px;
            right: 40px;
            width: 520px;
            max-height: 85vh;
            background: var(--paper);
            border: 1.5px solid var(--ink);
            box-shadow: 24px 24px 0 rgba(0, 0, 0, 0.12);
            transform: rotate(-1deg);
            transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
            z-index: 100;
            overflow: hidden;
            pointer-events: all;
        }

        .river-card.minimized {
            height: 60px;
            top: auto;
            bottom: 30px;
            right: 40px;
            transform: rotate(0deg);
            overflow: hidden;
            padding: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
        }

        .river-card.minimized .card-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            width: 100%;
            padding: 0 20px;
        }

        .river-card.minimized .card-title {
            font-size: 22px;
            margin: 0;
        }

        .river-card .card-header {
            position: relative;
            padding: 30px 40px 10px;
        }

        .close-btn {
            position: absolute;
            top: 20px;
            right: 25px;
            width: 32px;
            height: 32px;
            background: var(--ink);
            color: var(--paper);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            font-size: 18px;
            font-weight: bold;
            transition: all 0.3s;
            z-index: 101;
        }

        .close-btn:hover {
            transform: scale(1.15);
            background: #444;
        }

        .card-label {
            font-family: 'Space Mono', monospace;
            font-size: 11px;
            text-transform: uppercase;
            border: 1px solid var(--ink);
            padding: 4px 14px;
            margin-bottom: 20px;
            display: inline-block;
        }

        .card-title {
            font-size: 58px;
            font-weight: 800;
            line-height: 0.9;
            margin-bottom: 20px;
            letter-spacing: -0.03em;
        }

        .card-stats {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 24px;
            padding: 30px 40px;
            border-top: 1.5px solid var(--ink);
        }

        .stat-box .label {
            font-size: 10px;
            text-transform: uppercase;
            font-weight: 800;
            opacity: 0.55;
            margin-bottom: 6px;
        }

        .stat-box .value {
            font-family: 'Space Mono', monospace;
            font-size: 19px;
        }

        .card-details {
            padding: 0 40px 40px;
            font-size: 15px;
            line-height: 1.5;
        }

        .card-details p {
            margin: 16px 0;
        }

        .card-details strong {
            color: var(--accent);
        }

        /* ─── MOBILE RESPONSIVE ─────────────────────────────────── */
        @media (max-width: 900px) {
            body {
                flex-direction: column;
            }

            .sidebar {
                width: 100%;
                height: auto;
                max-height: 35vh;
                border-right: none;
                border-bottom: 1.5px solid var(--ink);
                box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
                transition: max-height 0.35s ease;
            }

            .sidebar.list-hidden {
                max-height: none;
                /* just the header row */
            }

            .header {
                padding: 14px 16px;
            }

            .list-toggle-btn {
                display: flex;
            }

            .river-card {
                position: absolute;
                bottom: 20px;
                left: 20px;
                right: 20px;
                top: auto;
                width: auto;
                transform: rotate(0deg);
                max-height: 45vh;
                overflow-y: auto;
            }

            .river-card.minimized {
                bottom: 20px;
                left: 15px;
                /* slightly smaller margins for mobile */
                right: 15px;
                max-height: 64px;
                /* give it a tiny bit more room */
                overflow: hidden;
            }

            .river-card.minimized .card-header {
                padding: 0 15px;
                /* less padding for compact view */
            }

            .river-card.minimized .card-label {
                display: none;
                /* hide label on minimized mobile */
            }

            .river-card.minimized .header-title-wrap {
                display: flex;
                flex-direction: column;
                justify-content: center;
            }

            .river-card.minimized .card-title {
                font-size: 24px;
                margin: 0 0 2px 0;
                line-height: 1;
            }

            .mini-stats {
                display: none;
                /* hidden globally, shown only when minimized on mobile */
            }

            .river-card.minimized .mini-stats {
                display: block;
                font-size: 10px;
                font-family: 'Space Mono', monospace;
                text-transform: uppercase;
                opacity: 0.8;
                color: var(--accent);
                /* subtle highlight to make info pop */
                font-weight: bold;
            }

            .card-title {
                font-size: 36px;
                margin-bottom: 10px;
            }

            .card-label {
                margin-bottom: 10px;
            }

            .river-card .card-header {
                padding: 15px 20px 5px;
            }

            .card-stats {
                grid-template-columns: 1fr 1fr;
                gap: 12px;
                padding: 15px 20px;
            }

            .stat-box .value {
                font-size: 15px;
            }

            .card-details {
                padding: 0 20px 20px;
                font-size: 14px;
            }

            .card-details p {
                margin: 8px 0;
            }
        }

        @media (max-width: 600px) {
            .header {
                padding: 20px 15px 10px;
            }

            .river-item {
                padding: 18px 20px;
            }

            .river-item .name {
                font-size: 18px;
            }

            .river-card {
                left: 10px;
                right: 10px;
                bottom: 10px;
            }

            .river-card.minimized {
                left: 10px;
                right: 10px;
                bottom: 10px;
            }
        }