/* ============================================
   FOX ASSISTANT — PREMIUM WEB UI
   ============================================ */

/* ---------- CSS Custom Properties ---------- */
:root {
    --bg-primary: #050505;
    --bg-secondary: #08080c;
    --bg-card: rgba(10, 15, 20, 0.85);
    --bg-glass: rgba(0, 243, 255, 0.03);
    --bg-glass-hover: rgba(0, 243, 255, 0.08);

    --fox-orange: #00f3ff;
    --fox-amber: #b3fbff;
    --fox-deep: #ff00ea;
    --fox-glow: rgba(0, 243, 255, 0.25);

    --accent-blue: #0088ff;
    --accent-green: #00ff00;
    --accent-red: #ff003c;
    --accent-purple: #b000ff;

    --text-primary: #e0f8f8;
    --text-secondary: #8ab4f8;
    --text-muted: #4a6b8c;

    --border-subtle: rgba(0, 243, 255, 0.15);
    --border-glow: rgba(0, 243, 255, 0.4);

    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.7);
    --shadow-glow: 0 0 40px rgba(0, 243, 255, 0.2);

    --font-sans: 'JetBrains Mono', 'Fira Code', monospace;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow: hidden;
    position: relative;
}

/* ---------- Background Particles ---------- */
.bg-particles {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.bg-particles .particle {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, var(--fox-orange), transparent 70%);
    opacity: 0;
    animation: floatParticle 12s infinite ease-in-out;
}

@keyframes floatParticle {
    0%, 100% { opacity: 0; transform: translateY(0) scale(0.5); }
    20% { opacity: 0.08; }
    50% { opacity: 0.12; transform: translateY(-120px) scale(1); }
    80% { opacity: 0.05; }
}

/* ---------- Wake Word Overlay ---------- */
.wake-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: radial-gradient(ellipse at center, rgba(15, 12, 25, 0.97), rgba(8, 6, 16, 0.99));
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.6s ease, visibility 0.6s ease, transform 0.6s ease;
}

.wake-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    transform: scale(1.05);
    pointer-events: none;
}

.wake-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    text-align: center;
    padding: 24px;
}

/* Sleeping fox */
.wake-fox {
    width: 120px;
    height: 120px;
    filter: drop-shadow(0 0 30px rgba(0, 243, 255, 0.3));
    animation: wakeFoxFloat 4s ease-in-out infinite;
}

.wake-fox svg {
    width: 100%;
    height: 100%;
}

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

/* Zzz animation */
.wake-zzz text {
    animation: zzzFloat 2.5s ease-in-out infinite;
}

.wake-zzz text:nth-child(1) { animation-delay: 0s; }
.wake-zzz text:nth-child(2) { animation-delay: 0.4s; }
.wake-zzz text:nth-child(3) { animation-delay: 0.8s; }

@keyframes zzzFloat {
    0%, 100% { opacity: 0.2; transform: translateY(0); }
    50% { opacity: 0.8; transform: translateY(-5px); }
}

.wake-title {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--text-primary);
}

.wake-title span {
    background: linear-gradient(135deg, var(--fox-amber), var(--fox-deep));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.wake-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    max-width: 320px;
    line-height: 1.5;
}

.wake-subtitle strong {
    color: var(--fox-orange);
    font-weight: 700;
    font-size: 1.1em;
}

/* Wake mic button */
.wake-mic-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
}

.wake-mic-btn {
    position: relative;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: 2px solid rgba(0, 243, 255, 0.3);
    background: linear-gradient(135deg, rgba(0, 243, 255, 0.1), rgba(0, 200, 255, 0.05));
    color: var(--fox-orange);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s var(--ease-spring);
}

.wake-mic-btn:hover {
    border-color: var(--fox-orange);
    background: linear-gradient(135deg, rgba(0, 243, 255, 0.2), rgba(0, 200, 255, 0.1));
    transform: scale(1.08);
    box-shadow: 0 0 40px rgba(0, 243, 255, 0.2);
}

.wake-mic-btn.listening {
    border-color: var(--fox-orange);
    background: linear-gradient(135deg, var(--fox-orange), var(--fox-deep));
    color: white;
    box-shadow: 0 0 40px rgba(0, 243, 255, 0.4);
}

.wake-mic-ring {
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    border: 2px solid rgba(0, 243, 255, 0.3);
    opacity: 0;
    pointer-events: none;
}

.wake-mic-btn.listening .wake-mic-ring {
    animation: wakeRipple 2s infinite ease-out;
}

.wake-mic-btn.listening .wake-mic-ring.ring-2 {
    animation-delay: 0.5s;
}

@keyframes wakeRipple {
    0% { transform: scale(0.9); opacity: 0.6; }
    100% { transform: scale(1.6); opacity: 0; }
}

.wake-mic-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
    letter-spacing: 0.3px;
    transition: color 0.3s ease;
}

.wake-mic-btn.listening ~ .wake-mic-label {
    color: var(--fox-orange);
}

/* Skip / manual wake button */
.wake-skip-btn {
    margin-top: 12px;
    padding: 10px 24px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    background: var(--bg-glass);
    color: var(--text-muted);
    font-family: var(--font-sans);
    font-size: 0.78rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.wake-skip-btn:hover {
    background: var(--bg-glass-hover);
    border-color: rgba(0, 243, 255, 0.3);
    color: var(--text-secondary);
}

/* Wake overlay responsive */
@media (max-width: 640px) {
    .wake-fox {
        width: 90px;
        height: 90px;
    }

    .wake-title {
        font-size: 1.4rem;
    }

    .wake-subtitle {
        font-size: 0.88rem;
    }

    .wake-mic-btn {
        width: 62px;
        height: 62px;
    }
}

@media (max-height: 500px) and (orientation: landscape) {
    .wake-content {
        gap: 10px;
    }

    .wake-fox {
        width: 60px;
        height: 60px;
    }

    .wake-title {
        font-size: 1.2rem;
    }

    .wake-mic-btn {
        width: 50px;
        height: 50px;
    }

    .wake-skip-btn {
        margin-top: 4px;
    }
}

/* ---------- App Container ---------- */
.app-container {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 900px;
    margin: 0 auto;
}

/* ---------- Header ---------- */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-subtle);
    background: rgba(5, 5, 10, 0.8);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    position: relative;
    z-index: 10;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.fox-logo {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 0 12px rgba(0, 243, 255, 0.4));
    transition: transform 0.4s var(--ease-spring);
}

.fox-logo:hover {
    transform: scale(1.1) rotate(-5deg);
}

.fox-logo svg {
    width: 44px;
    height: 44px;
}

.header-text h1 {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    line-height: 1.2;
    background: linear-gradient(135deg, var(--fox-amber), var(--fox-deep));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-text h1 .accent {
    -webkit-text-fill-color: var(--text-primary);
    font-weight: 400;
    opacity: 0.7;
}

.tagline {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 500;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.github-link {
    color: var(--text-secondary);
    transition: all 0.3s ease;
    padding: 8px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
}

.github-link:hover {
    color: var(--text-primary);
    background: var(--bg-glass-hover);
    transform: scale(1.05);
}

/* Status badge */
.status-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: var(--radius-full);
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.4s ease;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: all 0.4s ease;
}

.status-badge.listening {
    border-color: var(--border-glow);
    background: rgba(0, 243, 255, 0.08);
    color: var(--fox-orange);
    box-shadow: 0 0 20px rgba(0, 243, 255, 0.1);
}

.status-badge.listening .status-dot {
    background: var(--fox-orange);
    box-shadow: 0 0 8px var(--fox-orange);
    animation: pulseGlow 1.5s infinite ease-in-out;
}

.status-badge.speaking {
    border-color: rgba(0, 255, 0, 0.3);
    background: rgba(0, 255, 0, 0.08);
    color: var(--accent-blue);
}

.status-badge.speaking .status-dot {
    background: var(--accent-blue);
    box-shadow: 0 0 8px var(--accent-blue);
    animation: pulseGlow 1s infinite ease-in-out;
}

.status-badge.processing {
    border-color: rgba(255, 0, 234, 0.3);
    background: rgba(255, 0, 234, 0.08);
    color: var(--accent-purple);
}

.status-badge.processing .status-dot {
    background: var(--accent-purple);
    animation: pulseGlow 0.8s infinite ease-in-out;
}

@keyframes pulseGlow {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.4); opacity: 0.6; }
}

/* ---------- Chat Area ---------- */
.chat-area {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 243, 255, 0.2) transparent;
}

.chat-area::-webkit-scrollbar {
    width: 6px;
}

.chat-area::-webkit-scrollbar-track {
    background: transparent;
}

.chat-area::-webkit-scrollbar-thumb {
    background: rgba(0, 243, 255, 0.2);
    border-radius: 10px;
}

.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ---------- Messages ---------- */
.message {
    display: flex;
    gap: 12px;
    max-width: 85%;
    animation: messageSlideIn 0.5s var(--ease-out) forwards;
    opacity: 0;
    transform: translateY(16px);
}

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

.assistant-message {
    align-self: flex-start;
}

.user-message {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
}

.assistant-message .message-avatar {
    background: linear-gradient(135deg, rgba(0, 243, 255, 0.15), rgba(0, 200, 255, 0.1));
    border-color: rgba(0, 243, 255, 0.2);
}

.user-message .message-avatar {
    background: linear-gradient(135deg, rgba(0, 255, 0, 0.15), rgba(0, 255, 0, 0.1));
    border-color: rgba(0, 255, 0, 0.2);
}

.user-message .message-avatar svg {
    width: 18px;
    height: 18px;
    color: var(--accent-blue);
}

.message-content {
    padding: 14px 18px;
    border-radius: var(--radius-md);
    font-size: 0.92rem;
    line-height: 1.6;
}

.assistant-message .message-content {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-top-left-radius: 4px;
}

.user-message .message-content {
    background: linear-gradient(135deg, rgba(0, 255, 0, 0.12), rgba(0, 255, 0, 0.06));
    border: 1px solid rgba(0, 255, 0, 0.15);
    border-top-right-radius: 4px;
}

.message-sender {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 6px;
    color: var(--text-muted);
}

.assistant-message .message-sender {
    color: var(--fox-orange);
}

.user-message .message-sender {
    color: var(--accent-blue);
}

.message-content p {
    margin-bottom: 6px;
}

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

.message-content strong {
    color: var(--fox-orange);
    font-weight: 700;
}

/* Welcome message */
.welcome-msg .message-content {
    background: linear-gradient(135deg, rgba(0, 243, 255, 0.06), rgba(0, 200, 255, 0.03));
    border-color: rgba(0, 243, 255, 0.12);
}

/* Command chips */
.command-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
}

.chip:hover {
    background: rgba(0, 243, 255, 0.1);
    border-color: rgba(0, 243, 255, 0.3);
    color: var(--fox-amber);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 243, 255, 0.1);
}

/* Action cards in messages */
.action-card {
    margin-top: 10px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    gap: 10px;
}

.action-card .action-icon {
    font-size: 1.3rem;
}

.action-card .action-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.action-card a {
    color: var(--fox-orange);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.action-card a:hover {
    color: var(--fox-amber);
    text-decoration: underline;
}

/* Info snippets — brief information blocks */
.info-snippet {
    margin-top: 10px;
    padding: 14px 16px;
    background: linear-gradient(135deg, rgba(0, 243, 255, 0.04), rgba(0, 200, 255, 0.02));
    border-radius: var(--radius-sm);
    border: 1px solid rgba(0, 243, 255, 0.1);
    border-left: 3px solid var(--fox-orange);
    transition: all 0.3s ease;
}

.info-snippet.loading {
    border-left-color: var(--accent-purple);
    background: linear-gradient(135deg, rgba(255, 0, 234, 0.04), rgba(255, 0, 234, 0.02));
    border-color: rgba(255, 0, 234, 0.1);
    border-left-color: var(--accent-purple);
}

.info-snippet .info-header {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 10px;
}

.info-snippet .info-thumbnail {
    width: 60px;
    height: 60px;
    border-radius: 6px;
    object-fit: cover;
    border: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.info-snippet .info-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--fox-amber);
    margin-bottom: 2px;
}

.info-snippet .info-detail {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
    margin-top: 4px;
}

.info-snippet .info-body {
    font-size: 0.84rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-top: 6px;
}

/* Typing indicator */
.typing-indicator {
    display: flex;
    gap: 5px;
    padding: 8px 4px;
}

.typing-indicator span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--fox-orange);
    opacity: 0.4;
    animation: typingBounce 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(1) { animation-delay: 0s; }
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-8px); opacity: 1; }
}

/* ---------- Input Area ---------- */
.input-area {
    padding: 16px 24px 20px;
    border-top: 1px solid var(--border-subtle);
    background: rgba(5, 5, 10, 0.9);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
}

/* Visualizer */
.visualizer-container {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 12px 0 16px;
}

.visualizer-container.active {
    display: flex;
}

.visualizer {
    display: flex;
    align-items: center;
    gap: 3px;
    height: 32px;
}

.viz-bar {
    width: 3px;
    height: 6px;
    border-radius: 4px;
    background: var(--fox-orange);
    transition: height 0.1s ease;
    animation: vizPulse 0.8s infinite ease-in-out alternate;
}

.viz-bar:nth-child(1)  { animation-delay: 0.0s; }
.viz-bar:nth-child(2)  { animation-delay: 0.05s; }
.viz-bar:nth-child(3)  { animation-delay: 0.1s; }
.viz-bar:nth-child(4)  { animation-delay: 0.15s; }
.viz-bar:nth-child(5)  { animation-delay: 0.2s; }
.viz-bar:nth-child(6)  { animation-delay: 0.25s; }
.viz-bar:nth-child(7)  { animation-delay: 0.3s; }
.viz-bar:nth-child(8)  { animation-delay: 0.35s; }
.viz-bar:nth-child(9)  { animation-delay: 0.3s; }
.viz-bar:nth-child(10) { animation-delay: 0.25s; }
.viz-bar:nth-child(11) { animation-delay: 0.2s; }
.viz-bar:nth-child(12) { animation-delay: 0.15s; }
.viz-bar:nth-child(13) { animation-delay: 0.1s; }
.viz-bar:nth-child(14) { animation-delay: 0.05s; }
.viz-bar:nth-child(15) { animation-delay: 0.0s; }

@keyframes vizPulse {
    0% { height: 4px; opacity: 0.4; }
    100% { height: 28px; opacity: 1; }
}

.viz-label {
    font-size: 0.82rem;
    color: var(--fox-orange);
    font-weight: 500;
    letter-spacing: 0.3px;
}

/* Input row */
.input-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.text-input-wrap {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

#textInput {
    width: 100%;
    padding: 14px 50px 14px 18px;
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.92rem;
    outline: none;
    transition: all 0.3s ease;
}

#textInput::placeholder {
    color: var(--text-muted);
}

#textInput:focus {
    border-color: rgba(0, 243, 255, 0.4);
    background: rgba(255, 255, 255, 0.04);
    box-shadow: 0 0 0 3px rgba(0, 243, 255, 0.08);
}

.send-btn {
    position: absolute;
    right: 6px;
    width: 38px;
    height: 38px;
    border: none;
    background: linear-gradient(135deg, var(--fox-orange), var(--fox-deep));
    color: white;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s var(--ease-spring);
    opacity: 0.7;
}

.send-btn:hover {
    opacity: 1;
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(0, 243, 255, 0.3);
}

/* Mic button */
.mic-btn {
    position: relative;
    width: 52px;
    height: 52px;
    border: 2px solid rgba(0, 243, 255, 0.3);
    background: linear-gradient(135deg, rgba(0, 243, 255, 0.1), rgba(0, 200, 255, 0.05));
    color: var(--fox-orange);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s var(--ease-spring);
    flex-shrink: 0;
}

.mic-btn:hover {
    border-color: var(--fox-orange);
    background: linear-gradient(135deg, rgba(0, 243, 255, 0.2), rgba(0, 200, 255, 0.1));
    transform: scale(1.08);
    box-shadow: var(--shadow-glow);
}

.mic-btn.active {
    border-color: var(--fox-orange);
    background: linear-gradient(135deg, var(--fox-orange), var(--fox-deep));
    color: white;
    box-shadow: 0 0 30px rgba(0, 243, 255, 0.4);
    animation: micPulse 2s infinite ease-in-out;
}

.mic-pulse {
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 2px solid var(--fox-orange);
    opacity: 0;
    pointer-events: none;
}

.mic-btn.active .mic-pulse {
    animation: ripple 1.5s infinite ease-out;
}

@keyframes ripple {
    0% { transform: scale(0.8); opacity: 0.6; }
    100% { transform: scale(1.4); opacity: 0; }
}

@keyframes micPulse {
    0%, 100% { box-shadow: 0 0 20px rgba(0, 243, 255, 0.3); }
    50% { box-shadow: 0 0 40px rgba(0, 243, 255, 0.5); }
}

.input-hint {
    text-align: center;
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 10px;
    letter-spacing: 0.2px;
}

/* ---------- Toast Notifications ---------- */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow-md);
    font-size: 0.85rem;
    color: var(--text-primary);
    animation: toastIn 0.4s var(--ease-out) forwards;
    min-width: 280px;
}

.toast.info { border-left: 3px solid var(--accent-blue); }
.toast.success { border-left: 3px solid var(--accent-green); }
.toast.warning { border-left: 3px solid var(--fox-orange); }
.toast.error { border-left: 3px solid var(--accent-red); }

.toast-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.toast.leaving {
    animation: toastOut 0.3s ease forwards;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(60px) scale(0.9); }
    to { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes toastOut {
    to { opacity: 0; transform: translateX(60px) scale(0.9); }
}

/* ---------- Responsive ---------- */

/* ---- Extra-large desktops (1200px+) ---- */
@media (min-width: 1200px) {
    .app-container {
        max-width: 960px;
    }

    .message {
        max-width: 75%;
    }

    .message-content {
        font-size: 0.95rem;
    }
}

/* ---- Tablets landscape (768px – 1024px) ---- */
@media (max-width: 1024px) {
    .app-container {
        max-width: 100%;
    }

    .app-header {
        padding: 14px 20px;
    }

    .message {
        max-width: 88%;
    }

    .chat-area {
        padding: 20px;
    }

    .input-area {
        padding: 14px 20px 18px;
    }
}

/* ---- Tablets portrait & small laptops (640px – 768px) ---- */
@media (max-width: 768px) {
    .app-header {
        padding: 12px 16px;
    }

    .header-text h1 {
        font-size: 1.2rem;
    }

    .tagline {
        font-size: 0.6rem;
        letter-spacing: 1px;
    }

    .header-right {
        gap: 10px;
    }

    .status-badge {
        padding: 5px 10px;
        font-size: 0.72rem;
    }

    .status-badge .status-text {
        display: inline;
    }

    .chat-area {
        padding: 16px;
    }

    .chat-messages {
        gap: 12px;
    }

    .message {
        max-width: 92%;
        gap: 10px;
    }

    .message-content {
        padding: 12px 14px;
        font-size: 0.88rem;
    }

    .message-avatar {
        width: 32px;
        height: 32px;
    }

    .input-area {
        padding: 12px 16px 16px;
    }

    .input-row {
        gap: 10px;
    }

    #textInput {
        padding: 12px 46px 12px 14px;
        font-size: 0.88rem;
    }

    .send-btn {
        width: 34px;
        height: 34px;
    }

    .mic-btn {
        width: 48px;
        height: 48px;
    }

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

    .command-chips {
        gap: 6px;
    }

    .chip {
        font-size: 0.75rem;
        padding: 5px 12px;
    }

    .action-card {
        padding: 10px 12px;
    }

    .action-card .action-text {
        font-size: 0.8rem;
        word-break: break-word;
    }

    .toast-container {
        top: 12px;
        right: 12px;
        left: 12px;
    }

    .toast {
        min-width: auto;
        font-size: 0.8rem;
    }

    .fox-logo {
        width: 42px;
        height: 42px;
    }

    .fox-logo svg {
        width: 38px;
        height: 38px;
    }
}

/* ---- Mobile phones (480px – 640px) ---- */
@media (max-width: 640px) {
    .app-header {
        padding: 10px 12px;
        gap: 8px;
    }

    .header-left {
        gap: 10px;
    }

    .header-text h1 {
        font-size: 1.1rem;
    }

    .tagline {
        display: none;
    }

    .github-link {
        padding: 6px;
    }

    .github-link svg {
        width: 18px;
        height: 18px;
    }

    .status-badge {
        padding: 4px 8px;
        font-size: 0.68rem;
        gap: 5px;
    }

    .status-dot {
        width: 6px;
        height: 6px;
    }

    .chat-area {
        padding: 12px;
    }

    .chat-messages {
        gap: 10px;
    }

    .message {
        max-width: 95%;
        gap: 8px;
    }

    .message-avatar {
        width: 28px;
        height: 28px;
        border-radius: 6px;
    }

    .message-avatar svg {
        width: 22px !important;
        height: 22px !important;
    }

    .message-content {
        padding: 10px 12px;
        font-size: 0.85rem;
        line-height: 1.5;
        border-radius: var(--radius-sm);
    }

    .message-sender {
        font-size: 0.68rem;
        margin-bottom: 4px;
    }

    .command-chips {
        gap: 5px;
        margin-top: 10px;
    }

    .chip {
        font-size: 0.7rem;
        padding: 5px 10px;
        gap: 2px;
    }

    .action-card {
        padding: 8px 10px;
        gap: 8px;
        flex-wrap: wrap;
    }

    .action-card .action-icon {
        font-size: 1.1rem;
    }

    .action-card .action-text {
        font-size: 0.78rem;
        overflow-wrap: anywhere;
    }

    .input-area {
        padding: 10px 12px 14px;
    }

    .input-row {
        gap: 8px;
    }

    #textInput {
        padding: 11px 42px 11px 12px;
        font-size: 0.85rem;
        border-radius: var(--radius-md);
    }

    .send-btn {
        width: 32px;
        height: 32px;
        border-radius: var(--radius-sm);
    }

    .send-btn svg {
        width: 16px;
        height: 16px;
    }

    .mic-btn {
        width: 44px;
        height: 44px;
    }

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

    .input-hint {
        display: none;
    }

    .fox-logo {
        width: 36px;
        height: 36px;
    }

    .fox-logo svg {
        width: 32px;
        height: 32px;
    }

    .visualizer {
        gap: 2px;
        height: 24px;
    }

    .viz-bar {
        width: 2.5px;
    }

    .viz-label {
        font-size: 0.75rem;
    }
}

/* ---- Small phones (< 480px) ---- */
@media (max-width: 480px) {
    .header-text h1 {
        font-size: 1rem;
    }

    .header-right {
        gap: 6px;
    }

    .status-badge .status-text {
        max-width: 60px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .message {
        max-width: 98%;
    }

    .message-content {
        padding: 8px 10px;
        font-size: 0.82rem;
    }

    .chip {
        font-size: 0.65rem;
        padding: 4px 8px;
    }

    .mic-btn {
        width: 42px;
        height: 42px;
    }

    #textInput {
        padding: 10px 38px 10px 10px;
        font-size: 0.82rem;
    }

    .send-btn {
        width: 30px;
        height: 30px;
    }
}

/* ---- Ultra-small screens (< 380px) ---- */
@media (max-width: 380px) {
    .fox-logo {
        width: 30px;
        height: 30px;
    }

    .fox-logo svg {
        width: 26px;
        height: 26px;
    }

    .header-text h1 {
        font-size: 0.9rem;
    }

    .github-link {
        display: none;
    }

    .message-avatar {
        display: none;
    }

    .message {
        gap: 0;
    }

    .message-content {
        font-size: 0.8rem;
    }

    .command-chips {
        gap: 4px;
    }

    .chip {
        font-size: 0.62rem;
        padding: 3px 6px;
    }
}

/* ---- Landscape phones ---- */
@media (max-height: 500px) and (orientation: landscape) {
    .app-header {
        padding: 6px 16px;
    }

    .fox-logo {
        width: 32px;
        height: 32px;
    }

    .fox-logo svg {
        width: 28px;
        height: 28px;
    }

    .header-text h1 {
        font-size: 1rem;
    }

    .tagline {
        display: none;
    }

    .chat-area {
        padding: 8px 16px;
    }

    .chat-messages {
        gap: 8px;
    }

    .message-content {
        padding: 8px 10px;
        font-size: 0.82rem;
    }

    .message-avatar {
        width: 24px;
        height: 24px;
    }

    .input-area {
        padding: 6px 16px 8px;
    }

    #textInput {
        padding: 8px 42px 8px 12px;
    }

    .mic-btn {
        width: 40px;
        height: 40px;
    }

    .send-btn {
        width: 30px;
        height: 30px;
    }

    .input-hint {
        display: none;
    }

    .visualizer-container {
        padding: 4px 0 6px;
    }

    .welcome-msg .command-chips {
        margin-top: 6px;
    }
}

/* ---- Touch devices: remove hover effects ---- */
@media (hover: none) and (pointer: coarse) {
    .chip:hover {
        transform: none;
        box-shadow: none;
    }

    .chip:active {
        background: rgba(0, 243, 255, 0.15);
        border-color: rgba(0, 243, 255, 0.4);
        color: var(--fox-amber);
        transform: scale(0.97);
    }

    .mic-btn:hover {
        transform: none;
        box-shadow: none;
    }

    .mic-btn:active {
        transform: scale(0.95);
    }

    .send-btn:hover {
        transform: none;
    }

    .send-btn:active {
        transform: scale(0.95);
    }

    .fox-logo:hover {
        transform: none;
    }

    .github-link:hover {
        transform: none;
    }
}

/* ---- Safe area for notched phones (iPhone etc.) ---- */
@supports (padding: env(safe-area-inset-bottom)) {
    .input-area {
        padding-bottom: calc(14px + env(safe-area-inset-bottom));
    }

    .app-header {
        padding-top: calc(12px + env(safe-area-inset-top));
    }

    .toast-container {
        top: calc(12px + env(safe-area-inset-top));
        right: calc(12px + env(safe-area-inset-right));
    }
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .bg-particles {
        display: none;
    }

    .message {
        opacity: 1;
        transform: none;
    }
}

/* ---- High contrast mode ---- */
@media (prefers-contrast: high) {
    :root {
        --border-subtle: rgba(255, 255, 255, 0.2);
        --text-muted: #8888aa;
        --bg-glass: rgba(255, 255, 255, 0.08);
    }

    .message-content {
        border-width: 2px;
    }

    #textInput {
        border-width: 2px;
    }

    .status-badge {
        border-width: 2px;
    }
}

/* ---------- Selection ---------- */
::selection {
    background: rgba(0, 243, 255, 0.3);
    color: var(--text-primary);
}

/* ---------- No Speech API fallback ---------- */
.no-speech-warning {
    text-align: center;
    padding: 20px;
    margin: 20px;
    border-radius: var(--radius-md);
    background: rgba(248, 113, 113, 0.08);
    border: 1px solid rgba(248, 113, 113, 0.2);
    color: var(--accent-red);
    font-size: 0.9rem;
    line-height: 1.6;
}
