* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { overscroll-behavior: none; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: #121212; color: #e0e0e0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; }
a { color: #ffd600; }

/* Header */
header { background: #1e1e1e; padding: 12px 20px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid #333; }
header h1 { font-size: 18px; color: #ffd600; flex: 1; }
#status { font-size: 12px; padding: 4px 10px; border-radius: 12px; background: #333; }
#status.connected { background: #2e7d32; color: #fff; }
#status.error { background: #c62828; color: #fff; }
#logout-btn:hover { background: #444; }

/* Login — enterprise portal style */
#login { display: flex; flex-direction: column; align-items: center; justify-content: center; flex: 1; gap: 0; background: #dcdcdc; font-family: Verdana, Geneva, Tahoma, sans-serif; }
#login .login-header { background: #335e8a; color: #fff; padding: 14px 32px; width: 370px; border: 1px solid #264a6e; border-bottom: none; }
#login .login-header h1 { font-size: 15px; font-weight: 700; margin: 0; color: #fff; letter-spacing: 0.3px; }
#login .login-header p { font-size: 10px; margin: 3px 0 0 0; color: #a8c4e0; font-weight: 400; }
#login .login-box { background: #f5f5f0; border: 1px solid #a0a0a0; padding: 24px 32px; width: 370px; box-shadow: 1px 1px 4px rgba(0,0,0,0.1); }
#login .login-box label { display: block; color: #444; font-size: 11px; font-weight: 700; margin-bottom: 3px; }
#login .login-box input[type="email"],
#login .login-box input[type="password"] { background: #fff; border: 1px solid #999; color: #333; padding: 7px 8px; border-radius: 1px; font-size: 13px; width: 100%; box-sizing: border-box; margin-bottom: 12px; font-family: Verdana, Geneva, Tahoma, sans-serif; }
#login .login-box input:focus { border-color: #335e8a; outline: none; }
#login .login-box .login-btn { background: #335e8a; color: #fff; border: 1px solid #264a6e; padding: 7px 28px; border-radius: 1px; font-size: 11px; cursor: pointer; font-weight: 700; font-family: Verdana, Geneva, Tahoma, sans-serif; text-transform: uppercase; letter-spacing: 0.5px; }
#login .login-box .login-btn:hover { background: #264a6e; }
#login .login-box details { margin-top: 8px; }
#login .login-box details summary { color: #335e8a; font-size: 11px; cursor: pointer; }
#login .login-box details p { font-family: Verdana, Geneva, Tahoma, sans-serif; }
#login .login-box details button { background: #e8e8e8; color: #333; border: 1px solid #999; padding: 3px 10px; border-radius: 1px; font-size: 10px; cursor: pointer; font-family: Verdana, Geneva, Tahoma, sans-serif; }
#login .login-footer { color: #888; font-size: 9px; margin-top: 16px; font-family: Verdana, Geneva, Tahoma, sans-serif; text-align: center; }
#login #login-error { color: #c00; font-size: 11px; margin: 8px 0 0 0; font-family: Verdana, Geneva, Tahoma, sans-serif; }

/* Main layout */
#app { display: none; flex: 1; overflow: hidden; overscroll-behavior: none; }
nav { background: #1e1e1e; display: flex; border-bottom: 1px solid #333; align-items: center; }
.nav-status { display: none; }
.grid-filter-toggle { display: none; }
nav button { flex: 1; background: none; border: none; padding: 10px 0; font-size: 20px; cursor: pointer; border-bottom: 2px solid transparent; text-align: center; line-height: 1; }
nav button.active { border-bottom-color: #ffd600; }
nav button:hover { background: #2a2a2a; }

/* Panels */
.panel { display: none; flex: 1; overflow-y: auto; overscroll-behavior: contain; }
.panel.active { display: flex; flex-direction: column; }
#map-panel { padding: 0; position: relative; }
#map-panel.active { display: flex; }
#map { flex: 1; min-height: 0; }
#map-info { position: absolute; top: 10px; right: 10px; z-index: 1000; background: rgba(18,18,18,0.9); color: #e0e0e0; padding: 10px 14px; border-radius: 8px; font-size: 13px; max-width: 280px; pointer-events: none; }
#map-info b { color: #ffd600; }
.leaflet-popup { z-index: 10000 !important; }
.leaflet-popup-content-wrapper { background: #1e1e1e !important; color: #e0e0e0 !important; border-radius: 8px !important; }
.leaflet-popup-tip { background: #1e1e1e !important; }
.leaflet-popup-content { margin: 10px 14px !important; }

/* Inbox */
.conversation { display: flex; align-items: center; padding: 12px 16px; border-bottom: 1px solid #222; cursor: pointer; gap: 12px; }
.conversation:hover { background: #1e1e1e; }
.dot-filter { width: 18px; height: 18px; border-radius: 50%; cursor: pointer; opacity: 1; transition: opacity 0.2s; }
.dot-filter:not(.active) { opacity: 0.25; }
.conv-avatar-wrap { position: relative; flex-shrink: 0; }
.conv-avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; flex-shrink: 0; background: #333; }
.conv-avatar-placeholder { width: 44px; height: 44px; border-radius: 50%; background: #333; display: flex; align-items: center; justify-content: center; font-size: 20px; color: #666; flex-shrink: 0; }
.conv-online-dot { position: absolute; bottom: -1px; right: -1px; width: 14px; height: 14px; border-radius: 50%; border: 2px solid #121212; }
.conv-online-dot.online { background: #00e676; }
.conversation .name { font-weight: 600; font-size: 14px; }
.conversation .meta { font-size: 12px; color: #888; margin-top: 2px; }
.conversation .unread { background: #ffd600; color: #000; border-radius: 50%; min-width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; }

/* Chat */
#chat { overflow: hidden; }
#messages { overscroll-behavior: contain; }
#chat-header { background: #1e1e1e; padding: 12px 16px; border-bottom: 1px solid #333; display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
#chat-header button { background: none; border: none; color: #ffd600; font-size: 20px; cursor: pointer; }
#chat-header .chat-name { font-weight: 600; font-size: 15px; }
#messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.msg { padding: 8px 14px; border-radius: 16px; font-size: inherit; line-height: 1.4; word-wrap: break-word; }
.msg.sent { background: #005c4b; align-self: flex-end; border-bottom-right-radius: 4px; }
.msg.received { background: #1e1e1e; align-self: flex-start; border-bottom-left-radius: 4px; }
.msg img { max-width: 100%; border-radius: 8px; cursor: pointer; display: block; }
.msg .reply-quote { background: rgba(255,255,255,0.08); border-left: 3px solid #ffd600; padding: 4px 8px; margin-bottom: 6px; border-radius: 4px; font-size: 12px; cursor: pointer; }
.msg .reply-quote .reply-name { color: #ffd600; font-weight: 600; font-size: 11px; }
.msg .reply-quote .reply-text { color: #aaa; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 250px; }
.msg .reactions { display: flex; gap: 2px; margin-top: 2px; }
.msg .reaction-badge { font-size: 14px; cursor: pointer; background: rgba(255,255,255,0.08); padding: 1px 4px; border-radius: 8px; }
.react-btn { position: absolute; top: 4px; right: -56px; background: #333; color: #888; border: none; width: 24px; height: 24px; border-radius: 50%; cursor: pointer; font-size: 12px; display: none; align-items: center; justify-content: center; z-index: 2; }
div:hover > .react-btn { display: flex; }
.reply-btn { position: absolute; top: 4px; right: -28px; background: #333; color: #888; border: none; width: 24px; height: 24px; border-radius: 50%; cursor: pointer; font-size: 12px; display: none; align-items: center; justify-content: center; z-index: 2; }
div:hover > .reply-btn { display: flex; }
#reply-preview { background: #1e1e1e; border-top: 1px solid #333; border-left: 3px solid #ffd600; padding: 8px 12px; display: none; align-items: center; gap: 8px; }
#reply-preview .reply-content { flex: 1; min-width: 0; }
#reply-preview .reply-name { color: #ffd600; font-size: 12px; font-weight: 600; }
#reply-preview .reply-text { color: #888; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#reply-preview .reply-close { background: none; border: none; color: #888; font-size: 18px; cursor: pointer; }
.msg .time { font-size: 13px; color: #888; margin-top: 4px; display: flex; align-items: center; gap: 4px; justify-content: flex-end; }
.msg .status { font-size: 16px; font-weight: 700; letter-spacing: -2px; }
.msg .status.read { color: #53bdeb; }
.msg .status.delivered { color: #aaa; }
.msg .status.sent { color: #aaa; }
.date-divider { display: flex; align-items: center; gap: 12px; padding: 12px 16px 4px; align-self: stretch; }
.date-divider::before, .date-divider::after { content: ''; flex: 1; height: 1px; background: #333; }
.date-divider span { font-size: 12px; color: #888; white-space: nowrap; }
.translate-msg-btn { background: none; border: none; font-size: 12px; cursor: pointer; opacity: 0.4; padding: 2px; vertical-align: middle; }
.translate-msg-btn:hover, .translate-msg-btn:active { opacity: 1; }
.msg-translation { font-size: 12px; color: #53bdeb; padding: 4px 8px; font-style: italic; }
#chat-input { display: flex; padding: 8px 8px max(8px, env(safe-area-inset-bottom)); gap: 8px; background: #1e1e1e; border-top: 1px solid #333; flex-shrink: 0; align-items: center; }
#chat-input #msg-input { flex: 1; background: #2a2a2a; border: none; color: #e0e0e0; padding: 10px 14px; border-radius: 20px; font-size: 14px; outline: none; min-width: 0; overflow-y: auto; max-height: 100px; word-break: break-word; -webkit-user-select: text; user-select: text; }
#chat-input #msg-input:empty::before { content: attr(data-placeholder); color: #666; pointer-events: none; }
#chat-input button { background: #ffd600; color: #000; border: none; width: 40px; height: 40px; border-radius: 50%; cursor: pointer; font-size: 18px; flex-shrink: 0; }
.chat-plus-btn { background: #333 !important; color: #ccc !important; font-size: 24px !important; font-weight: 300; line-height: 1; }

/* Media tray buttons */
.media-tray-btn {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    background: none; border: none; cursor: pointer; color: #ccc;
    padding: 10px 12px; min-width: 60px;
    -webkit-tap-highlight-color: transparent;
}
.media-tray-btn:active { background: rgba(255,255,255,0.06); border-radius: 8px; }
.media-icon { font-size: 24px; }
.media-label { font-size: 11px; color: #888; }

/* Grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--grid-size, 140px), 1fr)); gap: 2px; padding: 2px; }
.grid-item { position: relative; aspect-ratio: 3/4; background: #1e1e1e; overflow: hidden; cursor: pointer; }
.grid-item img { width: 100%; height: 100%; object-fit: cover; }
.grid-item .overlay { position: absolute; bottom: 0; left: 0; right: 0; padding: 8px; background: linear-gradient(transparent, rgba(0,0,0,0.8)); }
.grid-item .overlay .name { font-size: 13px; font-weight: 600; }
.grid-item .overlay .dist { font-size: 11px; color: #ccc; }
.grid-item .boost { position: absolute; top: 6px; right: 6px; background: #ffd600; color: #000; font-size: 10px; padding: 2px 6px; border-radius: 4px; font-weight: 700; }
.grid-item .unread-badge { position: absolute; top: 6px; right: 6px; background: #ff1744; color: #fff; font-size: 10px; min-width: 18px; height: 18px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-weight: 700; padding: 0 4px; }
.grid-item .online-dot { position: absolute; top: 6px; left: 6px; width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(0,0,0,0.4); }
.grid-item .online-dot.online { background: #00e676; }
.grid-item .placeholder { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 40px; color: #444; }
.grid-item .chat-badge { position: absolute; top: 6px; right: 6px; font-size: 11px; line-height: 1; padding: 3px 4px; border-radius: 50%; pointer-events: none; box-shadow: 0 0 0 2px rgba(0,0,0,0.4); }
.grid-item .chat-badge.fresh { background: rgba(255, 40, 120, 0.95); opacity: 1; animation: chatPulse 1.8s ease-in-out infinite; }
.grid-item .chat-badge.hot  { background: rgba(255, 80, 40, 0.9);   opacity: 1; }
.grid-item .chat-badge.warm { background: rgba(255, 180, 40, 0.85); opacity: 0.95; }
.grid-item .chat-badge.cool { background: rgba(80, 160, 200, 0.8);  opacity: 0.85; }
.grid-item .chat-badge.cold { background: rgba(110, 110, 110, 0.7); opacity: 0.65; }
@keyframes chatPulse {
    0%, 100% { box-shadow: 0 0 0 2px rgba(0,0,0,0.4), 0 0 0 0 rgba(255,40,120,0.5); }
    50%      { box-shadow: 0 0 0 2px rgba(0,0,0,0.4), 0 0 0 6px rgba(255,40,120,0); }
}

/* Viewed Me */
.viewed-item { display: flex; align-items: center; padding: 12px 16px; border-bottom: 1px solid #222; gap: 12px; }
.viewed-item img { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; }
.viewed-item .avatar-placeholder { width: 48px; height: 48px; border-radius: 50%; background: #333; display: flex; align-items: center; justify-content: center; font-size: 20px; color: #666; }
.viewed-item .info { flex: 1; }
.viewed-item .info .name { font-weight: 600; font-size: 14px; }
.viewed-item .info .time { font-size: 12px; color: #888; }
.viewed-item .copy-btn { background: none; border: 1px solid #444; color: #888; padding: 4px 10px; border-radius: 4px; font-size: 11px; cursor: pointer; }

/* Blocked profiles */
.block-item { display: flex; align-items: center; padding: 12px 16px; border-bottom: 1px solid #222; gap: 12px; }
.block-item img { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; background: #333; }
.block-item .avatar-placeholder { width: 48px; height: 48px; border-radius: 50%; background: #333; display: flex; align-items: center; justify-content: center; font-size: 20px; color: #666; }
.block-item .info { flex: 1; }
.block-item .info .name { font-weight: 600; font-size: 14px; }
.block-item .info .pid { font-size: 12px; color: #888; }
.block-item .unblock-btn { background: #2e7d32; color: #fff; border: none; padding: 6px 14px; border-radius: 6px; font-size: 12px; cursor: pointer; font-weight: 600; }
.block-item .unblock-btn:hover { background: #388e3c; }

/* Profile modal */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.85); z-index: 20000; display: flex; align-items: center; justify-content: center; }
.modal { background: #1e1e1e; border-radius: 12px; max-width: 800px; width: 95%; max-height: 92vh; overflow-y: auto; }
.modal-header { padding: 16px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #333; }
.modal-header h2 { font-size: 18px; color: #ffd600; }
.modal-close { background: none; border: none; color: #888; font-size: 24px; cursor: pointer; }
.modal-photos { position: relative; height: 500px; background: #111; overflow: hidden; transition: opacity 0.15s; }
.modal-photos img { width: 100%; height: 100%; object-fit: contain; display: none; }
.modal-photos img.active { display: block; }
.modal-photos .photo-nav { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(0,0,0,0.6); color: #fff; border: none; width: 40px; height: 40px; border-radius: 50%; font-size: 20px; cursor: pointer; z-index: 5; }
.modal-photos .photo-nav:hover { background: rgba(255,214,0,0.7); color: #000; }
.modal-photos .photo-nav.prev { left: 8px; }
.modal-photos .photo-nav.next { right: 8px; }
.modal-photos .photo-counter { position: absolute; bottom: 8px; right: 8px; background: rgba(0,0,0,0.6); color: #fff; padding: 2px 8px; border-radius: 10px; font-size: 12px; }
.modal-photos .photo-dots { position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%); display: flex; gap: 6px; }
.modal-photos .photo-dots span { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,0.3); cursor: pointer; }
.modal-photos .photo-dots span.active { background: #ffd600; }
.modal-info { padding: 16px; transition: opacity 0.15s; }
.modal-info .stat { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #222; font-size: 14px; }
.modal-info .stat .label { color: #888; }

/* Profile action bar — sticky bottom, always visible */
.profile-action-bar {
    position: sticky; bottom: 0; z-index: 10;
    display: flex; gap: 0; border-top: 1px solid #333;
    background: #1a1a1a; padding: 6px 0 max(6px, env(safe-area-inset-bottom));
}
.action-btn {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px; padding: 8px 4px; background: none; border: none; cursor: pointer;
    color: #ccc; font-size: 12px; font-weight: 500; min-height: 52px;
    -webkit-tap-highlight-color: transparent; transition: background 0.15s;
}
.action-btn:active { background: rgba(255,255,255,0.08); }
.action-btn.primary { color: #ffd600; }
.action-btn .action-icon { font-size: 22px; line-height: 1; }
.action-btn .action-label { font-size: 11px; }
.action-btn:disabled { opacity: 0.4; }

/* Overflow sheet — slides up from action bar */
.profile-overflow {
    background: #242424; border-top: 1px solid #333;
    padding: 8px 12px max(8px, env(safe-area-inset-bottom));
    animation: slideUp 0.2s ease-out;
}
@keyframes slideUp { from { transform: translateY(100%); opacity: 0; } to { transform: none; opacity: 1; } }
.overflow-btn {
    display: block; width: 100%; text-align: left;
    background: none; border: none; color: #e0e0e0;
    padding: 14px 12px; font-size: 15px; cursor: pointer;
    border-bottom: 1px solid #2a2a2a;
    -webkit-tap-highlight-color: transparent;
}
.overflow-btn:last-child { border-bottom: none; }
.overflow-btn:active { background: rgba(255,255,255,0.06); }

/* Disconnect overlay */
#disconnected-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 28000;
    background: rgba(0, 0, 0, 0.75); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
}
.disconnect-content { text-align: center; color: #e0e0e0; }
.disconnect-icon { font-size: 48px; margin-bottom: 12px; animation: disconnectPulse 2s ease-in-out infinite; }
@keyframes disconnectPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
#disconnect-text { font-size: 15px; color: #ccc; margin-bottom: 16px; }
.disconnect-btn {
    background: #ffd600; color: #000; border: none; padding: 12px 32px;
    border-radius: 8px; font-size: 15px; font-weight: 600; cursor: pointer;
}
.disconnect-btn:active { opacity: 0.8; }

/* Drawer picker */
.drawer-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 12px; max-height: 400px; overflow-y: auto; }
.drawer-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; cursor: pointer; border: 2px solid transparent; }
.drawer-grid img:hover { border-color: #ffd600; }

/* Events log */
#events-log { font-family: monospace; font-size: 12px; padding: 12px; }
.event-entry { padding: 4px 0; border-bottom: 1px solid #1a1a1a; color: #888; }
.event-entry .event-type { color: #ffd600; }

/* Inbox avatars & online dots */
.dot-filter { width: 18px; height: 18px; border-radius: 50%; cursor: pointer; opacity: 1; transition: opacity 0.2s; }
.dot-filter:not(.active) { opacity: 0.25; }
.conv-avatar-wrap { position: relative; flex-shrink: 0; }
.conv-avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; flex-shrink: 0; background: #333; }
.conv-avatar-placeholder { width: 44px; height: 44px; border-radius: 50%; background: #333; display: flex; align-items: center; justify-content: center; font-size: 20px; color: #666; flex-shrink: 0; }
.conv-online-dot { position: absolute; bottom: -1px; right: -1px; width: 14px; height: 14px; border-radius: 50%; border: 2px solid #121212; }
.conv-online-dot.online { background: #00e676; }

/* Grid online dots */
.grid-item .online-dot { position: absolute; top: 6px; left: 6px; width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(0,0,0,0.4); }
.grid-item .online-dot.online { background: #00e676; }

/* Profile modal */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.85); z-index: 20000; display: flex; align-items: center; justify-content: center; }
.modal { background: #1e1e1e; border-radius: 12px; max-width: 800px; width: 95%; max-height: 92vh; overflow-y: auto; }
.modal-header { padding: 16px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #333; }
.modal-header h2 { font-size: 18px; color: #ffd600; }
.modal-close { background: none; border: none; color: #888; font-size: 24px; cursor: pointer; }
.modal-photos { position: relative; height: 500px; background: #111; overflow: hidden; transition: opacity 0.15s; }
.modal-photos img { width: 100%; height: 100%; object-fit: contain; display: none; }
.modal-photos img.active { display: block; }
.modal-photos .photo-nav { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(0,0,0,0.6); color: #fff; border: none; width: 40px; height: 40px; border-radius: 50%; font-size: 20px; cursor: pointer; z-index: 5; }
.modal-photos .photo-nav:hover { background: rgba(255,214,0,0.7); color: #000; }
.modal-photos .photo-nav.prev { left: 8px; }
.modal-photos .photo-nav.next { right: 8px; }
.modal-photos .photo-counter { position: absolute; bottom: 8px; right: 8px; background: rgba(0,0,0,0.6); color: #fff; padding: 2px 8px; border-radius: 10px; font-size: 12px; }
.modal-photos .photo-dots { position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%); display: flex; gap: 6px; }
.modal-photos .photo-dots span { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,0.3); cursor: pointer; }
.modal-photos .photo-dots span.active { background: #ffd600; }
.modal-info { padding: 16px; transition: opacity 0.15s; }
.modal-info .stat { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #222; font-size: 14px; }
.modal-info .stat .label { color: #888; }
/* Drawer picker */
.drawer-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 12px; max-height: 400px; overflow-y: auto; }
.drawer-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; cursor: pointer; border: 2px solid transparent; }
.drawer-grid img:hover { border-color: #ffd600; }

/* Typing indicator */
#typing-indicator { animation: typingPulse 1.5s ease-in-out infinite; }
@keyframes typingPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* Albums */
.album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; padding: 12px; }
.album-card { background: #1e1e1e; border-radius: 8px; overflow: hidden; cursor: pointer; transition: transform 0.1s; }
.album-card:hover { transform: scale(1.02); }
.album-card img { width: 100%; aspect-ratio: 1; object-fit: cover; background: #333; }
.album-card .album-placeholder { width: 100%; aspect-ratio: 1; background: #2a2a2a; display: flex; align-items: center; justify-content: center; font-size: 40px; color: #444; }
.album-card .album-info { padding: 8px 10px; }
.album-card .album-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.album-card .album-count { font-size: 11px; color: #888; margin-top: 2px; }
.album-content-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 4px; padding: 12px; }
.album-content-item { position: relative; aspect-ratio: 1; background: #1e1e1e; overflow: hidden; border-radius: 6px; }
.album-content-item img { width: 100%; height: 100%; object-fit: cover; cursor: pointer; }
.album-content-item .delete-badge { position: absolute; top: 4px; right: 4px; background: rgba(198,40,40,0.85); color: #fff; border: none; width: 24px; height: 24px; border-radius: 50%; cursor: pointer; font-size: 14px; display: none; align-items: center; justify-content: center; }
.album-content-item:hover .delete-badge { display: flex; }

/* Profile tags */
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 0; border-bottom: 1px solid #222; }
.tag-row .tag-label { font-size: 13px; color: #888; width: 100%; margin-bottom: 2px; }
.tag { display: inline-block; background: #2a2a2a; color: #e0e0e0; padding: 4px 10px; border-radius: 14px; font-size: 12px; }
.tag.highlight { background: #33691e; color: #c5e1a5; }

/* Loading */
.loading { display: flex; align-items: center; justify-content: center; padding: 40px; color: #666; }

/* Toasts */
#toast-container { position: fixed; top: 50px; right: 16px; z-index: 30000; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { pointer-events: auto; background: #1e1e1e; border: 1px solid #333; border-radius: 10px; padding: 12px 16px; min-width: 260px; max-width: 360px; box-shadow: 0 4px 20px rgba(0,0,0,0.5); display: flex; align-items: flex-start; gap: 10px; animation: toastIn 0.3s ease; cursor: pointer; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.toast.removing { animation: toastOut 0.3s ease forwards; }
.toast .toast-icon { font-size: 20px; flex-shrink: 0; line-height: 1; }
.toast .toast-body { flex: 1; min-width: 0; }
.toast .toast-title { font-size: 13px; font-weight: 600; color: #e0e0e0; }
.toast .toast-text { font-size: 12px; color: #888; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@keyframes toastIn { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(40px); } }

/* My Profile */
.profile-photo-thumb { position: relative; flex-shrink: 0; width: 90px; height: 120px; border-radius: 8px; overflow: hidden; background: #2a2a2a; cursor: grab; }
.profile-photo-thumb img { width: 100%; height: 100%; object-fit: cover; }
.profile-photo-thumb .photo-badge { position: absolute; top: 3px; left: 3px; background: rgba(0,0,0,0.7); color: #ffd600; font-size: 9px; padding: 1px 5px; border-radius: 6px; }
.profile-photo-thumb .photo-delete { position: absolute; top: 3px; right: 3px; background: rgba(198,40,40,0.85); color: #fff; border: none; width: 20px; height: 20px; border-radius: 50%; cursor: pointer; font-size: 12px; display: none; align-items: center; justify-content: center; }
.profile-photo-thumb:hover .photo-delete { display: flex; }
.profile-photo-thumb.primary { border: 2px solid #ffd600; }
.profile-field { display: flex; align-items: center; padding: 10px 0; border-bottom: 1px solid #222; gap: 12px; }
.profile-field label { font-size: 13px; color: #888; min-width: 100px; }
.profile-field input, .profile-field textarea, .profile-field select { flex: 1; background: #2a2a2a; border: 1px solid #444; color: #e0e0e0; padding: 8px 12px; border-radius: 6px; font-size: 13px; outline: none; font-family: inherit; }
.profile-field textarea { resize: vertical; min-height: 60px; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; }
.toggle-row label { font-size: 13px; color: #e0e0e0; }
.toggle-switch { position: relative; width: 44px; height: 24px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-switch .slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background: #444; border-radius: 12px; transition: 0.2s; }
.toggle-switch .slider:before { content: ''; position: absolute; height: 18px; width: 18px; left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: 0.2s; }
.toggle-switch input:checked + .slider { background: #ffd600; }
.toggle-switch input:checked + .slider:before { transform: translateX(20px); }

/* ---- Mobile responsive ---- */
@media (max-width: 600px) {
  /* Login box */
  #login .login-header, #login .login-box { width: 92vw; max-width: 370px; }
  #login .login-box { padding: 20px 16px; }

  /* Nav — compact emoji tabs */
  nav button { padding: 8px 0; font-size: 18px; }

  /* Hide dot filters on mobile */

  /* Collapsible grid filters on mobile */
  .grid-filters-expanded { display: none; }
  .grid-filters-expanded.open { display: block; }
  .grid-filter-toggle { display: flex !important; align-items: center; justify-content: center; }

  /* Hide header on mobile — status dot in nav instead */
  #app-header { display: none !important; }
  .nav-status { display: block !important; width: 8px; height: 8px; border-radius: 50%; background: #555; margin: 0 6px; flex-shrink: 0; }
  .nav-status.connected { background: #2e7d32; }
  .nav-status.error { background: #c62828; }

  /* Grid filters — wrap and stack */
  #grid-panel > div:first-child { padding: 6px !important; }
  #grid-panel > div:first-child > div { flex-wrap: wrap !important; gap: 6px !important; }
  #grid-panel input[type="number"] { width: 50px !important; }
  #grid-panel input[type="text"] { min-width: 0 !important; }
  #grid-size-slider { width: 60px !important; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)) !important; }

  /* Chat input */
  #chat-input { padding: 6px 6px max(6px, env(safe-area-inset-bottom)); gap: 6px; }
  #chat-input button { width: 38px; height: 38px; font-size: 16px; }
  #chat-input #msg-input { padding: 8px 12px; font-size: 14px; }

  /* Profile modal — full screen on mobile */
  .modal { width: 100%; max-width: 100%; border-radius: 0; max-height: 100vh; }
  .modal-photos { height: 300px; }

  /* Profile fields */
  .profile-field { flex-direction: column; align-items: stretch; gap: 4px; }
  .profile-field label { min-width: 0; }

  /* Album grids */
  .album-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)) !important; gap: 6px; padding: 8px; }
  .album-content-grid { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); }

  /* Toasts */
  #toast-container { right: 8px; left: 8px; }
  .toast { min-width: 0; max-width: 100%; }

  /* Map bar */
  #map-bar { padding: 6px 8px; gap: 6px; }
  #map-bar button { padding: 5px 10px; font-size: 12px; }
  #map-bar input { width: 100px !important; }
}

/* Profile tags */
