:root {
    --primary: #39ff14;
    --primary-dark: #28d810;
    --accent: #ff006e;
    --accent-alt: #00e5ff;
    --bg: #0a0a0f;
    --surface: #14141f;
    --surface-variant: #1e1e2e;
    --text: #f5f5fa;
    --text-muted: #8b8ba0;
    --text-on-primary: #0a0a0f;
    --divider: #2a2a3a;
    --like: #ff006e;
    --live-bg: #1a2a18;
    --live-stroke: #39ff14;
    --hot-bg: #2a1020;
    --hot-stroke: #ff006e;
    --radius: 16px;
    --radius-lg: 24px;
    --nav-h: 72px;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    min-height: 100dvh;
}

body.page-auth { padding-bottom: 0; }

a { color: var(--accent-alt); text-decoration: none; }
a:hover { text-decoration: underline; }

.icon-svg { display: block; flex-shrink: 0; }

/* App shell — mobile-first; expands on desktop */
.app-shell {
    min-height: 100vh;
    min-height: 100dvh;
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    background: var(--bg);
    position: relative;
    display: flex;
    flex-direction: column;
}

body.has-nav .app-main {
    min-height: calc(100vh - var(--nav-h));
    min-height: calc(100dvh - var(--nav-h));
    padding-bottom: 16px;
    flex: 1;
}

body.page-auth .app-shell {
    max-width: 520px;
}

body.page-auth .app-main {
    min-height: 100vh;
    min-height: 100dvh;
    padding-bottom: 0;
    flex: 1;
}

/* Auth — matches Android login gradient card */
.auth-page {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

.auth-hero {
    flex: 1;
    min-height: 220px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent-alt) 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px 64px;
    text-align: center;
}

.auth-logo {
    font-size: 2.75rem;
    font-weight: 800;
    color: var(--text-on-primary);
    letter-spacing: -0.02em;
}

.auth-tagline {
    margin-top: 8px;
    font-size: 1.05rem;
    color: rgba(10, 10, 15, 0.88);
    font-weight: 500;
}

.auth-card {
    background: var(--surface);
    border: 1px solid var(--divider);
    border-radius: var(--radius-lg);
    margin: -40px 20px 32px;
    padding: 28px 24px;
    box-shadow: var(--shadow);
}

.auth-card h2 {
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.legal-accept {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 16px 0 4px;
    font-size: 0.9rem;
    line-height: 1.45;
    color: var(--text-secondary);
    cursor: pointer;
}

.legal-accept input {
    margin-top: 3px;
    flex-shrink: 0;
    accent-color: var(--primary);
}

.legal-accept a {
    color: var(--accent-alt);
    font-weight: 600;
}

.legal-login-links {
    margin-top: 18px;
    text-align: center;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.legal-login-links a {
    color: var(--text-secondary);
}

.page-legal .app-main {
    padding-bottom: 32px;
}

.legal-header .legal-meta {
    margin-top: 6px;
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

.legal-doc {
    max-width: 720px;
    margin: 0 auto;
    padding: 8px 20px 40px;
    line-height: 1.65;
    color: var(--text-primary);
}

.legal-doc h2 {
    margin-top: 1.6rem;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.legal-doc h3 {
    margin-top: 1rem;
    margin-bottom: 0.35rem;
    font-size: 1rem;
}

.legal-doc ul {
    margin: 0.5rem 0 1rem 1.2rem;
}

.legal-doc a {
    color: var(--accent-alt);
}

.legal-footer-links {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--divider);
    font-size: 0.95rem;
}

.auth-card .sub {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 22px;
}

/* Forms */
.form-group { margin-bottom: 16px; }

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.input-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 14px;
    border: 1px solid var(--divider);
    border-radius: 14px;
    background: var(--surface-variant);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-wrap:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(57, 255, 20, 0.15);
}

.input-icon {
    color: var(--primary);
    display: flex;
    align-items: center;
}

.input-wrap input,
.form-group textarea {
    flex: 1;
    width: 100%;
    padding: 13px 0;
    border: none;
    background: transparent;
    color: var(--text);
    font-size: 1rem;
    font-family: inherit;
    outline: none;
}

.form-group textarea {
    padding: 12px 14px;
    border: 1px solid var(--divider);
    border-radius: 14px;
    background: var(--surface-variant);
    resize: vertical;
    min-height: 100px;
}

.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(57, 255, 20, 0.15);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 22px;
    border: none;
    border-radius: 28px;
    font-size: 1rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: transform 0.12s, filter 0.12s;
    text-decoration: none;
}

.btn:hover { text-decoration: none; filter: brightness(1.08); }
.btn:active { transform: scale(0.98); }

.btn-primary {
    background: var(--primary);
    color: var(--text-on-primary);
    width: 100%;
    box-shadow: 0 4px 20px rgba(57, 255, 20, 0.25);
}

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--primary);
    color: var(--primary);
}

.btn-accent { background: var(--accent); color: #fff; }
.btn-sm { padding: 8px 16px; font-size: 0.85rem; border-radius: 20px; }
.btn-icon { padding: 10px; border-radius: 50%; background: var(--surface-variant); color: var(--text); border: 1px solid var(--divider); }

.toggle-link {
    display: block;
    text-align: center;
    margin-top: 18px;
    color: var(--accent-alt);
    font-weight: 700;
    font-size: 0.95rem;
}

.toggle-link:hover { text-decoration: underline; }

.alert {
    padding: 12px 14px;
    border-radius: 12px;
    margin-bottom: 16px;
    font-size: 0.9rem;
    font-weight: 500;
}
.alert-error { background: #3a1520; color: #ff8fa8; border: 1px solid var(--accent); }
.alert-success { background: var(--live-bg); color: var(--primary); border: 1px solid var(--live-stroke); }
.alert-info { background: #1a2030; color: var(--accent-alt); border: 1px solid var(--accent-alt); }

.notification-alert {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.notification-alert-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

.notification-alert-link {
    font-weight: 700;
    font-size: 0.88rem;
}

.notification-dismiss {
    border: none;
    background: transparent;
    color: inherit;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
    opacity: 0.75;
}

.notification-dismiss:hover {
    opacity: 1;
}

.post-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    flex-shrink: 0;
}

.post-delete-btn {
    color: var(--text-muted);
}

.post-delete-btn:hover {
    color: #ff8fa8;
}

.hidden { display: none !important; }

/* Page header — Android toolbar style */
.page-header {
    background: var(--surface);
    border-bottom: 1px solid var(--divider);
    padding: 16px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 20;
    min-height: 56px;
}

.page-header h1 {
    font-size: 1.45rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    flex: 1;
}

.page-header .header-back {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--text);
    font-weight: 600;
    font-size: 0.9rem;
    padding: 6px 0;
}
.page-header .header-back:hover { color: var(--primary); text-decoration: none; }

.page-header .header-actions { display: flex; gap: 8px; align-items: center; }

/* Badges — live pill & trending pill */
.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 5px 12px;
    border-radius: 20px;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.pill-live {
    background: var(--live-bg);
    color: var(--primary);
    border: 1px solid var(--live-stroke);
}

.pill-hot {
    background: var(--hot-bg);
    color: var(--accent);
    border: 1px solid var(--hot-stroke);
}

.live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    box-shadow: 0 0 8px var(--primary);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.container {
    padding: 16px;
    width: 100%;
    max-width: 720px;
    margin: 0 auto;
}

.section-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-muted);
}

.empty-state {
    text-align: center;
    padding: 56px 24px;
    color: var(--text-muted);
}
.empty-state .emoji { font-size: 3.5rem; margin-bottom: 16px; line-height: 1; }
.empty-state p { font-size: 0.95rem; line-height: 1.6; }

/* Post card — Material card like Android */
.post-card {
    background: var(--surface);
    border: 1px solid var(--divider);
    border-radius: var(--radius);
    margin-bottom: 14px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
}

.post-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 14px 6px;
}

.post-header a { color: inherit; text-decoration: none; }
.post-header a:hover .name { color: var(--primary); }

.avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent-alt));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1rem;
    color: var(--text-on-primary);
    flex-shrink: 0;
    overflow: hidden;
    border: 2px solid var(--divider);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.sm { width: 32px; height: 32px; font-size: 0.8rem; }
.avatar.lg { width: 96px; height: 96px; font-size: 2.2rem; }

.post-meta .name { font-weight: 700; font-size: 0.95rem; transition: color 0.15s; }
.post-meta .time { font-size: 0.78rem; color: var(--text-muted); margin-top: 1px; }
.post-meta { flex: 1; min-width: 0; }

.post-share-btn {
    margin-left: auto;
    flex-shrink: 0;
    color: var(--text-muted);
}
.post-share-btn:hover { color: var(--primary); }

.action-btn-static {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.9rem;
    padding: 8px 10px;
    cursor: default;
}

.post-body {
    padding: 4px 14px 12px;
    font-size: 0.95rem;
    white-space: pre-wrap;
    line-height: 1.55;
}

.post-media-frame {
    margin: 0 14px 12px;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
    border: 1px solid var(--divider);
    display: block;
    width: calc(100% - 28px);
    padding: 0;
    cursor: pointer;
    position: relative;
    font: inherit;
    color: inherit;
    text-align: left;
}

.post-media-tap:hover {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(57, 255, 20, 0.2);
}

.post-media-tap:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.post-media-preview {
    pointer-events: none;
}

.media-play-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.35);
    color: #fff;
    pointer-events: none;
}

.media-expand-hint {
    position: absolute;
    bottom: 8px;
    right: 10px;
    font-size: 0.72rem;
    font-weight: 700;
    color: #fff;
    background: rgba(0, 0, 0, 0.55);
    padding: 4px 10px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    pointer-events: none;
}

/* Fullscreen media lightbox */
.media-lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 16px 16px;
}

.media-lightbox.hidden {
    display: none !important;
}

body.media-lightbox-open {
    overflow: hidden;
}

.media-lightbox-close {
    position: absolute;
    top: 12px;
    right: 16px;
    z-index: 10001;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 1.75rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.media-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.22);
}

.media-lightbox-content {
    width: 100%;
    max-width: min(1200px, 100%);
    max-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.media-lightbox-media {
    max-width: 100%;
    max-height: calc(100vh - 80px);
    max-height: calc(100dvh - 80px);
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
}

.media-lightbox-content video.media-lightbox-media {
    width: 100%;
    max-height: calc(100vh - 80px);
    max-height: calc(100dvh - 80px);
    background: #000;
}

.post-media {
    width: 100%;
    max-height: min(72vh, 640px);
    min-height: 120px;
    object-fit: contain;
    display: block;
    vertical-align: middle;
    background: #000;
}

.post-media-wrap video.post-media {
    max-height: min(72vh, 640px);
    min-height: 160px;
    object-fit: contain;
    background: #000;
}

.post-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 4px 8px 10px;
    border-top: 1px solid var(--divider);
    margin-top: 4px;
}

.action-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 0.88rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: inherit;
    transition: background 0.15s, color 0.15s;
}

.action-btn:hover { background: var(--surface-variant); }
.action-btn.liked { color: var(--like); }
.action-btn.liked .icon-svg { color: var(--like); fill: var(--like); }

.like-btn .like-icon { display: inline-flex; align-items: center; }
.like-btn .like-icon-filled { display: none; }
.like-btn.liked .like-icon-filled { display: inline-flex; }
.like-btn.liked .like-icon-outline { display: none; }
.like-btn:disabled { opacity: 0.7; cursor: wait; }

.action-form { display: inline; }

/* Comments */
.comments-section {
    padding: 0 14px 14px;
    border-top: 1px solid var(--divider);
    background: rgba(0, 0, 0, 0.15);
}

.comment-list { margin: 12px 0; max-height: 280px; overflow-y: auto; }

.comment {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.comment-bubble {
    background: var(--surface-variant);
    border-radius: 16px;
    padding: 10px 14px;
    flex: 1;
    font-size: 0.9rem;
}

.comment-bubble .user {
    color: var(--primary);
    font-weight: 700;
    font-size: 0.78rem;
    margin-bottom: 2px;
}

.comment-empty {
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 8px 0;
}

.comment-form {
    display: flex;
    gap: 8px;
    align-items: center;
    padding-top: 4px;
}

.comment-form input {
    flex: 1;
    padding: 11px 16px;
    border-radius: 24px;
    border: 1px solid var(--divider);
    background: var(--bg);
    color: var(--text);
    font-size: 0.9rem;
    font-family: inherit;
}

.comment-form input:focus {
    outline: none;
    border-color: var(--primary);
}

.comment-form .btn-send {
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--primary);
    color: var(--text-on-primary);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Bottom nav — Android BottomNavigationView */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    height: var(--nav-h);
    background: var(--surface);
    border-top: 1px solid var(--divider);
    display: flex;
    justify-content: space-around;
    align-items: flex-end;
    z-index: 100;
    padding: 0 4px env(safe-area-inset-bottom);
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.35);
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: #6b6b80;
    font-size: 0.68rem;
    font-weight: 600;
    padding: 8px 4px 10px;
    border-radius: 12px;
    text-decoration: none;
    min-height: 56px;
    transition: color 0.15s;
}

.nav-item:hover { color: var(--text); text-decoration: none; }
.nav-item.active { color: var(--primary); }
.nav-item.active .icon-svg { color: var(--primary); }

.nav-item-create { position: relative; }
.nav-fab {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--text-on-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: -20px;
    box-shadow: 0 4px 16px rgba(57, 255, 20, 0.4);
    border: 3px solid var(--surface);
}

.nav-item-create.active .nav-fab {
    box-shadow: 0 4px 20px rgba(57, 255, 20, 0.6);
}

/* Sidebar structure — mobile hides brand; desktop expands */
.sidebar-brand {
    display: none;
}

.sidebar-links {
    display: flex;
    flex: 1;
    width: 100%;
    justify-content: space-around;
    align-items: flex-end;
}

.app-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.desktop-rail {
    display: none;
}

/* Profile */
.profile-hero {
    text-align: center;
    padding: 28px 20px;
    background: var(--surface);
    border: 1px solid var(--divider);
    border-radius: var(--radius);
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.profile-hero h2 {
    margin-top: 14px;
    font-size: 1.35rem;
    font-weight: 800;
}

.profile-hero .bio {
    color: var(--text-muted);
    margin-top: 8px;
    font-size: 0.95rem;
    line-height: 1.5;
    max-width: 320px;
    margin-left: auto;
    margin-right: auto;
}

.stats-row {
    display: flex;
    justify-content: center;
    margin: 22px 0;
    border-radius: 12px;
    overflow: hidden;
    background: var(--surface-variant);
}

.stat {
    flex: 1;
    text-align: center;
    padding: 12px 8px;
    border-right: 1px solid var(--divider);
}
.stat:last-child { border-right: none; }
.stat .num { font-size: 1.3rem; font-weight: 800; color: var(--text); }
.stat .label { font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; margin-top: 2px; }

.profile-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.profile-actions .btn { min-width: 140px; }

/* Create post */
.create-form {
    background: var(--surface);
    border: 1px solid var(--divider);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow);
}

.create-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.media-buttons { display: flex; gap: 10px; margin: 12px 0; flex-wrap: wrap; }

.media-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 18px;
    border: 1.5px dashed var(--divider);
    border-radius: 14px;
    background: var(--surface-variant);
    color: var(--text);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: border-color 0.15s, color 0.15s;
}

.media-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.media-btn input[type=file] { display: none; }

.preview-media {
    margin: 14px 0;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--divider);
}
.preview-media img,
.preview-media video { width: 100%; display: block; max-height: 280px; object-fit: cover; }

.preview-media .btn-edit-preview {
    display: block;
    width: calc(100% - 24px);
    margin: 12px;
}

body.editor-open { overflow: hidden; }

.image-editor-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
    background: rgba(0, 0, 0, 0.82);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.image-editor-panel {
    width: min(520px, 100%);
    max-height: calc(100vh - 32px);
    overflow: auto;
    background: var(--surface);
    border: 1px solid var(--divider);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px;
}

.image-editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.image-editor-header h2 {
    margin: 0;
    font-size: 1.15rem;
}

.image-editor-close {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    padding: 4px 8px;
}

.image-editor-hint {
    margin: 0 0 12px;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.editor-stage {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--divider);
}

.editor-stage img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.editor-text-layer {
    position: absolute;
    inset: 0;
    touch-action: none;
}

.editor-sticker {
    position: absolute;
    font-weight: 800;
    font-size: 1.35rem;
    line-height: 1.2;
    cursor: grab;
    user-select: none;
    padding: 4px 8px;
    max-width: 90%;
    word-break: break-word;
}

.editor-sticker.dragging { cursor: grabbing; }

.image-editor-controls { margin-top: 14px; }

.editor-text-input {
    width: 100%;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid var(--divider);
    background: var(--background);
    color: var(--text-primary);
    font: inherit;
    margin-bottom: 10px;
}

.image-editor-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.image-editor-actions .btn { flex: 1; }

.image-editor-actions-main { margin-bottom: 0; }

.profile-pic-edit {
    position: relative;
    display: inline-block;
    margin-bottom: 8px;
}

.profile-pic-edit label.camera-btn {
    position: absolute;
    bottom: 4px;
    right: 4px;
    background: var(--primary);
    color: var(--text-on-primary);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 2px solid var(--surface);
    font-size: 1rem;
}

.profile-pic-edit input[type=file] { display: none; }

/* ——— Tablet (mobile layout preserved, slightly wider shell) ——— */
@media (min-width: 600px) and (max-width: 1023px) {
    body:not(.page-admin) {
        background: radial-gradient(ellipse at top, #12121c 0%, #050508 55%);
    }

    .app-shell {
        max-width: 640px;
        border-left: 1px solid var(--divider);
        border-right: 1px solid var(--divider);
        box-shadow: 0 0 80px rgba(0, 0, 0, 0.5);
    }

    body.page-auth .auth-card {
        margin-left: auto;
        margin-right: auto;
    }
}

/* Hover polish on pointer devices */
@media (hover: hover) and (pointer: fine) {
    .post-card {
        transition: border-color 0.15s, box-shadow 0.15s;
    }

    .post-card:hover {
        border-color: rgba(57, 255, 20, 0.25);
        box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
    }

    .nav-item:hover {
        background: rgba(255, 255, 255, 0.04);
    }
}

/* ——— Desktop: full-width app shell, left nav, right rail ——— */
@media (min-width: 1024px) {
    :root {
        --nav-h: 0px;
        --sidebar-w: 268px;
        --rail-w: 320px;
    }

    body.has-nav {
        padding-bottom: 0;
        background: var(--bg);
    }

    body.has-nav .app-shell {
        max-width: none;
        width: 100%;
        margin: 0;
        border: none;
        border-radius: 0;
        box-shadow: none;
        min-height: 100vh;
        display: grid;
        grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
        grid-template-rows: 1fr;
    }

    body.has-nav .app-sidebar.bottom-nav {
        position: sticky;
        top: 0;
        left: auto;
        bottom: auto;
        transform: none;
        width: var(--sidebar-w);
        max-width: none;
        height: 100vh;
        max-height: 100vh;
        flex-direction: column;
        justify-content: flex-start;
        align-items: stretch;
        border-top: none;
        border-right: 1px solid var(--divider);
        padding: 24px 16px;
        box-shadow: none;
        overflow-y: auto;
    }

    body.has-nav .sidebar-brand {
        display: block;
        padding: 4px 12px 28px;
        border-bottom: 1px solid var(--divider);
        margin-bottom: 20px;
    }

    body.has-nav .sidebar-logo {
        font-size: 1.65rem;
        font-weight: 800;
        color: var(--text);
        letter-spacing: -0.03em;
        text-decoration: none;
    }

    body.has-nav .sidebar-logo:hover {
        color: var(--primary);
        text-decoration: none;
    }

    body.has-nav .sidebar-tagline {
        margin-top: 6px;
        font-size: 0.82rem;
        color: var(--text-muted);
        line-height: 1.4;
    }

    body.has-nav .sidebar-links {
        flex-direction: column;
        justify-content: flex-start;
        align-items: stretch;
        gap: 4px;
        flex: 1;
    }

    body.has-nav .app-sidebar .nav-item {
        flex: none;
        flex-direction: row;
        justify-content: flex-start;
        gap: 14px;
        padding: 13px 16px;
        min-height: auto;
        font-size: 0.95rem;
        border-radius: 12px;
    }

    body.has-nav .app-sidebar .nav-item span:not(.nav-fab) {
        font-size: 0.95rem;
    }

    body.has-nav .app-sidebar .nav-item.active {
        background: rgba(57, 255, 20, 0.1);
    }

    body.has-nav .app-sidebar .nav-item-create {
        margin-top: 8px;
        flex-direction: row;
    }

    body.has-nav .app-sidebar .nav-fab {
        margin-top: 0;
        width: 40px;
        height: 40px;
        flex-shrink: 0;
        border-width: 2px;
    }

    body.has-nav .app-body {
        flex-direction: row;
        min-height: 100vh;
        overflow: hidden;
    }

    body.has-nav .app-main {
        flex: 1;
        min-width: 0;
        min-height: 100vh;
        max-height: 100vh;
        overflow-y: auto;
        padding-bottom: 0;
        border-right: 1px solid var(--divider);
    }

    body.has-nav .desktop-rail {
        display: flex;
        flex-direction: column;
        gap: 16px;
        width: var(--rail-w);
        flex-shrink: 0;
        padding: 24px 20px;
        overflow-y: auto;
        max-height: 100vh;
        position: sticky;
        top: 0;
    }

    body.has-nav .rail-card {
        background: var(--surface);
        border: 1px solid var(--divider);
        border-radius: var(--radius);
        padding: 18px;
    }

    body.has-nav .rail-card h2 {
        font-size: 1.1rem;
        margin-bottom: 8px;
    }

    body.has-nav .rail-card h3 {
        font-size: 0.95rem;
        margin-bottom: 10px;
        color: var(--text-muted);
        text-transform: uppercase;
        letter-spacing: 0.04em;
        font-weight: 700;
    }

    body.has-nav .rail-card p {
        color: var(--text-muted);
        font-size: 0.9rem;
        line-height: 1.5;
    }

    body.has-nav .rail-btn {
        width: 100%;
        margin-top: 12px;
    }

    body.has-nav .rail-links {
        list-style: none;
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    body.has-nav .rail-links a {
        display: block;
        padding: 8px 10px;
        border-radius: 10px;
        color: var(--text);
        font-weight: 600;
        font-size: 0.92rem;
    }

    body.has-nav .rail-links a:hover {
        background: rgba(255, 255, 255, 0.05);
        text-decoration: none;
        color: var(--primary);
    }

    body.has-nav .rail-muted {
        background: transparent;
        border-style: dashed;
    }

    body.has-nav .page-header {
        padding: 18px 32px;
    }

    body.has-nav .container {
        padding: 24px 32px 40px;
        max-width: none;
        margin: 0;
    }

    body.has-nav.page-feed .container,
    body.has-nav.page-trending .container {
        padding: 0;
    }

    body.has-nav.page-feed .container > .alert,
    body.has-nav.page-trending .container > .alert {
        margin: 16px 24px;
    }

    body.has-nav.page-feed .post-card,
    body.has-nav.page-trending .post-card {
        margin: 0;
        border-radius: 0;
        box-shadow: none;
        border: 1px solid var(--divider);
        margin-top: -1px;
    }

    body.has-nav.page-feed .post-card:first-of-type,
    body.has-nav.page-trending .post-card:first-of-type {
        margin-top: 0;
    }

    body.has-nav.page-create .container,
    body.has-nav.page-profile .container {
        max-width: 880px;
    }

    body.has-nav .post-media {
        max-height: min(78vh, 820px);
    }

    body.has-nav .create-form {
        max-width: 720px;
    }

    body.has-nav .profile-hero .bio {
        max-width: 480px;
    }

    .onboarding-list {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    .onboarding-card {
        margin-bottom: 0;
    }

    body.page-auth .app-shell {
        max-width: none;
        border: none;
        box-shadow: none;
    }

    body.page-auth .auth-page {
        flex-direction: row;
        align-items: stretch;
    }

    body.page-auth .auth-hero {
        flex: 1;
        min-height: 100vh;
        border-radius: 0;
    }

    body.page-auth .auth-card {
        flex: 1;
        max-width: 480px;
        margin: auto;
        align-self: center;
    }
}

@media (min-width: 1280px) {
    :root {
        --sidebar-w: 280px;
        --rail-w: 340px;
    }

    body.has-nav.page-feed .container,
    body.has-nav.page-trending .container {
        column-count: 2;
        column-gap: 0;
    }

    body.has-nav.page-feed .post-card,
    body.has-nav.page-trending .post-card {
        break-inside: avoid;
        -webkit-column-break-inside: avoid;
        width: 100%;
        display: inline-block;
    }

    body.has-nav.page-feed .container > .alert,
    body.has-nav.page-feed .container > .empty-state,
    body.has-nav.page-trending .container > .alert,
    body.has-nav.page-trending .container > .empty-state {
        column-span: all;
    }
}

@media (min-width: 1600px) {
    body.has-nav.page-feed .container,
    body.has-nav.page-trending .container {
        column-count: 3;
    }
}

/* Admin panel */
body.page-admin .app-main,
.page-admin .admin-main { padding-bottom: 24px; }

.admin-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: var(--surface);
    border-bottom: 1px solid var(--divider);
}

.admin-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: var(--accent);
    color: #fff;
    padding: 3px 8px;
    border-radius: 6px;
    margin-right: 8px;
}

.admin-tabs {
    display: flex;
    gap: 4px;
    padding: 10px 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--divider);
}

.admin-tabs a {
    padding: 8px 14px;
    border-radius: 10px;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
}

.admin-tabs a.active,
.admin-tabs a:hover {
    background: var(--surface-variant);
    color: var(--primary);
    text-decoration: none;
}

.admin-main { padding: 20px 16px; }

.admin-page-title {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 6px;
}

.admin-lead { color: var(--text-muted); margin-bottom: 20px; font-size: 0.95rem; }
.admin-hint { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 12px; }
.admin-section-title { font-size: 1.1rem; margin: 24px 0 8px; font-weight: 700; }

.stat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 8px;
}

.stat-grid-3 { grid-template-columns: 1fr; }

.stat-card {
    background: var(--surface);
    border: 1px solid var(--divider);
    border-radius: var(--radius);
    padding: 18px 16px;
}

.stat-card-accent { border-color: var(--primary); }
.stat-card-retention { border-color: var(--accent-alt); }

.stat-card-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--primary);
    line-height: 1.1;
}

.stat-card-accent .stat-card-value { color: var(--accent-alt); }
.stat-card-retention .stat-card-value { color: var(--accent); }

.stat-card-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 6px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.stat-card-sub {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.admin-split { display: flex; flex-direction: column; gap: 20px; }

.admin-panel {
    background: var(--surface);
    border: 1px solid var(--divider);
    border-radius: var(--radius);
    padding: 16px;
}

.admin-panel h2 {
    font-size: 1rem;
    margin-bottom: 12px;
    font-weight: 700;
}

.admin-user-list { list-style: none; }

.admin-user-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--divider);
}

.admin-user-row:last-child { border-bottom: none; }

.admin-user-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.admin-user-info span {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-lead code {
    font-size: 0.75rem;
    background: var(--surface-variant);
    padding: 2px 6px;
    border-radius: 6px;
    word-break: break-all;
}

/* Onboarding */
.onboarding-lead {
    color: var(--text-muted);
    margin-bottom: 16px;
    font-size: 0.95rem;
}

.onboarding-list { list-style: none; }

.onboarding-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    background: var(--surface);
    border: 1px solid var(--divider);
    border-radius: var(--radius);
    margin-bottom: 10px;
}

.onboarding-meta {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.onboarding-meta span {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.follow-check {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--primary);
    cursor: pointer;
    white-space: nowrap;
}

.follow-check input {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

@media (min-width: 640px) {
    .stat-grid { grid-template-columns: repeat(3, 1fr); }
    .stat-grid-3 { grid-template-columns: repeat(3, 1fr); }
    .admin-split { flex-direction: row; }
    .admin-split .admin-panel { flex: 1; }
}

/* Public shared post page */
.page-public-post .app-main {
    max-width: 560px;
    margin: 0 auto;
}

.public-post-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0 12px;
}

.public-post-logo {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--primary);
    text-decoration: none;
}

.public-post-card-wrap {
    margin-top: 8px;
}

.public-post-cta {
    margin-top: 24px;
    padding: 20px;
    text-align: center;
    background: var(--surface);
    border: 1px solid var(--divider);
    border-radius: 16px;
}

.public-post-cta p {
    color: var(--text-muted);
    margin-bottom: 16px;
}

.public-post-cta .btn {
    margin: 4px;
}

.share-toast {
    position: fixed;
    left: 50%;
    bottom: 88px;
    transform: translateX(-50%) translateY(12px);
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--divider);
    padding: 10px 18px;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 600;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
    z-index: 1200;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.share-toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
