/**
 * JWLRY 3D Customizer Styles
 */

/* ==========================================================================
   Layout
   ========================================================================== */

#jwlry-wrapper,
#jwlry-wrapper *,
#jwlry-wrapper *::before,
#jwlry-wrapper *::after {
    box-sizing: border-box;
}

#jwlry-wrapper {
    --jwlry-accent: #0073aa;
    --jwlry-accent-dark: color-mix(in srgb, #0073aa 85%, #000);
    --jwlry-accent-darker: color-mix(in srgb, #0073aa 70%, #000);
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0;
    width: 100%;
    max-width: 960px;
    margin: 1rem auto;
    padding: 0 1rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
}

@media (min-width: 840px) {
    #jwlry-wrapper {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: flex-start;
        gap: 0;
        padding: 0;
    }

    #jwlry-editor-panel {
        flex: 0 0 380px;
    }

    #jwlry-preview-panel {
        flex: 1;
        min-width: 0;
        position: sticky;
        top: 2rem;
    }
}

/* ==========================================================================
   Editor Panel
   ========================================================================== */

#jwlry-editor-panel {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0.75rem;
}

/* Upload Area */
#jwlry-upload-area {
    position: relative;
    border: 2px dashed #ccc;
    border-radius: 12px;
    padding: 0.75rem 1.5rem;
    text-align: center;
    transition: all 0.2s ease;
    background: #fafafa;
}

#jwlry-upload-area:hover,
#jwlry-upload-area.jwlry-dragover {
    border-color: var(--jwlry-accent);
    background: color-mix(in srgb, var(--jwlry-accent) 8%, #fff);
}

#jwlry-file-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

#jwlry-upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    pointer-events: none;
}

.jwlry-upload-icon {
    width: 32px;
    height: 32px;
    opacity: 0.45;
    transition: opacity 0.2s ease;
}

#jwlry-upload-area:hover .jwlry-upload-icon {
    opacity: 0.65;
}

.jwlry-upload-text {
    font-size: 1rem;
    font-weight: 500;
    color: #333;
}

.jwlry-upload-hint {
    font-size: 0.875rem;
    color: #666;
}

/* Upload Spinner */
#jwlry-upload-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    pointer-events: none;
}

#jwlry-upload-spinner span {
    font-size: 0.875rem;
    color: #666;
}

.jwlry-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #ddd;
    border-top-color: var(--jwlry-accent);
    border-radius: 50%;
    animation: jwlry-spin 0.7s linear infinite;
}

@keyframes jwlry-spin {
    to { transform: rotate(360deg); }
}

/* Canvas Container */
#jwlry-canvas-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    width: 100%;
}

#jwlry-canvas {
    cursor: grab;
    touch-action: none;
    width: 100%;
    aspect-ratio: 1 / 1;
    background: linear-gradient(45deg, #f0f0f0 25%, transparent 25%),
                linear-gradient(-45deg, #f0f0f0 25%, transparent 25%),
                linear-gradient(45deg, transparent 75%, #f0f0f0 75%),
                linear-gradient(-45deg, transparent 75%, #f0f0f0 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    background-color: #fff;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

#jwlry-canvas:active {
    cursor: grabbing;
}

/* Scale Control */
#jwlry-scale-control {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
}

#jwlry-scale-control label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #555;
    white-space: nowrap;
}

#jwlry-scale {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: #ddd;
    border-radius: 3px;
    outline: none;
}

#jwlry-scale::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--jwlry-accent);
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.1s ease;
}

#jwlry-scale::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

#jwlry-scale::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--jwlry-accent);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

/* Reset Button */
.jwlry-reset-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    width: 100%;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #666;
    background: transparent;
    border: 1px solid #ccc;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.jwlry-reset-btn:hover {
    color: #333;
    border-color: #999;
    background: #f5f5f5;
}

.jwlry-reset-btn::before {
    content: "\21BB";
    font-size: 1rem;
}

/* Options */
#jwlry-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.jwlry-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9375rem;
    color: #333;
}

.jwlry-checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--jwlry-accent);
}

/* Generate Button */
#jwlry-generate-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, var(--jwlry-accent), var(--jwlry-accent-dark));
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 48px;
}

#jwlry-generate-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--jwlry-accent-dark), var(--jwlry-accent-darker));
    transform: translateY(-1px);
    box-shadow: 0 4px 12px color-mix(in srgb, var(--jwlry-accent) 30%, transparent);
}

#jwlry-generate-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ==========================================================================
   Loading Overlay
   ========================================================================== */

#jwlry-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(28, 38, 43, 0.92);
    border-radius: 12px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    overflow: hidden;
}

#jwlry-loading-message {
    color: #EFEFFA;
    font-size: 1rem;
    font-weight: 500;
    text-align: center;
    margin: 0;
    padding: 0 1rem;
    animation: jwlry-pulse 2s ease-in-out infinite;
}

/* ==========================================================================
   Wizard Loader - Jewelry Forging Animation
   ========================================================================== */

.jwlry-wizard-scene {
    display: flex;
    flex-direction: row-reverse;
    transform: scale(0.7);
}

.jwlry-wizard {
    position: relative;
    width: 190px;
    height: 240px;
}

.jwlry-wizard .body {
    position: absolute;
    bottom: 0;
    left: 68px;
    height: 100px;
    width: 60px;
    background: var(--jwlry-accent);
}
.jwlry-wizard .body::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 20px;
    height: 100px;
    width: 60px;
    background: var(--jwlry-accent);
    transform: skewX(14deg);
}

.jwlry-wizard .right-arm {
    position: absolute;
    bottom: 74px;
    left: 110px;
    height: 44px;
    width: 90px;
    background: var(--jwlry-accent);
    border-radius: 22px;
    transform-origin: 16px 22px;
    transform: rotate(70deg);
    animation: jwlry-right-arm 10s ease-in-out infinite;
}
.jwlry-wizard .right-hand {
    position: absolute;
    right: 8px;
    bottom: 8px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #f1c5b4;
    transform-origin: center center;
    transform: rotate(-40deg);
    animation: jwlry-right-hand 10s ease-in-out infinite;
}
.jwlry-wizard .right-hand::after {
    content: "";
    position: absolute;
    right: 0px;
    top: -8px;
    width: 15px;
    height: 30px;
    border-radius: 10px;
    background: #f1c5b4;
    transform: translateY(16px);
    animation: jwlry-right-finger 10s ease-in-out infinite;
}

.jwlry-wizard .left-arm {
    position: absolute;
    bottom: 74px;
    left: 26px;
    height: 44px;
    width: 70px;
    background: var(--jwlry-accent);
    border-bottom-left-radius: 8px;
    transform-origin: 60px 26px;
    transform: rotate(-70deg);
    animation: jwlry-left-arm 10s ease-in-out infinite;
}
.jwlry-wizard .left-hand {
    position: absolute;
    left: -18px;
    top: 0;
    width: 18px;
    height: 30px;
    border-top-left-radius: 35px;
    border-bottom-left-radius: 35px;
    background: #f1c5b4;
}
.jwlry-wizard .left-hand::after {
    content: "";
    position: absolute;
    right: 0;
    top: 0;
    width: 30px;
    height: 15px;
    border-radius: 20px;
    background: #f1c5b4;
    transform-origin: right bottom;
    transform: scaleX(0);
    animation: jwlry-left-finger 10s ease-in-out infinite;
}

.jwlry-wizard .head {
    position: absolute;
    top: 0;
    left: 14px;
    width: 160px;
    height: 210px;
    transform-origin: center center;
    transform: rotate(-3deg);
    animation: jwlry-head 10s ease-in-out infinite;
}
.jwlry-wizard .beard {
    position: absolute;
    bottom: 0;
    left: 38px;
    height: 106px;
    width: 80px;
    border-bottom-right-radius: 55%;
    background: #ffffff;
}
.jwlry-wizard .beard::after {
    content: "";
    position: absolute;
    top: 16px;
    left: -10px;
    width: 40px;
    height: 20px;
    border-radius: 20px;
    background: #ffffff;
}
.jwlry-wizard .face {
    position: absolute;
    bottom: 76px;
    left: 38px;
    height: 30px;
    width: 60px;
    background: #f1c5b4;
}
.jwlry-wizard .face::before {
    content: "";
    position: absolute;
    top: 0px;
    left: 40px;
    width: 20px;
    height: 40px;
    border-bottom-right-radius: 20px;
    border-bottom-left-radius: 20px;
    background: #f1c5b4;
}
.jwlry-wizard .face::after {
    content: "";
    position: absolute;
    top: 16px;
    left: -10px;
    width: 50px;
    height: 20px;
    border-radius: 20px;
    border-bottom-right-radius: 0px;
    background: #ffffff;
}
.jwlry-wizard .adds {
    position: absolute;
    top: 0px;
    left: -10px;
    width: 40px;
    height: 20px;
    border-radius: 20px;
    background: #f1c5b4;
}
.jwlry-wizard .adds::after {
    content: "";
    position: absolute;
    top: 5px;
    left: 80px;
    width: 15px;
    height: 20px;
    border-bottom-right-radius: 20px;
    border-top-right-radius: 20px;
    background: #f1c5b4;
}
.jwlry-wizard .hat {
    position: absolute;
    bottom: 106px;
    left: 0;
    width: 160px;
    height: 20px;
    border-radius: 20px;
    background: var(--jwlry-accent);
}
.jwlry-wizard .hat::before {
    content: "";
    position: absolute;
    top: -70px;
    left: 50%;
    transform: translatex(-50%);
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 34px 70px 50px;
    border-color: transparent transparent var(--jwlry-accent) transparent;
}
.jwlry-wizard .hat::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 160px;
    height: 20px;
    background: var(--jwlry-accent);
    border-radius: 20px;
}
.jwlry-wizard .hat-of-the-hat {
    position: absolute;
    bottom: 78px;
    left: 79px;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 25px 25px 19px;
    border-color: transparent transparent var(--jwlry-accent) transparent;
}
.jwlry-wizard .hat-of-the-hat::after {
    content: "";
    position: absolute;
    top: 6px;
    left: -4px;
    width: 35px;
    height: 10px;
    border-radius: 10px;
    border-bottom-left-radius: 0px;
    background: var(--jwlry-accent);
    transform: rotate(40deg);
}
.jwlry-wizard .four-point-star {
    position: absolute;
    width: 12px;
    height: 12px;
}
.jwlry-wizard .four-point-star::after,
.jwlry-wizard .four-point-star::before {
    content: "";
    position: absolute;
    background: #ffffff;
    display: block;
    left: 0;
    width: 141.4213%;
    top: 0;
    bottom: 0;
    border-radius: 10%;
    transform: rotate(66.66deg) skewX(45deg);
}
.jwlry-wizard .four-point-star::after {
    transform: rotate(156.66deg) skew(45deg);
}
.jwlry-wizard .four-point-star.--first {
    bottom: 28px;
    left: 46px;
}
.jwlry-wizard .four-point-star.--second {
    bottom: 40px;
    left: 80px;
}
.jwlry-wizard .four-point-star.--third {
    bottom: 15px;
    left: 108px;
}

/* Jewelry Objects */
.jwlry-objects {
    position: relative;
    width: 200px;
    height: 240px;
    z-index: 1;
}

/* Ring */
.jwlry-ring {
    position: absolute;
    bottom: -60px;
    left: -5px;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    transform: rotate(-360deg);
    animation: jwlry-path-ring 10s ease-in-out infinite;
}
.jwlry-ring::after {
    content: "";
    position: absolute;
    top: 10px;
    left: 0;
    width: 40px;
    height: 40px;
    border: 8px solid #ffd700;
    border-radius: 50%;
    box-shadow: 0 0 10px #ffd700, inset 0 0 5px rgba(255, 215, 0, 0.5);
}
.jwlry-ring::before {
    content: "";
    position: absolute;
    top: 2px;
    left: 12px;
    width: 14px;
    height: 14px;
    background: #e0115f;
    border-radius: 2px;
    transform: rotate(45deg);
    box-shadow: 0 0 8px #e0115f;
}

/* Pendant */
.jwlry-pendant {
    position: absolute;
    bottom: 10px;
    left: 0;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    transform: rotate(-360deg);
    animation: jwlry-path-pendant 10s ease-in-out infinite;
}
.jwlry-pendant::after {
    content: "";
    position: absolute;
    bottom: -10px;
    left: 25px;
    width: 30px;
    height: 40px;
    background: linear-gradient(135deg, #c0c0c0 0%, #e8e8e8 50%, #a0a0a0 100%);
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    box-shadow: 0 0 10px rgba(192, 192, 192, 0.6);
}
.jwlry-pendant::before {
    content: "";
    position: absolute;
    bottom: 26px;
    left: 35px;
    width: 10px;
    height: 10px;
    border: 3px solid #c0c0c0;
    border-radius: 50%;
}

/* Gem */
.jwlry-gem {
    position: absolute;
    bottom: -62px;
    left: -10px;
    width: 110px;
    height: 110px;
    border-radius: 50%;
    transform: rotate(-360deg);
    animation: jwlry-path-gem 10s ease-in-out infinite;
}
.jwlry-gem::after {
    content: "";
    position: absolute;
    top: 0;
    right: -10px;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 20px 35px 20px;
    border-color: transparent transparent #4169e1 transparent;
    filter: drop-shadow(0 0 6px #4169e1);
}
.jwlry-gem::before {
    content: "";
    position: absolute;
    top: 35px;
    right: -10px;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 15px 20px 0 20px;
    border-color: #2a4db5 transparent transparent transparent;
}

/* Sparkles - positioned over jewelry */
.jwlry-sparkles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}
.jwlry-sparkle {
    position: absolute;
    width: 6px;
    height: 6px;
    background: #fff;
    border-radius: 50%;
    opacity: 0;
    box-shadow: 0 0 6px #fff, 0 0 10px #ffd700;
}
.jwlry-sparkle:nth-child(1) {
    top: -120px;
    left: 15px;
    animation: jwlry-sparkle 10s ease-in-out infinite;
    animation-delay: 1.2s;
}
.jwlry-sparkle:nth-child(2) {
    top: -140px;
    left: 50px;
    animation: jwlry-sparkle 10s ease-in-out infinite;
    animation-delay: 1.8s;
}
.jwlry-sparkle:nth-child(3) {
    top: -100px;
    left: 35px;
    animation: jwlry-sparkle 10s ease-in-out infinite;
    animation-delay: 2.4s;
}
.jwlry-sparkle:nth-child(4) {
    top: -130px;
    left: 70px;
    animation: jwlry-sparkle 10s ease-in-out infinite;
    animation-delay: 3s;
}
.jwlry-sparkle:nth-child(5) {
    top: -110px;
    left: 5px;
    animation: jwlry-sparkle 10s ease-in-out infinite;
    animation-delay: 3.5s;
}
.jwlry-sparkle:nth-child(6) {
    top: -150px;
    left: 25px;
    animation: jwlry-sparkle 10s ease-in-out infinite;
    animation-delay: 4s;
}

/* Wizard Animations */
@keyframes jwlry-right-arm {
    0% { transform: rotate(70deg); }
    10% { transform: rotate(8deg); }
    15% { transform: rotate(20deg); }
    20% { transform: rotate(10deg); }
    25% { transform: rotate(26deg); }
    30% { transform: rotate(10deg); }
    35% { transform: rotate(28deg); }
    40% { transform: rotate(9deg); }
    45% { transform: rotate(28deg); }
    50% { transform: rotate(8deg); }
    58% { transform: rotate(74deg); }
    62%, 100% { transform: rotate(70deg); }
}

@keyframes jwlry-left-arm {
    0% { transform: rotate(-70deg); }
    10% { transform: rotate(6deg); }
    15% { transform: rotate(-18deg); }
    20% { transform: rotate(5deg); }
    25% { transform: rotate(-18deg); }
    30% { transform: rotate(5deg); }
    35% { transform: rotate(-17deg); }
    40% { transform: rotate(5deg); }
    45% { transform: rotate(-18deg); }
    50% { transform: rotate(6deg); }
    58% { transform: rotate(-74deg); }
    62%, 100% { transform: rotate(-70deg); }
}

@keyframes jwlry-right-hand {
    0% { transform: rotate(-40deg); }
    10% { transform: rotate(-20deg); }
    15% { transform: rotate(-5deg); }
    20% { transform: rotate(-60deg); }
    25% { transform: rotate(-0deg); }
    30% { transform: rotate(-60deg); }
    35% { transform: rotate(-0deg); }
    40% { transform: rotate(-40deg); }
    45% { transform: rotate(-60deg); }
    50% { transform: rotate(10deg); }
    60%, 100% { transform: rotate(-40deg); }
}

@keyframes jwlry-right-finger {
    0% { transform: translateY(16px); }
    10% { transform: none; }
    50% { transform: none; }
    60%, 100% { transform: translateY(16px); }
}

@keyframes jwlry-left-finger {
    0% { transform: scaleX(0); }
    10% { transform: scaleX(1) rotate(6deg); }
    15% { transform: scaleX(1) rotate(0deg); }
    20% { transform: scaleX(1) rotate(8deg); }
    25% { transform: scaleX(1) rotate(0deg); }
    30% { transform: scaleX(1) rotate(7deg); }
    35% { transform: scaleX(1) rotate(0deg); }
    40% { transform: scaleX(1) rotate(5deg); }
    45% { transform: scaleX(1) rotate(0deg); }
    50% { transform: scaleX(1) rotate(6deg); }
    58%, 100% { transform: scaleX(0); }
}

@keyframes jwlry-head {
    0% { transform: rotate(-3deg); }
    10% { transform: translatex(10px) rotate(7deg); }
    50% { transform: translatex(0px) rotate(0deg); }
    56%, 100% { transform: rotate(-3deg); }
}

/* Jewelry Path Animations */
@keyframes jwlry-path-ring {
    0% { transform: translateY(0); }
    10% { transform: translateY(-155px) translatex(-15px) rotate(10deg); }
    55% { transform: translateY(-155px) translatex(-15px) rotate(-350deg); }
    57% { transform: translateY(-155px) translatex(-15px) rotate(-350deg); }
    63%, 100% { transform: rotate(-360deg); }
}

@keyframes jwlry-path-pendant {
    0% { transform: translateY(0); }
    10% { transform: translateY(-100px) rotate(-5deg); }
    55% { transform: translateY(-100px) rotate(-360deg); }
    58% { transform: translateY(-100px) rotate(-360deg); }
    63%, 100% { transform: rotate(-360deg); }
}

@keyframes jwlry-path-gem {
    0% { transform: translateY(0); }
    10% { transform: translateY(-172px) translatex(10px) rotate(-10deg); }
    55% { transform: translateY(-172px) translatex(10px) rotate(-365deg); }
    58% { transform: translateY(-172px) translatex(10px) rotate(-365deg); }
    63%, 100% { transform: rotate(-360deg); }
}

@keyframes jwlry-sparkle {
    0%, 9% { opacity: 0; transform: scale(0); }
    12% { opacity: 1; transform: scale(1.2); }
    14% { opacity: 1; transform: scale(0.8); }
    16% { opacity: 1; transform: scale(1.5); }
    18% { opacity: 0.8; transform: scale(1); }
    20% { opacity: 1; transform: scale(1.3); }
    22% { opacity: 0; transform: scale(0); }
    25% { opacity: 1; transform: scale(1); }
    27% { opacity: 0; transform: scale(0); }
    30% { opacity: 1; transform: scale(1.2); }
    32% { opacity: 0; transform: scale(0); }
    35% { opacity: 1; transform: scale(0.9); }
    37% { opacity: 0; transform: scale(0); }
    40% { opacity: 1; transform: scale(1.1); }
    42% { opacity: 0; transform: scale(0); }
    45% { opacity: 1; transform: scale(1); }
    48% { opacity: 0; transform: scale(0); }
    55%, 100% { opacity: 0; transform: scale(0); }
}

/* Rising Sparks - float upward from jewelry */
.jwlry-spark-rise {
    position: absolute;
    width: 4px;
    height: 4px;
    background: #ffd700;
    border-radius: 50%;
    opacity: 0;
    box-shadow: 0 0 4px #ffd700, 0 0 8px #ff8c00;
}

.jwlry-spark-rise:nth-child(7) {
    left: 10px;
    bottom: 120px;
    animation: jwlry-spark-rise-1 10s ease-out infinite;
    animation-delay: 1s;
}
.jwlry-spark-rise:nth-child(8) {
    left: 30px;
    bottom: 110px;
    animation: jwlry-spark-rise-2 10s ease-out infinite;
    animation-delay: 1.3s;
}
.jwlry-spark-rise:nth-child(9) {
    left: 50px;
    bottom: 130px;
    animation: jwlry-spark-rise-1 10s ease-out infinite;
    animation-delay: 1.6s;
}
.jwlry-spark-rise:nth-child(10) {
    left: 20px;
    bottom: 140px;
    animation: jwlry-spark-rise-3 10s ease-out infinite;
    animation-delay: 1.9s;
}
.jwlry-spark-rise:nth-child(11) {
    left: 40px;
    bottom: 115px;
    animation: jwlry-spark-rise-2 10s ease-out infinite;
    animation-delay: 2.2s;
}
.jwlry-spark-rise:nth-child(12) {
    left: 60px;
    bottom: 125px;
    animation: jwlry-spark-rise-1 10s ease-out infinite;
    animation-delay: 2.5s;
}
.jwlry-spark-rise:nth-child(13) {
    left: 15px;
    bottom: 135px;
    animation: jwlry-spark-rise-3 10s ease-out infinite;
    animation-delay: 2.8s;
}
.jwlry-spark-rise:nth-child(14) {
    left: 45px;
    bottom: 120px;
    animation: jwlry-spark-rise-2 10s ease-out infinite;
    animation-delay: 3.1s;
}
.jwlry-spark-rise:nth-child(15) {
    left: 25px;
    bottom: 145px;
    animation: jwlry-spark-rise-1 10s ease-out infinite;
    animation-delay: 3.4s;
}
.jwlry-spark-rise:nth-child(16) {
    left: 55px;
    bottom: 118px;
    animation: jwlry-spark-rise-3 10s ease-out infinite;
    animation-delay: 3.7s;
}
.jwlry-spark-rise:nth-child(17) {
    left: 35px;
    bottom: 128px;
    animation: jwlry-spark-rise-2 10s ease-out infinite;
    animation-delay: 4s;
}
.jwlry-spark-rise:nth-child(18) {
    left: 8px;
    bottom: 138px;
    animation: jwlry-spark-rise-1 10s ease-out infinite;
    animation-delay: 4.3s;
}

/* Different rise patterns */
@keyframes jwlry-spark-rise-1 {
    0%, 10% { opacity: 0; transform: translateY(0) scale(0); }
    12% { opacity: 1; transform: translateY(0) scale(1); }
    35% { opacity: 0.8; transform: translateY(-60px) translateX(10px) scale(0.6); }
    50% { opacity: 0; transform: translateY(-100px) translateX(15px) scale(0); }
    100% { opacity: 0; transform: translateY(0) scale(0); }
}

@keyframes jwlry-spark-rise-2 {
    0%, 10% { opacity: 0; transform: translateY(0) scale(0); }
    12% { opacity: 1; transform: translateY(0) scale(1.2); }
    30% { opacity: 0.9; transform: translateY(-40px) translateX(-8px) scale(0.8); }
    45% { opacity: 0; transform: translateY(-80px) translateX(-12px) scale(0); }
    100% { opacity: 0; transform: translateY(0) scale(0); }
}

@keyframes jwlry-spark-rise-3 {
    0%, 10% { opacity: 0; transform: translateY(0) scale(0); }
    12% { opacity: 1; transform: translateY(0) scale(0.8); }
    40% { opacity: 0.7; transform: translateY(-70px) translateX(5px) scale(0.5); }
    55% { opacity: 0; transform: translateY(-110px) translateX(8px) scale(0); }
    100% { opacity: 0; transform: translateY(0) scale(0); }
}

/* Status Message */
#jwlry-status {
    font-size: 0.875rem;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    text-align: center;
    min-height: 1.5rem;
}

#jwlry-status:empty {
    display: none;
}

.jwlry-status-info {
    background: color-mix(in srgb, var(--jwlry-accent) 10%, #fff);
    color: var(--jwlry-accent-dark);
}

.jwlry-status-success {
    background: #d4edda;
    color: #155724;
}

.jwlry-status-error {
    background: #f8d7da;
    color: #721c24;
}

/* ==========================================================================
   Preview Panel
   ========================================================================== */

#jwlry-preview-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    padding: 0.75rem;
    width: 100%;
}

#jwlry-model-viewer {
    display: block;
    position: relative;
    width: 100%;
    max-width: 520px;
    height: auto;
    aspect-ratio: 1 / 1;
    background: transparent;
    border-radius: 12px;
    outline: none;
    touch-action: pan-y;
    --poster-color: transparent;
    --progress-bar-color: rgba(180, 160, 120, 0.6);
    --progress-bar-height: 3px;
}

#jwlry-model-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f5f5f5, #e8e8e8);
    border-radius: 12px;
    color: #888;
    font-size: 0.9375rem;
    text-align: center;
    padding: 1rem;
    z-index: 1;
}

/* ==========================================================================
   Viewer Controls
   ========================================================================== */

#jwlry-viewer-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.5rem 0;
    width: 100%;
    max-width: 520px;
}

.jwlry-camera-presets {
    display: flex;
    gap: 0.25rem;
}

.jwlry-preset-btn {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #666;
    background: transparent;
    border: 1px solid #ddd;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.jwlry-preset-btn:hover {
    color: #333;
    border-color: #bbb;
}

.jwlry-preset-btn.active {
    color: #fff;
    background: var(--jwlry-accent);
    border-color: var(--jwlry-accent);
}

.jwlry-viewer-toolbar {
    display: flex;
    gap: 0.25rem;
}

.jwlry-viewer-toolbar button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    color: #666;
    background: transparent;
    border: 1px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.jwlry-viewer-toolbar button:hover {
    color: #333;
    border-color: #bbb;
    background: #f5f5f5;
}

.jwlry-viewer-toolbar button.active {
    color: var(--jwlry-accent);
    border-color: color-mix(in srgb, var(--jwlry-accent) 40%, transparent);
}

/* Fullscreen */
#jwlry-preview-panel:fullscreen {
    background: #1c262b;
    padding: 2rem;
}

#jwlry-preview-panel:fullscreen #jwlry-model-viewer {
    max-width: min(85vh, 85vw);
    width: min(85vh, 85vw);
    height: min(85vh, 85vw);
}

#jwlry-preview-panel:fullscreen #jwlry-viewer-controls {
    max-width: min(85vh, 85vw);
}

#jwlry-preview-panel:fullscreen .jwlry-preset-btn,
#jwlry-preview-panel:fullscreen .jwlry-viewer-toolbar button {
    color: #aaa;
    border-color: #444;
}

#jwlry-preview-panel:fullscreen .jwlry-preset-btn:hover,
#jwlry-preview-panel:fullscreen .jwlry-viewer-toolbar button:hover {
    color: #fff;
    border-color: #666;
    background: rgba(255, 255, 255, 0.1);
}

#jwlry-preview-panel:fullscreen .jwlry-preset-btn.active {
    color: #fff;
    background: var(--jwlry-accent);
    border-color: var(--jwlry-accent);
}

#jwlry-preview-panel:fullscreen .jwlry-viewer-toolbar button.active {
    color: var(--jwlry-accent);
    border-color: var(--jwlry-accent);
}

/* ==========================================================================
   Responsive Adjustments
   ========================================================================== */

/* Stacked layout (below desktop breakpoint) */
@media (max-width: 839px) {
    #jwlry-wrapper {
        flex-direction: column;
    }

    #jwlry-editor-panel,
    #jwlry-preview-panel {
        width: 100%;
    }

    #jwlry-model-viewer,
    #jwlry-viewer-controls {
        max-width: 100%;
    }
}

/* Tablet: center content at a comfortable reading width */
@media (min-width: 540px) and (max-width: 839px) {
    #jwlry-editor-panel,
    #jwlry-preview-panel {
        max-width: 500px;
        margin-left: auto;
        margin-right: auto;
    }
}

/* Small screens */
@media (max-width: 539px) {
    #jwlry-upload-area {
        padding: 1.5rem 1rem;
    }

    .jwlry-wizard-scene {
        transform: scale(0.5);
    }

    .jwlry-preset-btn {
        padding: 0.3rem 0.5rem;
        font-size: 0.75rem;
    }

    .jwlry-viewer-toolbar button {
        width: 30px;
        height: 30px;
    }

    .jwlry-viewer-toolbar button svg {
        width: 15px;
        height: 15px;
    }
}

/* ==========================================================================
   Animations
   ========================================================================== */

/* Fade in for status messages */
#jwlry-status {
    animation: jwlry-fadeIn 0.3s ease;
}

@keyframes jwlry-fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Pulse animation for processing state */
#jwlry-generate-btn:disabled .jwlry-loading-text {
    animation: jwlry-pulse 1.5s ease-in-out infinite;
}

@keyframes jwlry-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

/* ==========================================================================
   Variation Buttons
   ========================================================================== */

#jwlry-variation-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
    width: 100%;
    padding: 0.5rem 0 1rem;
}

#jwlry-variation-buttons:empty {
    display: none;
}

.jwlry-variation-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.jwlry-variation-group-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #666;
    white-space: nowrap;
}

.jwlry-variation-group-buttons {
    display: flex;
    gap: 0.375rem;
}

.jwlry-variation-btn {
    padding: 0.5rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #666;
    background: transparent;
    border: 1px solid #ddd;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.jwlry-variation-btn:hover {
    color: #333;
    border-color: #bbb;
}

.jwlry-variation-btn.active {
    color: #fff;
    background: var(--jwlry-accent);
    border-color: var(--jwlry-accent);
}

/* ==========================================================================
   Step Headers
   ========================================================================== */

.jwlry-step-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0 0 0.25rem;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    color: #555;
    letter-spacing: 0.02em;
}

.jwlry-step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.4rem;
    height: 1.4rem;
    border-radius: 50%;
    background: var(--jwlry-accent);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}

/* Full-width steps (step 1 + variation buttons) */
.jwlry-step--full {
    flex-basis: 100%;
}

/* Desktop: show only step 1 label (no number), hide steps 2+3 */
@media (min-width: 840px) {
    .jwlry-step--full {
        justify-content: center;
        padding: 0;
    }
    .jwlry-step--full .jwlry-step-number {
        display: none;
    }
    .jwlry-step--editor,
    .jwlry-step--preview {
        display: none;
    }
}
