@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

/* ==========================================================================
   Errorium Design System (Pure Vanilla CSS, Mobile-First & Fully Adaptive)
   Matching Chat-screen.png and Chat-screen-menu-not-authorized.png
   ========================================================================== */

:root {
    --bg-primary: #090d17;
    --bg-secondary: #0c1122;
    --bg-drawer: #090e1a;
    --bg-card: #101628;
    --bg-input: #121829;
    --border-subtle: rgba(255, 255, 255, 0.1);
    --border-focus: #3b82f6;

    --text-primary: #ffffff;
    --text-secondary: #ffffff;
    --text-muted: #6b7a90;
    --text-disclaimer: #4e5d78;

    --color-accent-blue: #2557e8;
    --color-accent-blue-hover: #1d46c7;
    --color-red-404: #ff4a4a;
    --color-green-accepted: #10b981;

    --font-ui: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

    --sidebar-width: 330px;
    --header-height: 58px;
    --footer-height: 100px;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent !important;
}

button,
a,
[role="button"],
.icon-btn {
    -webkit-tap-highlight-color: transparent !important;
    -webkit-touch-callout: none;
    user-select: none;
    -webkit-user-select: none;
    outline: none;
}

button:focus,
button:active,
a:focus,
a:active,
[role="button"]:focus,
[role="button"]:active,
.icon-btn:focus,
.icon-btn:active {
    outline: none !important;
    -webkit-tap-highlight-color: transparent !important;
}

html {
    width: 100%;
    max-width: 100%;
    height: 100%;
    background-color: var(--bg-primary);
    overflow-x: hidden;
}

body {
    width: 100%;
    max-width: 100%;
    height: 100%;
    height: 100dvh;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-ui);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    overflow-y: hidden;
    position: relative;
    margin: 0;
    padding: 0;
}

/* Suppress transitions on initial page load to eliminate FOUC and twitching */
.preload,
.preload *,
.preload *::before,
.preload *::after {
    -webkit-transition: none !important;
    -moz-transition: none !important;
    -ms-transition: none !important;
    -o-transition: none !important;
    transition: none !important;
}

/* ==========================================================================
   App Container & Responsive Shell
   ========================================================================== */

.app-container {
    display: flex;
    width: 100%;
    max-width: 100%;
    height: 100%;
    position: relative;
    overflow-x: hidden;
    overflow-y: hidden;
}

/* ==========================================================================
   Sidebar Drawer (Chat-screen-menu-not-authorized.png)
   ========================================================================== */

.drawer-backdrop {
    position: fixed;
    inset: 0;
    background-color: rgba(3, 6, 14, 0.7);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 80;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.26s cubic-bezier(0.16, 1, 0.3, 1);
}

.drawer-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

.sidebar-drawer {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 86vw;
    max-width: var(--sidebar-width);
    background-color: var(--bg-drawer);
    border-right: 1px solid var(--border-subtle);
    z-index: 90;
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.28s;
    box-shadow: none;
    visibility: hidden;
    pointer-events: none;
    user-select: none;
}

.sidebar-drawer.open {
    transform: translateX(0);
    visibility: visible;
    pointer-events: auto;
    box-shadow: 12px 0 36px rgba(0, 0, 0, 0.7);
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
}

.sidebar-brand {
    font-size: 1.45rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    cursor: pointer;
    user-select: none;
    transition: opacity 0.15s ease;
}

.sidebar-brand:hover {
    opacity: 0.85;
}

.close-btn {
    color: #cbd5e1;
}

.close-btn:hover {
    color: #ffffff;
}

.sidebar-toggle-btn,
.header-sidebar-toggle-btn {
    color: #cbd5e1;
    width: 36px;
    height: 36px;
    display: none !important;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    cursor: pointer;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.sidebar-toggle-btn:hover,
.header-sidebar-toggle-btn:hover {
    color: #ffffff;
    background-color: rgb(34 49 89 / 0.2);
}

.sidebar-toggle-btn svg path,
.header-sidebar-toggle-btn svg path {
    stroke: currentColor !important;
}

/* Sidebar Search Box */
.sidebar-search-box {
    padding: 8px 18px 12px;
}

.search-input-wrapper {
    display: flex;
    align-items: center;
    background-color: #111626;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 24px;
    padding: 8px 14px;
    gap: 10px;
    transition: border-color 0.15s ease;
}

.search-input-wrapper:focus-within {
    border-color: rgba(59, 130, 246, 0.6);
}

.search-icon {
    color: var(--text-muted);
    flex-shrink: 0;
}

.search-input-wrapper input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 0.95rem;
    width: 100%;
}

.search-input-wrapper input::placeholder {
    color: var(--text-muted);
}

/* Recent Chats Section */
.sidebar-section-header {
    display: flex;
    align-items: center;
    padding: 10px 20px 6px;
    font-size: 1.05rem;
    font-weight: 500;
    color: #e2e8f0;
    cursor: pointer;
    gap: 6px;
}

.chevron-icon {
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

.sidebar-section-header.collapsed .chevron-icon {
    transform: rotate(-90deg);
}

.recent-chats-nav {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 4px 10px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.recent-chats-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.recent-chat-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: 8px;
    color: #d1d7e0;
    font-size: 0.92rem;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.recent-chat-item:hover {
    background-color: rgba(255, 255, 255, 0.06);
    color: #ffffff;
}

.recent-chat-item.active {
    background-color: rgba(37, 87, 232, 0.18);
    color: #ffffff;
    font-weight: 500;
}

.chat-item-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 8px;
}

.chat-item-more {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    opacity: 0.7;
    transition: opacity 0.15s, color 0.15s;
    flex-shrink: 0;
}

.chat-item-more:hover {
    opacity: 1;
    color: #ffffff;
}

/* Sidebar Bottom Controls */
.sidebar-bottom {
    margin-top: auto;
    flex-shrink: 0;
    padding: 14px 18px 18px;
    background-color: var(--bg-drawer);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-links-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.sidebar-links-left {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-link-btn {
    display: flex;
    align-items: center;
    gap: 9px;
    background: transparent;
    border: none;
    color: #d1d7e0;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    padding: 4px 0;
    transition: color 0.15s ease;
}

.sidebar-link-btn:hover {
    color: #ffffff;
}

.new-chat-pill-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: #080c18;
    border: none;
    border-radius: 24px;
    padding: 9px 16px;
    margin-right: 3px;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
    transition: transform 0.15s ease, background-color 0.15s ease;
}

.new-chat-pill-btn:hover {
    background-color: #f1f5f9;
    transform: translateY(-1px);
}

.new-chat-pill-btn:active {
    transform: translateY(0);
}

.sidebar-divider {
    height: 1px;
    background-color: rgba(255, 255, 255, 0.08);
    margin: 8px 0 12px;
}

/* Sidebar User Footer Row */
.sidebar-user-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-info-group {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 4px 0;
    border-radius: 8px;
    transition: opacity 0.15s;
}

.user-info-group:hover {
    opacity: 0.9;
}

.user-text-meta {
    display: flex;
    flex-direction: column;
}

.user-title {
    font-size: 0.98rem;
    font-weight: 600;
    color: var(--text-primary);
}

.user-subtitle {
    font-size: 0.76rem;
    color: var(--text-muted);
}

.settings-btn {
    color: #cbd5e1;
    padding: 8px;
}

.settings-btn:hover {
    color: #ffffff;
}

/* ==========================================================================
   Main Viewport
   ========================================================================== */

.main-viewport {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    max-width: 100%;
    position: relative;
    overflow-x: hidden;
    overflow-y: hidden;
}

/* Header (Chat-screen.png) */
.app-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    padding-top: env(safe-area-inset-top, 0px);
    z-index: 20;
    flex-shrink: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.icon-btn {
    background: transparent;
    border: none;
    outline: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: opacity 0.15s, background-color 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.header-menu-btn,
.header-sidebar-toggle-btn {
    width: 36px;
    height: 36px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    padding: 4px;
}

.hamburger-bar {
    display: block;
    width: 22px;
    height: 2px;
    background-color: #ffffff;
    border-radius: 2px;
}

.header-logo {
    font-size: 1.55rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: #ffffff;
    cursor: pointer;
}

.header-profile-btn {
    width: 36px;
    height: 36px;
    color: #ffffff;
}

.header-profile-btn:hover {
    opacity: 0.85;
}

/* ==========================================================================
   View Content: Hero Screen & Chat Screen
   ========================================================================== */

.view-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
}

/* HERO SCREEN (Chat-screen.png) */
.hero-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 16px 16px 60px;
    text-align: center;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    box-sizing: border-box;
}

/* Blue Fire Background Aura (blue-fire.png) */
.hero-glow-aura {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(520px, 120vw);
    max-height: 56vh;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 1;
    user-select: none;
}

.blue-fire-bg {
    width: auto;
    max-width: 100%;
    max-height: 100%;
    height: auto;
    object-fit: contain;
    display: block;
    user-select: none;
    -webkit-user-drag: none;
}

.hero-center-card {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 100%;
    box-sizing: border-box;
}

.mascot-wrapper {
    margin-bottom: 18px;
    filter: drop-shadow(0 10px 24px rgba(37, 87, 232, 0.35));
    animation: mascotFloat 2s ease-in-out infinite;
}

@keyframes mascotFloat {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-6px);
    }
}

.mascot-image {
    display: block;
    width: 108px;
    height: auto;
    user-select: none;
    -webkit-user-drag: none;
}

/* Exact Monospace Typography with responsive clamp */
.hero-text-block {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-family: var(--font-mono);
    max-width: 96vw;
    box-sizing: border-box;
}

.hero-primary-text {
    font-size: clamp(14px, 4.3vw, 18px);
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.04em;
    line-height: 1.25;
    white-space: nowrap;
    text-shadow: 0 4px 4px rgba(0, 0, 0, 0.4);
}

.error-code-red {
    color: var(--color-red-404);
    font-weight: 700;
}

.hero-secondary-text {
    font-size: clamp(13px, 3.8vw, 16px);
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: -0.04em;
    line-height: 1.25;
    white-space: nowrap;
    text-shadow: 0 4px 4px rgba(0, 0, 0, 0.4);
}

.space {
    letter-spacing: -0.2em;
}

/* Floor Spotlight Ellipse Beam (already integrated in blue-fire.png) */
.hero-spotlight-beam {
    display: none;
}

/* ==========================================================================
   Chat View (Messages & Solutions)
   ========================================================================== */

.chat-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 16px 20px 80px;
    max-width: 840px;
    width: 100%;
    margin: 0 auto;
}

.messages-container {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.message-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
    animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.message-row.user {
    align-self: flex-end;
    max-width: 85%;
}

.user-bubble {
    background-color: #1a233b;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 18px 18px 4px 18px;
    padding: 12px 18px;
    color: #ffffff;
    font-size: 0.98rem;
    word-break: break-word;
    font-family: var(--font-mono);
}

.message-row.assistant {
    align-self: flex-start;
    width: 100%;
}

.assistant-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.card-top-bar {
    display: flex;
    align-items: center;
    gap: 10px;
}

.badge-mascot {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background-color: rgba(37, 87, 232, 0.2);
    filter: drop-shadow(0 0px 6px rgba(0, 0, 0, 0.95));
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
}

.badge-mascot img {
    width: 100%;
    height: auto;
}

.card-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: #cbd5e1;
}

.card-solution-text {
    font-size: 0.96rem;
    line-height: 1.55;
    color: #e2e8f0;
}

/* Code Snippet Box */
.code-block-wrapper {
    background-color: #080c16;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
}

.code-block-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 14px;
    background-color: #0f1525;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.code-copy-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 0.78rem;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
}

.code-copy-btn:hover {
    color: #ffffff;
}

.code-block-wrapper pre {
    padding: 14px;
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 0.88rem;
    line-height: 1.45;
    color: #38bdf8;
}

/* Sources Accordion */
.sources-card {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 12px;
}

.sources-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.88rem;
    color: var(--text-secondary);
    cursor: pointer;
    font-weight: 500;
}

.sources-list {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.source-item {
    background-color: #0c1222;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-decoration: none;
    color: #e2e8f0;
    transition: border-color 0.15s;
}

.source-item:hover {
    border-color: rgba(59, 130, 246, 0.4);
}

.source-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.source-score {
    background-color: rgba(16, 185, 129, 0.15);
    color: var(--color-green-accepted);
    font-size: 0.78rem;
    font-weight: 600;
    padding: 3px 7px;
    border-radius: 6px;
    font-family: var(--font-mono);
}

.source-title {
    font-size: 0.88rem;
}

/* ==========================================================================
   Bottom Prompt Area (Chat-screen.png)
   ========================================================================== */

.app-prompt-footer {
    padding: 8px 16px;
    padding-bottom: max(16px, env(safe-area-inset-bottom, 16px));
    position: relative;
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Attachment Popover (Liquid Glass) */
.attach-popover {
    position: absolute;
    bottom: 84px;
    left: 20px;
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.09) 0%,
        rgba(17, 24, 44, 0.75) 45%,
        rgba(10, 15, 30, 0.88) 100%
    );
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-top: 1px solid rgba(255, 255, 255, 0.32);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    box-shadow:
        inset 0 1px 1px 0 rgba(255, 255, 255, 0.2),
        0 14px 40px rgba(0, 0, 0, 0.65),
        0 2px 10px rgba(37, 87, 232, 0.15);
    z-index: 40;
    min-width: 210px;
}

.popover-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.88rem;
    color: #d1d7e0;
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s;
}

.popover-item:hover {
    background-color: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.lang-tag {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 4px;
    background-color: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
    font-family: var(--font-mono);
}

/* Liquid Glass Capsule Input Container (Apple VisionOS / High-end Designer Glass) */
.prompt-bar-container {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 720px;
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.03) 10%,
        rgba(15, 23, 42, 0.35) 70%,
        rgba(10, 16, 32, 0.5) 100%
    );
    backdrop-filter: blur(28px) saturate(210%) brightness(108%);
    -webkit-backdrop-filter: blur(28px) saturate(210%) brightness(108%);
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 9999px;
    padding: 7px 10px 7px 14px;
    gap: 10px;
    box-shadow:
        0 24px 50px -12px rgba(0, 0, 0, 0.75),
        0 8px 24px -4px rgba(2, 6, 23, 0.6),
        inset 0 1.5px 1.5px 0 rgba(255, 255, 255, 0.3),
        inset 0 8px 20px -6px rgba(255, 255, 255, 0.15),
        inset 0 -2px 6px 0 rgba(147, 197, 253, 0.15),
        inset 0 -12px 28px 0 rgba(5, 10, 25, 0.5);
    transition:
        border-color 0.3s cubic-bezier(0.16, 1, 0.3, 1),
        box-shadow 0.3s cubic-bezier(0.16, 1, 0.3, 1),
        background 0.3s ease,
        transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    box-sizing: border-box;
    overflow: hidden;
}

.prompt-bar-container:hover {
    box-shadow:
        0 24px 50px -12px rgba(0, 0, 0, 0.75),
        0 8px 24px -4px rgba(2, 6, 23, 0.6),
        inset 0 1.5px 1.5px 0 rgba(255, 255, 255, 0.3),
        inset 0 8px 20px -6px rgba(255, 255, 255, 0.15),
        inset 0 -2px 6px 0 rgba(147, 197, 253, 0.15),
        inset 0 -12px 28px 0 rgba(5, 10, 25, 0.5),
        0 0 25px 2px rgb(56 110 248 / 0.1);
    transition:
            box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1)
}

.prompt-bar-container:focus-within {
    border-color: rgba(147, 197, 253, 0.7);
    box-shadow:
        0 30px 65px -8px rgba(0, 0, 0, 0.85),
        0 0 45px 2px rgb(56 110 248 / 0.2),
        0 0 0 1.5px rgba(147, 197, 253, 0.1),
        inset 0 12px 28px -4px rgba(255, 255, 255, 0.1),
        inset 0 -3px 8px 0 rgb(78 149 255 / 0.2),
        inset 0 -16px 36px 0 rgba(5, 10, 25, 0.6);
}

/* Standalone Plus Action Button (No circle plate) */
.prompt-plus-btn {
    width: 32px;
    height: 32px;
    color: #94a3b8;
    background: transparent;
    border: none;
    box-shadow: none;
    border-radius: 0;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    flex-shrink: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: color 0.2s ease, transform 0.15s ease;
    position: relative;
    z-index: 2;
}

.prompt-plus-btn:hover {
    color: #ffffff;
    background: transparent;
    border: none;
    box-shadow: none;
    transform: scale(1.12);
}

.prompt-plus-btn:active {
    transform: scale(0.92);
}

.prompt-input-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    position: relative;
    z-index: 2;
}

#prompt-input {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    color: #f8fafc;
    font-size: 0.98rem;
    font-family: inherit;
    resize: none;
    line-height: 1.45;
    max-height: 140px;
    padding: 6px 4px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

#prompt-input::placeholder {
    color: rgba(203, 213, 225, 0.65);
    text-shadow: none;
}

/* Liquid Sapphire Droplet Send Button */
.prompt-send-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: radial-gradient(
        100% 100% at 32% 22%,
        #60a5fa 0%,
        #3b82f6 35%,
        #2563eb 70%,
        #1d4ed8 100%
    );
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.45);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow:
        inset 0 -2px 4px 0 rgba(15, 23, 42, 0.6),
        0 6px 18px 0 rgba(37, 99, 235, 0.3),
        0 0 14px 0 rgba(96, 165, 250, 0.2);
    transition:
        background 0.25s,
        transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    z-index: 2;
}

.prompt-send-btn:hover {
    background: radial-gradient(
        100% 100% at 32% 22%,
        #60a5fa 35%,
        #3b82f6 70%,
        #2563eb 100%
    );
    transform: scale(1.03);
    box-shadow:
        inset 0 2px 2px 0 rgb(255 255 255 / 0.1),
        inset 0 -2px 4px 0 rgba(15, 23, 42, 0.5),
        0 8px 24px 0 rgba(37, 99, 235, 0.5),
        0 0 20px 0 rgba(96, 165, 250, 0.2);
}

.prompt-send-btn:active {
    transform: scale(0.98);
    box-shadow:
        inset 0 1px 2px 0 rgba(0, 0, 0, 0.4),
        0 3px 10px 0 rgba(37, 99, 235, 0.45);
}

/* Disclaimer Text */
.prompt-disclaimer {
    font-size: 0.74rem;
    color: var(--text-disclaimer);
    margin-top: 10px;
    text-align: center;
    user-select: none;
}

/* ==========================================================================
   Modals
   ========================================================================== */

.modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(3, 6, 14, 0.75);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 120;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: fadeIn 0.18s ease;
}

.modal-card {
    background-color: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 18px;
    width: 100%;
    max-width: 440px;
    padding: 24px 26px;
    position: relative;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
}

.modal-wide {
    max-width: 580px;
}

.modal-close-btn {
    position: absolute;
    top: 16px;
    right: 18px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
}

.modal-close-btn:hover {
    color: #ffffff;
}

.modal-header {
    text-align: center;
    margin-bottom: 20px;
}

.modal-icon-badge {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background-color: rgba(37, 87, 232, 0.15);
    color: #60a5fa;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.modal-icon-badge.mcp-badge {
    background-color: rgba(168, 85, 247, 0.15);
    color: #c084fc;
}

.modal-header h2 {
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.modal-subtitle {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.45;
}

/* Auth Buttons */
.auth-buttons-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.auth-provider-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background-color: #161e33;
    color: #ffffff;
    transition: background-color 0.15s;
}

.auth-provider-btn:hover {
    background-color: #1d2844;
}

/* MCP Token & JSON Box */
.token-field-box {
    margin-bottom: 16px;
}

.token-field-box label {
    display: block;
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.copy-input-row {
    display: flex;
    gap: 8px;
}

.copy-input-row input {
    flex: 1;
    background-color: #0b101e;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 8px 12px;
    color: #38bdf8;
    font-family: var(--font-mono);
    font-size: 0.88rem;
    outline: none;
}

.action-btn {
    background-color: var(--color-accent-blue);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
}

.action-btn:hover {
    background-color: var(--color-accent-blue-hover);
}

.code-preview-box {
    background-color: #080c16;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
}

.code-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    background-color: #0f1525;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.copy-code-text-btn {
    background: transparent;
    border: none;
    color: #60a5fa;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
}

.copy-code-text-btn:hover {
    text-decoration: underline;
}

.code-content {
    padding: 12px 14px;
    font-family: var(--font-mono);
    font-size: 0.84rem;
    line-height: 1.45;
    color: #e2e8f0;
    overflow-x: auto;
}

/* About Us Modal Specs Grid */
.specs-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 16px 0;
}

.spec-card {
    background-color: #0c1222;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 12px;
    text-align: center;
}

.spec-num {
    font-size: 1.15rem;
    font-weight: 700;
    color: #60a5fa;
    font-family: var(--font-mono);
}

.spec-label {
    font-size: 0.76rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.nirs-note {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: 14px;
}

/* Settings Modal */
.settings-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.setting-title {
    font-size: 0.95rem;
    font-weight: 600;
}

.setting-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.active-badge {
    background-color: rgba(16, 185, 129, 0.15);
    color: var(--color-green-accepted);
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.78rem;
    font-family: var(--font-mono);
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

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

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: #334155;
    transition: 0.2s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.2s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: var(--color-accent-blue);
}

input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

/* Toast Message */
.toast-message {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #ffffff;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 0.88rem;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.5);
    z-index: 200;
    animation: fadeIn 0.2s ease;
}

/* ==========================================================================
   Responsive Adaptations (Small Height, Tablet & Desktop)
   ========================================================================== */

/* Short height screens (e.g. Samsung Galaxy Fold external cover screen, landscape, compact viewports) */
@media (max-height: 720px) {
    .hero-glow-aura {
        max-width: 120vw;
        max-height: 130vh;
    }
}

@media (max-height: 600px) {
    .hero-screen {
        padding: 12px 12px 36px;
    }

    .hero-glow-aura {
        max-width: 100vw;
    }

    .mascot-image {
        width: 84px;
    }

    .mascot-wrapper {
        margin-bottom: 14px;
    }
}

@media (min-width: 768px) {
    :root {
        --header-height: 64px;
    }

    .hero-primary-text {
        font-size: 1.35rem;
    }

    .hero-secondary-text {
        font-size: 1.15rem;
    }

    .mascot-image {
        width: 120px;
    }

    .hero-glow-aura {
        width: 560px;
        max-height: 65vh;
    }

    /* Sidebar is open by default on screens ≥768px */
    .sidebar-drawer {
        position: relative;
        top: auto;
        bottom: auto;
        left: auto;
        width: var(--sidebar-width);
        min-width: var(--sidebar-width);
        max-width: var(--sidebar-width);
        height: 100%;
        transform: none !important;
        visibility: visible !important;
        pointer-events: auto !important;
        box-shadow: none !important;
        transition: margin-left 0.28s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.28s !important;
        flex-shrink: 0;
        z-index: 10;
    }

    .drawer-backdrop {
        display: none !important;
    }

    .close-btn {
        display: none !important;
    }

    .sidebar-toggle-btn {
        display: flex !important;
    }

    .header-menu-btn {
        display: none !important;
    }

    .header-sidebar-toggle-btn {
        display: none !important;
    }

    .header-logo {
        display: none !important;
    }

    .app-header {
        justify-content: flex-end;
        box-shadow: #070a13 0 0 40px;
    }

    html.sidebar-collapsed .sidebar-drawer,
    .sidebar-drawer.collapsed,
    .app-container.sidebar-collapsed .sidebar-drawer {
        margin-left: calc(-1 * var(--sidebar-width)) !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }

    html.sidebar-collapsed .header-sidebar-toggle-btn,
    .app-container.sidebar-collapsed .header-sidebar-toggle-btn {
        display: flex !important;
    }

    html.sidebar-collapsed .header-logo,
    .app-container.sidebar-collapsed .header-logo {
        display: block !important;
    }

    html.sidebar-collapsed .app-header,
    .app-container.sidebar-collapsed .app-header {
        justify-content: space-between !important;
    }

    .main-viewport {
        min-width: 0;
    }
}

@media (min-width: 930px) {
    /* Persistent Sidebar (default open on wide screens, collapsible by toggle button) */
    .sidebar-drawer {
        position: relative;
        top: auto;
        bottom: auto;
        left: auto;
        width: var(--sidebar-width);
        min-width: var(--sidebar-width);
        max-width: var(--sidebar-width);
        height: 100%;
        transform: none !important;
        visibility: visible !important;
        pointer-events: auto !important;
        box-shadow: none !important;
        transition: margin-left 0.28s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.28s !important;
        flex-shrink: 0;
        z-index: 10;
    }
    .prompt-bar-container {
        margin-bottom: 6px;
    }
    
    /* Backdrop is never shown on wide screens */
    .drawer-backdrop {
        display: none !important;
    }

    /* Cross/close button in sidebar disappears as menu uses dedicated collapse button */
    .close-btn {
        display: none !important;
    }

    /* Dedicated sidebar collapse button shown in sidebar header */
    .sidebar-toggle-btn {
        display: flex !important;
    }

    /* Hamburger menu button in header disappears as sidebar is open by default */
    .header-menu-btn {
        display: none !important;
    }

    /* Open/expand button in header is hidden by default when sidebar is open */
    .header-sidebar-toggle-btn {
        display: none !important;
    }

    /* Errorium text in the center of header disappears to prevent duplicate project names */
    .header-logo {
        display: none !important;
    }

    /* Header aligns remaining elements (profile/auth button) to the right */
    .app-header {
        justify-content: flex-end;
        box-shadow: var(--bg-primary) 0 0 40px;
    }

    /* Collapsible sidebar on wide screens */
    html.sidebar-collapsed .sidebar-drawer,
    .sidebar-drawer.collapsed,
    .app-container.sidebar-collapsed .sidebar-drawer {
        margin-left: calc(-1 * var(--sidebar-width)) !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }

    html.sidebar-collapsed .header-sidebar-toggle-btn,
    .app-container.sidebar-collapsed .header-sidebar-toggle-btn {
        display: flex !important;
    }

    html.sidebar-collapsed .header-logo,
    .app-container.sidebar-collapsed .header-logo {
        display: block !important;
    }

    html.sidebar-collapsed .app-header,
    .app-container.sidebar-collapsed .app-header {
        justify-content: space-between !important;
    }

    /* Main viewport takes remaining width cleanly */
    .main-viewport {
        min-width: 0;
    }

    /* On wide screens, prompt bar expands gracefully */
    .prompt-bar-container {
        max-width: 800px;
    }
}
