/* 开好啦 Phase 1 (P0) Frontend Upgrade — Conversion, Mobile, Dark Polish & Motion */

/* 1. Dark Mode Native Scrollbars & Color Scheme */
html:not([data-theme="light"]) {
  color-scheme: dark;
  scrollbar-color: rgba(148, 163, 184, 0.28) rgba(10, 12, 20, 0.9);
  scrollbar-width: thin;
}
html:not([data-theme="light"]) ::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
html:not([data-theme="light"]) ::-webkit-scrollbar-track {
  background: rgba(10, 12, 20, 0.65);
}
html:not([data-theme="light"]) ::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.28);
  border-radius: 999px;
}
html:not([data-theme="light"]) ::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.45);
}

/* 2. Iris Card Corner Glow Clipping Fix (feather halos instead of hard box corners) */
.neo-card {
  overflow: visible;
}
.neo-card-bloom {
  -webkit-mask-image: radial-gradient(ellipse 74% 74% at 50% 50%, #000 48%, transparent 100%);
  mask-image: radial-gradient(ellipse 74% 74% at 50% 50%, #000 48%, transparent 100%);
  pointer-events: none;
}

/* 3. Prevent Wordmark Truncation (e.g. Firstmail) */
.neo-wordmark {
  font-size: clamp(16px, 1.55vw, 22px) !important;
  letter-spacing: -0.01em;
  white-space: nowrap;
  max-width: 100%;
  overflow: visible !important;
  text-overflow: clip !important;
}

/* 4. PDP Above-the-Fold Primary CTA Bar */
.detail-actions-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin: 16px 0 18px;
}
.detail-actions-top .btn-primary {
  min-width: 176px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.26);
}
.detail-trust-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  width: 100%;
  font-size: 12.5px;
  color: var(--text-3, #94a3b8);
  margin-top: 2px;
}
.detail-trust-strip span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.detail-trust-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  background: rgba(16, 185, 129, 0.14);
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.28);
}
[data-theme="light"] .detail-trust-pill {
  background: rgba(16, 185, 129, 0.1);
  color: #047857;
  border-color: rgba(4, 120, 87, 0.22);
}

/* 5. Mobile Sticky Bottom Buy Bar (PDP <= 860px) */
.pdp-sticky-bar {
  display: none;
}
@media (max-width: 860px) {
  .pdp-sticky-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 70;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    background: rgba(10, 12, 22, 0.94);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.45);
  }
  [data-theme="light"] .pdp-sticky-bar {
    background: rgba(255, 255, 255, 0.95);
    border-top: 1px solid rgba(15, 23, 42, 0.1);
    box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.08);
  }
  .pdp-sticky-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
  }
  .pdp-sticky-price {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.15;
    font-variant-numeric: tabular-nums;
  }
  .pdp-sticky-sub {
    font-size: 11.5px;
    color: var(--text-3, #94a3b8);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .pdp-sticky-bar .btn {
    flex-shrink: 0;
    min-width: 132px;
    min-height: 44px;
    padding: 10px 20px;
    font-weight: 600;
  }
  body.has-pdp-sticky {
    padding-bottom: 84px;
  }
}

/* 6. Checkout Step 1: Payment Method Selector & Password Helpers */
.pay-method-pick {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0 10px;
}
@media (max-width: 560px) {
  .pay-method-pick {
    grid-template-columns: 1fr;
  }
}
.pay-method-opt {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.03);
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}
[data-theme="light"] .pay-method-opt {
  border-color: rgba(15, 23, 42, 0.14);
  background: rgba(15, 23, 42, 0.02);
}
.pay-method-opt:hover {
  border-color: rgba(56, 189, 248, 0.45);
}
.pay-method-opt:not(.is-active) {
  border-color: rgba(255, 255, 255, 0.14) !important;
  box-shadow: none !important;
}
[data-theme="light"] .pay-method-opt:not(.is-active) {
  border-color: rgba(15, 23, 42, 0.14) !important;
  box-shadow: none !important;
}
.pay-method-opt.is-active {
  border-color: #2dd4bf !important;
  background: rgba(45, 212, 191, 0.11) !important;
  box-shadow: 0 0 0 1px rgba(45, 212, 191, 0.4), 0 8px 20px rgba(0, 0, 0, 0.22) !important;
}
[data-theme="light"] .pay-method-opt.is-active {
  border-color: #0d9488 !important;
  background: rgba(13, 148, 136, 0.08) !important;
  box-shadow: 0 0 0 1px rgba(13, 148, 136, 0.28) !important;
}
.pay-method-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 8px;
}
.pay-method-name {
  font-size: 14px;
  font-weight: 700;
}
.pay-method-tag {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
}
.pay-method-tag.is-free {
  background: rgba(16, 185, 129, 0.18);
  color: #34d399;
}
[data-theme="light"] .pay-method-tag.is-free {
  background: rgba(16, 185, 129, 0.12);
  color: #047857;
}
.pay-method-tag.is-fee {
  background: rgba(245, 158, 11, 0.16);
  color: #fbbf24;
}
[data-theme="light"] .pay-method-tag.is-fee {
  background: rgba(245, 158, 11, 0.14);
  color: #b45309;
}
.pay-method-desc {
  font-size: 12px;
  color: var(--text-3, #94a3b8);
  line-height: 1.4;
}
.pw-input-wrap {
  display: flex;
  align-items: stretch;
  gap: 6px;
}
.pw-input-wrap input {
  flex: 1;
  min-width: 0;
}
.pw-helper-btn {
  flex-shrink: 0;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.05);
  color: inherit;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease;
}
[data-theme="light"] .pw-helper-btn {
  border-color: rgba(15, 23, 42, 0.16);
  background: rgba(15, 23, 42, 0.04);
}
.pw-helper-btn:hover {
  border-color: rgba(45, 212, 191, 0.55);
  background: rgba(45, 212, 191, 0.12);
}

/* 7. Mobile (<=860px) Hero Top Clearance & Catalog Sticky Strip Fix */
@media (max-width: 860px) {
  .hall {
    padding-top: 112px !important;
  }
  .hall-copy {
    margin-top: 6px;
  }
  .cat-side {
    position: sticky;
    top: 64px;
    z-index: 25;
    background: rgba(10, 12, 20, 0.94) !important;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    padding: 10px 12px !important;
    margin: 0 -12px 14px !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.09);
    scrollbar-width: none !important;
    -ms-overflow-style: none;
  }
  .cat-side,
  .cat-side * {
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
  }
  .cat-side::-webkit-scrollbar,
  .cat-side *::-webkit-scrollbar {
    display: none !important;
    height: 0 !important;
    width: 0 !important;
    background: transparent !important;
  }
  [data-theme="light"] .cat-side {
    background: rgba(248, 250, 255, 0.95) !important;
    border-bottom-color: rgba(15, 23, 42, 0.09);
  }
}

/* 8. Tactile Micro-Interactions (respect prefers-reduced-motion) */
@media (prefers-reduced-motion: no-preference) {
  .btn-primary, .neo-buy {
    transition: transform 0.18s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.2s ease, filter 0.2s ease;
  }
  .btn-primary:active, .neo-buy:active {
    transform: scale(0.975);
  }
  @media (hover: hover) and (pointer: fine) {
    .neo-card:not(.is-out):hover {
      transform: translateY(-4px);
      transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
    }
  }
}
