:root {
    --bg-main: #07090e;
    --bg-card: #0f172a;
    --bg-input: #07090e;
    --accent: #38bdf8;
    --accent-hover: #0ea5e9;
    --accent-glow: rgba(56, 189, 248, 0.35);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: #1e293b;
    --success: #10b981;
    --error: #ef4444;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem 1rem;
    overflow-x: hidden;
}

.container {
    width: 100%;
    max-width: 560px;
    animation: fadeIn 0.5s ease-out;
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

.pigeon-icon {
    font-size: 3.5rem;
    display: inline-block;
    cursor: pointer;
    user-select: none;
    animation: idleFloat 3.5s ease-in-out infinite;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    filter: drop-shadow(0 0 15px var(--accent-glow));
    margin-bottom: 0.5rem;
}

.pigeon-icon:hover { transform: scale(1.15) rotate(5deg); }
.pigeon-icon.pecking { animation: peckAction 0.2s ease infinite alternate; }

@keyframes idleFloat {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-7px) rotate(-2deg); }
}

@keyframes peckAction {
    0% { transform: translateY(0) rotate(0deg); }
    100% { transform: translateY(6px) rotate(12deg) scale(1.05); }
}

/* Flying Animation */
.sky-overlay {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    pointer-events: none;
    overflow: hidden;
    z-index: 999;
}

.flying-homer {
    position: absolute;
    font-size: 2.5rem;
    transform: translateX(-150px);
    opacity: 0;
}

@keyframes flyParabolic {
    0% { transform: translate(-100px, 70vh) rotate(-15deg) scale(0.7); opacity: 0; }
    15% { opacity: 1; }
    50% { transform: translate(50vw, 25vh) rotate(8deg) scale(1.25); filter: drop-shadow(0 10px 15px rgba(56,189,248,0.4)); }
    85% { opacity: 1; }
    100% { transform: translate(calc(100vw + 100px), 40vh) rotate(-5deg) scale(1); opacity: 0; }
}

.flying-homer.active {
    animation: flyParabolic 2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

/* Notification Toast (Top Right) */
.bird-toast {
    position: fixed;
    top: 24px;
    right: 24px;
    background: var(--bg-card);
    border: 1px solid var(--accent);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.6), 0 0 15px rgba(56,189,248,0.2);
    z-index: 2000;
    animation: toastSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    max-width: 360px;
}

.bird-toast.hidden { display: none; }

@keyframes toastSlideIn {
    from { transform: translateY(-100px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.toast-envelope {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: envelopeBounce 0.6s ease-in-out infinite alternate;
}

@keyframes envelopeBounce {
    from { transform: translateY(0); }
    to { transform: translateY(-4px); }
}

.toast-content h4 { font-size: 0.92rem; font-weight: 700; color: var(--accent); margin-bottom: 0.2rem; }
.toast-content p { font-size: 0.82rem; color: var(--text-muted); line-height: 1.3; }

header h1 {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--accent);
    margin-bottom: 0.25rem;
    letter-spacing: -0.02em;
}

header p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
    box-shadow: 0 8px 24px -6px rgba(0, 0, 0, 0.4);
    transition: border-color 0.25s ease;
}

.card:hover { border-color: rgba(56, 189, 248, 0.3); }

.card-desc {
    color: var(--text-muted);
    font-size: 0.88rem;
    margin-bottom: 1rem;
    line-height: 1.4;
}

.step-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--accent);
}

.step-title span {
    background: rgba(56, 189, 248, 0.12);
    color: var(--accent);
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 0.85rem;
}

.btn {
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    color: var(--bg-main);
    font-weight: 700;
    border: none;
    border-radius: 10px;
    padding: 0.8rem 1.25rem;
    cursor: pointer;
    font-size: 0.95rem;
    width: 100%;
    text-align: center;
    transition: transform 0.15s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 12px rgba(56, 189, 248, 0.25);
}

.btn:active { transform: scale(0.98); }

.btn-secondary {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-main);
    box-shadow: none;
}

.btn-secondary:hover { background: rgba(255, 255, 255, 0.04); }

textarea, input[type="text"] {
    width: 100%;
    background-color: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-main);
    padding: 0.75rem;
    font-size: 0.85rem;
    resize: none;
    margin-bottom: 0.75rem;
}

textarea:focus, input[type="text"]:focus { outline: none; border-color: var(--accent); }

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.hidden { display: none !important; }

/* File Preview Card */
.drop-zone {
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 2rem 1rem;
    text-align: center;
    cursor: pointer;
    background-color: rgba(7, 9, 14, 0.4);
    transition: all 0.2s ease;
}

.drop-zone.dragover { border-color: var(--accent); background: rgba(56,189,248,0.05); }
.drop-icon { margin-bottom: 0.5rem; display: flex; justify-content: center; }
.drop-zone p { font-size: 0.9rem; font-weight: 500; margin-bottom: 0.25rem; }
.drop-zone span { font-size: 0.78rem; color: var(--text-muted); }

.file-preview-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem;
    margin-top: 1rem;
}

.file-icon-box {
    background: rgba(56, 189, 248, 0.1);
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    flex-shrink: 0;
}

.file-details { overflow: hidden; }
.file-details h4 { font-size: 0.9rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-main); }
.file-details span { font-size: 0.78rem; color: var(--text-muted); }

/* Progress Bar */
.progress-container { margin-top: 1.25rem; }
.progress-info { display: flex; justify-content: space-between; font-size: 0.82rem; color: var(--text-muted); margin-bottom: 0.4rem; }
.progress-bar-bg { width: 100%; height: 10px; background: var(--bg-input); border-radius: 5px; overflow: hidden; border: 1px solid var(--border); }
.progress-bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--success)); width: 0%; transition: width 0.1s linear; border-radius: 4px; }

/* Chat Messaging Styles */
#textChatCard {
    display: flex;
    flex-direction: column;
}

.chat-messages {
    height: 220px;
    overflow-y: auto;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-bottom: 0.75rem;
    scroll-behavior: smooth;
}

.chat-bubble {
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    font-size: 0.85rem;
    max-width: 80%;
    word-break: break-word;
}

.chat-bubble.received {
    background: var(--border);
    color: var(--text-main);
    align-self: flex-start;
}

.chat-bubble.sent {
    background: var(--accent);
    color: var(--bg-main);
    align-self: flex-end;
    font-weight: 500;
}

.chat-input-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
}

.chat-input-bar input[type="text"] {
    flex: 1;
    margin-bottom: 0;
    border-radius: 10px;
    padding: 0.75rem 0.9rem;
    font-size: 0.9rem;
    height: 44px;
}

.chat-input-bar .btn-send-chat {
    width: 76px;
    min-width: 76px;
    max-width: 76px;
    height: 44px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-size: 0.9rem;
    flex-shrink: 0;
}

/* Status Badges */
.status-badge {
    padding: 0.3rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
}

.status-disconnected { background: rgba(239, 68, 68, 0.15); color: var(--error); border: 1px solid rgba(239, 68, 68, 0.3); }
.status-connected { background: rgba(16, 185, 129, 0.15); color: var(--success); border: 1px solid rgba(16, 185, 129, 0.3); }
.status-gathering { background: rgba(56, 189, 248, 0.15); color: var(--accent); border: 1px solid rgba(56, 189, 248, 0.3); }

.flex-row { display: flex; gap: 0.75rem; }
.flex-row > * { flex: 1; }
.badge-row { display: flex; justify-content: space-between; align-items: center; }
.status-label { font-size: 0.85rem; color: var(--text-muted); font-weight: 500; }

@media (min-width: 480px) {
    .input-group { flex-direction: row; }
    .input-group textarea { margin-bottom: 0; }
    .input-group .btn { width: 120px; flex-shrink: 0; }
}

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