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

html,
body,
#root {
    width: 100%;
    height: 100%;
    background: var(--bg, #0c0c0c);
    overflow: hidden
}

body.theme-dark {
    --bg: #0c0c0c;
    --bgc: #111111;
    --border: #1e1e1e;
    --selection-bg: #00ff4133;
    --selection-color: #00ff41;
    --scrollbar-thumb: #00ff4128;
    --scrollbar-thumb-hover: #00ff4155;
    --scan-color: rgba(57, 255, 20, .035);
    --sug-hover: #00ff4110;
    --input-placeholder: #444;
    --logo-color: #4dff32;
    --logo-glow: #4dff3266;
    --vignette-color: rgba(0, 0, 0, .72);
    
    /* Palette Tokens */
    --green: #4dff32;
    --dg: #1aff55;
    --xdg: #00cc33;
    --yellow: #ffee66;
    --cyan: #33f5ff;
    --white: #f0f0f0;
    --dim: #666666;
    --mid: #888888;
    --red: #ff6666;
}

body.theme-light {
    --bg: #f5f5f0;
    --bgc: #ebebeb;
    --border: #cccccc;
    --selection-bg: #1a7a0033;
    --selection-color: #1a7a00;
    --scrollbar-thumb: #1a7a0028;
    --scrollbar-thumb-hover: #1a7a0055;
    --scan-color: rgba(26, 122, 0, .025);
    --sug-hover: #1a7a0010;
    --input-placeholder: #999;
    --logo-color: #1a7a00;
    --logo-glow: #1a7a0044;
    --vignette-color: rgba(200, 200, 195, .45);

    /* Palette Tokens */
    --green: #1a7a00;
    --dg: #1d8f00;
    --xdg: #166600;
    --yellow: #8a6800;
    --cyan: #006b8a;
    --white: #1a1a1a;
    --dim: #888888;
    --mid: #555555;
    --red: #cc2200;
}

/* ── RESPONSIVE SCALE ──────────────────────────────────────────── */
:root {
    --fs-base: 13px;
    --fs-sm:   11px;
    --fs-xs:   10px;
    --fs-code: 12px;
    --fs-h1:   15px;
    --fs-logo: 12.5px;
    --pad-x:   26px;
    --pad-out: 16px 26px 8px;
    --pad-in:  10px 26px 14px;
    --ls-min:  140px;
}

@media (max-width: 640px) {
    :root {
        --fs-base: 11px;
        --fs-sm:   10px;
        --fs-xs:   9px;
        --fs-code: 10px;
        --fs-h1:   13px;
        --fs-logo: 7px;
        --pad-x:   12px;
        --pad-out: 10px 12px 6px;
        --pad-in:  8px 12px 10px;
        --ls-min:  100px;
    }
}

@media (min-width: 641px) and (max-width: 900px) {
    :root {
        --fs-base: 12px;
        --fs-sm:   10px;
        --fs-xs:   9px;
        --fs-code: 11px;
        --fs-h1:   14px;
        --fs-logo: 9.5px;
        --pad-x:   16px;
        --pad-out: 12px 16px 6px;
        --pad-in:  8px 16px 12px;
        --ls-min:  120px;
    }
}

@keyframes blink {

    0%,
    100% {
        opacity: 1
    }

    50% {
        opacity: 0
    }
}

@keyframes scanmove {
    0% {
        top: -5%
    }

    100% {
        top: 108%
    }
}

@keyframes fadein {
    from {
        opacity: 0;
        transform: translateY(4px)
    }

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

@keyframes slidein {
    from {
        opacity: 0;
        transform: translateX(-6px)
    }

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

@keyframes shimmer {
    0% {
        background-position: -600px 0
    }

    100% {
        background-position: 600px 0
    }
}

@keyframes pulsedot {

    0%,
    100% {
        opacity: .25;
        transform: scale(.85)
    }

    50% {
        opacity: 1;
        transform: scale(1.1)
    }
}

::selection {
    background: var(--selection-bg, #00ff4133);
    color: var(--selection-color, #00ff41)
}

::-webkit-scrollbar {
    width: 4px
}

::-webkit-scrollbar-track {
    background: transparent
}

::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb, #00ff4128);
    border-radius: 2px
}

::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover, #00ff4155)
}

.crt-v {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9000;
    background: radial-gradient(ellipse at center, transparent 55%, var(--vignette-color, rgba(0, 0, 0, .72)) 100%)
}

.crt-l {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9001;
    background: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0, 0, 0, .05) 2px, rgba(0, 0, 0, .05) 4px)
}

.crt-s {
    position: fixed;
    left: 0;
    right: 0;
    height: 100px;
    background: linear-gradient(transparent, var(--scan-color, rgba(57, 255, 20, .035)), transparent);
    animation: scanmove 13s linear infinite;
    pointer-events: none;
    z-index: 9002
}

.sug-row:hover {
    background: var(--sug-hover, #00ff4110) !important
}

.input-wrap {
    transition: border-color .2s, box-shadow .2s, background .2s
}

/* ── TERMINAL LAYOUT ───────────────────────────────────────────── */
#term-output {
    padding: var(--pad-out) !important;
}

#input-wrap {
    padding: var(--pad-in) !important;
}

#term-sugs {
    left: var(--pad-x) !important;
    right: var(--pad-x) !important;
}

/* ── FONT SIZES (override inline styles via CSS variables) ─────── */
.t-base, #term-output *, #term-input, #term-mirror,
#prompt-span, #term-sugs * {
    font-size: var(--fs-base) !important;
}

#term-input::placeholder {
    color: var(--input-placeholder, #444);
    font-style: italic;
    font-size: var(--fs-sm, 11px);
    letter-spacing: .04em;
}

/* Exceptions — smaller UI elements keep their own scale */
#term-title,
#term-output .t-sm {
    font-size: var(--fs-sm) !important;
}

/* ── ASCII LOGO ────────────────────────────────────────────────── */
.ascii-logo-line {
    font-family: 'JetBrains Mono', monospace;
    font-size: var(--fs-logo) !important;
    color: var(--logo-color, #4dff32);
    white-space: pre;
    line-height: 1.45;
    text-shadow: 0 0 14px var(--logo-glow, #4dff3266);
}

/* ── LS GRID ───────────────────────────────────────────────────── */
.ls-entry {
    min-width: var(--ls-min) !important;
}

/* ── BOOT SCREEN ───────────────────────────────────────────────── */
#boot-text-list,
#boot-prog-container {
    width: min(700px, 94vw) !important;
    font-size: var(--fs-base) !important;
}

/* ── EDITOR OVERLAY ────────────────────────────────────────────── */
#editor-overlay textarea,
#editor-overlay .line-nums {
    font-size: var(--fs-base) !important;
}

#editor-overlay .editor-titlebar span,
#editor-overlay .editor-statusbar span {
    font-size: var(--fs-sm) !important;
}

/* ── MOBILE: hide line numbers in editor to save space ─────────── */
@media (max-width: 640px) {
    #editor-overlay .line-nums {
        display: none !important;
    }
    /* Shrink editor title hint text */
    #editor-overlay .editor-titlebar span:last-child {
        display: none;
    }
    /* Prevent horizontal scroll on out lines */
    #term-output div[style*="white-space:pre"] {
        white-space: pre-wrap !important;
        word-break: break-all;
    }
}

/* ── MOBILE: compact prompt ────────────────────────────────────── */
@media (max-width: 480px) {
    /* hide @portfolio part of prompt to save space */
    #prompt-host-wrap {
        display: none !important;
    }
}

/* ── PREVENT BODY SCROLL WHEN EDITOR IS OPEN ───────────────────── */
body.editor-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
}

/* ══ OS DESKTOP ══════════════════════════════════════════════════ */
#desktop {
    position: absolute;
    inset: 0;
    overflow: hidden;
    background:
      radial-gradient(ellipse at 20% 10%, rgba(77,255,50,.06), transparent 55%),
      radial-gradient(ellipse at 85% 80%, rgba(51,245,255,.04), transparent 60%),
      var(--bg, #0c0c0c);
    font-family: 'JetBrains Mono', monospace;
    user-select: none;
}

body.theme-light #desktop {
    background:
      radial-gradient(ellipse at 20% 10%, rgba(26,122,0,.10), transparent 55%),
      radial-gradient(ellipse at 85% 80%, rgba(0,107,138,.08), transparent 60%),
      var(--bg, #f5f5f0);
}

#desktop-icons {
    position: absolute;
    top: 24px; left: 24px;
    width: 0; height: 0;
    pointer-events: none;
    z-index: 5;
}

.desk-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 10px 4px 6px;
    border-radius: 6px;
    cursor: pointer;
    pointer-events: auto;
    text-align: center;
    transition: background .12s, transform .12s;
    width: 100px; /* Fixed width */
    height: 104px; /* Fixed height */
}
.desk-icon:hover { background: rgba(77,255,50,.06); }
body.theme-light .desk-icon:hover { background: rgba(26,122,0,.08); }
.desk-icon.selected {
    background: rgba(77,255,50,.12);
    outline: 1px dashed var(--logo-color, #4dff32);
    outline-offset: -3px;
}
body.theme-light .desk-icon.selected {
    background: rgba(26,122,0,.14);
    outline-color: var(--logo-color, #1a7a00);
}

.desk-icon-glyph {
    width: 52px; height: 52px;
    display: flex; align-items: center; justify-content: center;
    color: var(--logo-color, #4dff32);
    filter: drop-shadow(0 0 8px var(--logo-glow, #4dff3266));
    border: 1px solid rgba(77,255,50,.15);
    border-radius: 12px;
    background: rgba(17,17,17,.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    margin-bottom: 8px;
    transition: transform .15s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow .15s, border-color .15s;
}
.desk-icon-glyph svg {
    width: 24px; height: 24px;
    stroke-width: 1.8px;
}
.desk-icon:hover .desk-icon-glyph {
    transform: translateY(-2px);
    border-color: rgba(77,255,50,.4);
    box-shadow: 0 5px 15px rgba(0,0,0,.3);
}
.desk-icon.dragging {
    opacity: 0.8;
    z-index: 1000;
}
.desk-icon.dragging .desk-icon-glyph {
    transform: scale(1.05);
}
body.theme-light .desk-icon-glyph {
    color: var(--logo-color, #1a7a00);
    border-color: rgba(26,122,0,.22);
    background: rgba(255,255,255,.55);
}

.desk-icon-label {
    font-size: 11px;
    color: #e8e8e8;
    line-height: 1.2;
    max-width: 90px;
    word-break: break-word;
    padding: 1px 4px;
    border-radius: 2px;
    height: 2.4em; /* Reserve space for 2 lines */
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
body.theme-light .desk-icon-label { color: #1a1a1a; }
.desk-icon.selected .desk-icon-label {
    background: var(--logo-color, #4dff32);
    color: #0c0c0c;
}
body.theme-light .desk-icon.selected .desk-icon-label {
    background: var(--logo-color, #1a7a00);
    color: #f5f5f0;
}

/* ── WINDOWS ───────────────────────────────────────────────────── */
.os-window {
    position: absolute;
    min-width: 320px; min-height: 200px;
    background: var(--bg, #0c0c0c);
    border: 1px solid rgba(77,255,50,.28);
    border-radius: 6px;
    box-shadow: 0 18px 60px rgba(0,0,0,.6), 0 0 24px rgba(77,255,50,.05);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: winopen .16s ease;
}
body.theme-light .os-window {
    border-color: rgba(26,122,0,.30);
    box-shadow: 0 18px 60px rgba(0,0,0,.18), 0 0 24px rgba(26,122,0,.06);
}
.os-window.maximized {
    top: 0 !important; left: 0 !important;
    width: 100% !important; height: calc(100% - 44px) !important;
    border-radius: 0;
}
.os-window.minimized { display: none; }
.os-window-resizer {
    position: absolute;
    bottom: 0; right: 0;
    width: 12px; height: 12px;
    cursor: nwse-resize;
    z-index: 100;
}

@keyframes winopen {
    from { opacity: 0; transform: scale(.96); }
    to   { opacity: 1; transform: scale(1); }
}

.os-titlebar {
    display: flex; align-items: center; gap: 8px;
    padding: 7px 10px;
    background: #111;
    border-bottom: 1px solid rgba(77,255,50,.18);
    cursor: grab;
    flex-shrink: 0;
    user-select: none;
}
body.theme-light .os-titlebar {
    background: #ebebeb;
    border-bottom-color: rgba(26,122,0,.2);
}
.os-titlebar.dragging { cursor: grabbing; }

.os-tl-dots { display: flex; gap: 6px; }
.os-tl-dot {
    width: 11px; height: 11px; border-radius: 50%;
    cursor: pointer;
    transition: filter .12s;
}
.os-tl-dot:hover { filter: brightness(1.35); }
.os-tl-close  { background: #ff5f57; }
.os-tl-min    { background: #ffbd2e; }
.os-tl-max    { background: #28ca41; }
.os-tl-full   { 
    background: var(--logo-color, #4dff32); 
    display: flex; align-items: center; justify-content: center;
    position: relative;
}
.os-tl-full::after {
    content: ''; width: 5px; height: 5px; border: 1px solid #000; border-radius: 1px;
}

.os-title {
    flex: 1;
    text-align: center;
    font-size: 11px;
    color: var(--logo-color, #4dff32);
    letter-spacing: .06em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
body.theme-light .os-title { color: var(--logo-color, #1a7a00); }

.os-window-body {
    flex: 1;
    overflow: auto;
    position: relative;
    background: var(--bg, #0c0c0c);
}

/* File / folder browser (inside a window) */
.folder-view {
    padding: 16px 18px;
}
.folder-path {
    font-size: 11px;
    color: #888;
    margin-bottom: 12px;
    letter-spacing: .05em;
}
.folder-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 4px;
}
.folder-item {
    display: flex; flex-direction: column; align-items: center;
    padding: 10px 4px; border-radius: 5px; cursor: pointer;
    text-align: center;
    transition: background .12s;
    width: 100px; /* Fixed width */
    height: 100px; /* Fixed height */
    justify-content: flex-start;
}
.folder-item:hover { background: rgba(77,255,50,.06); }
body.theme-light .folder-item:hover { background: rgba(26,122,0,.08); }
.folder-item-glyph {
    font-size: 28px;
    color: var(--logo-color, #4dff32);
    margin-bottom: 4px;
    text-shadow: 0 0 10px var(--logo-glow, #4dff3266);
}
body.theme-light .folder-item-glyph { color: var(--logo-color, #1a7a00); }
.folder-item-label {
    font-size: 11px;
    color: #e8e8e8;
    word-break: break-word;
    line-height: 1.3;
    max-width: 90px;
    height: 2.6em;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
body.theme-light .folder-item-label { color: #1a1a1a; }

/* Markdown reader window */
.md-viewer {
    padding: 22px 28px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    line-height: 1.7;
    color: #e8e8e8;
}
body.theme-light .md-viewer { color: #1a1a1a; }

/* Terminal-window container: terminal fills it */
.os-window-body.term-body {
    overflow: hidden;
    display: flex;
}
.terminal-window-host { flex: 1; display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.terminal-window-host > div { flex: 1; min-height: 0; }

/* ── TASKBAR ───────────────────────────────────────────────────── */
#taskbar {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: 40px;
    background: rgba(10,10,10,.88);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-top: 1px solid rgba(77,255,50,.22);
    display: flex;
    align-items: center;
    padding: 0 10px;
    gap: 6px;
    z-index: 9990; /* Keep taskbar above windows */
}
body.theme-light #taskbar {
    background: rgba(235,235,235,.90);
    border-top-color: rgba(26,122,0,.22);
}
.tb-start {
    display: flex; align-items: center; gap: 7px;
    padding: 5px 12px;
    border: 1px solid rgba(77,255,50,.3);
    border-radius: 4px;
    font-size: 11px;
    color: var(--logo-color, #4dff32);
    cursor: pointer;
    transition: background .12s;
    font-family: inherit;
    background: transparent;
}
.tb-start:hover { background: rgba(77,255,50,.08); }
body.theme-light .tb-start {
    color: var(--logo-color, #1a7a00);
    border-color: rgba(26,122,0,.3);
}
body.theme-light .tb-start:hover { background: rgba(26,122,0,.08); }

.tb-windows { display: flex; gap: 5px; flex: 1; overflow-x: auto; }
.tb-win {
    padding: 5px 12px;
    background: #161616;
    border: 1px solid rgba(77,255,50,.16);
    border-radius: 4px;
    font-size: 11px;
    color: #ccc;
    cursor: pointer;
    white-space: nowrap;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background .12s, border-color .12s;
}
.tb-win:hover { background: #1e1e1e; }
.tb-win.active {
    border-color: var(--logo-color, #4dff32);
    color: var(--logo-color, #4dff32);
    box-shadow: inset 0 0 0 1px rgba(77,255,50,.15);
}
body.theme-light .tb-win {
    background: #f0f0eb;
    border-color: rgba(26,122,0,.16);
    color: #333;
}
body.theme-light .tb-win:hover { background: #e4e4df; }
body.theme-light .tb-win.active {
    border-color: var(--logo-color, #1a7a00);
    color: var(--logo-color, #1a7a00);
}

.tb-tray { display: flex; align-items: center; gap: 10px; font-size: 11px; color: #aaa; }
body.theme-light .tb-tray { color: #555; }
.tb-tray-btn {
    cursor: pointer;
    padding: 3px 8px;
    border-radius: 3px;
    transition: background .12s;
}
.tb-tray-btn:hover { background: rgba(255,255,255,.06); }
body.theme-light .tb-tray-btn:hover { background: rgba(0,0,0,.05); }

/* ── START MENU ────────────────────────────────────────────────── */
#start-menu {
    position: absolute;
    bottom: 44px; left: 10px;
    width: 260px;
    background: rgba(14,14,14,.96);
    border: 1px solid rgba(77,255,50,.28);
    border-radius: 6px;
    padding: 8px 0;
    box-shadow: 0 -8px 32px rgba(0,0,0,.55);
    z-index: 9995; /* Keep start menu above taskbar/windows */
    animation: winopen .14s ease;
}
body.theme-light #start-menu {
    background: rgba(245,245,240,.98);
    border-color: rgba(26,122,0,.28);
}
.sm-item {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 14px;
    font-size: 12px;
    color: #d0d0d0;
    cursor: pointer;
    transition: background .12s;
}
.sm-item:hover {
    background: rgba(77,255,50,.10);
    color: var(--logo-color, #4dff32);
}
body.theme-light .sm-item { color: #1a1a1a; }
body.theme-light .sm-item:hover {
    background: rgba(26,122,0,.10);
    color: var(--logo-color, #1a7a00);
}
.sm-glyph { width: 18px; text-align: center; opacity: .85; }
.sm-sep { height: 1px; background: rgba(77,255,50,.12); margin: 6px 0; }
body.theme-light .sm-sep { background: rgba(26,122,0,.15); }

/* ── RESPONSIVE DESKTOP ────────────────────────────────────────── */
@media (max-width: 640px) {
    #desktop-icons {
        inset: 14px 14px 54px 14px;
        grid-auto-flow: row;
        grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
        grid-template-rows: none;
        grid-auto-rows: 96px;
        gap: 4px;
    }
    .desk-icon-glyph { width: 42px; height: 42px; font-size: 22px; }
    .desk-icon-label { font-size: 10px; }
    .os-window {
        top: 0 !important; left: 0 !important;
        width: 100% !important; height: calc(100% - 40px) !important;
        border-radius: 0;
    }
    .tb-start span.tb-start-label { display: none; }
    .tb-tray .tb-clock { display: none; }
}
/* ── CONTEXT MENU ──────────────────────────────────────────────── */
.ctx-menu {
    position: fixed;
    z-index: 10000;
    background: var(--bgc);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 5px 0;
    width: 170px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    font-size: 12px;
    color: var(--white);
    animation: fadein 0.1s ease;
}

.ctx-item {
    padding: 8px 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 0.1s;
}

.ctx-item:hover {
    background: var(--sug-hover);
    color: var(--logo-color);
}

.ctx-sep {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}

/* ── HIRE APP ──────────────────────────────────────────────────── */
.hire-app {
    padding: 24px;
    height: 100%;
    display: flex;
    flex-direction: column;
    color: var(--white);
    font-family: 'JetBrains Mono', monospace;
}

.hire-header h2 {
    font-size: 18px;
    margin-bottom: 8px;
    color: var(--logo-color);
}

.hire-header p {
    font-size: 12px;
    color: var(--mid);
    margin-bottom: 24px;
}

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

.hire-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.hire-field label {
    font-size: 11px;
    color: var(--dim);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.hire-field input, .hire-field textarea {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 10px 12px;
    color: var(--white);
    font-family: inherit;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.hire-field input:focus, .hire-field textarea:focus {
    border-color: var(--logo-color);
    box-shadow: 0 0 0 2px var(--logo-glow);
}

.hire-field textarea {
    height: 140px;
    resize: none;
}

.hire-footer {
    margin-top: 10px;
}

.hire-btn {
    width: 100%;
    background: var(--logo-color);
    border: none;
    border-radius: 4px;
    padding: 12px;
    color: #000;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: transform 0.1s, opacity 0.2s;
}

.hire-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.hire-btn:active {
    transform: translateY(0);
}

.hire-status {
    margin-top: 16px;
    font-size: 12px;
    text-align: center;
    min-height: 1.5em;
}

.hire-status.success { color: var(--green); }
.hire-status.error { color: var(--red); }

/* ── AI AGENT APP ──────────────────────────────────────────────── */
.ai-app {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--bg);
}
.ai-chat-history {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.ai-msg {
    display: flex;
    flex-direction: column;
    max-width: 85%;
}
.ai-msg.user {
    align-self: flex-end;
}
.ai-msg.bot {
    align-self: flex-start;
}
.ai-bubble {
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.5;
    position: relative;
    white-space: pre-wrap;
}
.ai-msg.user .ai-bubble {
    background: var(--logo-color, #4dff32);
    color: #0c0c0c;
    border-bottom-right-radius: 2px;
}
body.theme-light .ai-msg.user .ai-bubble {
    background: var(--logo-color, #1a7a00);
    color: #f5f5f0;
}
.ai-msg.bot .ai-bubble {
    background: rgba(255,255,255,0.08);
    color: var(--white);
    border-bottom-left-radius: 2px;
    border: 1px solid rgba(255,255,255,0.1);
}
body.theme-light .ai-msg.bot .ai-bubble {
    background: rgba(0,0,0,0.05);
    color: #000;
    border-color: rgba(0,0,0,0.1);
}
.ai-bubble.thinking {
    font-style: italic;
    opacity: 0.7;
}
.ai-bubble.error {
    color: #ff5f57;
    border-color: #ff5f5733;
}
.ai-input-area {
    padding: 12px;
    background: rgba(0,0,0,0.2);
    border-top: 1px solid rgba(77,255,50,0.1);
    display: flex;
    gap: 10px;
    align-items: center;
}
body.theme-light .ai-input-area {
    background: rgba(255,255,255,0.5);
    border-top-color: rgba(26,122,0,0.1);
}
#ai-chat-input {
    flex: 1;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 6px;
    color: var(--white);
    padding: 8px 12px;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    resize: none;
    transition: border-color .15s;
}
body.theme-light #ai-chat-input {
    background: #fff;
    border-color: #ccc;
    color: #000;
}
#ai-chat-input:focus {
    border-color: var(--logo-color);
}
.ai-send-btn {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--logo-color);
    color: #0c0c0c;
    border: none;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: transform .1s, opacity .1s;
}
body.theme-light .ai-send-btn {
    color: #f5f5f0;
}
.ai-send-btn:hover {
    transform: scale(1.05);
    opacity: 0.9;
}
.ai-send-btn:active {
    transform: scale(0.95);
}
