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

body {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-weight: 300;
    background: radial-gradient(circle at 15% 20%, rgba(234, 239, 255, 0.8), rgba(244, 246, 255, 0.9) 45%, rgba(250, 251, 255, 1) 85%);
    height: 100dvh; /* Dynamic viewport - excludes browser UI */
    overflow-y: auto; /* Allow pull-to-refresh */
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    color: #0A0A0A;
    letter-spacing: 0;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Main container - Brian Eno asymmetric layout */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    padding: 0 16px 16px;
    position: relative;
    z-index: 1;
    min-height: 0; /* Important for mobile - prevents expansion */
}

.workspace {
    flex: 1;
    display: flex;
    flex-direction: row;
    gap: 16px;
    min-height: 0;
    padding-top: 16px;
}

/* Messages area */
.messages {
    flex: 1.08;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0;
    scroll-behavior: smooth;
    display: flex;
    flex-direction: column;
    justify-content: flex-start; /* Changed from center to allow scrolling to top */
    min-width: 0;
}

.messages::-webkit-scrollbar {
    width: 0;
}

.messages-inner {
    display: flex;
    flex-direction: column;
    margin: 0;
    max-width: 100%;
    width: 100%;
    padding: 0 8px;
}

.message {
    margin: 3px 0; /* Extremely tight vertical stack */
    opacity: 0;
    animation: arrive 0.6s ease forwards;
}

/* AI messages - even tighter for terminal density */
.message.ai,
.message.assistant {
    margin: 2px 0;
}

/* Minimal spacing for first and last messages */
.message:first-child {
    margin-top: 8px;
}

.message:last-child {
    margin-bottom: 8px;
}

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

.message.user {
    text-align: right;
}

/* Collapsible user messages */
.message.user .bubble.collapsible {
    position: relative;
    display: -webkit-box;
    -webkit-line-clamp: 3; /* Align with JS threshold */
    -webkit-box-orient: vertical;
    overflow: hidden; /* No ellipsis; we use a fade mask */
    text-overflow: clip;
}

.message.user .bubble.expanded {
    display: block;
    -webkit-line-clamp: unset;
}

.message.user .expand-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 6px;
    margin-right: 4px;
    font-size: 11px;
    letter-spacing: 0.02em;
    color: rgba(0, 0, 0, 0.55);
    cursor: pointer;
    border: 1px solid rgba(0, 0, 0, 0.06);
    background: #fff;
    padding: 4px 8px;
    border-radius: 999px;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 400;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, color 0.18s ease;
}

.message.user .expand-toggle:hover {
    color: rgba(0, 0, 0, 0.8);
    border-color: rgba(0, 0, 0, 0.12);
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

/* Gentle fade to indicate more content without cutting words */
.message.user .bubble.collapsible::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 48px;
    pointer-events: none;
    background: linear-gradient(to bottom, rgba(255,255,255,0), rgba(255,255,255,1));
}

.bubble {
    display: inline-block;
    max-width: 85%;
    padding: 8px 12px; /* Ultra-compact terminal style */
    background: #FFFFFF; /* Match page background for assistant messages */
    border: 1px solid rgba(0, 0, 0, 0.04);
    border-radius: 10px;
    font-size: 15px;
    line-height: 1.5; /* Tighter line height */
    text-align: left;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Better typography for message content */
.bubble p {
    margin: 0 0 4px 0; /* Minimal space between paragraphs */
}

.bubble p:last-child {
    margin-bottom: 0;
}

.bubble p + details {
    margin-top: 1px;
}

/* List styling - ultra-dense */
.bubble ul,
.bubble ol {
    margin: 4px 0;
    padding-left: 16px;
    list-style-position: outside;
}

.bubble ol {
    margin-bottom: 1px;
}

.bubble li {
    margin: 0;
    line-height: 1.35;
    padding-left: 0;
}

.input-box.drag-over {
    border: 2px dashed rgba(0, 0, 0, 0.35);
    border-radius: 18px;
    background: rgba(0, 0, 0, 0.04);
    transition: border 0.18s ease, background 0.18s ease;
}

.message-attachments {
    margin-top: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.message-attachment {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.06);
    color: rgba(0, 0, 0, 0.78);
    font-size: 12px;
    text-decoration: none;
    transition: background 0.18s ease, border-color 0.18s ease, transform 0.1s ease;
    cursor: pointer;
}

.message-attachment:hover {
    background: rgba(0, 0, 0, 0.06);
    border-color: rgba(0, 0, 0, 0.16);
}

.message-attachment:active {
    transform: translateY(1px);
}

.message-attachment--no-link {
    cursor: default;
}

.message-attachment--no-link:hover {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.06);
}

.message-attachment-icon {
    display: inline-flex;
    color: rgba(0, 0, 0, 0.55);
}

.message-attachment-name {
    font-weight: 500;
}

.message-attachment-size {
    margin-left: auto;
    font-size: 12px;
    color: rgba(0, 0, 0, 0.5);
}

.message.user .message-attachments {
    align-items: flex-end;
}

.message.user .message-attachment {
    justify-content: flex-end;
}

.preview-panel {
    flex: 1;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(15, 23, 42, 0.05);
    border-radius: 18px;
    box-shadow: 0 30px 60px -40px rgba(15, 23, 42, 0.45), 0 18px 28px -30px rgba(15, 23, 42, 0.2);
    backdrop-filter: blur(2px);
}

.preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px 8px;
    font-size: 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(23, 37, 84, 0.55);
}

.preview-title {
    font-weight: 600;
}

.preview-actions {
    align-items: center;
    gap: 10px;
}

.preview-actions-desktop {
    display: inline-flex;
}

.preview-actions-mobile {
    display: none;
}

.preview-actions button {
    border: none;
    background: none;
    color: rgba(55, 97, 238, 0.6);
    font-size: 17px;
    cursor: pointer;
    transition: transform 0.2s ease, color 0.2s ease;
    line-height: 1;
    padding: 6px 8px;
}

.preview-actions button:hover {
    transform: rotate(90deg);
    color: rgba(55, 97, 238, 0.85);
}

.preview-actions button.preview-toggle:hover {
    transform: rotate(180deg);
}

.preview-frame-container {
    position: relative;
    flex: 1;
    border-top: 1px solid rgba(15, 23, 42, 0.05);
    border-bottom: 1px solid rgba(15, 23, 42, 0.05);
    background: rgba(248, 250, 255, 0.65);
    border-radius: 0 0 18px 18px;
    overflow: hidden;
}

#previewFrame {
    width: 100%;
    height: 100%;
    border: none;
    background: #ffffff;
    overscroll-behavior-y: contain;
    touch-action: pan-y;
}

.preview-placeholder {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 32px;
    text-align: center;
    color: rgba(23, 37, 84, 0.55);
    font-size: 14px;
    letter-spacing: 0.05em;
    background: linear-gradient(160deg, rgba(248, 250, 255, 0.9), rgba(235, 239, 252, 0.9));
    border-radius: 0 0 18px 18px;
}

.preview-placeholder strong {
    font-weight: 600;
    margin-bottom: 4px;
}

.preview-status {
    padding: 10px 20px 14px;
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(23, 37, 84, 0.5);
}

.workspace.full-preview {
    gap: 0;
    flex-direction: column;
}

.workspace.full-preview .messages {
    display: none;
}

.workspace.full-preview .preview-panel {
    flex: 1;
    max-width: 100%;
    border-radius: 20px;
}

.workspace.full-preview .preview-frame-container {
    border-radius: 0 0 20px 20px;
}

.bubble li::marker {
    color: rgba(0, 0, 0, 0.45);
}

/* Nested lists */
.bubble ul ul,
.bubble ol ul,
.bubble ul ol,
.bubble ol ol {
    margin: 6px 0;
    padding-left: 18px;
}

/* Headers in messages */
.bubble h1,
.bubble h2,
.bubble h3 {
    margin: 10px 0 6px 0;
    font-weight: 600; /* Stronger, like news headlines */
    line-height: 1.25;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

/* Reduce space when heading comes after list */
.bubble ul + h1,
.bubble ol + h1,
.bubble ul + h2,
.bubble ol + h2,
.bubble ul + h3,
.bubble ol + h3 {
    margin-top: 6px !important;
}

/* Tight spacing when heading is followed by list */
.bubble h1:has(+ ul),
.bubble h1:has(+ ol),
.bubble h2:has(+ ul),
.bubble h2:has(+ ol),
.bubble h3:has(+ ul),
.bubble h3:has(+ ol) {
    margin-bottom: 0 !important; /* ZERO - heading touches list */
}

.bubble h1 + ul,
.bubble h1 + ol,
.bubble h2 + ul,
.bubble h2 + ol,
.bubble h3 + ul,
.bubble h3 + ol {
    margin-top: -2px !important; /* Ultra-tight */
}

.bubble h1 {
    font-size: 20px;
}

.bubble h2 {
    font-size: 18px;
}

.bubble h3 {
    font-size: 16px;
}

.bubble h1:first-child,
.bubble h2:first-child,
.bubble h3:first-child {
    margin-top: 0;
}

/* Code blocks - Claude Code inspired styling */
.bubble pre {
    margin: 6px 0;
    padding: 0;
    background: #f0f7ee; /* Claude Code greenish background */
    border-radius: 8px;
    overflow-x: auto;
    border: 1px solid rgba(0, 0, 0, 0.08);
    font-size: 13px;
    position: relative;
}

/* Line numbers styling */
.bubble pre.line-numbers {
    padding-left: 0;
}

.bubble pre.line-numbers > code {
    padding-left: 3.8em;
}

.bubble pre .line-numbers-rows {
    position: absolute;
    pointer-events: none;
    top: 0;
    font-size: 100%;
    left: -3.8em;
    width: 3em;
    letter-spacing: -1px;
    border-right: 1px solid rgba(0, 0, 0, 0.08);
    user-select: none;
    counter-reset: linenumber;
    background: #e8f3e5;
    padding: 12px 0;
}

.bubble pre .line-numbers-rows > span {
    display: block;
    counter-increment: linenumber;
    padding-right: 0.8em;
    text-align: right;
    color: rgba(0, 0, 0, 0.4);
}

.bubble pre .line-numbers-rows > span:before {
    content: counter(linenumber);
}

.bubble pre > code {
    display: block;
    padding: 12px 16px;
    background: transparent;
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.5;
    color: rgba(0, 0, 0, 0.85);
}

.bubble code {
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
    color: rgba(0, 0, 0, 0.85);
}

/* Inline code - beautiful and readable */
.bubble p code,
.bubble li code {
    background: #f7efef;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 13px;
    color: #6b1912;
    border: 1px solid rgba(189, 67, 54, 0.25);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.bubble pre code {
    background: transparent;
    padding: 0;
}

/* Language label in code blocks */
.bubble pre span[style*="opacity"] {
    display: block;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 10px;
    color: rgba(0, 0, 0, 0.4);
}

/* Prism.js Custom Theme - Claude Code inspired */
.bubble pre code .token.comment,
.bubble pre code .token.prolog,
.bubble pre code .token.doctype,
.bubble pre code .token.cdata {
    color: #6a737d;
    font-style: italic;
}

.bubble pre code .token.punctuation {
    color: #24292e;
}

.bubble pre code .token.property,
.bubble pre code .token.tag,
.bubble pre code .token.boolean,
.bubble pre code .token.number,
.bubble pre code .token.constant,
.bubble pre code .token.symbol,
.bubble pre code .token.deleted {
    color: #d73a49;
}

.bubble pre code .token.selector,
.bubble pre code .token.attr-name,
.bubble pre code .token.string,
.bubble pre code .token.char,
.bubble pre code .token.builtin,
.bubble pre code .token.inserted {
    color: #22863a;
}

.bubble pre code .token.operator,
.bubble pre code .token.entity,
.bubble pre code .token.url,
.bubble pre code .language-css .token.string,
.bubble pre code .style .token.string {
    color: #005cc5;
}

.bubble pre code .token.atrule,
.bubble pre code .token.attr-value,
.bubble pre code .token.keyword {
    color: #6f42c1;
}

.bubble pre code .token.function,
.bubble pre code .token.class-name {
    color: #6f42c1;
}

.bubble pre code .token.regex,
.bubble pre code .token.important,
.bubble pre code .token.variable {
    color: #e36209;
}

.bubble pre code .token.important,
.bubble pre code .token.bold {
    font-weight: bold;
}

.bubble pre code .token.italic {
    font-style: italic;
}

.user .bubble {
    background: rgba(0, 0, 0, 0.05); /* Subtle tone borrowed from former assistant bubble */
    color: #0B0B0B;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 10px; /* Consistent, refined radius */
    padding: 8px 12px; /* Ultra-compact */
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-weight: 400;
}

.ai .bubble,
.assistant .bubble {
    background: #FFFFFF;
    color: #0D0D0D;
    border: 1px solid rgba(0, 0, 0, 0.04);
    border-radius: 10px; /* Flat but refined */
}

/* Welcome message */
.welcome {
    padding: 16px;
    font-size: 18px;
    color: rgba(0, 0, 0, 0.3);
    font-weight: 300;
    text-align: center;
    /* Center vertically when it's the only element */
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
}

/* Tool status */
#tool-status {
    display: none;
}

/* Input area with controls - ultra-compact */
.input-container {
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    padding: 8px 12px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
    background: #FAFAFA;
    flex-shrink: 0;
    transition: transform 0.3s ease-out;
    display: flex;
    justify-content: center;
    position: relative;
    z-index: 1300;
}

.input-wrapper {
    max-width: 960px;
    width: 100%;
    margin: 0 auto;
    padding: 0 12px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Control buttons row - responsive */
.controls {
    display: flex;
    gap: 3px;
    margin-bottom: 4px;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 100%;
}

.model-selector {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 4px 0 12px;
    width: 100%;
}

.model-selector select {
    width: 100%;
    padding: 12px 20px;
    background: #fff;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 8px;
    color: #000;
    font-size: 14px;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.2s;
    appearance: none;
    background-image: url('data:image/svg+xml;charset=UTF-8,%3Csvg width="12" height="8" viewBox="0 0 12 8" fill="none" xmlns="http://www.w3.org/2000/svg"%3E%3Cpath d="M1 1.5L6 6.5L11 1.5" stroke="black" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/%3E%3C/svg%3E');
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 44px;
}

.model-selector select:hover {
    background: rgba(0,0,0,0.02);
}

.model-selector select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.model-selector select option {
    background: #fff;
    color: #000;
    padding: 12px;
}

.control-btn {
    padding: 5px 10px;
    background: transparent;
    border: 1px solid #E0E0E0;
    border-radius: 14px;
    font-size: 12px;
    color: #606060;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 3px;
    font-weight: 400;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.control-btn:hover {
    background: #000;
    color: #FFF;
    border-color: #000;
}

.control-btn.active {
    background: #000;
    color: #FFF;
    border-color: #000;
}


.control-icon {
    font-size: 16px;
    opacity: 0.8;
}

/* Responsive layout for control buttons */
@media (max-width: 470px) {
    .control-btn {
        font-size: 11px;
        padding: 8px 10px;
        white-space: nowrap;
    }
    
    .control-icon {
        font-size: 14px;
    }
}

/* Input field */
.input-box {
    position: relative;
    display: flex;
    align-items: flex-end;
    background: transparent; /* No container background */
    width: 100%;
}

 .input-area {
    width: 100%;
    position: relative;
    display: flex;
    align-items: flex-end;
    background: transparent;
}

.input-field {
    position: relative;
    width: 100%;
}

textarea.input,
input.input {
    width: 100%;
    padding: 10px 90px 10px 140px;
    background: #FFFFFF;
    border: none;
    border-radius: 20px;
    font-size: 14px;
    font-family: inherit;
    font-weight: 400;
    outline: none;
    transition: border 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    color: #1A1A1A;
    resize: none;
    min-height: 40px;
    max-height: 200px;
    line-height: 1.5;
    box-shadow: none;
    vertical-align: middle;
}

textarea.input:focus,
input.input:focus {
    background: #FFFFFF;
    outline: none;
    border: none;
    box-shadow: none;
}

textarea.input::placeholder,
input.input::placeholder {
    color: #A0A0A0;
}

.mobile-preview-toggle {
    display: none;
}

.mobile-preview-option {
    font-family: inherit;
}

.mobile-preview-toggle-indicator {
    display: none;
}

/* Focus state removed for cleaner appearance */

.attach-btn {
    position: absolute;
    left: 12px;
    bottom: 2px;
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(0, 0, 0, 0.05);
    color: #161616;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s ease, color 0.2s ease, transform 0.1s ease;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.05);
    z-index: 3;
}

.think-pill {
    position: absolute;
    bottom: 2px;
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(0, 0, 0, 0.05);
    color: #161616;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s ease, color 0.2s ease, transform 0.1s ease;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.05);
    z-index: 3;
}

#thinkBtn {
    left: 54px;
}

#improveBtn {
    left: 96px;
}

.think-pill:hover {
    background: #0A0A0A;
    color: #FFFFFF;
    transform: scale(1.05);
}

.think-pill:hover svg {
    opacity: 1;
    stroke: currentColor;
}

.think-pill.active {
    background: #0A0A0A;
    color: #FFFFFF;
    box-shadow: inset 0 0 0 1px #0A0A0A;
}

.think-pill svg {
    opacity: 0.85;
    transition: opacity 0.2s ease, stroke 0.2s ease;
}

.think-pill.active svg {
    opacity: 1;
    stroke: currentColor;
}

.attach-btn svg {
    opacity: 0.85;
    transition: opacity 0.2s ease;
}

.attach-btn:disabled {
    opacity: 0.2;
    cursor: not-allowed;
}

.attach-btn:hover:not(:disabled) {
    background: #0A0A0A;
    color: #FFFFFF;
    transform: scale(1.05);
}

.attach-btn:hover:not(:disabled) svg {
    opacity: 1;
}

.attach-btn:active:not(:disabled),
.think-pill:active {
    transform: scale(0.96);
}

.attach-btn:focus-visible,
.think-pill:focus-visible {
    outline: none;
    box-shadow: inset 0 0 0 1px #0A0A0A, 0 0 0 2px rgba(10, 10, 10, 0.2);
}
.input-inline-notice {
    position: absolute;
    bottom: calc(100% + 10px);
    right: 0;
    background: rgba(255, 255, 255, 0.98);
    color: #1E1E1E;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 12px;
    letter-spacing: 0.02em;
    line-height: 1.5;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.16);
    border: 1px solid rgba(0, 0, 0, 0.05);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
    max-width: 320px;
    text-align: right;
    z-index: 110;
    display: flex;
    align-items: center;
    gap: 10px;
}

.input-inline-notice .notice-text {
    flex: 1;
    text-align: left;
}

.input-inline-notice .notice-action {
    background: rgba(0, 0, 0, 0.06);
    color: #1E1E1E;
    border: none;
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 12px;
    letter-spacing: 0.04em;
    cursor: pointer;
    pointer-events: auto;
    transition: background 0.2s ease, color 0.2s ease;
}

.input-inline-notice .notice-action:hover {
    background: rgba(0, 0, 0, 0.12);
}

.input-inline-notice.show {
    opacity: 1;
    transform: translateY(0);
}

@media (max-width: 1024px) {
    .input-inline-notice {
        right: 12px;
        left: 12px;
        text-align: center;
        bottom: calc(100% + 12px);
        max-width: none;
        justify-content: center;
        gap: 8px;
    }
    
    .input-inline-notice .notice-text {
        text-align: center;
    }
}

/* Microphone button */
.mic-btn {
    position: absolute;
    right: 48px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border: none;
    background: #000;
    color: #FFF;
    border-radius: 50%;
    box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.04); /* Cover textarea background */
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: none; /* Remove transition to prevent movement on disabled */
}

.mic-btn:disabled {
    opacity: 0.2;
    cursor: not-allowed;
    /* Keep original colors, just fade */
}

.mic-btn:hover:not(:disabled) {
    transform: translateY(-50%) scale(1.1);
}

.mic-btn svg {
    width: 20px;
    height: 20px;
}

/* Recording state */
.mic-btn.recording {
    background: #EF4444;
    color: #FFF;
    animation: recordingPulse 1.5s ease-in-out infinite;
}

@keyframes recordingPulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* Position multiple mic buttons */
#micButton {
    right: 48px;
}

#stopDictationButton {
    right: 90px;
}

#submitDictationButton {
    right: 48px;
    background: #000;
}

#submitDictationButton:hover:not(:disabled) {
    transform: translateY(-50%) scale(1.1);
}

/* Send button */
.send {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border: none;
    background: #000;
    color: #FFF;
    border-radius: 50%;
    box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.04); /* Cover textarea background */
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: none; /* Remove transition to prevent movement on disabled */
    padding: 0;
}

.send:disabled {
    opacity: 0.2;
    cursor: not-allowed;
    /* Keep original colors, just fade */
}

.send:hover:not(:disabled) {
    transform: translateY(-50%) scale(1.1);
    transition: transform 0.2s;
}

.send.queue-hold-pending {
    transform: translateY(-50%) scale(1.06);
}

.send.queue-hold-queued {
    background: #222;
    transform: translateY(-50%);
}

.message-queue-indicator {
    position: absolute;
    right: 12px;
    bottom: 72px;
    display: none;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    z-index: 120;
}

.message-queue-indicator.visible {
    display: flex;
}



.message-queue-indicator.flash .queue-toggle {
    animation: queueFlash 0.28s ease;
}

.message-queue-indicator.full .queue-toggle {
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
}

.queue-toggle {
    background: #111;
    color: #FFF;
    border: none;
    border-radius: 999px;
    font-size: 11px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 4px 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    pointer-events: auto;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.queue-toggle:hover {
    background: #000;
}

.queue-toggle:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.18);
}

.queue-icon {
    font-size: 12px;
    opacity: 0.7;
}

.queue-count {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 12px;
}

.message-queue-popover {
    position: absolute;
    bottom: 44px;
    right: 0;
    width: 260px;
    display: none;
}

.message-queue-indicator.open .message-queue-popover {
    display: block;
}

.queue-popover-inner {
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 16px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.14);
    padding: 14px;
    backdrop-filter: blur(8px);
}

.queue-popover-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(0, 0, 0, 0.55);
    margin-bottom: 10px;
}

.queue-popover-counter {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.queue-notice {
    font-size: 11px;
    color: rgba(0, 0, 0, 0.6);
    background: rgba(0, 0, 0, 0.04);
    border-radius: 10px;
    padding: 6px 8px;
    margin-bottom: 10px;
}

.queue-empty {
    font-size: 12px;
    color: rgba(0, 0, 0, 0.5);
    text-align: center;
    padding: 16px 0;
}

.queue-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 220px;
    overflow-y: auto;
}

.queue-item {
    display: grid;
    grid-template-columns: 28px 1fr 20px;
    align-items: start;
    gap: 6px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    font-size: 12px;
}

.queue-item:last-child {
    border-bottom: none;
}

.queue-item-index {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    color: rgba(0, 0, 0, 0.4);
}

.queue-item-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    color: rgba(0, 0, 0, 0.75);
    word-break: break-word;
}

.queue-item-attachments {
    font-size: 11px;
    color: rgba(0, 0, 0, 0.5);
}

.queue-item-text {
    line-height: 1.4;
}

.queue-remove-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    color: rgba(0, 0, 0, 0.45);
    font-size: 16px;
    line-height: 1;
    padding: 0;
    margin-top: -2px;
}

.queue-remove-btn:hover {
    color: rgba(0, 0, 0, 0.75);
}

@keyframes queueFlash {
    from {
        transform: translateY(0) scale(1);
    }
    50% {
        transform: translateY(-2px) scale(1.05);
    }
    to {
        transform: translateY(0) scale(1);
    }
}

@media (max-width: 1024px) {
    .message-queue-indicator {
        right: 16px;
        bottom: 96px;
    }
}

/* Studio Mode button */
button[onclick*="openStudioMode"] {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-weight: 400;
    letter-spacing: 0.02em;
}

/* Side panels - Brian Eno minimal */
.panel {
    position: fixed;
    top: 0;
    width: 380px;
    height: 100vh;
    background: #FFFFFF;
    border-right: 1px solid rgba(0, 0, 0, 0.04);
    transform: translate3d(-100%, 0, 0);
    transition: transform 0.2s cubic-bezier(0.33, 1, 0.68, 1);
    will-change: transform;
    backface-visibility: hidden;
    contain: layout paint;
    z-index: 2000; /* Above chat input (1300) and tool-status (1400) */
    overflow-y: auto;
    box-shadow: none;
}

.panel.connectors {
    width: 480px;
}

.panel.right {
    right: 0;
    left: auto;
    transform: translate3d(100%, 0, 0);
    border-right: none;
    border-left: 1px solid rgba(0, 0, 0, 0.04);
}

.panel.open {
    transform: translate3d(0, 0, 0);
}

.panel-header {
    padding: 14px 12px 8px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: #FFFFFF;
    z-index: 10;
}

.panel-title {
    font-size: 12px;
    font-weight: 400;
    color: rgba(0, 0, 0, 0.7);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.panel-close {
    width: 20px;
    height: 20px;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
    font-size: 16px;
    color: #606060;
}

.panel-close:hover {
    background: #F0F0F0;
}

.panel-content {
    padding: 12px 12px 0;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.sites-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    flex-shrink: 0;
}

.sites-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
}

.sites-title {
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(0, 0, 0, 0.6);
    display: block;
}

.sites-caption {
    margin-top: 6px;
    font-size: 13px;
    color: rgba(0, 0, 0, 0.48);
    line-height: 1.5;
}

.sites-refresh {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: rgba(255, 255, 255, 0.9);
    color: rgba(0, 0, 0, 0.6);
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.sites-refresh:hover {
    background: rgba(0, 0, 0, 0.08);
    color: rgba(0, 0, 0, 0.8);
    border-color: rgba(0, 0, 0, 0.18);
}

.sites-selector {
    display: flex;
    gap: 10px;
    align-items: center;
}

.sites-select-wrap {
    position: relative;
    display: flex;
    flex: 1;
}

.sites-url {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: -2px;
    font-size: 13px;
    color: rgba(0, 0, 0, 0.55);
}

.sites-url a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: inherit;
    text-decoration: none;
    flex: 1;
    min-width: 0;
}

.sites-url a:hover {
    color: rgba(0, 0, 0, 0.8);
    text-decoration: underline;
    text-decoration-color: rgba(0, 0, 0, 0.2);
}

.sites-url-icon {
    filter: grayscale(1);
    font-size: 14px;
}

.sites-select-wrap select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: 100%;
    padding: 10px 42px 10px 14px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 10px;
    background: #FFFFFF;
    font-size: 14px;
    color: rgba(0, 0, 0, 0.75);
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    min-height: 42px;
}

.sites-select-wrap select:focus {
    outline: none;
    border-color: rgba(0, 0, 0, 0.45);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.08);
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.02), rgba(0, 0, 0, 0.02)), #FFFFFF;
}

.sites-select-icon {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 13px;
    color: rgba(0, 0, 0, 0.4);
    pointer-events: none;
    transition: color 0.2s ease, transform 0.2s ease;
}

.sites-select-wrap select:focus + .sites-select-icon {
    color: rgba(0, 0, 0, 0.6);
    transform: translateY(-50%) rotate(180deg);
}

#projectStatus,
#supabaseStatus {
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.05);
    color: rgba(0, 0, 0, 0.45);
    font-weight: 500;
    letter-spacing: 0.02em;
}

.sites-delete {
    width: 44px;
    min-height: 42px;
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    background: rgba(0, 0, 0, 0.02);
    color: rgba(0, 0, 0, 0.45);
    font-size: 18px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sites-delete:hover,
.sites-delete:focus-visible {
    color: rgba(0, 0, 0, 0.85);
    border-color: rgba(0, 0, 0, 0.3);
    background: rgba(0, 0, 0, 0.05);
    outline: none;
}

.sites-create {
    display: none;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.sites-create.visible {
    display: flex;
}

.sites-create label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(0, 0, 0, 0.55);
}

.sites-create-row {
    display: flex;
    gap: 10px;
}

.sites-create-row input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 8px;
    background: #FFFFFF;
    font-size: 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.sites-create-row input:focus {
    outline: none;
    border-color: rgba(0, 0, 0, 0.35);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.08);
}

.sites-create-row button {
    font-family: inherit;
    padding: 10px 18px;
    border-radius: 8px;
    background: #0A0A0A;
    color: #FFFFFF;
    border: none;
    cursor: pointer;
    font-size: 14px;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.sites-create-row button:hover {
    opacity: 0.85;
    transform: translateY(-1px);
}

.sites-create-row button:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.12);
}

.sites-helper {
    background: rgba(0, 0, 0, 0.04);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sites-helper h3 {
    font-size: 14px;
    color: rgba(0, 0, 0, 0.7);
    font-weight: 500;
    margin: 0;
}

.sites-helper ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 0;
    margin: 0;
    font-size: 13px;
    color: rgba(0, 0, 0, 0.55);
    line-height: 1.6;
}

.sites-helper li {
    position: relative;
    padding-left: 14px;
}

.sites-helper li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: rgba(0, 0, 0, 0.35);
}

.panel-subheading {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(0, 0, 0, 0.6);
    margin: 0;
    padding: 12px 0 6px;
    font-weight: 500;
    flex-shrink: 0;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.history-list::-webkit-scrollbar {
    width: 8px;
}

.history-list::-webkit-scrollbar-track {
    background: transparent;
}

.history-list::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 4px;
}

.history-list::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);
}

/* History items - ultra-compact */
.history-item {
    padding: 8px 0;
    margin-bottom: 0;
    background: transparent;
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
    cursor: pointer;
    transition: background 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.history-item:hover {
    background: rgba(0, 0, 0, 0.02);
}

.history-item-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.history-preview {
    font-size: 15px;
    font-weight: 400;
    color: #1A1A1A;
    letter-spacing: 0.01em;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.history-preview-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
    flex: 1;
    min-width: 0;
}

.history-active-indicator {
    font-size: 12px;
    color: rgba(0, 0, 0, 0.65);
}

.history-date {
    font-size: 11px;
    font-weight: 300;
    color: rgba(0, 0, 0, 0.55);
    margin-top: 4px;
    letter-spacing: 0.02em;
}

.history-delete-button {
    background: transparent;
    border: none;
    color: rgba(0, 0, 0, 0.35);
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    transition: color 0.2s ease, background 0.2s ease;
}

.history-delete-button:hover,
.history-delete-button:focus {
    background: rgba(0, 0, 0, 0.04);
    color: rgba(0, 0, 0, 0.7);
    outline: none;
}

.history-delete-button:disabled {
    opacity: 0.45;
    cursor: default;
}

/* Settings sections */
.settings-group {
    margin-bottom: 16px;
}

.settings-section {
    margin-bottom: 16px;
}

.settings-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #808080;
    margin-bottom: 12px;
}

.settings-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: #F7F7F7;
    border-radius: 10px;
    margin-bottom: 8px;
}

.toggle-switch {
    width: 44px;
    height: 24px;
    background: #E0E0E0;
    border-radius: 12px;
    position: relative;
    cursor: pointer;
    transition: background 0.2s;
}

.toggle-switch.active {
    background: #000;
}

.toggle-slider {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: #FFF;
    border-radius: 50%;
    transition: transform 0.2s;
}

.toggle-switch.active .toggle-slider {
    transform: translateX(20px);
}

/* MCP Servers */
.server-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: #F7F7F7;
    border-radius: 12px;
    margin-bottom: 12px;
    transition: background 0.2s;
}

.server-item:hover {
    background: #F0F0F0;
}

.server-name {
    font-size: 14px;
    font-weight: 400;
    color: #1A1A1A;
    margin-bottom: 4px;
}

.server-url {
    font-size: 12px;
    color: #808080;
    margin-top: 4px;
}

.server-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #606060;
}

.status-connected {
    color: #10B981;
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #10B981;
}

.status-dot.offline {
    background: #E0E0E0;
}

/* Workspace buttons */
button[onclick*="openFileManager"],
button[onclick*="openCodeEditor"] {
    width: 100%;
    padding: 14px 20px;
    margin-bottom: 12px;
    background: linear-gradient(135deg, rgba(255,255,255,0.03) 0%, rgba(255,255,255,0.01) 100%);
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: 8px;
    color: #333;
    font-size: 14px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 12px;
    text-align: left;
}

button[onclick*="openFileManager"]:hover,
button[onclick*="openCodeEditor"]:hover {
    background: linear-gradient(135deg, rgba(255,255,255,0.06) 0%, rgba(255,255,255,0.03) 100%);
    transform: translateY(-1px);
}

/* File preview - appears above input */
.file-preview-container {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 12px;
    padding: 0 4px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.file-preview {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #F7F7F7;
    border-radius: 16px;
    margin-right: 8px;
    margin-bottom: 8px;
    font-size: 13px;
    color: #606060;
}

.file-preview-remove {
    cursor: pointer;
    color: #999;
    transition: color 0.2s;
}

.file-preview-remove:hover {
    color: #000;
}

/* Typing indicator */
.typing {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: #FFFFFF;
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 10px 10px 10px 4px;
    color: #4F4F4F;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.04);
    font-size: 11px;
    font-weight: 400;
}

.dots-container {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.thinking-text {
    color: rgba(10, 10, 10, 0.6);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-size: 12px;
}

.dot {
    width: 6px;
    height: 6px;
    background: #0A0A0A;
    border-radius: 50%;
    animation: dotWave 1.2s ease-in-out infinite;
    opacity: 0.25;
    transform-origin: center bottom;
}

.dot:nth-child(2) { animation-delay: 0.15s; }
.dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes dotWave {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.25; }
    30% { transform: translateY(-4px); opacity: 1; }
}

/* Overlay for panels */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(2px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease-out;
    z-index: 1900; /* just beneath panels, above input */
}

.overlay.show {
    opacity: 1;
    pointer-events: all;
}

/* Extended thinking state */
.thinking-indicator {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 0;
    background: transparent;
    font-size: 12px;
    color: rgba(10, 10, 10, 0.6);
    margin: 6px 0;
    font-weight: 400;
}

.thinking-indicator svg {
    animation: spin 2s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translateX(-50%) translateY(-10px); }
    20% { opacity: 1; transform: translateX(-50%) translateY(0); }
    80% { opacity: 1; transform: translateX(-50%) translateY(0); }
    100% { opacity: 0; transform: translateX(-50%) translateY(-10px); }
}

/* Tool animations */
@keyframes toolPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Instructions textarea */
#workspaceInstructions {
    width: 100%;
    min-height: 400px;
    height: 400px;
    padding: 12px;
    border: 1px solid #E0E0E0;
    border-radius: 8px;
    font-size: 13px;
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
    resize: vertical;
    line-height: 1.5;
}

/* Pinger settings */
.settings-input,
#pingerMessage {
    width: 100%;
    padding: 12px;
    border: 1px solid #E0E0E0;
    border-radius: 8px;
    font-size: 12px;
    font-family: 'SF Mono', Monaco, monospace;
    line-height: 1.5;
    background: #FAFAFA;
}

#pingerMessage {
    height: 368px;
    resize: vertical;
}

/* Clean inputs */
input[type="text"],
input[type="password"],
input[type="number"],
select {
    padding: 8px 12px;
    border: 1px solid #E0E0E0;
    border-radius: 8px;
    font-size: 14px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    background: white;
    outline: none;
    transition: all 0.2s;
}

input:focus,
select:focus {
    border-color: #000;
}

/* Checkbox styling - black to match site design */
input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: 16px;
    height: 16px;
    border: 1.5px solid rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    background: white;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
}

input[type="checkbox"]:hover {
    border-color: rgba(0, 0, 0, 0.5);
}

input[type="checkbox"]:checked {
    background: #000;
    border-color: #000;
}

input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 1px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Buttons */
button {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-weight: 400;
    transition: all 0.2s;
}

/* Message rendering improvements */
.message pre {
    background: #F7F7F7;
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 8px 0;
}

.message code {
    background: #F0F0F0;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 0.9em;
}

.message pre code {
    background: none;
    padding: 0;
}

/* Tool calls - Brian Eno minimal aesthetic */
.tool-call {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    margin: 4px 0;
    background: rgba(0, 0, 0, 0.02);
    border-left: 2px solid rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    font-size: 12px;
    color: rgba(0, 0, 0, 0.6);
    transition: all 0.3s ease;
    cursor: pointer;
    animation: subtle-breathe 20s ease-in-out infinite;
}

.tool-call:hover {
    background: rgba(0, 0, 0, 0.04);
    border-left-color: rgba(0, 0, 0, 0.3);
}

.tool-icon {
    font-size: 14px;
    opacity: 0.7;
}

.tool-desc {
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 11px;
    opacity: 0.8;
}

.tool-expand {
    margin-left: auto;
    opacity: 0.4;
    transition: transform 0.3s ease;
}

.tool-call.expanded .tool-expand {
    transform: rotate(90deg);
}

.tool-details {
    display: none;
    margin-top: 8px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.01);
    border-radius: 4px;
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 10px;
    color: rgba(0, 0, 0, 0.5);
    width: 100%;
    overflow-x: auto;
}

.tool-call.expanded .tool-details {
    display: block;
    animation: gentle-flow 0.4s ease-out;
}

/* Tool results */
.tool-result {
    margin: 12px 0;
    padding: 12px;
    background: #F7F7F7;
    border-left: 3px solid #808080;
    border-radius: 4px;
    font-size: 13px;
    font-family: 'SF Mono', Monaco, monospace;
}

.tool-result.success {
    border-color: #10B981;
}

.tool-result.error {
    border-color: #EF4444;
    background: #FEF2F2;
}

/* Minimal tool results - Brian Eno aesthetic */
.tool-result-minimal {
    display: inline-block;
    padding: 2px 8px;
    margin: 2px 0;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 4px;
    font-size: 11px;
    color: rgba(0, 0, 0, 0.5);
    font-family: 'SF Mono', Monaco, monospace;
}

.tool-result-minimal.success {
    color: #10B981;
}

.tool-result-minimal.error {
    color: #EF4444;
    background: rgba(239, 68, 68, 0.05);
}

/* Collapsible tool outputs - native <details> styling */
.bubble details {
    margin: 4px 0;
    border-left: 2px solid rgba(0, 0, 0, 0.05);
    padding-left: 6px;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.bubble details:hover {
    border-left-color: rgba(0, 0, 0, 0.12);
}

.bubble details[open] {
    border-left-color: rgba(0, 0, 0, 0.18);
}

.bubble summary {
    cursor: pointer;
    user-select: none;
    list-style: none; /* Remove default triangle */
    padding: 5px 8px;
    margin: 0 0 0 -6px;
    font-size: 11px;
    color: rgba(0, 0, 0, 0.74);
    font-family: 'SF Mono', Monaco, monospace;
    font-weight: 500;
    transition: color 0.2s ease, background 0.2s ease, border 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 5px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.018);
}

.bubble summary::-webkit-details-marker {
    display: none; /* Remove default triangle on webkit */
}

.bubble summary:hover {
    color: rgba(0, 0, 0, 0.85);
    border-color: rgba(0, 0, 0, 0.08);
    background: rgba(0, 0, 0, 0.035);
}

.bubble details[open] summary {
    border-bottom-width: 0;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

/* Style the expanded content */
.bubble details .details-content {
    margin: -40px 0 0 0;
    padding: 8px 12px;
    background: #f7f7f7;
    border-radius: 8px;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 12.5px;
    line-height: 1.45;
    color: rgba(30, 30, 30, 0.78);
    overflow-x: auto;
    animation: gentle-flow 0.3s ease-out;
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-top-width: 0;
}

.bubble details pre {
    margin: 0;
    padding: 0;
    background: transparent;
    font-family: inherit;
    font-size: inherit;
    white-space: pre-wrap;
    word-wrap: break-word;
    line-height: 1.45;
}

.bubble details code {
    background: transparent;
    padding: 0;
    font-family: inherit;
}

.details-content .tool-arg-key {
    font-weight: 600;
    color: rgba(0, 0, 0, 0.68);
    letter-spacing: 0.01em;
}

.details-content .tool-arg-sep {
    display: inline-block;
    margin: 0 6px 0 4px;
    color: rgba(0, 0, 0, 0.36);
    font-weight: 500;
}

.details-content .tool-arg-value {
    color: rgba(0, 0, 0, 0.74);
}

.details-content .tool-arg-path {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.06);
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 12px;
    color: rgba(0, 0, 0, 0.82);
}

.details-content .tool-arg-output {
    display: inline-block;
    margin-top: 2px;
    padding: 2px 8px;
    border-radius: 6px;
    background: rgba(16, 185, 129, 0.08);
    color: rgba(18, 78, 60, 0.95);
    font-family: 'SF Mono', Monaco, monospace;
}

.details-content .tool-arg-divider {
    display: none;
}

.tool-summary-left {
    display: flex;
    align-items: center;
    gap: 6px;
}

.tool-summary-icon {
    font-size: 14px;
    color: rgba(0, 0, 0, 0.55);
    line-height: 1;
}

.tool-summary-text {
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 12.3px;
    color: rgba(0, 0, 0, 0.75);
    letter-spacing: 0.015em;
}

.tool-line {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    margin: 6px 0;
    border: 1px solid rgba(0, 0, 0, 0.06);
    background: #f9f9f9;
    border-radius: 12px;
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
    font-size: 12.3px;
    color: rgba(0, 0, 0, 0.72);
}

.tool-line .tool-summary-icon {
    color: rgba(0, 0, 0, 0.5);
}

.bubble details.tool-block {
    border-left-color: rgba(0, 0, 0, 0.08);
}

.bubble details.tool-block summary {
    padding: 8px 12px;
}

.bubble details.tool-block summary::before {
    content: '';
    display: none;
}

.bubble details.tool-block summary::after {
    content: 'EXPAND';
    font-size: 9px;
    color: rgba(0, 0, 0, 0.4);
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.bubble details.tool-block[open] summary::after {
    content: 'COLLAPSE';
}

/* Diff syntax highlighting - green for additions, red for deletions */
.bubble pre code.language-diff {
    display: block;
    padding: 0;
    background: transparent;
}

.bubble pre code.language-diff .token.deleted {
    background-color: rgba(255, 0, 0, 0.08);
    color: #d32f2f;
    display: block;
    margin: 0 -12px;
    padding: 0 12px;
}

.bubble pre code.language-diff .token.inserted {
    background-color: rgba(0, 200, 83, 0.1);
    color: #1b5e20;
    display: block;
    margin: 0 -12px;
    padding: 0 12px;
}

.bubble pre code.language-diff .token.coord,
.bubble pre code.language-diff .token.diff {
    color: rgba(0, 0, 0, 0.5);
    font-style: italic;
}

.bubble pre code.language-diff .token.prefix.deleted {
    color: #d32f2f;
    font-weight: 600;
}

.bubble pre code.language-diff .token.prefix.inserted {
    color: #1b5e20;
    font-weight: 600;
}

/* Brian Eno Asymmetric Layout - Responsive Breakpoints */

/* Extra-large screens: Centered (removed asymmetric effect) */
@media (min-width: 1920px) {
    .messages-inner,
    .input-wrapper {
        margin-left: auto;
        margin-right: auto;
        max-width: 960px;
    }
}

/* Large screens: Stay centered */
@media (min-width: 1024px) and (max-width: 1919px) {
    .messages-inner,
    .input-wrapper {
        margin-left: auto;
        margin-right: auto;
        max-width: 960px;
    }
}

@media (max-width: 1024px) {
    .main {
        padding: 0 8px 8px;
    }
    .workspace {
        gap: 8px;
        padding-top: 8px;
        flex-direction: column;
        position: relative;
    }
    .messages {
        padding-bottom: 120px;
    }
    .preview-panel {
        display: none;
        min-height: 0;
        padding-bottom: 0;
    }
    .preview-header {
        padding: 12px calc(16px + env(safe-area-inset-right)) 6px calc(16px + env(safe-area-inset-left));
    }
    .preview-title {
        font-size: 11px;
        letter-spacing: 0.14em;
    }
    .preview-frame-container,
    .preview-status {
        display: none;
    }
    .preview-actions-desktop {
        display: none;
    }
    .preview-actions-mobile {
        display: inline-flex;
        gap: 16px;
    }
    .preview-actions-mobile button {
        font-size: 22px;
        padding: 10px 16px;
        min-width: 44px;
        height: 44px;
        line-height: 1;
        border-radius: 12px;
        background: rgba(0,0,0,0.03);
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }
    .preview-actions-mobile button:active { transform: scale(0.98); }
    .preview-actions button:hover { transform: none; }
    /* Mobile: no toggle button shown in header */
    .preview-actions-mobile .preview-toggle { display: none; }
    .workspace.preview-mobile-visible .messages {
        display: none;
    }
    .workspace.preview-mobile-visible::after {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(14, 23, 44, 0.22);
        backdrop-filter: blur(10px);
        z-index: 1100;
        pointer-events: none;
    }
    .workspace.preview-mobile-visible .preview-panel {
        position: fixed;
        left: 0;
        right: 0;
        top: env(safe-area-inset-top);
        bottom: env(safe-area-inset-bottom);
        min-height: 0;
        padding: 0;
        display: flex;
        flex-direction: column;
        z-index: 1200;
        overflow: visible; /* let the page handle native pull-to-refresh */
        border-radius: 0;
        border: none;
        box-shadow: none;
    }
    .workspace.preview-mobile-visible .preview-panel .preview-header {
        padding: 16px 20px 12px;
        position: relative;
        z-index: 10; /* ensure header actions are above any overlay */
        background: #fff;
    }
    .workspace.preview-mobile-visible .preview-panel .preview-frame-container,
    .workspace.preview-mobile-visible .preview-panel .preview-status {
        display: block;
    }
    .workspace.preview-mobile-visible .preview-panel .preview-frame-container {
        flex: 1;
        border-radius: 0;
        padding-top: 0;
        margin-top: 0;
    }
    .workspace.preview-mobile-visible .preview-panel .preview-status {
        padding: 12px 20px 16px;
    }
    body.preview-mobile-open {
        overflow-y: auto; /* allow native pull-to-refresh */
        -webkit-overflow-scrolling: touch;
    }
    /* Hide mobile quick menu while preview overlay is open */
    body.preview-mobile-open #mobileMenuPopup {
        display: none !important;
    }

    /* Removed mobile header toggle entirely */
}

/* Medium screens: Centered */
@media (min-width: 1025px) and (max-width: 1199px) {
    .main {
        max-width: 100%;
    }

    .messages-inner,
    .input-wrapper {
        margin-left: auto;
        margin-right: auto;
        max-width: 720px;
    }
}

/* Small screens: Centered, full width */
@media (max-width: 1024px) {
    .main {
        max-width: 100%;
        padding: 20px 12px 0;
    }
    
    .messages-inner {
        max-width: 100%;
        padding: 0 8px;
    }
    
    .input-wrapper {
        max-width: 100%;
        padding: 0 8px;
    }
}

@media (max-width: 1024px) {
    .input-container {
        position: sticky;
        bottom: 0;
        padding: 12px 16px;
        padding-bottom: calc(16px + env(safe-area-inset-bottom));
        backdrop-filter: blur(12px);
    }

    .input-wrapper {
        padding: 0;
        gap: 10px;
    }

    .mobile-preview-toggle {
        display: flex;
        position: relative;
        width: 100%;
        align-items: center;
        gap: 0;
        border-radius: 12px;
        padding: 3px;
        margin: 14px auto 16px;
        background: rgba(0, 0, 0, 0.02);
        border: 1px solid rgba(0, 0, 0, 0.08);
        overflow: hidden;
        transition: border-color 0.2s ease;
        font-family: 'Space Grotesk', sans-serif;
    }

    .mobile-preview-toggle:focus-within {
        border-color: rgba(0, 0, 0, 0.12);
    }

    .mobile-preview-toggle[data-view="preview"] {
        border-color: rgba(0, 0, 0, 0.12);
    }

    #mobilePreviewIndicator {
        position: absolute;
        left: 3px;
        top: 3px;
        width: calc(50% - 3px);
        height: calc(100% - 6px);
        border-radius: 10px;
        background: #000;
        transition: transform 0.25s ease, left 0.25s ease;
        transform: translateX(0);
        z-index: 0;
        pointer-events: none;
    }

    .mobile-preview-toggle[data-view="preview"] #mobilePreviewIndicator {
        left: calc(50% + 3px);
    }

    .mobile-preview-option {
        flex: 1;
        position: relative;
        z-index: 1;
        border: none;
        background: transparent;
        padding: 10px 12px;
        border-radius: 10px;
        font-size: 14px;
        font-weight: 400;
        letter-spacing: -0.01em;
        color: rgba(0, 0, 0, 0.45);
        cursor: pointer;
        transition: color 0.2s ease;
    }

    .mobile-preview-option:focus-visible {
        outline: none;
        color: #000;
    }

    .mobile-preview-toggle[data-view="chat"] .mobile-preview-option[data-view="chat"],
    .mobile-preview-toggle[data-view="preview"] .mobile-preview-option[data-view="preview"] {
        color: #FFF;
    }

    .mobile-preview-option.active {
        color: #FFF;
    }

    .mobile-preview-toggle .mobile-preview-option:active {
        transform: translateY(0.5px);
    }
}

/* Mobile hamburger menu button - Icon logo */
.mobile-menu-btn {
    position: absolute;
    left: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    color: #000;
    cursor: pointer;
    display: none; /* Hidden by default, shown on mobile */
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s;
    z-index: 10;
    padding: 0;
}

.mobile-menu-btn:hover {
    transform: translateY(-50%) scale(1.05);
}

.mobile-menu-btn svg {
    opacity: 1;
    width: 100%;
    height: 100%;
}

/* Mobile menu popup */
.mobile-menu-popup {
    position: absolute;
    left: 12px;
    bottom: 56px;
    display: none; /* Hidden by default */
    flex-direction: column;
    gap: 6px;
    padding: 10px;
    background: #FFF;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 150; /* Higher than input-inline-notice (110) */
}

.mobile-menu-popup.show {
    display: flex;
    animation: slideUp 0.2s ease-out;
}

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

/* Mobile menu items */
.mobile-menu-item {
    min-width: 110px;
    height: 36px;
    padding: 0 12px;
    border: none;
    background: rgba(0, 0, 0, 0.05);
    color: #000;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    border-radius: 10px;
    transition: all 0.2s;
}

.mobile-menu-item:hover {
    background: rgba(0, 0, 0, 0.1);
}

.mobile-menu-item svg {
    opacity: 1;
    flex-shrink: 0;
    width: 16px;
    height: 16px;
}

.mobile-menu-item .control-icon {
    font-size: 18px;
    opacity: 1;
    flex-shrink: 0;
}


.mobile-menu-text {
    font-size: 13px;
    font-weight: 400;
    white-space: nowrap;
}

.mobile-menu-item.active {
    background: #000;
    color: #FFF;
}

.mobile-menu-item.active svg {
    stroke: #FFF;
}

/* Mobile-specific styles */
@media (max-width: 1024px) {
    /* Show hamburger menu button on mobile */
    .mobile-menu-btn {
        display: flex;
    }

    /* Hide desktop-only chips */
    .attach-btn,
    .think-pill {
        display: none;
    }

    /* Reduce left padding when buttons are hidden */
    textarea.input,
    input.input {
        padding-left: 72px;
        padding-right: 72px;
        font-size: 16px;
        min-height: 60px;
    }

    /* Hide desktop control buttons on mobile */
    .controls {
        display: none !important;
    }

    /* Hide input controls on mobile - use mobile menu instead */
    .input-controls {
        display: none !important;
    }
}

/* Welcome Modal */
.welcome-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    animation: fadeIn 0.3s ease;
}

.welcome-overlay.show {
    display: flex;
}

.welcome-modal {
    background: #FFF;
    border-radius: 20px;
    padding: 48px 40px;
    max-width: 480px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideInUp 0.4s ease;
    font-family: 'Space Grotesk', sans-serif;
}

.welcome-header {
    text-align: center;
    margin-bottom: 32px;
}

.welcome-title {
    font-size: 28px;
    font-weight: 500;
    color: #000;
    margin-bottom: 12px;
    letter-spacing: -0.02em;
}

.welcome-subtitle {
    font-size: 15px;
    color: rgba(0, 0, 0, 0.68);
    line-height: 1.6;
    font-weight: 400;
}

.welcome-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.welcome-input-wrapper {
    position: relative;
}

.welcome-input {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 12px;
    font-size: 15px;
    font-family: 'Space Grotesk', sans-serif;
    transition: all 0.2s;
    background: #FFF;
}

.welcome-input::placeholder {
    color: rgba(0, 0, 0, 0.35);
}

.welcome-input:focus {
    outline: none;
    border-color: #000;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

.welcome-input.error {
    border-color: #B91C1C;
}

.welcome-error {
    display: none;
    font-size: 13px;
    color: #B91C1C;
    margin-top: 8px;
}

.welcome-error.show {
    display: block;
}

.welcome-submit {
    padding: 10px 20px;
    background: #000;
    color: #FFF;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Space Grotesk', sans-serif;
    margin-top: 8px;
}

.welcome-submit:hover {
    background: #111;
    transform: translateY(-1px);
}

.welcome-submit:active {
    transform: translateY(0);
}

.welcome-submit:disabled {
    background: rgba(0, 0, 0, 0.1);
    color: rgba(0, 0, 0, 0.3);
    cursor: not-allowed;
    transform: none;
}

/* Confirmation Modal */
.confirmation-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease;
}

.confirmation-overlay.show {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.confirmation-modal {
    background: #FFF;
    border-radius: 16px;
    padding: 32px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    animation: slideInUp 0.3s ease;
    font-family: 'Space Grotesk', sans-serif;
}

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

.confirmation-content {
    margin-bottom: 24px;
}

.confirmation-title {
    font-size: 18px;
    font-weight: 500;
    color: #000;
    margin-bottom: 8px;
    letter-spacing: -0.01em;
}

.confirmation-message {
    font-size: 14px;
    color: rgba(0, 0, 0, 0.6);
    line-height: 1.5;
}

.confirmation-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.confirmation-btn {
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid #E0E0E0;
    background: transparent;
    color: #606060;
    font-family: 'Space Grotesk', sans-serif;
}

.confirmation-btn:hover {
    background: rgba(0, 0, 0, 0.04);
    border-color: #C0C0C0;
}

.confirmation-btn-primary {
    background: #000;
    color: #FFF;
    border-color: #000;
}

.confirmation-btn-primary:hover {
    background: #111;
    border-color: #111;
}

.confirmation-btn-danger {
    background: #B91C1C;
    color: #FFF;
    border-color: #B91C1C;
}

.confirmation-btn-danger:hover {
    background: #991B1B;
    border-color: #991B1B;
}
