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

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #64748b;
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --success: #22c55e;
    --error: #ef4444;
    --border: #334155;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

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

.logo {
    font-size: 3rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.logo img {
    height: 48px;
    width: auto;
    border-radius: 50%;
}

.tagline {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-top: 0.5rem;
}

/* Video Container */
.video-container {
    position: relative;
    background: var(--bg-card);
    border-radius: 16px;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    border: 1px solid var(--border);
}

#video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #000;
}

.welcome-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 10;
}

.welcome-canvas.active {
    opacity: 1;
}

.status-indicator {
    position: absolute;
    top: 1rem;
    left: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(0, 0, 0, 0.7);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.875rem;
}

.status-indicator .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--secondary);
}

.status-indicator.active .dot {
    background: var(--success);
    animation: pulse 2s infinite;
}

.status-indicator.analyzing .dot {
    background: var(--primary);
    animation: pulse 0.5s infinite;
}

.status-indicator.error .dot {
    background: var(--error);
}

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

/* Controls */
.controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin: 1.5rem 0;
}

.btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--border);
}

.btn-tts {
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-tts:hover {
    border-color: var(--primary);
    color: var(--text-primary);
}

.btn-tts.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.btn-tts .icon {
    font-size: 1.1rem;
}

.btn-stop-speak {
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-stop-speak:hover:not(:disabled) {
    border-color: var(--error);
    color: var(--error);
}

.btn-stop-speak:disabled {
    opacity: 0.4;
}

/* Description Panel */
.description-panel {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 1.5rem;
    border: 1px solid var(--border);
}

.description-panel h2 {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.description-text {
    font-size: 1.25rem;
    line-height: 1.8;
    min-height: 80px;
}

.description-text .placeholder {
    color: var(--text-secondary);
    font-style: italic;
}

.description-text .current {
    color: var(--text-primary);
    animation: fadeIn 0.3s ease;
}

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

/* History */
.description-history {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.description-history h3 {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

#historyList {
    list-style: none;
    max-height: 200px;
    overflow-y: auto;
}

#historyList li {
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: var(--bg-dark);
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    display: flex;
    gap: 0.75rem;
}

#historyList li .time {
    color: var(--primary);
    font-weight: 500;
    white-space: nowrap;
}

/* Settings */
.settings {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-top: 1.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.setting-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.settings select {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    max-width: 180px;
}

.settings select:hover {
    border-color: var(--primary);
}

/* Footer */
footer {
    text-align: center;
    margin-top: 3rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Loading Animation */
.loading {
    display: inline-flex;
    gap: 4px;
}

.loading span {
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

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

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Responsive */
@media (max-width: 640px) {
    .container {
        padding: 1rem;
    }

    .logo {
        font-size: 2.5rem;
    }

    .controls {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .description-text {
        font-size: 1.1rem;
    }
}
