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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #050510 0%, #0a0a1a 50%, #0d0d20 100%);
    color: #e2e8f0;
    min-height: 100vh;
    overflow-x: hidden;
}

.app-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
    min-height: 100vh;
}

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

header h1 {
    font-size: 2.5rem;
    font-weight: 300;
    letter-spacing: 0.3em;
    background: linear-gradient(90deg, #00d4ff, #ff6b9d);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-transform: uppercase;
}

header p {
    color: #64748b;
    font-size: 0.9rem;
    letter-spacing: 0.1em;
}

/* Main Content */
.main-content {
    display: flex;
    gap: 1.5rem;
    width: 100%;
    max-width: 1200px;
    flex: 1;
    align-items: flex-start;
}

/* DNA Section - Main focus */
.dna-section {
    flex: 1;
    position: relative;
    background: rgba(10, 10, 26, 0.8);
    border-radius: 1rem;
    overflow: hidden;
    border: 1px solid rgba(0, 212, 255, 0.1);
    box-shadow:
        0 0 60px rgba(0, 212, 255, 0.1),
        inset 0 0 60px rgba(0, 0, 0, 0.5);
}

#dnaCanvas {
    width: 100%;
    height: 500px;
    display: block;
}

.zoom-indicator {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    background: rgba(0, 0, 0, 0.6);
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.zoom-label {
    font-size: 0.75rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.zoom-value {
    font-size: 1rem;
    font-weight: 600;
    color: #00d4ff;
    font-family: 'Courier New', monospace;
}

/* Feature Indicators */
.feature-indicators {
    position: absolute;
    top: 1rem;
    left: 1rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.indicator {
    padding: 0.35rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(0, 0, 0, 0.6);
    color: #64748b;
    border: 1px solid rgba(100, 116, 139, 0.3);
    transition: all 0.3s ease;
}

.indicator.active {
    background: rgba(0, 212, 255, 0.2);
    color: #00d4ff;
    border-color: rgba(0, 212, 255, 0.5);
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.3);
}


/* Base Pair Info Popup */
.base-pair-info {
    position: absolute;
    bottom: 4rem;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(0, 0, 0, 0.85);
    padding: 0.75rem 1.25rem;
    border-radius: 0.75rem;
    border: 1px solid rgba(0, 212, 255, 0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 10;
}

.base-pair-info.visible {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.base-pair-info strong {
    font-size: 1.5rem;
    color: #00d4ff;
    font-family: 'Courier New', monospace;
}

.base-pair-info span {
    font-size: 0.8rem;
    color: #94a3b8;
}

/* Gesture Feedback */
.gesture-feedback {
    position: fixed;
    top: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: rgba(0, 0, 0, 0.85);
    padding: 0.75rem 1.5rem;
    border-radius: 2rem;
    font-size: 1rem;
    font-weight: 600;
    color: #00d4ff;
    border: 1px solid rgba(0, 212, 255, 0.3);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 200;
}

.gesture-feedback.visible {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.gesture-feedback.success {
    color: #22c55e;
    border-color: rgba(34, 197, 94, 0.5);
    box-shadow: 0 0 20px rgba(34, 197, 94, 0.3);
}

.gesture-feedback.error {
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.5);
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.3);
}

/* Tracking Section - Side panel */
.tracking-section {
    width: 320px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.video-container {
    position: relative;
    width: 100%;
    aspect-ratio: 4/3;
    border-radius: 0.75rem;
    overflow: hidden;
    background: #0f172a;
    border: 1px solid rgba(100, 116, 139, 0.2);
}

#video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
}

#handCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: scaleX(-1);
    pointer-events: none;
}

/* Status Panel */
.status-panel {
    background: rgba(30, 41, 59, 0.6);
    border-radius: 0.75rem;
    padding: 0.75rem;
    border: 1px solid rgba(100, 116, 139, 0.2);
}

.status-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 0.5rem;
}

.status-row:not(:last-child) {
    border-bottom: 1px solid rgba(100, 116, 139, 0.1);
}

.status-row .label {
    font-size: 0.8rem;
    color: #64748b;
}

.status-row .value {
    font-size: 0.85rem;
    font-weight: 600;
}

.status-row .value.active {
    color: #22c55e;
}

.status-row .value.inactive {
    color: #ef4444;
}

.status-row .value.gesture {
    color: #00d4ff;
}

.status-row .value.active-gesture {
    color: #22c55e;
    animation: pulse 1s ease infinite;
}

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

/* Start Button */
.start-button {
    width: 100%;
    padding: 0.875rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, #00d4ff 0%, #0099cc 100%);
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.start-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 212, 255, 0.4);
}

.start-button:disabled {
    background: #475569;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.start-button.running {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
}

/* Instructions */
.instructions {
    background: rgba(30, 41, 59, 0.6);
    border-radius: 0.75rem;
    padding: 1rem;
    border: 1px solid rgba(100, 116, 139, 0.2);
}

.instructions h2 {
    font-size: 0.8rem;
    color: #94a3b8;
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.gesture-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

.gesture-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 0.5rem;
    border: 1px solid rgba(100, 116, 139, 0.1);
    text-align: center;
}

.gesture-emoji {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.gesture-item > span:nth-child(2) {
    font-size: 0.7rem;
    color: #94a3b8;
}

.gesture-action {
    font-size: 0.65rem;
    color: #00d4ff;
    font-weight: 600;
    text-transform: uppercase;
    margin-top: 0.15rem;
}

.instructions .tip {
    font-size: 0.65rem;
    color: #475569;
    font-style: italic;
    margin-top: 0.75rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(100, 116, 139, 0.1);
    text-align: center;
}

/* Legend */
.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    justify-content: center;
    margin-top: 1rem;
    padding: 0.75rem 1.5rem;
    background: rgba(30, 41, 59, 0.4);
    border-radius: 2rem;
    border: 1px solid rgba(100, 116, 139, 0.1);
}

.legend-title {
    font-size: 0.75rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.legend-item {
    font-size: 0.8rem;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    background: rgba(0, 0, 0, 0.3);
}

.legend-item.adenine { color: #22c55e; border: 1px solid rgba(34, 197, 94, 0.3); }
.legend-item.thymine { color: #ef4444; border: 1px solid rgba(239, 68, 68, 0.3); }
.legend-item.guanine { color: #fbbf24; border: 1px solid rgba(251, 191, 36, 0.3); }
.legend-item.cytosine { color: #8b5cf6; border: 1px solid rgba(139, 92, 246, 0.3); }

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: linear-gradient(135deg, #1e293b, #0f172a);
    padding: 2.5rem;
    border-radius: 1rem;
    text-align: center;
    max-width: 350px;
    border: 1px solid rgba(0, 212, 255, 0.2);
    box-shadow: 0 0 40px rgba(0, 212, 255, 0.1);
}

.modal-content h2 {
    color: #e2e8f0;
    font-size: 1.25rem;
    font-weight: 400;
    letter-spacing: 0.1em;
}

.modal-content p {
    color: #94a3b8;
    font-size: 0.9rem;
}

.modal-content .small {
    font-size: 0.75rem;
    color: #64748b;
    margin-top: 0.5rem;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(0, 212, 255, 0.1);
    border-top-color: #00d4ff;
    border-radius: 50%;
    margin: 1.5rem auto;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 900px) {
    .main-content {
        flex-direction: column;
    }

    .dna-section {
        width: 100%;
    }

    #dnaCanvas {
        height: 400px;
    }

    .tracking-section {
        width: 100%;
        max-width: 400px;
    }

    .legend {
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.8rem;
        letter-spacing: 0.2em;
    }

    #dnaCanvas {
        height: 300px;
    }

    .legend {
        padding: 0.5rem 1rem;
        gap: 0.5rem;
    }

    .legend-item {
        font-size: 0.7rem;
        padding: 0.2rem 0.5rem;
    }
}
