/* Yasaboy guided assistant — dark glass UI, green accent, matches the platform theme. */
.ya-launcher,
.ya-panel,
.ya-panel * {
    box-sizing: border-box;
    font-family: var(--font, "Outfit", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
}

/* Floating launcher */
.ya-launcher {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 1100;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 12px 18px;
    border: 1px solid rgba(97, 208, 148, 0.45);
    border-radius: 999px;
    background: rgba(16, 17, 14, 0.86);
    color: var(--text, #f5f7ef);
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    cursor: pointer;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.34);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.ya-launcher:hover,
.ya-launcher:focus-visible {
    transform: translateY(-2px);
    border-color: rgba(97, 208, 148, 0.85);
    box-shadow: 0 22px 55px rgba(0, 0, 0, 0.4);
    outline: none;
}

.ya-launcher-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent, #61d094);
    box-shadow: 0 0 0 4px rgba(97, 208, 148, 0.2);
}

.ya-launcher-label {
    white-space: nowrap;
}

/* Chat panel */
.ya-panel {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 1101;
    display: flex;
    flex-direction: column;
    width: min(384px, calc(100vw - 32px));
    height: min(620px, calc(100vh - 96px));
    border: 1px solid rgba(245, 247, 239, 0.14);
    border-radius: 18px;
    background: rgba(16, 17, 14, 0.93);
    color: var(--text, #f5f7ef);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    overflow: hidden;
    transform: translateY(14px) scale(0.97);
    transform-origin: bottom right;
    opacity: 0;
    pointer-events: none;
    transition: transform 260ms cubic-bezier(0.22, 1, 0.36, 1), opacity 220ms ease;
}

.ya-panel.is-open {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: auto;
}

.ya-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 18px 14px;
    border-bottom: 1px solid rgba(245, 247, 239, 0.1);
    background: linear-gradient(180deg, rgba(97, 208, 148, 0.12), transparent);
}

.ya-heading {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.ya-title {
    font-size: 1.02rem;
    font-weight: 700;
}

.ya-subtitle {
    font-size: 0.82rem;
    color: var(--text-muted, #b8c0b3);
}

.ya-scope-note {
    display: block;
    font-size: 0.68rem;
    color: var(--text-muted, #b8c0b3);
    opacity: 0.65;
    margin-top: 0.1rem;
}

.ya-close {
    flex: none;
    width: 32px;
    height: 32px;
    border: 1px solid rgba(245, 247, 239, 0.16);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text, #f5f7ef);
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    transition: background 160ms ease, border-color 160ms ease;
}

.ya-close:hover,
.ya-close:focus-visible {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(97, 208, 148, 0.6);
    outline: none;
}

/* Messages */
.ya-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scrollbar-width: thin;
}

.ya-messages::-webkit-scrollbar {
    width: 8px;
}

.ya-messages::-webkit-scrollbar-thumb {
    background: rgba(245, 247, 239, 0.16);
    border-radius: 999px;
}

.ya-msg {
    display: flex;
    max-width: 100%;
}

.ya-msg-user {
    justify-content: flex-end;
}

.ya-msg-bot {
    justify-content: flex-start;
}

.ya-bubble {
    max-width: 88%;
    padding: 12px 14px;
    border-radius: 14px;
    font-size: 0.9rem;
    line-height: 1.5;
}

.ya-msg-bot .ya-bubble {
    border: 1px solid rgba(245, 247, 239, 0.12);
    background: rgba(255, 255, 255, 0.05);
    border-top-left-radius: 5px;
}

.ya-msg-user .ya-bubble {
    background: var(--accent, #61d094);
    color: #10110e;
    font-weight: 600;
    border-top-right-radius: 5px;
}

.ya-bot-name {
    margin-bottom: 4px;
    font-family: var(--font-mono, "JetBrains Mono", Consolas, monospace);
    font-size: 0.66rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent, #61d094);
}

.ya-bot-text {
    margin: 0;
}

/* Tool recommendation cards */
.ya-tool-card {
    margin-bottom: 10px;
    padding: 10px 12px;
    border: 1px solid rgba(97, 208, 148, 0.28);
    border-radius: 12px;
    background: rgba(97, 208, 148, 0.06);
}

.ya-tool-card-title {
    display: block;
    margin-bottom: 6px;
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text, #f5f7ef);
}

.ya-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 6px;
}

.ya-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.ya-badge-local {
    border: 1px solid rgba(97, 208, 148, 0.45);
    background: rgba(97, 208, 148, 0.12);
    color: #9ee8c0;
}

.ya-badge-offline {
    border: 1px solid rgba(120, 180, 255, 0.4);
    background: rgba(120, 180, 255, 0.1);
    color: #a8c8ff;
}

.ya-badge-online {
    border: 1px solid rgba(255, 190, 100, 0.45);
    background: rgba(255, 190, 100, 0.1);
    color: #ffd9a0;
}

.ya-badge-heavy {
    border: 1px solid rgba(255, 140, 100, 0.4);
    background: rgba(255, 140, 100, 0.1);
    color: #ffc4a8;
}

.ya-badge-guide {
    border: 1px solid rgba(180, 160, 255, 0.4);
    background: rgba(180, 160, 255, 0.1);
    color: #d4c8ff;
}

.ya-badge-exp {
    border: 1px solid rgba(255, 220, 120, 0.45);
    background: rgba(255, 220, 120, 0.1);
    color: #ffe9a0;
}

.ya-tool-limit {
    margin: 0;
    font-size: 0.78rem;
    line-height: 1.45;
    color: var(--text-muted, #b8c0b3);
}

.ya-did-you-mean {
    margin: 10px 0 4px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted, #b8c0b3);
}

/* Action buttons */
.ya-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.ya-action {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid rgba(97, 208, 148, 0.4);
    border-radius: 10px;
    background: rgba(97, 208, 148, 0.1);
    color: var(--text, #f5f7ef);
    font-size: 0.85rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.ya-action:hover,
.ya-action:focus-visible {
    background: rgba(97, 208, 148, 0.2);
    border-color: rgba(97, 208, 148, 0.85);
    transform: translateX(2px);
    outline: none;
}

/* Quick option chips */
.ya-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.ya-chip {
    padding: 8px 12px;
    border: 1px solid rgba(245, 247, 239, 0.2);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text, #f5f7ef);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 160ms ease, border-color 160ms ease;
}

.ya-chip:hover,
.ya-chip:focus-visible {
    background: rgba(97, 208, 148, 0.16);
    border-color: rgba(97, 208, 148, 0.65);
    outline: none;
}

/* Input row */
.ya-input-row {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid rgba(245, 247, 239, 0.1);
    background: rgba(255, 255, 255, 0.02);
}

.ya-input {
    flex: 1;
    min-width: 0;
    padding: 11px 13px;
    border: 1px solid rgba(245, 247, 239, 0.18);
    border-radius: 10px;
    background: rgba(16, 17, 14, 0.6);
    color: var(--text, #f5f7ef);
    font-size: 0.88rem;
}

.ya-input::placeholder {
    color: var(--text-muted, #b8c0b3);
}

.ya-input:focus {
    border-color: rgba(97, 208, 148, 0.7);
    outline: none;
}

.ya-send {
    flex: none;
    padding: 0 16px;
    border: none;
    border-radius: 10px;
    background: var(--accent, #61d094);
    color: #10110e;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: filter 160ms ease, transform 160ms ease;
}

.ya-send:hover,
.ya-send:focus-visible {
    filter: brightness(1.06);
    transform: translateY(-1px);
    outline: none;
}

/* Mobile */
@media (max-width: 560px) {
    .ya-panel {
        right: 10px;
        left: 10px;
        bottom: max(10px, env(safe-area-inset-bottom, 10px));
        width: auto;
        height: min(78vh, calc(100vh - 80px - env(safe-area-inset-bottom, 0px)));
        border-radius: 16px;
    }

    .ya-launcher {
        right: max(16px, env(safe-area-inset-right, 16px));
        bottom: max(12px, env(safe-area-inset-bottom, 12px));
        padding: 11px 14px;
        max-width: calc(50vw - 24px);
    }

    .ya-launcher-label {
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 9.5rem;
    }
}

@media (max-width: 640px) {
    .ya-launcher {
        right: max(16px, env(safe-area-inset-right, 16px));
        z-index: 1100;
    }

    body.has-pwa-install-cta .ya-launcher {
        bottom: calc(76px + env(safe-area-inset-bottom, 0px));
    }
}

@media (prefers-reduced-motion: reduce) {
    .ya-launcher,
    .ya-panel,
    .ya-action,
    .ya-send {
        transition: none;
    }
}

[data-theme="light"] .ya-launcher,
[data-theme="light"] .ya-panel {
    background: rgba(255, 255, 255, 0.94);
    color: var(--text);
    border-color: rgba(23, 25, 19, 0.14);
}

[data-theme="light"] .ya-msg-bot .ya-bubble {
    background: rgba(23, 25, 19, 0.04);
    border-color: rgba(23, 25, 19, 0.12);
}

[data-theme="light"] .ya-input {
    background: rgba(255, 255, 255, 0.95);
    color: var(--text);
}

[data-theme="light"] .ya-chip,
[data-theme="light"] .ya-action {
    color: var(--text-strong);
}

[data-theme="light"] .ya-badge-local {
    color: #2a9d65;
}

[data-theme="light"] .ya-subtitle {
    color: var(--text-muted);
}

/* Teach panel */
.ya-teach-panel {
    padding: 0.65rem 0.85rem;
    border-top: 1px solid rgba(245, 247, 239, 0.1);
    background: rgba(97, 208, 148, 0.06);
}

.ya-teach-panel[hidden] {
    display: none !important;
}

.ya-teach-title {
    margin: 0 0 0.35rem;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--accent, #61d094);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.ya-teach-question {
    margin: 0 0 0.45rem;
    font-size: 0.84rem;
    color: var(--text-muted, #c8cfc0);
}

.ya-teach-input {
    width: 100%;
    min-height: 72px;
    padding: 0.55rem 0.65rem;
    border: 1px solid rgba(245, 247, 239, 0.16);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.22);
    color: var(--text, #f5f7ef);
    font: inherit;
    resize: vertical;
}

.ya-teach-actions {
    display: flex;
    gap: 0.45rem;
    margin-top: 0.5rem;
}

.ya-teach-save,
.ya-teach-cancel,
.ya-memory-toggle,
.ya-memory-btn {
    border: 1px solid rgba(245, 247, 239, 0.16);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text, #f5f7ef);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0.35rem 0.65rem;
}

.ya-teach-save {
    background: rgba(97, 208, 148, 0.2);
    border-color: rgba(97, 208, 148, 0.45);
}

.ya-memory-toggle {
    margin-right: 0.35rem;
}

.ya-memory-panel {
    padding: 0.55rem 0.85rem;
    border-bottom: 1px solid rgba(245, 247, 239, 0.1);
    background: rgba(0, 0, 0, 0.18);
    max-height: 160px;
    overflow: auto;
}

.ya-memory-panel[hidden] {
    display: none !important;
}

.ya-memory-title {
    margin: 0 0 0.35rem;
    font-size: 0.76rem;
    font-weight: 700;
    color: var(--text-muted, #c8cfc0);
}

.ya-memory-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.ya-memory-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.3rem 0;
    border-bottom: 1px solid rgba(245, 247, 239, 0.06);
    font-size: 0.78rem;
}

.ya-memory-q {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text, #f5f7ef);
}

.ya-memory-del {
    border: 0;
    background: transparent;
    color: #f5a9a9;
    font-size: 0.72rem;
    cursor: pointer;
}

.ya-memory-empty {
    font-size: 0.78rem;
    color: var(--text-muted, #c8cfc0);
}

.ya-memory-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.45rem;
}

.ya-memory-import-label {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
}

.ya-memory-clear {
    color: #f5c49a;
}

.ya-privacy-note {
    margin: 0;
    padding: 0.45rem 0.85rem 0.6rem;
    font-size: 0.72rem;
    color: var(--text-muted, #c8cfc0);
    border-top: 1px solid rgba(245, 247, 239, 0.08);
}

.ya-typing .ya-bot-text {
    opacity: 0.75;
    font-style: italic;
}

[data-theme="light"] .ya-teach-panel {
    background: rgba(40, 160, 110, 0.08);
    border-top-color: rgba(23, 25, 19, 0.1);
}

[data-theme="light"] .ya-teach-question,
[data-theme="light"] .ya-memory-title,
[data-theme="light"] .ya-memory-empty,
[data-theme="light"] .ya-privacy-note {
    color: var(--text-muted);
}

[data-theme="light"] .ya-teach-input {
    background: #ffffff;
    color: var(--text);
    border-color: rgba(23, 25, 19, 0.16);
}

[data-theme="light"] .ya-teach-save,
[data-theme="light"] .ya-teach-cancel,
[data-theme="light"] .ya-memory-toggle,
[data-theme="light"] .ya-memory-btn {
    background: #ffffff;
    color: var(--text-strong, #171913);
    border-color: rgba(23, 25, 19, 0.14);
}

[data-theme="light"] .ya-teach-save {
    background: rgba(40, 160, 110, 0.14);
    border-color: rgba(40, 160, 110, 0.35);
}

[data-theme="light"] .ya-memory-panel {
    background: rgba(23, 25, 19, 0.03);
    border-bottom-color: rgba(23, 25, 19, 0.1);
}

[data-theme="light"] .ya-memory-q {
    color: var(--text);
}

[data-theme="light"] .ya-msg-user .ya-bubble {
    color: #ffffff;
}

