:root{
  --pink-50:#fff1f6;
  --pink-100:#ffe4ee;
  --pink-200:#ffc9dd;
  --pink-300:#ff9fc5;
  --pink-400:#ff6aa7;
  --pink-500:#ec4899;
  --text:#2b2b2b;
  --muted:#7a7a7a;
  --card:#ffffffcc;
  --border:rgba(236,72,153,.20);
}

.public-wrap{
  max-width:480px;
  width:100%;
  margin:0 auto;
  padding:14px;
  box-sizing:border-box;
}

.p-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-bottom:12px;
}

.p-title{
  font-weight:900;
  font-size:18px;
  letter-spacing:.2px;
}

.p-back{
  text-decoration:none;
  font-weight:900;
  color:var(--pink-500);
}

.p-card{
  background:#ffffff;
  border:1px solid #ececec;
  border-radius:24px;
  padding:16px;
  box-shadow:0 14px 36px rgba(0,0,0,.06);
  backdrop-filter:none;
}

.p-list{
  display:flex;
  flex-direction:column;
  gap:12px;
}

.cart-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}

.cart-left{
  display:flex;
  align-items:center;
  gap:12px;
  min-width:0;
  flex:1;
}

.p-thumb{
  width:56px;
  height:56px;
  border-radius:16px;
  object-fit:cover;
  border:1px solid var(--border);
  background:#fff;
  flex-shrink:0;
}

.p-name{
  font-weight:900;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.p-sub{
  font-size:12px;
  color:var(--muted);
  margin-top:6px;
}

.qty-pill{
  display:flex;
  align-items:center;
  gap:8px;
  flex-shrink:0;
  background:rgba(236,72,153,.08);
  border:1px solid var(--border);
  border-radius:18px;
  padding:8px 10px;
}

.qty-btn{
  width:34px;
  height:34px;
  border-radius:14px;
  border:1px solid var(--border);
  background:#fff;
  font-weight:900;
  cursor:pointer;
  color:var(--pink-500);
}

.qty-btn:disabled{
  opacity:.35;
  cursor:not-allowed;
}

.qty-num{
  min-width:26px;
  text-align:center;
  font-weight:900;
  color:var(--text);
}

.p-totalbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-top:14px;
}

.p-total{
  font-weight:900;
}

.btn-primary{
  display:block;
  width:100%;
  text-align:center;
  padding:16px;
  border-radius:18px;
  border:0;
  font-weight:900;
  font-size:18px;
  color:#ffffff;
  background:linear-gradient(135deg,#e60073,#c2185b);
  box-shadow:0 10px 24px rgba(194,24,91,.28);
  text-decoration:none;
  cursor:pointer;
}

.btn-ghost-danger{
  padding:10px 14px;
  border-radius:16px;
  border:1px solid rgba(239,68,68,.7);
  background:transparent;
  color:#ef4444;
  font-weight:900;
  cursor:pointer;
}

.p-input, .p-textarea{
  width:100%;
  padding:14px 16px;
  border-radius:18px;
  border:1px solid #d9d9d9;
  background:#ffffff;
  color:#111111;
  outline:none;
  box-shadow:none;
}

.p-textarea{ min-height:110px; resize:vertical; }

.p-section{
  display:flex;
  flex-direction:column;
  gap:10px;
}

.p-note{
  font-size:12px;
  color:var(--muted);
}

/* ===== Mobile overflow guard ===== */
html, body { max-width:100%; overflow-x:hidden; }
.public-wrap { width:100%; box-sizing:border-box; }
img, video, iframe { max-width:100%; height:auto; }

/* ===== Checkout mobile width fix ===== */
@media (max-width: 520px){
  .public-wrap{
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 12px !important;
  }
  body{ overflow-x:hidden; }
}

/* ===== Force direction by html dir ===== */
html[dir="rtl"], html[dir="rtl"] body{ direction: rtl !important; }
html[dir="ltr"], html[dir="ltr"] body{ direction: ltr !important; }

/* ===== Global mobile layout fix ===== */
html, body{
  max-width:100%;
  overflow-x:hidden;
}
*, *::before, *::after{
  box-sizing:border-box;
}
img, svg, video, canvas, iframe{
  max-width:100%;
  height:auto;
}
.public-wrap{
  width:100%;
  max-width:480px;
  margin:0 auto;
  padding:14px;
  box-sizing:border-box;
  overflow-x:hidden;
}
.p-card, .p-head, .p-list, .p-totalbar, details, summary{
  max-width:100%;
  min-width:0;
}
input, select, textarea, button, a{
  max-width:100%;
}
@media (max-width: 520px){
  .public-wrap{
    max-width:100% !important;
    width:100% !important;
    margin:0 !important;
    padding:12px !important;
    box-sizing:border-box !important;
  }
  .cart-row,
  .p-totalbar{
    flex-wrap:wrap;
    min-width:0;
  }
  .cart-left{
    min-width:0;
    flex:1 1 220px;
    max-width:100%;
  }
}

.p-name{
  font-weight:900;
  line-height:1.2;
  min-height:2.4em;
  max-height:2.4em;
  overflow:hidden;
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
}




/* ===== GLOBAL DARK THEME (CHATGPT STYLE) ===== */
html[data-theme="dark"] body{
  background:#0b0d12;
  color:#f5f5f5;
}

html[data-theme="dark"] .public-wrap{
  background:transparent;
}

html[data-theme="dark"] .p-card,
html[data-theme="dark"] .p-head,
html[data-theme="dark"] .p-list,
html[data-theme="dark"] .p-totalbar,
html[data-theme="dark"] details,
html[data-theme="dark"] summary{
  background:#171a21 !important;
  border:1px solid #2a2f3a !important;
  color:#f5f5f5 !important;
  box-shadow:0 10px 24px rgba(0,0,0,.25);
}

html[data-theme="dark"]{
  --muted:#a1a1aa;
}

html[data-theme="dark"] input,
html[data-theme="dark"] textarea,
html[data-theme="dark"] select{
  background:#0f1115 !important;
  color:#f5f5f5 !important;
  border:1px solid #2a2f3a !important;
}

html[data-theme="dark"] .btn-primary{
  background:#111 !important;
  color:#fff !important;
}

html[data-theme="dark"] a{
  color:#f5f5f5;
}
