:root {
    --bg-color: #0b0f19;
    --panel-bg: rgba(20, 27, 45, 0.6);
    --panel-border: rgba(255, 255, 255, 0.08);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-color: #3b82f6;
    --accent-glow: #60a5fa;
    --danger-color: #ef4444;
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(59, 130, 246, 0.15), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(139, 92, 246, 0.15), transparent 25%);
    background-attachment: fixed;
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.app-container {
    width: 100%;
    max-width: 1100px;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

header {
    text-align: center;
}

h1 {
    font-size: 3rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
}

.gradient-text {
    background: linear-gradient(135deg, #60a5fa, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

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

@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
    }
}

.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--panel-border);
    border-radius: 24px;
    padding: 2rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Camera Section */
.camera-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 4/3;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 1px solid var(--panel-border);
}

#webcam-container canvas {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
    border-radius: 16px;
}

.status-overlay {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(8px);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.status-overlay.active {
    background: rgba(59, 130, 246, 0.8);
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.5);
}

.controls {
    display: flex;
    gap: 1rem;
}

/* Buttons */
.btn {
    padding: 0.8rem 1.5rem;
    border-radius: 12px;
    font-family: inherit;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

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

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

.btn-primary:hover:not(:disabled) {
    background: #2563eb;
    transform: translateY(-2px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    flex: 1;
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.15);
}

.btn-icon {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger-color);
    border-color: rgba(239, 68, 68, 0.3);
}

.btn-glow {
    width: 100%;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: white;
    padding: 1rem;
    font-size: 1.1rem;
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.4);
    position: relative;
    overflow: hidden;
    margin-top: 1rem;
}

.btn-glow::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(45deg);
    animation: shine 3s infinite;
}

@keyframes shine {
    0% { transform: translateX(-100%) rotate(45deg); }
    100% { transform: translateX(100%) rotate(45deg); }
}

.btn-glow:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 30px rgba(139, 92, 246, 0.6);
}

/* Translation Section */
h2, h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
}

.detected-sequence-container {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    padding: 1rem;
    min-height: 80px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.word-sequence {
    font-size: 1.5rem;
    font-weight: 600;
    color: white;
    letter-spacing: 2px;
}

.sequence-controls {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.result-container {
    background: rgba(59, 130, 246, 0.05);
    border-radius: 16px;
    padding: 1.5rem;
    border: 1px solid rgba(59, 130, 246, 0.2);
    min-height: 120px;
    margin-top: auto;
}

.gemini-result {
    margin-top: 1rem;
    font-size: 1.2rem;
    line-height: 1.6;
}

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

/* Animations */
@keyframes popIn {
    0% { transform: scale(0.8); opacity: 0; }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

.new-letter {
    display: inline-block;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    color: var(--accent-glow);
}

.loading-dots::after {
    content: '.';
    animation: dots 1.5s steps(5, end) infinite;
}

@keyframes dots {
    0%, 20% { color: transparent; text-shadow: .25em 0 0 transparent, .5em 0 0 transparent; }
    40% { color: white; text-shadow: .25em 0 0 transparent, .5em 0 0 transparent; }
    60% { text-shadow: .25em 0 0 white, .5em 0 0 transparent; }
    80%, 100% { text-shadow: .25em 0 0 white, .5em 0 0 white; }
}
