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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.app-container {
    max-width: 600px;
    margin: 0 auto;
}

.app-header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

.app-header h1 {
    font-size: 2.5em;
    margin-bottom: 8px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
    font-size: 1em;
    opacity: 0.9;
}

.app-main {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

/* Input Section */
.input-section label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.input-group {
    display: flex;
    gap: 10px;
}

.input-field {
    flex: 1;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1em;
    transition: border-color 0.3s;
}

.input-field:focus {
    outline: none;
    border-color: #667eea;
}

.error-message {
    color: #e74c3c;
    font-size: 0.9em;
    margin-top: 8px;
    display: none;
}

.error-message.show {
    display: block;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-control {
    background: #f0f0f0;
    color: #333;
    flex: 1;
    min-height: 44px;
}

.btn-control:hover:not(:disabled) {
    background: #e0e0e0;
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.9em;
}

/* Player Section */
.youtube-player {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 8px 8px 0 0;
    overflow: hidden;
}

.youtube-player iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.progress-container {
    background: white;
    border-radius: 0 0 8px 8px;
    padding: 12px;
}

.time-display {
    font-size: 0.9em;
    font-weight: 600;
    color: #666;
    text-align: center;
    margin-top: 8px;
}

.time-separator {
    margin: 0 6px;
    color: #ccc;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    position: relative;
    margin-bottom: 8px;
}

.loop-range {
    position: absolute;
    height: 100%;
    background: rgba(102, 126, 234, 0.3);
    border-left: 2px solid #667eea;
    border-right: 2px solid #667eea;
    left: 0%;
    width: 0%;
    display: none;
    z-index: 1;
}

.loop-range.active {
    display: block;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    width: 0%;
    transition: width 0.1s linear;
    position: relative;
    z-index: 2;
}

/* Controls Section */
.control-group {
    display: flex;
    gap: 10px;
}

/* Loop Section */
.loop-section h2,
.effects-section h2 {
    margin-bottom: 16px;
    color: #333;
    font-size: 1.2em;
}

.time-input-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.time-input {
    display: flex;
    flex-direction: column;
}

.time-input label {
    margin-bottom: 8px;
    font-weight: 500;
    color: #666;
    font-size: 0.9em;
}

.time-input input {
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 1em;
}

.time-input input:focus {
    outline: none;
    border-color: #667eea;
}

.loop-display {
    background: #f5f5f5;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    color: #666;
    font-weight: 500;
}

/* Effects Section */
.effect-group {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.effect-slider {
    display: flex;
    flex-direction: column;
}

.effect-slider label {
    margin-bottom: 8px;
    font-weight: 500;
    color: #666;
    font-size: 0.95em;
}

.effect-slider input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #e0e0e0;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.effect-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
    transition: transform 0.2s;
}

.effect-slider input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.effect-slider input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
    border: none;
    transition: transform 0.2s;
}

.effect-slider input[type="range"]::-moz-range-thumb:hover {
    transform: scale(1.2);
}

.effect-slider input[type="range"]:disabled {
    opacity: 0.5;
}

/* Waveform Section */
.waveform-section {
    padding: 0;
    overflow: visible;
    border-radius: 12px;
}

.waveform-canvas {
    display: block;
    width: 100%;
    height: 150px;
    background: #f5f5f5;
    border-radius: 12px;
}

.waveform-overlay {
    position: relative;
    margin-top: -150px;
    pointer-events: auto;
    height: 150px;
}

.playhead {
    position: absolute;
    top: 0;
    left: 0;
    width: 2px;
    height: 100%;
    background: linear-gradient(90deg, #ff6b6b 0%, #ff8787 100%);
    box-shadow: 0 0 8px rgba(255, 107, 107, 0.6);
    transition: left 0.05s linear;
    pointer-events: none;
}

.loop-slider {
    position: absolute;
    top: 0;
    width: 3px;
    height: 100%;
    cursor: col-resize;
    pointer-events: auto;
    opacity: 0.7;
    transition: opacity 0.2s;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loop-slider:hover {
    opacity: 1;
}

.slider-label {
    position: absolute;
    top: -18px;
    font-size: 0.7em;
    font-weight: 700;
    white-space: nowrap;
    pointer-events: none;
    padding: 2px 4px;
    border-radius: 3px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    letter-spacing: 0.5px;
}

.in-slider {
    background: linear-gradient(90deg, #4ecdc4 0%, #44a8a0 100%);
    box-shadow: 0 0 6px rgba(78, 205, 196, 0.5);
    left: 0%;
}

.in-slider .slider-label {
    background: rgba(78, 205, 196, 0.8);
    color: white;
}

.out-slider {
    background: linear-gradient(90deg, #f7b731 0%, #e67e22 100%);
    box-shadow: 0 0 6px rgba(247, 183, 49, 0.5);
    left: 100%;
}

.out-slider .slider-label {
    background: rgba(247, 183, 49, 0.8);
    color: #333;
}

/* Responsive Design */
@media (max-width: 480px) {
    .app-header h1 {
        font-size: 2em;
    }

    .card {
        padding: 16px;
    }

    .time-input-group {
        grid-template-columns: 1fr;
    }

    .input-group {
        flex-direction: column;
    }

    .btn-primary {
        width: 100%;
    }
}
