/* v58 URBAN NODE - CSS3D & ROBUST */
:root {
    --bg-color: #000000;
    --text-color: #FFFDF4;
    /* LUA Warm White */
    --header-bg: #000000;
    --header-text: #FFFDF4;
    --accent-purple: #8B00FF;
    --font-primary: "Helvetica Neue", -apple-system, system-ui, Arial, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-primary);
    background-color: var(--bg-color);
    color: var(--text-color);
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
    background: #000000;
    /* Black Background */
}

/* CSS 3D SCENE (Mobile) */
.scene3d {
    width: 100%;
    height: 100%;
    perspective: 1000px;
    transform-style: preserve-3d;
    position: absolute;
    top: 0;
    left: 0;
    overflow: hidden;
}

.shape3d {
    position: absolute;
    transform-style: preserve-3d;
    will-change: transform;
}

/* WIREFRAME CUBE FACES - INVERTED */
.cube-face {
    position: absolute;
    border: 1px solid rgba(255, 253, 244, 0.9);
    /* LUA Warm White Wireframe */
    background: rgba(255, 255, 255, 0.05);
    /* Faint White Fill */
    width: 100%;
    height: 100%;
    backface-visibility: visible;
}

.shape3d.purple .cube-face {
    border-color: rgba(139, 0, 255, 0.8);
    background: rgba(139, 0, 255, 0.1);
}

/* PYRAMID FACES (Triangles) - INVERTED */
.triangle {
    position: absolute;
    width: 0;
    height: 0;
    border-left: 30px solid transparent;
    border-right: 30px solid transparent;
    border-bottom: 60px solid rgba(255, 255, 255, 0.8);
    /* White Border */
    background: transparent;
    backface-visibility: visible;
}

.triangle::after {
    /* Inner cut for "Wireframe" look - MASK MUST BE BLACK */
    content: '';
    position: absolute;
    top: 2px;
    left: -28px;
    width: 0;
    height: 0;
    border-left: 28px solid transparent;
    border-right: 28px solid transparent;
    border-bottom: 56px solid #000000;
    /* Black Mask */
}

.shape3d.purple .triangle {
    border-bottom-color: rgba(139, 0, 255, 0.8);
}

/* HEADER */
#main-header {
    background-color: var(--header-bg);
    color: var(--header-text);
    padding: 1.5rem 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    border-bottom: 1px solid #333;
    /* Specific subtle border */
    box-shadow: 0 4px 10px rgba(255, 255, 255, 0.05);
    /* White faint shadow */
}

.header-content {
    text-align: center;
}

.header-content h1 {
    font-weight: 500;
    font-size: clamp(1.8rem, 6vw, 2.8rem);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin: 0;
    line-height: 1.0;
}

.header-content .subtitle {
    font-size: clamp(0.7rem, 2.5vw, 0.9rem);
    color: #888;
    /* Slightly darker than white */
    margin-top: 10px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.language-toggle {
    display: flex;
    gap: 12px;
    font-size: 0.75rem;
    margin-top: 15px;
    letter-spacing: 1px;
}

.lang-btn {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
}

.lang-btn.active {
    color: #fff;
    text-decoration: underline;
    text-underline-offset: 4px;
}

.app-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    max-width: 1000px;
    margin: 0 auto;
    width: 100%;
}

#chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

#messages-area {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding-bottom: 20px;
}

.msg {
    max-width: 82%;
    padding: 18px 24px;
    border-radius: 18px;
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.05);
    /* White shadow */
    font-size: 0.95rem;
    line-height: 1.6;
    animation: fadeSlide 0.5s ease-out;
    white-space: pre-wrap;
}

/* BOT MESSAGE - INVERTED: White Bubble, Black Text (High Contrast) */
.msg.bot {
    background: #ffffff;
    color: #000000;
    align-self: flex-start;
    text-transform: uppercase;
    font-weight: 400;
    /* Slightly bolder for black on white */
    border-bottom-left-radius: 2px;
}

/* USER MESSAGE - INVERTED: Dark Grey Bubble */
.msg.user {
    background: #333333;
    color: #ffffff;
    align-self: flex-end;
    border-bottom-right-radius: 2px;
}

/* INPUT AREA - Black Glass */
.input-area-wrapper {
    background: rgba(0, 0, 0, 0.8);
    border-top: 1px solid #333;
    padding: 1.5rem;
    padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
    width: 100%;
    z-index: 50;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

#chat-form {
    display: flex;
    align-items: flex-end;
    gap: 15px;
}

#file-upload {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 200;
}

.icon-btn {
    background: none;
    border: 1px solid transparent;
    cursor: pointer;
    color: #ffffff;
    /* White Icons */
    padding: 10px;
    border-radius: 50%;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 100;
    user-select: none;
    -webkit-user-select: none;
}

.icon-btn:hover {
    border-color: var(--accent-purple);
    color: var(--accent-purple);
}

#user-input {
    flex: 1;
    border: none;
    border-bottom: 2px solid #ffffff;
    /* White underline */
    background: transparent;
    color: #ffffff;
    /* White Input Text */
    padding: 10px 0;
    font-size: 1rem;
    resize: none;
    outline: none;
    font-family: var(--font-primary);
}

#user-input:focus {
    border-bottom-color: var(--accent-purple);
}

#user-input::placeholder {
    color: #666;
    text-transform: uppercase;
    font-size: 0.8rem;
}

/* LOADER - Inverted */
.loader {
    align-self: center;
    background: #fff;
    /* White Pill */
    color: #000;
    /* Black Text */
    padding: 10px 24px;
    border-radius: 30px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--accent-purple);
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 200;
}

.loader-text {
    font-size: 0.75rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.loader-pulse {
    width: 6px;
    height: 6px;
    background: var(--accent-purple);
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        opacity: 0.3;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.3;
    }
}

@keyframes fadeSlide {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hidden {
    display: none !important;
}

#main-footer {
    text-align: center;
    padding: 1rem;
    font-size: 0.7rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    background: #000;
    border-top: 1px solid #333;
}