/* DreamCase AI Styles */

/* Prevent double-tap zoom on mobile */
* { touch-action: manipulation; }

:root {
    --df-bg-sidebar: #f8f9fa;
    --df-bg-main: #f0f2f5;
    --df-surface: #ffffff;
    --df-text-main: #111113;
    --df-text-muted: #86868b;
    --df-text-light: #aaa;
    --df-border: #e6e8eb;
    --df-accent: #000000;
    --df-green: #20c997;
    --df-green-light: #e6f9f3;
    --df-shadow-soft: 0 8px 30px rgba(0,0,0,0.08);
    --df-shadow-hard: 0 10px 40px rgba(0,0,0,0.12);
    --df-radius-lg: 16px;
    --df-radius-md: 12px;
    --df-radius-sm: 8px;
    --df-font: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
}

body.df-body {
    margin: 0;
    padding: 0;
    background: var(--df-bg-main);
    font-family: var(--df-font);
    font-weight: 350;
    overflow: hidden; /* App handles its own scrolling */
    min-height: 100vh;
    min-height: 100dvh;
}

/* App Layout */
.df-app {
    display: flex;
    height: 100vh;
    height: 100dvh;
    width: 100vw;
    padding: 16px 24px 16px;
    box-sizing: border-box;
    gap: 24px;
}

/* --- SIDEBAR --- */
.df-sidebar {
    width: 260px;
    background: var(--df-surface);
    border: none;
    border-radius: var(--df-radius-lg);
    box-shadow: 0 4px 20px rgba(0,0,0,0.03);
    display: flex;
    flex-direction: column;
    padding: 24px 0;
    z-index: 10;
    min-height: 0;  /* Required for flex children to allow overflow */
    max-height: 100%; /* Never exceed parent (.df-app = 100vh minus padding) */
    overflow: hidden; /* Prevent sidebar content from pushing body scroll */
}

.df-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 24px;
    margin-bottom: 32px;
    font-size: 18px;
    color: var(--df-text-main);
}
.df-logo strong { font-weight: 700; }
.df-logo span { font-weight: 400; }

.df-mobile-header-language {
    display: none;
}

.df-tablet-header-status,
.df-tablet-header-action,
.df-tablet-header-save {
    display: none;
}

.df-language-selector {
    position: relative;
    display: inline-flex;
}
.df-language-selector-sidebar {
    width: 100%;
}
.df-language-trigger {
    border: 1px solid var(--df-border);
    background: var(--df-surface);
    color: var(--df-text-main);
    border-radius: 999px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-family: var(--df-font);
    font-weight: 600;
    line-height: 1;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
    padding: 8px 10px;
    font-size: 13px;
    min-width: auto;
    justify-content: center;
}
.df-language-selector-sidebar .df-language-trigger {
    width: 100%;
    justify-content: space-between;
    padding: 10px 12px;
    font-size: 12px;
}
.df-language-trigger-text {
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
}
.df-language-flag {
    font-size: 14px;
    line-height: 1;
}
.df-language-label {
    letter-spacing: 0.3px;
}
.df-language-selector-sidebar .df-language-label {
    letter-spacing: 0;
}
.df-language-chevron {
    opacity: 0.55;
    flex-shrink: 0;
}
.df-language-panel {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 10px);
    width: 190px;
    background: var(--df-surface);
    border: 1px solid var(--df-border);
    border-radius: 14px;
    padding: 6px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.10);
    z-index: 10000;
}
.df-language-selector-sidebar .df-language-panel {
    left: 0;
    right: 0;
    top: auto;
    bottom: calc(100% + 8px);
    width: auto;
}
.df-language-option {
    width: 100%;
    border: 0;
    background: transparent;
    color: var(--df-text-main);
    border-radius: 10px;
    padding: 9px 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-family: var(--df-font);
    text-align: left;
}
.df-language-option.is-active {
    background: var(--df-bg-main);
}
.df-language-option-flag {
    font-size: 15px;
    line-height: 1;
}
.df-language-option-name {
    flex: 1;
    font-size: 13px;
    font-weight: 600;
}
.df-language-option-check {
    opacity: 0.75;
}

.df-language-trigger:hover,
.df-language-option:hover {
    background: var(--df-bg-main) !important;
}

.df-nav {
    flex: 1;
    min-height: 0;             /* Allow shrinking below content size */
    overflow-y: auto;
    scrollbar-width: none;     /* Firefox: hide scrollbar */
    -ms-overflow-style: none;  /* IE/Edge */
    padding: 0 12px;
}
.df-nav::-webkit-scrollbar {
    display: none;             /* Chrome/Safari: hide scrollbar */
}

.df-nav-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-radius: var(--df-radius-sm);
    color: var(--df-text-main);
    font-weight: 500;
    cursor: pointer;
    font-size: 14px;
    margin-bottom: 4px;
    transition: background 0.2s;
    text-decoration: none;
}

.df-nav-item:hover, .df-nav-item.active {
    background: var(--df-bg-sidebar);
}

.df-nav-item .df-icon {
    width: 20px;
    margin-right: 12px;
    font-size: 16px;
    color: var(--df-text-muted);
}

.df-nav-item .df-chevron {
    margin-left: auto;
    font-size: 10px;
    color: var(--df-text-light);
}

.df-sub-nav {
    padding-left: 48px;
    padding-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
}

.df-sub-nav::before {
    content: '';
    position: absolute;
    left: 23px;
    top: -10px;
    bottom: 20px;
    width: 1px;
    background: var(--df-border);
}

.df-sub-nav a {
    text-decoration: none;
    color: var(--df-text-muted);
    font-size: 13px;
    font-weight: 500;
}

.df-sub-nav a.active {
    color: var(--df-text-main);
}
.df-sub-nav a.df-nav-disabled {
    opacity: 0.5;
    cursor: default;
    pointer-events: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.df-my-scenes {
    padding: 24px 24px 16px;
    border-top: 1px solid rgba(0,0,0,0.04);
    flex-shrink: 0;  /* Never shrink — stays pinned at bottom */
}

.df-scenes-title {
    font-size: 12px;
    color: var(--df-text-light);
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 16px;
}

.df-create-scene {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--df-text-main);
    font-size: 14px;
    font-weight: 600;
}
.df-create-scene .df-icon-plus {
    font-size: 18px;
    color: var(--df-text-muted);
}

/* --- MAIN CONTENT --- */
.df-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    background: transparent;
    gap: 0;
    overflow: hidden;
    padding-top: 0;
}

/* Top fade disabled by default; theme can opt into a header fade. */
.df-main::before {
    display: none;
}

/* Bottom fade+blur overlay - above prompt bar */
.df-main::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 120px;
    background: linear-gradient(to top, var(--df-bg-main), transparent);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    mask-image: linear-gradient(to top, black, transparent);
    -webkit-mask-image: linear-gradient(to top, black, transparent);
    z-index: 10;
    pointer-events: none;
}

/* TOPBAR */
.df-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: var(--df-surface);
    border-radius: var(--df-radius-lg);
    box-shadow: 0 4px 20px rgba(0,0,0,0.03);
    margin: 0 8px 0 8px;
    flex-shrink: 0;
    position: relative;
    z-index: 20;
}

.df-top-left, .df-top-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.df-icon-btn {
    background: transparent;
    border: none;
    color: var(--df-text-muted);
    font-size: 16px;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
}
.df-icon-btn:hover { background: rgba(0,0,0,0.05); }

.df-search {
    background: var(--df-bg-sidebar);
    border: 1px solid var(--df-border);
    border-radius: 30px;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    width: 320px;
    gap: 10px;
}
.df-search input {
    border: none;
    outline: none;
    background: transparent;
    width: 100%;
    font-size: 14px;
}
.df-search-icon { color: var(--df-text-muted); font-size: 14px; }

.df-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--df-text-main);
}
.df-dot {
    width: 6px;
    height: 6px;
    background: var(--df-green);
    border-radius: 50%;
}

.df-link {
    font-size: 13px;
    font-weight: 500;
    color: var(--df-text-main);
    text-decoration: none;
}

.df-btn-outline {
    background: transparent;
    border: 1px solid var(--df-border);
    color: var(--df-text-main);
    padding: 8px 16px;
    border-radius: 30px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    line-height: 1;
    text-decoration: none;
}
.df-btn-outline:hover { background: rgba(0,0,0,0.02); }

.df-avatar img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: block;
}

/* CONTENT AREA */
.df-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 8px 180px;
}
#view-detail.df-content {
    padding-bottom: 40px;
}
/* When detail view is active, disable the gradient overlays and overflow clipping */
.df-main:has(#view-detail) {
    overflow: visible;
}
.df-main:has(#view-detail)::before,
.df-main:has(#view-detail)::after {
    display: none;
}
/* When account view is active, disable overflow clipping and gradient overlays */
.df-main:has(#view-account) {
    overflow: visible;
}
.df-main:has(#view-account)::before,
.df-main:has(#view-account)::after {
    display: none;
}

.df-categories-wrapper {
    position: relative;
    margin-bottom: 24px;
    overflow: hidden;
}

.df-categories-row {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    scroll-behavior: smooth;
    -ms-overflow-style: none;
    scrollbar-width: none;
    padding: 2px 0;
}
.df-categories-row::-webkit-scrollbar {
    display: none; /* Chrome, Safari and Opera */
}

/* Category Navigation Arrows */
.df-cat-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    background: var(--df-surface);
    border: 1px solid var(--df-border);
    border-radius: 50%;
    display: none; /* Controlled by JS */
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    z-index: 10;
    color: var(--df-text-muted);
    transition: all 0.2s;
}
.df-cat-nav:hover {
    background: var(--df-bg-hover);
    color: var(--df-text-main);
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
.df-cat-nav:disabled {
    opacity: 0.3;
    cursor: default;
}
.df-cat-prev { left: 0; }
.df-cat-next { right: 0; }

.df-cat-card {
    flex-shrink: 0;
    background: var(--df-surface);
    border: 1px solid var(--df-border);
    border-radius: 14px;
    padding: 8px 14px 8px 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.2s;
}
.df-cat-card:hover {
    background: var(--df-bg-hover);
    border-color: rgba(0,0,0,0.1);
}
.df-cat-card.df-cat-active {
    background: rgba(0,0,0,0.05); /* Soft, non-intense background instead of black */
    border-color: rgba(0,0,0,0.15);
}
.df-cat-card.df-cat-active .df-cat-text strong {
    color: var(--df-text-main);
}
.df-cat-card.df-cat-active .df-cat-text span {
    color: var(--df-text-muted);
}

.df-cat-img {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    object-fit: cover;
}

.df-cat-text {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.df-cat-text strong {
    font-size: 13px;
    font-weight: 600;
    color: var(--df-text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}
.df-cat-text span {
    font-size: 11px;
    color: var(--df-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

/* MASONRY GRID */
.df-masonry {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-gap: 24px;
    grid-auto-rows: 50px;
    grid-auto-flow: dense;
}

.df-masonry-item {
    background: var(--df-surface);
    border-radius: var(--df-radius-lg);
    overflow: hidden;
    position: relative;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    cursor: pointer;
}

/* For DreamCase/DreamPillow: fill the card via absolute positioning so the
   dominant-color gradient shows while the image loads, without stretching the image. */
.df-masonry-item:not(.df-raw-texture) .df-masonry-img-wrapper {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
}
.df-masonry-item:not(.df-raw-texture) .df-grid-frame,
.df-masonry-item:not(.df-raw-texture) .df-grid-mat,
.df-masonry-item:not(.df-raw-texture) .df-grid-inner {
    width: 100%;
    height: 100%;
}

/* Staggered heights — 7-item cycle: middle gets 3 items (shorter), left/right get 2 each */
.df-masonry-item:nth-child(7n+1) { grid-column: 1; grid-row: span 6; }
.df-masonry-item:nth-child(7n+2) { grid-column: 2; grid-row: span 4; }
.df-masonry-item:nth-child(7n+3) { grid-column: 3; grid-row: span 6; }
.df-masonry-item:nth-child(7n+4) { grid-column: 2; grid-row: span 4; }
.df-masonry-item:nth-child(7n+5) { grid-column: 1; grid-row: span 6; }
.df-masonry-item:nth-child(7n+6) { grid-column: 2; grid-row: span 4; }
.df-masonry-item:nth-child(7n)   { grid-column: 3; grid-row: span 6; }

/* ===== DreamFrame: canvas artwork card ===== */
.df-masonry-item.df-raw-texture .df-masonry-img-wrapper {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 11%;
    box-sizing: border-box;
}
body.blog-2 #prinftul-results-grid .df-masonry-item.df-raw-texture:nth-child(7n+2) .df-masonry-img-wrapper,
body.blog-2 #prinftul-results-grid .df-masonry-item.df-raw-texture:nth-child(7n+4) .df-masonry-img-wrapper,
body.blog-2 #prinftul-results-grid .df-masonry-item.df-raw-texture:nth-child(7n+6) .df-masonry-img-wrapper {
    align-items: flex-end;
    padding: 9% 11% 0;
}
.df-masonry-item.df-raw-texture .df-masonry-img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 3px;
    display: block;
    filter: none;
    /* Canvas hanging shadow: layered for depth */
    box-shadow:
        0 0 0 1px rgba(0,0,0,0.12),
        0 2px 6px  rgba(0,0,0,0.28),
        0 8px 20px rgba(0,0,0,0.22),
        0 18px 40px rgba(0,0,0,0.14),
        inset 0 0 0 1px rgba(255,255,255,0.06);
    transition: box-shadow 0.35s ease, transform 0.35s ease;
}
/* No lift on hover for DreamFrame canvas cards */
.df-masonry-item.df-raw-texture:hover .df-masonry-img {
    transform: none;
}

/* ===== DreamFrame product-specific grid card overlays (div-based, matching create page) ===== */

/* --- Base wrapper styles (shrink-wrap around image, transparent by default) --- */
.df-raw-texture .df-grid-frame {
    max-width: 100%;
    max-height: 100%;
    overflow: hidden;
    padding: 0; background: transparent;
    transition: padding 0.3s ease, background 0.3s ease, box-shadow 0.3s ease;
    box-sizing: border-box;
    line-height: 0;
    position: relative;
}
.df-raw-texture .df-grid-mat {
    max-height: 100%;
    overflow: hidden;
    padding: 0; background: transparent;
    transition: padding 0.3s ease, background 0.3s ease;
    box-sizing: border-box;
    line-height: 0;
}
.df-raw-texture .df-grid-inner {
    position: relative;
    max-height: 100%;
    overflow: hidden;
    line-height: 0;
}
.df-raw-texture .df-grid-inner .df-masonry-img {
    border-radius: 0;
}
.df-raw-texture .df-grid-tex,
.df-raw-texture .df-grid-matte-overlay {
    position: absolute; inset: 0; pointer-events: none; z-index: 2;
    opacity: 0; transition: opacity 0.3s ease;
}
.df-raw-texture .df-grid-tex {
    background-image: var(--df-canvas-texture-url);
    background-size: 120px 120px;
    background-repeat: repeat;
    mix-blend-mode: multiply;
}
.df-raw-texture .df-grid-matte-overlay {
    background: linear-gradient(135deg, rgba(255,255,255,0.06) 0%, rgba(0,0,0,0.03) 100%);
}

/* --- Canvas products: show texture overlay --- */
body[data-df-product="canvas"] .df-raw-texture .df-grid-tex,
body[data-df-product="thin-canvas"] .df-raw-texture .df-grid-tex,
body[data-df-product="framed-canvas"] .df-raw-texture .df-grid-tex {
    opacity: 0.35;
}

/* --- Poster products: show matte overlay --- */
body[data-df-product="matte-poster"] .df-raw-texture .df-grid-matte-overlay,
body[data-df-product="framed-poster"] .df-raw-texture .df-grid-matte-overlay,
body[data-df-product="framed-poster-mat"] .df-raw-texture .df-grid-matte-overlay {
    opacity: 1;
}

/* --- Framed products: activate frame wrapper --- */
body[data-df-product="framed-canvas"] .df-raw-texture .df-grid-frame,
body[data-df-product="framed-poster"] .df-raw-texture .df-grid-frame,
body[data-df-product="framed-poster-mat"] .df-raw-texture .df-grid-frame {
    padding: 3%;
    background: var(--df-frame-color, #1a1a1a);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), inset 0 -1px 0 rgba(0,0,0,0.2);
}
body[data-df-product="framed-canvas"] .df-raw-texture .df-grid-frame::after,
body[data-df-product="framed-poster"] .df-raw-texture .df-grid-frame::after,
body[data-df-product="framed-poster-mat"] .df-raw-texture .df-grid-frame::after {
    content: "";
    position: absolute;
    inset: 0 0 -22% 0;
    background: var(--df-frame-color, #1a1a1a);
    pointer-events: none;
    z-index: 0;
}
body[data-df-product="framed-canvas"] .df-raw-texture .df-grid-mat,
body[data-df-product="framed-poster"] .df-raw-texture .df-grid-mat,
body[data-df-product="framed-poster-mat"] .df-raw-texture .df-grid-mat {
    position: relative;
    z-index: 1;
}
/* Inset shadow on framed image for depth */
body[data-df-product="framed-canvas"] .df-raw-texture .df-grid-inner,
body[data-df-product="framed-poster"] .df-raw-texture .df-grid-inner,
body[data-df-product="framed-poster-mat"] .df-raw-texture .df-grid-inner {
    box-shadow: inset 0 0 4px rgba(0,0,0,0.35);
}

/* --- Framed poster with mat: activate mat wrapper --- */
body[data-df-product="framed-poster-mat"] .df-raw-texture .df-grid-mat {
    padding: 5%;
    background: #f5f5f0;
}


/* DreamFrame: avoid showing a bare frame/mat before the artwork has loaded. */
.df-masonry-item.df-raw-texture:not(.df-frame-ready) .df-grid-frame {
    background: transparent !important;
    box-shadow: none !important;
}
.df-masonry-item.df-raw-texture:not(.df-frame-ready) .df-grid-mat {
    background: transparent !important;
}
.df-masonry-item.df-raw-texture:not(.df-frame-ready) .df-grid-inner {
    box-shadow: none !important;
}
.df-masonry-item.df-raw-texture:not(.df-frame-ready) .df-grid-tex,
.df-masonry-item.df-raw-texture:not(.df-frame-ready) .df-grid-matte-overlay {
    opacity: 0 !important;
}

/* ===== WIDESCREEN: 5-column masonry (≥ 1800px) ===== */
@media (min-width: 1800px) {
    .df-masonry {
        grid-template-columns: repeat(5, 1fr) !important;
    }
    /* 5-column stagger cycle — 10-item pattern */
    .df-masonry-item:nth-child(10n+1)  { grid-column: 1 !important; grid-row: span 6 !important; }
    .df-masonry-item:nth-child(10n+2)  { grid-column: 2 !important; grid-row: span 4 !important; }
    .df-masonry-item:nth-child(10n+3)  { grid-column: 3 !important; grid-row: span 7 !important; }
    .df-masonry-item:nth-child(10n+4)  { grid-column: 4 !important; grid-row: span 4 !important; }
    .df-masonry-item:nth-child(10n+5)  { grid-column: 5 !important; grid-row: span 6 !important; }
    .df-masonry-item:nth-child(10n+6)  { grid-column: 1 !important; grid-row: span 4 !important; }
    .df-masonry-item:nth-child(10n+7)  { grid-column: 2 !important; grid-row: span 7 !important; }
    .df-masonry-item:nth-child(10n+8)  { grid-column: 3 !important; grid-row: span 4 !important; }
    .df-masonry-item:nth-child(10n+9)  { grid-column: 4 !important; grid-row: span 6 !important; }
    .df-masonry-item:nth-child(10n)    { grid-column: 5 !important; grid-row: span 4 !important; }
    /* Browse by category: 5 cols on widescreen */
    .df-browse-grid {
        grid-template-columns: repeat(5, 1fr) !important;
    }
}

/* Tag pills on cards */
.df-card-tags {
    position: absolute;
    top: 12px;
    left: 12px;
    right: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    z-index: 3;
}
.df-card-tag {
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: white;
    font-size: 11px;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 20px;
    white-space: nowrap;
    letter-spacing: 0.3px;
}

/* Category filtering */
.df-masonry-item.df-hidden {
    display: none;
}
/* active state handled above in .df-cat-card.df-cat-active */

.df-masonry-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;     /* pin mockup to top — bottom gets cropped in short cards */
    display: block;
    transition: transform 0.3s ease, opacity 0.35s ease;
    background: transparent;         /* transparent so card gradient shows while loading */
    color: transparent;              /* hides alt text / broken icon */
}

/* Studio grid: show full mockups without cropping */
#prinftul-studio-grid .df-masonry-img {
    object-fit: contain;
    object-position: center center;
}

/* DreamFrame raw designs: center the artwork */
.df-masonry-item.df-raw-texture .df-masonry-img {
    object-position: center center;
}

/* DreamPet: center mockup images (square pet accessory mockups, not portrait phone cases) */
body.blog-4 .df-masonry-img {
    object-position: center center;
}

.df-masonry-overlay {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    padding: 16px;
    background: linear-gradient(transparent, rgba(0,0,0,0.6));
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    opacity: 0;
    transition: opacity 0.2s;
}
.df-masonry-item:hover .df-masonry-overlay { opacity: 1; }

.df-user-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    color: white;
    font-size: 13px;
    font-weight: 500;
}
.df-user-badge img {
    width: 24px; height: 24px; border-radius: 50%;
}

.df-action-icons {
    display: flex;
    gap: 8px;
}
.df-action-icons button {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 32px; height: 32px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(4px);
    cursor: pointer;
}
.df-action-icons button:hover { background: rgba(255,255,255,0.4); }
.df-action-icons .df-detail-link {
    background: rgba(255,255,255,0.2);
    color: white;
    width: 32px; height: 32px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(4px);
    text-decoration: none;
    transition: background 0.15s ease;
}
.df-action-icons .df-detail-link:hover { background: rgba(255,255,255,0.4); }

/* LIKE BUTTON */
.df-like-btn {
    position: relative;
    transition: transform 0.2s ease;
}
.df-like-btn.df-liked {
    animation: df-like-pop 0.3s ease;
}
@keyframes df-like-pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.25); }
    100% { transform: scale(1); }
}

/* Like Count Bubble */
.df-like-bubble {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: rgba(255, 255, 255, 0.9);
    font-size: 10px;
    font-weight: 600;
    line-height: 20px;
    text-align: center;
    pointer-events: none;
    z-index: 2;
}

/* STUDIO TABS - removed, using sidebar sub-nav now */

/* PROFILE POPOVER */
.df-profile-popover {
    position: fixed;
    width: 260px;
    background: var(--df-surface);
    border-radius: 16px;
    border: 1px solid var(--df-border);
    box-shadow: 0 12px 40px rgba(0,0,0,0.12), 0 0 0 1px rgba(0,0,0,0.04);
    padding: 16px;
    z-index: 99999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(0.96);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
    pointer-events: none;
}
.df-profile-popover.df-popover-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* CART POPOVER */
.df-cart-popover.df-popover-open {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) !important;
    pointer-events: auto;
}

.df-popover-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 12px;
}
.df-popover-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
}
.df-popover-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--df-text-main);
}
.df-popover-email {
    font-size: 12px;
    color: var(--df-text-muted);
    margin-top: 2px;
}
.df-popover-divider {
    height: 1px;
    background: var(--df-border);
    margin: 8px 0;
}
.df-popover-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 8px;
    border-radius: 8px;
    color: var(--df-text-main);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.15s;
}
.df-popover-link:hover {
    background: rgba(0,0,0,0.04);
}
.df-popover-link svg {
    color: var(--df-text-muted);
    flex-shrink: 0;
}
.df-popover-logout {
    color: var(--df-text-muted);
}
/* FLOATING PROMPT */
.df-prompt-container {
    position: absolute;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 700px;
    z-index: 100;
}

.df-prompt-inner {
    background: var(--df-surface);
    border-radius: 24px;
    padding: 16px 20px;
    box-shadow: var(--df-shadow-hard);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.df-prompt-input-wrapper {
    width: 100%;
}
.df-prompt-input-wrapper input {
    width: 100%;
    border: none;
    font-size: 16px;
    color: var(--df-text-main);
    outline: none;
    background: transparent;
}
.df-prompt-input-wrapper input::placeholder {
    color: var(--df-text-muted);
}

.df-prompt-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.df-actions-left, .df-actions-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.df-action-btn {
    border: 1px solid var(--df-border);
    background: transparent;
    color: var(--df-text-main);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.df-round-btn {
    width: 32px; height: 32px;
    border-radius: 50%;
}

.df-pill-btn {
    padding: 8px 16px;
    border-radius: 30px;
}

.df-pill-green {
    background: var(--df-green-light);
    color: var(--df-green);
    border-color: transparent;
}
.df-pill-green:hover { background: #d3f4ea; }

.df-icon-only {
    width: 32px; height: 32px;
    border-radius: 50%;
    border: none;
    font-size: 18px;
}

.df-submit-btn {
    background: var(--df-accent);
    color: white;
    border: none;
    width: 32px; height: 32px;
    border-radius: 50%;
    font-weight: bold;
}
.df-submit-btn:hover {
    background: #333;
}

.df-submit-btn:disabled {
    opacity: 0.5; cursor: not-allowed;
}

/* UPLOAD POPOVER */
.df-upload-popover {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 0;
    width: 220px;
    background: var(--df-surface);
    border-radius: 14px;
    border: 1px solid var(--df-border);
    box-shadow: 0 8px 30px rgba(0,0,0,0.1);
    padding: 6px;
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition: opacity 0.15s, transform 0.15s, visibility 0.15s;
}
.df-upload-popover.df-popover-open {
    opacity: 1; visibility: visible; transform: translateY(0);
}
.df-upload-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--df-text-main);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    font-family: var(--df-font);
    transition: background 0.15s;
}
.df-upload-option:hover { background: rgba(0,0,0,0.04); }
.df-upload-option svg { flex-shrink: 0; color: var(--df-text-main); }
.df-upload-disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.df-upload-disabled:hover { background: transparent; }
.df-soon-badge {
    margin-left: auto;
    font-size: 10px;
    font-weight: 700;
    color: var(--df-text-muted);
    background: var(--df-border);
    padding: 2px 6px;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

/* REFERENCE IMAGE PREVIEW */
.df-ref-preview {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 8px;
}
.df-ref-preview img {
    width: 56px;
    height: 56px;
    border-radius: 10px;
    object-fit: cover;
    border: 1px solid var(--df-border);
}
.df-ref-remove {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,0.08);
    color: var(--df-text-muted);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
.df-ref-remove:hover { background: rgba(0,0,0,0.15); }

/* AI MODEL POPOVER */
.df-model-popover {
    position: absolute;
    bottom: calc(100% + 10px);
    right: 0;
    width: 280px;
    background: var(--df-surface);
    border-radius: 14px;
    border: 1px solid var(--df-border);
    box-shadow: 0 8px 30px rgba(0,0,0,0.1);
    padding: 6px;
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition: opacity 0.15s, transform 0.15s, visibility 0.15s;
}
.df-model-popover.df-popover-open {
    opacity: 1; visibility: visible; transform: translateY(0);
}
.df-model-option {
    display: block;
    width: 100%;
    padding: 12px 14px;
    border: none;
    border-radius: 10px;
    background: transparent;
    text-align: left;
    cursor: pointer;
    font-family: var(--df-font);
    transition: background 0.15s;
}
.df-model-option:hover { background: rgba(0,0,0,0.04); }
.df-model-option.active { background: rgba(0,0,0,0.05); }
.df-model-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--df-text-main);
}
.df-model-desc {
    font-size: 12px;
    color: var(--df-text-muted);
    margin-top: 2px;
}

/* EXPANDABLE CHAT PANEL */
.df-chat-panel {
    max-height: 350px;
    display: flex;
    flex-direction: column;
}
.df-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 8px;
}
.df-chat-new-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border: 1px solid var(--df-border);
    border-radius: 8px;
    background: transparent;
    color: var(--df-text-main);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--df-font);
    transition: background 0.15s;
}
.df-chat-new-btn:hover { background: rgba(0,0,0,0.04); }
.df-chat-collapse-btn {
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--df-text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
.df-chat-collapse-btn:hover { background: rgba(0,0,0,0.04); }
.df-chat-divider {
    height: 1px;
    background: var(--df-border);
    margin-bottom: 12px;
}
.df-chat-messages {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 4px 0 12px;
    max-height: 260px;
}
.df-chat-messages::-webkit-scrollbar { width: 4px; }
.df-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.12);
    border-radius: 2px;
}

/* Chat Message Bubbles */
.df-msg {
    display: flex;
    gap: 8px;
    max-width: 85%;
}
.df-msg-user {
    align-self: flex-end;
    flex-direction: row-reverse;
}
.df-msg-ai {
    align-self: flex-start;
}
.df-msg-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    margin-top: 2px;
}
.df-msg-bubble {
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
}
.df-msg-user .df-msg-bubble {
    background: var(--df-accent);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.df-msg-ai .df-msg-bubble {
    background: rgba(0,0,0,0.05);
    color: var(--df-text-main);
    border-bottom-left-radius: 4px;
}

/* Chat expanded state */
.df-prompt-container.df-chat-expanded .df-prompt-inner {
    border-radius: 20px;
}

/* LOADER modal */
.df-modal-loader {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255,255,255,0.8);
    backdrop-filter: blur(5px);
    z-index: 9999;
    display: flex; align-items: center; justify-content: center;
}

.df-spinner {
    width: 50px; height: 50px;
    border: 4px solid var(--df-border);
    border-top-color: var(--df-accent);
    border-radius: 50%;
    animation: df-spin 1s linear infinite;
}
@keyframes df-spin { to { transform: rotate(360deg); } }

/* ============================
   DESIGN DETAIL PAGE
   ============================ */

/* Make masonry cards clickable */
.df-masonry-item { cursor: pointer; }

/* Back button */
.df-detail-back {
    padding: 20px 40px 0;
}
.df-detail-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--df-text-muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 10px;
    transition: all 0.2s;
}
.df-detail-back-btn:hover {
    background: var(--df-surface);
    color: var(--df-text-main);
}

/* Main layout: 2-column */
.df-detail-layout {
    display: flex;
    gap: 40px;
    padding: 24px 40px 40px;
    align-items: flex-start;
}

/* Hero image area */
.df-detail-hero {
    flex: 3;
    min-width: 0;
    border-radius: 20px;
    padding: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}
.df-detail-hero-img {
    max-width: 100%;
    max-height: 560px;
    object-fit: contain;
    border-radius: 12px;
    filter: drop-shadow(0 12px 40px rgba(0,0,0,0.15));
    transition: opacity 0.3s ease;
}

/* Thumbnail strip */
.df-detail-thumbs {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}
.df-detail-thumb {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 10px;
    border: 2px solid transparent;
    cursor: pointer;
    opacity: 0.6;
    transition: all 0.2s;
}
.df-detail-thumb:hover { opacity: 0.9; }
.df-detail-thumb.active {
    border-color: var(--df-accent);
    opacity: 1;
}

/* Sidebar */
.df-detail-sidebar {
    flex: 2;
    min-width: 280px;
    max-width: 380px;
}

/* Creator badge */
.df-detail-creator {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--df-border);
}
.df-detail-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
}
.df-detail-creator-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}
.df-detail-creator-info strong {
    font-size: 15px;
    color: var(--df-text-main);
}
.df-detail-cat {
    font-size: 12px;
    color: var(--df-text-muted);
    margin-top: 2px;
}
.df-detail-follow-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 8px;
    border: 1px solid var(--df-border);
    background: var(--df-surface);
    color: var(--df-text-main);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}
.df-detail-follow-btn:hover {
    background: var(--df-accent);
    color: #fff;
    border-color: var(--df-accent);
}

/* Title + description */
.df-detail-title {
    font-size: 22px;
    font-weight: 700;
    line-height: 1.3;
    margin: 0 0 12px;
    color: var(--df-text-main);
}
.df-detail-desc {
    font-size: 14px;
    line-height: 1.6;
    color: var(--df-text-muted);
    margin: 0 0 28px;
}

/* Action buttons */
.df-detail-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 24px;
}
.df-detail-btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 24px;
    border-radius: 12px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.25s;
}
.df-detail-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}
.df-detail-btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 24px;
    border-radius: 12px;
    background: transparent;
    color: var(--df-text-main);
    font-size: 14px;
    font-weight: 500;
    border: 1px solid var(--df-border);
    cursor: pointer;
    transition: all 0.2s;
}
.df-detail-btn-secondary:hover {
    background: var(--df-surface);
    border-color: var(--df-text-muted);
}

/* Like + meta row */
.df-detail-meta-row {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--df-border);
}
.df-detail-like-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 10px;
    border: 1px solid var(--df-border);
    background: var(--df-surface);
    cursor: pointer;
    color: var(--df-text-main);
    transition: all 0.2s;
}
.df-detail-like-btn:hover {
    border-color: #e74c3c;
    color: #e74c3c;
}
.df-detail-date {
    font-size: 13px;
    color: var(--df-text-muted);
}

/* Tags */
.df-detail-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.df-detail-tag {
    padding: 6px 14px;
    border-radius: 8px;
    background: var(--df-surface);
    border: 1px solid var(--df-border);
    font-size: 12px;
    font-weight: 500;
    color: var(--df-text-muted);
}

/* More from creator */
.df-detail-more {
    padding: 0 0 60px;
}
.df-detail-more h2 {
    font-size: 20px;
    font-weight: 600;
    margin: 0 0 20px;
    color: var(--df-text-main);
}
.df-detail-more-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}
.df-detail-more-card {
    border-radius: 14px;
    overflow: hidden;
    padding: 12px;
    transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
}
.df-detail-more-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}
.df-detail-more-card img {
    width: 100%;
    height: auto;
    border-radius: 10px;
    display: block;
}

/* Responsive */
@media (max-width: 900px) {
    .df-detail-layout {
        flex-direction: column;
        padding: 20px;
    }
    .df-detail-sidebar {
        max-width: 100%;
    }
    .df-detail-hero {
        padding: 24px;
    }
    .df-detail-back {
        padding: 16px 20px 0;
    }
    .df-detail-more {
        padding: 0 0 40px;
    }
}

/* ============================
   BROWSE BY CATEGORY GRID
   ============================ */
.df-browse-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}
.df-browse-card {
    border-radius: 14px;
    overflow: hidden;
    position: relative;
    cursor: pointer;
    transition: transform 0.25s, box-shadow 0.25s;
}
.df-browse-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12);
}

/* Collage layout */
.df-browse-collage {
    display: flex;
    gap: 2px;
    aspect-ratio: 4/3;
    overflow: hidden;
}
.df-browse-collage-main {
    flex: 3;
    overflow: hidden;
}
.df-browse-collage-main img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.df-browse-collage-main.df-browse-collage-full {
    flex: 1;
}
.df-browse-collage-side {
    flex: 2;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
}
.df-browse-collage-side img {
    width: 100%;
    flex: 1;
    object-fit: cover;
    display: block;
    min-height: 0;
}

/* Label overlay */
.df-browse-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px 16px 14px;
    background: linear-gradient(to top, rgba(0,0,0,0.75) 0%, transparent 100%);
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.df-browse-label strong {
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    text-shadow: 0 1px 4px rgba(0,0,0,0.3);
}
.df-browse-label span {
    color: rgba(255,255,255,0.8);
    font-size: 12px;
    font-weight: 500;
}

/* Responsive */
@media (max-width: 1100px) {
    .df-browse-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 800px) {
    .df-browse-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 500px) {
    .df-browse-grid { grid-template-columns: 1fr; }
}

/* LEADERBOARD LIST */
.df-leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.df-leaderboard-row {
    background: var(--df-surface);
    border: 1px solid var(--df-border);
    border-radius: 12px;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
}

/* Left side: Rank & User */
.df-l-left {
    display: flex;
    align-items: center;
    gap: 24px;
    flex: 1;
}

.df-l-rank {
    font-size: 24px;
    font-weight: 800;
    color: var(--df-text);
    min-width: 24px;
}

.df-l-user {
    display: flex;
    align-items: center;
    gap: 16px;
}

.df-l-user img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.df-l-user span {
    font-size: 16px;
    font-weight: 600;
    color: var(--df-text);
}

/* Right side: Stats, Artworks, Actions */
.df-l-right {
    display: flex;
    align-items: center;
    gap: 32px;
}

.df-l-stats {
    display: flex;
    align-items: center;
    gap: 24px;
    color: var(--df-text-muted);
    font-size: 13px;
    font-weight: 500;
}

.df-l-stat {
    display: flex;
    align-items: center;
    gap: 6px;
}

.df-l-stat svg {
    color: var(--df-text-muted);
}

.df-l-artworks {
    display: flex;
    align-items: center;
    gap: 6px;
}

.df-l-artworks img {
    width: 48px;
    height: 48px;
    border-radius: 4px;
    object-fit: cover;
}

.df-l-more {
    width: 48px;
    height: 48px;
    border-radius: 4px;
    background: #e2e8f0;
    color: #475569;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

.df-l-follow-btn {
    background: #0f172a;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.df-l-follow-btn:hover {
    background: #1e293b;
}

/* Leaderboard Responsive */
@media (max-width: 900px) {
    .df-leaderboard-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    .df-l-right {
        width: 100%;
        justify-content: space-between;
        gap: 16px;
        flex-wrap: wrap;
    }
}
@media (max-width: 600px) {
    .df-l-stats {
        width: 100%;
        justify-content: flex-start;
    }
    .df-l-artworks {
        width: 100%;
        justify-content: flex-start;
    }
    .df-l-follow-btn {
        width: 100%;
        justify-content: center;
    }
}

/* ============================
   MOBILE RESPONSIVE (phones + tablets up to 1024px)
   ============================ */

/* Mobile header — hidden on desktop */
.df-mobile-header,
.df-mobile-search-bar,
.df-mobile-backdrop,
.df-mobile-settings-wrapper,
.df-mobile-settings-sheet {
    display: none;
}

@media (max-width: 1024px) {

    /* --- BODY & APP CONTAINER --- */
    html {
        overflow-x: hidden; /* Prevent horizontal scroll on all mobile pages */
    }
    body.df-body {
        overflow-x: hidden;
        overflow-y: auto;
    }

    .df-app {
        flex-direction: column;
        padding: 0;
        padding-top: calc(104px + env(safe-area-inset-top, 0px));
        gap: 0;
        height: auto;
        min-height: 100vh;
        min-height: 100dvh;
        width: 100%;
        max-width: 100vw;
    }

    /* --- MOBILE HEADER (toolbar-style) --- */
    .df-mobile-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 10px 16px;
        margin: 0;
        /* Safari 26: it only checks background-COLOR for chrome tint.
           Using background-IMAGE (gradient) makes it visually white but Safari
           sees transparent and keeps the browser bar transparent. */
        background-color: transparent;
        background-image: linear-gradient(var(--df-surface), var(--df-surface));
        border-radius: var(--df-radius-lg);
        box-shadow: 0 4px 20px rgba(0,0,0,0.03);
        position: fixed;
        /* iOS 26 Safari Bug fix: top must be > 4px + safe area so Safari doesn't sample
           this white background for the browser chrome tint! Also respects the physical notch. */
        top: calc(env(safe-area-inset-top, 0px) + 12px);
        left: 12px;
        right: 12px;
        z-index: 1000;
        min-height: 48px;
        box-sizing: border-box;
        /* Scroll hide/show animation */
        transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                    opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    }
    .df-mobile-header.df-header-hidden {
        transform: translateY(calc(-100% - 30px));
        opacity: 0;
        pointer-events: none;
    }

    .df-mobile-menu-btn {
        background: none;
        border: none;
        padding: 4px;
        margin-right: 4px;
        color: var(--df-text-main);
        cursor: pointer;
        border-radius: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .df-mobile-menu-btn:active { background: rgba(0,0,0,0.06); }

    .df-mobile-logo {
        display: flex;
        align-items: center;
        gap: 6px;
        text-decoration: none;
        color: var(--df-text-main);
        font-size: 15px;
        margin-right: auto;
    }
    .df-mobile-logo strong { font-weight: 700; }
    .df-mobile-logo span { font-weight: 400; }

    .df-mobile-actions {
        display: flex;
        align-items: center;
        gap: 2px;
    }

    .df-mobile-icon-btn {
        background: none;
        border: none;
        padding: 6px;
        color: var(--df-text-main);
        cursor: pointer;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        text-decoration: none;
        width: 34px;
        height: 34px;
        flex-shrink: 0;
    }

    /* Avatar button: smaller circle */
    .df-mobile-avatar-btn {
        padding: 0 !important;
        width: 30px !important;
        height: 30px !important;
        border-radius: 50% !important;
        overflow: hidden !important;
    }

    /* Cart needs relative for badge */
    #df-mobile-cart-toggle {
        position: relative;
    }

    .df-mobile-cart-badge {
        position: absolute;
        top: 2px;
        right: 2px;
        background: #ef4444;
        color: #fff;
        font-size: 9px;
        font-weight: 700;
        width: 16px;
        height: 16px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        border: 2px solid var(--df-surface);
    }

    /* --- MOBILE SEARCH BAR --- */
    .df-mobile-search-bar {
        display: none;
        position: fixed;
        top: calc(env(safe-area-inset-top, 0px) + 12px + 48px);
        left: 12px;
        right: 12px;
        z-index: 999;
        background: var(--df-surface);
        border-radius: 0 0 var(--df-radius-lg) var(--df-radius-lg);
        padding: 14px 16px 16px;
        box-shadow: 0 12px 48px rgba(0,0,0,0.15);
        box-sizing: border-box;
    }
    .df-mobile-search-bar.df-active { display: block; }

    .df-mobile-search-inner {
        display: flex;
        align-items: center;
        gap: 8px;
        background: var(--df-bg-sidebar);
        border: 1px solid var(--df-border);
        border-radius: 12px;
        padding: 10px 14px;
    }
    .df-mobile-search-inner input {
        border: none;
        outline: none;
        background: transparent;
        flex: 1;
        font-size: 15px;
        color: var(--df-text-main);
        font-family: var(--df-font);
    }
    .df-mobile-search-inner button {
        background: none;
        border: none;
        color: var(--df-text-muted);
        font-size: 16px;
        cursor: pointer;
        padding: 4px;
    }

    #df-mobile-search-results {
        max-height: 60vh;
        overflow-y: auto;
        margin-top: 4px;
    }

    /* --- BACKDROP --- */
    .df-mobile-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: transparent;
        z-index: 997;
        opacity: 0;
        transition: opacity 0.3s ease;
    }
    .df-mobile-backdrop.df-active {
        display: block;
        opacity: 1;
    }

    /* --- SIDEBAR AS POPOVER DROPDOWN BELOW HEADER --- */
    .df-sidebar {
        position: fixed;
        top: calc(env(safe-area-inset-top, 0px) + 12px + 48px);
        left: 12px;
        right: 12px;
        bottom: auto;
        width: auto;
        max-height: 70vh;
        z-index: 999;
        border-radius: 0 0 var(--df-radius-lg) var(--df-radius-lg);
        box-shadow: 0 12px 48px rgba(0,0,0,0.15);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        opacity: 0;
        visibility: hidden;
        transform: translateY(-8px);
        transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
        pointer-events: none;
        padding-top: 24px;
    }
    .df-sidebar.df-mobile-open {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
        pointer-events: auto;
    }

    /* Hide logo in popover — already shown in header pill */
    .df-sidebar .df-logo {
        display: none;
    }

    /* When sidebar is open, merge header pill bottom with popover top.
       Keep background white (not gray), and prevent scroll-hide. */
    .df-mobile-header:has(~ .df-sidebar.df-mobile-open),
    .df-mobile-header:has(~ .df-mobile-search-bar.df-active),
    .df-mobile-header.df-menu-active {
        border-radius: var(--df-radius-lg) var(--df-radius-lg) 0 0;
        box-shadow: none;
        background-color: transparent;
        background-image: linear-gradient(var(--df-surface), var(--df-surface));
        /* Lock header visible while menu is open */
        transform: none !important;
        opacity: 1 !important;
        pointer-events: auto !important;
    }

    /* --- HIDE DESKTOP TOPBAR --- */
    .df-topbar {
        display: none !important;
    }

    /* --- MAIN CONTENT --- */
    .df-main {
        flex: 1;
        overflow: visible;
        padding-top: 0;
    }

    /* --- MOBILE BOTTOM SHEET (used for cart + profile popovers) --- */
    .df-mobile-sheet-open {
        position: fixed !important;
        top: auto !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        max-height: 80vh;
        overflow-y: auto;
        border-radius: 20px 20px 0 0 !important;
        z-index: 9998 !important;
        padding: 24px 20px calc(20px + env(safe-area-inset-bottom, 0px)) !important;
        box-shadow: 0 -4px 30px rgba(0,0,0,0.15) !important;
        background: var(--df-surface) !important;
        border: none !important;
        visibility: visible !important;
        opacity: 1 !important;
        transform: translateY(0) !important;
        pointer-events: auto !important;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                    opacity 0.3s ease !important;
    }
    /* --- MOBILE FADES (simple, universal) --- */

    /* Top fade: OFF on mobile. The header pill provides visual separation,
       and on iOS 26 Safari's Liquid Glass handles the top natively. */
    .df-main::before {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 0;
        background: transparent;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        mask-image: linear-gradient(to bottom, black, transparent);
        -webkit-mask-image: linear-gradient(to bottom, black, transparent);
        opacity: 1;
    }

    /* Bottom fade: ON for all mobile devices. Simple gradient, no blur.
       Sits at bottom:0 and fades content behind the prompt bar.
       Starts hidden, revealed by JS on scroll. */
    .df-main::after {
        position: fixed;
        bottom: 0;
        height: 200px;
        background: linear-gradient(to top,
            rgba(240,242,245,1) 0%,
            rgba(240,242,245,0.7) 30%,
            rgba(240,242,245,0) 100%
        );
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        mask-image: none;
        -webkit-mask-image: none;
        /* Start hidden, JS reveals on scroll */
        opacity: 0;
        transition: opacity 0.4s ease;
    }
    .df-main.df-scrolled::after {
        opacity: 1;
    }

    .df-content {
        padding: 32px 12px calc(140px + env(safe-area-inset-bottom, 0px));
        overflow: visible;
    }

    /* --- MASONRY: 50/50 → Full-width repeating pattern --- */
    /* Pattern: items 1+2 = side-by-side (same height), item 3 = full width (cropped panoramic) */
    .df-masonry {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        grid-auto-rows: auto !important;
        grid-gap: 12px !important;
        grid-auto-flow: dense !important;
    }
    .df-masonry-item {
        border-radius: 12px;
        overflow: hidden;
        touch-action: manipulation;
        position: relative;
        transform: none !important;
    }
    /* Side-by-side pairs: items 1,2 / 4,5 / 7,8 ... (3n+1 and 3n+2) */
    .df-masonry-item:nth-child(3n+1),
    .df-masonry-item:nth-child(3n+2) {
        grid-column: auto !important;
        grid-row: auto !important;
        aspect-ratio: 3/4 !important;
    }
    /* DreamFrame & DreamPillow: square cards for small pairs */
    body.blog-2 .df-masonry-item:nth-child(3n+1),
    body.blog-2 .df-masonry-item:nth-child(3n+2),
    body.blog-3 .df-masonry-item:nth-child(3n+1),
    body.blog-3 .df-masonry-item:nth-child(3n+2) {
        aspect-ratio: 1/1 !important;
    }
    /* Full-width panoramic: items 3, 6, 9, 12... (every 3rd) */
    .df-masonry-item:nth-child(3n) {
        grid-column: 1 / -1 !important;
        grid-row: auto !important;
        aspect-ratio: 16/9 !important;
    }

    /* Wrapper fills the card */
    .df-masonry-item .df-masonry-img-wrapper {
        width: 100%;
        height: 100%;
        box-sizing: border-box;
        display: block;
    }
    /* Image fills the card edge-to-edge */
    .df-masonry-item .df-masonry-img {
        width: 100% !important;
        height: 100% !important;
        margin: 0 !important;
        object-fit: cover !important;
        object-position: center top !important;
        display: block !important;
        border-radius: 0 !important;
        transform: none !important;
    }
    /* DreamFrame mobile: keep flex layout for framed artwork positioning */
    .df-masonry-item.df-raw-texture .df-masonry-img-wrapper {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 8% !important;
        box-sizing: border-box !important;
    }
    body.blog-2 #prinftul-results-grid .df-masonry-item.df-raw-texture:nth-child(3n) .df-masonry-img-wrapper {
        align-items: flex-end !important;
        padding: 8% 8% 0 !important;
    }
    .df-masonry-item.df-raw-texture .df-masonry-img {
        width: auto !important;
        height: auto !important;
        max-width: 100% !important;
        max-height: 100% !important;
        object-fit: contain !important;
        object-position: center center !important;
    }
    /* --- CARD OVERLAY: same as desktop — hidden by default, show on TAP --- */
    .df-masonry-overlay {
        opacity: 0;
        transition: opacity 0.25s ease;
        padding: 10px;
    }
    .df-masonry-item.df-tapped .df-masonry-overlay {
        opacity: 1;
    }
    .df-masonry-overlay .df-user-badge {
        font-size: 11px;
        max-width: 60%;
        overflow: hidden;
    }
    .df-masonry-overlay .df-user-badge img { width: 20px; height: 20px; }
    .df-masonry-overlay .df-user-badge span {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 70px;
        display: inline-block;
        vertical-align: middle;
    }
    .df-masonry-item { border-radius: 12px; }

    /* Portrait tablets keep the mobile shell, but use the normal 3-column Discover grid. */
@media (min-width: 769px) and (max-width: 1024px) {
        .df-masonry {
            grid-template-columns: repeat(3, 1fr) !important;
            grid-gap: 24px !important;
            grid-auto-rows: 50px !important;
            grid-auto-flow: dense !important;
        }
        .df-masonry-item {
            aspect-ratio: auto !important;
            border-radius: var(--df-radius-lg) !important;
        }
        .df-masonry-item:nth-child(3n+1),
        .df-masonry-item:nth-child(3n+2),
        .df-masonry-item:nth-child(3n) {
            grid-column: auto !important;
            grid-row: auto !important;
            aspect-ratio: auto !important;
        }
        .df-masonry-item:nth-child(7n+1) { grid-column: 1 !important; grid-row: span 6 !important; }
        .df-masonry-item:nth-child(7n+2) { grid-column: 2 !important; grid-row: span 4 !important; }
        .df-masonry-item:nth-child(7n+3) { grid-column: 3 !important; grid-row: span 6 !important; }
        .df-masonry-item:nth-child(7n+4) { grid-column: 2 !important; grid-row: span 4 !important; }
        .df-masonry-item:nth-child(7n+5) { grid-column: 1 !important; grid-row: span 6 !important; }
        .df-masonry-item:nth-child(7n+6) { grid-column: 2 !important; grid-row: span 4 !important; }
        .df-masonry-item:nth-child(7n)   { grid-column: 3 !important; grid-row: span 6 !important; }
        .df-masonry-item:not(.df-raw-texture) .df-masonry-img-wrapper {
            position: absolute !important;
            top: 0 !important;
            left: 0 !important;
            right: 0 !important;
            bottom: 0 !important;
        }
        .df-masonry-item.df-raw-texture .df-masonry-img-wrapper {
            position: absolute !important;
            top: 0 !important;
            left: 0 !important;
            right: 0 !important;
            bottom: 0 !important;
            display: flex !important;
            align-items: center !important;
            justify-content: center !important;
            padding: 11% !important;
            box-sizing: border-box !important;
        }
        body.blog-2 #prinftul-results-grid .df-masonry-item.df-raw-texture:nth-child(7n+2) .df-masonry-img-wrapper,
        body.blog-2 #prinftul-results-grid .df-masonry-item.df-raw-texture:nth-child(7n+4) .df-masonry-img-wrapper,
        body.blog-2 #prinftul-results-grid .df-masonry-item.df-raw-texture:nth-child(7n+6) .df-masonry-img-wrapper {
            align-items: flex-end !important;
            padding: 9% 11% 0 !important;
        }
        .df-masonry-item.df-raw-texture .df-masonry-img {
            max-width: 100% !important;
            max-height: 100% !important;
            width: auto !important;
            height: auto !important;
            object-fit: contain !important;
        }
    }

    /* Card tags */
    .df-card-tags { gap: 4px; }
    .df-card-tag { font-size: 10px; padding: 3px 8px; }

    /* --- CATEGORY ROW --- */
    .df-categories-wrapper { margin-bottom: 20px; }
    .df-categories-row { gap: 10px; }
    .df-cat-card {
        min-width: 140px;
        flex: 0 0 auto;
        padding: 10px;
        gap: 8px;
    }
    .df-cat-img { width: 28px; height: 28px; }
    .df-cat-text strong { font-size: 13px; }
    .df-cat-text span { font-size: 11px; }
    .df-cat-nav { display: none !important; }

    /* --- FLOATING PROMPT --- */
    .df-prompt-container {
        position: fixed;
        bottom: calc(12px + env(safe-area-inset-bottom, 0px));
        left: 12px;
        right: 12px;
        transform: none;
        width: auto;
        max-width: none;
        z-index: 20;
        /* Start hidden, JS reveals on scroll */
        opacity: 0;
        transform: translateY(30px);
        transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        pointer-events: none;
    }
    .df-prompt-container.df-prompt-visible {
        opacity: 1;
        transform: translateY(0);
        pointer-events: auto;
    }
    .df-prompt-inner {
        border-radius: 18px;
        padding: 12px 14px;
        gap: 10px;
    }
    .df-prompt-input-wrapper input { font-size: 15px; }

    /* --- CREATE PAGE: chat visible immediately, mockup smaller --- */
    body.df-create-page .df-prompt-container {
        opacity: 1 !important;
        transform: translateY(0) !important;
        pointer-events: auto !important;
    }
    body.df-create-page #view-create > div { min-height: auto !important; }
    body.df-create-page #css-phone-mockup {
        width: 220px !important;
        height: 450px !important;
        border-radius: 36px !important;
    }
    body.df-create-page #view-create .df-page-heading { display: none; }
    body.df-create-page #df-create-buy-trigger { margin-top: 0; }
    body.df-create-page #view-create { padding-bottom: 180px !important; }

    /* --- DESIGN DETAIL --- */
    .df-detail-back { padding: 12px 12px 0; }
    .df-detail-layout {
        flex-direction: column;
        padding: 12px;
        gap: 20px;
    }
    .df-detail-sidebar {
        max-width: 100%;
        min-width: 0;
    }
    .df-detail-hero {
        padding: 20px;
        border-radius: 16px;
    }
    .df-detail-hero-img {
        max-height: 400px;
    }
    .df-detail-title { font-size: 20px; }
    .df-detail-more-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    /* --- BROWSE GRID --- */
    .df-browse-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    /* --- SEARCH DROPDOWN (desktop) --- */
    #df-search-results {
        width: 100% !important;
        left: 0 !important;
    }

    /* --- PROFILE & CART POPOVER MOBILE: dropdown below header pill (matches sidebar) --- */
    .df-profile-popover,
    .df-cart-popover {
        position: fixed !important;
        /* Same positioning as .df-sidebar */
        top: calc(env(safe-area-inset-top, 0px) + 12px + 48px) !important;
        bottom: auto !important;
        left: 12px !important;
        right: 12px !important;
        width: auto !important;
        max-width: none !important;
        border-radius: 0 0 var(--df-radius-lg) var(--df-radius-lg) !important;
        max-height: 70vh;
        overflow-y: auto;
        z-index: 999 !important;
        padding: 20px !important;
        box-shadow: 0 12px 48px rgba(0,0,0,0.15) !important;
        background: var(--df-surface) !important;
        border: none !important;
        /* Slide-down animation */
        opacity: 0 !important;
        visibility: hidden !important;
        transform: translateY(-8px) !important;
        transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s !important;
        pointer-events: none !important;
    }
    .df-profile-popover.df-popover-open,
    .df-cart-popover.df-popover-open {
        opacity: 1 !important;
        visibility: visible !important;
        transform: translateY(0) !important;
        pointer-events: auto !important;
    }
    /* Merge header pill bottom with popover top (body class set by JS) */
    body.df-popover-active .df-mobile-header {
        border-radius: var(--df-radius-lg) var(--df-radius-lg) 0 0 !important;
        box-shadow: none !important;
        transform: none !important;
        opacity: 1 !important;
        pointer-events: auto !important;
        z-index: 1000 !important;
    }

    /* --- LEADERBOARD --- */
    .df-leaderboard-row { padding: 14px 16px; }
    .df-l-left { gap: 12px; }
    .df-l-user img { width: 36px; height: 36px; }
    .df-l-user span { font-size: 14px; }
    .df-l-rank { font-size: 18px; }

    /* --- PRODUCT DETAIL --- */
    .df-detail-more { padding: 0 0 30px; }

    /* Hide desktop-only elements */
    .df-arrow { display: none; }
    .df-status { display: none; }

    /* --- PROMPT BAR MOBILE --- */
    /* Hide the 3 desktop pill selects, show settings gear instead */
    .df-casetype-wrapper,
    .df-finish-wrapper,
    .df-model-wrapper,
    .df-actions-right .df-action-btn.df-icon-only { display: none !important; }

    .df-mobile-settings-wrapper { display: block; }

    .df-prompt-actions {
        flex-wrap: nowrap;
        gap: 6px;
    }
    .df-actions-left { gap: 6px; }
    .df-actions-right { gap: 6px; }

    /* --- SETTINGS POPOVER (bottom sheet) --- */
    .df-mobile-settings-sheet {
        display: none;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--df-surface);
        border-radius: 20px 20px 0 0;
        box-shadow: 0 -8px 32px rgba(0,0,0,0.12);
        padding: 20px 16px calc(env(safe-area-inset-bottom, 12px) + 12px);
        z-index: 2000;
        animation: dfSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    }
    .df-mobile-settings-sheet.df-active { display: block; }

    @keyframes dfSlideUp {
        from { transform: translateY(100%); }
        to { transform: translateY(0); }
    }

    .df-mobile-settings-title {
        font-size: 16px;
        font-weight: 700;
        color: var(--df-text-main);
        margin-bottom: 16px;
        padding-bottom: 12px;
        border-bottom: 1px solid var(--df-border);
    }

    .df-mobile-setting-row {
        display: flex;
        align-items: center;
        gap: 12px;
        width: 100%;
        padding: 14px 12px;
        background: none;
        border: none;
        border-radius: 12px;
        cursor: pointer;
        font-family: var(--df-font);
        transition: background 0.15s;
        text-align: left;
        color: var(--df-text-main);
    }
    .df-mobile-setting-row:active { background: rgba(0,0,0,0.04); }

    .df-mobile-setting-row svg:first-child {
        color: var(--df-text-muted);
        flex-shrink: 0;
    }
    .df-mobile-setting-row svg:last-child {
        color: var(--df-text-muted);
        flex-shrink: 0;
        margin-left: auto;
    }

    .df-ms-label {
        flex: 1;
        display: flex;
        flex-direction: column;
        gap: 2px;
    }
    .df-ms-key {
        font-size: 11px;
        font-weight: 600;
        color: var(--df-text-muted);
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
    .df-ms-value {
        font-size: 15px;
        font-weight: 600;
        color: var(--df-text-main);
    }

    /* Chat-action popovers on mobile: positioned ABOVE the prompt bar,
       not as bottom sheets that cover the chat. Matches desktop behavior. */
    .df-upload-popover.df-popover-open,
    .df-model-popover.df-popover-open,
    .df-casetype-popover.df-popover-open,
    .df-finish-popover.df-popover-open,
    #df-producttype-popover.df-popover-open,
    #df-color-popover.df-popover-open,
    #df-size-popover.df-popover-open {
        position: fixed !important;
        bottom: calc(80px + env(safe-area-inset-bottom, 0px)) !important;
        left: 12px !important;
        right: 12px !important;
        top: auto !important;
        width: auto !important;
        max-height: 60vh !important;
        overflow-y: auto !important;
        border-radius: 16px !important;
        z-index: 9999 !important;
        box-shadow: 0 -4px 24px rgba(0,0,0,0.15), 0 8px 32px rgba(0,0,0,0.12) !important;
        padding: 8px !important;
        padding-bottom: 8px !important;
    }
}

@media (min-width: 769px) and (max-width: 1024px) and (orientation: portrait) {
    .df-mobile-header {
        justify-content: flex-start;
        gap: 14px;
    }
    .df-mobile-logo {
        margin-right: auto;
    }
    .df-mobile-actions {
        gap: 10px;
        margin-left: 8px;
    }
    #df-mobile-create-link {
        display: flex;
    }
    #df-mobile-search-toggle { order: 9; }
    #df-mobile-cart-toggle { order: 10; }
    #df-mobile-avatar-toggle { order: 11; }
}

/* Safety: never show tablet-only pills/language outside tablet portrait */
@media (max-width: 1024px) and (orientation: landscape) {
    .df-tablet-header-status,
    .df-tablet-header-action,
    .df-tablet-header-save,
    .df-mobile-header-language {
        display: none !important;
    }
}

@media (max-width: 768px) {
    .df-tablet-header-status,
    .df-tablet-header-action,
    .df-tablet-header-save,
    .df-mobile-header-language {
        display: none !important;
    }
}

/* Small desktop / large tablet landscape tweaks */
@media (min-width: 1025px) and (max-width: 1180px) {
    .df-sidebar { width: 220px; }
    .df-app { padding: 12px 16px; gap: 16px; }
    .df-masonry {
        grid-template-columns: repeat(2, 1fr);
        grid-gap: 16px;
    }
    .df-masonry-item:nth-child(3n+1),
    .df-masonry-item:nth-child(3n+2),
    .df-masonry-item:nth-child(3n) {
        grid-column: auto;
        grid-row: span 6;
    }
    .df-search { width: 220px; }
}
