:root {
    --bg: #080808;
    --bg2: #0f0f0f;
    --bg3: #171717;
    --bg4: #1f1f1f;
    --text: #ffffff;
    --text2: #a0a0a0;
    --text3: #606060;
    --accent: #ffffff;
    --gold: #ffd231;
    --red: #ff0000;
    --blue: #64b5f6;
    --border: #222222;
    --radius: 12px;
    --trans: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: var(--bg); color: var(--text);
    min-height: 100vh; font-size: 15px;
    overflow-x: hidden; -webkit-tap-highlight-color: transparent;
    zoom: 1.5;
    -moz-transform: scale(1.5);
    -moz-transform-origin: 0 0;
}
::-webkit-scrollbar { width: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2a2a2a; border-radius: 2px; }

/* Auth */
.auth-wall { position: fixed; inset: 0; background: var(--bg); z-index: 9999; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 12px; padding: 20px; }
.auth-wall.hidden { display: none; }
.auth-box { background: var(--bg3); border: 1px solid var(--border); border-radius: 18px; padding: 40px 30px; width: 100%; max-width: 400px; text-align: center; animation: popIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes popIn { from{opacity:0;transform:scale(0.92) translateY(16px)} to{opacity:1;transform:scale(1) translateY(0)} }
.auth-box h1 { font-size: 30px; font-weight: 900; color: var(--accent); margin-bottom: 2px; letter-spacing: -1px; }
.auth-box .subtitle { font-size: 12px; color: var(--text3); margin-bottom: 24px; }
.auth-box input { width: 100%; padding: 13px 15px; margin: 6px 0; border-radius: 10px; border: 1px solid var(--border); background: var(--bg2); color: #fff; font-size: 13px; outline: none; transition: var(--trans); }
.auth-box input:focus { border-color: #444; }
.auth-toggle { color: var(--text3); font-size: 11px; margin-top: 14px; }
.auth-toggle span { color: var(--accent); cursor: pointer; text-decoration: underline; font-weight: 600; }
.try-link { color: #555; font-size: 11px; cursor: pointer; text-decoration: underline; margin-top: 10px; transition: var(--trans); }
.try-link:hover { color: var(--accent); }

/* Buttons */
.btn { padding: 13px 22px; border-radius: 10px; border: none; font-size: 13px; font-weight: 700; cursor: pointer; width: 100%; transition: var(--trans); margin-top: 8px; }
.btn:active { transform: scale(0.97); }
.btn-white { background: var(--accent); color: #000; }
.btn-white:hover { background: #e0e0e0; }
.btn-outline { background: transparent; color: var(--text2); border: 1px solid var(--border); }
.btn-outline:hover { border-color: #555; color: #fff; }
.btn-sm { padding: 8px 14px; font-size: 11px; width: auto; border-radius: 8px; }
.btn-danger { background: transparent; border: 1px solid rgba(255,0,0,0.3); color: var(--red); }
.btn-danger:hover { background: var(--red); color: #fff; border-color: var(--red); }

/* Header */
.header { display: flex; align-items: center; justify-content: center; height: 56px; padding: 0 20px; background: rgba(15,15,15,0.9); border-bottom: 1px solid rgba(34,34,34,0.8); position: sticky; top: 0; z-index: 100; backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); }
.search-bar { width: 100%; max-width: 460px; position: relative; }
.search-bar input { width: 100%; padding: 10px 16px; border-radius: 20px; border: 1px solid var(--border); background: var(--bg3); color: #fff; font-size: 13px; outline: none; transition: var(--trans); }
.search-bar input:focus { border-color: #555; background: var(--bg4); }

/* Badges */
.badge { font-size: 8px; font-weight: 800; padding: 2px 6px; border-radius: 3px; text-transform: uppercase; letter-spacing: 0.4px; display: inline-flex; align-items: center; color: #fff; }
.badge-owner { background: var(--gold); box-shadow: 0 0 10px rgba(255,210,49,0.4); }
.badge-admin { background: var(--red); box-shadow: 0 0 10px rgba(255,0,0,0.4); }
.badge-uploader { background: var(--blue); box-shadow: 0 0 10px rgba(100,181,246,0.4); }
.badges-row { display: inline-flex; gap: 4px; align-items: center; }
.hidden { display: none !important; }

/* Drawer */
.drawer-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 200; display: none; }
.drawer-overlay.open { display: block; }
.drawer { position: fixed; top: 0; left: 0; bottom: 0; width: 48px; background: rgba(15,15,15,0.98); z-index: 201; transition: width 0.2s cubic-bezier(0.4, 0, 0.2, 1); display: flex; flex-direction: column; border-right: 1px solid var(--border); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); overflow: hidden; padding: 6px 4px; }
.drawer.open { width: 210px; padding: 6px 8px; }
.drawer-header { display: flex; align-items: center; justify-content: center; padding: 2px 0; margin-bottom: 4px; overflow: hidden; user-select: none; }
.drawer.open .drawer-header { justify-content: space-between; padding: 2px 4px; }
.drawer-logo { font-size: 17px; font-weight: 900; color: var(--accent); white-space: nowrap; pointer-events: none; width: 0; opacity: 0; }
.drawer.open .drawer-logo { width: auto; opacity: 1; pointer-events: auto; }
.drawer-burger { display: flex; align-items: center; justify-content: center; padding: 6px; border-radius: 6px; cursor: pointer; transition: var(--trans); background: none; border: none; color: var(--text2); flex-shrink: 0; user-select: none; }
.drawer-burger:hover { background: var(--bg4); color: #fff; }
.drawer-items { display: flex; flex-direction: column; gap: 1px; flex: 0 0 auto; }
.drawer-item { padding: 9px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 12px; color: var(--text2); border: none; background: transparent; width: 100%; text-align: left; transition: var(--trans); display: flex; align-items: center; gap: 11px; white-space: nowrap; overflow: hidden; }
.drawer.open .drawer-item { padding: 9px 10px; }
.drawer-item:hover { background: var(--bg4); color: #fff; }
.drawer-item-icon { flex-shrink: 0; width: 20px; display: flex; align-items: center; justify-content: center; }
.drawer-item-text { opacity: 0; transition: opacity 0.15s; font-size: 12px; }
.drawer.open .drawer-item-text { opacity: 1; }
.drawer-spacer { flex: 1; }
.drawer-bottom { margin-top: 2px; padding: 7px; border-radius: 8px; cursor: pointer; transition: var(--trans); display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--border); }
.drawer-bottom:hover { background: var(--bg4); }
.drawer-bottom-av { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 11px; overflow: hidden; flex-shrink: 0; }
.drawer-bottom-av img { width: 100%; height: 100%; object-fit: cover; }
.drawer-bottom-info { opacity: 0; transition: opacity 0.15s; min-width: 0; overflow: hidden; flex: 1; }
.drawer.open .drawer-bottom-info { opacity: 1; }
.drawer-bottom-name { font-size: 12px; font-weight: 700; white-space: nowrap; }
.drawer-bottom-user { font-size: 10px; color: var(--text3); }
.drawer-logout-btn { background: none; border: none; color: var(--text3); cursor: pointer; padding: 4px; border-radius: 4px; display: flex; align-items: center; opacity: 0; transition: var(--trans); }
.drawer.open .drawer-logout-btn { opacity: 1; }
.drawer-logout-btn:hover { color: var(--red); background: rgba(255,0,0,0.1); }

/* Main */
.app-content { display: none; margin-left: 48px; transition: margin-left 0.2s cubic-bezier(0.4, 0, 0.2, 1); position: relative; z-index: 1; }
.app-content.active { display: block; animation: fadeUp 0.25s ease; }
.app-content.drawer-open { margin-left: 210px; }
@keyframes fadeUp { from{opacity:0;transform:translateY(6px)} to{opacity:1;transform:translateY(0)} }
.content { padding: 20px; max-width: 1350px; margin: 0 auto; }
.page-title { font-size: 22px; font-weight: 700; margin-bottom: 16px; }

/* Search dropdown */
.search-dropdown { position: absolute; top: calc(100% + 8px); left: 0; right: 0; background: var(--bg3); border: 1px solid var(--border); border-radius: 12px; padding: 6px; z-index: 150; box-shadow: 0 8px 24px rgba(0,0,0,0.6); animation: menuIn 0.15s ease; max-height: 260px; overflow-y: auto; }
.search-dropdown-header { font-size: 11px; color: var(--text3); padding: 6px 10px 4px; text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; }
.search-dropdown-item { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 13px; color: var(--text); transition: var(--trans); }
.search-dropdown-item:hover { background: var(--bg4); }
.search-dropdown-remove { background: none; border: none; color: var(--text3); font-size: 16px; cursor: pointer; padding: 0 4px; line-height: 1; transition: var(--trans); }
.search-dropdown-remove:hover { color: var(--red); }

/* Pills */
.category-pills { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 18px; }
.category-pill { padding: 7px 14px; border-radius: 16px; border: 1px solid var(--border); background: var(--bg3); color: var(--text2); cursor: pointer; font-size: 11px; font-weight: 600; transition: var(--trans); white-space: nowrap; }
.category-pill:hover { border-color: #555; color: #fff; }
.category-pill.active { background: var(--accent); color: #000; border-color: var(--accent); font-weight: 700; }

/* Masonry */
.masonry { columns: 5 220px; column-gap: 10px; }
.pin { break-inside: avoid; margin-bottom: 10px; border-radius: 14px; overflow: hidden; background: var(--bg2); cursor: pointer; border: 1px solid var(--border); transition: var(--trans); animation: pinIn 0.4s ease backwards; position: relative; }
@keyframes pinIn { from{opacity:0;transform:translateY(14px)} }
.pin:nth-child(1){animation-delay:0.03s}.pin:nth-child(2){animation-delay:0.06s}.pin:nth-child(3){animation-delay:0.09s}.pin:nth-child(4){animation-delay:0.12s}.pin:nth-child(5){animation-delay:0.15s}
.pin:hover { border-color: #444; transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,0.5); }
.pin-img-wrap { position: relative; overflow: hidden; border-radius: 14px; line-height: 0; }
.pin-img-wrap img { width: 100%; display: block; transition: transform 0.4s ease; border-radius: 14px; }
.pin:hover .pin-img-wrap img { transform: scale(1.03); }
.pin-save-btn { position: absolute; top: 10px; right: 10px; padding: 8px 16px; border-radius: 20px; background: var(--red); color: #fff; border: none; cursor: pointer; font-size: 11px; font-weight: 700; opacity: 0; transition: opacity 0.2s, background 0.2s, transform 0.15s; text-transform: uppercase; letter-spacing: 0.5px; z-index: 2; }
.pin:hover .pin-save-btn { opacity: 1; }
.pin-save-btn:hover { transform: scale(1.05); }
.pin-save-btn.saved { background: var(--bg4); color: var(--text); animation: pinPop 0.3s ease; }
@keyframes pinPop { 0%{transform:scale(1)} 50%{transform:scale(1.15)} 100%{transform:scale(1)} }
.pin-dots-btn { position: absolute; bottom: 10px; right: 10px; width: 30px; height: 30px; border-radius: 50%; background: rgba(0,0,0,0.55); color: #fff; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity 0.2s; z-index: 2; }
.pin:hover .pin-dots-btn { opacity: 1; }
.pin-dots-btn:hover { background: rgba(0,0,0,0.8); }
.pin-menu { position: absolute; bottom: 46px; right: 10px; background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; padding: 4px; z-index: 10; display: none; flex-direction: column; min-width: 140px; box-shadow: 0 8px 24px rgba(0,0,0,0.6); animation: menuIn 0.15s ease; }
@keyframes menuIn { from{opacity:0;transform:translateY(4px)} to{opacity:1;transform:translateY(0)} }
.pin-menu.open { display: flex; }
.pin-menu button { background: none; border: none; color: var(--text); padding: 9px 14px; border-radius: 7px; cursor: pointer; font-size: 12px; font-weight: 600; text-align: left; transition: var(--trans); white-space: nowrap; }
.pin-menu button:hover { background: var(--bg4); }
.pin-menu button.danger { color: var(--red); }
.pin-menu button.danger:hover { background: rgba(255,0,0,0.1); }

/* Hero */
.hero-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 22px; }
.hero-card { background: var(--bg3); border-radius: 14px; padding: 22px 14px; cursor: pointer; border: 1px solid var(--border); text-align: center; font-weight: 600; font-size: 14px; transition: var(--trans); }
.hero-card:hover { border-color: #555; background: var(--bg4); }

/* Modal */
/* ===== MODAL PINTEREST STYLE ===== */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.85); z-index: 2000; display: none; align-items: center; justify-content: center; padding: 16px; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.modal-overlay.active { display: flex; animation: modalFadeIn 0.2s ease; }
@keyframes modalFadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-box {
    background: var(--bg2);
    border-radius: 20px;
    width: min(720px, 92vw);
    max-height: 85dvh;
    border: 1px solid var(--border);
    overflow: hidden;
    display: flex;
    flex-direction: row;
    animation: modalPopIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}
@keyframes modalPopIn { from { opacity:0; transform: scale(0.93) translateY(20px); } to { opacity:1; transform: scale(1) translateY(0); } }

/* Bouton fermer */
.modal-close-btn {
    position: absolute; top: 12px; left: 12px; z-index: 10;
    width: 36px; height: 36px; border-radius: 50%; border: none;
    background: rgba(0,0,0,0.55); color: #fff; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: var(--trans); backdrop-filter: blur(4px);
}
.modal-close-btn:hover { background: rgba(0,0,0,0.8); transform: scale(1.08); }

/* Côté gauche — image */
.modal-left {
    flex: 0 0 auto;
    width: min(50%, 360px);
    background: #000;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
    border-radius: 24px 0 0 24px;
}
.modal-main-img {
    width: 100%; height: 100%;
    object-fit: cover;
    cursor: zoom-in;
    display: block;
    transition: transform 0.3s ease;
}
.modal-main-img:hover { transform: scale(1.02); }

/* Côté droit — infos */
.modal-right {
    flex: 1;
    display: flex; flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

.modal-actions-top {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px 10px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.modal-dots-wrap { display: flex; gap: 6px; }

.modal-icon-btn {
    width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--border);
    background: transparent; color: var(--text2); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: var(--trans);
}
.modal-icon-btn:hover { background: var(--bg3); color: var(--text); border-color: #444; }
.modal-icon-btn.danger:hover { background: rgba(255,0,0,0.12); color: var(--red); border-color: rgba(255,0,0,0.3); }

.modal-pin-btn {
    padding: 10px 20px; border-radius: 24px; border: none; font-size: 13px; font-weight: 700;
    cursor: pointer; background: #e60023; color: #fff; transition: var(--trans);
    letter-spacing: 0.2px;
}
.modal-pin-btn:hover { background: #c0001d; transform: scale(1.03); }
.modal-pin-btn.saved { background: #111; color: #fff; border: 1px solid #444; }
.modal-pin-btn.saved:hover { background: #222; }

/* Contenu scrollable — toute la partie droite sous le header */
.modal-content-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 16px 18px 20px;
    display: flex; flex-direction: column; gap: 12px;
}
.modal-content-scroll::-webkit-scrollbar { width: 3px; }
.modal-content-scroll::-webkit-scrollbar-thumb { background: #2a2a2a; border-radius: 2px; }

.modal-title { font-size: 20px; font-weight: 800; letter-spacing: -0.5px; line-height: 1.25; }
.modal-desc { font-size: 13px; color: var(--text2); line-height: 1.55; }

.modal-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.modal-tag {
    font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 20px;
    background: var(--bg3); color: var(--text2); border: 1px solid var(--border);
    letter-spacing: 0.3px;
}

.modal-views-row { font-size: 11px; color: var(--text3); display: flex; align-items: center; gap: 5px; }

/* Auteur */
.modal-author-section {
    display: flex; align-items: center; gap: 10px;
    padding: 10px; border-radius: 12px; cursor: pointer;
    transition: var(--trans); border: 1px solid transparent;
    min-height: 58px;
}
.modal-author-section:hover { background: var(--bg3); border-color: var(--border); }

.author-av {
    width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 15px; overflow: hidden;
}
.author-av img { width: 100%; height: 100%; object-fit: cover; }
.author-av span { color: #fff; }

.author-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.author-info strong { font-size: 14px; font-weight: 700; }
.author-info span { font-size: 11px; color: var(--text3); }

/* Skeletons chargement auteur */
.author-av-sk { width: 40px; height: 40px; border-radius: 50%; background: var(--bg3); flex-shrink: 0; }
.author-text-sk { width: 120px; height: 14px; border-radius: 7px; background: var(--bg3); }

/* Similar */
.modal-similar { display: flex; flex-direction: column; gap: 10px; }
.modal-similar-title { font-size: 13px; font-weight: 700; color: var(--text2); }
.modal-similar-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 6px; }
.modal-similar-item { border-radius: 12px; overflow: hidden; cursor: pointer; aspect-ratio: 1; border: 1px solid var(--border); transition: var(--trans); }
.modal-similar-item:hover { transform: scale(1.04); border-color: #555; }
.modal-similar-item img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ===== RESPONSIVE MOBILE ===== */
@media (max-width: 640px) {
    .modal-box {
    width: min(720px, 92vw);
    max-height: 85dvh;
    border-radius: 20px;
    }
    .modal-left {
    width: min(50%, 360px);
    }
    .modal-main-img { object-fit: contain; }
    .modal-close-btn { top: 10px; left: 10px; }
}

/* Legacy compat */
.modal-image { max-width: 100%; max-height: 60vh; width: auto; height: auto; object-fit: contain; display: block; cursor: pointer; }
.modal-author { display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 8px; border-radius: 10px; transition: var(--trans); }
.modal-author:hover { background: var(--bg3); }
.similar-section { margin-top: 2px; }
.similar-title { font-size: 12px; font-weight: 700; margin-bottom: 6px; color: var(--text2); }
.similar-grid { display: flex; gap: 7px; flex-wrap: wrap; }
.similar-pin { width: 90px; height: 65px; border-radius: 10px; overflow: hidden; cursor: pointer; border: 1px solid var(--border); transition: var(--trans); flex-shrink: 0; }
.similar-pin:hover { border-color: #fff; transform: scale(1.04); }
.similar-pin img { width: 100%; height: 100%; object-fit: cover; }

/* Profile */
.profile-card { background: var(--bg2); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; width: 100%; max-width: 520px; }
.profile-banner { width: 100%; padding-bottom: 20%; position: relative; overflow: hidden; display: block; }
.profile-banner-img { width: 100%; height: 100%; object-fit: cover; display: block; position: absolute; inset: 0; }
.profile-body { padding: 18px 22px 22px; }
.profile-avatar-section { display: flex; align-items: flex-end; gap: 14px; margin-top: -44px; margin-bottom: 10px; position: relative; z-index: 3; }
.profile-avatar { width: 80px; height: 80px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 26px; font-weight: 900; overflow: hidden; flex-shrink: 0; transition: var(--trans); cursor: pointer; border: none; }
.profile-avatar:hover { transform: scale(1.04); }
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-names { padding-top: 26px; flex: 1; min-width: 0; }
.profile-name-row { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; line-height: 1.2; }
.profile-name-row h2 { font-size: 19px; font-weight: 700; margin: 0; line-height: 1; }
.profile-badges-inline { display: inline-flex; align-items: center; gap: 4px; }
.profile-username { font-size: 12px; color: var(--text3); }
.profile-bio { font-size: 12px; color: var(--text2); margin: 8px 0; line-height: 1.5; }
.profile-stats-row { display: flex; align-items: center; gap: 12px; margin-top: 8px; padding-top: 8px; border-top: 1px solid rgba(255,255,255,0.05); font-size: 11px; color: var(--text3); }
.profile-stats-row strong { color: var(--text3); font-size: 13px; font-weight: 600; }
.profile-stats-sep { width: 1px; height: 12px; background: rgba(255,255,255,0.08); }
.profile-member-since { font-size: 10px; color: var(--text3); }

/* Tabs */
.tabs { display: flex; gap: 3px; background: var(--bg); border-radius: 10px; padding: 3px; margin-bottom: 16px; max-width: 520px; }
.tab { flex: 1; padding: 10px; border-radius: 8px; border: none; background: transparent; color: #777; font-size: 12px; font-weight: 600; cursor: pointer; transition: var(--trans); }
.tab.active { background: var(--bg2); color: #fff; }

/* Edit */
.edit-section { background: var(--bg2); border: 1px solid var(--border); border-radius: 16px; padding: 22px; max-width: 520px; }
.edit-row { margin: 12px 0; }
.edit-row label { font-size: 10px; color: var(--text3); display: block; margin-bottom: 4px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.edit-row input[type="text"], .edit-row input[type="password"], .edit-row textarea { width: 100%; padding: 10px 13px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg3); color: #fff; font-size: 13px; outline: none; transition: var(--trans); }
.edit-row textarea { min-height: 70px; resize: vertical; }
.edit-row input:focus, .edit-row textarea:focus { border-color: #555; }
.file-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.file-btn { padding: 9px 15px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg3); color: var(--text2); cursor: pointer; font-size: 11px; font-weight: 600; transition: var(--trans); display: inline-flex; align-items: center; gap: 5px; }
.file-btn:hover { border-color: #fff; color: #fff; }
.file-btn input { display: none; }
.remove-btn { padding: 9px 13px; border-radius: 10px; border: 1px solid rgba(255,0,0,0.3); background: transparent; color: var(--red); cursor: pointer; font-size: 11px; font-weight: 600; transition: var(--trans); }
.remove-btn:hover { background: var(--red); color: #fff; }
.color-row { display: flex; align-items: center; gap: 8px; }
.color-row input[type="color"] { width: 40px; height: 40px; border: 2px solid var(--border); border-radius: 10px; cursor: pointer; padding: 2px; background: transparent; flex-shrink: 0; }
.color-row input[type="text"] { width: 110px; padding: 9px 11px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg3); color: #fff; font-size: 12px; font-family: monospace; outline: none; text-align: center; }
.profile-layout { display: flex; gap: 22px; flex-wrap: wrap; align-items: flex-start; }
.profile-preview-col { flex: 0 0 520px; max-width: 520px; position: sticky; top: 80px; }
.profile-edit-col { flex: 1; min-width: 300px; max-width: 520px; }

/* ===== DISCORD-STYLE CHAT ===== */
.dc-layout {
    display: flex; flex-direction: column;
    height: calc(100dvh - 100px);
    background: var(--bg);
    border-radius: 12px;
    overflow: hidden;
}

/* Messages area */
.dc-messages {
    flex: 1; overflow-y: auto;
    padding: 16px 0 8px;
    display: flex; flex-direction: column;
    gap: 0;
}
.dc-messages::-webkit-scrollbar { width: 4px; }
.dc-messages::-webkit-scrollbar-thumb { background: #2a2a2a; border-radius: 2px; }

.dc-empty { color: var(--text3); font-size: 14px; text-align: center; padding: 40px; }

/* Date separator */
.dc-date-sep {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 16px; color: var(--text3); font-size: 11px; font-weight: 600;
}
.dc-date-sep::before, .dc-date-sep::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* Message group (avatar + body) */
.dc-group {
    display: flex; gap: 14px;
    padding: 6px 16px 2px;
    position: relative;
}
.dc-group:hover { background: rgba(255,255,255,0.025); }

.dc-av {
    width: 38px; height: 38px; border-radius: 50%;
    flex-shrink: 0; cursor: pointer; overflow: hidden;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 800; color: #fff;
    margin-top: 2px;
    transition: var(--trans);
}
.dc-av:hover { transform: scale(1.08); }
.dc-av img { width: 100%; height: 100%; object-fit: cover; }

.dc-group-body { flex: 1; min-width: 0; }

.dc-group-header {
    display: flex; align-items: baseline; gap: 8px;
    margin-bottom: 3px;
}
.dc-username { font-size: 14px; font-weight: 700; color: var(--text); }
.dc-timestamp { font-size: 10px; color: var(--text3); }

/* Individual message line */
.dc-msg-line {
    display: flex; align-items: flex-start;
    gap: 8px; position: relative;
    padding: 1px 0;
    border-radius: 4px;
}
.dc-msg-line.grouped {
    padding: 1px 16px 1px calc(38px + 14px + 16px);
}
.dc-msg-line.grouped:hover { background: rgba(255,255,255,0.025); }
.dc-msg-line:hover .dc-msg-actions { opacity: 1; }

.dc-bubble {
    flex: 1; font-size: 14px; line-height: 1.55;
    color: #dcddde; word-break: break-word;
}

/* Emoji rendered inline */
.dc-emoji-rendered {
    width: 22px; height: 22px;
    vertical-align: -5px;
    object-fit: contain;
    display: inline;
    margin: 0 1px;
}
/* Big emoji if message is emoji-only */
.dc-bubble.emoji-only .dc-emoji-rendered { width: 40px; height: 40px; vertical-align: -10px; }

.dc-img { max-width: 300px; border-radius: 8px; margin-top: 6px; display: block; }

/* Hover actions (time + delete) */
.dc-msg-actions {
    display: flex; align-items: center; gap: 4px;
    opacity: 0; transition: opacity 0.12s;
    flex-shrink: 0; padding-top: 2px;
}
.dc-hover-time { font-size: 10px; color: var(--text3); white-space: nowrap; }
.dc-del-btn {
    background: none; border: 1px solid transparent; color: var(--text3);
    cursor: pointer; padding: 3px 6px; border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    transition: var(--trans);
}
.dc-del-btn:hover { color: var(--red); background: rgba(255,0,0,0.1); border-color: rgba(255,0,0,0.2); }

/* ===== INPUT AREA ===== */
.dc-input-area {
    padding: 0 16px 16px;
    position: relative;
    flex-shrink: 0;
}

.dc-input-wrap {
    display: flex; align-items: center; gap: 4px;
    background: #2b2d31;
    border-radius: 10px;
    padding: 4px 6px;
    border: 1px solid transparent;
    transition: var(--trans);
}
.dc-input-wrap:focus-within { border-color: #5865f2; }

.dc-emoji-btn {
    background: none; border: none; color: #b5bac1;
    cursor: pointer; padding: 7px; border-radius: 6px;
    display: flex; align-items: center;
    transition: var(--trans); flex-shrink: 0;
}
.dc-emoji-btn:hover { color: #fff; background: rgba(255,255,255,0.08); }

.dc-input-editable {
    flex: 1; padding: 8px 4px; border: none;
    background: transparent; color: #dcddde;
    font-size: 14px; outline: none;
    min-height: 22px; max-height: 150px;
    overflow-y: auto; line-height: 1.5;
    word-break: break-word;
}
.dc-input-editable:empty::before { content: attr(data-placeholder); color: #6d6f78; pointer-events: none; }
.dc-emoji-in-input {
    width: 22px; height: 22px; vertical-align: -5px;
    object-fit: contain; pointer-events: none;
    margin: 0 1px;
}

.dc-send-btn {
    background: #5865f2; color: #fff; border: none;
    width: 36px; height: 36px; border-radius: 8px;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: var(--trans); flex-shrink: 0;
}
.dc-send-btn:hover { background: #4752c4; transform: scale(1.05); }

/* Emoji picker */
.dc-emoji-picker {
    position: absolute; bottom: calc(100% + 8px); left: 16px;
    background: #111214; border: 1px solid #2e2f34;
    border-radius: 12px; padding: 10px;
    display: none; flex-wrap: wrap; gap: 4px;
    width: 320px; max-height: 240px; overflow-y: auto;
    z-index: 100; box-shadow: 0 8px 32px rgba(0,0,0,0.7);
    animation: menuIn 0.15s ease;
}
.dc-emoji-picker.open { display: flex; }
.dc-emoji-picker::-webkit-scrollbar { width: 4px; }
.dc-emoji-picker::-webkit-scrollbar-thumb { background: #3a3b40; border-radius: 2px; }
.dc-emoji-item {
    width: 36px; height: 36px; cursor: pointer;
    border-radius: 6px; object-fit: contain; padding: 3px;
    transition: var(--trans);
}
.dc-emoji-item:hover { background: rgba(255,255,255,0.1); transform: scale(1.25); }

/* Legacy compat */
.chat-emoji-inline { width: 20px; height: 20px; vertical-align: middle; object-fit: contain; }

/* Bio emoji */
.bio-emoji-wrap { position: relative; display: flex; align-items: flex-start; gap: 4px; }
.bio-emoji-btn { background: none; border: 1px solid var(--border); color: var(--text3); padding: 6px; border-radius: 6px; cursor: pointer; transition: var(--trans); }
.bio-emoji-btn:hover { background: var(--bg4); color: #fff; }

/* Upload */
.upload-form { background: var(--bg2); border: 1px solid var(--border); border-radius: 16px; padding: 24px; max-width: 560px; }
.upload-title { font-size: 19px; font-weight: 700; margin-bottom: 18px; }
.drop-zone { border: 2px dashed var(--border); border-radius: 14px; padding: 44px 20px; text-align: center; cursor: pointer; transition: var(--trans); background: var(--bg); }
.drop-zone:hover { border-color: #666; background: var(--bg3); }
.drop-zone-active { border-color: var(--accent) !important; background: rgba(255,255,255,0.02); }
.drop-zone-icon { margin-bottom: 12px; opacity: 0.5; }
.drop-zone-title { font-weight: 600; font-size: 14px; margin-bottom: 3px; }
.drop-zone-sub { font-size: 11px; color: var(--text3); }
.preview-grid { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.preview-item { width: 75px; height: 75px; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); position: relative; flex-shrink: 0; }
.preview-item img { width: 100%; height: 100%; object-fit: cover; }
.preview-item-remove { position: absolute; top: 3px; right: 3px; background: rgba(0,0,0,0.7); color: #fff; border: none; width: 20px; height: 20px; border-radius: 50%; cursor: pointer; font-size: 11px; display: flex; align-items: center; justify-content: center; }
.status-text { margin-top: 8px; font-size: 11px; color: var(--text3); }
.cat-select { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.cat-chip { padding: 7px 14px; border-radius: 16px; border: 1px solid var(--border); background: var(--bg3); color: var(--text2); font-size: 11px; font-weight: 600; cursor: pointer; transition: var(--trans); user-select: none; }
.cat-chip:hover { border-color: #666; color: #fff; }
.cat-chip.selected { background: var(--accent); color: #000; border-color: var(--accent); font-weight: 700; }

/* Admin */
.admin-tab { padding: 7px 15px; border-radius: 7px; border: none; background: transparent; color: var(--text3); font-size: 12px; font-weight: 600; cursor: pointer; transition: var(--trans); }
.admin-tab.active { background: var(--bg3); color: #fff; }
.admin-card { background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; transition: var(--trans); }
.admin-card:hover { border-color: #444; }
.admin-card-left { display: flex; align-items: center; gap: 10px; cursor: pointer; min-width: 0; flex: 1; }
.admin-av { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; overflow: hidden; flex-shrink: 0; }
.admin-av img { width: 100%; height: 100%; object-fit: cover; }
.admin-card-name { font-weight: 600; font-size: 12px; display: flex; align-items: center; gap: 4px; }
.admin-card-username { font-size: 10px; color: var(--text3); }
.admin-card-actions { display: flex; gap: 4px; align-items: center; flex-shrink: 0; }
.admin-action-btn { padding: 6px 11px; border-radius: 6px; border: 1px solid var(--border); background: var(--bg3); color: var(--text2); font-size: 10px; font-weight: 600; cursor: pointer; transition: var(--trans); white-space: nowrap; }
.admin-action-btn:hover { border-color: #fff; color: #fff; }
.admin-action-btn.active { background: var(--accent); color: #000; border-color: var(--accent); }
.admin-action-btn.delete-btn { border-color: rgba(255,0,0,0.3); color: var(--red); }
.admin-action-btn.delete-btn:hover { background: var(--red); color: #fff; }
.admin-input { padding: 9px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg3); color: #fff; font-size: 12px; outline: none; flex: 1; }
.cat-pill { display: inline-flex; align-items: center; gap: 5px; background: var(--bg3); border: 1px solid var(--border); padding: 7px 12px; border-radius: 16px; font-size: 11px; font-weight: 600; }
.cat-pill-x { background: none; border: none; color: var(--text3); cursor: pointer; font-size: 14px; padding: 0 2px; }
.cat-pill-x:hover { color: var(--red); }

/* Toast & Confirm */
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--bg3); color: #fff; padding: 10px 20px; border-radius: 20px; font-weight: 600; font-size: 11px; z-index: 3000; opacity: 0; pointer-events: none; border: 1px solid var(--border); transition: opacity 0.3s; white-space: nowrap; }
.toast.show { opacity: 1; }
.confirm-dialog { position: fixed; inset: 0; background: rgba(0,0,0,0.8); z-index: 3500; display: none; align-items: center; justify-content: center; backdrop-filter: blur(4px); }
.confirm-dialog.active { display: flex; }
.confirm-box { background: var(--bg2); border: 1px solid var(--border); border-radius: 16px; padding: 24px; text-align: center; max-width: 330px; width: 100%; animation: popIn 0.25s ease; }
.confirm-box p { margin-bottom: 14px; font-size: 14px; }

*:focus-visible { outline: 2px solid rgba(255,255,255,0.5); outline-offset: 2px; }

/* Responsive */
@media (max-width: 1200px) { .masonry { columns: 4 190px; } }
@media (max-width: 900px) {
    .masonry { columns: 3 160px; } .hero-grid { grid-template-columns: repeat(2, 1fr); }
    .profile-layout { flex-direction: column-reverse; } .profile-preview-col { position: static; } .profile-edit-col { max-width: 100%; }
    .admin-card { flex-direction: column; align-items: flex-start; } .admin-card-actions { width: 100%; justify-content: flex-end; padding-top: 8px; border-top: 1px solid var(--border); }
}
.lazy-sentinel { height: 1px; }
@media (max-width: 600px) {
    .header { height: 48px; padding: 0 10px; } .content { padding: 12px; }
    .masonry { columns: 2 145px; column-gap: 6px; } .pin { margin-bottom: 6px; border-radius: 12px; }
    .pin-img-wrap, .pin-img-wrap img { border-radius: 12px; }
    .hero-grid { grid-template-columns: repeat(2, 1fr); gap: 6px; } .hero-card { padding: 16px 10px; font-size: 12px; }
    .category-pill { padding: 6px 12px; font-size: 10px; }
    .profile-avatar { width: 64px; height: 64px; font-size: 20px; }
    .profile-avatar-section { margin-top: -34px; } .profile-names { padding-top: 20px; } .profile-name-row h2 { font-size: 16px; }
    .dc-layout { height: calc(100dvh - 110px); } .edit-section { padding: 16px; } .upload-form { padding: 16px; }
    .drop-zone { padding: 28px 14px; } .toast { bottom: 14px; padding: 8px 16px; font-size: 10px; }
    .drawer { width: 42px; padding: 4px 2px; } .drawer.open { width: 190px; padding: 4px 6px; }
    .app-content { margin-left: 42px; } .app-content.drawer-open { margin-left: 190px; }
    .pin-save-btn { padding: 6px 12px; font-size: 10px; top: 6px; right: 6px; }
    .pin-dots-btn { width: 26px; height: 26px; bottom: 6px; right: 6px; }
    
}