/* =========================================================
   LUNATIK.FUN
   Dark Gothic / Old Internet Chat
   ========================================================= */

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    margin: 0;
    min-height: 100vh;

    font-family: Verdana, Tahoma, Arial, sans-serif;
    font-size: 13px;

    color: #d8d8dc;
    background:
        radial-gradient(
            circle at top,
            #1b1820 0%,
            #111014 45%,
            #0b0a0d 100%
        );

    line-height: 1.45;
}


/* =========================================================
   LINKS
   ========================================================= */

a {
    color: #b58cff;
    text-decoration: none;
}

a:hover {
    color: #d1b8ff;
    text-decoration: underline;
}


/* =========================================================
   TOP BAR
   ========================================================= */

.topbar {
    height: 52px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 0 22px;

    background: #141217;

    border-bottom: 1px solid #332b3d;

    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.45);
}

.logo {
    color: #eeeeef;

    font-size: 18px;
    font-weight: bold;

    letter-spacing: -0.3px;
}

.user-menu {
    color: #aaa5af;

    font-size: 12px;
}

.user-menu a {
    color: #b58cff;
}


/* =========================================================
   MAIN CHAT
   ========================================================= */

.chat-container {
    width: 920px;
    max-width: calc(100% - 30px);

    margin: 28px auto;

    background: #121115;

    border: 1px solid #342d3b;

    box-shadow:
        0 8px 25px rgba(0, 0, 0, 0.45);
}


/* =========================================================
   CHAT HEADER
   ========================================================= */

.chat-header {
    padding: 11px 14px;

    background:
        linear-gradient(
            to bottom,
            #211c26,
            #19161d
        );

    border-bottom: 1px solid #342d3b;
}

.chat-header h2 {
    margin: 0;

    color: #e7e3eb;

    font-size: 14px;
    font-weight: bold;
}


/* =========================================================
   MESSAGES
   ========================================================= */

.messages {
    height: 520px;

    overflow-y: auto;

    padding: 15px 16px;

    background:
        linear-gradient(
            to bottom,
            #111014,
            #0f0e12
        );

    scrollbar-width: thin;
    scrollbar-color: #403747 #151319;
}


/* Chrome / Edge scrollbar */

.messages::-webkit-scrollbar {
    width: 9px;
}

.messages::-webkit-scrollbar-track {
    background: #151319;
}

.messages::-webkit-scrollbar-thumb {
    background: #403747;

    border: 2px solid #151319;
}

.messages::-webkit-scrollbar-thumb:hover {
    background: #584b61;
}


/* =========================================================
   MESSAGE
   ========================================================= */

.message {
    margin-bottom: 14px;

    padding-bottom: 10px;

    border-bottom: 1px solid #211e24;
}

.message:last-child {
    border-bottom: none;
}


/* =========================================================
   MESSAGE HEADER
   ========================================================= */

.message-header {
    font-size: 12px;

    line-height: 18px;
}

.message-time {
    color: #6f6875;

    font-family: "Courier New", monospace;
}

.message-username {
    margin-left: 4px;

    color: #ded8e4;

    font-weight: bold;
}


/* =========================================================
   BADGES
   ========================================================= */

.badge {
    margin-left: 5px;

    font-weight: bold;

    font-size: 11px;

    letter-spacing: 0.2px;
}


/* Individual badge colors */

.badge-vip {
    color: #c69bff;
}

.badge-creator {
    color: #b76cff;
}

.badge-moderator {
    color: #78a7ff;
}

.badge-verified {
    color: #72d69b;
}

.badge-developer {
    color: #b5b5bd;
}

.badge-banned {
    color: #e56b76;
}


/* =========================================================
   MESSAGE CONTENT
   ========================================================= */

.message-content {
    margin-top: 3px;
    margin-left: 0;

    color: #c9c5cc;

    font-size: 13px;

    line-height: 20px;

    white-space: pre-wrap;
    word-break: break-word;
}


/* =========================================================
   MESSAGE FORM
   ========================================================= */

.message-form {
    display: flex;

    padding: 10px;

    background: #17151a;

    border-top: 1px solid #342d3b;
}

.message-form input {
    flex: 1;

    height: 35px;

    padding: 7px 9px;

    color: #dedbe2;

    background: #0e0d10;

    border: 1px solid #38313e;

    border-radius: 2px;

    outline: none;

    font-family: Verdana, Tahoma, Arial, sans-serif;
    font-size: 13px;
}

.message-form input::placeholder {
    color: #625c66;
}

.message-form input:focus {
    border-color: #71518e;

    box-shadow:
        0 0 0 1px rgba(126, 87, 165, 0.18);
}

.message-form button {
    height: 35px;

    margin-left: 7px;

    padding: 0 17px;

    color: #ded9e1;

    background:
        linear-gradient(
            to bottom,
            #29232e,
            #211d25
        );

    border: 1px solid #403747;

    border-radius: 2px;

    font-family: Verdana, Tahoma, Arial, sans-serif;
    font-size: 12px;

    cursor: pointer;
}

.message-form button:hover {
    background:
        linear-gradient(
            to bottom,
            #342b3c,
            #29222f
        );

    border-color: #5a4668;
}

.message-form button:active {
    background: #1c1820;
}


/* =========================================================
   AUTH PAGES
   ========================================================= */

.auth-container {
    min-height: 100vh;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 20px;
}

.auth-box {
    width: 390px;
    max-width: 100%;

    padding: 25px;

    background: #141217;

    border: 1px solid #342d3b;

    box-shadow:
        0 8px 30px rgba(0, 0, 0, 0.5);
}

.auth-box h1 {
    margin: 0 0 4px;

    color: #eeeaf0;

    font-size: 22px;
}

.auth-box h2 {
    margin: 0 0 20px;

    color: #8e8793;

    font-size: 13px;

    font-weight: normal;
}

.auth-box label {
    display: block;

    margin: 12px 0 5px;

    color: #aaa3ae;

    font-size: 12px;
}

.auth-box input {
    width: 100%;

    height: 36px;

    padding: 7px 9px;

    color: #ddd9e0;

    background: #0e0d10;

    border: 1px solid #39323e;

    border-radius: 2px;

    outline: none;
}

.auth-box input:focus {
    border-color: #71518e;
}

.auth-box button {
    width: 100%;

    height: 37px;

    margin-top: 18px;

    color: #e5e0e8;

    background:
        linear-gradient(
            to bottom,
            #392a46,
            #2c2136
        );

    border: 1px solid #59406b;

    border-radius: 2px;

    cursor: pointer;
}

.auth-box button:hover {
    background:
        linear-gradient(
            to bottom,
            #493455,
            #36263f
        );
}

.auth-box p {
    margin-top: 18px;

    color: #77717c;

    font-size: 12px;
}


/* =========================================================
   ERROR
   ========================================================= */

.error {
    margin-bottom: 15px;

    padding: 9px 10px;

    color: #e88a91;

    background: #241619;

    border: 1px solid #5a2930;

    font-size: 12px;
}


/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 700px) {

    .topbar {
        padding: 0 12px;
    }

    .chat-container {
        width: 100%;
        max-width: calc(100% - 12px);

        margin: 12px auto;
    }

    .messages {
        height: calc(100vh - 170px);
    }

}
/* =========================================================
   PROFILE
   ========================================================= */

.profile-container {
    width: 760px;
    max-width: calc(100% - 30px);

    margin: 28px auto;

    background: #121115;

    border: 1px solid #342d3b;

    box-shadow:
        0 8px 25px rgba(0, 0, 0, 0.45);
}


/* Header */

.profile-header {
    display: flex;

    padding: 20px;

    background:
        linear-gradient(
            to bottom,
            #211c26,
            #18151c
        );

    border-bottom: 1px solid #342d3b;
}


/* Avatar */

.profile-avatar {
    width: 100px;
    height: 100px;

    margin-right: 18px;

    flex-shrink: 0;
}

.profile-avatar img,
.default-avatar {
    width: 100px;
    height: 100px;

    object-fit: cover;

    border: 1px solid #493d50;

    background: #0d0c0f;
}

.default-avatar {
    display: flex;

    align-items: center;
    justify-content: center;

    color: #a98cc4;

    font-size: 34px;
    font-weight: bold;
}


/* Main info */

.profile-main {
    padding-top: 4px;
}

.profile-name {
    color: #eeeaf0;

    font-size: 20px;
    font-weight: bold;
}

.profile-username {
    margin-top: 2px;

    color: #716b75;

    font-size: 12px;
}

.profile-badges {
    margin-top: 9px;
}

.profile-badge {
    margin-right: 6px;

    font-size: 11px;
    font-weight: bold;
}

.profile-status {
    margin-top: 9px;

    font-size: 11px;
}

.status-online {
    color: #72c991;
}

.status-offline {
    color: #706b73;
}


/* Sections */

.profile-section {
    padding: 15px 18px;

    border-bottom: 1px solid #211e24;
}

.profile-section-title {
    margin-bottom: 9px;

    color: #8e8794;

    font-size: 11px;
    font-weight: bold;

    text-transform: uppercase;

    letter-spacing: 0.5px;
}

.profile-bio {
    color: #c9c5cc;

    font-size: 13px;

    line-height: 20px;
}

.profile-info {
    color: #aaa4ad;

    font-size: 12px;

    line-height: 22px;
}

.profile-info strong {
    color: #ddd7e1;
}

.profile-links {
    font-size: 12px;

    line-height: 23px;
}


/* Buttons */

.profile-actions {
    display: flex;
    gap: 7px;

    padding: 12px;

    background: #17151a;

    border-top: 1px solid #342d3b;
}

.profile-button {
    padding: 7px 13px;

    color: #dcd6e0;

    background:
        linear-gradient(
            to bottom,
            #29232e,
            #211d25
        );

    border: 1px solid #403747;

    border-radius: 2px;

    font-size: 12px;

    cursor: pointer;
}

.profile-button:hover {
    background:
        linear-gradient(
            to bottom,
            #342b3c,
            #29222f
        );

    border-color: #5a4668;
}

.profile-button:disabled {
    color: #66616a;

    cursor: default;

    opacity: 0.7;
}

.profile-button.danger:hover {
    color: #e88a91;

    border-color: #69363d;
}


.muted {
    color: #656069;
}


@media (max-width: 600px) {

    .profile-container {
        width: 100%;
        max-width: calc(100% - 12px);

        margin: 12px auto;
    }

    .profile-header {
        padding: 14px;
    }

    .profile-avatar,
    .profile-avatar img,
    .default-avatar {
        width: 75px;
        height: 75px;
    }

    .default-avatar {
        font-size: 26px;
    }

    .profile-name {
        font-size: 17px;
    }

}

/* =========================================================
   DIRECT MESSAGES
   ========================================================= */

.dm-container {
    width: 1000px;
    max-width: calc(100% - 30px);

    height: 650px;

    margin: 28px auto;

    display: flex;

    background: #121115;

    border: 1px solid #342d3b;

    box-shadow:
        0 8px 25px rgba(0, 0, 0, 0.45);
}


/* Sidebar */

.dm-sidebar {
    width: 240px;

    flex-shrink: 0;

    background: #151319;

    border-right: 1px solid #342d3b;

    overflow-y: auto;
}

.dm-sidebar-title {
    padding: 12px;

    color: #8e8794;

    background: #1b1820;

    border-bottom: 1px solid #302934;

    font-size: 11px;
    font-weight: bold;

    letter-spacing: 0.5px;
}

.dm-conversation {
    display: block;

    padding: 10px 12px;

    color: #c8c2cc;

    border-bottom: 1px solid #211e24;

    cursor: pointer;
}

.dm-conversation:hover {
    color: #eeeaf0;

    background: #1d1921;

    text-decoration: none;
}

.dm-conversation.active {
    background: #241d2b;

    border-left: 2px solid #8e5bb8;
}

.dm-conversation-name {
    font-weight: bold;
}

.dm-conversation-preview {
    margin-top: 3px;

    color: #6f6875;

    font-size: 11px;

    white-space: nowrap;

    overflow: hidden;

    text-overflow: ellipsis;
}

.dm-empty {
    padding: 15px;

    color: #625c66;

    font-size: 12px;
}


/* Main */

.dm-main {
    flex: 1;

    min-width: 0;

    display: flex;

    flex-direction: column;
}

.dm-header {
    padding: 12px 15px;

    color: #ded8e4;

    background:
        linear-gradient(
            to bottom,
            #211c26,
            #19161d
        );

    border-bottom: 1px solid #342d3b;

    font-weight: bold;
}

.dm-messages {
    flex: 1;

    overflow-y: auto;

    padding: 15px;

    background: #101014;
}

.dm-placeholder {
    color: #625c66;

    text-align: center;

    margin-top: 30px;

    font-size: 12px;
}


/* DM message */

.dm-message {
    margin-bottom: 14px;

    padding-bottom: 10px;

    border-bottom: 1px solid #211e24;
}

.dm-message-header {
    font-size: 12px;
}

.dm-message-time {
    color: #6f6875;

    font-family: "Courier New", monospace;
}

.dm-message-username {
    margin-left: 5px;

    color: #ded8e4;

    font-weight: bold;
}

.dm-message-content {
    margin-top: 3px;

    color: #c9c5cc;

    font-size: 13px;

    line-height: 20px;

    white-space: pre-wrap;

    word-break: break-word;
}


/* Form */

.dm-form {
    display: flex;

    padding: 10px;

    background: #17151a;

    border-top: 1px solid #342d3b;
}

.dm-form input {
    flex: 1;

    height: 35px;

    padding: 7px 9px;

    color: #dedbe2;

    background: #0e0d10;

    border: 1px solid #38313e;

    border-radius: 2px;

    outline: none;
}

.dm-form button {
    height: 35px;

    margin-left: 7px;

    padding: 0 17px;

    color: #ded9e1;

    background: #29232e;

    border: 1px solid #403747;

    border-radius: 2px;

    cursor: pointer;
}

.dm-form button:hover {
    background: #342b3c;
}


@media (max-width: 700px) {

    .dm-container {
        width: 100%;

        max-width: calc(100% - 12px);

        height: calc(100vh - 80px);

        margin: 12px auto;
    }

    .dm-sidebar {
        width: 180px;
    }

}

/* =========================================================
   PHASE 1 + 2 — profile/message identity
   ========================================================= */

.topnav {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-left: auto;
    margin-right: 22px;
}
.topnav a {
    color: #938b99;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .4px;
}
.topnav a:hover,
.topnav a.active {
    color: #cbb2df;
    text-decoration: none;
}

.chat-subtitle {
    display: block;
    margin-top: 2px;
    color: #625b67;
    font: 10px "Courier New", monospace;
}

.chat-user-mini {
    float: right;
    margin-top: -30px;
}
.chat-user-mini img,
.chat-user-mini span {
    display: block;
    width: 28px;
    height: 28px;
    border: 1px solid #43394a;
    background: #1b1720;
    color: #aa8ac2;
    text-align: center;
    line-height: 27px;
    font-weight: bold;
    object-fit: cover;
}

.message,
.dm-message {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
    padding: 9px 2px 11px;
    border-bottom: 1px solid #211e24;
}

.message-avatar-wrap {
    flex: 0 0 42px;
}

.message-avatar {
    display: block;
    width: 42px;
    height: 42px;
    object-fit: cover;
    border: 1px solid #403547;
    background: #19151d;
}

.message-avatar-default {
    color: #aa91bc;
    font-size: 15px;
    line-height: 40px;
    text-align: center;
    font-weight: bold;
}

.message-body {
    min-width: 0;
    flex: 1;
}

.message-header,
.dm-message-header {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 5px;
}

.message-username,
.dm-message-username {
    margin-left: 0;
    color: #e1d9e8;
    font-weight: bold;
}

.message-handle {
    color: #5f5864;
    font-size: 10px;
}

.message-time,
.dm-message-time {
    margin-left: 3px;
    color: #6f6875;
    font-family: "Courier New", monospace;
    font-size: 10px;
}

.message-content,
.dm-message-content {
    margin-top: 4px;
}

.badge {
    margin-left: 0;
}

.profile-banned-box {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin: 14px 0;
    padding: 10px 12px;
    color: #cba6ac;
    background: #1d1519;
    border: 1px solid #4d2e35;
    font-size: 12px;
}

.settings-container {
    width: 760px;
    max-width: calc(100% - 30px);
    margin: 28px auto;
}

.settings-card {
    background: #121115;
    border: 1px solid #342d3b;
    box-shadow: 0 8px 25px rgba(0,0,0,.45);
    padding: 18px;
}

.settings-title {
    padding-bottom: 10px;
    margin-bottom: 16px;
    border-bottom: 1px solid #302a36;
    color: #e6dfea;
    font-size: 14px;
    font-weight: bold;
}

.settings-card label {
    display: block;
    margin: 11px 0 5px;
    color: #aaa0ae;
    font-size: 11px;
}

.settings-card input,
.settings-card textarea {
    width: 100%;
    padding: 8px;
    color: #ddd7e1;
    background: #0e0d10;
    border: 1px solid #38313e;
    outline: none;
    font: 12px Verdana, Tahoma, Arial, sans-serif;
}

.settings-card textarea {
    resize: vertical;
}

.settings-card input:focus,
.settings-card textarea:focus {
    border-color: #71518e;
}

.edit-avatar-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 9px 0;
}

.edit-avatar {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border: 1px solid #493d55;
    background: #1b1720;
}

.edit-avatar-default {
    color: #aa91bc;
    text-align: center;
    line-height: 62px;
    font-weight: bold;
    font-size: 20px;
}

.settings-actions {
    display: flex;
    gap: 7px;
    margin-top: 16px;
}

.form-error,
.form-success {
    padding: 8px 10px;
    margin-bottom: 10px;
    border: 1px solid #45323b;
    font-size: 11px;
}
.form-error {
    color: #d9959e;
    background: #1d1519;
}
.form-success {
    color: #99c79f;
    background: #151c17;
}

@media (max-width: 760px) {
    .topnav {
        display: none;
    }
    .topbar {
        padding: 0 12px;
    }
    .chat-container {
        max-width: calc(100% - 12px);
        margin: 12px auto;
    }
    .messages {
        height: calc(100vh - 160px);
    }
}

.dm-conversation {
    display: flex;
    align-items: center;
    gap: 8px;
}
.dm-list-avatar {
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    object-fit: cover;
    border: 1px solid #3d3344;
    background: #19151d;
}
.dm-list-avatar-default {
    display: block;
    color: #a88cba;
    text-align: center;
    line-height: 32px;
    font-weight: bold;
}
.dm-conversation-copy {
    min-width: 0;
    flex: 1;
}


/* =========================================================
   PHASE 3 — CHAT / MESSAGE COMPONENTS
   ========================================================= */

.chat-container {
    width: 1000px;
    max-width: calc(100% - 30px);
    height: 700px;
    margin: 28px auto;
    display: flex;
    flex-direction: column;
    background: #121115;
    border: 1px solid #342d3b;
    box-shadow: 0 8px 25px rgba(0,0,0,.45);
}

.chat-header {
    min-height: 60px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #18151c;
    border-bottom: 1px solid #342d3b;
}

.chat-header h2 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: #ddd3e4;
}

.chat-subtitle {
    color: #756d7d;
    font-size: 10px;
}

.chat-user-mini,
.chat-user-mini img {
    width: 34px;
    height: 34px;
}

.chat-user-mini {
    border: 1px solid #403547;
    background: #211b26;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9f8ca9;
    font-size: 12px;
}

.chat-user-mini img { object-fit: cover; }

.messages {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
    scrollbar-width: thin;
}

.message {
    position: relative;
    display: flex;
    gap: 10px;
    padding: 8px 14px;
    border-top: 1px solid transparent;
    border-bottom: 1px solid transparent;
}

.message:hover {
    background: #17141a;
    border-color: #27222c;
}

.message-avatar-wrap { flex: 0 0 40px; }

.message-avatar {
    display: block;
    width: 40px;
    height: 40px;
    object-fit: cover;
    border: 1px solid #403547;
    background: #211b26;
}

.message-avatar-default {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #bca8c6;
    font-size: 13px;
}

.message-body { min-width: 0; flex: 1; }

.message-header,
.dm-message-header {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 5px;
    line-height: 1.3;
}

.message-username,
.dm-message-username {
    color: #d9cbe2;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
}

.message-username:hover { text-decoration: underline; }

.message-handle {
    color: #635b68;
    font-size: 9px;
}

.message-time,
.dm-message-time {
    color: #625b66;
    font-family: monospace;
    font-size: 9px;
}

.badge {
    font-family: monospace;
    font-size: 9px;
    font-weight: 700;
}

.message-content,
.dm-message-content {
    margin-top: 2px;
    color: #bcb5c0;
    font-size: 12px;
    line-height: 1.55;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.message-tools {
    display: none;
    margin-top: 4px;
    gap: 4px;
}

.message:hover .message-tools { display: flex; }

.message-action,
.reaction {
    border: 1px solid #3a3141;
    background: #1b1720;
    color: #93889a;
    font: inherit;
    font-size: 9px;
    padding: 2px 6px;
    cursor: pointer;
}

.message-action:hover,
.reaction:hover,
.reaction.mine {
    color: #d3c1dc;
    border-color: #6a5577;
    background: #241e2a;
}

.reaction-row {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    margin-top: 4px;
}

.reaction-pop {
    position: absolute;
    z-index: 30;
    margin-top: 3px;
    display: flex;
    gap: 2px;
    padding: 4px;
    background: #17131b;
    border: 1px solid #493c52;
    box-shadow: 0 5px 15px rgba(0,0,0,.4);
}

.reaction-pop button {
    border: 0;
    background: transparent;
    cursor: pointer;
    padding: 3px 4px;
}

.message-reply {
    margin: 2px 0 4px;
    padding: 3px 7px;
    border-left: 2px solid #665073;
    background: #17141b;
    color: #766c7c;
    font-size: 10px;
    overflow: hidden;
}

.message-media-image {
    display: block;
    max-width: min(420px, 80%);
    max-height: 360px;
    margin-top: 7px;
    border: 1px solid #3c3343;
    object-fit: contain;
    background: #0e0c10;
}

.message-media-video {
    display: block;
    width: min(500px, 85%);
    max-height: 360px;
    margin-top: 7px;
    background: #09080a;
}

.message-media-audio {
    display: block;
    width: min(420px, 85%);
    margin-top: 7px;
}

.message-file {
    display: flex;
    align-items: center;
    gap: 8px;
    width: min(420px, 85%);
    margin-top: 7px;
    padding: 8px;
    box-sizing: border-box;
    border: 1px solid #3b3243;
    background: #18151c;
    color: #bdb2c3;
    text-decoration: none;
    font-size: 10px;
}

.message-file:hover { border-color: #695475; }

.message-file span { flex: 1; min-width: 0; }
.message-file strong,
.message-file small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.message-file small { color: #6f6673; margin-top: 2px; }
.message-file b { color: #9e89a8; font-size: 9px; }

.message-form {
    position: relative;
    border-top: 1px solid #342d3b;
    background: #151319;
}

.chat-composer {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px;
}

.chat-composer.dragging {
    background: #211a27;
    outline: 1px dashed #80658d;
    outline-offset: -4px;
}

.chat-composer input[type="text"] {
    flex: 1;
    min-width: 0;
    padding: 8px 9px;
    border: 1px solid #342d3b;
    background: #0f0d12;
    color: #d0c8d3;
    outline: none;
    font: inherit;
    font-size: 11px;
}

.chat-composer input[type="text"]:focus { border-color: #5a4764; }

.icon-button {
    width: 32px;
    height: 32px;
    border: 1px solid #3b3243;
    background: #1c1820;
    color: #a998ae;
    cursor: pointer;
}

.icon-button:hover { background: #27202d; color: #d4c7da; }

.chat-composer > button[type="submit"] {
    height: 32px;
    padding: 0 13px;
}

.file-preview,
.reply-preview {
    margin: 0 8px 8px;
    padding: 6px 8px;
    border: 1px solid #3b3243;
    background: #1b1720;
    color: #9e92a5;
    font-size: 10px;
}

.file-preview {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.file-preview button,
.reply-preview button {
    border: 0;
    background: transparent;
    color: #98899f;
    cursor: pointer;
    font-size: 15px;
}

.hidden { display: none !important; }

.upload-progress {
    padding: 0 8px 8px;
}

.upload-progress-label {
    color: #746a79;
    font-size: 9px;
    margin-bottom: 4px;
}

.upload-progress-track {
    height: 4px;
    background: #2a232e;
    overflow: hidden;
}

.upload-progress-bar {
    width: 0;
    height: 100%;
    background: #80658d;
    transition: width .1s linear;
}


/* =========================================================
   PHASE 4 — FRIENDS
   ========================================================= */

.friends-page {
    width: 900px;
    max-width: calc(100% - 30px);
    margin: 28px auto 50px;
}

.friends-card {
    margin-bottom: 12px;
    padding: 12px;
    background: #151319;
    border: 1px solid #342d3b;
}

.section-title {
    margin-bottom: 10px;
    color: #cfc3d6;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.count {
    color: #706777;
    font-weight: normal;
}

.friend-search {
    display: flex;
    gap: 6px;
}

.friend-search input {
    flex: 1;
    padding: 7px 8px;
    border: 1px solid #342d3b;
    background: #0f0d12;
    color: #cfc7d3;
    outline: none;
    font: inherit;
    font-size: 11px;
}

.friend-list { display: flex; flex-direction: column; }

.friend-row {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 48px;
    padding: 6px 3px;
    border-top: 1px solid #29242d;
}

.friend-row:first-child { border-top: 0; }

.friend-avatar {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    object-fit: cover;
    border: 1px solid #403547;
    background: #211b26;
    color: #bca8c6;
    font-size: 11px;
}

.friend-copy { flex: 1; min-width: 0; }

.friend-copy a {
    display: block;
    color: #cfc2d7;
    text-decoration: none;
    font-size: 11px;
}

.friend-copy a:hover { text-decoration: underline; }

.friend-copy small {
    display: block;
    color: #625a68;
    font-size: 9px;
    margin-top: 2px;
}

.friend-action {
    border: 1px solid #473a50;
    background: #1c1820;
    color: #bba9c3;
    padding: 5px 8px;
    cursor: pointer;
    font: inherit;
    font-size: 9px;
}

.friend-action:hover { background: #28212e; }

.friend-action.danger { color: #b98e96; }

.friend-status {
    font-size: 12px;
    margin-right: 4px;
}

.friend-status.online { color: #87b98b; }
.friend-status.offline { color: #55505a; }

@media (max-width: 700px) {
    .chat-container { max-width: 100%; width: 100%; height: calc(100vh - 56px); margin: 0; border-left: 0; border-right: 0; }
    .topnav { display: none; }
    .message { padding-left: 8px; padding-right: 8px; }
    .message-media-image, .message-media-video, .message-file { max-width: 100%; width: 100%; }
    .friends-page { max-width: calc(100% - 12px); }
    .friend-row { flex-wrap: wrap; }
}

/* LUNATIK PHASE 5-9 */
.page-container{max-width:1050px;margin:30px auto;padding:0 14px}
.notification-list{display:flex;flex-direction:column}
.notification-row{padding:12px;border-bottom:1px solid #302a36;cursor:pointer}
.notification-row.unread{background:#1a1620}
.notification-row small{display:block;color:#777;margin-top:4px}
.chat-message{padding:9px 0;border-bottom:1px solid #28232d}
.chat-message .message-meta{font-size:12px;color:#bca9c7;margin-bottom:3px}
.chat-message .message-meta span{color:#706877;margin-left:7px}
form label{display:block;margin:12px 0 5px;color:#aa9aad}
form input,form textarea{box-sizing:border-box}
form textarea{min-height:110px;resize:vertical}

/* LUNATIK FIX PASS */
.message{display:flex;gap:10px;align-items:flex-start}
.message-avatar-wrap{flex:0 0 40px}
.message-avatar,.message-avatar-default{width:40px;height:40px;object-fit:cover;border:1px solid #493d50;background:#0d0c0f}
.message-avatar-default{display:flex;align-items:center;justify-content:center;color:#a98cc4;font-weight:bold}
.message-body{min-width:0;flex:1}
.message-header{display:flex;align-items:center;flex-wrap:wrap;gap:3px}
.message-handle{color:#625b68;font-size:11px}
.message-tools{margin-top:5px;display:flex;gap:4px}
.message-action{background:none;border:0;color:#706877;font:inherit;font-size:11px;padding:0 4px;cursor:pointer}
.message-action:hover{color:#b58cff}
.message-reply{margin:4px 0;padding:4px 7px;border-left:2px solid #594568;color:#837a89;font-size:11px;background:#151219}
.message-media-image{display:block;max-width:360px;max-height:320px;margin-top:6px;border:1px solid #332b3a}
.message-media-video{display:block;max-width:480px;width:100%;margin-top:6px}
.message-media-audio{max-width:360px;margin-top:6px}
.message-file{display:flex;gap:8px;align-items:center;width:max-content;max-width:100%;margin-top:6px;padding:8px 10px;background:#17131b;border:1px solid #382f40}
.message-file small{display:block;color:#777}
.attachment-preview-image{display:block;max-width:160px;max-height:100px;margin:5px 0}
.messages-page{width:980px;max-width:calc(100% - 20px);margin:20px auto;display:grid;grid-template-columns:250px 1fr;min-height:650px;background:#111015;border:1px solid #302a36}
.messages-sidebar{border-right:1px solid #302a36;background:#151319}.messages-main{min-width:0;display:flex;flex-direction:column}
.dm-header{padding:12px;border-bottom:1px solid #302a36;background:#18151d;color:#ddd}
.dm-messages{height:560px;flex:1}.dm-dropzone{flex:1;min-width:0}.dm-dropzone input{width:100%}.dm-list-avatar,.dm-list-avatar-default{width:34px;height:34px;display:inline-flex;align-items:center;justify-content:center;object-fit:cover;background:#0d0c0f;border:1px solid #403647}.dm-conversation{display:flex;gap:8px;padding:9px;border-bottom:1px solid #25212a;cursor:pointer}.dm-conversation.active,.dm-conversation:hover{background:#211c27}.dm-conversation-copy{min-width:0}.dm-conversation-name{color:#ddd;font-weight:bold;font-size:12px}.dm-conversation-preview{color:#777;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:11px}
.attachment-preview-bar{padding:5px 7px;color:#aaa;background:#18151d;border:1px solid #332b3a;font-size:11px}
.hidden{display:none!important}
.page-container{max-width:1050px;margin:25px auto;padding:0 14px}.settings-card{background:#121115;border:1px solid #342d3b;padding:18px;box-shadow:0 8px 25px rgba(0,0,0,.35)}.settings-title{font-size:16px;color:#e7e3eb;font-weight:bold;margin-bottom:15px}.settings-card label{display:block;margin:12px 0;color:#aaa}.settings-card input,.settings-card textarea,.settings-card select{background:#0e0d10;color:#ddd;border:1px solid #39323e;padding:7px}.settings-card textarea{width:100%;min-height:100px}.settings-card button,.profile-button{background:#211b27;color:#ddd;border:1px solid #493d55;padding:6px 10px;cursor:pointer}.muted{color:#6e6873}.form-success{color:#85c78e;margin-bottom:10px}.form-error{color:#e88a91;margin-bottom:10px}
.admin-note{padding:9px;background:#17131b;border:1px solid #302a36;color:#8f8794;margin-bottom:15px;font-size:11px}.admin-user,.admin-report{display:flex;justify-content:space-between;gap:10px;align-items:center;padding:10px 0;border-bottom:1px solid #25212a}.admin-btn{background:#211b27;color:#ccc;border:1px solid #493d55;padding:5px 8px;cursor:pointer}.badge-select{margin-left:5px}
.profile-banned-box{margin:15px;padding:12px;background:#25171b;border:1px solid #61313a;color:#d88b93}.profile-banned-box strong{display:block;margin-bottom:4px}
@media(max-width:720px){.messages-page{grid-template-columns:1fr}.messages-sidebar{display:none}.messages-main{min-height:calc(100vh - 40px)}.messages{height:calc(100vh - 180px)}.message-media-image{max-width:100%}}

/* =========================================================
   LUNATIK FINAL FIX PASS — groups, admin, uploads, bans
   ========================================================= */

.group-chat-layout{
    width:1100px;max-width:calc(100% - 24px);height:calc(100vh - 82px);
    margin:20px auto;display:grid;grid-template-columns:minmax(0,1fr) 230px;
    background:#111015;border:1px solid #302a36;box-shadow:0 15px 40px rgba(0,0,0,.35)
}
.group-chat-main{min-width:0;display:flex;flex-direction:column}
.group-chat-main .messages{flex:1;min-height:0;overflow:auto}
.group-sidebar{border-left:1px solid #302a36;background:#151319;padding:14px}
.group-sidebar-title{color:#d8cce0;font-size:12px;font-weight:700;text-transform:uppercase;letter-spacing:.06em;margin-bottom:10px}
.group-handle{color:#a98cc4;font-size:12px;margin-bottom:10px}
.group-description{color:#77707e;font-size:11px;line-height:1.5;white-space:pre-wrap;overflow-wrap:anywhere}
.group-side-button{display:block;text-align:center;margin-top:12px;width:100%;box-sizing:border-box}
.group-chat-title-row{display:flex;align-items:center;gap:10px}
.group-avatar{width:38px;height:38px;flex:0 0 38px;display:flex;align-items:center;justify-content:center;border:1px solid #493d50;background:#0d0c0f;color:#b998d8;font-weight:700;overflow:hidden}
.group-avatar img{width:100%;height:100%;object-fit:cover}
.group-avatar-large{width:44px;height:44px;flex-basis:44px}
.group-avatar.small{width:34px;height:34px;flex-basis:34px;font-size:10px}
.group-row,.group-member-row{display:flex;align-items:center;gap:10px;padding:9px 2px;border-top:1px solid #29242d}
.group-row:first-of-type,.group-member-row:first-of-type{border-top:0}
.group-list-head{display:flex;align-items:center;justify-content:space-between;gap:10px}
.group-action{border:1px solid #493d55;background:#211b27;color:#d4cad9;padding:5px 9px;cursor:pointer;font:inherit;font-size:10px}
.group-action:hover{background:#2a2231}
.group-action.danger{color:#d999a1}
.group-settings-card{max-width:720px}
.check-row{display:flex!important;align-items:center;gap:7px}
.check-row input{width:auto!important}
.inline-form{display:flex;gap:7px}
.inline-form input{flex:1}
.danger-zone{border-color:#5a3038}
.admin-user-expanded{align-items:flex-start}
.admin-user-main{min-width:0;flex:1}
.admin-status{font-size:10px;color:#6e6873;margin-top:3px}
.admin-status.is-banned{color:#db818a}
.admin-badges{display:flex;align-items:center;flex-wrap:wrap;gap:3px;margin-top:6px}
.admin-badge{font-family:monospace;font-size:9px;font-weight:700}
.badge-remove{border:0;background:transparent;color:#8d7e91;padding:0 2px;cursor:pointer;font-size:13px}
.badge-remove:hover{color:#e18c96}
.admin-controls{display:flex;align-items:center;gap:5px;flex-wrap:wrap;justify-content:flex-end}
.log-row{display:flex;align-items:baseline;gap:8px;padding:7px 0;border-bottom:1px solid #29242d;font-size:10px;flex-wrap:wrap}
.log-row:last-child{border-bottom:0}
.log-time{color:#5e5765;font-family:monospace}
.log-row strong{color:#b88fd1;text-transform:uppercase}
.log-row span{color:#918795}
.log-row small{color:#6e6873;width:100%;padding-left:76px}
.profile-banned-box{display:flex!important;flex-direction:column;gap:5px}
.profile-banned-box strong{color:#ef929a}
.profile-banned-box small{color:#a87980}
.edit-avatar-row{display:flex;align-items:center;gap:12px}
.edit-avatar{width:72px;height:72px;object-fit:cover;border:1px solid #493d50;background:#0d0c0f}
.edit-avatar-default{display:flex;align-items:center;justify-content:center;color:#b998d8;font-weight:700}
.edit-avatar-row small{display:block;margin-top:5px}
.settings-actions{display:flex;align-items:center;gap:7px;margin-top:15px}
.member-role{background:#0e0d10;color:#ddd;border:1px solid #39323e;padding:5px;font-size:10px}
.dm-dropzone.dragging{background:#211a27;outline:1px dashed #80658d;outline-offset:-3px}
.message-attach{width:32px;height:32px;border:1px solid #3b3243;background:#1c1820;color:#a998ae;cursor:pointer}
.message-attach:hover{background:#27202d;color:#d4c7da}
.conversation-unread{margin-left:auto;align-self:center;min-width:18px;padding:2px 5px;text-align:center;border:1px solid #5a4764;background:#211a28;color:#c9aee0;font-size:9px}
@media(max-width:800px){
 .group-chat-layout{width:100%;max-width:100%;margin:0;height:calc(100vh - 55px);grid-template-columns:1fr;border-left:0;border-right:0}
 .group-sidebar{display:none}
}
@media(max-width:600px){
 .admin-user-expanded{flex-direction:column}
 .admin-controls{justify-content:flex-start}
 .inline-form{flex-direction:column}
}

/* =========================================================
   CHAT / DM / GROUP FIXES
========================================================= */
.messages-page,.group-chat-layout{overflow:hidden}
.messages-main,.group-chat-main{min-height:0;overflow:hidden}
.messages,.dm-messages,.group-chat-main .messages{min-height:0;overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;scroll-behavior:auto}
.dm-messages{height:auto;max-height:none;flex:1}
.message-reply{display:block;width:fit-content;max-width:min(700px,100%);margin:5px 0 8px;padding:7px 10px;border:1px solid #302936;background:#111015;color:#8f8798;text-align:left;font:inherit;font-size:11px;cursor:pointer}
.message-reply:hover{border-color:#4b3d59;color:#c4b6d0}
.reply-preview{margin:0 0 7px;padding:8px 10px;border-left:2px solid #8f6cc2;background:#15121a;color:#aaa1b2;font-size:11px}
.reply-preview button{float:right;border:0;background:transparent;color:#8d8492;cursor:pointer}
.reply-highlight{outline:1px solid #755a9b;outline-offset:3px}
@media(max-width:720px){.messages-page{height:calc(100vh - 40px);min-height:0}.messages-main{height:calc(100vh - 40px)}.dm-messages{height:auto}.group-chat-layout{height:calc(100vh - 55px);min-height:0}.group-chat-main{height:100%}.group-chat-main .messages{height:auto}}

/* =========================================================
   NOTIFICATIONS + PRESENCE (stable)
========================================================= */
.lunatik-notification-widget{
  position:relative;
  display:inline-flex;
  align-items:center;
  vertical-align:middle;
  margin:0 7px;
  z-index:10000;
}
.lunatik-notification-button{
  position:relative;
  width:30px;
  height:28px;
  padding:0;
  border:1px solid #332b3d;
  background:#141217;
  color:#ddd;
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  justify-content:center;
}
.lunatik-notification-button:hover{background:#1d1922;border-color:#4a3d57}
.lunatik-bell{font-size:13px;line-height:1}
.lunatik-notification-count{
  position:absolute;
  right:-6px;
  top:-7px;
  min-width:16px;
  height:16px;
  padding:0 4px;
  border-radius:9px;
  background:#a66cff;
  color:#fff;
  font:700 9px/16px Arial,sans-serif;
  text-align:center;
}
.lunatik-notification-count.hidden,
.lunatik-notification-panel.hidden{display:none}
.lunatik-notification-panel{
  position:absolute;
  right:0;
  top:36px;
  width:min(360px,calc(100vw - 28px));
  border:1px solid #332b3d;
  background:#111016;
  box-shadow:0 18px 60px rgba(0,0,0,.55);
}
.lunatik-notification-head{display:flex;justify-content:space-between;align-items:center;padding:12px;border-bottom:1px solid #29242f;color:#ddd}
.lunatik-notification-head button{border:0;background:none;color:#9f91ad;font-size:10px;cursor:pointer}
.lunatik-notification-items{max-height:330px;overflow:auto}
.lunatik-notification-item{display:flex;gap:10px;padding:11px 12px;border-bottom:1px solid #211e25;color:#aaa;text-decoration:none}
.lunatik-notification-item:hover,.lunatik-notification-item.unread{background:#19151f;color:#ddd}
.lunatik-notification-icon{width:25px;text-align:center;flex:0 0 25px}
.lunatik-notification-item span:last-child{display:flex;flex-direction:column;gap:4px;min-width:0}
.lunatik-notification-item b{font-size:11px;font-weight:500;line-height:1.4}
.lunatik-notification-item small{font-size:9px;color:#625c68}
.lunatik-notification-footer{display:block;padding:10px;text-align:center;border-top:1px solid #29242f;color:#a991c4;font-size:10px;text-decoration:none}
.presence-dot{display:inline-block;width:7px;height:7px;border-radius:50%;vertical-align:middle;margin-right:5px;background:#555}
.presence-dot.online{background:#8fe3a1;box-shadow:0 0 7px rgba(143,227,161,.45)}
.presence-dot.offline{background:#555}
.friend-status.online{color:#8fe3a1}
.friend-status.offline{color:#555}
.profile-live-status{cursor:default}
.user-menu .lunatik-notification-widget{margin-left:8px;margin-right:8px}
@media(max-width:700px){
  .lunatik-notification-widget{margin:0 4px}
  .lunatik-notification-panel{right:-4px}
}


/* Report modal */
.lunatik-report-overlay{position:fixed;inset:0;z-index:100000;display:flex;align-items:center;justify-content:center;padding:20px;background:rgba(5,4,7,.78);backdrop-filter:blur(6px)}
.lunatik-report-modal{width:min(520px,100%);background:#141217;border:1px solid #3a3342;box-shadow:0 25px 90px rgba(0,0,0,.65);color:#ddd}
.lunatik-report-head{display:flex;justify-content:space-between;align-items:flex-start;padding:18px 20px;border-bottom:1px solid #29242f}.lunatik-report-head div{display:flex;flex-direction:column;gap:4px}.lunatik-report-head strong{font-size:14px}.lunatik-report-head small{font-size:10px;color:#756d7d}.lunatik-report-close{border:0;background:none;color:#8f8795;font-size:22px;cursor:pointer}.lunatik-report-body{padding:18px 20px}.lunatik-report-label{display:block;margin-bottom:9px;font-size:11px;color:#9b93a3}.lunatik-report-reasons{display:grid;grid-template-columns:1fr 1fr;gap:7px}.lunatik-report-reasons button{padding:10px;border:1px solid #302a36;background:#0f0d12;color:#aaa2b0;text-align:left;font:inherit;font-size:11px;cursor:pointer}.lunatik-report-reasons button:hover,.lunatik-report-reasons button.selected{border-color:#68527f;background:#1b1622;color:#ddd}.lunatik-report-details{width:100%;min-height:80px;resize:vertical;margin-top:12px;padding:10px;border:1px solid #302a36;background:#0d0b10;color:#ddd;outline:none;font:inherit;font-size:11px}.lunatik-report-details:focus{border-color:#68527f}.lunatik-report-error{min-height:18px;margin-top:7px;color:#d98d8d;font-size:10px}.lunatik-report-actions{display:flex;justify-content:flex-end;gap:8px;padding:14px 20px;border-top:1px solid #29242f}.lunatik-report-actions button{padding:9px 14px;border:1px solid #332d39;background:#18151d;color:#aaa2b0;font:inherit;font-size:11px;cursor:pointer}.lunatik-report-submit{border-color:#594778!important;color:#d6c5f2!important}.lunatik-report-submit:disabled{opacity:.35;cursor:not-allowed}.lunatik-report-toast{position:fixed;right:22px;bottom:22px;z-index:100001;padding:11px 14px;border:1px solid #493b57;background:#17131c;color:#d8c9e6;box-shadow:0 12px 35px rgba(0,0,0,.45);font-size:11px}
@media(max-width:560px){.lunatik-report-reasons{grid-template-columns:1fr}.lunatik-report-actions{flex-direction:column}.lunatik-report-actions button{width:100%}}

/* Moderation v2 */
.profile-sanction-active{margin-top:8px;padding:8px 10px;border:1px solid #51343c;background:#181116;color:#dcaab2}
