html, body {
    height: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
    background: #eef3f6;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    color: #18212f;
    background:
        linear-gradient(180deg, rgba(247, 249, 252, 0.96) 0%, rgba(235, 242, 246, 0.96) 100%),
        #eef3f6;
    display: flex;
    flex-direction: column;
}

.animate0 {
    -webkit-animation-duration: .8s;
    -webkit-animation-delay: 0s;
    -webkit-animation-timing-function: ease;
    -webkit-animation-fill-mode: both;
    -moz-animation-duration: .8s;
    -moz-animation-delay: 0s;
    -moz-animation-timing-function: ease;
    -moz-animation-fill-mode: both;
    -ms-animation-duration: .8s;
    -ms-animation-delay: 0s;
    -ms-animation-timing-function: ease;
    -ms-animation-fill-mode: both;
    animation-duration: .8s;
    animation-delay: 0s;
    animation-timing-function: ease;
    animation-fill-mode: both;
}

.animate1{
    -webkit-animation-duration: .8s;
    -webkit-animation-delay: .2s;
    -webkit-animation-timing-function: ease;
    -webkit-animation-fill-mode: both;
    -moz-animation-duration: .8s;
    -moz-animation-delay: .2s;
    -moz-animation-timing-function: ease;
    -moz-animation-fill-mode: both;
    -ms-animation-duration: .8s;
    -ms-animation-delay: .2s;
    -ms-animation-timing-function: ease;
    -ms-animation-fill-mode: both;
    animation-duration: .8s;
    animation-delay: .2s;
    animation-timing-function: ease;
    animation-fill-mode: both;
}

.bounceIn {
    -webkit-animation-name:bounceIn;
    -moz-animation-name:bounceIn;
    -o-animation-name:bounceIn;
    animation-name:bounceIn
}


.loginpanel {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    padding: 28px 20px;
}
.loginpanel a { color:#ddd; }
.recoverypanel { position: absolute; top: 40%; left: 50%; height: 300px; }
.loginpanelinner {
    width: 100%;
    max-width: 380px;
}
.recoverypanel .loginpanelinner { width: 250px;}
.loginpanelinner .logo {
    display: block;
    width: min(72vw, 260px);
    margin: 0 auto 30px;
    padding: 0;
}
.loginpanel .pull-right { margin-top: 11px; color: #ddd; font-size: 11px; font-family: Helvetica, sans-serif; }
.loginpanel .pull-right a { color: #ddd; }

.login-error {
    color: #d32f2f;
    font-size: 17px;
    font-weight: 700;
    margin: 0 0 16px;
    text-align: center;
}

.logo {
    width: 250px;
    margin-left: 0px;
}

#fireworks-canvas {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

#birthday-message {
    position: fixed;
    bottom: 40px;
    width: 100%;
    text-align: center;
    font-size: 4em;
    font-weight: bold;
    font-family: 'Comic Sans MS', cursive, sans-serif;
    background: linear-gradient(90deg, red, orange, yellow, green, blue, indigo, violet);
    background-size: 400% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: glow 1.5s infinite alternate, rainbow 5s linear infinite;
    z-index: 9999;
}

@keyframes glow {
    0% {
        text-shadow: 0 0 5px white, 0 0 10px gold, 0 0 20px red;
    }
    100% {
        text-shadow: 0 0 20px white, 0 0 30px gold, 0 0 40px red;
    }
}

@keyframes rainbow {
    0% {
        background-position: 0% 50%;
    }
    100% {
        background-position: 100% 50%;
    }
}


.fade-out {
    transition: opacity 2s ease;
    opacity: 0;
}

#imageButton {
    padding: 10px 20px;
    background-color: #0078D7;
    color: white;
    border: none;
    border-radius: 18px;
    cursor: pointer;
}

#imageButton:hover {
    background-color: #0056b3;
}

.hidden {
    display: none;
}

.header {
    width: 100%;
    padding: 0;
    background: #18212f;
    color: white;
    text-align: center;
    font-size: 24px;
    font-weight: bold;
    box-shadow: 0 12px 30px rgba(24, 33, 47, 0.16);
    overflow: hidden;
}

.title-box {
    text-align: center;
    font-size: 25px;
    font-weight: 700;
    color: #1f2a3a;
    padding: 16px 16px 10px;
    background: transparent;
    box-shadow: none;
    font-family: 'Baloo 2', cursive;
}

.input-container {
    width: 100%;
    max-width: none;
    box-sizing: border-box;
    margin: 0 auto;
    padding: 12px;
    background: rgba(255, 255, 255, 0.86);
    border: 1px solid rgba(144, 160, 180, 0.22);
    border-radius: 22px;
    box-shadow: 0 16px 36px rgba(24, 33, 47, 0.12);
    backdrop-filter: blur(12px);
}

.button-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
}

.button-container > button,
.button-container .media-buttons {
    flex: 1;
}

.button-container .media-buttons {
    flex: 1.45;
}

#chatContainer {
    width: 100%;
    max-width: none;
    flex: 1;
    min-height: 0;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    padding: 0;
    box-sizing: border-box;
    overflow: hidden;
}

.chat-wrapper {
    width: min(100%, 720px);
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
    box-sizing: border-box;
    margin: 0 auto;
    padding: 14px 16px 18px;
}

#messageInput {
    flex-grow: 1;
    margin-right: 0;
}

#nameInput {
    flex-grow: 2;
    margin-right: 0;
}


#messages {
    flex-grow: 1;
    overflow-y: auto;
    padding: 18px;
    background: rgba(255, 255, 255, 0.74);
    border: 1px solid rgba(144, 160, 180, 0.2);
    border-radius: 26px;
    box-shadow: 0 18px 42px rgba(24, 33, 47, 0.1);
    margin-bottom: 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(111, 128, 150, 0.45) transparent;
}

.media-buttons {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.message {
    position: relative;
    max-width: 78%;
    margin: 8px 0;
    padding: 10px 12px 11px;
    background-color: #ffffff;
    border: 1px solid rgba(144, 160, 180, 0.18);
    border-radius: 18px 18px 18px 6px;
    box-shadow: 0 8px 24px rgba(24, 33, 47, 0.08);
    word-wrap: break-word;
    line-height: 1.42;
}


.message-right {
    margin-left: auto;
    color: #ffffff;
    background: linear-gradient(135deg, #1677ff 0%, #1aa77d 100%);
    border-color: transparent;
    border-radius: 18px 18px 6px 18px;
}



.message-time {
    font-size: 0.75em;
    color: #6d7b8e;
    margin-bottom: 4px;
    font-weight: 600;
}

.message-right .message-time {
    color: rgba(255, 255, 255, 0.78);
}

.message-content {
    font-size: 15px;
}

.message img {
    display: block;
    width: 100%;
    max-width: 400px;
    height: auto;
    border-radius: 12px;
}

.message audio {
    display: block;
    width: min(100%, 320px);
    margin-top: 4px;
}

.header img {
    display: block;
    height: 118px;
    width: 100%;
    margin: auto;
    object-fit: cover;
}

textarea {
    width: 100%;
    box-sizing: border-box;
    min-height: 68px;
    margin-bottom: 10px;
    padding: 13px 15px;
    border: 1px solid rgba(144, 160, 180, 0.28);
    border-radius: 18px;
    resize: none;
    font-size: 16px;
    line-height: 1.35;
    color: #18212f;
    background: #f8fafc;
    outline: none;
}

textarea:focus {
    border-color: rgba(22, 119, 255, 0.65);
    box-shadow: 0 0 0 4px rgba(22, 119, 255, 0.1);
    background: #ffffff;
}

input[type="text"] {
    width: calc(100% - 22px);
    margin-bottom: 10px;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 18px;
}

button {
    min-height: 44px;
    padding: 11px 16px;
    background-color: #31506f;
    color: white;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 700;
    box-shadow: 0 8px 18px rgba(49, 80, 111, 0.18);
    transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

button:hover {
    background-color: #253f59;
    box-shadow: 0 10px 22px rgba(49, 80, 111, 0.22);
    transform: translateY(-1px);
}

.close-button {
    background: #e6ebf1;
    color: #344256;
    box-shadow: none;
}

.close-button:hover {
    background: #d9e1ea;
}

#imageButton,
#audioButton {
    background: #ffffff;
    color: #28506d;
    border: 1px solid rgba(144, 160, 180, 0.35);
    box-shadow: none;
}

#imageButton:hover,
#audioButton:hover {
    background: #f0f5f8;
}

.send-button {
    background: #1677ff;
}

.send-button:hover {
    background: #0d63d8;
}

#audioButton.recording {
    background-color: #d32f2f;
    color: #ffffff;
    border-color: transparent;
}

.access-info {
    color: #6d7b8e;
    font-size: 13px;
    line-height: 1.35;
    text-align: center;
    margin-top: 10px;
}

.access-info p {
    margin: 4px 0 0;
}

@media (max-width: 520px) {
    .header {
        padding: 0;
    }

    .header img {
        height: 82px;
    }

    .title-box {
        padding: 12px 12px 8px;
        font-size: 22px;
    }

    .chat-wrapper {
        padding: 10px;
        gap: 10px;
    }

    #messages {
        padding: 12px;
        border-radius: 22px;
    }

    .input-container {
        padding: 10px;
        border-radius: 20px;
    }

    .message {
        max-width: 86%;
        padding: 9px 11px 10px;
    }

    .button-container {
        gap: 8px;
    }

    .media-buttons {
        gap: 8px;
    }

    button {
        flex: 1;
        min-width: 0;
        padding: 11px 8px;
        font-size: 14px;
    }
}
