:root {
    --bg: #050816;
    --bg-soft: #020617;
    --card: #0b1024;
    --card-soft: #0f172a;
    --text: #e5e7eb;
    --muted: #a5b4fc;
    --accent: #6366f1;
    --accent-soft: rgba(99, 102, 241, 0.14);
    --accent-strong: #4f46e5;
    --border: #1f2937;
    --danger: #f97373;
    --radius-md: 10px;
    --radius-lg: 14px;
    --shadow-soft: 0 10px 35px rgba(15, 23, 42, 0.9);
    --shadow-card: 0 18px 45px rgba(15, 23, 42, 0.98);
    --fog: .18;
}

/* Global reset / base */

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    color: var(--text);
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Arial, sans-serif;
    line-height: 1.4;
    background:
        radial-gradient(60% 40% at 30% 30%, rgba(79, 70, 229, var(--fog)), transparent 60%),
        radial-gradient(50% 30% at 70% 60%, rgba(236, 72, 153, 0.16), transparent 60%),
        var(--bg-soft);
    background-size: 200% 200%;
    background-attachment: fixed; /* <<< Hintergrund bleibt fest, scrollt nicht mit */
    animation: sn-bg-float 28s ease-in-out infinite alternate;
}

/* Leicht schwebende Animation des Hintergrunds (optional) */
@keyframes sn-bg-float {
    0% {
        background-position: 0% 0%;
    }
    50% {
        background-position: 50% 40%;
    }
    100% {
        background-position: 100% 70%;
    }
}

a {
    color: inherit;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Layout container */

.wrap {
    max-width: 980px;
    margin: 24px auto;
    padding: 0 16px 32px;
}

/* Topbar / Navigation */

.topbar {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 10px 16px;
    background: rgba(11, 15, 26, 0.96);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 20;
    backdrop-filter: blur(18px);
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.9);
}

.brand {
    color: var(--text);
    text-decoration: none;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-size: 0.9rem;
}

.grow {
    flex: 1;
}

.menu-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px 10px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 0.18s ease, border-color 0.18s ease, transform 0.12s ease,
        box-shadow 0.18s ease;
}

.menu-btn:hover {
    background: rgba(15, 23, 42, 0.9);
    border-color: var(--accent);
    transform: translateY(-1px);
    box-shadow: 0 0 12px rgba(129, 140, 248, 0.5);
}

/* User Info / Chip */

.top-user {
    display: flex;
    gap: 10px;
    align-items: center;
}

.userchip {
    display: flex;
    gap: 10px;
    align-items: center;
}

.avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(148, 163, 184, 0.7);
    box-shadow: 0 0 10px rgba(129, 140, 248, 0.45);
}

.avatar-lg {
    width: 42px;
    height: 42px;
}

.username {
    margin-right: 6px;
    font-weight: 600;
}

.meta .line1 {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

/* Level / Gruppen / Wave Badges */

.lvl-badge {
    background: linear-gradient(135deg, #4f46e5, #22c55e);
    color: #020617;
    border-radius: 999px;
    padding: 2px 8px;
    font-weight: 700;
    margin-left: 4px;
    font-size: 0.75rem;
    box-shadow: 0 0 12px rgba(52, 211, 153, 0.8);
}

.group-badge {
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 2px 8px;
    background: var(--group, #111827);
    margin-left: 6px;
    font-size: 0.75rem;
}

.group-badge.glow {
    box-shadow: 0 0 12px var(--group, #6366f1);
}

.wave-badge {
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 2px 8px;
    background: #111827;
    margin-left: 6px;
    opacity: 0.9;
    font-size: 0.75rem;
}

/* XP / Progress */

.xp {
    height: 8px;
    background: #020617;
    border: 1px solid var(--border);
    border-radius: 999px;
    overflow: hidden;
    margin-top: 4px;
}

.xp .bar {
    height: 8px;
    background: linear-gradient(90deg, var(--accent), #aaffaa);
}

.xp-info {
    font-size: 0.72rem;
    color: #b501fc;
    text-align: center;
    margin-top: 2px;
}

/* Buttons / CTA */

.btn {
    background: radial-gradient(circle at top left, rgba(236, 72, 153, 0.18), transparent 55%),
        linear-gradient(135deg, #111827, #020617);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.92rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition:
        background 0.18s ease,
        border-color 0.18s ease,
        transform 0.12s ease,
        box-shadow 0.18s ease,
        opacity 0.12s ease;
}

.btn.small {
    padding: 6px 10px;
    font-size: 0.9rem;
}

.btn.xsmall {
    padding: 4px 8px;
    font-size: 0.8rem;
}

.btn:hover {
    border-color: var(--accent);
    box-shadow: 0 0 18px rgba(129, 140, 248, 0.6);
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
    box-shadow: none;
    opacity: 0.9;
}

/* Like active → rot */

.like-btn.active {
    color: #ff3b3b;
    border-color: #7a2323;
    background: #2a0f0f;
    box-shadow: 0 0 14px rgba(248, 113, 113, 0.7);
}

/* Kleine Icon-Buttons */

.icon-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    padding: 6px 8px;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.85rem;
    transition: background 0.18s ease, border-color 0.18s ease, transform 0.1s ease;
}

.icon-btn:hover {
    background: rgba(15, 23, 42, 0.9);
    border-color: var(--accent);
    transform: translateY(-1px);
}

/* Cards / Panels */

.card {
    background: radial-gradient(circle at top left, rgba(79, 70, 229, 0.16), transparent 60%),
        radial-gradient(circle at bottom right, rgba(236, 72, 153, 0.14), transparent 60%),
        var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 14px 16px;
    margin: 14px 0;
    box-shadow: var(--shadow-card);
}

/* Forms */

input,
select,
textarea {
    width: 100%;
    padding: 10px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #111827;
    color: var(--text);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.5);
    background: #020617;
}

/* Tabellen */

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.table th,
.table td {
    border-bottom: 1px solid var(--border);
    padding: 8px;
    text-align: left;
}

.table th {
    font-weight: 600;
    color: var(--muted);
    background: rgba(15, 23, 42, 0.9);
}

/* Pills / Filter */

.pills {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.8rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #13416b;
    color: inherit;
    text-decoration: none;
    font-size: 0.83rem;
    transition: background 0.16s ease, border-color 0.16s ease, transform 0.1s ease,
        box-shadow 0.16s ease;
}

.pill:hover {
    background: rgba(15, 23, 42, 0.9);
    border-color: var(--accent-strong);
    transform: translateY(-1px);
    box-shadow: 0 0 10px rgba(129, 140, 248, 0.6);
}

.pill.active {
    outline: 2px solid var(--accent);
    background: var(--accent-soft);
}

/* Posts / Feed */

.post-head {
    display: flex;
    gap: 10px;
    align-items: center;
}

.post-username {
    font-weight: 800;
    font-size: 1.1rem;
}

.post-titleline {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

/* Badges */

.badge {
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #111827;
    font-size: 0.78rem;
}

.badge.glow {
    box-shadow: 0 0 10px var(--chip, #6366f1);
}

.post-media {
    width: 100%;
    max-height: 520px;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid var(--border);
    margin-top: 8px;
}

/* Aktionen unter Posts */

.actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

/* Kommentare */

.comment .meta {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-top: 6px;
}

.comment-actions {
    display: flex;
    gap: 6px;
    margin: 6px 0;
}

/* Modals / Hidden */

.modal {
    display: none;
}

.modal.open,
.comment-composer.is-open {
    display: block;
}

.hidden,
.is-hidden {
    display: none;
}

/* Footer */

.foot {
    border-top: 1px solid var(--border);
    padding: 20px;
    text-align: center;
    opacity: 0.7;
    margin-top: 40px;
    font-size: 0.85rem;
}

/* Drawer (Seitliches Menü) */

.drawer {
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    width: 280px;
    background: radial-gradient(circle at top, rgba(34, 197, 94, 0.05), transparent 55%),
        #020817;
    border-left: 1px solid var(--border);
    transform: translateX(100%);
    transition: transform 0.2s ease;
    z-index: 30;
    padding: 12px;
    box-shadow: -12px 0 30px rgba(15, 23, 42, 0.9);
}

.drawer.open {
    transform: translateX(0);
}

.drawer-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.drawer-links {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.drawer-links a {
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #111827;
    font-size: 0.9rem;
    transition: background 0.16s ease, border-color 0.16s ease, transform 0.1s ease;
}

.drawer-links a:hover {
    background: rgba(15, 23, 42, 0.95);
    border-color: var(--accent);
    transform: translateY(-1px);
}

.drawer-section {
    margin-top: 10px;
    opacity: 0.8;
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* Drawer-Backdrop */

.backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 25;
}

.backdrop.show {
    opacity: 1;
    pointer-events: auto;
}

/* Grid & Rows */

.grid.two {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.row {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Post-Menü (Pencil, Kontextmenü) */

.post-menu-wrap {
    position: relative !important;
}

.post-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 6px;
    background: #111827;
    border: 1px solid var(--border);
    border-radius: 10px;
    display: none;
    flex-direction: column;
    min-width: 140px;
    z-index: 10050 !important;
    box-shadow: 0 18px 35px rgba(15, 23, 42, 0.95);
    will-change: top, left;
    transform: none !important;
}

.post-menu.open {
    display: flex;
}

.post-menu button {
    background: transparent;
    border: 0;
    color: var(--text);
    text-align: left;
    padding: 8px 10px;
    cursor: pointer;
    font-size: 0.9rem;
    display: block;
    width: 100%;
    text-decoration: none;
    transition: background 0.16s ease;
}

.post-menu button:hover {
    background: rgba(15, 23, 42, 0.9);
}

.edited-note {
    font-size: 0.8rem;
    opacity: 0.8;
    margin: -6px 0 6px 0;
}

/* Guest Einschränkungen: Kommentare / Buttons */

body.guest .comment-btn {
    display: none !important;
}

body.guest [data-open-comment] {
    display: none !important;
}

/* Responsive */

@media (max-width: 640px) {
    .wrap {
        padding: 0 12px 24px;
        margin-top: 16px;
    }

    .topbar {
        padding: 8px 12px;
    }

    .card {
        padding: 12px 12px;
        margin: 10px 0;
    }

    .grid.two {
        grid-template-columns: 1fr;
    }
}
