:root {
    --sat-bottom: env(safe-area-inset-bottom, 0px);
    --keyboard-offset: 0px;
}

body, html {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    box-sizing: border-box;
}

body {
    font-family: 'Helvetica', sans-serif;
    color: #fff;
    background-color: black;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    font-size: 16px;
    padding-bottom: 100px; 
}

#origamiCanvas {
    display: block;
    position: fixed; 
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1; 
    pointer-events: none;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

.logo-container {
    text-align: center;
    margin-top: 1%;
    padding-top: 1px;
    width: 100%;
}

.logo-container img {
    width: 220px;
    max-width: 90%;
    height: auto;
    display: inline-block;
}

.main-content-wrapper {
    position: relative;
    width: 97%;
    max-width: 1600px; /* Restored to the correct wider format */
    margin-top: 40px;
}

.chat-container {
    width: 100%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(0, 0, 0, 0.6) 100%);
    border-radius: 15px;
    padding: 10px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5), inset 0 0 10px rgba(255, 255, 255, 0.05);
    z-index: 1;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    margin-top: 0;
}

.messages {
    overflow-y: auto;
    margin-bottom: 20px;
    flex-grow: 1;
    min-height: 30px;
}

@media only screen and (min-width: 600px) {
    .logo-container img { width: 320px; }
    .chat-container { padding: 2rem; }
}

@media only screen and (min-width: 768px) {
     .logo-container img { width: 480px; }
     .chat-container { padding: 3rem; }
}

.message { margin: 10px 0; padding: 10px; border-radius: 10px; max-width: 90%; display: flex; align-items: flex-start; gap: 8px; position: relative; word-break: break-word; overflow-wrap: break-word; }
.message.user { background: rgba(255, 204, 0, 0.15); margin-left: auto; }
.message.ai, .message.bot { 
    background-color: transparent;
    border: 8px solid rgba(255, 255, 255, 0.1);
    margin-right: auto; 
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
}
.ai-response-content { width: 100%; text-align: left; }
.ai-response-content p { margin-bottom: 0.8em; line-height: 1.5; }
.ai-response-content h1, .ai-response-content h2, .ai-response-content h3, .ai-response-content h4 { font-family: 'Orbitron', sans-serif; color: gold; letter-spacing: 1.5px; }
.ai-response-content .ai-content-title { padding-left: 10px; }
.ai-response-content a { color: gold; text-decoration: underline; }
.ai-response-content pre { background-color: rgba(0, 0, 0, 0.6); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 8px; padding: 10px 15px; overflow-x: auto; position: relative; padding-top: 35px; white-space: pre-wrap; }

.icon { width: 32px; height: 28px; border-radius: 50%; color: #222; font-size: 11px; font-weight: bold; display: flex; justify-content: center; align-items: center; background: gold; flex-shrink: 0; }
.message.user .icon { font-size: 15px; }
.message.ai .icon, .message.bot .icon { background: #fff; color: #444; }

.input-container { position: fixed; bottom: calc(var(--keyboard-offset) + var(--sat-bottom)); transition: bottom 0.3s ease-out; left: 0; width: 100%; display: flex; gap: 12px; padding: 0 20px 24px 20px; box-sizing: border-box; z-index: 1000; justify-content: center; pointer-events: none; }
.input-split-container { flex-grow: 1; display: flex; max-width: 1200px; /* Restored to the correct wider format */ width: 100%; pointer-events: auto; position: relative; gap: 15px; }

.button-group { display: flex; gap: 10px; flex-shrink: 0; }

.split-button { display: flex; align-items: center; justify-content: center; font-size: 16px; font-family: 'Orbitron', sans-serif; background-color: #FFD700; color: black; border: none; cursor: pointer; font-weight: bold; transition: background-color 0.2s ease-in-out, box-shadow 0.2s; border-radius: 14px; box-shadow: 0 2px 24px 0 rgba(0, 0, 0, 0.32), 0 0px 8px rgba(0, 0, 0, 0.20); padding: 12px 22px; touch-action: manipulation; min-height: 44px; -webkit-tap-highlight-color: transparent; }
.split-button:hover { background: #ffcc00; }
.split-button:active { background: #DAA520; transform: scale(0.97); }
.split-button.active-mode { background-color: #DAA520; }
.split-button:focus-visible { outline: 2px solid gold; outline-offset: 2px; box-shadow: 0 0 0 4px rgba(255, 215, 0, 0.3); }

input:focus-visible, select:focus-visible { border-color: gold; outline: none; box-shadow: 0 0 8px rgba(255, 215, 0, 0.5); }

@media only screen and (max-width: 767px) {
    .input-split-container { flex-direction: column; }
    .button-group { width: 100%; flex-wrap: wrap; justify-content: space-between; gap: 10px; }
    .split-button { flex: 1 1 calc(50% - 10px); font-size: 14px; padding: 12px 8px; min-height: 48px; }
}

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.5); border-radius: 10px; }
::-webkit-scrollbar-thumb { background-color: Gold; border-radius: 10px; border: 2px solid rgba(0, 0, 0, 0.7); }
::-webkit-scrollbar-thumb:hover { background-color: #ffcc00; }

.close-message-btn {
    background: none; 
    border: none; 
    color: #999; 
    font-size: 1.2em; 
    cursor: pointer; 
    position: absolute; 
    top: 5px; 
    right: 5px; 
    padding: 2px 5px; 
    z-index: 20;
}
.close-message-btn:hover { color: #fff; }

/* --- Gallery & Carousel Correction --- */
.in-chat-gallery-carousel {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px 0;
    width: 100%;
}

.in-chat-gallery-carousel .gallery-image-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    /* Locks height so the buy button is always in the same relative spot */
    height: clamp(250px, 50vh, 450px); 
    overflow: hidden;
    position: relative;
    gap: 5px;
}

.in-chat-gallery-carousel .gallery-main-image { 
    height: 100%;
    width: 100%;
    /* This is the key fix: it stops the image from cutting off */
    object-fit: contain; 
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.3s ease;
}

/* Container for the main image and overlay button */
.main-image-container {
    position: relative;
    width: 80%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* The Buy Button Overlay */
.carousel-buy-btn {
    position: absolute;
    bottom: 15px;
    right: 15px;
    z-index: 10;
    padding: 10px 20px !important;
    font-size: 14px !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.6) !important;
    border: 1px solid rgba(255,255,255,0.2) !important;
}

.in-chat-gallery-carousel .gallery-thumb-image { 
    flex-shrink: 0; 
    width: 10%; 
    height: 60%;
    object-fit: cover;
    opacity: 0.4; 
    border-radius: 4px;
    cursor: pointer;
}

@media only screen and (max-width: 600px) {
    .in-chat-gallery-carousel .gallery-image-wrapper {
        height: 300px; /* Shorter for mobile */
    }
    .carousel-buy-btn {
        bottom: 10px;
        right: 10px;
        padding: 8px 14px !important;
    }
}

/* Shopping Feature Styles */
.buy-view-container { display: flex; flex-wrap: wrap; gap: 20px; width: 100%; align-items: flex-start; }
.buy-view-image-col { flex: 1 1 280px; max-width: 100%; }
.buy-view-image-col img { width: 100%; height: auto; border-radius: 8px; border: 2px solid gold; box-shadow: 0 4px 15px rgba(0,0,0,0.5); }

.buy-view-options-col { 
    flex: 1 1 320px; 
    display: flex; 
    flex-direction: column; 
    gap: 12px; 
    height: auto;
    max-height: 600px; 
    overflow-y: auto; 
    -webkit-overflow-scrolling: touch;
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
}

.product-group.active .product-sizes { 
    max-height: 1000px; 
    padding: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1); 
    overflow: visible; 
}
.product-group:hover { background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 215, 0, 0.4); }

.product-header { 
    padding: 15px; 
    cursor: pointer; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    color: gold; 
    font-family: 'Orbitron', sans-serif; 
    font-size: 0.95em; 
    letter-spacing: 1.5px;
    min-height: 44px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
.product-header::after { content: '+'; font-weight: bold; font-size: 1.2em; transition: transform 0.3s; }

.product-group.active { background: rgba(0,0,0,0.6); border-color: gold; box-shadow: 0 0 15px rgba(255, 215, 0, 0.2); }
.product-group.active .product-header::after { content: '-'; transform: rotate(180deg); }

.product-sizes { 
    max-height: 0;
    overflow: hidden;
    display: flex; 
    flex-direction: column; 
    gap: 10px; 
    padding: 0 15px;
    transition: max-height 0.4s ease-out, padding 0.4s ease;
    border-top: 1px solid transparent;
}

.product-group.active .product-sizes { 
    max-height: none; 
    padding: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1); 
}

.size-option-item { 
    background: rgba(255, 255, 255, 0.03); 
    border: 1px solid rgba(255,255,255,0.15); 
    color: #fff; 
    padding: 12px 15px; 
    border-radius: 6px; 
    display: flex; 
    flex-wrap: wrap;
    justify-content: space-between; 
    align-items: center; 
    gap: 8px;
    font-family: 'Helvetica', sans-serif; 
    transition: all 0.2s; 
}
.size-option-item:hover { border-color: gold; background: rgba(255, 215, 0, 0.05); }
.size-option-item > span:first-child { min-width: 60px; font-weight: bold; }
.size-option-item > div { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }

.variant-select {
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 4px;
    padding: 4px 8px;
    margin-right: 10px;
    font-family: 'Helvetica', sans-serif;
    font-size: 0.9em;
    cursor: pointer;
}
.variant-select:focus {
    border-color: gold;
    outline: none;
}

.qty-controls { display: flex; align-items: center; gap: 10px; background: rgba(0,0,0,0.5); padding: 4px 8px; border-radius: 20px; border: 1px solid rgba(255,255,255,0.2); }
.qty-btn { background: none; border: 1px solid gold; color: gold; border-radius: 50%; width: 32px; height: 32px; cursor: pointer; display: flex; align-items: center; justify-content: center; font-weight: bold; font-size: 16px; line-height: 1; padding: 0; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.qty-btn:hover { background: gold; color: black; }
.qty-btn:active { background: gold; color: black; transform: scale(0.92); }
.qty-display { min-width: 20px; text-align: center; font-weight: bold; color: #fff; }

.price-text {
    color: #FFD700;
    font-weight: bold;
    font-family: 'Orbitron', sans-serif;
    margin-right: 15px;
    font-size: 1.1em;
    letter-spacing: 1px;
}

.buy-action-btn { 
    background: gold; 
    color: black; 
    border: none; 
    padding: 8px 12px; 
    border-radius: 4px; 
    font-weight: bold; 
    cursor: pointer; 
    font-family: 'Orbitron', sans-serif; 
    font-size: 1.2em; 
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
.buy-action-btn:hover { background: #ffcc00; box-shadow: 0 0 8px rgba(255, 215, 0, 0.5); }
.buy-action-btn:active { background: #DAA520; transform: scale(0.95); }

/* Updated Contact Form Styles */
.contact-form-container { 
    display: flex; 
    flex-direction: column; 
    gap: 15px; 
    width: 100%; 
    max-width: 400px; 
}
.contact-input { 
    width: 100%; 
    padding: 12px; 
    background: rgba(0, 0, 0, 0.8); 
    border: 1px solid rgba(255, 215, 0, 0.3); 
    color: #fff; 
    border-radius: 8px; 
    font-family: 'Helvetica', sans-serif;
    font-size: 16px; 
    outline: none; 
    box-sizing: border-box; 
    transition: border-color 0.3s;
    -webkit-appearance: none;
    appearance: none;
}
.contact-input:focus { border-color: gold; box-shadow: 0 0 8px rgba(255, 215, 0, 0.3); }
.contact-textarea { min-height: 100px; resize: vertical; }

.contact-field-error {
    color: #ff6b6b;
    font-size: 0.8em;
    margin-top: -10px;
}

.char-counter {
    margin-top: -10px;
    margin-bottom: 5px;
    font-size: 0.8em;
    color: #ccc;
    text-align: right;
}

.contact-submit-btn { font-family: 'Orbitron', sans-serif; background-color: #FFD700; color: black; border: none; cursor: pointer; font-weight: bold; border-radius: 14px; padding: 14px 22px; font-size: 16px; transition: background-color 0.2s, box-shadow 0.2s; box-shadow: 0 2px 24px 0 rgba(0, 0, 0, 0.32); width: 100%; min-height: 48px; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.contact-submit-btn:hover { background-color: #ffcc00; box-shadow: 0 0 15px rgba(255, 215, 0, 0.6); }
.contact-submit-btn:active { background-color: #DAA520; transform: scale(0.98); }
.contact-submit-btn:disabled { background-color: #555; color: #888; cursor: not-allowed; }

.hp-field {
    display: none !important;
    visibility: hidden;
    opacity: 0; 
    position: absolute; 
    top: 0; 
    left: 0; 
    height: 0; 
    width: 0; 
    z-index: -1; 
}

#gallery-viewer-container { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 2000; display: none; }

/* ---- Mobile-specific overrides ---- */
@media only screen and (max-width: 600px) {
    .logo-container { margin-top: 8px; }
    .main-content-wrapper { margin-top: 16px; width: 99%; }
    .contact-form-container { max-width: 100%; }
    .buy-view-container { flex-direction: column; }
    .buy-view-image-col { flex: none; width: 100%; max-width: 320px; margin: 0 auto; }
    .buy-view-options-col { flex: none; width: 100%; max-height: none; }
    .product-header { font-size: 0.85em; letter-spacing: 0.5px; }
    .price-text { font-size: 0.95em; }
    .close-message-btn { top: 2px; right: 2px; }
    .in-chat-gallery-carousel::after {
        content: 'â†  swipe â†’';
        display: block;
        position: absolute;
        bottom: 18px;
        left: 50%;
        transform: translateX(-50%);
        font-size: 0.7em;
        color: rgba(255,255,255,0.35);
        pointer-events: none;
        white-space: nowrap;
    }
}

.split-button, .qty-btn, .buy-action-btn, .product-header, .contact-submit-btn {
    user-select: none;
    -webkit-user-select: none;
}

.messages, .buy-view-options-col {
    -webkit-overflow-scrolling: touch;
}

@media (prefers-reduced-motion: reduce) {
    #origamiCanvas { display: none; }
    .split-button, .qty-btn, .buy-action-btn, .contact-submit-btn { transition: none; }
    .in-chat-gallery-carousel img { transition: none; }
}
    
/* --- Security Gate Styles --- */
#main-site-content {
    display: none; /* This is the magic lock. Hides the site until JS opens it. */
}

#turnstile-gate {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: black;
    z-index: 9999; /* Keeps the gate on top of absolutely everything */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.gate-logo {
    width: 280px;
    max-width: 80%;
    margin-bottom: 20px;
}

.gate-text {
    font-family: 'Orbitron', sans-serif;
    color: gold;
    letter-spacing: 2px;
    margin-bottom: 30px;
    font-size: 1.1em;

