:root {
    --primary: #2ecc71;
    --primary-glow: rgba(46, 204, 113, 0.4);
    --bg: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --text: #f8fafc;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

.container {
    width: 90%;
    max-width: 900px;
    margin: 40px auto;
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 40px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

h1 {
    font-weight: 800;
    font-size: 2.5rem;
    margin-bottom: 30px;
    text-align: center;
    background: linear-gradient(to right, #2ecc71, #27ae60);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

h1 svg {
    width: 32px;
    height: 32px;
    filter: drop-shadow(0 0 10px rgba(0, 208, 120, 0.4));
}

.dropzone {
    border: 2px dashed rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 30px;
}

.dropzone:hover {
    border-color: var(--primary);
    background: rgba(46, 204, 113, 0.05);
}

#waveform {
    width: 100%;
    height: 120px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    margin: 20px 0;
    display: none;
    overflow: hidden;
    position: relative;
    transition: all 0.3s ease;
}

#waveform.stars-active canvas {
    filter: drop-shadow(0 0 10px var(--glow-color, rgba(46, 204, 113, 0.8)));
    mask-image: radial-gradient(circle, black 30%, transparent 70%);
    -webkit-mask-image: radial-gradient(circle, black 30%, transparent 70%);
}

@keyframes stars-pulse {
    0%, 100% {
        opacity: 0.7;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
}

#waveform.stars-active {
    animation: stars-pulse 2s infinite ease-in-out;
}

#waveform.bg-space {
    background: url('../space-bg.webp') center/cover no-repeat;
}

.controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px 70px;
    margin-bottom: 30px;
    align-items: end;
}

input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    outline: none;
    margin: 15px 0;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.4);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

input[type="range"]::-webkit-slider-thumb:hover {
    box-shadow: 0 0 0 8px rgba(46, 204, 113, 0.15);
    transform: scale(1.1);
}

input[type="range"]:active::-webkit-slider-thumb {
    box-shadow: 0 0 0 12px rgba(46, 204, 113, 0.25);
    transform: scale(1.1);
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.control-group.full-width {
    grid-column: span 2;
}

.toggle-group {
    display: flex;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 4px;
    gap: 4px;
}

.toggle-btn {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #94a3b8;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.toggle-btn.active {
    background: var(--primary);
    color: #000;
    box-shadow: 0 4px 12px var(--primary-glow);
}

.toggle-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #94a3b8;
}

input,
input[type="number"],
select {
    background: transparent;
    border: none;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px 4px 0 0;
    padding: 10px 0;
    color: white;
    font-family: inherit;
    outline: none;
    transition: all 0.2s;
    width: 100%;
    font-size: 1rem;
}

input[type="number"]:focus,
select:focus {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.02);
    box-shadow: none;
}

.color-picker-container {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 4px 12px;
}

input[type="color"] {
    -webkit-appearance: none;
    border: none;
    width: 32px;
    height: 32px;
    cursor: pointer;
    background: none;
    padding: 0;
}

input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

input[type="color"]::-webkit-color-swatch {
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
}

@keyframes stars-pulse {
    0% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.02); opacity: 1; filter: brightness(1.2) blur(0.5px); }
    100% { transform: scale(1); opacity: 0.8; }
}

.stars-active {
    animation: stars-pulse 2s infinite ease-in-out;
    mask-image: radial-gradient(circle, white 0%, transparent 70%);
    -webkit-mask-image: radial-gradient(circle, white 0%, transparent 70%);
}

.wave-preview-box {
    width: 100%;
    height: 40px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.wave-sample {
    display: flex;
    align-items: center;
    gap: 2px;
    height: 60%;
}

.wave-bar {
    width: 3px;
    background: var(--primary);
    border-radius: 2px;
    animation: wave-anim 1.2s ease-in-out infinite;
}

@keyframes wave-anim {
    0%, 100% { height: 20%; }
    50% { height: 100%; }
}

.btn-generate {
    width: 100%;
    background: var(--primary);
    color: #000;
    border: none;
    padding: 16px;
    border-radius: 12px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 10px 20px var(--primary-glow);
    display: none;
}

#status {
    margin-top: 20px;
    text-align: center;
    color: #94a3b8;
}

.progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    margin-top: 10px;
    overflow: hidden;
    display: none;
}

.progress-fill {
    width: 0%;
    height: 100%;
    background: var(--primary);
    transition: width 0.3s ease;
}

#waveform {
    width: 100%;
    height: 120px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    margin-bottom: 25px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

#waveform canvas {
    transition: opacity 0.4s ease;
}

#waveform.bg-space {
    background-image: url('../space-bg.webp');
    background-size: cover;
    background-position: center;
}

#waveform.bg-space::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 2px;
    background: #ffffff;
    box-shadow: 0 0 10px white, 0 0 20px var(--glow-color, var(--primary));
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
    z-index: 5;
}

#waveform.bg-space.minimal-line::after {
    opacity: 1;
    animation: spacePulse 2s infinite ease-in-out;
}

@keyframes spacePulse {
    0% { box-shadow: 0 0 10px white, 0 0 20px var(--glow-color, var(--primary)); transform: scaleY(1); }
    50% { box-shadow: 0 0 15px white, 0 0 30px var(--glow-color, var(--primary)), 0 0 45px var(--glow-color, var(--primary)); transform: scaleY(1.5); }
    100% { box-shadow: 0 0 10px white, 0 0 20px var(--glow-color, var(--primary)); transform: scaleY(1); }
}

#waveform.bg-space.minimal-line canvas,
#waveform.bg-line canvas {
    display: block !important;
    opacity: 0 !important;
}

#waveform.bg-space.minimal-line,
#waveform.bg-line {
    cursor: pointer;
}

#waveform.bg-line {
    background-image: url('../line-bg2.webp');
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;
}

#lineOverlay {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    background-image: url('../line-bg.webp');
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;
    z-index: 4;
    display: none;
    pointer-events: none;
    clip-path: inset(0 100% 0 0);
    transition: none;
}

#waveform.bg-line #lineOverlay {
    display: block;
}

#seekPoint {
    position: absolute;
    top: 50%;
    left: 0;
    width: 12px;
    height: 12px;
    background: #ffffff;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 10px white, 0 0 20px var(--glow-color, var(--primary));
    z-index: 10;
    display: none;
    pointer-events: none;
    transition: left 0.1s linear;
}

#waveform.bg-space.minimal-line #seekPoint {
    display: block;
    animation: pointPulse 1s infinite alternate ease-in-out;
}

#waveform.bg-space.minimal-line #seekPoint::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 2px;
    height: 120px;
    background: #ffffff;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 10px white, 0 0 20px var(--glow-color, var(--primary));
    z-index: -1;
}

@keyframes pointPulse {
    from { transform: translate(-50%, -50%) scale(1); box-shadow: 0 0 10px white; }
    to { transform: translate(-50%, -50%) scale(1.3); box-shadow: 0 0 20px white, 0 0 30px var(--glow-color, var(--primary)); }
}

#waveform>div:not(#lineOverlay) {
    transition: width 0.1s linear !important;
}

.btn-play {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 12px 0;
    width: 200px;
    border-radius: 30px;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s;
    display: inline-grid;
    grid-template-columns: 40px auto;
    align-items: center;
    justify-content: center;
    gap: 0;
    white-space: nowrap;
    box-sizing: border-box;
    position: relative;
}

.btn-play:hover {
    background: rgba(255, 255, 255, 0.2);
}

#playIcon {
    font-size: 1.2rem;
    width: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Language Switcher */
.lang-switch {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
}

.lang-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.2s;
}

.lang-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.lang-btn.active {
    background: var(--primary);
    color: #000;
    border-color: var(--primary);
}
