
:root {
    --bg: #090909;
    --sidebar: #0d0d0e;
    --panel: #121213;
    --panel-hover: #1b1718;
    --border: #292426;
    --red: #b20d20;
    --red-bright: #ed172e;
    --text: #eeeeee;
    --muted: #898487;
    --steel: #aaa4a6;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: "Inter", sans-serif;
    min-height: 100vh;
}

button, input, textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

.app {
    display: flex;
    min-height: 100vh;
}

/* SIDEBAR */

.sidebar {
    width: 260px;
    min-width: 260px;
    height: 100vh;
    background: var(--sidebar);
    border-right: 1px solid var(--border);
    padding: 27px 17px 15px;
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 10;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 36px 5px;
}

.brand-icon {
    font-size: 39px;
    color: var(--red-bright);
    text-shadow: 0 0 18px #b20d2055;
}

.brand h1 {
    font-family: "Cinzel Decorative", serif;
    font-size: 19px;
    letter-spacing: 2px;
    font-weight: 900;
}

.brand span {
    display: block;
    font-size: 8px;
    color: var(--muted);
    letter-spacing: 1.7px;
    margin-top: 4px;
}

.new-chat {
    width: 100%;
    border: 1px solid #6e1823;
    background: linear-gradient(120deg, #84101e, #410912);
    color: white;
    padding: 13px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 13px;
    text-align: left;
    transition: .2s;
}

.new-chat:hover {
    background: #b20d20;
    box-shadow: 0 0 20px #b20d2030;
}

.new-chat span {
    margin-right: 10px;
    font-size: 19px;
}

.menu-label {
    color: #716a6d;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 2px;
    margin: 32px 10px 12px;
}

.navigation {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 12px;
    border: 0;
    background: transparent;
    color: #a49da0;
    font-size: 13px;
    text-align: left;
    border-radius: 7px;
    transition: .2s;
    width: 100%;
}

.nav-item span {
    font-size: 19px;
    width: 20px;
    text-align: center;
}

.nav-item:hover,
.nav-item.active {
    color: white;
    background: #291216;
}

.nav-item.active {
    border-left: 3px solid var(--red-bright);
}

.history-label {
    margin-top: 35px;
}

.history-list {
    overflow-y: auto;
    flex: 1;
}

.history-chat {
    padding: 11px 10px;
    font-size: 12px;
    color: #aaa;
    cursor: pointer;
    border-radius: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-chat:hover {
    background: #211719;
    color: white;
}

.history-chat.selected {
    background: #251719;
    color: white;
}

.sidebar-bottom {
    margin-top: auto;
}

.profile {
    display: flex;
    align-items: center;
    gap: 10px;
    border-top: 1px solid var(--border);
    margin-top: 12px;
    padding: 17px 5px 3px;
}

.avatar, .top-avatar {
    width: 35px;
    height: 35px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: #64101c;
    color: white;
    font-family: "Cinzel Decorative";
    font-weight: 900;
}

.profile-info strong {
    font-size: 10px;
    display: block;
}

.profile-info span {
    font-size: 10px;
    color: var(--muted);
}

.online-dot, .status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #d5172c;
    box-shadow: 0 0 10px #ed172e;
    margin-left: auto;
}

/* MAIN */

.main {
    margin-left: 260px;
    width: calc(100% - 260px);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
}

.topbar {
    height: 70px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 35px;
    background: #0b0b0b;
}

.topbar-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: "Cinzel Decorative", serif;
    font-size: 13px;
    font-weight: 900;
    letter-spacing: 1.5px;
}

.topbar-title .status-dot {
    margin: 0;
}

.red-text, .section-heading h2 span {
    color: var(--red-bright);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.version {
    color: #777;
    font-size: 10px;
    letter-spacing: 1px;
}

.top-avatar {
    width: 32px;
    height: 32px;
}

.mobile-menu {
    display: none;
    color: white;
    background: transparent;
    border: none;
    font-size: 23px;
}

.page-container {
    display: none;
    flex: 1;
    width: 100%;
    padding: 25px 35px 150px;
}

.page-container.active {
    display: block;
}

/* WELCOME */

#chatPage {
    display: none;
    flex-direction: column;
    min-height: 0;
}

#chatPage.active {
    display: flex;
}

.welcome {
    max-width: 790px;
    margin: auto;
    width: 100%;
    text-align: center;
    padding: 25px 0;
}

.sigil {
    color: var(--red-bright);
    font-size: 53px;
    text-shadow: 0 0 30px #ed172e55;
    margin-bottom: 22px;
}

.welcome-tag, .eyebrow {
    color: #a9a0a3;
    font-size: 10px;
    letter-spacing: 3px;
    font-weight: 700;
}

.welcome-tag span {
    display: inline-block;
    width: 6px;
    height: 6px;
    background: var(--red-bright);
    border-radius: 50%;
    margin-right: 7px;
}

.welcome h2 {
    font-family: "Cinzel Decorative", serif;
    font-size: clamp(37px, 6vw, 65px);
    line-height: 1.25;
    letter-spacing: 2px;
    margin: 20px 0;
    text-shadow: 0 5px 20px #000;
}

.welcome h2 span {
    color: var(--red-bright);
    text-shadow: 0 0 25px #ed172e35;
}

.welcome-description {
    max-width: 480px;
    margin: 0 auto 40px;
    font-size: 13px;
    color: var(--muted);
    line-height: 1.8;
}

.suggestions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    max-width: 610px;
    margin: auto;
}

.suggestion {
    text-align: left;
    padding: 17px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 9px;
    color: white;
    transition: .2s;
}

.suggestion:hover {
    border-color: var(--red);
    background: var(--panel-hover);
    transform: translateY(-2px);
}

.suggestion > span {
    display: block;
    color: var(--red-bright);
    font-size: 21px;
    margin-bottom: 9px;
}

.suggestion strong {
    display: block;
    font-size: 12px;
}

.suggestion small {
    display: block;
    margin-top: 5px;
    color: var(--muted);
    font-size: 10px;
}

/* COMPOSER */

.composer-wrapper {
    width: min(760px, calc(100% - 70px));
    position: fixed;
    bottom: 16px;
    left: calc(260px + (100% - 260px) / 2);
    transform: translateX(-50%);
    z-index: 5;
}

.composer {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    background: #171516;
    border: 1px solid #413034;
    border-radius: 12px;
    padding: 12px 13px;
    box-shadow: 0 10px 40px #0009;
}

.composer:focus-within {
    border-color: #a61b2d;
}

.composer textarea {
    flex: 1;
    min-height: 26px;
    max-height: 150px;
    resize: none;
    border: none;
    outline: none;
    background: transparent;
    color: white;
    font-size: 13px;
    padding: 5px;
}

.composer textarea::placeholder {
    color: #81797c;
}

.send-button {
    width: 37px;
    height: 37px;
    border: none;
    border-radius: 8px;
    background: var(--red);
    color: white;
    font-size: 20px;
    transition: .2s;
}

.send-button:hover {
    background: var(--red-bright);
    box-shadow: 0 0 15px #ed172e66;
}

.send-button:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.composer-footer {
    display: flex;
    justify-content: space-between;
    padding: 10px 2px;
    font-size: 8px;
    color: #716a6d;
    letter-spacing: .5px;
}

/* CHAT MESSAGES */

.chat-messages {
    display: none;
    flex-direction: column;
    gap: 23px;
    max-width: 760px;
    width: 100%;
    margin: 20px auto;
}

.chat-messages.visible {
    display: flex;
}

.message {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.message.user {
    flex-direction: row-reverse;
}

.message-avatar {
    min-width: 33px;
    width: 33px;
    height: 33px;
    display: grid;
    place-items: center;
    background: #65101c;
    border-radius: 8px;
    font-family: "Cinzel Decorative";
    font-size: 13px;
}

.message.user .message-avatar {
    background: #292426;
    font-family: "Inter";
}

.message-body {
    max-width: 85%;
    padding: 13px 16px;
    background: #151314;
    border: 1px solid #292426;
    border-radius: 9px;
    font-size: 13px;
    line-height: 1.8;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.message.user .message-body {
    background: #28151a;
    border-color: #51212b;
}

.message-author {
    color: var(--red-bright);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1px;
    margin-bottom: 6px;
}

.typing {
    color: #aaa;
    font-size: 12px;
    padding: 10px;
}

/* EXTRA PAGES */

.extra-page {
    max-width: 1150px;
    margin: auto;
    width: 100%;
}

.section-heading {
    margin: 55px 0 40px;
}

.section-heading h2 {
    font-family: "Cinzel Decorative", serif;
    font-size: clamp(28px, 4vw, 43px);
    margin: 14px 0;
}

.section-heading p {
    font-size: 13px;
    color: var(--muted);
}

/* EXPLORE */

.explore-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 17px;
}

.explore-card {
    text-align: left;
    min-height: 190px;
    padding: 23px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: white;
    transition: .2s;
}

.explore-card:hover {
    transform: translateY(-3px);
    border-color: var(--red);
    background: #1a1416;
}

.explore-icon {
    color: var(--red-bright);
    font-size: 27px;
    margin-bottom: 18px;
}

.explore-card h3 {
    font-size: 14px;
    margin-bottom: 9px;
}

.explore-card p {
    font-size: 11px;
    color: var(--muted);
    line-height: 1.6;
    min-height: 37px;
}

.explore-card > span {
    color: var(--red-bright);
    display: block;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 1px;
    margin-top: 16px;
}

/* LIBRARY */

.library-toolbar {
    display: flex;
    gap: 12px;
    margin-bottom: 25px;
}

.library-toolbar input {
    flex: 1;
    min-width: 0;
    background: var(--panel);
    border: 1px solid var(--border);
    padding: 12px;
    border-radius: 7px;
    color: white;
    outline: none;
}

.library-toolbar input:focus {
    border-color: var(--red);
}

.new-chat.small {
    width: auto;
    text-align: center;
    font-size: 11px;
}

.library-list {
    display: grid;
    gap: 10px;
}

.library-entry {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    padding: 16px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.library-info {
    min-width: 0;
    flex: 1;
}

.library-info strong {
    font-size: 13px;
    display: block;
}

.library-info span {
    color: var(--muted);
    font-size: 10px;
    display: block;
    margin-top: 5px;
}

.library-actions {
    display: flex;
    gap: 8px;
}

.library-actions button {
    background: #282124;
    color: white;
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 8px 10px;
    font-size: 10px;
}

.library-actions button:hover {
    border-color: var(--red);
}

.library-actions .delete-chat {
    color: #ff5262;
}

/* SETTINGS */

.settings-panel {
    max-width: 780px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 25px;
}

.setting-item {
    min-height: 95px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    border-bottom: 1px solid var(--border);
}

.setting-item h3 {
    font-size: 13px;
    margin-bottom: 7px;
}

.setting-item p {
    font-size: 11px;
    color: var(--muted);
}

.switch {
    position: relative;
    display: inline-block;
    width: 42px;
    height: 23px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch span {
    position: absolute;
    inset: 0;
    cursor: pointer;
    border-radius: 20px;
    background: #393336;
    transition: .2s;
}

.switch span::before {
    content: "";
    position: absolute;
    width: 17px;
    height: 17px;
    left: 3px;
    top: 3px;
    background: white;
    border-radius: 50%;
    transition: .2s;
}

.switch input:checked + span {
    background: var(--red);
}

.switch input:checked + span::before {
    transform: translateX(19px);
}

.danger-button {
    background: #421019;
    color: #ff6674;
    border: 1px solid #76212d;
    border-radius: 6px;
    padding: 10px 13px;
    font-size: 9px;
    font-weight: 800;
}

.danger-button:hover {
    background: #75101f;
    color: white;
}

.about {
    text-align: center;
    padding: 38px 10px 28px;
}

.about-logo {
    color: var(--red-bright);
    font-size: 35px;
    margin-bottom: 10px;
}

.about h3 {
    font-family: "Cinzel Decorative";
    letter-spacing: 2px;
    font-size: 17px;
}

.about p {
    color: var(--muted);
    font-size: 10px;
    margin: 9px;
}

.about > span {
    font-size: 8px;
    letter-spacing: 2px;
    color: #a51a2c;
}

/* RED THEME DISABLED */

body.no-red {
    --red: #777;
    --red-bright: #bcbcbc;
}

body.no-red .brand-icon,
body.no-red .sigil,
body.no-red .welcome h2 span,
body.no-red .explore-icon {
    text-shadow: none;
}

/* RESPONSIVE */

@media (max-width: 950px) {
    .explore-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 700px) {
    .sidebar {
        transform: translateX(-100%);
        transition: .25s;
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 10px 0 40px #000a;
    }

    .main {
        margin-left: 0;
        width: 100%;
    }

    .topbar {
        padding: 0 17px;
        height: 60px;
    }

    .mobile-menu {
        display: block;
    }

    .topbar-title {
        margin-right: auto;
        margin-left: 15px;
        font-size: 11px;
    }

    .page-container {
        padding: 20px 17px 140px;
    }

    .welcome {
        padding: 25px 0;
    }

    .welcome h2 {
        font-size: 38px;
    }

    .suggestions {
        gap: 9px;
    }

    .suggestion {
        padding: 12px;
    }

    .composer-wrapper {
        width: calc(100% - 28px);
        left: 50%;
        bottom: 10px;
    }

    .composer-footer {
        font-size: 7px;
    }

    .explore-grid {
        grid-template-columns: 1fr;
    }

    .section-heading {
        margin-top: 30px;
    }

    .library-toolbar {
        flex-wrap: wrap;
    }

    .library-toolbar input {
        flex-basis: 100%;
    }

    .library-entry {
        align-items: flex-start;
    }

    .library-actions {
        flex-direction: column;
    }

    .settings-panel {
        padding: 8px 15px;
    }

    .setting-item {
        min-height: 100px;
    }
}

@media (max-width: 390px) {
    .welcome h2 {
        font-size: 32px;
    }

    .welcome-description {
        font-size: 11px;
    }

    .composer-footer span:last-child {
        display: none;
    }
}
