/* Externalized from profile/index.html for CSP. */
:root {
            --panel: rgba(17, 24, 39, .9);
            --text: #e5e7eb;
            --muted: #9ca3af;
            --accent: #2563eb;
            --accentHover: #1d4ed8;
        }

        * {
            box-sizing: border-box;
        }

        [hidden] {
            display: none !important;
        }

        body {
            margin: 0;
            background: #020617;
            color: var(--text);
            font-family: var(--seen-font);
            min-height: 100vh;
        }

        /* Main content */
        main {
            margin: 0 auto;
            padding: 0;
        }

        h1 {
            margin-top: 14px;
            margin-bottom: 6px;
            font-size: 22px;
        }

        .profile-back-row {
            display: none;
            align-items: center;
            margin-top: 12px;
            margin-bottom: 4px;
        }

        .profile-back-btn {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            padding: 6px 10px;
            border-radius: 999px;
            border: 1px solid rgba(148, 163, 184, 0.28);
            background: rgba(2, 6, 23, 0.35);
            color: #e5e7eb;
            font-weight: 800;
            font-size: 13px;
            cursor: pointer;
        }

        .profile-back-btn:hover {
            background: rgba(148, 163, 184, 0.18);
        }

        .muted {
            color: var(--muted);
            font-size: 14px;
            margin-bottom: 18px;
        }

        .field-row {
            display: flex;
            flex-direction: column;
            gap: 4px;
            margin-bottom: 12px;
        }

        label {
            font-size: 13px;
            color: var(--muted);
        }

        input,
        textarea {
            width: 100%;
            border-radius: 10px;
            border: 1px solid #334155;
            background: #020617;
            color: var(--text);
            padding: 10px;
            font-size: 14px;
        }

        textarea {
            min-height: 70px;
            resize: vertical;
        }

        .hint {
            font-size: 12px;
            color: var(--muted);
            margin-top: 4px;
        }

        .btn {
            padding: 10px 12px;
            border-radius: 12px;
            border: 1px solid rgba(148, 163, 184, .22);
            background: rgba(15, 23, 42, 0.55);
            color: rgba(226, 232, 240, .95);
            cursor: pointer;
            font-weight: 800;
        }

        .btn-primary {
            background: rgba(37, 99, 235, .95);
            border-color: rgba(37, 99, 235, .95);
            color: #fff;
        }

        .btn-primary:hover {
            background: rgba(29, 78, 216, .95);
        }

        .photo-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
            gap: 10px;
            margin-bottom: 10px;
        }

        .photo-grid img {
            width: 100%;
            height: 90px;
            object-fit: cover;
            border-radius: 8px;
            border: 1px solid rgba(255, 255, 255, 0.15);
        }

        .img-loading {
            background: linear-gradient(90deg,
                    rgba(30, 41, 59, 0.45),
                    rgba(59, 130, 246, 0.3),
                    rgba(30, 41, 59, 0.45));
            background-size: 200% 100%;
            animation: shimmer 1.15s ease-in-out infinite;
        }

        @keyframes shimmer {
            0% {
                background-position: -200% 0;
            }

            100% {
                background-position: 200% 0;
            }
        }

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

        .album-tabs {
            display: flex;
            gap: 8px;
            margin: 8px 0 10px;
            overflow-x: auto;
            padding-bottom: 2px;
        }

        .album-tab {
            border: 1px solid rgba(148, 163, 184, 0.22);
            background: rgba(148, 163, 184, 0.10);
            color: #e5e7eb;
            border-radius: 999px;
            padding: 6px 12px;
            font-size: 13px;
            white-space: nowrap;
        }

        .album-tab.active {
            background: rgba(37, 99, 235, 0.85);
            border-color: rgba(37, 99, 235, 1);
        }

        .photo-item {
            position: relative;
        }

        .photo-delete {
            position: absolute;
            top: 6px;
            right: 6px;
            width: 26px;
            height: 26px;
            border-radius: 999px;
            border: 1px solid rgba(239, 68, 68, 0.6);
            background: rgba(239, 68, 68, 0.18);
            color: #fecaca;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 16px;
            line-height: 1;
        }

        .photo-delete:hover {
            background: rgba(239, 68, 68, 0.28);
        }

        .photo-rotate {
            position: absolute;
            top: 6px;
            right: 40px;
            z-index: 3;
            width: 30px;
            height: 30px;
            border-radius: 999px;
            border: 1px solid rgba(96, 165, 250, 0.72);
            background: rgba(30, 64, 175, 0.72);
            color: #dbeafe;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 19px;
            line-height: 1;
            box-shadow: 0 6px 14px rgba(30, 64, 175, 0.38);
        }

        .photo-rotate:disabled {
            cursor: wait;
            opacity: 0.65;
        }

        .photo-main-badge {
            position: absolute;
            left: 6px;
            top: 6px;
            z-index: 2;
            padding: 4px 8px;
            border-radius: 999px;
            border: 1px solid rgba(34, 197, 94, 0.65);
            background: rgba(16, 185, 129, 0.20);
            color: #bbf7d0;
            font-size: 11px;
            font-weight: 800;
            letter-spacing: 0.04em;
            text-transform: uppercase;
        }

        .photo-main-btn {
            position: absolute;
            left: 6px;
            right: 6px;
            bottom: 6px;
            z-index: 2;
            padding: 7px 10px;
            border-radius: 10px;
            border: 1px solid rgba(59, 130, 246, 0.55);
            background: rgba(30, 64, 175, 0.72);
            color: #dbeafe;
            font-size: 12px;
            font-weight: 700;
            cursor: pointer;
        }

        .photo-main-btn:hover {
            background: rgba(37, 99, 235, 0.82);
        }

        .photo-main-btn.is-main {
            border-color: rgba(34, 197, 94, 0.75);
            background: rgba(22, 163, 74, 0.30);
            color: #dcfce7;
            cursor: default;
        }

        .photo-main-settings {
            margin-top: 10px;
            padding: 10px 12px;
            border-radius: 12px;
            border: 1px solid rgba(148, 163, 184, 0.22);
            background: rgba(2, 6, 23, 0.30);
        }

        .photo-main-settings-title {
            font-size: 12px;
            font-weight: 800;
            letter-spacing: 0.06em;
            text-transform: uppercase;
            color: rgba(191, 219, 254, 0.9);
            margin-bottom: 6px;
        }

        /* -----------------------------
   Mobile: Profile page overrides
------------------------------*/

        /* Mobile-first overrides for profile UX */
        /* View-mode profile cards */
        /* Editable profile form layout */
        /* Photo grid behavior (no cropping) */

        @media (max-width: 640px) {

            /* Prevent horizontal scroll from nav */
            body {
                overflow-x: hidden;
            }

            /* Nav: keep on one line and align right */
            body:not(.is-admin) .top-nav {
                height: auto;
                padding: 8px 12px;
                gap: 8px;
                flex-wrap: nowrap;
                align-items: center;
            }

            body:not(.is-admin) .nav-links {
                flex: 1 1 auto;
                min-width: 0;
                margin-left: auto;
                justify-content: flex-end;
                flex-wrap: nowrap;
                overflow: hidden;
                gap: 6px;
                padding-bottom: 0;
            }

            body:not(.is-admin) .nav-link {
                flex: 0 0 auto;
                padding: 8px 8px;
                font-size: 13px;
                white-space: nowrap;
            }

            /* Content spacing */
            main {
                padding: 14px 12px;
            }

            h1 {
                font-size: 20px;
            }

            .card {
                padding: 14px;
            }

            /* Inputs: stop iOS zoom and improve tap targets */
            input,
            textarea {
                font-size: 16px;
                padding: 12px;
                border-radius: 12px;
            }

            .btn {
                width: 100%;
                padding: 12px 16px;
                font-size: 16px;
            }

            /* Save/Add buttons should stack */
            #profileEdit>div[style*="display:flex"] {
                flex-direction: column;
            }

            /* Photo grid: fewer columns, bigger tiles */
            .photo-grid {
                grid-template-columns: repeat(3, minmax(0, 1fr));
                gap: 10px;
            }

            .photo-grid img {
                height: 110px;
            }

            .photo-delete {
                width: 34px;
                height: 34px;
                font-size: 18px;
            }
        }

        /* Profile detail rows (view mode) */
        #profileView .grid-2>div {
            background: rgba(15, 23, 42, 0.55);
            border: 1px solid rgba(148, 163, 184, 0.18);
            border-radius: 14px;
            padding: 10px 12px;
        }

        #profileView .label {
            font-size: 11px;
            letter-spacing: .08em;
            text-transform: uppercase;
            opacity: .75;
            margin-bottom: 4px;
        }

        #profileView .muted {
            font-size: 14px;
            line-height: 1.35;
        }

        .profile-last-seen {
            font-size: 12px;
            color: #94a3b8;
            margin-top: 4px;
            min-height: 14px;
        }

        .profile-last-seen.is-empty {
            visibility: hidden;
        }

        .profile-user-id {
            font-size: 12px;
            color: #93c5fd;
            margin: 2px 0 0;
            min-height: 14px;
            font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', monospace;
        }

        .profile-user-id.is-empty {
            display: none;
        }

        /* Chip-like lines for profile stats */
        .profile-chips {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
        }

        .profile-chip {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            padding: 6px 10px;
            border-radius: 999px;
            border: 1px solid rgba(148, 163, 184, 0.18);
            background: rgba(2, 6, 23, 0.35);
            color: rgba(226, 232, 240, 0.92);
            font-size: 13px;
            line-height: 1;
            white-space: nowrap;
        }

        .profile-chip .k {
            opacity: 0.7;
            font-weight: 800;
            font-size: 11px;
            letter-spacing: .08em;
            text-transform: uppercase;
        }

        /* ---- Profile UI upgrades ---- */
        .container {
            max-width: 980px;
            margin: 0 auto;
            padding: 18px 16px 40px;
        }

        .card {
            background: rgba(17, 24, 39, 0.75);
            border: 1px solid rgba(148, 163, 184, 0.22);
            border-radius: 16px;
            padding: 14px;
            box-shadow: 0 10px 26px rgba(0, 0, 0, 0.28);
            backdrop-filter: blur(10px);
        }

        .section-title {
            font-weight: 800;
            font-size: 13px;
            letter-spacing: .08em;
            text-transform: uppercase;
            color: rgba(226, 232, 240, .9);
            margin: 2px 0 10px;
        }

        .section-sub {
            font-size: 13px;
            color: rgba(148, 163, 184, .9);
            margin-top: -6px;
            margin-bottom: 12px;
        }

        .grid-2 {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 10px;
        }

        .choice-grid {
            display: grid;
            grid-template-columns: repeat(2, minmax(0, 1fr));
            gap: 8px;
            margin-top: 6px;
        }

        .choice-chip {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 9px 10px;
            border-radius: 12px;
            border: 1px solid rgba(148, 163, 184, .28);
            background: rgba(2, 6, 23, 0.5);
            color: rgba(226, 232, 240, 0.98);
            font-size: 13px;
            font-weight: 650;
        }

        .choice-chip input[type="checkbox"] {
            width: 16px;
            height: 16px;
            margin: 0;
            accent-color: #2563eb;
            flex: 0 0 auto;
        }

        .toggle-line {
            display: flex;
            align-items: center;
            gap: 8px;
            margin-top: 6px;
            font-size: 13px;
            color: rgba(203, 213, 225, .95);
        }

        .toggle-line input[type="checkbox"] {
            width: 16px;
            height: 16px;
            margin: 0;
            accent-color: #2563eb;
            flex: 0 0 auto;
        }

        @media (max-width: 760px) {
            .grid-2 {
                grid-template-columns: 1fr;
            }

            .choice-grid {
                grid-template-columns: 1fr;
            }
        }

        .input,
        .select,
        .textarea {
            width: 100%;
            padding: 11px 12px;
            border-radius: 12px;
            border: 1px solid rgba(148, 163, 184, .28);
            background: rgba(2, 6, 23, 0.55);
            color: rgba(226, 232, 240, 0.98);
            outline: none;
        }

        .input:focus,
        .select:focus,
        .textarea:focus {
            border-color: rgba(34, 211, 238, 0.55);
            box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.15);
        }

        .textarea {
            min-height: 110px;
            resize: vertical;
        }

        .label {
            display: block;
            font-size: 12px;
            color: rgba(148, 163, 184, .95);
            margin: 0 0 6px;
        }

        .row {
            margin-bottom: 12px;
        }

        .pillbar {
            display: flex;
            gap: 8px;
            padding: 6px;
            background: rgba(15, 23, 42, 0.55);
            border: 1px solid rgba(148, 163, 184, .18);
            border-radius: 999px;
        }

        .pillbar button {
            flex: 1;
            padding: 9px 10px;
            border-radius: 999px;
            border: none;
            cursor: pointer;
            background: transparent;
            color: rgba(226, 232, 240, .9);
            font-weight: 700;
        }

        .pillbar button.active {
            background: rgba(37, 99, 235, .95);
            color: #fff;
        }

        .photo-grid {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 10px;
        }

        @media (max-width: 520px) {
            .photo-grid {
                grid-template-columns: repeat(2, 1fr);
            }
        }

        .photo-tile {
            position: relative;
            border-radius: 16px;
            overflow: hidden;
            border: 1px solid rgba(148, 163, 184, .22);
            background: rgba(2, 6, 23, .35);
            aspect-ratio: 1/1;
        }

        .photo-tile img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            display: block;
        }

        .photo-add {
            border: 1px dashed rgba(148, 163, 184, .35);
            background: rgba(2, 6, 23, .25);
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: 800;
            color: rgba(226, 232, 240, .85);
        }

        .actions {
            display: flex;
            gap: 10px;
            align-items: center;
            justify-content: flex-end;
            margin-top: 10px;
        }

        .btn {
            padding: 10px 12px;
            border-radius: 12px;
            border: 1px solid rgba(148, 163, 184, .22);
            background: rgba(15, 23, 42, 0.55);
            color: rgba(226, 232, 240, .95);
            cursor: pointer;
            font-weight: 800;
        }

        .btn-primary {
            background: rgba(37, 99, 235, .95);
            border-color: rgba(37, 99, 235, .95);
            color: #fff;
        }

        .btn-primary:hover {
            background: rgba(29, 78, 216, .95);
        }

        /* ---- Profile photos: stop cropping, keep full image ---- */
        #profileView .photo-item,
        #profileEdit .photo-item,
        #profilePhotosEdit .photo-item {
            border-radius: 16px;
            overflow: hidden;
            border: 1px solid rgba(148, 163, 184, .22);
            background: rgba(2, 6, 23, .35);
            aspect-ratio: 1 / 1;
        }

        #profileView .photo-item img,
        #profileEdit .photo-item img,
        #profilePhotosEdit .photo-item img {
            width: 100%;
            height: 100% !important;
            object-fit: contain !important;
            /* <-- this is the key */
            display: block;
        }

        .profile-albums {
            margin-top: 18px;
            padding-top: 12px;
            border-top: 1px solid rgba(148, 163, 184, 0.22);
        }

        .profile-albums .albums-actions {
            display: flex;
            gap: 10px;
            align-items: center;
            flex-wrap: wrap;
            margin-top: 8px;
        }

        .profile-albums .album-tabs {
            margin: 0;
        }

        /* -----------------------------
           Mobile: split nav (top vs bottom)
        ------------------------------*/

        /* Mobile split-nav: keep primary actions in top nav, move Grid/Map/Chat to bottom nav on small screens */
        /* Uses --top-nav-h and --bottom-nav-h to reserve layout space and prevent UI from being covered */

        :root {
            --top-nav-h: calc(56px + env(safe-area-inset-top));
            --bottom-nav-h: 56px;
        }

        .bottom-nav {
            display: none;
            position: fixed;
            left: 0;
            right: 0;
            bottom: 0;
            height: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom));
            padding: 6px 10px calc(env(safe-area-inset-bottom) + 6px);
            background: linear-gradient(to top,
                    rgba(15, 23, 42, 0.98),
                    rgba(15, 23, 42, 0.80));
            border-top: 1px solid rgba(148, 163, 184, 0.25);
            backdrop-filter: blur(10px);
            z-index: 60;
            flex-direction: column;
            justify-content: center;
            gap: 4px;
        }

        .bottom-nav-row {
            display: flex;
            gap: 10px;
            align-items: center;
            justify-content: space-around;
        }

        .bn-link {
            flex: 1 1 0;
            text-align: center;
            padding: 10px 12px;
            border-radius: 999px;
            text-decoration: none;
            color: rgba(229, 231, 235, 0.92);
            font-weight: 800;
            font-size: 13px;
            border: 1px solid transparent;
            background: rgba(148, 163, 184, 0.10);
        }

        .bn-link:hover {
            background: rgba(148, 163, 184, 0.18);
        }

        .bn-link.active {
            background: rgba(37, 99, 235, 0.28);
            border-color: rgba(37, 99, 235, 0.38);
        }

        .bottom-nav-status {
            text-align: center;
            color: rgba(156, 163, 175, 0.95);
            font-size: 12px;
            font-weight: 750;
            text-shadow: 0 1px 2px rgba(0, 0, 0, .6);
            line-height: 1.1;
            min-height: 14px;
        }

        @media (max-width: 720px) {
            :root {
                --bottom-nav-h: 64px;
                --mobile-bottom-gap: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom) + 24px);
            }

            html,
            body {
                scroll-padding-bottom: var(--mobile-bottom-gap);
            }

            body {
                padding-bottom: var(--mobile-bottom-gap);
            }

            .nav-mobile-hide {
                display: none !important;
            }

            .bottom-nav {
                display: flex;
            }

            .bn-link {
                padding: 8px 10px;
                font-size: 12px;
            }

            .bottom-nav-status {
                font-size: 11px;
                min-height: 11px;
            }

            /* Map page: keep bottom bar from covering map */
            #map {
                bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom));
            }

            /* Chat page: keep bottom bar from covering layout */
            .chat-shell {
                height: calc(100dvh - var(--top-nav-h) - var(--bottom-nav-h));
            }
        }

        /* -----------------------------
           Profile Polish Refresh
        ------------------------------*/
        body {
            background:
                radial-gradient(110% 60% at 50% -8%, rgba(37, 99, 235, 0.24), transparent 58%),
                linear-gradient(180deg, rgba(2, 6, 23, 0.88), rgba(2, 6, 23, 1));
            background-color: #020617;
        }

        .container {
            max-width: 1020px;
            padding: 18px 16px 44px;
        }

        .profile-hero {
            border: 1px solid rgba(148, 163, 184, 0.18);
            border-radius: 18px;
            padding: 14px 16px;
            margin: 2px 0 14px;
            background: linear-gradient(135deg, rgba(15, 23, 42, 0.84), rgba(30, 64, 175, 0.14));
            box-shadow: 0 16px 34px rgba(2, 6, 23, 0.38);
        }

        #profilePageTitle {
            margin: 0;
            font-size: clamp(24px, 3.8vw, 34px);
            letter-spacing: -0.02em;
            line-height: 1.08;
        }

        .profile-subtitle {
            margin: 8px 0 0;
            font-size: 14px;
            color: rgba(191, 219, 254, 0.88);
        }

        .profile-hero-top {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            flex-wrap: wrap;
            margin-bottom: 12px;
        }

        .profile-hero-kicker {
            display: inline-flex;
            align-items: center;
            padding: 6px 10px;
            border-radius: 999px;
            border: 1px solid rgba(96, 165, 250, 0.34);
            background: rgba(30, 64, 175, 0.18);
            color: rgba(219, 234, 254, 0.96);
            font-size: 11px;
            font-weight: 800;
            letter-spacing: 0.1em;
            text-transform: uppercase;
        }

        .profile-hero-status {
            display: inline-flex;
            align-items: center;
            padding: 6px 10px;
            border-radius: 999px;
            border: 1px solid rgba(148, 163, 184, 0.24);
            background: rgba(2, 6, 23, 0.42);
            color: rgba(226, 232, 240, 0.94);
            font-size: 11px;
            font-weight: 800;
            letter-spacing: 0.08em;
            text-transform: uppercase;
        }

        .profile-hero-status[data-mode="edit"] {
            border-color: rgba(34, 211, 238, 0.36);
            background: rgba(8, 47, 73, 0.34);
            color: rgba(165, 243, 252, 0.96);
        }

        .profile-hero-status[data-mode="photos"] {
            border-color: rgba(59, 130, 246, 0.4);
            background: rgba(30, 64, 175, 0.26);
            color: rgba(219, 234, 254, 0.96);
        }

        .profile-hero-copy {
            display: grid;
            gap: 8px;
        }

        .card {
            border-radius: 18px;
            border-color: rgba(148, 163, 184, 0.24);
            box-shadow: 0 16px 34px rgba(2, 6, 23, 0.38);
            background: linear-gradient(180deg, rgba(17, 24, 39, 0.86), rgba(15, 23, 42, 0.8));
        }

        .card-mode {
            margin-top: 14px;
        }

        #profileView,
        #profileEdit,
        #profilePhotosEdit {
            display: grid;
            gap: 16px;
        }

        #viewHandle {
            margin: 0;
            font-size: clamp(24px, 3.7vw, 36px);
            letter-spacing: -0.02em;
            line-height: 1.05;
        }

        .profile-view-intro {
            display: grid;
            gap: 12px;
            padding: 16px;
            border-radius: 16px;
            border: 1px solid rgba(148, 163, 184, 0.22);
            background: linear-gradient(145deg, rgba(15, 23, 42, 0.72), rgba(30, 41, 59, 0.46));
        }

        .profile-view-kicker {
            margin: 0;
            font-size: 11px;
            font-weight: 800;
            letter-spacing: 0.1em;
            text-transform: uppercase;
            color: rgba(191, 219, 254, 0.92);
        }

        .profile-meta-row {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
        }

        .profile-meta-row .profile-user-id,
        .profile-meta-row .profile-last-seen {
            display: inline-flex;
            align-items: center;
            min-height: 0;
            margin: 0;
            padding: 6px 10px;
            border-radius: 999px;
            border: 1px solid rgba(148, 163, 184, 0.22);
            background: rgba(2, 6, 23, 0.38);
            font-size: 12px;
            line-height: 1;
        }

        .profile-meta-row .profile-user-id {
            color: #93c5fd;
        }

        .profile-meta-row .profile-last-seen {
            color: #cbd5e1;
        }

        .profile-meta-row .profile-user-id.is-empty,
        .profile-meta-row .profile-last-seen.is-empty {
            display: none;
            visibility: visible;
        }

        .profile-tagline {
            margin: 0;
            color: rgba(191, 219, 254, 0.88);
            line-height: 1.45;
        }

        #viewTags:empty,
        #viewBio:empty {
            display: none;
        }

        .profile-section {
            margin: 0;
            padding: 14px;
            border-radius: 16px;
            border: 1px solid rgba(148, 163, 184, 0.18);
            background: rgba(2, 6, 23, 0.22);
        }

        .profile-section-head {
            display: flex;
            align-items: flex-start;
            justify-content: space-between;
            gap: 10px;
            flex-wrap: wrap;
            margin-bottom: 12px;
        }

        .profile-section-head .section-title {
            margin: 0;
        }

        .profile-section-copy {
            margin: 0;
            max-width: 460px;
            font-size: 13px;
            line-height: 1.45;
            color: rgba(148, 163, 184, 0.95);
        }

        .profile-mode-header {
            display: grid;
            gap: 8px;
            padding: 2px 0;
        }

        .profile-mode-eyebrow {
            display: inline-flex;
            align-items: center;
            justify-self: start;
            padding: 6px 10px;
            border-radius: 999px;
            border: 1px solid rgba(96, 165, 250, 0.3);
            background: rgba(30, 64, 175, 0.18);
            color: rgba(219, 234, 254, 0.96);
            font-size: 11px;
            font-weight: 800;
            letter-spacing: 0.1em;
            text-transform: uppercase;
        }

        .profile-mode-title {
            margin: 0;
            font-size: clamp(22px, 3.2vw, 30px);
            line-height: 1.08;
            letter-spacing: -0.02em;
            color: #f8fafc;
        }

        .profile-mode-copy {
            margin: 0;
            max-width: 640px;
            font-size: 14px;
            line-height: 1.5;
            color: rgba(191, 219, 254, 0.88);
        }

        .profile-bio {
            margin: 0;
            padding: 12px 14px;
            border-radius: 14px;
            border: 1px solid rgba(148, 163, 184, 0.2);
            background: rgba(2, 6, 23, 0.3);
            line-height: 1.5;
            color: rgba(226, 232, 240, 0.96);
            min-height: 42px;
        }

        .profile-instagram {
            display: grid;
            gap: 10px;
            margin: 0;
            padding: 12px 14px;
            border-radius: 14px;
            border: 1px solid rgba(236, 72, 153, 0.32);
            background: linear-gradient(145deg, rgba(76, 29, 149, 0.22), rgba(190, 24, 93, 0.12));
        }

        .profile-instagram-head {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
            flex-wrap: wrap;
        }

        .profile-instagram-label {
            font-size: 11px;
            font-weight: 800;
            letter-spacing: 0.1em;
            text-transform: uppercase;
            color: rgba(244, 114, 182, 0.96);
        }

        .profile-instagram-link {
            font-size: 13px;
            font-weight: 700;
            color: rgba(224, 231, 255, 0.98);
            text-decoration: none;
        }

        .profile-instagram-link:hover {
            text-decoration: underline;
        }

        .profile-instagram-status {
            margin: 0;
            font-size: 12px;
            color: rgba(226, 232, 240, 0.88);
        }

        .profile-instagram-grid {
            display: grid;
            grid-template-columns: repeat(3, minmax(0, 1fr));
            gap: 8px;
        }

        .profile-instagram-grid:empty {
            display: none;
        }

        .profile-instagram-photo {
            border-radius: 12px;
            border: 1px solid rgba(148, 163, 184, 0.24);
            overflow: hidden;
            background: rgba(15, 23, 42, 0.46);
            aspect-ratio: 1 / 1;
        }

        .profile-instagram-photo img {
            width: 100%;
            height: 100%;
            display: block;
            object-fit: cover;
        }

        .profile-action-row {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
            gap: 10px;
            margin-top: 12px;
        }

        .profile-action-row .btn {
            min-height: 40px;
            padding: 10px 14px;
            width: 100%;
        }

        .profile-upload-queue-card {
            display: none;
            margin-top: 12px;
            padding: 13px;
            border: 1px solid rgba(96, 165, 250, 0.34);
            border-radius: 14px;
            background: rgba(30, 64, 175, 0.12);
        }
        .profile-upload-queue-card.show { display: block; }
        .profile-upload-queue-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
        .profile-upload-queue-title { font-weight: 850; color: #dbeafe; }
        .profile-upload-queue-copy { margin-top: 3px; color: #93c5fd; font-size: 12px; line-height: 1.4; }
        .profile-upload-queue-list { display: grid; gap: 7px; margin-top: 11px; }
        .profile-upload-queue-item { padding: 9px 10px; border-radius: 10px; background: rgba(15, 23, 42, 0.45); }
        .profile-upload-queue-name { font-size: 12px; font-weight: 800; color: #e2e8f0; overflow-wrap: anywhere; }
        .profile-upload-queue-meta { margin-top: 3px; font-size: 11px; color: #94a3b8; }
        .profile-upload-queue-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 11px; }

        .profile-public-actions {
            margin-top: 4px;
            display: grid;
            gap: 10px;
            padding: 12px;
            border-radius: 14px;
            border: 1px solid rgba(148, 163, 184, 0.18);
            background: rgba(2, 6, 23, 0.26);
        }

        #profileView .profile-action-row {
            margin-top: 4px;
            padding: 12px;
            border-radius: 14px;
            border: 1px solid rgba(148, 163, 184, 0.18);
            background: rgba(2, 6, 23, 0.24);
        }

        .profile-public-action-row {
            display: grid;
            grid-template-columns: auto repeat(3, minmax(0, 1fr));
            gap: 8px;
            align-items: center;
        }

        .profile-public-action-btn {
            border: 1px solid rgba(148, 163, 184, 0.28);
            border-radius: 12px;
            min-height: 40px;
            padding: 10px 10px;
            font-size: 13px;
            font-weight: 800;
            cursor: pointer;
            color: rgba(229, 231, 235, 0.95);
            background: rgba(2, 6, 23, 0.85);
            display: inline-flex;
            align-items: center;
            justify-content: center;
            text-align: center;
            white-space: nowrap;
            min-width: 0;
            width: 100%;
            transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
        }

        .profile-public-action-btn:hover {
            transform: translateY(-1px);
            border-color: rgba(96, 165, 250, 0.58);
        }

        .profile-public-action-btn.menu {
            width: 40px;
            min-width: 40px;
            padding: 0;
            border-radius: 12px;
            color: rgba(191, 219, 254, 0.95);
        }

        .profile-public-action-btn.menu svg {
            width: 18px;
            height: 18px;
            display: block;
        }

        .profile-public-action-btn.chat {
            background: rgba(37, 99, 235, 0.92);
            border-color: rgba(37, 99, 235, 0.6);
            color: #fff;
        }

        .profile-public-action-btn.seen {
            background: rgba(148, 163, 184, 0.16);
            border-color: rgba(148, 163, 184, 0.4);
        }

        .profile-public-action-btn.match {
            background: rgba(14, 165, 233, 0.22);
            border-color: rgba(56, 189, 248, 0.42);
        }

        .profile-public-action-btn.is-added {
            background: rgba(34, 197, 94, 0.2);
            border-color: rgba(34, 197, 94, 0.46);
            color: #dcfce7;
        }

        .profile-public-action-btn.is-pending {
            background: rgba(34, 197, 94, 0.2);
            border-color: rgba(34, 197, 94, 0.46);
            color: #dcfce7;
        }

        .profile-public-action-btn[disabled] {
            opacity: 0.55;
            cursor: not-allowed;
        }

        .profile-public-action-menu {
            display: none;
            background: rgba(15, 23, 42, 0.82);
            border-radius: 14px;
            padding: 10px;
            border: 1px solid rgba(148, 163, 184, 0.28);
            gap: 8px;
        }

        .profile-public-action-menu.open {
            display: grid;
        }

        .profile-public-action-menu-title {
            font-size: 11px;
            font-weight: 800;
            letter-spacing: 0.1em;
            text-transform: uppercase;
            text-align: center;
            color: rgba(191, 219, 254, 0.96);
        }

        .profile-public-action-menu-grid {
            display: grid;
            grid-template-columns: repeat(2, minmax(0, 1fr));
            gap: 8px;
        }

        .profile-public-action-menu-btn {
            border-radius: 10px;
            border: 0;
            padding: 9px 8px;
            font-weight: 800;
            font-size: 12px;
            background: rgba(2, 6, 23, 0.88);
            color: rgba(229, 231, 235, 0.95);
            cursor: pointer;
            box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
            white-space: nowrap;
        }

        .profile-public-action-menu-btn:hover {
            box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.5);
        }

        .profile-public-action-menu-btn.danger {
            color: #fca5a5;
        }

        .profile-public-action-menu-btn[disabled] {
            opacity: 0.55;
            cursor: not-allowed;
        }

        .profile-basics-modal {
            position: fixed;
            inset: 0;
            z-index: 1400;
            display: none;
            align-items: center;
            justify-content: center;
            padding: 16px;
            background: rgba(2, 6, 23, 0.78);
            backdrop-filter: blur(8px);
        }

        .profile-basics-modal.open {
            display: flex;
        }

        .profile-basics-card {
            width: min(520px, 96vw);
            border-radius: 16px;
            border: 1px solid rgba(148, 163, 184, 0.28);
            background: rgba(15, 23, 42, 0.96);
            box-shadow: 0 24px 56px rgba(2, 6, 23, 0.5);
            padding: 16px;
            display: grid;
            gap: 12px;
        }

        .profile-basics-title {
            margin: 0;
            font-size: 19px;
            font-weight: 900;
            color: #f8fafc;
            letter-spacing: -0.01em;
        }

        .profile-basics-copy {
            margin: 0;
            font-size: 14px;
            line-height: 1.45;
            color: rgba(226, 232, 240, 0.95);
        }

        .profile-basics-actions {
            display: flex;
            justify-content: flex-end;
            gap: 8px;
            flex-wrap: wrap;
        }

        .profile-basics-btn {
            border-radius: 12px;
            border: 1px solid rgba(148, 163, 184, 0.3);
            background: rgba(15, 23, 42, 0.55);
            color: rgba(226, 232, 240, 0.95);
            font-size: 13px;
            font-weight: 800;
            min-height: 40px;
            padding: 8px 14px;
            cursor: pointer;
        }

        .profile-basics-btn.primary {
            border-color: rgba(37, 99, 235, 0.68);
            background: rgba(37, 99, 235, 0.95);
            color: #ffffff;
        }

        .basics-disabled-banner {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            margin: 0 0 16px;
            padding: 12px 14px;
            border-radius: 16px;
            border: 1px solid rgba(96, 165, 250, 0.28);
            background: rgba(2, 6, 23, 0.84);
            color: #dbeafe;
            box-shadow: 0 14px 28px rgba(2, 6, 23, 0.22);
        }

        .basics-disabled-banner[hidden] {
            display: none;
        }

        .basics-disabled-banner-copy {
            margin: 0;
            font-size: 13px;
            line-height: 1.45;
        }

        .basics-disabled-banner-btn {
            border: 1px solid rgba(37, 99, 235, 0.78);
            background: linear-gradient(135deg, #2563eb, #06b6d4);
            color: #eff6ff;
            border-radius: 999px;
            min-height: 40px;
            padding: 9px 14px;
            font-size: 13px;
            font-weight: 800;
            cursor: pointer;
            white-space: nowrap;
        }

        #profileEdit .field-row {
            padding: 12px;
            border-radius: 14px;
            border: 1px solid rgba(148, 163, 184, 0.18);
            background: rgba(2, 6, 23, 0.24);
            margin-bottom: 12px;
        }

        #profileEdit .field-row>label:first-child {
            font-size: 11px;
            letter-spacing: 0.07em;
            text-transform: uppercase;
            color: rgba(191, 219, 254, 0.9);
            font-weight: 800;
        }

        #profileView .photo-grid,
        #profilePhotosEdit .photo-grid {
            margin-top: 12px;
            grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
            gap: 12px;
        }

        .photo-item {
            border-radius: 16px;
            border: 1px solid rgba(148, 163, 184, 0.24);
            background: rgba(2, 6, 23, 0.35);
        }

        .photo-delete {
            box-shadow: 0 6px 14px rgba(127, 29, 29, 0.35);
        }

        .empty-grid-state {
            grid-column: 1 / -1;
            min-height: 120px;
            display: flex;
            align-items: center;
            justify-content: center;
            text-align: center;
            border-radius: 14px;
            border: 1px dashed rgba(148, 163, 184, 0.32);
            background: rgba(2, 6, 23, 0.28);
            color: rgba(148, 163, 184, 0.95);
            font-size: 13px;
            padding: 12px;
        }

        .album-tab {
            font-weight: 700;
            transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
        }

        .album-tab:hover {
            transform: translateY(-1px);
            border-color: rgba(59, 130, 246, 0.55);
            background: rgba(30, 64, 175, 0.26);
        }

        .btn {
            transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
        }

        .btn:hover {
            transform: translateY(-1px);
            border-color: rgba(59, 130, 246, 0.5);
        }

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

        @media (max-width: 760px) {
            .container {
                padding: 14px 12px 120px;
            }

            .profile-hero {
                border-radius: 16px;
                padding: 12px 13px;
            }

            .profile-hero-top,
            .profile-section-head {
                align-items: flex-start;
            }

            .profile-view-intro,
            .profile-section {
                padding: 13px;
            }

            .profile-action-row .btn {
                width: 100%;
            }

            .profile-public-action-row {
                grid-template-columns: repeat(2, minmax(0, 1fr));
            }

            .profile-public-action-btn.menu {
                width: 100%;
                min-width: 0;
            }

            #profileView .photo-grid,
            #profilePhotosEdit .photo-grid {
                grid-template-columns: repeat(2, minmax(0, 1fr));
                gap: 10px;
            }
        }
