:root {
    --bg-color: #fffaf5;
    --card-bg: #ffffff;
    --border-color: #fce7d4;
    --accent: #f43f5e;
    --accent-hover: #e11d48;
    --text-primary: #3f2b2b;
    --text-secondary: #7c5c5c;
    --text-muted: #a89090;
    --radius-sm: 10px;
    --radius: 20px;
    --radius-lg: 32px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow: 0 10px 15px -3px rgba(0,0,0,0.05), 0 4px 6px -2px rgba(0,0,0,0.02);
    --shadow-lg: 0 25px 50px -12px rgba(0,0,0,0.1);
}

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

body {
    background-color: var(--bg-color);
    background-image: url("data:image/svg+xml,%3Csvg width='120' height='120' viewBox='0 0 120 120' xmlns='http://www.w3.org/2000/svg'%3E%3Ctext x='30' y='40' font-size='24' opacity='0.04' transform='rotate(-15 30 40)'%3E🍎%3C/text%3E%3Ctext x='90' y='100' font-size='20' opacity='0.03' transform='rotate(20 90 100)'%3E🍊%3C/text%3E%3C/svg%3E");
    background-attachment: fixed;
    color: var(--text-primary);
    font-family: 'Montserrat', sans-serif;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

.shell {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 24px;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
}

.topbar {
    margin-bottom: 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-logo {
    width: 52px;
    height: 52px;
    display: block;
    object-fit: contain;
    opacity: 0;
    transition: opacity 0.6s ease-out;
}

.brand-logo.loaded {
    opacity: 1;
}

.brand-title {
    font-weight: 800;
    font-size: 24px;
    color: var(--text-primary);
    letter-spacing: -0.03em;
    text-transform: uppercase;
}

.deposit-btn {
    background-color: var(--text-primary);
    color: #fff;
    border: none;
    padding: 14px 32px;
    font-size: 14px;
    font-weight: 700;
    border-radius: 100px;
    cursor: pointer;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    transition: all 0.3s ease;
}

.deposit-btn:hover {
    background-color: var(--accent);
    transform: scale(1.05);
}

/* Dashboard Header */
.dashboard-header {
    margin-bottom: 32px;
    text-align: center;
}

.dashboard-info h1 {
    font-size: 36px;
    font-weight: 900;
    letter-spacing: -0.04em;
    margin-bottom: 12px;
    background: linear-gradient(to right, var(--text-primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.dashboard-subtitle {
    color: var(--text-secondary);
    font-size: 18px;
    max-width: 700px;
    margin: 0 auto;
    line-height: 1.6;
}

/* Product Grid */
.grid-placeholders {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.product-card {
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    cursor: pointer;
}

.product-image-container {
    width: 100%;
    height: 180px;
    position: relative;
    overflow: hidden;
    padding: 0;
}

.product-image-container img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    padding: 24px;
    transform: scale(1.1);
    transition: transform 0.3s ease, opacity 0.6s ease-out;
    opacity: 0;
}

.product-image-container img.loaded {
    opacity: 1;
}

/* .product-card:nth-child(1) .product-image-container { background-color: #ffe4e6; }
.product-card:nth-child(2) .product-image-container { background-color: #fef9c3; }
.product-card:nth-child(3) .product-image-container { background-color: #ffedd5; }
.product-card:nth-child(4) .product-image-container { background-color: #ecfccb; }
.product-card:nth-child(5) .product-image-container { background-color: #fce7f3; }
.product-card:nth-child(6) .product-image-container { background-color: #f3e8ff; } */

.product-card:hover img {
    transform: scale(1.4);
}

.product-card .grid-item-header {
    padding: 16px 20px 8px 20px;
    margin-bottom: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.product-card .placeholder-text {
    padding: 0 20px 24px 20px;
    background: transparent;
    height: auto;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
}

.footer-note {
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid var(--border-color);
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.disclaimer {
    font-weight: 600;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

/* Modal */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(254, 242, 242, 0.85);
    backdrop-filter: blur(12px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
}

.modal-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 16px;
    max-width: 100%;
}

.modal {
    background: #ffffff;
    width: fit-content;
    border-radius: var(--radius-lg);
    padding: 0;
    position: relative;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.close-btn-outside {
    background: #ffffff;
    border: none;
    color: var(--text-primary);
    padding: 12px 24px;
    border-radius: 100px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.close-btn-outside:hover {
    background: #f8fafc;
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
}

.close-btn-outside.confirm {
    background: #ef4444;
    color: #ffffff;
}

.close-btn-outside.confirm:hover {
    background: #dc2626;
}

.widget-frame {
    width: 720px;
    height: 720px;
    max-width: 100%;
    max-height: calc(100vh - 120px);
    background: #ffffff;
    overflow: hidden;
}

#widget-host {
    width: 100%;
    height: 100%;
    background: #ffffff !important;
    display: block;
}

ttm-widget {
    background: #ffffff !important;
}

.error-panel {
    display: none;
    margin-top: 16px;
    padding: 16px;
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fee2e2;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
}

/* Responsive Design */
@media (max-width: 1120px) {
    .grid-placeholders {
        gap: 24px;
    }
}

@media (max-width: 1024px) {
    .grid-placeholders {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .shell {
        padding: 32px 16px;
    }

    .topbar {
        margin-bottom: 40px;
    }

    .dashboard-info h1 {
        font-size: 32px;
    }

    .dashboard-subtitle {
        font-size: 16px;
    }

    .modal-backdrop {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        padding: 0;
        overflow-y: hidden;
        background: #ffffff !important;
        backdrop-filter: none;
        z-index: 9999;
    }

    .modal-wrapper {
        width: 100%;
        height: 100%;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        align-items: stretch;
        gap: 0;
        background: #ffffff !important;
    }

    .modal {
        width: 100% !important;
        height: auto;
        flex-grow: 1;
        border-radius: 0;
        display: flex;
        flex-direction: column;
        box-shadow: none;
        overflow: hidden;
        background: #ffffff !important;
    }

    .widget-frame {
        width: 100% !important;
        height: 100% !important;
        flex-grow: 1;
        min-height: 0;
        max-height: none;
        background: #ffffff !important;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .close-btn-outside {
        position: relative;
        flex-shrink: 0;
        width: 100%;
        z-index: 1001;
        border-radius: 0;
        padding: calc(12px + env(safe-area-inset-top)) 16px 12px 16px;
        font-size: 13px;
        box-shadow: none;
        background: #ffffff !important;
        text-align: center;
        border-bottom: 1px solid #f1f5f9;
        color: var(--text-muted);
        text-decoration: underline;
        transition: color 0.2s;
        margin: 0;
    }
}

@media (max-width: 640px) {
    .topbar {
        flex-direction: column;
        gap: 32px;
        align-items: center;
        text-align: center;
    }

    .nav-links {
        width: 100%;
    }

    .deposit-btn {
        width: 100%;
        padding: 18px 32px;
        font-size: 16px;
    }

    .brand {
        flex-direction: column;
        gap: 12px;
    }

    .brand-logo {
        width: 80px;
        height: 80px;
    }

    .brand-title {
        font-size: 28px;
    }

    .grid-placeholders {
        grid-template-columns: 1fr;
    }
}
