:root {
  color-scheme: dark;
  --bg: #10131b;
  --panel: #171b25;
  --panel-raised: #1d2230;
  --panel-hover: #252b3a;
  --border: #2a3040;
  --text: #f3f4f8;
  --muted: #929bad;
  --accent: #9b8cff;
  --accent-strong: #7965f4;
  --danger: #ff858c;
  --success: #71d8ae;
  --radius: 16px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { width: 100%; min-height: 100%; margin: 0; }
body { min-height: 100dvh; background: var(--bg); color: var(--text); }
button, input, textarea { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, textarea:focus-visible, label:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.hidden { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.muted { color: var(--muted); font-weight: 400; }

.auth-screen { min-height: 100dvh; display: grid; place-items: center; padding: 24px; background: radial-gradient(ellipse at 50% 0%, #29254a 0, var(--bg) 53%); }
.auth-card { width: min(100%, 430px); padding: 38px; border: 1px solid var(--border); border-radius: 24px; background: rgba(23,27,37,.92); box-shadow: 0 28px 90px #0005; }
.brand-mark { position: relative; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 15px; background: linear-gradient(145deg, #baabff, #7864ed); box-shadow: 0 8px 25px #806df544; }
.brand-mark::before { content: ""; position: absolute; top: 11px; left: 10px; width: 22px; height: 16px; border: 2px solid #fff; border-radius: 7px; }
.brand-mark::after { content: ""; position: absolute; top: 25px; left: 14px; width: 7px; height: 7px; border-bottom: 2px solid #fff; border-left: 2px solid #fff; border-radius: 0 0 0 2px; background: #907cf5; transform: skew(-18deg) rotate(-28deg); }
.eyebrow { margin: 24px 0 3px; color: var(--accent); font-size: 11px; font-weight: 750; letter-spacing: .13em; text-transform: uppercase; }
.auth-card h1 { margin: 0 0 26px; font-size: 30px; letter-spacing: -.04em; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 12px; background: #10131b; }
.tab { border: 0; border-radius: 9px; padding: 10px; color: var(--muted); background: transparent; cursor: pointer; transition: .18s ease; }
.tab.active { color: var(--text); background: var(--panel-hover); }
.auth-form { display: grid; gap: 10px; margin-top: 23px; }
.auth-form > label, .photo-field > label { margin-top: 7px; font-size: 13px; font-weight: 600; }
.auth-form input:not([type=file]) { width: 100%; padding: 12px 13px; border: 1px solid var(--border); border-radius: 11px; color: var(--text); background: #11151e; }
.auth-form select { width: 100%; padding: 12px 13px; border: 1px solid var(--border); border-radius: 11px; color: var(--text); background: #11151e; }
.field-hint { margin: -5px 0 2px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.register-fields { display: grid; gap: 10px; min-width: 0; padding: 0; margin: 0; border: 0; }
.register-fields label { margin-top: 3px; font-size: 13px; font-weight: 600; }
.password-control { position: relative; }
.password-control input { padding-right: 82px !important; }
.password-toggle { position: absolute; top: 50%; right: 8px; padding: 6px 8px; border: 0; border-radius: 7px; color: var(--accent); background: transparent; font-size: 12px; cursor: pointer; transform: translateY(-50%); }
.password-toggle:hover { background: #ffffff0a; }
.password-meter { display: grid; gap: 7px; }
.password-meter .field-hint { margin: 0; }
.meter-bars { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; }
.meter-bars span { height: 4px; border-radius: 8px; background: #343a49; transition: background .18s ease; }
.password-meter[data-strength="1"] .meter-bars span:nth-child(-n+1) { background: var(--danger); }
.password-meter[data-strength="2"] .meter-bars span:nth-child(-n+2) { background: #ffb36e; }
.password-meter[data-strength="3"] .meter-bars span:nth-child(-n+3) { background: #f2d16f; }
.password-meter[data-strength="4"] .meter-bars span:nth-child(-n+4) { background: #9ed889; }
.password-meter[data-strength="5"] .meter-bars span:nth-child(-n+5) { background: var(--success); }
.photo-picker { display: flex; align-items: center; gap: 14px; margin-top: 10px; }
.button { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 15px; border: 1px solid transparent; border-radius: 11px; font-size: 13px; font-weight: 650; cursor: pointer; transition: transform .16s ease, background .16s ease, border .16s ease; }
.button:hover { transform: translateY(-1px); }
.button-primary { color: white; background: var(--accent-strong); }
.button-primary:hover { background: #8978ff; }
.button-quiet { color: #d6d1ff; border-color: #403a65; background: #28243f; }
.button-danger { color: #fff; border-color: #9a3f50; background: #8e3042; }
.button-danger:hover { background: #a43d50; }
.button-wide { width: 100%; margin-top: 8px; }
.delete-options { display: grid; gap: 4px; }
.form-error { min-height: 18px; margin: 2px 0 0; color: var(--danger); font-size: 13px; }

.app-shell { height: var(--visible-viewport-height, 100dvh); display: grid; grid-template-columns: minmax(270px, 340px) minmax(0, 1fr); overflow: hidden; }
.app-shell { grid-template-columns: 300px minmax(0, 1fr); }
.sidebar { display: flex; flex-direction: column; min-width: 0; border-right: 1px solid var(--border); background: var(--panel); overflow-x: hidden; overflow-y: auto; }
.sidebar-header { padding: 22px 20px 17px; border-bottom: 1px solid var(--border); }
.sidebar-social-label { color: #727b8d; font-size: 9px; letter-spacing: .14em; }
.app-nav { display: grid; gap: 6px; padding: 20px 14px; }
.nav-item { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 14px; border: 0; border-radius: 11px; color: #aab1c0; background: transparent; text-align: left; font-size: 13px; font-weight: 650; cursor: pointer; }
.nav-item span { width: 20px; color: var(--accent); font-size: 20px; text-align: center; }
.nav-item:hover, .nav-item.active { color: var(--text); background: #25293a; }
.nav-badge { display: inline-grid; place-items: center; min-width: 19px; height: 19px; padding: 0 5px; margin-left: auto; border-radius: 20px; color: #11131a !important; background: #ff829a; font-size: 10px !important; font-weight: 800; }
.new-post-button { min-height: 43px; margin-top: 14px; }
.app-shell:not(.show-conversations) #sidebar .sidebar-section,
.app-shell:not(.show-conversations) #sidebar .sidebar-foot { display: none; }
.me-info label, .me-info input, .me-info button, .me-info .notification-status { display: none; }
.email-gate { position: fixed; z-index: 20; inset: 0; display: grid; place-items: center; padding: 20px; overflow-y: auto; background: #080a10dd; backdrop-filter: blur(5px); }
.email-notice { position: relative; display: grid; gap: 12px; width: min(100%, 430px); padding: 30px; border: 1px solid #ff626b; border-radius: 18px; background: #4a171d; box-shadow: 0 24px 90px #0009, 0 0 35px #ff404022; }
.email-alert-icon { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid #ff989d; border-radius: 50%; color: white; background: #c82936; font-size: 20px; font-weight: 800; }
.email-notice h2 { margin: 0; color: #fff0f1; font-size: 20px; }
.email-notice p { margin: 0; color: #ffd3d5; font-size: 13px; line-height: 1.5; }
.email-notice label { margin-top: 4px; color: #fff0f1; font-size: 12px; font-weight: 700; }
.email-notice input { width: 100%; min-width: 0; padding: 11px 12px; border: 1px solid #bc545c; border-radius: 9px; color: var(--text); background: #2b1115; font: inherit; font-size: 13px; }
.email-notice .form-error { color: #ffc4c7; }
.email-notice .text-button { justify-self: center; color: #ffd3d5; }
.brand-small { display: flex; align-items: center; gap: 9px; font-size: 14px; letter-spacing: -.02em; }
.brand-home-button { padding: 0; border: 0; color: inherit; background: transparent; text-align: left; cursor: pointer; }
.brand-mark.small { width: 28px; height: 28px; border-radius: 9px; }
.brand-mark.small::before { top: 6px; left: 5px; width: 15px; height: 11px; border-width: 1.5px; border-radius: 4px; }
.brand-mark.small::after { top: 16px; left: 8px; width: 5px; height: 5px; border-width: 0 0 1.5px 1.5px; background: #917cf4; }
.me-row { display: flex; align-items: center; gap: 11px; margin-top: 23px; }
.avatar { flex: 0 0 42px; width: 42px; height: 42px; display: grid; place-items: center; overflow: hidden; border: 1px solid #ffffff13; border-radius: 50%; color: #e9e5ff; background: linear-gradient(145deg, #514b79, #302e49); font-size: 15px; font-weight: 700; text-transform: uppercase; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-xl { width: 58px; height: 58px; flex-basis: 58px; font-size: 20px; }
.me-info { display: grid; min-width: 0; gap: 4px; flex: 1; }
.notification-status { color: var(--muted); font-size: 10px; line-height: 1.35; }
.me-info strong, .chat-title strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.change-photo { width: fit-content; color: var(--accent); font-size: 11px; cursor: pointer; }
.text-button { width: fit-content; padding: 0; border: 0; color: var(--muted); background: transparent; font-size: 11px; text-align: left; cursor: pointer; }
.text-button:hover { color: var(--text); }
.icon-button { display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 10px; color: var(--muted); background: transparent; font-size: 21px; cursor: pointer; transition: .16s ease; }
.icon-button:hover { color: var(--text); background: var(--panel-hover); }
.small-icon { width: 30px; height: 30px; font-size: 20px; }
.sidebar-section { padding: 17px 16px 0; }
.section-label, .section-heading h2 { margin: 0; color: #c3c8d4; font-size: 11px; font-weight: 750; letter-spacing: .09em; text-transform: uppercase; }
.search-input { width: 100%; height: 40px; margin-top: 10px; padding: 0 12px; border: 1px solid var(--border); border-radius: 11px; color: var(--text); background: #11151e; font-size: 13px; }
.search-input::placeholder, textarea::placeholder { color: #788194; }
.section-heading { display: flex; align-items: center; justify-content: space-between; min-height: 30px; }
.count-badge { min-width: 22px; padding: 3px 7px; border-radius: 20px; color: #d8d2ff; background: #353052; font-size: 11px; text-align: center; }
.stack-list { display: grid; gap: 4px; margin-top: 8px; }
.search-results:empty { display: none; }
.requests-section:has(.stack-list:empty) { display: none; }
.list-row { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 8px; border-radius: 12px; }
.list-row:hover { background: #ffffff06; }
.list-row .avatar { width: 36px; height: 36px; flex-basis: 36px; font-size: 13px; }
.group-avatar { border-radius: 12px; }
.row-info { flex: 1; min-width: 0; }
.row-info strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 600; }
.row-info span { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.row-action { min-height: 30px; padding: 0 10px; border: 1px solid #413a67; border-radius: 9px; color: #d8d1ff; background: #292541; font-size: 11px; cursor: pointer; }
.row-action:hover { background: #393257; }
.friend-list { overflow-y: auto; }
.groups-section { padding-bottom: 12px; }
.groups-section .friend-list { max-height: 190px; }
.friend-row { width: 100%; border: 0; text-align: left; cursor: pointer; }
.friend-row.active, .friend-row.active:hover { background: #2a2641; }
.contact-username { margin-top: 2px !important; font-size: 10px !important; }
.unread-badge { flex: 0 0 auto; min-width: 21px; padding: 3px 6px; border-radius: 20px; color: #10131b; background: var(--success); font-size: 10px; font-weight: 800; text-align: center; }
.mention-badge { flex: 0 0 auto; padding: 4px 7px; border: 1px solid #ff7883; border-radius: 20px; color: #ffe6e8; background: #742a34; font-size: 10px; font-weight: 800; }
.empty-note { padding: 8px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.sidebar-foot { margin: auto 16px 14px; padding-top: 12px; border-top: 1px solid var(--border); color: #737d90; font-size: 11px; }

.chat-panel { position: relative; min-width: 0; min-height: 0; background: radial-gradient(ellipse at 50% 10%, #1d2030, #11141c 65%); }
.feed-view, .profile-view { width: 100%; height: 100%; margin: 0; overflow-y: auto; background: #10131b; }
.feed-topbar { position: sticky; z-index: 2; top: 0; display: flex; align-items: center; justify-content: space-between; height: 64px; padding: 0 22px; border-bottom: 1px solid var(--border); color: #c3b4ff; background: #10131bf2; font-size: 10px; font-weight: 800; letter-spacing: .15em; backdrop-filter: blur(12px); }
.feed-tab { display: grid; place-items: center; height: 48px; border-bottom: 1px solid var(--border); color: #d3d5df; font-size: 13px; font-weight: 650; }
.feed-tabs { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--border); }
.feed-tabs .feed-tab { width: 100%; padding: 0; border: 0; border-bottom: 2px solid transparent; background: transparent; cursor: pointer; }
.feed-tabs .feed-tab.active { border-bottom-color: var(--accent); color: var(--text); }
.suggestions-pane { padding: 10px 18px 26px; }
.suggestions-list { display: grid; gap: 8px; }
.suggestion-row { padding: 12px; border: 1px solid var(--border); background: #171b25; }
.suggestion-row .row-action { min-width: 82px; }
.notifications-view { width: 100%; height: 100%; overflow-y: auto; background: #10131b; }
.notifications-list { display: grid; }
.admin-view { width: 100%; height: 100%; overflow-y: auto; background: #10131b; }
.admin-toolbar { display: flex; align-items: center; gap: 12px; padding: 15px 20px; border-bottom: 1px solid var(--border); }
.admin-toolbar .search-input { flex: 1; min-width: 0; }
.admin-user-list { display: grid; }
.admin-user-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 13px 20px; border: 0; border-bottom: 1px solid var(--border); color: var(--text); background: transparent; text-align: left; cursor: pointer; }
.admin-user-row:hover { background: #1d2030; }
.admin-user-details { display: grid; gap: 4px; min-width: 0; }
.admin-user-details strong { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.admin-user-details > span { color: var(--muted); font-size: 11px; }
.admin-checkbox { display: flex; align-items: center; gap: 9px; padding: 8px 0; color: var(--text); font-size: 13px; }
.admin-checkbox input { accent-color: var(--accent-strong); }
.admin-form-actions { display: flex; justify-content: space-between; gap: 10px; }
.verified-badge { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; color: #10131b; background: #9b8cff; font-size: 11px; font-weight: 900; vertical-align: middle; }
.profile-presence, .user-presence { margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.profile-presence.is-online, .user-presence.is-online { color: var(--success); }
.chat-name-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.read-status { color: var(--muted); font-size: 10px; white-space: nowrap; }
.read-status.is-read { color: #b9aaff; }
.push-settings { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 22px; border-bottom: 1px solid var(--border); background: #171b25; }
.push-settings-copy { display: grid; gap: 5px; min-width: 0; }
.push-settings-copy strong { font-size: 13px; }
.push-settings-copy .notification-status { font-size: 11px; }
.push-switch { position: relative; flex: 0 0 48px; width: 48px; height: 28px; padding: 0; border: 1px solid #51586a; border-radius: 20px; background: #343a49; cursor: pointer; transition: background .18s, border-color .18s; }
.push-switch span { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #f3f4f8; box-shadow: 0 1px 3px #0006; transition: transform .18s; }
.push-switch.is-on { border-color: var(--accent-strong); background: var(--accent-strong); }
.push-switch.is-on span { transform: translateX(20px); }
.push-switch:disabled { cursor: not-allowed; opacity: .55; }
.social-notification { display: grid; grid-template-columns: 42px minmax(0,1fr) auto; align-items: center; gap: 12px; width: 100%; padding: 16px 22px; border: 0; border-bottom: 1px solid var(--border); color: var(--text); background: transparent; text-align: left; cursor: pointer; }
.social-notification:hover, .social-notification.unread { background: #1d2030; }
.social-notification.unread { box-shadow: inset 3px 0 var(--accent); }
.social-notification > span { font-size: 13px; line-height: 1.45; }
.social-notification time { color: var(--muted); font-size: 10px; white-space: nowrap; }
.post-composer { display: flex; gap: 13px; padding: 20px 22px 15px; border-bottom: 1px solid var(--border); }
.post-composer-main { flex: 1; min-width: 0; }
.post-composer textarea { width: 100%; min-height: 54px; padding: 10px 0; resize: vertical; border: 0; outline: 0; color: var(--text); background: transparent; font-size: 14px; line-height: 1.5; }
.post-composer textarea:focus-visible { outline: 0; }
.post-composer-actions { display: flex; align-items: center; gap: 12px; min-height: 48px; margin-top: 8px; border-top: 1px solid var(--border); }
.post-attach-button { color: var(--accent); font-size: 23px; cursor: pointer; }
.post-composer-actions .form-error { flex: 1; min-height: 0; }
.post-attachment-preview { display: flex; align-items: center; gap: 8px; padding: 8px; border-radius: 10px; background: #ffffff0a; color: var(--muted); font-size: 11px; }
.post-preview-media { width: 80px; height: 58px; border-radius: 7px; object-fit: cover; }
.feed-post { padding: 17px 22px 12px; border-bottom: 1px solid var(--border); }
.feed-post-header { display: flex; align-items: center; gap: 12px; }
.feed-post-author { display: grid; gap: 4px; min-width: 0; }
.feed-post-author strong { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.feed-post-author span { color: var(--muted); font-size: 10px; }
.feed-post-content { margin: 11px 0 6px 54px; }
.feed-post-content p { margin: 0 0 12px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; line-height: 1.55; }
.feed-post-media { display: block; width: 100%; max-height: 520px; border: 1px solid var(--border); border-radius: 12px; object-fit: contain; background: #080a10; }
.feed-post-media[src$=".jpg"], .feed-post-media[src$=".jpeg"], .feed-post-media[src$=".png"], .feed-post-media[src$=".webp"], .feed-post-media[src$=".gif"] { width: auto; max-width: 100%; height: auto; max-height: min(75vh, 800px); margin-inline: 0; object-fit: initial; background: transparent; }
.feed-post-media[src$=".jpg"], .feed-post-media[src$=".jpeg"], .feed-post-media[src$=".png"], .feed-post-media[src$=".webp"], .feed-post-media[src$=".gif"] { cursor: zoom-in; }
.feed-post-actions { display: flex; gap: 18px; margin-left: 54px; }
.feed-action { padding: 7px 4px; border: 0; color: var(--muted); background: transparent; font-size: 11px; cursor: pointer; }
.feed-action:hover { color: var(--text); }
.feed-action.liked { color: #ff829a; }
.feed-comments { margin: 8px 0 0 54px; padding-top: 10px; border-top: 1px solid var(--border); }
.feed-comment-list { display: grid; gap: 10px; }
.feed-comment { display: flex; gap: 9px; }
.comment-avatar { width: 30px; height: 30px; flex-basis: 30px; font-size: 11px; }
.feed-comment-body strong { font-size: 11px; }
.feed-comment-body p { margin: 4px 0 0; color: #d4d7e0; font-size: 12px; line-height: 1.45; white-space: pre-wrap; }
.feed-comment-form { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; margin-top: 12px; }
.feed-comment-form input { flex: 1; min-width: 0; padding: 9px 11px; border: 1px solid var(--border); border-radius: 10px; color: var(--text); background: #171b25; font-size: 12px; }
.feed-comment-form .button { min-height: 35px; }
.feed-empty { padding: 28px 18px; color: var(--muted); text-align: center; font-size: 13px; line-height: 1.5; }
.load-more-posts { display: flex; margin: 16px auto 24px; }
.profile-cover { display: flex; align-items: flex-end; justify-content: flex-end; min-height: 184px; padding: 22px 30px; background: radial-gradient(ellipse at 18% 120%, #6748b9 0, transparent 48%), linear-gradient(120deg, #27203f, #171c2b 68%, #222338); }
.profile-cover span { color: #858ba0; font-size: 10px; font-weight: 750; letter-spacing: .14em; }
.profile-card { width: 100%; margin: 0; padding: 0 24px 25px; border-bottom: 1px solid var(--border); background: #10131b; }
.profile-card-top { position: relative; display: flex; align-items: center; justify-content: space-between; min-height: 64px; margin-top: -54px; }
.profile-avatar-action { width: 108px; height: 108px; flex-basis: 108px; padding: 0; border: 4px solid #10131b; background-clip: padding-box; cursor: pointer; }
.profile-card h1 { margin: 13px 0 3px; font-size: 22px; }
.profile-handle { margin: 0; color: var(--muted); font-size: 12px; }
.profile-bio { max-width: 650px; margin: 18px 0 0; color: #d7d9e2; font-size: 13px; line-height: 1.55; white-space: pre-wrap; }
.profile-social-stats { display: flex; flex-wrap: wrap; gap: 22px; margin-top: 23px; color: var(--muted); font-size: 11px; }
.profile-stat-button { padding: 0; border: 0; color: var(--muted); background: transparent; font-size: 11px; cursor: pointer; }
.profile-stat-button:hover { color: var(--text); }
.profile-stat-button strong { margin-right: 4px; color: var(--text); font-size: 13px; }
.profile-age { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.profile-details { display: grid; grid-template-columns: 110px 1fr; gap: 12px 16px; margin: 26px 0; font-size: 12px; }
.profile-details dt { color: var(--muted); }
.profile-details dd { margin: 0; overflow-wrap: anywhere; }
.profile-logout { margin: 0 0 20px; color: var(--danger); }
.profile-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.profile-posts-tab { display: grid; place-items: center; height: 48px; border-bottom: 1px solid var(--border); color: var(--text); font-size: 12px; font-weight: 700; }
.profile-notifications { display: grid; gap: 7px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.profile-notifications .notification-status { min-height: 14px; }
.relations-list { display: grid; gap: 4px; max-height: 55vh; margin-top: 14px; overflow-y: auto; }
.profile-relation-row { width: 100%; border: 0; color: var(--text); background: transparent; text-align: left; cursor: pointer; }
.profile-relation-row:hover { background: #ffffff0a; }
.feed-comment { align-items: flex-start; }
.feed-comment-body { flex: 1; min-width: 0; }
.feed-comment-reply { flex: 0 0 auto; padding: 3px 5px; border: 0; color: var(--muted); background: transparent; font-size: 10px; cursor: pointer; }
.feed-comment-reply:hover { color: var(--accent); }
.comment-quoted-reply { margin: 5px 0 !important; padding-left: 8px; border-left: 2px solid var(--accent); color: var(--muted) !important; font-size: 10px !important; }
.comment-reply-preview { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px; border-left: 3px solid var(--accent); border-radius: 6px; background: #ffffff0a; color: var(--muted); font-size: 11px; }
.chat-profile-avatar { padding: 0; cursor: pointer; }
.chat-profile-link { padding: 0; border: 0; color: var(--text); background: transparent; text-align: left; font-size: 13px; font-weight: 700; cursor: pointer; }
.chat-profile-link:hover, .profile-clickable:hover { color: #c3b4ff; }
.profile-clickable { cursor: pointer; }
.profile-clickable:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.auth-form textarea { width: 100%; padding: 11px 13px; resize: vertical; border: 1px solid var(--border); border-radius: 11px; color: var(--text); background: #11151e; }
.welcome-panel { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 28px; text-align: center; }
.welcome-art { position: relative; width: 114px; height: 100px; display: grid; place-items: center; margin-bottom: 24px; border: 1px solid #a899ff35; border-radius: 34px; color: #d8d1ff; background: linear-gradient(145deg,#262441,#1a1d2a); transform: rotate(-5deg); }
.welcome-bubble { position: relative; width: 54px; height: 39px; border: 3px solid var(--accent); border-radius: 15px; }
.welcome-bubble::after { content: ""; position: absolute; bottom: -8px; left: 9px; width: 10px; height: 10px; border-left: 3px solid var(--accent); border-bottom: 3px solid var(--accent); border-radius: 0 0 0 3px; background: #24223d; transform: skew(-18deg) rotate(-25deg); }
.welcome-art span:last-child { position: absolute; right: -14px; bottom: -7px; display: grid; place-items: center; width: 42px; height: 42px; border: 4px solid #151823; border-radius: 50%; background: #383253; font-size: 19px; }
.welcome-panel h2 { margin: 0; font-size: 21px; letter-spacing: -.03em; }
.welcome-panel p { max-width: 320px; margin: 10px 0 20px; color: var(--muted); font-size: 14px; line-height: 1.55; }
.conversation { height: 100%; display: flex; flex-direction: column; }
.chat-header { flex: 0 0 72px; display: flex; align-items: center; gap: 12px; padding: 0 24px; border-bottom: 1px solid var(--border); background: #171b25e8; }
.chat-title { display: grid; gap: 4px; min-width: 0; }
.chat-title span { color: var(--muted); font-size: 11px; }
.back-button { display: none; font-size: 31px; }
.messages { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 12px; padding: 22px max(24px, calc((100% - 820px) / 2)); overflow-y: auto; scroll-behavior: smooth; }
.day-divider { align-self: center; padding: 5px 10px; border: 1px solid var(--border); border-radius: 20px; color: var(--muted); background: #1b1f2b; font-size: 10px; }
.message-row { display: flex; width: 100%; }
.message-row.mine { justify-content: flex-end; }
.bubble { max-width: min(74%, 510px); padding: 10px 13px 7px; border: 1px solid #343a49; border-radius: 16px 16px 16px 5px; background: #202532; overflow-wrap: anywhere; }
.mine .bubble { border-color: #6556be; border-radius: 16px 16px 5px 16px; background: #51469a; }
.message-text { white-space: pre-wrap; line-height: 1.48; font-size: 14px; }
.mention-tag { padding: 1px 3px; border-radius: 4px; color: #ffecae; background: #ffffff22; font-weight: 750; }
.mention-notice { display: block; width: fit-content; margin: 0 0 6px; padding: 3px 7px; border-radius: 8px; color: #fff0bb; background: #7a541e; font-size: 10px; font-weight: 800; }
.quoted-message { display: grid; gap: 3px; width: 100%; margin-bottom: 7px; padding: 7px 9px; border: 0; border-left: 3px solid #b8aaff; border-radius: 4px 8px 8px 4px; color: #e2defb; background: #ffffff12; text-align: left; cursor: pointer; }
.quoted-message strong, .quoted-message span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
.quoted-message span { color: #c9c9d4; }
.message-footer { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.message-time { margin: 0; }
.reply-action { padding: 2px 4px; border: 0; color: #d4cdfd; background: transparent; font-size: 10px; cursor: pointer; }
.reply-action:hover { text-decoration: underline; }
.deleted-message { color: var(--muted); font-style: italic; }
.reply-preview { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; padding: 8px 10px; border-left: 3px solid var(--accent); border-radius: 7px; background: #ffffff0b; }
.reply-preview-copy { overflow: hidden; color: #dedaf7; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.reply-preview-close { flex: 0 0 auto; border: 0; color: var(--muted); background: transparent; font-size: 18px; cursor: pointer; }
.mention-suggestions { position: absolute; z-index: 6; bottom: calc(100% + 8px); left: 10px; width: min(310px, calc(100vw - 40px)); max-height: 250px; overflow-y: auto; padding: 5px; border: 1px solid var(--border); border-radius: 12px; background: #202532; box-shadow: 0 12px 35px #0008; }
.mention-option { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; padding: 9px; border: 0; border-radius: 8px; color: var(--text); background: transparent; text-align: left; cursor: pointer; }
.mention-option:hover { background: #ffffff12; }
.mention-option strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.mention-option span { color: var(--muted); font-size: 10px; }
.message-sender { display: block; margin-bottom: 4px; color: #c6baff; font-size: 11px; font-weight: 700; }
.message-time { display: block; margin-top: 5px; color: #b5b8c4; font-size: 10px; text-align: right; }
.message-media { display: block; max-width: min(100%, 370px); max-height: 340px; border-radius: 10px; object-fit: contain; cursor: zoom-in; }
.bubble video { display: block; max-width: min(100%, 390px); max-height: 340px; border-radius: 10px; background: #08090c; }
.empty-chat { align-self: center; margin: auto; color: var(--muted); font-size: 13px; text-align: center; }
.composer { position: relative; flex: 0 0 auto; display: grid; grid-template-columns: auto minmax(0, 1fr) 40px; align-items: end; gap: 8px; width: min(100% - 48px, 820px); margin: 0 auto 20px; padding: 9px 10px 25px; border: 1px solid #363c4d; border-radius: 16px; background: #1b1f2a; box-shadow: 0 10px 40px #0002; }
.composer-tools { display: flex; gap: 2px; align-self: center; }
.tool-button { color: #a6adbe; font-size: 23px; }
.composer textarea { width: 100%; max-height: 140px; min-height: 40px; padding: 10px 3px; resize: none; border: 0; outline: 0; color: var(--text); background: transparent; line-height: 1.45; font-size: 14px; }
.composer textarea:focus-visible { outline: 0; }
.send-button { width: 38px; height: 38px; border: 0; border-radius: 12px; color: white; background: var(--accent-strong); font-size: 24px; cursor: pointer; transition: .16s ease; }
.send-button:hover { background: #8978ff; transform: translateY(-1px); }
.composer-hint { position: absolute; bottom: 7px; left: 59px; margin: 0; color: #70798b; font-size: 10px; }
.emoji-wrap { position: relative; }
.emoji-picker { position: absolute; z-index: 5; left: 0; bottom: 48px; width: min(310px, calc(100vw - 40px)); display: grid; grid-template-columns: repeat(8, 1fr); gap: 3px; padding: 10px; border: 1px solid var(--border); border-radius: 14px; background: #202532; box-shadow: 0 12px 35px #0008; }
.emoji-choice { aspect-ratio: 1; padding: 0; border: 0; border-radius: 7px; background: transparent; font-size: 21px; cursor: pointer; }
.emoji-choice:hover { background: #ffffff12; }
.attachment-preview { display: flex; align-items: center; gap: 14px; width: min(100% - 48px, 820px); margin: 0 auto 10px; padding: 12px; border: 1px solid var(--border); border-radius: 14px; background: #1b1f2a; }
.preview-media { width: 76px; height: 64px; border-radius: 9px; object-fit: cover; background: #0c0e13; }
.preview-details { flex: 1; min-width: 0; }
.preview-details strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.preview-details span { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; }
.preview-actions { display: flex; gap: 7px; }
.preview-actions .button { min-height: 34px; padding: 0 11px; }
.image-modal { position: fixed; z-index: 10; inset: 0; display: grid; place-items: center; padding: 36px; background: #080a10ed; }
.image-modal img { max-width: 100%; max-height: 100%; object-fit: contain; }
.modal-close { position: absolute; top: 17px; right: 20px; width: 44px; height: 44px; border: 0; border-radius: 50%; color: white; background: #ffffff17; font-size: 30px; cursor: pointer; }
.dialog-card { position: relative; width: min(100%, 470px); max-height: calc(100dvh - 40px); padding: 28px; overflow-y: auto; border: 1px solid var(--border); border-radius: 20px; background: var(--panel); box-shadow: 0 24px 80px #0009; text-align: left; }
.dialog-card h2 { margin: 0; padding-right: 38px; font-size: 20px; }
.dialog-card .modal-close { top: 12px; right: 12px; }
.dialog-card .auth-form { gap: 8px; margin-top: 18px; }
.dialog-card .auth-form > label { margin-top: 4px; }
.compact-dialog { width: min(100%, 410px); }
.dialog-copy { margin: 10px 0 16px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.invite-friends-list { display: grid; gap: 4px; max-height: 280px; margin: 12px 0; overflow-y: auto; }
.invite-check-row { display: flex; align-items: center; gap: 10px; padding: 9px; border-radius: 10px; cursor: pointer; }
.invite-check-row:hover { background: #ffffff08; }
.invite-check-row input { accent-color: var(--accent-strong); }
.invite-check-row .avatar { width: 32px; height: 32px; flex-basis: 32px; }

@media (max-width: 760px) {
  .app-shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(210px, 30dvh) minmax(0, 1fr); }
  .sidebar { min-height: 0; border-right: 0; border-bottom: 1px solid var(--border); }
  .chat-panel { display: block; min-height: 0; }
  .feed-view, .profile-view { width: 100%; border: 0; }
  .feed-topbar { height: 54px; padding: 0 15px; }
  .post-composer { gap: 9px; padding: 14px; }
  .post-composer .avatar { width: 34px; height: 34px; flex-basis: 34px; }
  .feed-post { padding: 14px; }
  .feed-post-content, .feed-post-actions { margin-left: 0; }
  .feed-comments { margin-left: 0; }
  .profile-cover { min-height: 140px; padding: 16px; }
  .profile-card { padding: 0 15px 22px; }
  .profile-avatar-action { width: 88px; height: 88px; flex-basis: 88px; }
  .profile-actions { gap: 6px; }
  .app-shell.chat-open .sidebar { display: none; }
  .app-shell.chat-open .chat-panel { display: block; }
  .app-shell.chat-open { grid-template-rows: minmax(0, 1fr); }
  .back-button { display: grid; margin-left: -8px; }
  .chat-header { flex-basis: 64px; gap: 9px; padding: 0 14px; }
  .messages { padding: 17px 13px; }
  .bubble { max-width: 84%; }
  .composer { width: calc(100% - 20px); margin-bottom: max(10px, env(safe-area-inset-bottom)); }
  .attachment-preview { width: calc(100% - 20px); }
  .sidebar-header { padding-top: max(16px, env(safe-area-inset-top)); }
  .auth-card { padding: 29px 24px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}

@media (max-width: 760px) {
  .app-shell { position: relative; display: block; width: 100%; height: var(--visible-viewport-height, 100dvh); overflow: hidden; }
  .sidebar { position: fixed; z-index: 12; right: 0; bottom: 0; left: 0; display: block; width: 100%; height: calc(68px + env(safe-area-inset-bottom)); min-height: 0; overflow: visible; border: 0; border-top: 1px solid var(--border); background: #171b25f7; }
  .sidebar-header { position: fixed; z-index: 13; top: 0; left: 0; display: block; width: 100%; height: 40px; padding: 6px 12px; border: 0; background: #171b25f7; }
  .sidebar-header .brand-home-button { font-size: 12px; }
  .sidebar-header .brand-mark.small { width: 26px; height: 26px; }
  .sidebar-header .me-row { display: none; }
  .app-nav { display: flex; align-items: center; justify-content: space-around; gap: 2px; height: 68px; padding: 4px 5px max(4px, env(safe-area-inset-bottom)); }
  .nav-item { position: relative; display: flex; flex: 1 1 0; flex-direction: column; justify-content: center; gap: 1px; min-width: 0; min-height: 54px; padding: 3px 1px; font-size: 9px; white-space: nowrap; }
  .nav-item span:not(.nav-badge) { width: auto; font-size: 18px; line-height: 1.1; }
  .nav-badge { position: absolute; top: 1px; right: calc(50% - 23px); min-width: 16px; height: 16px; padding: 0 4px; margin: 0; font-size: 9px !important; }
  .new-post-button { display: none; }
  .chat-panel { position: absolute; inset: 40px 0 calc(68px + env(safe-area-inset-bottom)); display: block; min-height: 0; }
  .feed-view, .profile-view, .notifications-view, .admin-view { width: 100%; height: 100%; border: 0; }
  .feed-topbar { height: 48px; padding: 0 12px; }
  .feed-topbar > span { margin-left: 38px; }
  .feed-tabs .feed-tab { height: 43px; }
  .post-composer { gap: 9px; padding: 12px; }
  .post-composer-actions { gap: 8px; }
  .post-composer-actions .form-error { font-size: 11px; }
  .feed-post { padding: 13px 12px 10px; }
  .feed-post-content, .feed-post-actions, .feed-comments { margin-left: 0; }
  .feed-post-content p { font-size: 14px; }
  .feed-post-media { max-height: 65vh; }
  .profile-cover { min-height: 124px; padding: 13px; }
  .profile-cover span { transform: translateY(-7px); }
  .profile-card { padding: 0 13px 20px; }
  .profile-card-top { min-height: 57px; margin-top: -43px; }
  .profile-avatar-action { width: 86px; height: 86px; flex-basis: 86px; }
  .profile-actions { justify-content: flex-end; gap: 5px; }
  .profile-actions .button { min-height: 34px; padding: 0 9px; font-size: 11px; }
  .profile-card h1 { font-size: 19px; }
  .profile-social-stats { gap: 15px; }
  .social-notification { grid-template-columns: 36px minmax(0,1fr); gap: 9px; padding: 13px 12px; }
  .social-notification time { grid-column: 2; }
  .push-settings { gap: 12px; padding: 14px 13px; }
  .admin-toolbar { align-items: stretch; flex-direction: column; padding: 12px; }
  .admin-user-row { padding: 12px; }
  .app-shell.show-conversations:not(.chat-open) .sidebar { position: absolute; top: 40px; right: 0; bottom: calc(68px + env(safe-area-inset-bottom)); left: 0; width: 100%; height: auto; overflow-x: hidden; overflow-y: auto; border: 0; background: var(--panel); }
  .app-shell.show-conversations:not(.chat-open) .app-nav { position: fixed; z-index: 14; top: auto; right: 0; bottom: 0; left: 0; height: calc(68px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); background: #171b25f7; }
  .app-shell.show-conversations:not(.chat-open) .chat-panel { display: none; }
  .app-shell.chat-open .sidebar { display: none; }
  .app-shell.chat-open .sidebar-header { display: none; }
  .app-shell.chat-open .chat-panel { position: absolute; inset: 0; display: block; }
  .app-shell.chat-open { display: block; }
  .chat-header { flex-basis: 60px; gap: 8px; padding: 0 10px; }
  .chat-title { flex: 1; }
  .chat-name-row { gap: 5px; }
  .chat-profile-link { max-width: 48vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .messages { padding: 12px 10px; }
  .bubble { max-width: 88%; }
  .composer { width: calc(100% - 12px); margin-bottom: max(6px, env(safe-area-inset-bottom)); padding-bottom: 24px; }
  .attachment-preview { width: calc(100% - 12px); }
  .image-modal { padding: 14px; }
  .dialog-card { max-height: calc(var(--visible-viewport-height, 100dvh) - 24px); padding: 22px 17px; }
  .profile-details { grid-template-columns: 82px minmax(0,1fr); }
}

@media (max-width: 380px) {
  .nav-item { font-size: 8px; }
  .profile-social-stats { gap: 10px; }
  .profile-actions .button { min-height: 32px; padding: 0 7px; font-size: 10px; }
  .post-composer .avatar { display: none; }
}
