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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f5f5f5;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

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

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    color: #222;
}

header p {
    color: #666;
    font-size: 1.1rem;
}

header .back-link {
    font-size: 0.9rem;
    margin-top: 10px;
}

header .back-link a {
    color: #666;
    text-decoration: none;
    transition: color 0.2s ease;
}

header .back-link a:hover {
    color: #4CAF50;
}

/* Upload Section */
.upload-section {
    background: white;
    border-radius: 8px;
    padding: 30px;
    margin-bottom: 40px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.upload-area {
    border: 2px dashed #ddd;
    border-radius: 8px;
    padding: 40px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-area:hover,
.upload-area.drag-over {
    border-color: #4CAF50;
    background: #f9fff9;
}

.upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    color: #666;
}

.upload-label svg {
    color: #999;
}

.upload-label span:first-of-type {
    font-size: 1.1rem;
    color: #333;
}

.upload-hint {
    font-size: 0.9rem;
    color: #999;
}

/* Preview Area */
.preview-area {
    margin-top: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
}

.preview-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 4px;
    overflow: hidden;
    border: 2px solid #eee;
}

.preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-item .remove-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(255, 0, 0, 0.8);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-item .remove-btn:hover {
    background: rgba(255, 0, 0, 1);
}

/* Controls */
.controls {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.slider-group {
    margin-bottom: 20px;
}

.slider-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: 500;
    color: #333;
}

#fpsSlider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
}

#fpsSlider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #4CAF50;
    cursor: pointer;
}

#fpsSlider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #4CAF50;
    cursor: pointer;
    border: none;
}

/* Buttons */
.button-group {
    display: flex;
    gap: 10px;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.btn-primary {
    background: #4CAF50;
    color: white;
}

.btn-primary:hover {
    background: #45a049;
}

.btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.btn-secondary {
    background: #f0f0f0;
    color: #333;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

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

/* Progress */
.progress {
    margin-top: 20px;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 6px;
}

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

.progress-fill {
    height: 100%;
    background: #4CAF50;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    text-align: center;
    color: #666;
    font-size: 0.9rem;
}

/* Result */
.result {
    margin-top: 20px;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 6px;
    text-align: center;
}

.result h3 {
    margin-bottom: 15px;
    color: #333;
}

.result img {
    max-width: 100%;
    border-radius: 4px;
    margin-bottom: 15px;
    border: 2px solid #eee;
}

/* Filename Input */
.filename-input {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 15px 0;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 6px;
}

.filename-input label {
    font-weight: 500;
    color: #333;
}

.filename-input input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
}

.filename-input input:focus {
    outline: none;
    border-color: #4CAF50;
}

.filename-input span {
    color: #666;
    font-weight: 500;
}

/* Responsive */
@media (max-width: 600px) {
    .container {
        padding: 10px;
    }

    header h1 {
        font-size: 2rem;
    }

    .upload-section,
    .gallery-section {
        padding: 20px;
    }

    .preview-area {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 10px;
    }

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

    .btn {
        width: 100%;
    }
}
