:root {
    --bg: #10081f;
    --card: rgba(28, 17, 50, 0.76);
    --card-strong: rgba(42, 24, 70, 0.88);
    --stroke: rgba(255, 255, 255, 0.14);
    --text: #fff8ff;
    --muted: #d9c8e9;
    --pink: #ff8dd8;
    --purple: #9c7dff;
    --danger: #ff7d9f;
    --ok: #7dffcb;
    --shadow: 0 18px 60px rgba(0,0,0,0.38);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
    margin: 0;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background: radial-gradient(circle at 20% 10%, #44206f 0, transparent 30%),
                radial-gradient(circle at 85% 20%, #2b5aa4 0, transparent 28%),
                linear-gradient(135deg, #0b0618, #170b2d 55%, #090411);
    overflow-x: hidden;
}

.stars {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
    background-repeat: repeat;
    opacity: 0.8;
}
.stars-one {
    background-image: radial-gradient(#fff 1px, transparent 1px);
    background-size: 70px 70px;
    animation: drift 48s linear infinite;
}
.stars-two {
    background-image: radial-gradient(#ffd6fa 1px, transparent 1px);
    background-size: 120px 120px;
    animation: drift 90s linear infinite reverse;
}
.stars-three {
    background-image: radial-gradient(#b8d4ff 1.5px, transparent 1.5px);
    background-size: 190px 190px;
    animation: drift 130s linear infinite;
    opacity: 0.45;
}
@keyframes drift {
    from { transform: translate3d(0,0,0); }
    to { transform: translate3d(-240px, 160px,0); }
}

a { color: inherit; }
button, input, textarea, select { font: inherit; }
input, textarea, select {
    width: 100%;
    color: var(--text);
    background: rgba(255,255,255,0.08);
    border: 1px solid var(--stroke);
    border-radius: 16px;
    padding: 12px 14px;
    outline: none;
}
input:focus, textarea:focus, select:focus {
    border-color: rgba(255,141,216,0.82);
    box-shadow: 0 0 0 4px rgba(255,141,216,0.12);
}
label { display: block; margin: 12px 0 6px; color: var(--muted); }
small { color: var(--muted); }

.glass-card {
    background: var(--card);
    border: 1px solid var(--stroke);
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
    border-radius: 28px;
}
.btn-primary, .btn-ghost, .btn-small, .icon-btn {
    border: 0;
    cursor: pointer;
    text-decoration: none;
    border-radius: 999px;
    transition: transform .12s ease, filter .12s ease, background .12s ease;
}
.btn-primary {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    padding: 12px 18px;
    color: #1b0825;
    font-weight: 800;
    background: linear-gradient(135deg, var(--pink), #ffd1f0 45%, var(--purple));
}
.btn-primary:hover, .btn-small:hover, .icon-btn:hover { transform: translateY(-1px); filter: brightness(1.08); }
.btn-ghost {
    display: inline-flex;
    justify-content: center;
    padding: 12px 18px;
    border: 1px solid var(--stroke);
    background: rgba(255,255,255,0.06);
    color: var(--text);
}
.btn-small {
    display: inline-flex;
    padding: 9px 14px;
    background: rgba(255,255,255,0.11);
    color: var(--text);
    border: 1px solid var(--stroke);
}
.btn-small.ghost { opacity: .82; }
.icon-btn {
    width: 38px;
    height: 38px;
    background: rgba(255,255,255,0.10);
    border: 1px solid var(--stroke);
    color: var(--text);
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    grid-template-columns: minmax(260px, 420px) minmax(300px, 420px);
    gap: 28px;
    padding: 32px;
}
.auth-shell.compact { grid-template-columns: minmax(260px, 360px) minmax(320px, 520px); }
.mascot-card { text-align: center; }
.mascot-card h1 {
    font-size: clamp(42px, 7vw, 76px);
    line-height: .95;
    margin: 6px 0 12px;
    text-shadow: 0 0 26px rgba(255,141,216,.42);
}
.mascot-card p { color: var(--muted); font-size: 18px; }
.mascot-img { width: min(340px, 78vw); filter: drop-shadow(0 22px 45px rgba(0,0,0,.38)); }
.mascot-img.small { width: min(220px, 60vw); }
.auth-card { padding: 28px; }
.auth-card h2 { margin-top: 0; }
.auth-card .btn-primary, .auth-card .btn-ghost { width: 100%; margin-top: 14px; }
.auth-card.wide { max-height: 92vh; overflow: auto; }
.code-input { text-transform: uppercase; letter-spacing: .22em; text-align: center; font-weight: 900; }
.errorlist { color: #ffd1df; margin: 8px 0; }

.topbar {
    width: min(1280px, calc(100vw - 28px));
    margin: 18px auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 16px;
    border: 1px solid var(--stroke);
    border-radius: 26px;
    background: rgba(18, 9, 34, 0.66);
    backdrop-filter: blur(14px);
}
.brand-mini { display: flex; align-items: center; gap: 12px; }
.brand-mascot { width: 58px; height: 58px; }
.brand-title { font-size: 24px; font-weight: 900; }
.brand-subtitle { color: var(--muted); font-size: 13px; }
.top-actions { display: flex; gap: 10px; }

.app-layout {
    width: min(1280px, calc(100vw - 28px));
    margin: 0 auto 36px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 18px;
    align-items: start;
}
.main-column { min-width: 0; }
.composer { padding: 18px; margin-bottom: 18px; }
.composer-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.composer textarea { resize: vertical; min-height: 92px; }
.composer-row { display: grid; grid-template-columns: 1fr 140px auto; gap: 10px; align-items: center; margin-top: 10px; }
.compact-row { grid-template-columns: 1fr 110px auto; }

.feed { display: grid; gap: 18px; }
.post-card { padding: 18px; }
.post-head, .author-line, .comment-head { display: flex; align-items: center; gap: 10px; }
.post-head { justify-content: space-between; }
time { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.post-text { font-size: 17px; line-height: 1.55; }
.post-image { width: 100%; max-height: 520px; object-fit: contain; border-radius: 22px; background: rgba(0,0,0,.22); }
.big-emoji { font-size: 42px; margin-top: 8px; }
.hidden-card { opacity: .64; border-color: rgba(255,125,159,.35); }
.hidden-label { display: inline-flex; margin: 10px 0; color: #ffd1df; font-size: 13px; }
.empty-card { padding: 26px; color: var(--muted); text-align: center; }

.reply-box { margin-top: 12px; }
.reply-box summary { cursor: pointer; color: #ffd1f0; }
.reply-box form { margin-top: 10px; }
.reply-box.mini textarea { min-height: 58px; }
.comments { margin-top: 14px; display: grid; gap: 10px; }
.comment-node { margin-left: 18px; padding-left: 12px; border-left: 1px solid rgba(255,255,255,.12); }
.comment-node:first-child { margin-left: 0; }
.comment-card {
    margin-top: 10px;
    padding: 12px;
    border-radius: 18px;
    background: rgba(255,255,255,0.065);
    border: 1px solid rgba(255,255,255,0.08);
}
.comment-card p { margin: 8px 0; color: #fff8ff; }
.comment-image { max-width: 320px; width: 100%; border-radius: 16px; }
.comment-emoji { font-size: 26px; }

.right-column { position: sticky; top: 14px; display: grid; gap: 14px; }
.sidebar-card, .chat-placeholder { padding: 14px; }
.sidebar-search { margin-bottom: 12px; }
.user-list { display: grid; gap: 8px; max-height: 54vh; overflow: auto; padding-right: 4px; }
.user-card {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 10px;
    border-radius: 18px;
    background: rgba(255,255,255,0.065);
    border: 1px solid rgba(255,255,255,.08);
}
.user-main { min-width: 0; }
.user-name { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-status { font-size: 12px; }
.user-status.online { color: var(--ok); }
.user-status.offline { color: #b9a9c8; }
.chat-placeholder h3 { margin: 0 0 8px; }
.chat-placeholder p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.45; }

.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    border-radius: 50%;
    object-fit: cover;
    background: linear-gradient(135deg, var(--pink), var(--purple));
    color: #180820;
    font-weight: 900;
    border: 2px solid rgba(255,255,255,.34);
}
.avatar.small { width: 42px; height: 42px; }
.avatar.tiny { width: 32px; height: 32px; font-size: 13px; }

.toast-box { position: fixed; right: 18px; top: 18px; z-index: 50; display: grid; gap: 8px; }
.toast {
    max-width: 340px;
    padding: 12px 14px;
    border-radius: 18px;
    border: 1px solid var(--stroke);
    background: rgba(26, 12, 46, .92);
    box-shadow: var(--shadow);
}
.toast-error { border-color: rgba(255,125,159,.55); }
.toast-success { border-color: rgba(125,255,203,.55); }
.toast-warning { border-color: rgba(255,214,117,.55); }

@media (max-width: 900px) {
    .auth-shell, .auth-shell.compact { grid-template-columns: 1fr; }
    .app-layout { grid-template-columns: 1fr; }
    .right-column { position: static; }
    .composer-row, .compact-row { grid-template-columns: 1fr; }
    .topbar { align-items: flex-start; flex-direction: column; }
}
