*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{background:#fff;color:#222;font-family:-apple-system,BlinkMacSystemFont,"Pretendard","Noto Sans KR",sans-serif}
.em-home{max-width:720px;margin:0 auto;min-height:100vh;padding-bottom:90px;background:#fff}
.em-top{position:sticky;top:0;z-index:100;background:#fff;border-bottom:1px solid #eee;padding:10px 12px;display:flex;align-items:center;gap:9px}
.em-logo{font-size:19px;font-weight:900;white-space:nowrap}.em-logo span{color:#ff4d7d}
.em-searchbox{position:relative;flex:1}.em-searchbox input{width:100%;height:40px;border:1px solid #e4e4e4;border-radius:12px;background:#fafafa;padding:0 36px 0 12px;font-size:16px}.em-searchbox b{position:absolute;right:11px;top:8px;color:#888}
.em-top-cart{height:40px;border:0;background:#fff1f5;color:#d93666;border-radius:11px;padding:0 10px;font-weight:900}
.em-cats{display:flex;gap:6px;overflow-x:auto;white-space:nowrap;padding:10px 12px;border-bottom:1px solid #f2f2f2;scrollbar-width:none}.em-cats::-webkit-scrollbar{display:none}.em-cats button{flex:0 0 auto;border:1px solid #ececec;background:#fff;border-radius:10px;padding:7px 11px;font-size:13px;font-weight:700}.em-cats button.active{background:#222;color:#fff;border-color:#222}
.em-home-title{display:flex;justify-content:space-between;align-items:end;padding:16px 12px 10px}.em-home-title h2{margin:0;font-size:21px}.em-home-title span{font-size:12px;color:#999}
.em-grid{display:grid;grid-template-columns:1fr 1fr;gap:16px 10px;padding:0 12px}.em-card{text-decoration:none;color:#222}.em-thumb{position:relative;aspect-ratio:1/1.16;border-radius:14px;overflow:hidden;background:#f4f4f4}.em-thumb img{width:100%;height:100%;object-fit:cover}.em-noimg{height:100%;display:grid;place-items:center;color:#aaa}.em-badges{position:absolute;left:7px;top:7px;display:flex;gap:4px}.em-badges span{font-size:10px;background:#222;color:#fff;border-radius:7px;padding:4px 6px;font-weight:900}.em-badges .closed{background:#777}.em-card-body{padding:7px 2px}.em-card-body h3{font-size:14px;line-height:1.35;margin:0 0 3px}.em-card-body strong{font-size:16px}
.em-product{max-width:980px;margin:0 auto 100px;background:#fff}.em-back{display:block;padding:14px 16px;border-bottom:1px solid #eee;text-decoration:none;color:#333}.em-gallery{position:relative;overflow:hidden;background:#f6f6f6}.em-gallery-track{display:flex;transition:transform .4s ease}.em-gallery-track img{min-width:100%;width:100%;height:112vw;max-height:560px;object-fit:contain;background:#f6f6f6}.em-gallery-nav{position:absolute;top:50%;transform:translateY(-50%);z-index:5;width:38px;height:38px;border:0;border-radius:50%;background:#ffffffe8;font-size:24px}.em-gallery-prev{left:10px}.em-gallery-next{right:10px}.em-gallery-dots{position:absolute;left:50%;transform:translateX(-50%);bottom:10px;display:flex;gap:5px}.em-gallery-dot{width:7px;height:7px;border:0;border-radius:50%;background:#ffffff88}.em-gallery-dot.active{background:#fff;width:18px;border-radius:99px}
.em-product-info{padding:18px 16px 24px}.em-product-info h1{font-size:23px;margin:0 0 5px}.em-price{font-size:24px;font-weight:900;margin-bottom:14px}.em-desc{background:#fafafa;border-radius:12px;padding:13px 14px;color:#555;line-height:1.65;margin-bottom:16px}.em-product-info label{display:block;font-weight:800;margin:11px 0}.em-product-info select{width:100%;height:48px;border:1px solid #ddd;border-radius:11px;padding:0 11px;background:#fff;font-size:16px}.em-qty{display:flex;width:max-content;border:1px solid #ddd;border-radius:10px;overflow:hidden;margin-top:7px}.em-qty button,.em-qty input{height:42px;border:0;background:#fff;text-align:center}.em-qty button{width:42px}.em-qty input{width:58px}.em-add-cart{width:100%;min-height:54px;border:0;border-radius:13px;background:#ff4d7d;color:#fff;font-size:16px;font-weight:900;margin-top:17px}.em-add-cart.disabled{background:#aaa}
.em-bottom-cart{position:fixed;left:50%;transform:translateX(-50%);bottom:calc(10px + env(safe-area-inset-bottom));width:min(700px,calc(100% - 20px));z-index:150}.em-bottom-cart button{width:100%;height:54px;border:0;border-radius:15px;background:#222;color:#fff;padding:0 16px;display:flex;justify-content:space-between;align-items:center;font-weight:900;box-shadow:0 7px 24px #0003}
.em-cart-sheet{display:none;position:fixed;inset:0;z-index:1000}.em-cart-sheet.open{display:block}.em-cart-backdrop{position:absolute;inset:0;background:#0008}.em-cart-panel{position:absolute;left:50%;transform:translateX(-50%);bottom:0;width:min(720px,100%);max-height:88vh;overflow:auto;background:#fff;border-radius:22px 22px 0 0;padding:16px 14px calc(16px + env(safe-area-inset-bottom))}.em-cart-head{display:flex;gap:8px;align-items:center}.em-cart-head h2{margin:0;flex:1}.em-cart-head button{border:0;border-radius:9px;padding:8px;background:#f4f4f4}.em-cart-row{padding:13px 0;border-bottom:1px solid #eee;display:grid;grid-template-columns:1fr auto;gap:8px}.em-cart-main strong,.em-cart-main small{display:block}.em-cart-main small{color:#777;margin-top:4px}.em-cart-actions{display:flex;gap:5px;align-items:center;flex-wrap:wrap}.em-cart-actions button{height:34px;border:1px solid #ddd;background:#fff;border-radius:8px;padding:0 9px}.em-cart-qty-num{min-width:24px;text-align:center;font-weight:800}.em-kakao-name-wrap{margin:14px 0}.em-kakao-name-wrap label{display:block;font-weight:800;margin-bottom:6px}.em-kakao-name{width:100%;height:45px;border:1px solid #ddd;border-radius:10px;padding:0 11px;font-size:16px}.em-cart-summary{display:flex;justify-content:space-between;font-size:18px;margin:14px 0}.em-order-text{width:100%;min-height:135px;border:1px solid #ddd;border-radius:11px;padding:11px}.em-copy-order,.em-kakao-go{display:block;width:100%;min-height:50px;margin-top:9px;border:0;border-radius:12px;text-align:center;padding:14px;font-weight:900;text-decoration:none}.em-copy-order{background:#222;color:#fff}.em-kakao-go{background:#fee500;color:#191919}
@media(min-width:760px){.em-grid{grid-template-columns:repeat(3,1fr)}.em-product{max-width:720px;border:1px solid #eee;border-radius:20px;overflow:hidden;margin-top:24px}.em-gallery-track img{height:720px;max-height:720px}.em-product-info{padding:26px}}

/* v5.1 fixes */
.em-memory{display:flex!important;gap:7px!important;flex-wrap:wrap!important}
.em-memory-chip{display:inline-flex;align-items:center;border:1px solid #ddd;border-radius:9px;overflow:hidden;background:#fff}
.em-memory-chip .em-memory-use{border:0!important;border-radius:0!important}
.em-memory-chip .em-memory-del{border:0!important;border-left:1px solid #eee!important;border-radius:0!important;color:#c33;background:#fff;padding:7px 9px;cursor:pointer}
.em-success-preview{display:grid;grid-template-columns:220px 1fr;gap:18px;max-width:680px;margin:22px auto;text-align:left;border:1px solid #eee;border-radius:16px;padding:14px}
.em-success-photo{aspect-ratio:1/1.12;background:#f5f5f5;border-radius:12px;overflow:hidden;display:grid;place-items:center;color:#aaa}
.em-success-photo img{width:100%;height:100%;object-fit:cover}
.em-success-info h2{margin:5px 0;font-size:24px}.em-success-info>strong{font-size:22px}.em-success-info p{margin:8px 0}.em-success-info small{color:#888}
.em-success-url{display:flex;gap:7px;max-width:680px;margin:0 auto 18px}.em-success-url input{flex:1;min-width:0;padding:9px;border:1px solid #ddd;border-radius:8px}
.em-product{display:block!important}
.em-gallery{width:100%!important}
.em-gallery-track img{object-fit:contain!important;background:#f6f6f6!important}
@media(max-width:759px){
  .em-product{max-width:100%!important;margin-top:0!important}
  .em-gallery-track img{height:auto!important;aspect-ratio:1/1.18!important;max-height:none!important}
}
@media(max-width:600px){
  .em-success-preview{grid-template-columns:1fr}
  .em-success-photo{max-height:360px}
  .em-success-url{flex-direction:column}
}

/* v5.3 UI refinements */

/* dashboard recent cards with visible edit/preview */
.em-recent{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.em-recent-item{border:1px solid #eee;border-radius:11px;padding:7px;background:#fff}
.em-recent-main{display:grid;grid-template-columns:68px 1fr;gap:9px;align-items:center;text-decoration:none;color:#222}
.em-recent-actions{display:flex;gap:6px;margin-top:7px}
.em-recent-actions .button{flex:1;text-align:center}

/* product detail image size */
.em-product{max-width:640px!important}
.em-gallery{background:#f7f7f7}
.em-gallery-track img{
  height:auto!important;
  aspect-ratio:4/5!important;
  max-height:620px!important;
  object-fit:contain!important;
}

/* smaller product description text */
.em-desc{
  font-size:15px!important;
  line-height:1.6!important;
  padding:12px 13px!important;
}

/* desktop */
@media(min-width:760px){
  .em-product{max-width:640px!important}
  .em-gallery-track img{
    height:auto!important;
    aspect-ratio:4/5!important;
    max-height:620px!important;
  }
  .em-product-info{padding:22px 24px!important}
}
/* mobile */
@media(max-width:759px){
  .em-product{max-width:100%!important}
  .em-gallery-track img{
    aspect-ratio:4/5!important;
    max-height:none!important;
  }
  .em-desc{font-size:14px!important}
}

/* v5.4 live preview */
.em-live-layout{display:grid;grid-template-columns:minmax(0,1.45fr) minmax(300px,.55fr);gap:18px;align-items:start}
.em-live-preview-panel{position:sticky;top:46px;background:#fff;border:1px solid #e1e5e9;border-radius:16px;padding:14px}
.em-live-preview-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:10px}
.em-live-preview-head b{font-size:16px}.em-live-preview-head small{color:#888}
.em-live-phone{border:1px solid #eee;border-radius:18px;overflow:hidden;background:#fff;box-shadow:0 5px 18px #0000000d}
.em-live-photo{aspect-ratio:4/5;background:#f5f5f5;display:grid;place-items:center;color:#aaa;overflow:hidden}
.em-live-photo img{width:100%;height:100%;object-fit:cover}
.em-live-body{padding:14px}.em-live-body h3{margin:5px 0 2px;font-size:19px}.em-live-body>strong{font-size:21px}.em-live-body p{font-size:13px;line-height:1.5;color:#666;background:#fafafa;border-radius:10px;padding:10px;margin:10px 0}
.em-live-option{display:flex;justify-content:space-between;padding:9px 0;border-top:1px solid #eee;font-size:13px}.em-live-option span{color:#666}
.em-live-body>button{width:100%;height:46px;border:0;border-radius:11px;background:#ff4d7d;color:#fff;font-weight:900;margin-top:9px}
.em-live-badge{display:inline-block;background:#222;color:#fff;border-radius:7px;padding:4px 7px;font-size:10px;font-weight:900}
@media(max-width:1100px){.em-live-layout{grid-template-columns:1fr}.em-live-preview-panel{position:static;max-width:480px}}

/* ===== v5.5 ===== */

/* BADGE colors */
.em-badges .badge-new,.em-detail-badge.badge-new{background:#2f80ed!important;color:#fff!important}
.em-badges .badge-best,.em-detail-badge.badge-best{background:#ffb000!important;color:#222!important}
.em-badges .badge-hot,.em-detail-badge.badge-hot{background:#ff4d5a!important;color:#fff!important}
.em-detail-badge{display:inline-block;padding:5px 8px;border-radius:7px;font-size:11px;font-weight:900;margin-bottom:7px}
.em-card-pin{font-size:12px;margin-right:3px}

/* PIN checkbox */
.em-pin-check{display:flex!important;align-items:center;gap:7px;height:43px;padding:0 10px;border:1px solid #d9dde3;border-radius:9px;background:#fafafa;font-weight:700!important}
.em-pin-check input{width:auto!important}

/* dashboard recent products: one line */
.em-recent-list{display:flex;flex-direction:column;gap:0}
.em-recent-line{display:grid;grid-template-columns:minmax(0,1fr) 100px 58px 76px;gap:8px;align-items:center;padding:10px 0;border-bottom:1px solid #eee}
.em-recent-name{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.em-recent-line>strong{font-size:13px}
.em-pin-mark{margin-right:4px}

/* FULL custom buyer detail - no theme leftovers */
body.em-product-only{background:#fff!important;margin:0!important}
.em-product-shell{max-width:560px;margin:0 auto 90px;background:#fff;min-height:100vh}
.em-product-shell .em-back{display:block;padding:13px 14px;border-bottom:1px solid #eee;text-decoration:none;color:#333;font-size:14px}
.em-product-shell .em-gallery{width:100%;aspect-ratio:1/1!important;background:#f5f5f5!important;overflow:hidden;position:relative}
.em-product-shell .em-gallery>img{width:100%!important;height:100%!important;aspect-ratio:1/1!important;object-fit:cover!important;object-position:center center!important;display:block!important}
.em-product-shell .em-gallery-track{height:100%!important}
.em-product-shell .em-gallery-track img{min-width:100%!important;width:100%!important;height:100%!important;aspect-ratio:1/1!important;object-fit:cover!important;object-position:center center!important;display:block!important}
.em-product-shell .em-product-info{padding:17px 14px 24px!important}
.em-product-shell .em-product-info h1{font-size:21px!important;margin:0 0 3px!important}
.em-product-shell .em-price{font-size:23px!important;margin-bottom:11px!important}
.em-product-shell .em-desc{font-size:13px!important;line-height:1.55!important;padding:10px 11px!important;margin-bottom:13px!important}
.em-product-shell .em-desc p{margin:0 0 7px!important}
.em-product-shell .em-product-info label{font-size:14px!important;margin:10px 0!important}
.em-product-shell .em-product-info select{height:44px!important;font-size:15px!important}
.em-product-shell .em-add-cart{min-height:50px!important;margin-top:14px!important}
.em-product-shell .em-noimg{aspect-ratio:1/1}

@media(min-width:700px){
  .em-product-shell{max-width:560px!important;border-left:1px solid #eee;border-right:1px solid #eee}
}
@media(max-width:650px){
  .em-recent-line{grid-template-columns:minmax(0,1fr) 82px 54px 70px;font-size:12px}
}

/* ===== v5.6 ===== */

/* dashboard recent: thumbnail + title + price + buttons in one line */
.em-recent-line{
  display:grid!important;
  grid-template-columns:46px minmax(0,1fr) 92px 56px 74px!important;
  gap:8px!important;
  align-items:center!important;
  padding:8px 0!important;
}
.em-recent-thumb{width:46px;height:46px;border-radius:8px;overflow:hidden;background:#f4f4f4;display:grid;place-items:center;color:#aaa;font-size:10px}
.em-recent-thumb img{width:100%;height:100%;object-fit:cover;object-position:center}

/* optional detail page images */
.em-detail-drop{background:#fffdf8!important}
.em-detail-images{width:100%;border-top:1px solid #eee;background:#fff}
.em-detail-images img{display:block;width:100%;height:auto;margin:0;padding:0}

/* product management category */
.em-manage-filter{align-items:center;flex-wrap:wrap}
.em-manage-filter select{min-width:180px;height:38px}
.em-product-cat{display:inline-block;font-size:11px;font-weight:800;color:#6d5bd0;background:#f1efff;border-radius:999px;padding:4px 7px;margin-bottom:5px}

@media(max-width:650px){
  .em-recent-line{grid-template-columns:40px minmax(0,1fr) 76px 52px 68px!important}
  .em-recent-thumb{width:40px;height:40px}
}

/* v5.8 cart thumbnail */
.em-cart-row{grid-template-columns:minmax(0,1fr) auto!important}
.em-cart-product{display:grid;grid-template-columns:54px minmax(0,1fr);gap:10px;align-items:center;min-width:0}
.em-cart-thumb{width:54px;height:54px;border-radius:9px;overflow:hidden;background:#f4f4f4;display:grid;place-items:center;color:#aaa;font-size:10px}
.em-cart-thumb img{width:100%;height:100%;object-fit:cover;object-position:center}
.em-cart-main{min-width:0}
.em-cart-main strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
@media(max-width:520px){
  .em-cart-product{grid-template-columns:48px minmax(0,1fr)}
  .em-cart-thumb{width:48px;height:48px}
}

/* ===== v5.9 1차 최종 UI ===== */
.em-product-shell .em-continue-shopping-top{
  display:flex!important;
  align-items:center!important;
  min-height:48px!important;
  padding:0 14px!important;
  background:#fff!important;
  border-bottom:1px solid #ececec!important;
  color:#222!important;
  font-size:15px!important;
  font-weight:800!important;
  text-decoration:none!important;
}
.em-product-shell .em-continue-shopping-top:hover{background:#fafafa!important}

.em-continue-shopping{
  display:block!important;
  width:100%!important;
  min-height:48px!important;
  margin-top:9px!important;
  border:1px solid #dcdcdc!important;
  border-radius:12px!important;
  background:#fff!important;
  color:#222!important;
  padding:13px 14px!important;
  text-align:center!important;
  font-weight:900!important;
  text-decoration:none!important;
}
.em-continue-shopping:hover{background:#f7f7f7!important}
.em-copy-order{margin-top:9px!important}

/* ===== v6.0 2단 상품 필터 ===== */

/* 1차: 전체상품 / 오늘공구 / 지난 상품 / 종료 상품 */
.em-stage-tabs{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:7px;
  padding:10px 12px 8px;
  background:#fff;
}
.em-stage-tabs button{
  min-height:42px;
  border:1px solid #e6e6e6;
  border-radius:11px;
  background:#fff;
  color:#333;
  font-size:13px;
  font-weight:800;
  padding:7px 5px;
  cursor:pointer;
  white-space:nowrap;
}
.em-stage-tabs button.active{
  background:#222;
  color:#fff;
  border-color:#222;
}
.em-stage-tabs button[data-stage="recent"].active{
  background:#ff4d7d;
  border-color:#ff4d7d;
}
.em-stage-tabs button[data-stage="past"].active{
  background:#6750a4;
  border-color:#6750a4;
}
.em-stage-tabs button[data-stage="closed"].active{
  background:#777;
  border-color:#777;
}

/* 2차: 카테고리 */
.em-cats{
  padding-top:7px!important;
  padding-bottom:10px!important;
  background:#fafafa!important;
}
.em-cats button{
  background:#fff!important;
}
.em-cats button.active{
  background:#222!important;
  color:#fff!important;
}

/* 종료상품 카드는 살짝 톤다운 */
.em-card[data-stage="closed"] .em-thumb img{
  filter:saturate(.75);
}
.em-card[data-stage="closed"] .em-card-body{
  opacity:.82;
}

@media(max-width:430px){
  .em-stage-tabs{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
}

/* v6.1 모바일 공구상태 필터: 무조건 한 줄 */
@media(max-width:600px){
  .em-stage-tabs{
    display:flex !important;
    flex-wrap:nowrap !important;
    gap:5px !important;
    padding:8px 10px !important;
    overflow-x:auto !important;
    scrollbar-width:none;
    -webkit-overflow-scrolling:touch;
  }
  .em-stage-tabs::-webkit-scrollbar{display:none}
  .em-stage-tabs button{
    flex:1 0 auto !important;
    min-width:0 !important;
    min-height:38px !important;
    padding:6px 9px !important;
    font-size:12px !important;
    white-space:nowrap !important;
  }
}
@media(max-width:390px){
  .em-stage-tabs button{
    padding-left:7px !important;
    padding-right:7px !important;
    font-size:11px !important;
  }
}

/* ===== v7.0 메인 배너 ===== */
.em-hero{position:relative;margin:10px 12px 4px;border-radius:18px;overflow:hidden;background:#f3f3f3;aspect-ratio:16/8.2}
.em-hero-track{display:flex;width:100%;height:100%;overflow-x:auto;scroll-snap-type:x mandatory;scrollbar-width:none;-webkit-overflow-scrolling:touch}
.em-hero-track::-webkit-scrollbar{display:none}
.em-hero-slide{flex:0 0 100%;width:100%;height:100%;scroll-snap-align:start;display:block;text-decoration:none}
.em-hero-slide img{width:100%;height:100%;object-fit:cover;object-position:center;display:block}
.em-hero-count{position:absolute;right:12px;bottom:10px;background:#0009;color:#fff;border-radius:999px;padding:5px 9px;font-size:11px;line-height:1}
.em-banner-admin-list{display:flex;flex-direction:column;gap:12px}.em-banner-admin-row{display:grid;grid-template-columns:220px 1fr;gap:16px;align-items:center;padding:14px;border:1px solid #e3e5e8;border-radius:14px}.em-banner-admin-preview{aspect-ratio:16/8.2;background:#f4f4f4;border-radius:10px;overflow:hidden;display:grid;place-items:center;color:#999}.em-banner-admin-preview img{width:100%;height:100%;object-fit:cover}
@media(max-width:600px){.em-hero{margin:8px 10px 3px;border-radius:14px}.em-banner-admin-row{grid-template-columns:1fr}}

/* ===== v8.0 운영/인기 ===== */
.em-badges .soldout{background:#111!important;color:#fff!important}
.em-card-body{position:relative}
.em-card-views{display:block;color:#888;font-size:11px;margin-top:4px}
.em-detail-meta{display:flex;justify-content:space-between;align-items:center;gap:8px;color:#777;font-size:12px;margin:2px 0 6px}
.em-detail-meta b{background:#111;color:#fff;border-radius:7px;padding:4px 7px;font-size:10px}
.em-home-title{align-items:center!important}
.em-home-title>div:first-child span{display:block;margin-top:3px}
.em-sort-tabs{display:flex;gap:5px}
.em-sort-tabs button{border:1px solid #ddd;background:#fff;border-radius:8px;padding:6px 8px;font-size:11px;font-weight:800}
.em-sort-tabs button.active{background:#222;color:#fff;border-color:#222}
