:root {
    /* WooCommerce scheme */
    --woocommerce: #720eec;
    --wc-green: #7ad03a;
    --wc-red: #a00;
    --wc-orange: #ffba00;
    --wc-blue: #2ea2cc;
    --wc-primary: #720eec;
    --wc-primary-text: #fcfbfe;
    --wc-secondary: #e9e6ed;
    --wc-secondary-text: #515151;
    --wc-highlight: #958e09;
    --wc-highligh-text: white;
    --wc-content-bg: #fff;
    --wc-subtext: #767676;
    --wc-form-border-color: rgba(32, 7, 7, 0.8);
    --wc-form-border-radius: 4px;
    --wc-form-border-width: 1px;

    /* Theme mappings */
    --bg-color: #ebebeb;
    /* Light grey background like reference */
    --card-bg: #ffffff;
    /* Solid white cards */

    --text-primary: #333333;
    /* Dark text for readability on white */
    --text-secondary: #666666;

    --accent-primary: var(--wc-primary);
    --accent-secondary: var(--wc-blue);
    --accent-tertiary: var(--wc-green);

    --accent-glow: rgba(114, 14, 236, 0.3);
    /* Purple glow based on WC Primary */

    --font-main: 'Inter', system-ui, -apple-system, sans-serif;
    --transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);

    /* Legacy keeping */
    --primary-color: var(--accent-primary);
    --secondary-color: var(--accent-secondary);
    --text-color: var(--text-primary);
    --glass-bg: var(--card-bg);
    --glass-border: rgba(0, 0, 0, 0.08);
    /* Dark subtle border for glass */
    --card-radius: 24px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-main);
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

.alpha-banner {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: #ffcc00;
    color: #000;
    text-align: center;
    padding: 0.5rem;
    font-weight: bold;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

/* Animated Background Grid & Glowing Orb */
.background-blobs {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60vw;
    height: 60vw;
    background: radial-gradient(circle, rgba(114, 14, 236, 0.05) 0%, rgba(46, 162, 204, 0.02) 40%, transparent 70%);
    z-index: -1;
    pointer-events: none;
    filter: blur(60px);
    animation: orbPulse 8s ease-in-out infinite alternate;
}

@keyframes orbPulse {
    0% {
        opacity: 0.5;
        transform: translate(-50%, -50%) scale(0.8);
    }

    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.1);
    }
}

body::before {
    display: none;
    /* Remove background grids/gradients to match clean reference */
}

@keyframes gridMove {
    0% {
        transform: perspective(500px) rotateX(60deg) translateY(0);
    }

    100% {
        transform: perspective(500px) rotateX(60deg) translateY(50px);
    }
}

.container {
    width: 100%;
    max-width: 800px;
    padding: 2rem;
    margin: 0 auto;
    text-align: center;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

header {
    margin-bottom: 3rem;
}

h1 {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
}

.gradient-text {
    background: none;
    -webkit-text-fill-color: initial;
    color: var(--primary-color);
}

p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.drop-zone,
.preview-container,
.result-section {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--card-radius);
    padding: 1rem;
    transition: transform 0.3s ease, border-color 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.drop-zone {
    cursor: pointer;
    border-style: dashed;
}

.drop-zone:hover {
    transform: translateY(-5px);
    border-color: var(--primary-color);
}

.hint-box {
    margin-top: 1rem;
    margin-bottom: 2rem;
    padding: 0;
    background: none;
    border: none;
    text-align: center;
    font-size: 0.7rem;
    color: var(--text-secondary);
    opacity: 0.8;
}

.hint-box p {
    margin-bottom: 0.3rem;
    line-height: 1.4;
    color: inherit;
    font-size: 0.7rem;
}

.hint-box p:last-child {
    margin-bottom: 0;
}

.hint-contact {
    font-weight: 600;
}

.hint-contact a.nav-btn {
    font-size: 0.7rem;
    padding: 0.3rem 1rem;
    border-radius: 6px;
}

.drop-zone .icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.btn-primary,
.btn-secondary {
    padding: 12px 32px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    margin: 0.5rem;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: #767676;
    /* Solid grey */
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.btn-primary:hover {
    background: #515151;
    /* Darker grey */
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
}

.btn-secondary {
    background: #e0e0e0;
    color: #333333;
    border: 1px solid #cccccc;
}

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

#imagePreview {
    max-width: 100%;
    max-height: 300px;
    border-radius: 12px;
    margin-bottom: 2rem;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

/* Loader */
.loader {
    width: 48px;
    height: 48px;
    border: 5px solid #eee;
    /* Updated to contrast with white bg */
    border-bottom-color: var(--primary-color);
    border-radius: 50%;
    display: inline-block;
    box-sizing: border-box;
    animation: rotation 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes rotation {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 10px;
    margin-top: 1rem;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #767676;
    width: 0%;
    transition: width 0.5s ease;
}

/* History Vault Grid Styling */
#historyGrid div:hover {
    transform: translateY(-5px);
    box-shadow: 0 0 15px rgba(255, 0, 255, 0.4);
    border: 1px solid rgba(255, 0, 255, 0.5);
}

/* Outer shell: block layout; 3D canvas below uses original viewport-based height */
.viewer-container {
    display: block;
    width: 100%;
    margin-top: 0;
    margin-bottom: 0;
    padding-bottom: 0;
    overflow: hidden;
}

.viewer-canvas-wrap {
    display: block;
    position: relative;
    margin-top: 0;
    margin-bottom: 0.35rem;
    padding-bottom: 0;
    height: calc(100vh - 350px);
    min-height: 400px;
    overflow: hidden;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.02);
}

.viewer-glb-overlay[hidden] {
    display: none !important;
}

.viewer-glb-overlay {
    position: absolute;
    inset: 0;
    z-index: 12;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(6px);
    border-radius: 12px;
}

.viewer-glb-overlay__inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    max-width: 90%;
    text-align: center;
}

.viewer-glb-overlay__spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(0, 0, 0, 0.08);
    border-bottom-color: var(--primary-color, #767676);
    border-radius: 50%;
    box-sizing: border-box;
    animation: rotation 1s linear infinite;
}

.viewer-glb-overlay__text {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary, #1a1a1a);
}

.viewer-glb-overlay__bar {
    width: min(280px, 75vw);
    height: 6px;
    background: rgba(0, 0, 0, 0.08);
    border-radius: 10px;
    overflow: hidden;
}

.viewer-glb-overlay__fill {
    height: 100%;
    width: 0%;
    border-radius: 10px;
    background: linear-gradient(90deg, var(--accent-primary, #00c8e8), var(--primary-color, #767676));
    transition: width 0.2s ease-out;
}

/* Percentage height on model-viewer fails when the flex parent has no explicit px height; fill the wrap instead */
.viewer-canvas-wrap model-viewer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    border-radius: 12px;
}

/* Collapsed: only a centered pill; open: full-width card, expanded panel unchanged */
.viewer-color-bar {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 100%;
    margin-top: 0;
    margin-bottom: 0;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    backdrop-filter: none;
    overflow: visible;
}

.viewer-color-bar--open {
    align-items: stretch;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    box-shadow: 0 2px 14px rgba(0, 0, 0, 0.07);
    backdrop-filter: blur(10px);
    overflow: hidden;
}

.viewer-color-bar__toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    max-width: 100%;
    gap: 0.4rem;
    padding: 0.38rem 0.85rem;
    border: 1px solid rgba(0, 0, 0, 0.12);
    background: rgba(255, 255, 255, 0.96);
    cursor: pointer;
    font-family: inherit;
    text-align: center;
    color: var(--text-primary, #1a1a1a);
    border-radius: 999px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}

.viewer-color-bar--open .viewer-color-bar__toggle {
    display: flex;
    width: 100%;
    justify-content: space-between;
    text-align: left;
    padding: 0.5rem 0.75rem;
    border: none;
    border-radius: 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: none;
    background: transparent;
}

.viewer-color-bar__toggle:hover {
    background: rgba(0, 0, 0, 0.04);
}

.viewer-color-bar--open .viewer-color-bar__toggle:hover {
    background: rgba(0, 0, 0, 0.03);
}

.viewer-color-bar__toggle:focus-visible {
    outline: 2px solid var(--accent-primary, #00c8e8);
    outline-offset: 1px;
}

.viewer-color-bar__toggle-label {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.viewer-color-bar--open .viewer-color-bar__toggle-label {
    font-size: 0.85rem;
}

.viewer-color-bar__chevron {
    display: inline-block;
    width: 0.45rem;
    height: 0.45rem;
    border-right: 2px solid rgba(0, 0, 0, 0.45);
    border-bottom: 2px solid rgba(0, 0, 0, 0.45);
    transform: rotate(-45deg);
    margin-right: 0.2rem;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.viewer-color-bar--open .viewer-color-bar__chevron {
    transform: rotate(45deg);
    margin-top: -0.15rem;
}

.viewer-color-bar__panel {
    padding: 0.35rem 0.65rem 0.65rem;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    background: rgba(255, 255, 255, 0.55);
}

.viewer-color-bar__panel[hidden] {
    display: none !important;
}

.viewer-color-bar__scroll {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: center;
    gap: 0.5rem 0.65rem;
    max-height: min(42vh, 240px);
    overflow-x: auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    padding-top: 0.45rem;
    padding-bottom: 0.15rem;
}

.viewer-color-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
}

.viewer-color-group__label {
    font-size: 0.58rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: rgba(0, 0, 0, 0.4);
    text-align: center;
    line-height: 1.2;
    max-width: 5.5rem;
    white-space: normal;
}

.viewer-color-group__swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 0.22rem;
    justify-content: center;
}

.viewer-swatch {
    width: 26px;
    height: 26px;
    padding: 0;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    flex-shrink: 0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    outline: none;
}

.viewer-swatch:hover {
    transform: scale(1.07);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.viewer-swatch:focus-visible {
    box-shadow: 0 0 0 2px rgba(0, 243, 255, 0.55), 0 1px 3px rgba(0, 0, 0, 0.12);
}

.viewer-swatch.is-active {
    box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--accent-primary, #00c8e8);
    transform: scale(1.05);
}

.viewer-swatch--glossy.is-active {
    box-shadow:
        0 0 0 2px #fff,
        0 0 0 3px var(--accent-primary, #00c8e8),
        inset 0 -4px 8px rgba(0, 0, 0, 0.1),
        inset 0 5px 10px rgba(255, 255, 255, 0.4);
}

.viewer-swatch--original {
    background: linear-gradient(145deg, #f0f0f2, #d8d8dc);
    color: #444;
    display: flex;
    align-items: center;
    justify-content: center;
}

.viewer-swatch__ico {
    font-size: 0.85rem;
    line-height: 1;
    font-weight: 700;
}

.viewer-swatch--solid {
    background: var(--swatch-fill, #ccc);
    border: 1px solid rgba(0, 0, 0, 0.12);
}

.viewer-swatch--solid.viewer-swatch--glossy {
    box-shadow:
        0 1px 2px rgba(0, 0, 0, 0.08),
        inset 0 -6px 12px rgba(0, 0, 0, 0.12),
        inset 0 8px 14px rgba(255, 255, 255, 0.45);
}

.viewer-swatch--metal {
    border: 1px solid rgba(0, 0, 0, 0.15);
}

.viewer-swatch--rainbow {
    display: flex;
    align-items: center;
    justify-content: center;
    background: conic-gradient(from 0deg, #c13a3d, #ffbd25, #00a553, #23529a, #a855f7, #c13a3d);
    border: 1px solid rgba(0, 0, 0, 0.18);
}

.viewer-swatch--rainbow .viewer-swatch__rainbow-ico {
    font-size: 0.5rem;
    font-weight: 800;
    line-height: 1;
    color: #fff;
    text-shadow: 0 0 3px rgba(0, 0, 0, 0.85), 0 1px 2px rgba(0, 0, 0, 0.6);
    pointer-events: none;
}

body.wish-color-modal-open {
    overflow: hidden;
}

.wish-color-modal {
    position: fixed;
    inset: 0;
    z-index: 10050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    box-sizing: border-box;
}

.wish-color-modal[hidden] {
    display: none !important;
}

.wish-color-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10, 10, 18, 0.55);
    backdrop-filter: blur(4px);
}

.wish-color-modal__dialog {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    max-height: min(90vh, 560px);
    overflow-y: auto;
    padding: 1.35rem 1.4rem 1.25rem;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.22);
    color: #1a1a24;
    font-family: 'Inter', system-ui, sans-serif;
}

.wish-color-modal__close {
    position: absolute;
    top: 0.65rem;
    right: 0.65rem;
    width: 2.25rem;
    height: 2.25rem;
    border: none;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.06);
    color: #333;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wish-color-modal__close:hover {
    background: rgba(0, 0, 0, 0.1);
}

.wish-color-modal__title {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0 2rem 0.75rem 0;
    line-height: 1.25;
}

.wish-color-modal__intro {
    font-size: 0.88rem;
    line-height: 1.55;
    color: #3d3d4a;
    margin: 0 0 1rem;
}

.wish-color-modal__label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
    color: #2a2a33;
}

.wish-color-modal__input {
    width: 100%;
    box-sizing: border-box;
    min-height: 5.5rem;
    padding: 0.65rem 0.75rem;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 10px;
    font-size: 0.88rem;
    font-family: inherit;
    resize: vertical;
    margin-bottom: 1rem;
}

.wish-color-modal__input:focus {
    outline: none;
    border-color: var(--accent-primary, #00c8e8);
    box-shadow: 0 0 0 2px rgba(0, 200, 232, 0.2);
}

.wish-color-modal__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: flex-end;
}

.wish-color-modal__btn {
    padding: 0.55rem 1.1rem;
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid rgba(0, 0, 0, 0.12);
    background: #f4f4f6;
    color: #222;
    font-family: inherit;
}

.wish-color-modal__btn--primary {
    background: linear-gradient(135deg, #00d4e8, #0090a8);
    color: #fff;
    border: none;
}

.wish-color-modal__btn--primary:hover {
    filter: brightness(1.05);
}

model-viewer {
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.02);
    border-radius: 12px;
    display: block;
}

@media (max-width: 600px) {
    h1 {
        font-size: 2.5rem;
    }

    .container {
        padding: 1rem;
    }

    .drop-zone,
    .preview-container,
    .result-section {
        padding: 1.5rem;
    }
}

/* Selection Hub */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--card-radius);
    padding: 2rem;
    text-align: center;
    transition: transform 0.3s ease, border-color 0.3s ease;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.card:hover {
    transform: translateY(-5px);
    border-color: var(--primary-color);
}

.card .icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.card h3 {
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
}

.card p {
    margin-bottom: 1.5rem;
    font-size: 1rem;
}

.back-link {
    text-align: left;
    margin-bottom: 1rem;
    cursor: pointer;
    color: rgba(0, 0, 0, 0.4);
    transition: color 0.3s ease;
}

.back-link:hover {
    color: var(--primary-color);
}
/* ===== Responsive Header ===== */
.main-header {
    padding: 0.8rem 0;
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 100;
    background: #333333;
    border-bottom: 2px solid #222222;
    margin-bottom: 0;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-left .logo {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.header-left .logo img {
    height: 48px;
}

.header-brand {
    color: #ffffff;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: -0.02em;
}

.header-center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    pointer-events: none; /* Let clicks pass through if overlapping */
}

.header-center h1 {
    font-size: 1.2rem;
    margin-bottom: 0;
    color: #ffffff;
    letter-spacing: 0;
}

.header-center h1 span:last-child {
    color: #ffffff;
    font-weight: 800;
}

.header-center p {
    font-size: 0.7rem;
    margin-bottom: 0;
    color: #cccccc;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.lang-switcher {
    display: flex;
    gap: 0.3rem;
    font-size: 0.7rem;
    font-weight: bold;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.2rem 0.5rem;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-btn {
    padding: 0.4rem 1.2rem;
    background: #555555;
    color: #ffffff;
    font-weight: 600;
    border-radius: 4px;
    font-size: 0.8rem;
    text-decoration: none;
    transition: background 0.3s ease;
}

.nav-btn:hover {
    background: #666666;
}

@media (max-width: 1000px) {
    .header-brand {
        display: none;
    }
}

@media (max-width: 768px) {
    main.container {
        margin-top: 7rem !important;
    }

    .header-container {
        padding: 0 1rem;
        flex-wrap: wrap;
    }
    
    .header-center {
        position: static;
        transform: none;
        flex: 1 1 100%;
        margin: 0.8rem 0 0 0;
        align-items: center;
        text-align: center;
        order: 3;
    }
    
    .header-center h1 {
        font-size: 1.1rem;
    }
    
    .header-center p {
        display: block;
        font-size: 0.65rem;
    }
    
    .header-right {
        gap: 0.5rem;
    }
    
    .nav-btn {
        padding: 0.3rem 0.8rem;
    }
}

@media (max-width: 550px) {
    /* Prevent text from fully disappearing, instead we let it gracefully wrap. */
}
