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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Fira Sans', 'Droid Sans', 'Helvetica Neue', Arial, sans-serif;
    background: #ffffff;
    min-height: 100vh;
    color: rgba(0, 0, 0, 0.8);
    font-size: 16px;
    line-height: 1.6em;
}

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

header {
    text-align: center;
    margin-bottom: 60px;
    padding-bottom: 30px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 12px;
    font-weight: 700;
    color: hsl(200, 60%, 15%);
    letter-spacing: -0.02em;
}

.subtitle {
    font-size: 1.1em;
    color: rgba(0, 0, 0, 0.6);
    font-weight: 400;
}

.main-content {
    background: white;
}

section {
    margin-bottom: 50px;
}

h2 {
    color: rgba(0, 0, 0, 0.8);
    margin-bottom: 20px;
    font-size: 1.4em;
    font-weight: 600;
}

/* Input Section */
.input-section {
    margin-bottom: 30px;
}

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

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 4px;
    font-size: 0.95em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    background: white;
    color: rgba(0, 0, 0, 0.8);
}

.btn:hover {
    border-color: rgba(0, 0, 0, 0.3);
    background: rgba(0, 0, 0, 0.02);
}

.btn-primary {
    background: hsl(200, 60%, 15%);
    color: white;
    border-color: hsl(200, 60%, 15%);
}

.btn-primary:hover {
    background: hsl(200, 60%, 20%);
    border-color: hsl(200, 60%, 20%);
}

.btn-secondary {
    background: white;
    color: rgba(0, 0, 0, 0.7);
}

.btn-large {
    width: 100%;
    justify-content: center;
    padding: 20px 40px;
    font-size: 1.2em;
}

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

/* Camera Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    border-radius: 20px;
    padding: 30px;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

#video {
    max-width: 100%;
    border-radius: 10px;
}

.camera-controls {
    display: flex;
    gap: 15px;
}

/* Image Preview */
.image-preview {
    margin-top: 20px;
    text-align: center;
}

.image-preview.hidden {
    display: none;
}

#inputCanvas {
    max-width: 100%;
    border-radius: 2px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(0, 0, 0, 0.08);
}

/* Controls Section */
.controls-section {
    margin-bottom: 30px;
}

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

.control-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 10px;
    color: rgba(0, 0, 0, 0.8);
    font-size: 0.95em;
}

.control-group select,
.control-group input[type="range"] {
    width: 100%;
    padding: 10px;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 4px;
    font-size: 0.95em;
    transition: border-color 0.2s;
    background: white;
}

.control-group select:focus {
    outline: none;
    border-color: hsl(200, 60%, 15%);
}

input[type="range"] {
    height: 6px;
    padding: 0;
    background: rgba(0, 0, 0, 0.1);
    -webkit-appearance: none;
    border: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: hsl(200, 60%, 15%);
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: hsl(200, 60%, 15%);
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.help-text {
    margin-top: 6px;
    font-size: 0.9em;
    color: rgba(0, 0, 0, 0.5);
    line-height: 1.5;
}

/* Progress Section */
.progress-section {
    text-align: center;
}

.progress-section.hidden {
    display: none;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(0, 0, 0, 0.08);
    border-radius: 4px;
    overflow: hidden;
    margin: 20px 0;
}

.progress-fill {
    height: 100%;
    background: hsl(200, 60%, 15%);
    width: 0%;
    transition: width 0.3s ease;
}

#progressText {
    font-size: 0.95em;
    color: rgba(0, 0, 0, 0.6);
    margin-top: 12px;
}

/* Results Section */
.results-section {
    text-align: center;
}

.results-section.hidden {
    display: none;
}

.result-image {
    margin-bottom: 20px;
}

.result-image canvas {
    max-width: 100%;
    width: auto;
    height: auto;
    border-radius: 2px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.result-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Footer */
footer {
    text-align: center;
    color: rgba(0, 0, 0, 0.5);
    margin-top: 80px;
    padding: 30px 20px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

footer p {
    margin: 6px 0;
    font-size: 0.9em;
}

.note {
    font-size: 0.85em;
    color: rgba(0, 0, 0, 0.4);
}

/* Responsive */
@media (max-width: 768px) {
    .main-content {
        padding: 20px;
    }

    header h1 {
        font-size: 2em;
    }

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

    .results-container {
        grid-template-columns: 1fr;
    }
}
