:root {
    --bg-primary: #0d0d14;
    --bg-secondary: #15151f;
    --bg-card: rgba(30, 30, 45, 0.6);
    --accent-pink: #ff2d75;
    --accent-purple: #7c3aed;
    --accent-blue: #06b6d4;
    --text-primary: #f0f0f5;
    --text-secondary: #9898a8;
    --border-color: rgba(255, 255, 255, 0.08);
    --glass-blur: blur(12px);
}

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

body {
    font-family: 'Space Grotesk', system-ui, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(ellipse at 20% 20%, rgba(124, 58, 237, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(255, 45, 117, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(6, 182, 212, 0.05) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

.app-container {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-header {
    text-align: center;
    padding: 3rem 1rem 2rem;
    background: linear-gradient(135deg, var(--accent-pink) 0%, var(--accent-purple) 100%);
    -webkit-background-clip: text;
    background-clip: text;
}

.app-title {
    font-size: clamp(2.5rem, 6vw, 4rem);
    font-weight: 700;
    color: transparent;
    background: linear-gradient(135deg, var(--accent-pink) 0%, var(--accent-purple) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    text-shadow: 0 0 60px rgba(255, 45, 117, 0.3);
}

.app-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
    font-weight: 400;
}

.main-content {
    flex: 1;
    max-width: 700px;
    margin: 0 auto;
    padding: 2rem 1rem;
    width: 100%;
}

.error-banner {
    background: rgba(255, 45, 117, 0.15);
    border: 1px solid rgba(255, 45, 117, 0.3);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    backdrop-filter: var(--glass-blur);
}

.dismiss-btn {
    background: none;
    border: none;
    color: var(--accent-pink);
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.dismiss-btn:hover {
    opacity: 1;
}

.mode-selector {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.mode-card {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: var(--glass-blur);
    text-align: center;
}

.mode-card:hover {
    border-color: rgba(124, 58, 237, 0.5);
    transform: translateY(-2px);
}

.mode-card.selected {
    border-color: var(--accent-purple);
    box-shadow: 0 0 30px rgba(124, 58, 237, 0.3);
    transform: scale(1.02);
}

.mode-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
}

.mode-label {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.mode-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.control-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 2rem;
    text-align: center;
    backdrop-filter: var(--glass-blur);
    margin-bottom: 1.5rem;
}

.recording-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 45, 117, 0.2);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    margin-bottom: 1rem;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    color: var(--accent-pink);
}

.rec-dot {
    width: 10px;
    height: 10px;
    background: var(--accent-pink);
    border-radius: 50%;
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.2); }
}

.timer-display {
    font-family: 'JetBrains Mono', monospace;
    font-size: 3rem;
    font-weight: 600;
    color: var(--text-primary);
    text-shadow: 0 0 30px rgba(124, 58, 237, 0.4);
    margin-bottom: 1.5rem;
}

.max-time {
    font-size: 1.5rem;
    color: var(--text-secondary);
}

.button-row {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.record-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    background: linear-gradient(135deg, var(--accent-pink) 0%, #ff1a5c 100%);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 1rem 2.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(255, 45, 117, 0.4);
}

.record-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px rgba(255, 45, 117, 0.5);
}

.record-icon {
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    animation: recordPulse 2s ease-in-out infinite;
}

@keyframes recordPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

.stop-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    color: var(--accent-pink);
    border: 2px solid var(--accent-pink);
    border-radius: 50px;
    padding: 1rem 2.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
}

.stop-btn:hover {
    background: var(--accent-pink);
    color: white;
}

.stop-icon {
    width: 14px;
    height: 14px;
    background: currentColor;
    border-radius: 2px;
}

.processing-state {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-purple);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.settings-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0.5rem 1rem;
    margin: 0 auto 1rem;
    display: block;
    transition: color 0.2s;
}

.settings-toggle:hover {
    color: var(--text-primary);
}

.settings-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    backdrop-filter: var(--glass-blur);
    margin-bottom: 1.5rem;
}

.setting-item {
    margin-bottom: 1.25rem;
}

.setting-item:last-child {
    margin-bottom: 0;
}

.setting-item label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.slider {
    width: 100%;
    height: 6px;
    background: var(--bg-secondary);
    border-radius: 3px;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: linear-gradient(135deg, var(--accent-pink), var(--accent-purple));
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(124, 58, 237, 0.4);
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.select-input,
.number-input {
    width: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
}

.select-input:focus,
.number-input:focus {
    outline: none;
    border-color: var(--accent-purple);
}

.checkbox-item label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.checkbox-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-purple);
}

.preview-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    backdrop-filter: var(--glass-blur);
}

.progress-container {
    text-align: center;
    padding: 2rem 0;
}

.progress-bar {
    height: 8px;
    background: var(--bg-secondary);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

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

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

.preview-window {
    background: var(--bg-secondary);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.preview-gif {
    width: 100%;
    display: block;
    max-height: 400px;
    object-fit: contain;
}

.gif-info {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
}

.export-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
}

.download-btn {
    flex: 1;
    min-width: 200px;
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-pink));
    color: white;
    border: none;
    border-radius: 12px;
    padding: 1rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(124, 58, 237, 0.3);
}

.download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px rgba(124, 58, 237, 0.4);
}

.secondary-btn {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
}

.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent-purple);
}

.status-bar {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 0.75rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
}

.status-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.status-indicator.recording {
    background: var(--accent-pink);
    animation: pulse 1s ease-in-out infinite;
}

.status-indicator.processing {
    background: var(--accent-purple);
    animation: pulse 0.5s ease-in-out infinite;
}

.status-indicator.complete {
    background: #22c55e;
}

.status-text {
    color: var(--text-secondary);
    font-weight: 500;
}

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

.app-footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.footer-divider {
    opacity: 0.3;
}

.remix-link {
    color: var(--accent-pink);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.remix-link:hover {
    color: var(--accent-purple);
}

.footer-note {
    opacity: 0.7;
}

.countdown-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.countdown-number {
    font-size: 12rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 0 100px var(--accent-pink);
    animation: countdownPop 1s ease-out;
}

@keyframes countdownPop {
    0% { transform: scale(0.5); opacity: 0; }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}

.mobile-fallback,
.unsupported-browser {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
}

.mobile-content,
.unsupported-content {
    max-width: 400px;
}

.mobile-content h1,
.unsupported-content h1 {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.mobile-content h2,
.unsupported-content h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--accent-pink), var(--accent-purple));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.mobile-content p,
.unsupported-content p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    line-height: 1.6;
}

@media (max-width: 640px) {
    .mode-selector {
        grid-template-columns: 1fr;
    }
    
    .timer-display {
        font-size: 2.5rem;
    }
    
    .export-controls {
        flex-direction: column;
    }
    
    .download-btn,
    .secondary-btn {
        width: 100%;
    }
    
    .status-bar {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .tip-text {
        font-size: 0.8rem;
    }
}