/* ==================== Custom Properties ==================== */
:root {
    /* Dark sophisticated palette */
    --bg-primary: #0a0a0b;
    --bg-secondary: #111113;
    --bg-tertiary: #18181b;
    --bg-elevated: #1f1f23;
    
    /* Accent - warm copper/amber */
    --accent: #d4a574;
    --accent-light: #e8c9a8;
    --accent-dim: #8b6b4a;
    
    /* Text */
    --text-primary: #fafafa;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    
    /* Borders */
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-light: rgba(255, 255, 255, 0.1);
    
    /* Typography */
    --font-sans: 'Sora', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    
    /* Spacing */
    --section-padding: clamp(80px, 12vh, 140px);
    --container-width: min(1200px, 90vw);
    
    /* Transitions */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
}

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Subtle noise texture */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0.015;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    z-index: 9999;
}

::selection {
    background: var(--accent);
    color: var(--bg-primary);
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

/* Cursor glow effect */
.cursor-glow {
    position: fixed;
    width: 280px;
    height: 280px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(212, 165, 116, 0.02) 0%, transparent 70%);
    pointer-events: none;
    z-index: 1;
    transform: translate(-50%, -50%);
    transition: opacity 0.3s ease;
    opacity: 0.35;
}

@media (min-width: 768px) {
    .cursor-glow {
        opacity: 0.35;
    }
}

/* ==================== Navigation ==================== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding: 0 clamp(20px, 5vw, 60px);
    background: rgba(10, 10, 11, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-subtle);
}

.nav-inner {
    max-width: var(--container-width);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 72px;
}

.nav-logo {
    font-family: var(--font-mono);
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: var(--text-primary);
    transition: color 0.2s ease;
}

.logo-bracket {
    color: var(--accent);
}

.nav-links {
    display: none;
    list-style: none;
    gap: 2.5rem;
}

@media (min-width: 768px) {
    .nav-links {
        display: flex;
    }
}

.nav-link {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: color 0.2s ease;
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--accent);
    transition: width 0.3s var(--ease-out);
}

.nav-link:hover,
.nav-link.active {
    color: var(--text-primary);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

.nav-chat-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.nav-chat-btn:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border-color: var(--accent-dim);
}

.chat-dot {
    width: 6px;
    height: 6px;
    background: #22c55e;
    border-radius: 50%;
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ==================== Hero Section ==================== */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 100px clamp(20px, 5vw, 60px);
    position: relative;
}

.hero-inner,
.scroll-indicator {
    position: relative;
    z-index: 2;
}

.particles-overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    opacity: 0.75;
}

.hero-inner {
    width: 100%;
    max-width: var(--container-width);
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 1024px) {
    .hero-inner {
        grid-template-columns: 1fr auto;
        align-items: center;
        justify-content: space-between;
    }
}

.hero-content {
    max-width: 600px;
}

.hero-label {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--accent);
}

.label-line {
    width: 40px;
    height: 1px;
    background: var(--accent);
}

.hero-title {
    margin-bottom: 1.5rem;
}

.title-line {
    display: block;
    font-size: clamp(2.5rem, 7vw, 4.5rem);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.title-accent {
    color: var(--accent);
}

.hero-description {
    font-size: 1.125rem;
    line-height: 1.7;
    color: var(--text-secondary);
    margin-bottom: 2.5rem;
    max-width: 480px;
}

.hero-stats {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 3rem;
    padding: 1.25rem 0;
    border-top: 1px solid var(--border-subtle);
    border-bottom: 1px solid var(--border-subtle);
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.stat-value {
    font-family: var(--font-mono);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.stat-divider {
    width: 1px;
    height: 40px;
    background: var(--border-light);
}

.hero-cta {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Buttons */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.875rem 1.5rem;
    background: var(--accent);
    color: var(--bg-primary);
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.btn-primary:hover {
    background: var(--accent-light);
    transform: translateY(-2px);
}

.btn-primary svg {
    transition: transform 0.2s ease;
}

.btn-primary:hover svg {
    transform: translate(2px, -2px);
}

.btn-ghost {
    display: inline-flex;
    align-items: center;
    padding: 0.875rem 1.5rem;
    background: transparent;
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.btn-ghost:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-dim);
}

/* Hero Visual */
.hero-visual {
    display: none;
    justify-content: flex-end;
}

@media (min-width: 1024px) {
    .hero-visual {
        display: flex;
    }
}

.visual-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    max-width: 380px;
}

.grid-item {
    padding: 1.25rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
}

.grid-code {
    grid-column: span 2;
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    line-height: 1.8;
    overflow: hidden;
}

.grid-code pre {
    margin: 0;
}

.code-keyword { color: #c792ea; }
.code-prop { color: var(--accent); }
.code-string { color: #a5d6a7; }
.code-bool { color: #82aaff; }

.grid-badge {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.badge-icon {
    font-size: 1.25rem;
}

.grid-badge-alt {
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-tertiary));
}

/* Scroll Indicator */
.scroll-indicator {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.15em;
}

.scroll-line {
    width: 1px;
    height: 40px;
    background: linear-gradient(to bottom, var(--accent), transparent);
    animation: scroll-bounce 2s infinite;
}

@keyframes scroll-bounce {
    0%, 100% { transform: scaleY(1); opacity: 1; }
    50% { transform: scaleY(0.5); opacity: 0.5; }
}

/* ==================== Sections Common ==================== */
.section-container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: var(--section-padding) clamp(20px, 5vw, 60px);
}

.section-number {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--accent);
    letter-spacing: 0.1em;
}

.section-title {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-top: 0.5rem;
    margin-bottom: 3rem;
}

/* ==================== About Section ==================== */
.about {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-subtle);
}

.about-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 3rem;
    margin-bottom: 4rem;
}

@media (min-width: 768px) {
    .about-grid {
        grid-template-columns: 1.2fr 1fr;
    }
}

.intro-text {
    font-size: 1.125rem;
    line-height: 1.8;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.intro-text strong {
    color: var(--text-primary);
    font-weight: 500;
}

.detail-block {
    margin-bottom: 2rem;
}

.detail-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: 1rem;
}

.experience-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.exp-role {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.exp-company {
    font-size: 0.875rem;
    color: var(--accent);
}

.exp-date {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Skills */
.skills-section {
    padding-top: 3rem;
    border-top: 1px solid var(--border-subtle);
}

.skills-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: 1.5rem;
}

.skills-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 640px) {
    .skills-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.category-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.skill-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.skill-tag {
    padding: 0.375rem 0.75rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.skill-tag:hover {
    background: var(--bg-elevated);
    border-color: var(--accent-dim);
    color: var(--accent);
}

/* ==================== Work Section ==================== */
.work {
    border-top: 1px solid var(--border-subtle);
}

.projects-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.project-item {
    display: grid;
    grid-template-columns: 60px 1fr;
    gap: 2rem;
    padding: 2.5rem 0;
    border-bottom: 1px solid var(--border-subtle);
    transition: all 0.3s ease;
}

@media (min-width: 768px) {
    .project-item {
        grid-template-columns: 80px 1fr;
        padding: 3rem 0;
    }
}

.project-item:hover {
    background: linear-gradient(90deg, var(--bg-secondary) 0%, transparent 50%);
    padding-left: 1.5rem;
    margin-left: -1.5rem;
    padding-right: 1.5rem;
    margin-right: -1.5rem;
}

.project-index {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
}

.project-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.project-tag {
    padding: 0.25rem 0.625rem;
    background: var(--accent);
    color: var(--bg-primary);
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: 4px;
}

.project-year {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.project-title {
    font-size: clamp(1.25rem, 3vw, 1.5rem);
    font-weight: 600;
    margin-bottom: 0.75rem;
    transition: color 0.2s ease;
}

.project-item:hover .project-title {
    color: var(--accent);
}

.project-description {
    font-size: 0.9375rem;
    line-height: 1.7;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    max-width: 600px;
}

.project-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--accent);
    transition: gap 0.2s ease;
}

.project-link:hover {
    gap: 0.75rem;
}

.work-footer {
    padding-top: 3rem;
    text-align: center;
}

.view-all-link {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.view-all-link:hover {
    color: var(--accent);
    gap: 1rem;
}

/* ==================== Chat Promo Section ==================== */
.chat-promo {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    border-top: 1px solid var(--border-subtle);
}

.chat-promo .section-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 3rem;
    align-items: center;
}

@media (min-width: 900px) {
    .chat-promo .section-container {
        grid-template-columns: 1fr 1fr;
        gap: 4rem;
    }
}

.promo-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.875rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border-light);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.pulse {
    width: 6px;
    height: 6px;
    background: #22c55e;
    border-radius: 50%;
    animation: pulse-dot 2s infinite;
}

.promo-title {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 1rem;
}

.promo-description {
    font-size: 1.0625rem;
    line-height: 1.7;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    max-width: 440px;
}

.promo-note {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 1rem;
    font-style: italic;
}

/* Chat Preview */
.promo-preview {
    display: none;
}

@media (min-width: 900px) {
    .promo-preview {
        display: block;
    }
}

.chat-preview-window {
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.preview-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-subtle);
    font-size: 0.875rem;
    font-weight: 500;
}

.preview-dot {
    width: 8px;
    height: 8px;
    background: #22c55e;
    border-radius: 50%;
}

.preview-messages {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 280px;
}

.preview-msg {
    padding: 0.75rem 1rem;
    border-radius: 12px;
    font-size: 0.8125rem;
    line-height: 1.5;
    max-width: 85%;
}

.preview-user {
    background: var(--accent);
    color: var(--bg-primary);
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.preview-bot {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border-bottom-left-radius: 4px;
}

/* ==================== Contact Section ==================== */
.contact {
    border-top: 1px solid var(--border-subtle);
    position: relative;
    overflow: hidden;
}

.contact .section-container,
.contact-content {
    position: relative;
    z-index: 2;
}

.contact-content {
    max-width: 600px;
}

.contact-intro {
    font-size: 1.125rem;
    line-height: 1.7;
    color: var(--text-secondary);
    margin-bottom: 2.5rem;
}

.contact-links {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.contact-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    transition: all 0.2s ease;
}

.contact-link:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-dim);
    transform: translateX(4px);
}

.link-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border-radius: 10px;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.contact-link:hover .link-icon {
    background: var(--accent);
    color: var(--bg-primary);
}

.link-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.link-label {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
}

.link-handle {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.link-arrow {
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.contact-link:hover .link-arrow {
    color: var(--accent);
    transform: translate(2px, -2px);
}

/* ==================== Footer ==================== */
.footer {
    padding: 2rem clamp(20px, 5vw, 60px);
    border-top: 1px solid var(--border-subtle);
}

.footer-inner {
    max-width: var(--container-width);
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.footer-note {
    display: none;
}

@media (min-width: 640px) {
    .footer-note {
        display: block;
    }
}

/* ==================== Chat Widget ==================== */
.chat-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
}

.chat-fab {
    width: 56px;
    height: 56px;
    background: var(--accent);
    color: var(--bg-primary);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 30px rgba(212, 165, 116, 0.25);
    transition: all 0.3s var(--ease-out);
}

.chat-fab:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 40px rgba(212, 165, 116, 0.35);
}

/* Chat Modal Overlay */
.chat-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.chat-overlay.active {
    opacity: 1;
    visibility: visible;
}

.chat-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    width: min(720px, calc(100vw - 48px));
    height: min(680px, calc(100vh - 80px));
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: 24px;
    display: none;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 40px 100px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    opacity: 0;
}

.chat-panel.active {
    display: flex;
    animation: modal-appear 0.35s var(--ease-out) forwards;
}

@keyframes modal-appear {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.92);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.chat-panel-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-subtle);
}

.chat-avatar {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    color: var(--bg-primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: 0.875rem;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(212, 165, 116, 0.3);
}

.chat-info {
    flex: 1;
}

.chat-info h4 {
    font-size: 0.9375rem;
    font-weight: 600;
    margin-bottom: 0.125rem;
    color: var(--text-primary);
}

.chat-status {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

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

.chat-actions {
    display: flex;
    gap: 0.5rem;
}

.tts-btn,
.close-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.tts-btn:hover,
.close-btn:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.tts-btn.active {
    background: var(--accent);
    color: var(--bg-primary);
}

.chat-messages {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    background: var(--bg-primary);
}

/* Scrollbar styling */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

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

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.message {
    display: flex;
    max-width: 680px;
    margin: 0 auto;
    width: 100%;
}

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

.bot-message {
    justify-content: flex-start;
    gap: 0.75rem;
}

/* Bot avatar in messages */
.bot-message::before {
    content: 'ZK';
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    color: var(--bg-primary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: 0.625rem;
    font-weight: 700;
}

.message-content {
    max-width: 75%;
    padding: 1rem 1.25rem;
    border-radius: 18px;
    font-size: 0.9375rem;
    line-height: 1.7;
}

.user-message .message-content {
    background: var(--accent);
    color: var(--bg-primary);
    border-bottom-right-radius: 6px;
    font-weight: 500;
}

.bot-message .message-content {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-bottom-left-radius: 6px;
    border: 1px solid var(--border-subtle);
}

.chat-input-area {
    display: flex;
    justify-content: center;
    padding: 1.5rem 2rem 2rem;
    border-top: 1px solid var(--border-subtle);
    background: linear-gradient(to top, var(--bg-primary) 60%, transparent);
}

.chat-input-wrapper {
    display: flex;
    gap: 0.75rem;
    width: 100%;
    max-width: 680px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 16px;
    padding: 0.5rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.chat-input-wrapper:focus-within {
    border-color: var(--accent-dim);
    box-shadow: 0 0 0 3px rgba(212, 165, 116, 0.1);
}

#chat-input {
    flex: 1;
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 0.9375rem;
    outline: none;
    resize: none;
}

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

.send-btn {
    width: 44px;
    height: 44px;
    background: var(--accent);
    color: var(--bg-primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.send-btn:hover {
    background: var(--accent-light);
    transform: scale(1.05);
}

.send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

/* Typing indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 1.25rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 18px;
    border-bottom-left-radius: 6px;
    max-width: 80px;
    margin-left: 40px; /* Account for avatar */
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: typing-bounce 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing-bounce {
    0%, 80%, 100% { transform: scale(0.8); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

/* Streaming cursor */
.streaming-message .message-content::after {
    content: '▋';
    color: var(--accent);
    animation: blink 1s infinite;
    margin-left: 2px;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* TTS Settings Panel */
.tts-settings-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 320px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 20px;
    display: none;
    overflow: hidden;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5);
    z-index: 1001;
}

.tts-settings-panel.show {
    display: block;
    animation: modal-appear 0.3s var(--ease-out) forwards;
}

.tts-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-subtle);
}

.tts-panel-header h4 {
    font-size: 0.9375rem;
    font-weight: 600;
}

.close-btn-sm {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    border-radius: 6px;
    transition: all 0.2s ease;
}

.close-btn-sm:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.tts-settings-body {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.setting-row {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.setting-row label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
}

.setting-row label span {
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 0.75rem;
}

.setting-select {
    padding: 0.625rem 0.875rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.8125rem;
    outline: none;
}

.setting-range {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    outline: none;
}

.setting-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.setting-range::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

/* ==================== Responsive ==================== */
@media (max-width: 640px) {
    .hero-stats {
        flex-wrap: wrap;
        gap: 1rem;
    }
    
    .stat-divider {
        display: none;
    }
    
    .stat-item {
        flex: 1 1 45%;
    }
    
    .chat-widget {
        bottom: 16px;
        right: 16px;
    }
    
    .chat-fab {
        width: 52px;
        height: 52px;
        border-radius: 14px;
    }
    
    .chat-panel {
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
        top: 0;
        left: 0;
        transform: none;
    }
    
    .chat-panel.active {
        animation: none;
        opacity: 1;
        transform: none;
    }
    
    .chat-messages {
        padding: 1.25rem;
    }
    
    .message {
        max-width: 100%;
    }
    
    .bot-message::before {
        width: 28px;
        height: 28px;
        font-size: 0.5rem;
    }
    
    .typing-indicator {
        margin-left: 36px;
    }
    
    .chat-input-area {
        padding: 1rem;
    }
    
    .tts-settings-panel {
        width: calc(100% - 32px);
    }
}
