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

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --accent: #22d3ee;
    --bg-dark: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.8);
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border: rgba(148, 163, 184, 0.1);
    --success: #22c55e;
    --error: #ef4444;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-dark);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: var(--text-primary);
    position: relative;
    overflow-x: hidden;
}

/* Animated interference background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(ellipse at 20% 20%, rgba(99, 102, 241, 0.12) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(34, 211, 238, 0.08) 0%, transparent 50%);
    z-index: -2;
}

/* Interference wave patterns */
.interference-bg {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: -1;
    overflow: hidden;
    opacity: 0.6;
}

.wave {
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(99, 102, 241, 0.15);
    animation: ripple 8s linear infinite;
}

.wave:nth-child(1) {
    width: 600px;
    height: 600px;
    top: 10%;
    left: -10%;
    animation-delay: 0s;
    border-color: rgba(99, 102, 241, 0.12);
}

.wave:nth-child(2) {
    width: 800px;
    height: 800px;
    top: 5%;
    left: -15%;
    animation-delay: -2s;
    border-color: rgba(99, 102, 241, 0.08);
}

.wave:nth-child(3) {
    width: 500px;
    height: 500px;
    bottom: 10%;
    right: -10%;
    animation-delay: -1s;
    border-color: rgba(34, 211, 238, 0.12);
}

.wave:nth-child(4) {
    width: 700px;
    height: 700px;
    bottom: 5%;
    right: -15%;
    animation-delay: -3s;
    border-color: rgba(34, 211, 238, 0.08);
}

.wave:nth-child(5) {
    width: 400px;
    height: 400px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -4s;
    border-color: rgba(139, 92, 246, 0.1);
}

@keyframes ripple {
    0% {
        transform: scale(0.8);
        opacity: 1;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

/* Signal noise lines */
.noise-line {
    position: absolute;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(99, 102, 241, 0.3) 20%, 
        rgba(34, 211, 238, 0.2) 40%,
        transparent 60%,
        rgba(239, 68, 68, 0.15) 80%,
        transparent 100%
    );
    animation: scanline 4s ease-in-out infinite;
}

.noise-line:nth-child(6) {
    top: 20%;
    left: 0;
    right: 0;
    animation-delay: 0s;
}

.noise-line:nth-child(7) {
    top: 45%;
    left: 0;
    right: 0;
    animation-delay: -1.5s;
}

.noise-line:nth-child(8) {
    top: 70%;
    left: 0;
    right: 0;
    animation-delay: -3s;
}

@keyframes scanline {
    0%, 100% {
        opacity: 0;
        transform: scaleX(0.5);
    }
    50% {
        opacity: 1;
        transform: scaleX(1);
    }
}

/* Glitch flicker effect */
.glitch-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: transparent;
    animation: glitch 10s step-end infinite;
    pointer-events: none;
}

@keyframes glitch {
    0%, 95%, 100% {
        background: transparent;
    }
    96% {
        background: rgba(99, 102, 241, 0.02);
    }
    97% {
        background: rgba(239, 68, 68, 0.015);
    }
    98% {
        background: transparent;
    }
    99% {
        background: rgba(34, 211, 238, 0.02);
    }
}

/* Floating signal dots */
.signal-dot {
    position: absolute;
    width: 4px;
    height: 4px;
    background: rgba(99, 102, 241, 0.4);
    border-radius: 50%;
    animation: float 6s ease-in-out infinite;
}

.signal-dot:nth-child(9) {
    top: 15%;
    left: 20%;
    animation-delay: 0s;
}

.signal-dot:nth-child(10) {
    top: 30%;
    right: 25%;
    animation-delay: -1s;
    background: rgba(34, 211, 238, 0.4);
}

.signal-dot:nth-child(11) {
    bottom: 25%;
    left: 30%;
    animation-delay: -2s;
}

.signal-dot:nth-child(12) {
    bottom: 35%;
    right: 15%;
    animation-delay: -3s;
    background: rgba(34, 211, 238, 0.4);
}

.signal-dot:nth-child(13) {
    top: 60%;
    left: 10%;
    animation-delay: -4s;
    background: rgba(239, 68, 68, 0.3);
}

@keyframes float {
    0%, 100% {
        transform: translateY(0) scale(1);
        opacity: 0.4;
    }
    50% {
        transform: translateY(-20px) scale(1.5);
        opacity: 0.8;
    }
}

.upload-container {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 40px;
    max-width: 600px;
    width: 100%;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

/* Header */
.app-header {
    text-align: center;
    margin-bottom: 32px;
}

.logo-section {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 8px;
}

.logo-icon {
    font-size: 2.5rem;
    filter: drop-shadow(0 0 20px rgba(99, 102, 241, 0.5));
}

.logo-text {
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.logo-text h1 {
    font-size: 2.2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-light), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.version-badge {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent);
    background: rgba(34, 211, 238, 0.1);
    padding: 4px 10px;
    border-radius: 20px;
    border: 1px solid rgba(34, 211, 238, 0.3);
}

.tagline {
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 400;
}

/* Upload Area */
.upload-area {
    border: 2px dashed rgba(99, 102, 241, 0.4);
    border-radius: 16px;
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(99, 102, 241, 0.03);
    margin-bottom: 20px;
}

.upload-area:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.08);
    transform: translateY(-2px);
}

.upload-area.dragover {
    border-color: var(--accent);
    background: rgba(34, 211, 238, 0.1);
    border-style: solid;
}

.upload-icon {
    color: var(--primary-light);
    margin-bottom: 16px;
}

.upload-text {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.upload-subtext {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

#fileInput {
    display: none;
}

/* File List */
.file-list {
    margin: 16px 0;
}

.station-summary {
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
}

.station-summary h4 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--primary-light);
    margin-bottom: 12px;
}

.station-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid rgba(99, 102, 241, 0.1);
}

.station-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.station-label {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-primary);
    font-family: 'SF Mono', 'Monaco', monospace;
}

.station-details {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.file-badge {
    font-size: 0.7rem;
    padding: 3px 8px;
    border-radius: 6px;
    font-weight: 500;
}

.file-badge.obs {
    background: rgba(99, 102, 241, 0.2);
    color: var(--primary-light);
}

.file-badge.nav {
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
}

.hours-badge {
    font-size: 0.7rem;
    padding: 3px 8px;
    border-radius: 6px;
    background: rgba(34, 211, 238, 0.15);
    color: var(--accent);
    font-weight: 500;
}

.station-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(99, 102, 241, 0.2);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 4px;
}

.station-chip .count {
    background: var(--primary);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
}

/* More files indicator */
.file-item.more-indicator {
    background: transparent;
    border: 1px dashed var(--border);
    justify-content: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
    padding: 10px;
}

.file-item {
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}

.file-item:hover {
    background: rgba(30, 41, 59, 0.9);
    border-color: rgba(99, 102, 241, 0.3);
}

.file-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

.file-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.file-icon {
    font-size: 1.2rem;
}

.file-name {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.marker-badge {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.file-meta {
    display: flex;
    gap: 12px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    flex-wrap: wrap;
}

.file-meta .file-type {
    color: var(--primary-light);
}

.file-meta .file-size {
    color: var(--text-secondary);
}

.remove-file {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #f87171;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.remove-file:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
}

/* Options Panel */
.options-panel {
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
}

.options-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.options-icon {
    font-size: 1.2rem;
}

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

.option-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.option-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.option-toggle input {
    display: none;
}

.toggle-slider {
    width: 40px;
    height: 22px;
    background: rgba(148, 163, 184, 0.3);
    border-radius: 11px;
    position: relative;
    transition: background 0.3s ease;
}

.toggle-slider::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    top: 3px;
    left: 3px;
    transition: transform 0.3s ease;
}

.option-toggle input:checked + .toggle-slider {
    background: var(--primary);
}

.option-toggle input:checked + .toggle-slider::after {
    transform: translateX(18px);
}

.toggle-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.rate-select {
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    outline: none;
}

.rate-select:focus {
    border-color: var(--primary);
}

/* Libraries Section */
.libraries-section {
    margin-top: 8px;
}

.libraries-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.libraries-hint {
    font-size: 0.75rem;
    color: var(--text-secondary);
    opacity: 0.7;
}

.libraries-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.library-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.library-option:hover {
    background: rgba(30, 41, 59, 0.8);
    border-color: rgba(99, 102, 241, 0.3);
}

.library-option input {
    display: none;
}

.library-checkbox {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(148, 163, 184, 0.4);
    border-radius: 4px;
    position: relative;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.library-option input:checked + .library-checkbox {
    background: var(--primary);
    border-color: var(--primary);
}

.library-option input:checked + .library-checkbox::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.library-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.library-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.library-desc {
    font-size: 0.7rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.library-error {
    margin-top: 10px;
    padding: 8px 12px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    color: var(--error);
    font-size: 0.85rem;
    text-align: center;
}

/* Progress */
.progress-container {
    margin: 20px 0;
    display: none;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(148, 163, 184, 0.2);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 3px;
}

.progress-text {
    display: block;
    text-align: center;
    margin-top: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Status Message */
#statusMessage {
    text-align: center;
    padding: 12px;
    border-radius: 10px;
    margin: 16px 0;
    font-weight: 500;
    display: none;
}

#statusMessage.info {
    display: block;
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-light);
    border: 1px solid rgba(99, 102, 241, 0.3);
}

#statusMessage.success {
    display: block;
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

#statusMessage.error {
    display: block;
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Upload Button */
.upload-btn {
    width: 100%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    padding: 16px 32px;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.3);
}

.upload-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(99, 102, 241, 0.4);
}

.upload-btn:disabled {
    background: rgba(148, 163, 184, 0.2);
    color: var(--text-secondary);
    cursor: not-allowed;
    box-shadow: none;
}

.btn-icon {
    font-size: 0.9rem;
}

/* Features Grid */
.features-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 32px;
}

.feature-card {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px;
    background: rgba(30, 41, 59, 0.4);
    border: 1px solid var(--border);
    border-radius: 12px;
    transition: all 0.2s ease;
}

.feature-card:hover {
    background: rgba(30, 41, 59, 0.6);
    border-color: rgba(99, 102, 241, 0.2);
}

.feature-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.feature-content h4 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.feature-content p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Footer */
.app-footer {
    text-align: center;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.5px;
}

/* Responsive */
@media (max-width: 640px) {
    .upload-container {
        padding: 24px;
        margin: 10px;
    }
    
    .logo-text h1 {
        font-size: 1.8rem;
    }
    
    .upload-area {
        padding: 32px 16px;
    }
    
    .options-panel {
        flex-direction: column;
        gap: 12px;
    }
}

/* Time info badge */
.time-info {
    background: rgba(34, 211, 238, 0.1);
    color: var(--accent);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
}

.file-year {
    color: var(--primary-light);
    font-weight: 500;
}