:root {
  --mx-bg0: #F7FAFF;
  --mx-bg1: #EFF4FF;
  --mx-line: rgba(15, 23, 42, 0.12);
  --mx-soft: rgba(15, 23, 42, 0.06);
  --mx-glow: rgba(255, 184, 77, 0.28);
  --mx-gold: #FFB84D;
  --mx-gold2: #FF9F1C;
  --mx-cyan: #06b6d4;
  --mx-violet: #7c3aed;
}

html {
  height: 100%;
  background:
    radial-gradient(1100px 600px at 15% -10%, rgba(6,182,212,0.16), transparent 60%),
    radial-gradient(900px 520px at 90% 0%, rgba(124,58,237,0.12), transparent 60%),
    radial-gradient(900px 560px at 50% 105%, rgba(255,159,28,0.16), transparent 55%),
    linear-gradient(180deg, var(--mx-bg0), var(--mx-bg1));
}

body {
  min-height: 100vh;
  background:
    radial-gradient(1100px 600px at 15% -10%, rgba(6,182,212,0.16), transparent 60%),
    radial-gradient(900px 520px at 90% 0%, rgba(124,58,237,0.12), transparent 60%),
    radial-gradient(900px 560px at 50% 105%, rgba(255,159,28,0.16), transparent 55%),
    linear-gradient(180deg, var(--mx-bg0), var(--mx-bg1));
  color: rgba(15, 23, 42, 0.92);
  font-size: 16px;
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: none;
}

.wrap { max-width: 1100px; }

.muted { color: rgba(15, 23, 42, 0.55) !important; }
.error { color: #b42318 !important; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px;
  border: 1px solid var(--mx-line);
  border-radius: 18px;
  background: rgba(255,255,255,0.72);
  backdrop-filter: blur(12px);
  box-shadow: 0 18px 60px rgba(15, 23, 42, 0.12);
}

.topSlotLeft {
  width: 0;
  height: 1px;
  flex: 0 0 auto;
}

.topUser {
  white-space: nowrap;
  flex: 0 0 auto;
}

.brandTitle {
  font-weight: 900;
  font-size: 18px;
  letter-spacing: 0.6px;
  background: linear-gradient(90deg, rgba(15,23,42,0.92), var(--mx-gold2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  white-space: nowrap;
  flex: 1 1 auto;
  text-align: left;
}


.navLarge {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.navBtn {
  border: 1px solid transparent;
  background: linear-gradient(180deg, rgba(255,255,255,0.95), rgba(255,255,255,0.72));
  color: rgba(15, 23, 42, 0.78);
  padding: 16px 14px;
  border-radius: 18px;
  font-weight: 800;
  font-size: 16px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  touch-action: manipulation;
  transition: transform .16s ease, background .16s ease, box-shadow .16s ease, color .16s ease;
}

.navBtn::before {
  content: '';
  position: absolute;
  inset: -2px;
  background:
    radial-gradient(280px 120px at 20% 10%, rgba(6,182,212,0.22), transparent 60%),
    radial-gradient(240px 120px at 80% 0%, rgba(124,58,237,0.16), transparent 60%),
    radial-gradient(260px 140px at 50% 120%, rgba(255,159,28,0.18), transparent 55%);
  opacity: 1;
  pointer-events: none;
}

.navBtn > span { position: relative; }

.navBtn:active { transform: translateY(1px); }

.navBtn.active {
  background: linear-gradient(180deg, rgba(255,184,77,0.46), rgba(255,255,255,0.82));
  border-color: rgba(255,159,28,0.55);
  color: rgba(15, 23, 42, 0.92);
  box-shadow:
    0 0 0 3px rgba(255,159,28,0.18),
    0 18px 60px rgba(15, 23, 42, 0.16);
}

.topActions { display: flex; align-items: center; gap: 10px; }

.iconBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--mx-line);
  background: rgba(255,255,255,0.80);
  color: rgba(15, 23, 42, 0.92);
  cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}

.iconBtn:hover {
  background: rgba(255,255,255,0.92);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.14);
}

.iconBtn:active { transform: translateY(1px); }

button.secondary {
  background: rgba(255,255,255,0.82);
  color: rgba(15, 23, 42, 0.92);
  border: 1px solid var(--mx-line);
}

button.secondary:hover {
  background: rgba(255,255,255,0.94);
}

.toast {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 120;
  width: calc(100% - 24px);
  max-width: 560px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--mx-line);
  background: rgba(255,255,255,0.90);
  backdrop-filter: blur(12px);
  box-shadow: 0 18px 60px rgba(15, 23, 42, 0.16);
  white-space: pre-wrap;
  color: rgba(15, 23, 42, 0.92);
  font-weight: 800;
  line-height: 1.35;
  display: none;
}

.toast.show {
  display: block;
  animation: toastIn .18s ease;
}

.toast.toastError {
  border-color: rgba(180, 35, 24, 0.28);
  background: rgba(255, 242, 241, 0.92);
  color: rgba(130, 20, 13, 0.95);
}

.toast.toastOk {
  border-color: rgba(6, 182, 212, 0.25);
  background: rgba(236, 254, 255, 0.92);
  color: rgba(15, 23, 42, 0.92);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-6px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.main { margin-top: 14px; }

.tab {
  animation: tabIn .25s ease;
}

@keyframes tabIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero {
  text-align: center;
  padding: 34px 18px;
  min-height: 240px;
  border-radius: 22px;
  border: 1px solid rgba(255,159,28,0.22);
  background:
    radial-gradient(600px 260px at 50% 0%, rgba(255,159,28,0.14), transparent 60%),
    rgba(255,255,255,0.72);
  backdrop-filter: blur(14px);
  box-shadow:
    0 18px 70px rgba(15, 23, 42, 0.12),
    inset 0 0 0 1px rgba(255,255,255,0.55);
}

.heroLabel { color: rgba(15, 23, 42, 0.62); font-weight: 700; font-size: 13px; }

.heroValue {
  margin-top: 4px;
  font-size: 112px;
  line-height: 1.05;
  font-weight: 950;
  letter-spacing: 1px;
  background: linear-gradient(180deg, rgba(15,23,42,0.95), var(--mx-gold2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 30px var(--mx-glow);
}

.heroMain {
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.heroMain .heroValue { margin-top: 0; }

.heroRefresh {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  flex: 0 0 auto;
  border: none;
}

.heroUnit {
  font-weight: 900;
  font-size: 12px;
  color: rgba(15, 23, 42, 0.56);
  flex: 0 0 auto;
  white-space: nowrap;
}

.glass {
  margin-top: 14px;
  background: rgba(255,255,255,0.74) !important;
  border-color: var(--mx-line) !important;
  backdrop-filter: blur(12px);
  box-shadow: 0 18px 60px rgba(15, 23, 42, 0.12);
}

.sectionHead {
  display:flex;
  align-items:flex-end;
  justify-content: space-between;
  gap: 12px;
  margin: 16px 2px 10px;
}

.sectionTitle { font-weight: 900; font-size: 16px; letter-spacing: 0.2px; }

.help { margin-top: 4px; font-size: 12px; color: rgba(15, 23, 42, 0.62); }

.ordersFilter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.shopFilter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.segBtn {
  appearance: none;
  border: 1px solid var(--mx-line);
  background: rgba(255,255,255,0.70);
  color: rgba(15, 23, 42, 0.86);
  font-weight: 900;
  font-size: 12px;
  padding: 8px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}

.segBtn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.10);
}

.segBtn.active {
  border-color: rgba(255,159,28,0.35);
  background: rgba(255,159,28,0.16);
}

.orderClickable { cursor: pointer; }
.orderClickable:hover { box-shadow: 0 18px 50px rgba(15, 23, 42, 0.14); }

.gridProducts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

@media (max-width: 980px) { .gridProducts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .gridProducts { grid-template-columns: repeat(2, minmax(0, 1fr)); } .heroValue { font-size: 84px; } .hero { min-height: 200px; } }
@media (max-width: 380px) { .gridProducts { grid-template-columns: 1fr; } }

.productCard {
  position: relative;
  border: 1px solid var(--mx-line);
  border-radius: 18px;
  background: rgba(255,255,255,0.74);
  overflow: hidden;
  backdrop-filter: blur(12px);
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.12);
  transition: transform .18s ease, box-shadow .18s ease;
}

.productCard:hover {
  transform: translateY(-2px);
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.16);
}

.productMedia {
  position: relative;
  aspect-ratio: 1 / 1;
  width: 100%;
  background: rgba(255,255,255,0.70);
  border-bottom: 1px solid var(--mx-line);
  overflow: hidden;
}

.productSoldOut {
  opacity: 0.82;
}

.productSoldOut .productImg,
.productSoldOut .productImgFallback {
  filter: grayscale(1) saturate(0.2);
}

.soldOutCardOverlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(148, 163, 184, 0.68);
  color: rgba(15, 23, 42, 0.92);
  font-weight: 950;
  font-size: 46px;
  letter-spacing: 10px;
  text-indent: 10px;
  text-transform: uppercase;
  cursor: not-allowed;
  user-select: none;
  pointer-events: auto;
}

.productImg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.productImgFallback {
  width: 100%;
  height: 100%;
  background:
    radial-gradient(220px 140px at 20% 20%, rgba(6,182,212,0.20), transparent 60%),
    radial-gradient(240px 160px at 90% 10%, rgba(124,58,237,0.14), transparent 60%),
    radial-gradient(240px 180px at 50% 120%, rgba(255,159,28,0.18), transparent 55%),
    linear-gradient(180deg, rgba(255,255,255,0.86), rgba(255,255,255,0.70));
}

.productBody { padding: 12px; }

.productTitle {
  font-weight: 900;
  font-size: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.productMeta { margin-top: 6px; font-size: 12px; color: rgba(15, 23, 42, 0.62); }
.productRemark { margin-top: 8px; font-size: 12px; color: rgba(15, 23, 42, 0.56); min-height: 16px; }

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

.pricePill {
  display:inline-flex;
  align-items:center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,159,28,0.30);
  background: rgba(255,159,28,0.14);
  color: rgba(15, 23, 42, 0.92);
  font-weight: 800;
  font-size: 12px;
}

.buyBtn {
  border: 1px solid rgba(255,159,28,0.35);
  background: linear-gradient(180deg, rgba(255,159,28,0.46), rgba(255,255,255,0.78));
  color: rgba(15, 23, 42, 0.92);
  padding: 10px 12px;
  border-radius: 14px;
  font-weight: 900;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 0 0 3px rgba(255,159,28,0.14);
  transition: transform .16s ease, box-shadow .16s ease;
}

.buyBtn:active { transform: translateY(1px); }

.buyBtn:hover { box-shadow: 0 16px 50px rgba(255,211,122,0.10); }

.buyBtn:hover { box-shadow: 0 16px 50px rgba(15, 23, 42, 0.12); }

.buyBtn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

.list { display: grid; gap: 10px; margin-top: 10px; }

.item {
  border: 1px solid var(--mx-line);
  border-radius: 16px;
  background: rgba(255,255,255,0.74);
  padding: 12px;
  box-shadow: 0 14px 45px rgba(15, 23, 42, 0.10);
}

.orderTop { display:flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.orderTitle { font-weight: 900; }
.orderMeta { margin-top: 6px; font-size: 12px; color: rgba(15, 23, 42, 0.56); }
#orders .orderTop .orderMeta { margin-top: 0; white-space: nowrap; text-align: right; }

.pill {
  display:inline-flex;
  align-items:center;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  border: 1px solid var(--mx-line);
  background: rgba(255,255,255,0.80);
}

.pillOk { border-color: rgba(6,182,212,0.30); background: rgba(6,182,212,0.10); }
.pillBad { border-color: rgba(255,107,107,0.30); background: rgba(255,107,107,0.10); }

.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 80;
}

.modalBox {
  width: 100%;
  max-width: 520px;
  border-radius: 20px;
  border: 1px solid var(--mx-line);
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(14px);
  padding: 14px;
  box-shadow: 0 22px 80px rgba(15, 23, 42, 0.18);
}

.modalTop { display:flex; align-items:flex-start; justify-content: space-between; gap: 10px; }
.modalTitle { font-weight: 950; font-size: 18px; }
.modalSub { margin-top: 2px; font-size: 12px; color: rgba(15, 23, 42, 0.56); }

.qrWrap {
  margin-top: 12px;
  border: 1px solid var(--mx-line);
  border-radius: 18px;
  background: rgba(255,255,255,0.82);
  padding: 14px;
  display:flex;
  align-items:center;
  justify-content:center;
}

#qrImg { width: 240px; height: 240px; border-radius: 16px; background: #fff; }

.qrMeta { margin-top: 10px; display:grid; gap: 6px; }
.qrMeta #qrEncoded { display: none; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; font-size: 12px; color: rgba(15, 23, 42, 0.70); word-break: break-all; }

.confirmBody {
  margin-top: 12px;
  border: 1px solid var(--mx-line);
  border-radius: 16px;
  background: rgba(255,255,255,0.82);
  padding: 12px;
  display: grid;
  gap: 10px;
}

.confirmLine {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.confirmValue {
  font-weight: 900;
  color: rgba(15, 23, 42, 0.92);
  text-align: right;
  white-space: nowrap;
}
