:root {

    --bg: #010101;
    --bg-secondary: #080808;

    --green: #39ff14;
    --green-soft: #00ff88;

    --text: #eeeeee;
    --muted: #777;

    --border: rgba(57,255,20,.15);

    --message: #0b0b0b;

}


* {
    box-sizing: border-box;
}


html,
body {

    margin: 0;
    padding: 0;

    width: 100%;
    height: 100%;

    background: var(--bg);

    color: var(--text);

    font-family:
        Inter,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

}


body {

    overflow: hidden;

}


button,
textarea {

    font-family: inherit;

}


button {

    cursor: pointer;

}


/* =========================================================
   APP
========================================================= */

#app {

    width: 100%;
    height: 100dvh;

    display: flex;
    flex-direction: column;

}


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

.ayla-header {

    height: 70px;

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

    padding: 0 18px;

    border-bottom: 1px solid var(--border);

    background:
        rgba(0,0,0,.85);

}


.ayla-brand {

    display: flex;
    align-items: center;

    gap: 10px;

}


.ayla-logo {

    width: 42px;
    height: 42px;

    object-fit: contain;

}


.ayla-brand h1 {

    margin: 0;

    font-size: 18px;

    color: var(--green);

    text-shadow:
        0 0 8px rgba(57,255,20,.5);

}


.ayla-brand span {

    display: block;

    margin-top: 2px;

    font-size: 9px;

    letter-spacing: 2px;

    color: #555;

}


/* =========================================================
   BUTTONS
========================================================= */

.icon-button {

    width: 42px;
    height: 42px;

    border: 1px solid var(--border);

    border-radius: 10px;

    background: rgba(0,0,0,.5);

    color: var(--green);

    font-size: 20px;

}


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

.chat-container {

    flex: 1;

    width: 100%;

    max-width: 900px;

    margin: auto;

    padding: 30px 18px;

    overflow-y: auto;

}


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

.ayla-message {

    display: flex;

    gap: 12px;

    margin-bottom: 25px;

}


.avatar {

    flex-shrink: 0;

}


.avatar img {

    width: 38px;
    height: 38px;

    border-radius: 50%;

    object-fit: cover;

    border: 1px solid var(--green);

}


.message-content {

    max-width: 85%;

}


.message-author {

    margin-bottom: 5px;

    color: var(--green);

    font-size: 12px;

    font-weight: 600;

}


.message-text {

    padding: 13px 15px;

    background: var(--message);

    border: 1px solid var(--border);

    border-radius: 4px 14px 14px 14px;

    line-height: 1.6;

    font-size: 15px;

    white-space: pre-wrap;

}


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

.user-message {

    display: flex;

    justify-content: flex-end;

    margin-bottom: 25px;

}


.user-message .message-text {

    border-radius: 14px 4px 14px 14px;

    background:
        rgba(57,255,20,.06);

}


/* =========================================================
   TYPING
========================================================= */

.typing {

    display: flex;

    align-items: center;

    gap: 5px;

    padding: 0 20px 8px;

    color: #555;

    font-size: 10px;

}


.typing span {

    width: 5px;
    height: 5px;

    border-radius: 50%;

    background: var(--green);

    animation: typing 1.2s infinite;

}


.typing span:nth-child(2) {

    animation-delay: .15s;

}


.typing span:nth-child(3) {

    animation-delay: .3s;

}


@keyframes typing {

    0%,
    60%,
    100% {

        opacity: .2;
        transform: translateY(0);

    }

    30% {

        opacity: 1;
        transform: translateY(-3px);

    }

}


/* =========================================================
   COMMAND
========================================================= */

.command-area {

    width: 100%;

    padding:
        10px
        15px
        calc(10px + env(safe-area-inset-bottom));

    background:
        linear-gradient(
            to top,
            #010101 80%,
            transparent
        );

}


.command-box {

    max-width: 900px;

    margin: auto;

    display: flex;

    align-items: flex-end;

    gap: 8px;

    padding: 8px;

    border:

        1px solid
        rgba(57,255,20,.25);

    border-radius: 15px;

    background:

        rgba(8,8,8,.95);

    box-shadow:

        0 0 20px
        rgba(57,255,20,.04);

}


#mensagem {

    flex: 1;

    min-height: 42px;

    max-height: 160px;

    resize: none;

    border: 0;

    outline: none;

    background: transparent;

    color: white;

    padding: 11px;

    font-size: 15px;

}


#mensagem::placeholder {

    color: #555;

}


.command-actions {

    display: flex;

    gap: 5px;

}


.command-button,
.send-button {

    width: 42px;
    height: 42px;

    border-radius: 10px;

    border: 1px solid var(--border);

    background: #050505;

    color: var(--green);

}


.send-button {

    background: var(--green);

    color: #000;

    font-weight: bold;

}


.command-info {

    max-width: 900px;

    margin: 6px auto 0;

    display: flex;

    justify-content: space-between;

    color: #333;

    font-size: 9px;

}


/* =========================================================
   MENU
========================================================= */

.side-menu {

    position: fixed;

    top: 0;
    right: 0;

    width: min(330px, 90vw);

    height: 100dvh;

    z-index: 1000;

    display: flex;

    flex-direction: column;

    background: #050505;

    border-left: 1px solid var(--border);

    transform: translateX(100%);

    transition: transform .25s ease;

}


.side-menu.active {

    transform: translateX(0);

}


.menu-header {

    height: 70px;

    padding: 0 15px;

    display: flex;

    align-items: center;

    justify-content: space-between;

    border-bottom: 1px solid var(--border);

}


.menu-header strong {

    color: var(--green);

}


.menu-navigation {

    display: flex;

    flex-direction: column;

    padding: 15px;

    gap: 8px;

}


.menu-navigation button {

    padding: 14px;

    text-align: left;

    border: 1px solid var(--border);

    border-radius: 10px;

    background: #080808;

    color: #ddd;

}


.menu-navigation button:hover {

    border-color: var(--green);

    color: var(--green);

}


.menu-footer {

    margin-top: auto;

    padding: 15px;

}


.logout-button {

    width: 100%;

    padding: 13px;

    border: 0;

    border-radius: 10px;

    background: #301010;

    color: #ff5555;

}


/* =========================================================
   OVERLAY
========================================================= */

.menu-overlay {

    position: fixed;

    inset: 0;

    z-index: 999;

    background: rgba(0,0,0,.7);

    backdrop-filter: blur(3px);

}


@media (min-width: 800px) {

    .chat-container {

        padding-left: 30px;
        padding-right: 30px;

    }

    .command-area {

        padding-left: 30px;
        padding-right: 30px;

    }

}


/* =========================================================
   TELA DE LOGIN / CADASTRO
========================================================= */

.auth-screen {

    width: 100%;
    height: 100dvh;

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

    background: var(--bg);

}


.auth-box {

    width: 100%;
    max-width: 340px;

    padding: 32px 24px;

    display: flex;
    flex-direction: column;
    align-items: center;

    text-align: center;

}


.auth-logo {

    width: 64px;
    height: 64px;

    margin-bottom: 8px;

    border-radius: 50%;

}


.auth-box h1 {

    margin: 0 0 24px;

    color: var(--text);

    letter-spacing: .04em;

}


.auth-form {

    width: 100%;

    display: flex;
    flex-direction: column;
    gap: 12px;

}


.auth-form input {

    width: 100%;

    padding: 12px 14px;

    background: var(--message);
    border: 1px solid var(--border);
    border-radius: 10px;

    color: var(--text);

    font-size: 15px;

}


.auth-form input:focus {

    outline: none;
    border-color: var(--green);

}


.auth-button {

    padding: 12px 14px;

    background: var(--green);
    border: none;
    border-radius: 10px;

    color: #010101;
    font-weight: 600;

}


.auth-button:hover {

    background: var(--green-soft);

}


.auth-erro {

    margin: 4px 0 0;

    color: #ff4444;
    font-size: 13px;

}


.auth-troca {

    margin: 8px 0 0;

    color: var(--muted);
    font-size: 13px;

}


.auth-troca a {

    color: var(--green-soft);
    text-decoration: none;

}


.auth-troca a:hover {

    text-decoration: underline;

}


/* =========================================================
   FIX — [hidden] precisa vencer os display:flex fixos acima
   (#app, .auth-screen, .auth-form todos têm display declarado
   incondicionalmente, o que anula o atributo hidden do HTML
   sozinho — por isso login e cadastro apareciam juntos, e o
   chat aparecia empurrado embaixo da tela de login).
========================================================= */

#app[hidden],
.auth-screen[hidden],
.auth-form[hidden] {
    display: none !important;
}
