
        * { box-sizing: border-box; }
        .auth-toggle { font-size: 13px; color: #555; margin-top: 12px; }
        .auth-toggle a { color: #007aff; cursor: pointer; }
        .friend-code-badge {
            display: inline-block;
            background: rgba(0,122,255,0.12);
            border: 1px solid rgba(0,122,255,0.3);
            border-radius: 8px; padding: 6px 14px;
            font-size: 18px; font-weight: bold; letter-spacing: 2px; color: #007aff;
            margin: 8px 0 2px;
        }
        .code-label { font-size: 11px; color: #888; margin-bottom: 10px; }
        /* Always-visible "add by friend code" bar pinned to the bottom of the
           Friends & Family card. Exact-code entry only -- never a directory search. */
        .friend-card-add { margin-top: 12px; padding-top: 12px; border-top: 1px dashed rgba(0,0,0,0.12); }
        .friend-card-add .fc-add-label { font-size: 12px; color: #777; margin: 0 0 6px; }
        .friend-card-add .fc-add-msg { font-size: 12px; margin-top: 4px; min-height: 16px; }
        .toggle-wrapper { display: flex; align-items: center; justify-content: center; margin: 15px 0; }
        .toggle-btn {
            width: 70px; height: 70px; border-radius: 50%;
            border: 4px solid #ccc; background: #ff3b30;
            cursor: pointer; transition: all 0.3s; font-size: 22px; color: white;
        }
        .toggle-btn.on { background: #34c759; border-color: #2db84d; box-shadow: 0 0 20px rgba(52,199,89,0.4); }
        .toggle-btn:active { transform: scale(0.95); }
        .stats { display: flex; justify-content: space-around; margin: 10px 0; }
        .stat-card { background: rgba(248,249,250,0.9); padding: 12px; border-radius: 10px; width: 45%; }
        .stat-value { font-size: 24px; font-weight: bold; color: #1a1a1a; }
        .stat-label { font-size: 11px; color: #888; margin-top: 3px; }
        .mini-map { height: 200px; width: 100%; border-radius: 10px; margin-top: 10px; border: 2px solid #e0e0e0; }
        .city-name { font-size: 11px; color: #555; margin-top: 8px; }
        #status { margin-top: 5px; font-size: 12px; color: #888; }
        #friendsSidebar {
            position: fixed; top: 0; right: 0; height: 100vh; width: 72px;
            display: flex; flex-direction: column; align-items: center;
            padding: 20px 0; gap: 14px; z-index: 10; pointer-events: none;
        }
        .friend-bubble {
            width: 52px; height: 52px; border-radius: 50%;
            border: 2px solid rgba(255,255,255,0.9);
            box-shadow: 0 2px 12px rgba(0,0,0,0.25);
            display: flex; align-items: center; justify-content: center;
            font-size: 18px; font-weight: bold; color: white;
            cursor: pointer; pointer-events: all;
            transition: transform 0.15s, box-shadow 0.15s;
            position: relative;
        }
        .friend-bubble:hover { transform: scale(1.12); box-shadow: 0 4px 18px rgba(0,0,0,0.35); }
        .friend-bubble .blabel {
            position: absolute; bottom: -16px; left: 50%; transform: translateX(-50%);
            font-size: 9px; color: white; white-space: nowrap;
            text-shadow: 0 1px 3px rgba(0,0,0,0.8);
        }
        .friend-bubble.pending-in { border-color: #ff9500; animation: pulse 1.5s infinite; }
        @keyframes pulse {
            0%,100% { box-shadow: 0 0 0 0 rgba(255,149,0,0.5); }
            50%      { box-shadow: 0 0 0 7px rgba(255,149,0,0); }
        }
        .overlay {
            position: fixed; inset: 0; background: rgba(0,0,0,0.5);
            z-index: 20; display: flex; align-items: center; justify-content: center;
        }
        .panel {
            background: white; border-radius: 16px; padding: 24px;
            width: 90%; max-width: 360px; max-height: 80vh; overflow-y: auto; position: relative;
        }
        .panel h3 { margin: 0 0 16px; font-size: 18px; }
        .close-btn { position: absolute; top: 14px; right: 16px; background: none; border: none; font-size: 22px; cursor: pointer; color: #888; }
        .friend-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid #f0f0f0; }
        .friend-row:last-child { border-bottom: none; }
        .fname { font-weight: 600; font-size: 15px; }
        .fmeta { font-size: 12px; color: #888; }
        .factions { display: flex; gap: 6px; }
        .mini-btn { padding: 5px 10px; border: none; border-radius: 6px; font-size: 12px; cursor: pointer; font-weight: 600; }
        .mini-btn.accept { background: #34c759; color: white; }
        .mini-btn.decline { background: #ff3b30; color: white; }
        .divider { border: none; border-top: 2px solid #eee; margin: 14px 0; }

        /* Chat photo messages (web/app parity). Rounded thumbnail tile that
           matches the .msg-bubble radius (shared.css: 18px). The subtle surface
           background reads as a loading tile until the X-Session blob fetch
           resolves and sets img.src. Click opens the lightbox below. */
        .msg-photo {
            display: block;
            max-width: 220px; max-height: 220px;
            width: auto; height: auto;
            border-radius: 18px;
            object-fit: cover;
            background: rgba(0,0,0,0.08);
            cursor: pointer;
            margin-top: 2px;
        }
        .msg-photo-fallback {
            max-width: 220px;
            padding: 8px 12px; border-radius: 18px;
            background: rgba(0,0,0,0.08); color: #888;
            font-size: 13px; font-style: italic;
            margin-top: 2px;
        }
        /* Full-screen lightbox shown when a .msg-photo is tapped. */
        .msg-photo-lightbox {
            display: none;
            position: fixed; inset: 0; z-index: 4000;
            background: rgba(0,0,0,0.85);
            align-items: center; justify-content: center;
            padding: 24px;
        }
        .msg-photo-lightbox-img {
            max-width: 90vw; max-height: 90vh;
            object-fit: contain;
            border-radius: 8px;
        }
        .msg-photo-lightbox-close {
            position: fixed; top: 16px; right: 20px;
            color: white; font-size: 30px; line-height: 1;
            cursor: pointer; user-select: none;
            text-shadow: 0 1px 4px rgba(0,0,0,0.6);
        }
