/* MeshCave 6.0.3 — responsive and visual polish. CSS-only where possible. */
:root{
  --mc-radius-sm:10px;
  --mc-radius:14px;
  --mc-radius-lg:18px;
  --mc-control-h:42px;
  --mc-touch:44px;
}

/* Consistent controls */
button,.btn-primary,.btn-secondary,.btn-ghost,input,select,textarea{border-radius:var(--mc-radius-sm)}
button,.btn-primary,.btn-secondary,.btn-ghost{min-height:var(--mc-touch)}
input,select{min-height:var(--mc-control-h)}
textarea{min-height:110px}
.form-card,.summary-card,.panel,.stat-card,.cart-item,.review,.collection-card,.cockpit-card{border-radius:var(--mc-radius-lg)}

/* Catalog: compact mobile filter entry point */
.catalog-mobile-tools{display:none;align-items:center;justify-content:space-between;gap:12px;margin-bottom:14px}
.catalog-filter-toggle{display:inline-flex;align-items:center;justify-content:center;gap:8px;padding:0 15px;border:1px solid var(--border);background:var(--surface);color:var(--ink);font-weight:700;cursor:pointer}
.catalog-filter-toggle svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.catalog-filter-backdrop{display:none}
.filters-head-mobile{display:none;align-items:center;justify-content:space-between;margin-bottom:14px}
.filters-close{width:40px;height:40px;border:1px solid var(--border);background:transparent;color:var(--ink);font-size:23px;line-height:1;cursor:pointer}

/* Make all cards visually even and interaction targets predictable */
.product-grid{align-items:stretch}
.product-card-shell,.product-card{min-height:100%}
.product-card-body{min-height:128px}
.product-card-foot{margin-top:auto}
.card-favorite{touch-action:manipulation}
.card-favorite:focus-visible,.theme-toggle:focus-visible,.notification-center>summary:focus-visible,.catalog-filter-toggle:focus-visible{outline:3px solid rgba(111,76,255,.38);outline-offset:2px}

/* General responsive tables */
.table-wrap{overflow-x:auto;-webkit-overflow-scrolling:touch}
.table{min-width:680px}

/* Tablet */
@media (max-width:1100px){
  .container{width:min(100% - 36px,1320px)}
  .header-inner{gap:14px}
  .header-search{max-width:420px}
  .header-nav{gap:8px}
  .catalog-layout{grid-template-columns:220px minmax(0,1fr);gap:22px}
  .product-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
  .pd-layout,.cart-layout,.form-grid,.review-grid,.cockpit-grid{gap:22px}
}

/* Mobile/tablet navigation and layouts */
@media (max-width:820px){
  body{overflow-x:hidden}
  .container{width:min(100% - 24px,1320px)}
  .site-header{position:sticky;top:0;z-index:120}
  .header-inner{display:grid;grid-template-columns:auto 1fr auto;height:auto;min-height:68px;padding:10px 0;gap:10px}
  .logo{font-size:19px;white-space:nowrap}
  .logo-cube{font-size:20px}
  .header-search{grid-column:1/-1;grid-row:2;max-width:none;width:100%}
  .header-search input{height:42px}
  .header-search button{height:42px;padding:0 15px}
  .header-nav{justify-self:end;gap:5px;min-width:0}
  .header-nav>a:not(.header-icon-link):not(.cart-link),.account-menu>summary>span:not(.user-chip):not(.cart-badge){display:none}
  .header-icon-link,.theme-toggle,.notification-center>summary{width:40px;height:40px}
  .cart-link{font-size:0;width:40px;height:40px;display:grid;place-items:center;border-radius:10px;position:relative}
  .cart-link::before{content:'🛒';font-size:20px}
  .cart-link .cart-badge{position:absolute;right:-2px;top:-3px;font-size:9px}
  .account-menu>summary{padding:0;min-height:40px}
  .user-chip{width:36px;height:36px}
  .account-dropdown{right:0;left:auto;min-width:230px}
  .notification-popover{top:72px}

  .page-head{padding:28px 0 8px}
  .page-head h1{font-size:27px}
  .catalog-mobile-tools{display:flex}
  .catalog-layout{display:block;padding-top:16px}
  .filters{position:fixed;z-index:210;left:0;top:0;bottom:0;width:min(86vw,340px);max-height:100dvh;overflow-y:auto;border-radius:0 18px 18px 0;transform:translateX(-105%);transition:transform .2s ease;box-shadow:0 20px 70px rgba(0,0,0,.58);padding:20px}
  .filters-head-mobile{display:flex}
  body.catalog-filters-open{overflow:hidden}
  body.catalog-filters-open .filters{transform:translateX(0)}
  .catalog-filter-backdrop{position:fixed;inset:0;z-index:200;background:rgba(2,5,12,.7);backdrop-filter:blur(3px)}
  body.catalog-filters-open .catalog-filter-backdrop{display:block}
  .catalog-toolbar{gap:12px;align-items:center}
  .catalog-toolbar select{min-width:0;width:100%;max-width:210px}
  .product-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}

  .pd-layout,.cart-layout,.form-grid,.review-grid,.cockpit-grid,.creator-inner,.creator-inner-v2{grid-template-columns:1fr!important}
  .pd-media,.pd-info{min-width:0}
  .pd-actions{flex-wrap:wrap}
  .pd-actions>*{min-height:44px}
  .pd-price-row{align-items:flex-start;gap:10px;flex-wrap:wrap}
  .pd-gallery-thumbs{overflow-x:auto;display:flex;flex-wrap:nowrap;padding-bottom:5px;scrollbar-width:thin}
  .pd-gallery-thumbs img{flex:0 0 78px;width:78px;height:78px}
  .pd-seller-card{grid-template-columns:1fr!important}
  .pd-seller-banner{min-height:120px}

  .cart-layout{display:block}
  .summary-card{position:static!important;margin-top:18px}
  .cart-item{grid-template-columns:72px minmax(0,1fr)!important;gap:12px}
  .cart-item-price{grid-column:2;text-align:left!important}

  .form-page,.account-settings-container,.collection-detail-page{width:100%}
  .form-card{padding:18px}
  .form-foot{position:sticky;bottom:0;z-index:15;background:color-mix(in srgb,var(--surface) 94%,transparent);backdrop-filter:blur(12px);padding:10px;margin:18px -10px -10px;border-top:1px solid var(--border);display:flex;gap:8px;flex-wrap:wrap}
  .form-foot>*{flex:1 1 150px}

  .collection-grid,.collection-products-grid,.creator-products{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  .cockpit-metrics{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  .review-summary{grid-template-columns:1fr!important}
  .review-images{overflow-x:auto;flex-wrap:nowrap!important}
}

/* Phones */
@media (max-width:540px){
  .container{width:min(100% - 18px,1320px)}
  .header-inner{grid-template-columns:auto 1fr auto}
  .header-nav{gap:2px}
  .header-icon-link,.theme-toggle,.notification-center>summary,.cart-link{width:37px;height:37px}
  .header-favorite{display:none!important}
  .page-head h1{font-size:24px}
  .catalog-mobile-tools{align-items:stretch}
  .catalog-mobile-tools>*{flex:1}
  .catalog-toolbar{display:grid;grid-template-columns:1fr;align-items:stretch;margin-bottom:14px}
  .catalog-toolbar select{max-width:none;width:100%}
  .result-count{padding:0 2px}
  .product-grid{grid-template-columns:1fr 1fr;gap:10px}
  .product-card{border-radius:13px}
  .product-card-body{padding:11px 11px 13px;min-height:116px;gap:5px}
  .product-title{font-size:14px;line-height:1.25}
  .product-seller{font-size:11px;line-height:1.3;min-height:29px}
  .product-price{font-size:15px}
  .rating-line{font-size:11px}
  .card-format{top:7px;left:7px;font-size:10px;padding:2px 6px}
  .card-favorite{right:7px;top:7px;width:34px;height:34px}
  .card-favorite svg{width:19px;height:19px}
  .market-badge{font-size:9px}
  .pagination{gap:6px;flex-wrap:wrap}

  .notification-popover{left:8px;right:8px;top:64px;border-radius:14px;padding:10px}
  .notification-tabs{gap:4px}
  .notification-tabs button{padding:7px 9px}
  .notification-mini-list{max-height:56vh}

  .pd-main-image-viewer-fallback,.pd-media{border-radius:14px}
  .pd-gallery-thumbs img{flex-basis:66px;width:66px;height:66px}
  .pd-actions{display:grid!important;grid-template-columns:1fr auto auto;align-items:stretch}
  .pd-actions .btn-primary,.pd-actions .btn-secondary{grid-column:1/-1}
  .pd-price{font-size:28px}

  .collection-grid,.collection-products-grid,.creator-products,.cockpit-metrics{grid-template-columns:1fr!important}
  .creator-hero,.creator-hero-v2{border-radius:16px}
  .creator-inner,.creator-inner-v2{padding:16px!important}
  .creator-stats{display:grid!important;grid-template-columns:repeat(2,1fr);gap:8px}

  .cart-item{grid-template-columns:58px minmax(0,1fr)!important;padding:12px}
  .cart-item img{width:58px!important;height:58px!important}
  .table{font-size:13px}
  .site-footer{margin-top:42px}
  .footer-inner{grid-template-columns:1fr!important;gap:20px}
}

@media (prefers-reduced-motion:reduce){
  .filters,.product-card,.product-thumb,.card-favorite,.theme-toggle{transition:none!important}
}

/* MeshCave 6.1 — mobile experience hotfix */
.mobile-header-actions,.footer-mobile{display:none}
.mobile-menu-backdrop{position:fixed;inset:0;background:rgba(0,0,0,.68);backdrop-filter:blur(3px);z-index:298}
.mobile-menu{position:fixed;z-index:299;top:0;right:0;bottom:0;width:min(88vw,360px);background:var(--surface);border-left:1px solid var(--border);box-shadow:-20px 0 60px rgba(0,0,0,.5);transform:translateX(105%);transition:transform .2s ease;padding:18px;overflow-y:auto}
body.mobile-menu-open{overflow:hidden}
body.mobile-menu-open .mobile-menu{transform:translateX(0)}
.mobile-menu-head{display:flex;align-items:center;justify-content:space-between;padding-bottom:14px;border-bottom:1px solid var(--border)}
.mobile-menu-head strong{font-size:20px}
.mobile-menu-head button{width:40px;height:40px;border:1px solid var(--border);background:transparent;color:var(--ink);font-size:26px;line-height:1}
.mobile-menu-links{display:grid;padding-top:10px}
.mobile-menu-links>a,.mobile-menu-links form button{display:flex;align-items:center;justify-content:space-between;width:100%;min-height:48px;padding:0 10px;border:0;border-bottom:1px solid color-mix(in srgb,var(--border) 70%,transparent);background:transparent;color:var(--ink);text-align:left;font:inherit;text-decoration:none}
.mobile-menu-links span{display:grid;place-items:center;min-width:24px;height:24px;padding:0 6px;border-radius:999px;background:var(--accent);color:#fff;font-size:12px;font-weight:800}
.mobile-search-toggle,.mobile-menu-toggle{display:grid;place-items:center;width:40px;height:40px;border:1px solid var(--border);background:var(--surface);color:var(--ink);padding:0}
.mobile-search-toggle svg,.mobile-menu-toggle svg{width:21px;height:21px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round}
.footer-mobile details{border-top:1px solid var(--border)}
.footer-mobile summary{display:flex;align-items:center;justify-content:space-between;min-height:52px;font-weight:800;cursor:pointer;list-style:none}
.footer-mobile summary::-webkit-details-marker{display:none}
.footer-mobile summary::after{content:'+';font-size:22px;color:var(--muted)}
.footer-mobile details[open] summary::after{content:'−'}
.footer-mobile .footer-list{padding:0 0 14px;margin:0}
.footer-mobile .footer-list li{margin:0}
.footer-mobile .footer-list a{display:block;padding:8px 0}
.footer-mobile-brand{padding-bottom:18px}

@media (max-width:820px){
  .header-inner{grid-template-columns:auto 1fr auto;min-height:64px;padding:9px 0}
  .mobile-header-actions{display:flex;justify-self:end;gap:7px}
  .header-nav{display:none}
  .header-search{display:none;grid-row:2;grid-column:1/-1}
  body.mobile-search-open .header-search{display:flex}
  .theme-toggle{width:36px!important;height:36px!important}
  .footer-desktop{display:none!important}
  .footer-mobile{display:block;padding-top:26px;padding-bottom:22px}
  .site-footer{padding:0}
  .footer-mobile .footer-note{padding-top:18px}
}

@media (max-width:390px){
  .product-grid{grid-template-columns:1fr!important;gap:14px}
  .product-card-body{min-height:auto}
  .product-title{font-size:16px}
  .product-seller{font-size:13px;min-height:auto}
  .product-price{font-size:18px}
}
