* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --primary-color: #8b9d83;
    --primary-hover: #6b7d63;
    --success-color: #7fa89e;
    --error-color: #c99a7c;
    --bg-color: #f5f3ed;
    --surface-color: #fdfcf7;
    --text-color: #4a5446;
    --text-muted: #7d8b77;
    --border-color: #d4cfc0;
}

html {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #f5f3ed 0%, #e8e4d9 100%);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    flex: 1;
}

header {
    text-align: center;
    margin-bottom: 3rem;
    padding: 2rem 0;
}

header h1 {
    font-size: 3.5rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #8b9d83 0%, #a5b89a 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.site-title-link {
    text-decoration: none;
    background: linear-gradient(135deg, #8b9d83 0%, #a5b89a 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    cursor: pointer;
    transition: opacity 0.3s ease;
}

.site-title-link:hover {
    opacity: 0.8;
}

.subtitle {
    font-size: 1.2rem;
    color: var(--text-muted);
}

.section {
    display: none;
    animation: fadeIn 0.5s ease-in;
}

.section.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Category Section */
.category-container {
    background: var(--surface-color);
    border-radius: 1rem;
    padding: 2.5rem;
    box-shadow: 0 10px 40px rgba(139, 157, 131, 0.15);
    max-width: 900px;
    margin: 0 auto;
}

.category-container h2 {
    text-align: center;
    margin-bottom: 1.5rem;
    font-size: 2rem;
}

.intro-text {
    max-width: 900px;
    margin: 2rem auto 0;
    padding: 1.5rem;
    background: rgba(139, 157, 131, 0.1);
    border-radius: 0.75rem;
    border-left: 4px solid var(--primary-color);
}

.intro-text p {
    color: var(--text-muted);
    line-height: 1.8;
    font-size: 1rem;
    margin: 0;
}

.intro-text strong {
    color: var(--text-color);
    font-weight: 600;
}

.intro-cta {
    text-align: center;
    margin: 1.5rem auto 0;
    font-size: 1rem;
    font-weight: 500;
    color: var(--primary-color);
    max-width: 800px;
}

.intro-images {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.intro-images img {
    width: 100%;
    max-width: 350px;
    height: auto;
    border-radius: 0.75rem;
    box-shadow: 0 5px 20px rgba(139, 157, 131, 0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.intro-images img:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(139, 157, 131, 0.35);
}

.demo-button-container {
    text-align: center;
    margin-top: 2rem;
}

.btn-demo {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 2rem;
    background: linear-gradient(135deg, #8b9d83 0%, #a8b89f 100%);
    color: white;
    text-decoration: none;
    border-radius: 0.75rem;
    font-weight: 600;
    font-size: 1.1rem;
    box-shadow: 0 4px 15px rgba(139, 157, 131, 0.4);
    transition: all 0.3s ease;
}

.btn-demo:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(139, 157, 131, 0.6);
    background: linear-gradient(135deg, #7a8b72 0%, #8b9d83 100%);
}

.category-grid {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.category-card {
    background: rgba(139, 157, 131, 0.08);
    border: 2px solid var(--border-color);
    border-radius: 1rem;
    padding: 1.25rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    min-width: 140px;
    max-width: 180px;
}

.category-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary-color);
    background: rgba(139, 157, 131, 0.15);
    box-shadow: 0 10px 30px rgba(139, 157, 131, 0.25);
}

.category-icon {
    width: 80px;
    height: 80px;
    object-fit: contain;
    filter: brightness(0.9) invert(0.7);
    transition: filter 0.3s ease;
}

.category-card:hover .category-icon {
    filter: brightness(1.1) invert(0.7);
}

.category-card h3 {
    font-size: 1.2rem;
    margin: 0;
    color: var(--text-color);
}

/* Upload Section */
.btn-back {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    margin-bottom: 1rem;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.btn-back:hover {
    background: var(--surface-color);
    color: var(--text-color);
    border-color: var(--primary-color);
}

.category-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.current-category-icon {
    width: 50px;
    height: 50px;
    object-fit: contain;
    filter: invert(0.7);
}

.upload-container {
    background: var(--surface-color);
    border-radius: 1rem;
    padding: 2.5rem;
    box-shadow: 0 10px 40px rgba(139, 157, 131, 0.15);
}

.upload-container h2 {
    text-align: center;
    margin-bottom: 1rem;
    font-size: 2rem;
}

.info {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
    width: 100%;
    max-width: 100%;
}

.image-upload-box {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 4;
}

.file-input {
    display: none;
}

.upload-label {
    position: absolute;
    top: 0;
    left: 0;
    display: block;
    width: 100%;
    height: 100%;
    border: 2px dashed var(--border-color);
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(245, 243, 237, 0.5);
}

.upload-label:hover {
    border-color: var(--primary-color);
    background: rgba(139, 157, 131, 0.1);
}

.upload-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 1rem;
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.upload-text {
    font-size: 1.1rem;
    color: var(--text-muted);
}

.preview {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 0.75rem;
    overflow: hidden;
    background: rgba(139, 157, 131, 0.1);
    z-index: 2;
}

.preview.active {
    display: block;
}

.image-upload-box:has(.preview.active) .upload-label {
    display: none;
}

.preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.delete-upload-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(201, 154, 124, 0.9);
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
}

.delete-upload-btn:hover {
    background: var(--error-color);
    transform: scale(1.1);
}

/* Upload Error */
.upload-error {
    position: absolute;
    bottom: 10px;
    left: 10px;
    right: 10px;
    background: rgba(201, 154, 124, 0.95);
    border-radius: 0.5rem;
    padding: 0.75rem;
    z-index: 3;
}

.upload-error .error-text {
    color: white;
    font-size: 0.85rem;
    margin: 0 0 0.5rem 0;
}

.upload-error .btn-retry {
    background: white;
    color: var(--error-color);
    border: none;
    padding: 0.4rem 1rem;
    border-radius: 0.3rem;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.upload-error .btn-retry:hover {
    background: rgba(255, 255, 255, 0.9);
    transform: scale(1.05);
}

/* Buttons */
.btn {
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    width: 100%;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(139, 157, 131, 0.35);
}

.btn-primary:disabled {
    background: var(--border-color);
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover {
    background: #6b9087;
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--surface-color);
    color: var(--text-color);
    border: 2px solid var(--border-color);
}

.btn-secondary:hover {
    border-color: var(--primary-color);
    background: rgba(139, 157, 131, 0.1);
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

/* Progress Section */
.progress-container {
    background: var(--surface-color);
    border-radius: 1rem;
    padding: 3rem;
    box-shadow: 0 10px 40px rgba(139, 157, 131, 0.15);
    text-align: center;
}

.progress-bar {
    width: 100%;
    height: 2rem;
    background: rgba(139, 157, 131, 0.15);
    border-radius: 1rem;
    overflow: hidden;
    margin: 2rem 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), #a5b89a);
    transition: width 0.5s ease;
    width: 0%;
}

.progress-text {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

.progress-info {
    font-size: 0.95rem;
    color: var(--text-muted);
    font-style: italic;
    margin: 1rem 0;
    text-align: center;
    line-height: 1.5;
}

.loader {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(139, 157, 131, 0.2);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 2rem auto;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Result Section */
.result-container {
    background: var(--surface-color);
    border-radius: 1rem;
    padding: 2.5rem;
    box-shadow: 0 10px 40px rgba(139, 157, 131, 0.15);
}

.result-container h2 {
    text-align: center;
    margin-bottom: 2rem;
    font-size: 2rem;
}

.viewer-container {
    position: relative;
    width: 100%;
    height: 600px;
    max-height: 70vh;
    background: rgba(139, 157, 131, 0.08);
    border-radius: 0.75rem;
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

#model-canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
}

.viewer-controls-hint {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(74, 84, 70, 0.8);
    color: #f5f3ed;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    pointer-events: none;
    backdrop-filter: blur(10px);
}

.result-actions {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.result-actions .btn {
    flex: 1;
}

.share-link {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.share-link label {
    color: var(--text-muted);
    white-space: nowrap;
}

.share-link input {
    flex: 1;
    padding: 0.75rem;
    background: rgba(139, 157, 131, 0.08);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    color: var(--text-color);
    font-family: monospace;
}

.share-link input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.share-link #copy-link-btn {
    background: linear-gradient(135deg, #8b9d83 0%, #a8b89f 100%);
    border: none;
    color: white;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(139, 157, 131, 0.3);
    transition: all 0.3s ease;
    white-space: nowrap;
}

.share-link #copy-link-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 157, 131, 0.5);
    background: linear-gradient(135deg, #7a8b72 0%, #8b9d83 100%);
}

.share-link #copy-link-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(139, 157, 131, 0.4);
}

/* Source Images Section */
.source-images-section {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.source-images-section h3 {
    text-align: center;
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
    color: var(--text-color);
}

.source-images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, 150px);
    gap: 1rem;
    max-width: 600px;
    margin: 0 auto;
    justify-content: center;
}

.source-image-thumbnail {
    position: relative;
    width: 100%;
    padding-bottom: 100%;
    border-radius: 0.75rem;
    overflow: hidden;
    background: rgba(139, 157, 131, 0.08);
    border: 2px solid var(--border-color);
    cursor: pointer;
    transition: all 0.3s ease;
}

.source-image-thumbnail:hover {
    border-color: var(--primary-color);
    transform: translateY(-3px);
    box-shadow: 0 5px 20px rgba(139, 157, 131, 0.25);
}

.source-image-thumbnail img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.source-image-thumbnail .image-number {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(139, 157, 131, 0.9);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* Show Sources Option */
.show-sources-option {
    margin: 1.5rem 0;
    padding: 1rem;
    background: rgba(139, 157, 131, 0.1);
    border-radius: 0.5rem;
    border: 1px solid rgba(139, 157, 131, 0.25);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    font-size: 1rem;
    color: var(--text-color);
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.checkbox-label span {
    flex: 1;
}

/* Texture Toggle */
.texture-toggle-container {
    margin: 1rem 0;
    display: flex;
    justify-content: center;
}

.btn-texture {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--surface-color);
    border: 2px solid var(--border-color);
    color: var(--text-color);
    transition: all 0.3s ease;
}

.btn-texture:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

.btn-texture #texture-icon {
    font-size: 1.2rem;
}

.btn-texture #texture-label {
    font-weight: 600;
}

/* Error Section */
.error-container {
    background: var(--surface-color);
    border-radius: 1rem;
    padding: 3rem;
    box-shadow: 0 10px 40px rgba(139, 157, 131, 0.15);
    text-align: center;
}

.error-container h2 {
    margin-bottom: 1.5rem;
    font-size: 2rem;
}

.error-message {
    color: var(--error-color);
    font-size: 1.1rem;
    margin-bottom: 2rem;
    padding: 1rem;
    background: rgba(201, 154, 124, 0.15);
    border-radius: 0.5rem;
    border: 1px solid var(--error-color);
}

/* Footer */
footer {
    padding: 2rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-content p {
    margin: 0;
}

.language-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.language-select {
    background: var(--surface-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
}

.language-select:hover {
    border-color: var(--primary-color);
    background: rgba(139, 157, 131, 0.1);
}

.language-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(139, 157, 131, 0.1);
}

@media (max-width: 768px) {
    .footer-content {
        flex-direction: column;
        text-align: center;
    }
}

footer a {
    color: var(--primary-color);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Photo Source Section */
.photo-source-container {
    background: var(--surface-color);
    border-radius: 1rem;
    padding: 2.5rem;
    box-shadow: 0 10px 40px rgba(139, 157, 131, 0.15);
    max-width: 800px;
    margin: 0 auto;
}

.photo-source-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
    margin-top: 2rem;
}

.photo-source-card {
    background: rgba(139, 157, 131, 0.08);
    border: 2px solid var(--border-color);
    border-radius: 1rem;
    padding: 2.5rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.photo-source-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary-color);
    background: rgba(139, 157, 131, 0.15);
    box-shadow: 0 10px 30px rgba(139, 157, 131, 0.25);
}

.source-icon {
    font-size: 4rem;
    display: block;
}

.photo-source-card h3 {
    font-size: 1.5rem;
    margin: 0;
    color: var(--text-color);
}

.photo-source-card p {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin: 0;
}

/* Camera Section */
.camera-container {
    background: var(--surface-color);
    border-radius: 1rem;
    padding: 2.5rem;
    box-shadow: 0 10px 40px rgba(139, 157, 131, 0.15);
    max-width: 900px;
    margin: 0 auto;
}

.camera-preview-container {
    position: relative;
    width: 100%;
    max-width: 640px;
    margin: 0 auto 2rem;
    border-radius: 1rem;
    overflow: hidden;
    background: #4a5446;
}

#camera-video {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 1rem;
}

.camera-switch-container {
    text-align: center;
    margin: -0.5rem auto 1.5rem;
}

.switch-camera-btn {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.85rem 1.5rem;
}

.btn-capture {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 50px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(139, 157, 131, 0.35);
    font-weight: 600;
}

.btn-capture:hover {
    background: var(--primary-hover);
    transform: translateX(-50%) translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 157, 131, 0.45);
}

.captured-photos-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.captured-photo {
    position: relative;
    width: 100%;
    padding-bottom: 100%;
    border-radius: 0.75rem;
    overflow: hidden;
    background: rgba(139, 157, 131, 0.08);
    border: 2px solid var(--border-color);
}

.captured-photo img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: rgba(139, 157, 131, 0.08);
}

.delete-photo-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(201, 154, 124, 0.9);
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
}

.delete-photo-btn:hover {
    background: var(--error-color);
    transform: scale(1.1);
}

.photo-number {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: rgba(74, 84, 70, 0.8);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
}

/* Demo Poses Section */
.demo-poses {
    background: rgba(139, 157, 131, 0.08);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.demo-title {
    text-align: center;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-color);
    margin: 0 0 0.5rem 0;
}

.demo-subtitle {
    text-align: center;
    font-size: 0.9rem;
    font-style: italic;
    color: var(--text-muted);
    margin: 0 0 0.5rem 0;
}

.demo-note {
    text-align: center;
    font-size: 0.85rem;
    font-style: italic;
    color: var(--primary-color);
    margin: 0 0 1rem 0;
    font-weight: 500;
}

.demo-images {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.demo-image {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 4;
    border-radius: 0.5rem;
    overflow: visible; /* allow label below without clipping */
    background: rgba(139, 157, 131, 0.08);
    border: 2px solid var(--border-color);
    margin-bottom: 1.1rem; /* reserve space for label below the image */
}

.demo-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: invert(0.7);
}

.demo-label {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translate(-50%, 6px);
    background: rgba(139, 157, 131, 0.9);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* Responsive */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }
    
    header {
        padding: 1rem 0;
        margin-bottom: 2rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }

    .container {
        padding: 1rem;
    }
    
    /* Category Section */
    .category-container {
        padding: 1.5rem;
    }
    
    .category-container h2 {
        font-size: 1.5rem;
        margin-bottom: 1.5rem;
    }
    
    .category-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .category-card {
        padding: 1.5rem;
    }
    
    .category-icon {
        width: 80px;
        height: 80px;
    }
    
    .category-card h3 {
        font-size: 1.2rem;
    }
    
    /* Category Header */
    .category-header {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .current-category-icon {
        width: 40px;
        height: 40px;
    }

    .upload-container,
    .progress-container,
    .result-container,
    .error-container,
    .photo-source-container,
    .camera-container {
        padding: 1.5rem;
    }
    
    .upload-container h2,
    .progress-container h2,
    .result-container h2 {
        font-size: 1.5rem;
    }

    .captured-photos-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .image-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.75rem;
    }

    .demo-images {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.75rem;
    }

    /* Mobile: replace pose labels with numbers to avoid overlap */
    .demo-label {
        font-size: 0;
    }

    .demo-label::before {
        display: inline-block;
        font-size: 0.85rem;
        content: var(--mobile-label, attr(data-mobile-label));
    }

    .demo-image:nth-child(1) .demo-label { --mobile-label: '1'; }
    .demo-image:nth-child(2) .demo-label { --mobile-label: '2'; }
    .demo-image:nth-child(3) .demo-label { --mobile-label: '3'; }

    /* Mobile: replace upload texts with numbers */
    .upload-text {
        font-size: 0;
        line-height: 1.2;
        position: relative;
        visibility: hidden; /* hide original text fully */
    }

    .upload-text::before {
        content: '1';
        position: absolute;
        inset: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.1rem;
        color: var(--text-muted);
        visibility: visible;
    }

    .image-upload-box:nth-child(2) .upload-text::before { content: '2'; }
    .image-upload-box:nth-child(3) .upload-text::before { content: '3'; }

    .demo-poses {
        padding: 1rem;
    }

    .photo-source-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .source-option {
        padding: 2rem 1.5rem;
    }
    
    .source-icon {
        font-size: 2.5rem;
    }
    
    .source-option h3 {
        font-size: 1.3rem;
    }

    .result-actions {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .btn {
        width: 100%;
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
    }

    .share-link {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    
    .share-link input {
        min-width: 100%;
    }
    
    /* Model Viewer */
    .viewer-container {
        height: 350px;
        max-height: 50vh;
    }
    
    .viewer-controls-hint {
        font-size: 0.75rem;
        padding: 0.4rem 0.8rem;
    }
    
    /* Source Images */
    .source-images-grid {
        grid-template-columns: 1fr;
    }
    
    /* Camera */
    #camera-video {
        height: 300px;
    }
    
    .camera-preview-container {
        height: 300px;
    }
    
    .captured-photos-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Smaller mobile screens */
@media (max-width: 480px) {
    header h1 {
        font-size: 1.75rem;
    }
    
    .container {
        padding: 0.75rem;
    }
    
    .category-container,
    .upload-container,
    .progress-container,
    .result-container,
    .error-container,
    .photo-source-container,
    .camera-container {
        padding: 1rem;
        border-radius: 0.75rem;
    }
    
    .btn {
        padding: 0.75rem 1.25rem;
        font-size: 0.95rem;
    }
    
    .btn-back {
        padding: 0.5rem 0.875rem;
        font-size: 0.9rem;
    }
    
    .upload-icon {
        font-size: 2rem;
    }
    
    .upload-text {
        font-size: 0.9rem;
    }
    
    .viewer-container {
        height: 280px;
        max-height: 45vh;
    }
    
    .viewer-controls-hint {
        font-size: 0.7rem;
        padding: 0.35rem 0.7rem;
        bottom: 0.5rem;
    }
}

/* ===== PURCHASE SECTION STYLES ===== */

.purchase-section {
    min-height: calc(100vh - 100px);
}

.purchase-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.purchase-content {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 40px;
    margin-top: 30px;
}

.purchase-preview {
    position: sticky;
    top: 20px;
    height: fit-content;
}

.purchase-preview h3 {
    margin-bottom: 15px;
    color: var(--text-color);
    font-size: 1.3rem;
}

.preview-viewer {
    position: relative;
    width: 100%;
    height: 400px;
    background: linear-gradient(135deg, #8b9d83 0%, #a5b89a 100%);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(139, 157, 131, 0.25);
}

#preview-canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
}

.purchase-form-container {
    background: var(--surface-color);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(139, 157, 131, 0.15);
}

.purchase-form-container h2 {
    margin-bottom: 30px;
    color: var(--text-color);
    font-size: 1.8rem;
}

#purchase-form {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.form-group label {
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.95rem;
}

.form-group input[type="text"],
.form-group input[type="email"] {
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
    background: rgba(139, 157, 131, 0.05);
}

.form-group input[type="text"]:focus,
.form-group input[type="email"]:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.size-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 12px;
}

.size-option {
    position: relative;
    cursor: pointer;
}

.size-option input[type="radio"] {
    position: absolute;
    opacity: 0;
}

.size-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px 10px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    transition: all 0.3s;
    background: var(--surface-color);
}

.size-option input[type="radio"]:checked + .size-label {
    border-color: var(--primary-color);
    background: rgba(139, 157, 131, 0.15);
    transform: scale(1.05);
}

.size-dimension {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--text-color);
    margin-bottom: 5px;
}

.size-price {
    font-size: 0.9rem;
    color: var(--primary-color);
    font-weight: 600;
}

.color-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 12px;
}

.color-option {
    position: relative;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    transition: all 0.3s;
    background: var(--surface-color);
}

.color-option input[type="radio"] {
    position: absolute;
    opacity: 0;
}

.color-option input[type="radio"]:checked ~ .color-swatch {
    box-shadow: 0 0 0 3px var(--primary-color);
}

.color-option:has(input[type="radio"]:checked) {
    border-color: var(--primary-color);
    background: rgba(139, 157, 131, 0.15);
}

.color-swatch {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-bottom: 8px;
    transition: all 0.3s;
}

.color-name {
    font-size: 0.85rem;
    color: var(--text-color);
    font-weight: 500;
}

.discount-input-group {
    display: flex;
    gap: 10px;
}

.discount-input-group input {
    flex: 1;
}

.btn-apply-discount {
    padding: 12px 20px;
    background: var(--text-muted);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-apply-discount:hover {
    background: var(--text-color);
    transform: translateY(-2px);
}

.discount-message {
    margin-top: 10px;
    padding: 10px 15px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
}

.discount-message.success {
    background-color: rgba(127, 168, 158, 0.2);
    color: #4a5446;
    border: 1px solid var(--success-color);
}

.discount-message.error {
    background-color: rgba(201, 154, 124, 0.2);
    color: #4a5446;
    border: 1px solid var(--error-color);
}

.price-summary {
    background: rgba(139, 157, 131, 0.1);
    padding: 20px;
    border-radius: 10px;
    margin-top: 10px;
}

.price-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 1rem;
    color: var(--text-color);
}

.price-row:last-child {
    margin-bottom: 0;
}

.discount-row {
    color: var(--success-color);
}

.btn-pay {
    width: 100%;
    padding: 18px;
    font-size: 1.2rem;
    margin-top: 10px;
}

@media (max-width: 1024px) {
    .purchase-content {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .purchase-preview {
        position: relative;
        top: 0;
    }
}

@media (max-width: 768px) {
    .purchase-container {
        padding: 1rem;
    }
    
    .purchase-content {
        gap: 20px;
        margin-top: 20px;
    }
    
    .purchase-preview h3 {
        font-size: 1.2rem;
    }
    
    .preview-viewer {
        height: 300px;
    }
    
    .purchase-form-container h2 {
        font-size: 1.5rem;
    }
    
    .size-options {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .size-option {
        padding: 10px;
    }
    
    .size-dimension {
        font-size: 1rem;
    }
    
    .size-price {
        font-size: 0.85rem;
    }
    
    .color-options {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
    
    .color-option {
        padding: 10px;
    }
    
    .color-swatch {
        width: 35px;
        height: 35px;
    }
    
    .color-name {
        font-size: 0.85rem;
    }
    
    .form-group label {
        font-size: 0.95rem;
    }
    
    .form-group input {
        padding: 10px;
        font-size: 0.95rem;
    }
    
    .discount-input-group {
        flex-direction: column;
        gap: 8px;
    }
    
    .btn-apply-discount {
        width: 100%;
    }
    
    .price-summary {
        padding: 15px;
    }
    
    .btn-pay {
        padding: 14px;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .preview-viewer {
        height: 250px;
    }
    
    .size-options {
        grid-template-columns: 1fr;
    }
    
    .color-options {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ===== ORDER CONFIRMATION SECTION STYLES ===== */

#order-confirmation-section.active {
    min-height: calc(100vh - 100px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.confirmation-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

.confirmation-header {
    text-align: center;
    margin-bottom: 40px;
}

.success-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--success-color) 0%, #6b9087 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: white;
    margin: 0 auto 20px;
    box-shadow: 0 10px 30px rgba(127, 168, 158, 0.3);
}

.confirmation-header h2 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #8b9d83 0%, #a5b89a 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.confirmation-message {
    font-size: 1.1rem;
    color: var(--text-muted);
}

.order-details {
    background: var(--surface-color);
    padding: 30px;
    border-radius: 15px;
    margin-bottom: 20px;
    box-shadow: 0 5px 20px rgba(139, 157, 131, 0.15);
}

.order-details h3 {
    color: var(--text-color);
    margin-bottom: 20px;
    font-size: 1.3rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 10px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(139, 157, 131, 0.2);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.detail-value {
    font-weight: 500;
    color: var(--text-color);
    font-size: 1rem;
}

.status-badge {
    background: linear-gradient(135deg, var(--success-color) 0%, #6b9087 100%);
    color: white;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
}

.discount-value {
    color: var(--success-color);
    font-weight: 600;
}

.order-details .total-row {
    background: rgba(139, 157, 131, 0.1);
    padding: 15px;
    margin: 10px -15px -15px;
    border-radius: 10px;
    border-bottom: none !important;
}

.order-details .total-row .detail-label,
.order-details .total-row .detail-value {
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--text-color);
}

.address-block {
    background: rgba(139, 157, 131, 0.08);
    padding: 20px;
    border-radius: 10px;
    color: var(--text-color);
    line-height: 1.6;
}

.address-block p {
    margin: 5px 0;
}

.confirmation-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    justify-content: center;
}

.confirmation-actions .btn {
    flex: 1;
    max-width: 250px;
    padding: 15px 30px;
    font-size: 1.1rem;
}

@media (max-width: 768px) {
    .confirmation-container {
        padding: 15px;
    }
    
    .confirmation-header h2 {
        font-size: 1.75rem;
    }
    
    .success-icon {
        width: 60px;
        height: 60px;
        font-size: 2rem;
    }
    
    .order-details {
        padding: 15px;
    }
    
    .order-details h3 {
        font-size: 1.2rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .confirmation-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .confirmation-actions .btn {
        max-width: 100%;
    }
    
    .detail-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .detail-label {
        font-size: 0.9rem;
    }
    
    .detail-value {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .confirmation-header h2 {
        font-size: 1.5rem;
    }
    
    .confirmation-message {
        font-size: 0.95rem;
    }
    
    .success-icon {
        width: 50px;
        height: 50px;
        font-size: 1.75rem;
    }
    
    .order-details {
        padding: 12px;
    }
    
    .shipping-info {
        padding: 12px;
    }
}
