* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #301515;
    color: #e0e6f0;
}
body::before {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: -1;
    pointer-events: none;
    background: radial-gradient(circle at 1% 30%, #250000 0%, transparent 70%),
                radial-gradient(circle at 80% 70%, #240000 0%, transparent 70%),
                linear-gradient(135deg, #1f0000 0%, #160000 100%);
    animation: ripple-bg 18s linear infinite;
    opacity: 0.7;
}
@keyframes ripple-bg {
    0% { background-position: 20% 30%, 80% 70%, 0 0; }
    50% { background-position: 25% 35%, 75% 65%, 100% 100%; }
    100% { background-position: 20% 30%, 80% 70%, 0 0; }
}
.screen {
    display: none;
    height: 100vh;
}
.screen.active {
    display: flex;
}
#auth-screen {
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #1a0000, #0e0000, #1a0000, #0d0000);
    background-size: 400% 400%;
    animation: blood-gradient 15s ease infinite;
    padding: 24px;
    min-height: 100vh;
    position: relative;
    overflow: hidden;
}

.blood-bg {
    background: linear-gradient(135deg, #1a0000, #0e0000, #1a0000, #0d0000);
    background-size: 400% 400%;
    animation: blood-gradient 15s ease infinite;
}

@keyframes blood-gradient {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

#auth-screen::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 15px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 120' preserveAspectRatio='none'%3E%3Cpath d='M0,60 Q150,90 300,60 T600,60 T900,60 T1200,60 L1200,120 L0,120 Z' fill='%231a0000' fill-opacity='0.9'/%3E%3C/svg%3E");
    background-size: 1200px 150px;
    background-repeat: repeat-x;
    animation: wave1 12s linear infinite;
    z-index: 3;
    pointer-events: none;
    opacity: 0.05;
}

#auth-screen::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 70px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 120' preserveAspectRatio='none'%3E%3Cpath d='M0,50 Q200,80 400,50 T800,50 T1200,50 L1200,120 L0,120 Z' fill='%231a0000' fill-opacity='0.8'/%3E%3C/svg%3E");
    background-size: 1200px 140px;
    background-repeat: repeat-x;
    animation: wave2 18s linear infinite reverse;
    z-index: 2;
    pointer-events: none;
    opacity: 0.05;
}

.auth-container::before {
    content: '';
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 65px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 120' preserveAspectRatio='none'%3E%3Cpath d='M0,70 Q250,40 500,70 T1000,70 T1200,70 L1200,120 L0,120 Z' fill='%231a0000' fill-opacity='0.7'/%3E%3C/svg%3E");
    background-size: 1200px 130px;
    background-repeat: repeat-x;
    animation: wave3 22s linear infinite;
    z-index: -1;
    pointer-events: none;
    opacity: 0.05;
}

.auth-container::after {
    content: '';
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 65px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 120' preserveAspectRatio='none'%3E%3Cpath d='M0,40 Q300,70 600,40 T1200,40 L1200,120 L0,120 Z' fill='%231a0000' fill-opacity='0.6'/%3E%3C/svg%3E");
    background-size: 1200px 120px;
    background-repeat: repeat-x;
    animation: wave4 28s linear infinite reverse;
    z-index: -2;
    pointer-events: none;
    opacity: 0.05;
}

@keyframes wave1 {
    0% { background-position-x: 0; }
    100% { background-position-x: 1200px; }
}

@keyframes wave2 {
    0% { background-position-x: 0; }
    100% { background-position-x: 1200px; }
}

@keyframes wave3 {
    0% { background-position-x: 0; }
    100% { background-position-x: 1200px; }
}

@keyframes wave4 {
    0% { background-position-x: 0; }
    100% { background-position-x: 1200px; }
}

#auth-screen canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    opacity: 0.15;
}

.auth-container {
    background: rgba(20, 20, 20, 0.98);
    border-radius: 18px;
    padding: 48px 32px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.7);
    width: 100%;
    max-width: 400px;
    position: relative;
    z-index: 10;
    align-items: center;
    margin: 0 auto;
    margin-top: 10%;
}

.auth-container h1 {
    text-align: center;
    margin-bottom: 30px;
    color: #e0e6f0;
    font-size: 32px;
    letter-spacing: 2px;
    font-weight: 700;
}
.auth-form {
    display: none;
}
.auth-form.active {
    display: block;
    text-align: center;
}
.auth-form input {
    width: 100%;
    padding: 14px 16px;
    margin-bottom: 18px;
    background: #292929;
    color: #e0e6f0;
    border: 1.5px solid #353535;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    transition: border 0.2s, box-shadow 0.2s;
    outline: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.auth-form input:focus {
    border-color: #7d7d7d;
    box-shadow: 0 0 0 3px rgba(125,125,125,0.12);
    background: #292929;
}

.auth-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 24px;
}
.tab-button {
    background: #303030;
    color: #e0e6f0;
    border: 2px solid #363636;
    flex: 1;
    padding: 14px 0;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s;
    cursor: pointer;
    letter-spacing: 1px;
}
.tab-button.active {
    background: linear-gradient(90deg, #8a8a8a 0%, #2b2b2b 100%);
    color: #fff;
}
.error {
    color: #e74c3c;
    font-size: 12px;
    margin-top: 10px;
    text-align: center;
}

#chat-screen {
    background: white;
}

.chat-container {
    display: flex;
    height: 100%;
    width: 100%;
}

.online-users-panel {
    width: 250px;
    background: #2e2e2e;
    color: #e0e6f0;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    box-sizing: border-box;
    text-align: center;
}
.online-users-panel h3 {
    font-size: 12px;
    text-transform: uppercase;
    color: #ffffff;
    margin-bottom: 15px;
    letter-spacing: 1px;
    font-weight: 700;
    
}
.online-users-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    padding: 0;
    margin: 0;
    list-style: none;
}
.online-user-rect {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #444444;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 15px;
    color: #e0e6f0;
    box-shadow: 0 1px 4px rgba(0,0,0,0.10);
    transition: background 0.2s;
}
.online-user-rect .online-user-status {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #43e97b;
    box-shadow: 0 0 6px #43e97b88;
    display: inline-block;
}
.online-user-rect .online-user-name {
    font-weight: 600;
    color: #ffffff;
    font-size: 15px;
    letter-spacing: 0.5px;
}

.sidebar {
    width: 250px;
    background: #2e2e2e;
    color: #e0e6f0;
    padding: 20px;
    overflow-y: auto;
}

.current-display-name {
    font-size: 25px;
    color: #9aa0a6;
    margin-bottom: 4px;
    text-align: left;
}

.user-info {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #464646;
    display: flex;
    flex-direction: column;
}

.user-info p {
    font-size: 14px;
    margin-bottom: 10px;
    word-break: break-all;
}

.user-info button {
    width: 100%;
    padding: 8px;
    background: #575757;;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.3s;
    margin-top: 2.5%;
    align-items: center;
    align-self: center;
}

.user-info button:hover {
    background: #383838;
}

.sidebar h3 {
    font-size: 12px;
    text-transform: uppercase;
    margin-bottom: 15px;
    color: #95a5a6;
}

#channels-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.channel-item {
    padding: 10px;
    background: #3d3d3d;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

.channel-item:hover {
    background: #383838;
}

.channel-item.active {
    background: linear-gradient(90deg, #252525 0%, #383838 100%);
    color: #fff;
}

.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.chat-header {
    padding: 20px;
    background: #2e2e2e;
}

.chat-header h2 {
    color: #e0e6f0;
    font-size: 18px;
}

.messages-container.blood-bg::before {
    opacity: 5%;
}

.messages-container {
    padding: 0 24px;
    padding-top: 10px;
    box-sizing: border-box;
    overflow-x: hidden;
}

.messages-container canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    opacity: 0.15;
}

.messages-container::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 0;
    pointer-events: none;
    background: linear-gradient(270deg, #111111, #7d7d7d, #2b2b2b, #505050, #1a1a1a);
    animation: animated-gradient 16s ease-in-out infinite;
    opacity: 0.35;
}
@keyframes animated-gradient {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}
.messages-container > * {
    position: relative;
    z-index: 1;
}

.message {
    display: block;
    width: 100%;
    margin-bottom: 10px;
    background: #161616;
    color: #e0e6f0;
    border-radius: 6px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.18);
    padding: 10px 16px;
    box-sizing: border-box;
    position: relative;
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 1%;
}

.message.own {
    
    background: #313131;
    width: fit-content;
    max-width: 75%;
    display: block;
    word-wrap:break-word;
}

.message.other {
    background: #363636;
    width: fit-content;
    max-width: 75%;
    display: inline-block;
    word-wrap:break-word;
}

.message-sender {
    font-size: 15px;
    color: #c0c0c0;
    margin-bottom: 2px;
    margin-top: -5px;
    margin-left: -5px;
    font-weight: 600;
}

.message-timestamp {
    font-size: 11px;
    color: #aaa;
    position: absolute;
    left: 12px;
    top: -12px;
}

.input-area {
    padding: 20px;
    background: #363636;
    display: flex;
    gap: 10px;
    position: relative;
}

#message-input {
    flex: 1;
    padding: 12px;
    border: 1px solid #0c0c0c;
    border-radius: 5px;
    background: #303030;
    color: #e0e6f0;
    font-size: 14px;
}

#message-input:focus {
    border-color: #838383;
    box-shadow: 0 0 0 3px rgba(36, 36, 36, 0.15);
}

.input-area button {
    padding: 12px 25px;
    background: linear-gradient(90deg, #808080 0%, #525252 100%);
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.3s;
}

.input-area button:hover {
    background: linear-gradient(90deg, #1b1b1b 0%, #424242 100%);
}

::-webkit-scrollbar {
    width: 8px;
    background: #23243a;
}

::-webkit-scrollbar-thumb {
    background: #353a4a;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

#admin-panel.screen.active {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(30,30,30,0.95);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-y: ellipsis;
}
.admin-container {
    background: #23243a !important;
    color: #e0e6f0 !important;
    border-radius: 10px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.6);
    padding: 2em;
    min-width: 320px;
    max-width: 90vw;
}

.admin-container input,
.admin-container button,
.admin-container select,
.admin-container textarea {
    background: #181c24;
    color: #e0e6f0;
    border: 1px solid #353a4a;
    border-radius: 5px;
    margin-bottom: 8px;
}
.admin-container button {
    background: linear-gradient(90deg, #252525 0%, #764ba2 100%);
    color: #fff;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}
.admin-container button:hover {
    background: linear-gradient(90deg, #1a1a1a 0%, #1d1d1d 100%);
}

.admin-container ul,
.admin-container li {
    background: transparent;
    color: #e0e6f0;
    border: none;
}

#admin-panel-error {
    color: #ff0000;
}

.button-49,
.button-49:after {
height: 2em;
width: 5em;
font-size: 20px;
font-family: 'Bebas Neue', sans-serif;
background: linear-gradient(45deg, #5f0000 5%, #3f0000 100%);
border: 0;
color: #fff;
letter-spacing: 3px;
outline: transparent;
position: relative;
user-select: none;
-webkit-user-select: none;
touch-action: manipulation;
border-radius: 8px;
}

.button-49:after {
--slice-0: inset(50% 50% 50% 50%);
--slice-1: inset(80% -6px 0 0);
--slice-2: inset(50% -6px 30% 0);
--slice-3: inset(10% -6px 85% 0);
--slice-4: inset(40% -6px 43% 0);
--slice-5: inset(80% -6px 5% 0);

content: 'BLOODSPOT';
display: block;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: linear-gradient(45deg, transparent 3%, #ffffff 3%, #000000 5%, #3b0000 5%);
text-shadow: -3px -3px 0px #000000, 3px 3px 0px #ffffff;
clip-path: var(--slice-0);
}

.button-49:hover:after {
animation: 1s glitch;
animation-timing-function: steps(2, end);
}

@keyframes glitch {
0% {
    clip-path: var(--slice-1);
    transform: translate(-20px, -10px);
}
10% {
    clip-path: var(--slice-3);
    transform: translate(10px, 10px);
}
20% {
    clip-path: var(--slice-1);
    transform: translate(-10px, 10px);
}
30% {
    clip-path: var(--slice-3);
    transform: translate(0px, 5px);
}
40% {
    clip-path: var(--slice-2);
    transform: translate(-5px, 0px);
}
50% {
    clip-path: var(--slice-3);
    transform: translate(5px, 0px);
}
60% {
    clip-path: var(--slice-4);
    transform: translate(5px, 10px);
}
70% {
    clip-path: var(--slice-2);
    transform: translate(-10px, 10px);
}
80% {
    clip-path: var(--slice-5);
    transform: translate(20px, -10px);
}
90% {
    clip-path: var(--slice-1);
    transform: translate(-10px, 0px);
}
100% {
    clip-path: var(--slice-1);
    transform: translate(0);
}
}

@media (min-width: 50%) {
.button-49,
.button-49:after {
    width: 100%;
    height: 100%;
}
}

:root {
    --message-font: inherit;
    --message-font-size: 14px;
}

.message-bubble {
    font-family: var(--message-font);
    font-size: var(--message-font-size);
}

.customize-divider {
    border: none;
    border-top: 1px solid #3a3a3a;
    margin: 6px 0;
}

.customize-row input[type="range"] {
    flex: 1;
    accent-color: #8b0000;
    cursor: pointer;
}

#customize-panel {
    width: 100%;
    margin-top: 6px;
}

.customize-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.customize-label {
    font-size: 11px;
    text-transform: uppercase;
    color: #95a5a6;
    letter-spacing: 0.5px;
    flex-shrink: 0;
    overflow-y: ellipsis;
}

.customize-row input[type="text"],
.customize-row select {
    flex: 1;
    padding: 5px 8px;
    background: #3d3d3d;
    color: #e0e6f0;
    border: 1px solid #555;
    border-radius: 4px;
    font-size: 12px;
    outline: none;
}

.customize-row input[type="color"] {
    flex: 1;
    height: 28px;
    padding: 2px 3px;
    background: #3d3d3d;
    border: 1px solid #555;
    border-radius: 4px;
    cursor: pointer;
}

.customize-actions {
    display: flex;
    gap: 6px;
    margin-top: 2px;
}

#characters-panel {
    width: 100%;
    margin-top: 4px;
    margin-bottom: 4px;
}

.char-empty {
    font-size: 11px;
    color: #666;
    margin: 4px 0 6px;
}

.char-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 0;
    border-bottom: 1px solid #3a3a3a;
}

.char-swatch {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 1px solid #555;
}

.char-name {
    flex: 1;
    font-size: 13px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.char-use-btn,
.char-del-btn {
    width: auto !important;
    padding: 2px 7px !important;
    margin-top: 0 !important;
    font-size: 11px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
}

.char-use-btn {
    background: #575757;
    color: #fff;
}

.char-use-btn:hover {
    background: #383838;
}

.char-del-btn {
    background: #6b2020;
    color: #fff;
}

.char-del-btn:hover {
    background: #4a1010;
}

#add-char-btn {
    margin-top: 6px !important;
}

#char-error {
    font-size: 11px;
    color: #e74c3c;
    margin-top: 3px;
    min-height: 14px;
}

.reply-container {
    display: block;
    align-items: center;
    background-color: #f9f9f9;
    border-left: 4px solid #ccc;
    padding: 8px;
    margin-bottom: 8px;
    font-size: 14px;
    color: #ffffff;
    font-style: italic;
    margin-left: 16px;
}
.reply-container .reply-text {
    color: #ffffff;
    margin-left: 8px;
}
.reply-container .close-reply {
    margin-left: auto;
    cursor: pointer;
    color: #ffffff;
}
.reply-container .close-reply:hover {
    color: #000;
}

.message-reply {
    font-size: calc(var(--message-font-size) - 5px);
    color: rgb(136, 136, 136);
    margin-left: 16px;
    font-style: italic;
    margin-bottom: 10px;
}

.reply-text {
    color: #000;
}

.reply-author {
    font-weight: 600;
    color: #555;
    margin-bottom: 2px;
    font-size: calc(var(--message-font-size) - 10px);
}

.input-area {
    position: relative;
}

#reply-container {
    position: absolute;
    top: -40px;
    left: 0;
    width: 50%;
    transform: none;
    margin-bottom: 8px;
    z-index: 1;
    background-color: #3a3a3a;
}


.flash-highlight {
    animation: flash-border 2.8s ease forwards;
}

@keyframes flash-border {
    0% {
        box-shadow: 0 0 0 4px rgba(255,0,0,0.95);
    }
    60% {
        box-shadow: 0 0 0 10px rgba(255,0,0,0.12);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255,0,0,0);
    }
}