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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, #0a0a0f 0%, #1a1a2e 50%, #0f0f1a 100%);
    min-height: 100vh;
    color: #fff;
}

.app {
    max-width: 500px;
    margin: 0 auto;
    padding: 40px 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 40px;
}

h1 {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, #ff6b6b, #feca57, #ff9ff3);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}

.tagline {
    color: #888;
    font-size: 1rem;
}

/* Main */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Steps */
.step {
    display: none;
    animation: fadeIn 0.3s ease;
}

.step.active, .step:not(.hidden) {
    display: block;
}

.step.hidden {
    display: none !important;
}

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

/* Record Button */
.record-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 0;
}

.record-btn {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: linear-gradient(135deg, #333, #222);
    border: 4px solid #444;
    cursor: pointer;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.record-btn:hover {
    transform: scale(1.05);
    border-color: #ff6b6b;
}

.record-btn.recording {
    border-color: #ff6b6b;
    background: linear-gradient(135deg, #ff6b6b, #ee5a5a);
}

.record-icon {
    width: 50px;
    height: 50px;
    background: #ff6b6b;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.record-btn.recording .record-icon {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    background: #fff;
}

.pulse-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 3px solid #ff6b6b;
    opacity: 0;
}

.record-btn.recording .pulse-ring {
    animation: pulse 1.5s ease-out infinite;
}

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

.record-label {
    margin-top: 20px;
    font-size: 1.1rem;
    color: #888;
}

.timer {
    font-size: 3rem;
    font-weight: 300;
    font-family: monospace;
    color: #ff6b6b;
    margin-top: 20px;
    opacity: 0;
    transition: opacity 0.3s;
}

.timer.visible {
    opacity: 1;
}

/* Waveform */
.waveform {
    width: 100%;
    height: 60px;
    margin-top: 20px;
    opacity: 0;
    transition: opacity 0.3s;
}

.waveform.visible {
    opacity: 1;
}

/* Playback */
.playback {
    margin-top: 30px;
    text-align: center;
}

.playback audio {
    width: 100%;
    margin-bottom: 20px;
}

.playback-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* Buttons */
.btn {
    padding: 14px 28px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-primary {
    background: linear-gradient(135deg, #ff6b6b, #ee5a5a);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(255, 107, 107, 0.3);
}

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

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.15);
}

.btn-large {
    padding: 18px 36px;
    font-size: 1.1rem;
}

.btn-link {
    background: none;
    border: none;
    color: #888;
    font-size: 0.9rem;
    cursor: pointer;
    text-decoration: underline;
}

.btn-link:hover {
    color: #fff;
}

/* Genre Selection */
.step-genre h2 {
    text-align: center;
    margin-bottom: 30px;
    font-size: 1.5rem;
}

.genre-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 30px;
}

.genre-card {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 24px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.genre-card:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-4px);
}

.genre-card.selected {
    background: rgba(255, 107, 107, 0.2);
    border-color: #ff6b6b;
}

.genre-icon {
    font-size: 2rem;
}

.genre-name {
    font-size: 0.9rem;
    color: #ccc;
}

.advanced-toggle {
    text-align: center;
    margin-bottom: 20px;
}

.advanced-input {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.advanced-input input {
    flex: 1;
    padding: 14px 16px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.3);
    color: white;
    font-size: 1rem;
}

.advanced-input input:focus {
    outline: none;
    border-color: #ff6b6b;
}

.back-btn {
    display: block;
    margin: 20px auto 0;
}

/* Processing */
.step-processing {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
}

.processing-container {
    text-align: center;
}

.processing-spinner {
    width: 80px;
    height: 80px;
    border: 4px solid rgba(255, 107, 107, 0.2);
    border-top-color: #ff6b6b;
    border-radius: 50%;
    margin: 0 auto 30px;
    animation: spin 1s linear infinite;
}

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

.processing-container h2 {
    margin-bottom: 30px;
    font-weight: 500;
}

.processing-stages {
    text-align: left;
    display: inline-block;
}

.stage {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    color: #666;
    transition: color 0.3s;
}

.stage.active {
    color: #ff6b6b;
}

.stage.done {
    color: #4ecdc4;
}

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

.stage.done .stage-icon::after {
    content: "✓";
}

.stage.active .stage-icon::after {
    content: "●";
}

.stage:not(.active):not(.done) .stage-icon::after {
    content: "○";
}

/* Result */
.step-result {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
}

.result-container {
    text-align: center;
    width: 100%;
}

.result-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    animation: bounce 0.5s ease;
}

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

.result-container h2 {
    margin-bottom: 30px;
    font-weight: 500;
}

.result-container audio {
    width: 100%;
    margin-bottom: 30px;
}

.result-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

/* Error */
.error {
    background: rgba(255, 0, 0, 0.1);
    border: 1px solid rgba(255, 0, 0, 0.3);
    color: #ff6b6b;
    padding: 15px 20px;
    border-radius: 12px;
    margin-top: 20px;
    text-align: center;
}

/* Footer */
footer {
    text-align: center;
    padding: 30px 0;
    color: #444;
    font-size: 0.85rem;
}

/* Utilities */
.hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 400px) {
    .genre-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    h1 {
        font-size: 2rem;
    }

    .record-btn {
        width: 120px;
        height: 120px;
    }

    .record-icon {
        width: 40px;
        height: 40px;
    }
}

/* Credits Badge */
.credits-badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.1);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    margin-top: 12px;
    color: #feca57;
}

/* Paywall */
.paywall-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.paywall-modal {
    background: linear-gradient(135deg, #1a1a2e, #2a2a4e);
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    max-width: 400px;
    margin: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.paywall-modal h2 {
    font-size: 1.8rem;
    margin-bottom: 16px;
    background: linear-gradient(135deg, #ff6b6b, #feca57);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.paywall-modal p {
    color: #ccc;
    margin-bottom: 24px;
    font-size: 1.1rem;
}

.paywall-modal .btn-large {
    padding: 16px 40px;
    font-size: 1.2rem;
}

.paywall-value {
    color: #888 !important;
    font-size: 0.9rem !important;
    margin-top: 16px !important;
    margin-bottom: 0 !important;
}

/* Login Screen */
.login-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(180deg, #1a1028 0%, #0d0a1a 50%, #15102a 100%);
    z-index: 100;
    overflow-y: auto;
}

.login-screen.hidden {
    display: none;
}

.login-overlay {
    display: none;
}

.login-container {
    text-align: center;
    max-width: 400px;
    width: 100%;
    position: relative;
    z-index: 1;
    padding: 20px 0 40px;
}

.login-container h1 {
    font-size: 2.5rem;
    margin-bottom: 12px;
}

.hero-headline {
    font-size: 1.3rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 8px;
    line-height: 1.3;
}

.hero-headline span {
    background: linear-gradient(135deg, #ff6b6b, #feca57);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-tagline {
    font-size: 1rem;
    color: #aaa;
    margin-bottom: 20px;
}

.before-after {
    margin-bottom: 24px;
}

.before-after img {
    max-width: 100%;
    max-height: 200px;
    width: auto;
    height: auto;
    border-radius: 12px;
    border: 2px solid rgba(255, 255, 255, 0.15);
    object-fit: contain;
}

.btn-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 32px;
    background: linear-gradient(135deg, #ff6b6b, #ee5a5a);
    color: #fff;
    border: none;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    width: 100%;
}

.btn-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 40px rgba(255, 107, 107, 0.4);
}

.btn-cta svg {
    background: #fff;
    padding: 4px;
    border-radius: 4px;
}

.login-note {
    color: #888;
    font-size: 0.85rem;
    margin-top: 16px;
}

.login-note strong {
    color: #feca57;
}

/* Auth Form */
.auth-form {
    max-width: 320px;
    margin: 0 auto 24px;
}

.auth-title {
    font-size: 1.1rem;
    font-weight: 500;
    color: #fff;
    margin-bottom: 16px;
}

.auth-input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.3);
    color: #fff;
    font-size: 1rem;
    margin-bottom: 10px;
    transition: border-color 0.2s;
}

.auth-input:focus {
    outline: none;
    border-color: #ff6b6b;
}

.auth-input::placeholder {
    color: #666;
}

.auth-error {
    color: #ff6b6b;
    font-size: 0.9rem;
    margin-top: 8px;
    margin-bottom: 8px;
}

.auth-toggle {
    margin-top: 16px;
    color: #888;
    font-size: 0.9rem;
}

.auth-toggle .btn-link {
    color: #feca57;
    text-decoration: none;
    font-weight: 600;
}

.auth-toggle .btn-link:hover {
    text-decoration: underline;
}

.auth-divider {
    display: flex;
    align-items: center;
    margin: 16px auto;
    max-width: 320px;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.15);
}

.auth-divider span {
    padding: 0 16px;
    color: #666;
    font-size: 0.9rem;
}

.btn-google {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px 32px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 50px;
    color: #fff;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-google:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.25);
}

.btn-google svg {
    background: none;
    padding: 0;
}

.sign-out-btn {
    margin-top: 16px;
    color: #666;
    font-size: 0.85rem;
}

#app-content.hidden {
    display: none;
}
