:root {
    --bg-dark: #0a0a0f;
    --bg-panel: rgba(15, 15, 25, 0.85);
    --bg-input: rgba(25, 25, 40, 0.9);
    --accent-primary: #ff2d75;
    --accent-secondary: #00f5d4;
    --accent-tertiary: #7b2dff;
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.6);
    --border-color: rgba(255, 255, 255, 0.08);
    --shadow-glow: 0 0 60px rgba(255, 45, 117, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans SC', sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

.bg-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(rgba(255, 45, 117, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 45, 117, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    pointer-events: none;
    z-index: 0;
}

.bg-glow {
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background:
        radial-gradient(ellipse at 20% 20%, rgba(255, 45, 117, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(123, 45, 255, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(0, 245, 212, 0.05) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
    animation: glowMove 20s ease-in-out infinite;
}

@keyframes glowMove {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(2%, 2%) rotate(1deg); }
    66% { transform: translate(-1%, 1%) rotate(-1deg); }
}

.container {
    position: relative;
    z-index: 1;
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px 40px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 40px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 40px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 20px;
}

.logo-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-tertiary));
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 12px;
    position: relative;
    overflow: hidden;
}

.logo-icon::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent 40%, rgba(255,255,255,0.2));
}

.wave {
    width: 6px;
    height: 100%;
    background: linear-gradient(to top, #fff, rgba(255,255,255,0.3));
    border-radius: 3px;
    animation: wave 1s ease-in-out infinite;
}

.wave:nth-child(1) { animation-delay: 0s; height: 60%; }
.wave:nth-child(2) { animation-delay: 0.2s; height: 100%; }
.wave:nth-child(3) { animation-delay: 0.4s; height: 40%; }

@keyframes wave {
    0%, 100% { transform: scaleY(0.5); }
    50% { transform: scaleY(1); }
}

.logo-text h1 {
    font-family: 'Orbitron', monospace;
    font-size: 1.8rem;
    font-weight: 900;
    letter-spacing: 3px;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-text p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 4px;
    letter-spacing: 2px;
}

.api-key-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.api-key-section label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.api-key-section input {
    width: 280px;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: 'Noto Sans SC', sans-serif;
    transition: all 0.3s ease;
}

.api-key-section input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 20px rgba(255, 45, 117, 0.2);
}

.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    flex: 1;
}

.panel {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 32px;
    backdrop-filter: blur(20px);
    position: relative;
    overflow: hidden;
}

.panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent-primary), transparent);
    opacity: 0.5;
}

.panel-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 28px;
}

.panel-icon {
    font-size: 1.5rem;
}

.panel-header h2 {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 1px;
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 14px 18px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: 'Noto Sans SC', sans-serif;
    transition: all 0.3s ease;
    resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-secondary);
    box-shadow: 0 0 25px rgba(0, 245, 212, 0.15);
}

.form-group textarea {
    line-height: 1.8;
}

.audio-settings {
    margin-bottom: 28px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 16px;
    border: 1px solid var(--border-color);
}

.audio-settings h3 {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.setting-item label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.setting-item select {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: 'Noto Sans SC', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
}

.setting-item select:focus {
    outline: none;
    border-color: var(--accent-tertiary);
}

.lyrics-actions {
    margin-top: 12px;
    display: flex;
    justify-content: flex-end;
}

.secondary-btn {
    padding: 10px 18px;
    background: var(--bg-input);
    border: 1px solid var(--accent-secondary);
    border-radius: 8px;
    color: var(--accent-secondary);
    font-size: 0.85rem;
    font-family: 'Noto Sans SC', sans-serif;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
}

.secondary-btn:hover {
    background: rgba(0, 245, 212, 0.1);
    transform: translateY(-1px);
}

.secondary-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.secondary-btn.loading .btn-loader-inline {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(0, 245, 212, 0.3);
    border-top-color: var(--accent-secondary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.generate-btn {
    width: 100%;
    padding: 18px 32px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-tertiary));
    border: none;
    border-radius: 14px;
    color: white;
    font-size: 1.1rem;
    font-weight: 700;
    font-family: 'Noto Sans SC', sans-serif;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 8px 30px rgba(255, 45, 117, 0.4);
}

.generate-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

.generate-btn:hover::before {
    left: 100%;
}

.generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(255, 45, 117, 0.5);
}

.generate-btn:active {
    transform: translateY(0);
}

.generate-btn.loading {
    pointer-events: none;
}

.generate-btn.loading .btn-text,
.generate-btn.loading .btn-icon {
    opacity: 0;
}

.generate-btn .btn-loader {
    display: none;
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.generate-btn.loading .btn-loader {
    display: block;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.player-container {
    min-height: 280px;
    display: flex;
    flex-direction: column;
}

.player-placeholder {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    color: var(--text-secondary);
}

.placeholder-icon {
    font-size: 4rem;
    opacity: 0.3;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.player-placeholder p {
    font-size: 0.95rem;
}

.player-content {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.visualizer {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 6px;
    height: 80px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 16px;
    border: 1px solid var(--border-color);
}

.visualizer .bar {
    width: 8px;
    background: linear-gradient(to top, var(--accent-primary), var(--accent-secondary));
    border-radius: 4px;
    animation: visualize 1.2s ease-in-out infinite;
}

.bar:nth-child(1) { animation-delay: 0s; }
.bar:nth-child(2) { animation-delay: 0.1s; }
.bar:nth-child(3) { animation-delay: 0.2s; }
.bar:nth-child(4) { animation-delay: 0.3s; }
.bar:nth-child(5) { animation-delay: 0.4s; }
.bar:nth-child(6) { animation-delay: 0.5s; }
.bar:nth-child(7) { animation-delay: 0.6s; }
.bar:nth-child(8) { animation-delay: 0.7s; }
.bar:nth-child(9) { animation-delay: 0.8s; }
.bar:nth-child(10) { animation-delay: 0.9s; }
.bar:nth-child(11) { animation-delay: 1.0s; }
.bar:nth-child(12) { animation-delay: 1.1s; }

@keyframes visualize {
    0%, 100% { height: 20%; }
    50% { height: 100%; }
}

.track-info {
    text-align: center;
}

.track-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.track-status {
    font-size: 0.85rem;
    color: var(--accent-secondary);
}

.audio-controls {
    display: flex;
    justify-content: center;
}

.audio-controls audio {
    width: 100%;
    height: 50px;
    border-radius: 10px;
}

.audio-controls audio::-webkit-media-controls-panel {
    background: var(--bg-input);
}

.audio-url-display {
    margin-top: 16px;
    padding: 14px 16px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    border: 1px solid var(--border-color);
    display: block;
}

.audio-url-display label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.url-container {
    display: flex;
    gap: 8px;
}

.url-container input {
    flex: 1;
    padding: 10px 12px;
    background: #1a1a2e;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #00f5d4;
    font-size: 0.8rem;
    font-family: 'Noto Sans SC', sans-serif;
    width: 100%;
}

.url-container input:focus {
    outline: none;
    border-color: #00f5d4;
}

.copy-btn {
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.copy-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent-secondary);
}

.player-actions {
    display: flex;
    gap: 12px;
}

.action-btn {
    flex: 1;
    padding: 12px 20px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: 'Noto Sans SC', sans-serif;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent-primary);
}

.generation-info {
    margin-top: 28px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 16px;
    border: 1px solid var(--border-color);
}

.generation-info h3 {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.info-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.info-item:last-child {
    border-bottom: none;
}

.info-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.info-value {
    font-size: 0.85rem;
    font-weight: 500;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.url-value {
    color: var(--accent-secondary);
    cursor: pointer;
}

.url-value:hover {
    text-decoration: underline;
}

.footer {
    text-align: center;
    padding-top: 40px;
    margin-top: 40px;
    border-top: 1px solid var(--border-color);
}

.footer p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    letter-spacing: 1px;
}

.toast {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-panel);
    border: 1px solid var(--accent-primary);
    border-radius: 12px;
    padding: 16px 28px;
    color: var(--text-primary);
    font-size: 0.95rem;
    backdrop-filter: blur(20px);
    opacity: 0;
    transition: all 0.4s ease;
    z-index: 1000;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast.success {
    border-color: var(--accent-secondary);
}

.toast.error {
    border-color: #ff4444;
}

@media (max-width: 1100px) {
    .main-content {
        grid-template-columns: 1fr;
    }

    .header {
        flex-direction: column;
        gap: 24px;
        align-items: flex-start;
    }

    .api-key-section {
        width: 100%;
    }

    .api-key-section input {
        flex: 1;
        width: auto;
    }
}

@media (max-width: 600px) {
    .container {
        padding: 20px;
    }

    .settings-grid {
        grid-template-columns: 1fr;
    }

    .player-actions {
        flex-direction: column;
    }
}
