* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    background: #171a1f;
    color: #eceff3;
}

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


/* HEADER */

.topbar {
    min-height: 92px;
    flex-shrink: 0;

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

    padding: 12px 30px;

    background: #111419;
    border-bottom: 1px solid #2b3038;
}

.header-branding {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-logo {
    width: 58px;
    height: 58px;
    object-fit: contain;
}

.header-text {
    display: flex;
    flex-direction: column;
}

.brand {
    font-size: 20px;
    font-weight: 650;
    letter-spacing: 1.2px;
}

.tagline-primary {
    margin-top: 4px;

    font-size: 12px;
    font-weight: 650;
    letter-spacing: 1.4px;

    color: #d6d9dd;
}

.tagline-secondary {
    margin-top: 2px;

    font-size: 10px;
    font-weight: 500;
    letter-spacing: 1.2px;

    color: #838a94;
}

.status {
    display: flex;
    align-items: center;
    gap: 7px;

    padding: 7px 12px;

    border: 1px solid #313741;
    border-radius: 16px;

    background: #181c22;

    font-size: 11px;
    color: #aeb5be;
}

.status-dot {
    width: 7px;
    height: 7px;

    border-radius: 50%;

    background: #54d890;

    box-shadow: 0 0 7px rgba(84, 216, 144, 0.4);
}

.status-dot.thinking {
    background: #d8b354;
}

.status-dot.web {
    background: #61bde8;
}

.status-dot.error {
    background: #e76b6b;
}


/* CHAT */

.chat {
    flex: 1;
    overflow-y: auto;

    padding: 30px 20px 170px;
}


/* WELCOME */

.welcome {
    height: 100%;

    display: flex;
    flex-direction: column;

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

    text-align: center;

    transform: translateY(-30px);
}

.welcome-logo {
    width: 125px;
    height: 125px;

    object-fit: contain;

    margin-bottom: 20px;

    filter: drop-shadow(
        0 0 10px
        rgba(66, 194, 230, 0.12)
    );
}

.welcome h1 {
    margin: 0;

    font-size: 30px;
    font-weight: 500;
}

.welcome p {
    margin-top: 9px;

    color: #8e959f;

    font-size: 14px;
}


/* MESSAGES */

.message {
    width: 100%;
    margin-bottom: 30px;
}

.message-inner {
    width: 100%;
    max-width: 820px;

    margin: 0 auto;
}

.message.user .message-inner {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.message-text {
    font-size: 15.5px;
    line-height: 1.65;
}

.message.user .message-text {
    max-width: 75%;

    padding: 11px 17px;

    background: #292e35;

    border: 1px solid #373d46;
    border-radius: 20px;
}

.message.assistant .message-text {
    width: 100%;
}


/* JARVIS RESPONSE IDENTITY */

.assistant-identity {
    display: flex;
    align-items: center;

    gap: 8px;

    margin-bottom: 10px;
}

/*
   Reduced to roughly 75% of the
   previous 34px chat-logo size.
*/
.assistant-icon {
    width: 26px;
    height: 26px;

    object-fit: contain;

    filter: drop-shadow(
        0 0 4px
        rgba(66, 194, 230, 0.10)
    );
}

.assistant-name {
    font-size: 11px;

    font-weight: 650;

    letter-spacing: 1px;

    color: #bec4cb;
}


/* SOURCES */

.sources {
    margin-top: 18px;

    padding-top: 14px;

    border-top: 1px solid #343a43;
}

.sources-title {
    margin-bottom: 8px;

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

    color: #858d97;

    text-transform: uppercase;

    letter-spacing: 1px;
}

.sources a {
    display: block;

    margin: 7px 0;

    color: #aeb9c4;

    font-size: 13px;

    text-decoration: none;
}

.sources a:hover {
    color: #ffffff;
    text-decoration: underline;
}


/* MESSAGE COMPOSER */

.composer-area {
    position: fixed;

    left: 0;
    right: 0;
    bottom: 0;

    padding: 22px 20px 13px;

    background:
        linear-gradient(
            transparent,
            #171a1f 35%
        );
}

.composer {
    max-width: 820px;

    margin: 0 auto;

    padding: 8px 17px;

    background: #292e35;

    border: 1px solid #414852;
    border-radius: 26px;

    box-shadow:
        0 5px 20px
        rgba(0, 0, 0, 0.25);
}

textarea {
    display: block;

    width: 100%;

    min-height: 34px;
    max-height: 180px;

    padding: 7px 3px;

    resize: none;
    overflow-y: auto;

    border: none;
    outline: none;

    background: transparent;

    color: #eceff3;

    font-family: inherit;
    font-size: 16px;
    line-height: 1.35;
}

textarea::placeholder {
    color: #858c95;
}

textarea:disabled {
    opacity: 0.6;
}

.hint {
    margin-top: 8px;

    text-align: center;

    color: #656c75;

    font-size: 11px;
}


/* SCROLLBAR */

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

::-webkit-scrollbar-track {
    background: #171a1f;
}

::-webkit-scrollbar-thumb {
    background: #373d45;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #484f59;
}


/* MOBILE */

@media (max-width: 700px) {

    .topbar {
        min-height: 84px;
        padding: 10px 15px;
    }

    .header-logo {
        width: 46px;
        height: 46px;
    }

    .header-branding {
        gap: 10px;
    }

    .brand {
        font-size: 15px;
        letter-spacing: 0.7px;
    }

    .tagline-primary {
        font-size: 9px;
        letter-spacing: 0.7px;
    }

    .tagline-secondary {
        font-size: 8px;
        letter-spacing: 0.6px;
    }

    .status {
        display: none;
    }

    .welcome-logo {
        width: 105px;
        height: 105px;
    }

    .chat {
        padding-left: 14px;
        padding-right: 14px;
    }

    .message.user .message-text {
        max-width: 90%;
    }

    .composer-area {
        padding-left: 12px;
        padding-right: 12px;
    }
}


/* =========================================================
   JARVIS MOBILE / iPHONE REFINEMENTS
   ========================================================= */

html,
body {
    width: 100%;
    overflow: hidden;
}

.app {
    height: 100dvh;
    min-height: 100vh;
}


/* iPhone / mobile layout */

@media (max-width: 700px) {

    .app {
        height: 100dvh;
    }

    .topbar {
        min-height: 72px;

        padding:
            calc(8px + env(safe-area-inset-top))
            12px
            8px;

        align-items: center;
    }

    .header-logo {
        width: 42px;
        height: 42px;
        flex-shrink: 0;
    }

    .header-branding {
        min-width: 0;
        gap: 9px;
    }

    .header-text {
        min-width: 0;
    }

    .brand {
        font-size: 14px;
        letter-spacing: 0.5px;

        white-space: nowrap;
    }

    .tagline-primary {
        margin-top: 3px;

        font-size: 8px;
        letter-spacing: 0.55px;

        white-space: nowrap;
    }

    .tagline-secondary {
        margin-top: 1px;

        font-size: 7px;
        letter-spacing: 0.45px;

        white-space: nowrap;
    }


    /* CHAT AREA */

    .chat {
        padding:
            20px
            14px
            calc(125px + env(safe-area-inset-bottom));

        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }

    .welcome {
        transform: translateY(-18px);
    }

    .welcome-logo {
        width: 92px;
        height: 92px;

        margin-bottom: 15px;
    }

    .welcome h1 {
        font-size: 25px;
    }

    .welcome p {
        font-size: 13px;
    }


    /* MESSAGES */

    .message {
        margin-bottom: 24px;
    }

    .message-inner {
        max-width: 100%;
    }

    .message-text {
        font-size: 15.5px;
        line-height: 1.58;
    }

    .message.user .message-text {
        max-width: 88%;

        padding: 10px 14px;

        border-radius: 18px;
    }

    .assistant-identity {
        margin-bottom: 8px;
    }

    .assistant-icon {
        width: 24px;
        height: 24px;
    }


    /* COMPOSER */

    .composer-area {
        padding:
            18px
            10px
            calc(8px + env(safe-area-inset-bottom));

        background:
            linear-gradient(
                transparent,
                #171a1f 28%
            );
    }

    .composer {
        width: 100%;
        max-width: none;

        padding: 7px 14px;

        border-radius: 24px;
    }

    textarea {
        min-height: 36px;

        padding: 7px 2px;

        font-size: 16px;
        line-height: 1.35;
    }

    .hint {
        margin-top: 6px;

        font-size: 10px;
    }


    /* SOURCES */

    .sources {
        margin-top: 15px;
    }

    .sources a {
        font-size: 12.5px;

        overflow-wrap: anywhere;
    }
}


/* Extra-small phones */

@media (max-width: 390px) {

    .brand {
        font-size: 13px;
    }

    .tagline-primary {
        font-size: 7.5px;
    }

    .tagline-secondary {
        font-size: 6.5px;
    }

    .header-logo {
        width: 38px;
        height: 38px;
    }

    .message.user .message-text {
        max-width: 92%;
    }
}


/* =========================================================
   JARVIS MOBILE / iPHONE REFINEMENTS
   ========================================================= */

html,
body {
    width: 100%;
    overflow: hidden;
}

.app {
    height: 100dvh;
    min-height: 100vh;
}


/* iPhone / mobile layout */

@media (max-width: 700px) {

    .app {
        height: 100dvh;
    }

    .topbar {
        min-height: 72px;

        padding:
            calc(8px + env(safe-area-inset-top))
            12px
            8px;

        align-items: center;
    }

    .header-logo {
        width: 42px;
        height: 42px;
        flex-shrink: 0;
    }

    .header-branding {
        min-width: 0;
        gap: 9px;
    }

    .header-text {
        min-width: 0;
    }

    .brand {
        font-size: 14px;
        letter-spacing: 0.5px;

        white-space: nowrap;
    }

    .tagline-primary {
        margin-top: 3px;

        font-size: 8px;
        letter-spacing: 0.55px;

        white-space: nowrap;
    }

    .tagline-secondary {
        margin-top: 1px;

        font-size: 7px;
        letter-spacing: 0.45px;

        white-space: nowrap;
    }


    /* CHAT AREA */

    .chat {
        padding:
            20px
            14px
            calc(125px + env(safe-area-inset-bottom));

        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }

    .welcome {
        transform: translateY(-18px);
    }

    .welcome-logo {
        width: 92px;
        height: 92px;

        margin-bottom: 15px;
    }

    .welcome h1 {
        font-size: 25px;
    }

    .welcome p {
        font-size: 13px;
    }


    /* MESSAGES */

    .message {
        margin-bottom: 24px;
    }

    .message-inner {
        max-width: 100%;
    }

    .message-text {
        font-size: 15.5px;
        line-height: 1.58;
    }

    .message.user .message-text {
        max-width: 88%;

        padding: 10px 14px;

        border-radius: 18px;
    }

    .assistant-identity {
        margin-bottom: 8px;
    }

    .assistant-icon {
        width: 24px;
        height: 24px;
    }


    /* COMPOSER */

    .composer-area {
        padding:
            18px
            10px
            calc(8px + env(safe-area-inset-bottom));

        background:
            linear-gradient(
                transparent,
                #171a1f 28%
            );
    }

    .composer {
        width: 100%;
        max-width: none;

        padding: 7px 14px;

        border-radius: 24px;
    }

    textarea {
        min-height: 36px;

        padding: 7px 2px;

        font-size: 16px;
        line-height: 1.35;
    }

    .hint {
        margin-top: 6px;

        font-size: 10px;
    }


    /* SOURCES */

    .sources {
        margin-top: 15px;
    }

    .sources a {
        font-size: 12.5px;

        overflow-wrap: anywhere;
    }
}


/* Extra-small phones */

@media (max-width: 390px) {

    .brand {
        font-size: 13px;
    }

    .tagline-primary {
        font-size: 7.5px;
    }

    .tagline-secondary {
        font-size: 6.5px;
    }

    .header-logo {
        width: 38px;
        height: 38px;
    }

    .message.user .message-text {
        max-width: 92%;
    }
}


/* iPhone header safe-area adjustment */

@media (max-width: 700px) {

    .topbar {
        padding-top: calc(16px + env(safe-area-inset-top));
        min-height: 82px;
    }

}


/* Additional iPhone header positioning */

@media (max-width: 700px) {

    .topbar {
        padding-top: calc(22px + env(safe-area-inset-top));
        min-height: 88px;
    }

}
