/* 对齐小程序 realtime-tryon.wxss（rpx≈0.5px @375宽） */
* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: linear-gradient(180deg, #0a1210 0%, #050509 100%);
  background-color: #050509;
  min-height: 100%;
  color: #f8fafc;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", sans-serif;
  -webkit-tap-highlight-color: transparent;
}
button {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  background: none;
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
}
textarea, input { font: inherit; color: inherit; }

.page {
  min-height: 100vh;
  min-height: 100dvh;
  padding: 8px 12px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-sizing: border-box;
}

.fade-in { animation: fadeIn 0.35s ease; }
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.meta-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  flex-shrink: 0;
  padding: 2px 4px 0;
  gap: 8px;
}
.meta-balance {
  display: flex;
  align-items: baseline;
  gap: 4px;
  min-width: 0;
}
.meta-balance-value {
  font-size: 15px;
  font-weight: 700;
  color: #39ff88;
  line-height: 1.2;
}
.meta-balance-label {
  font-size: 11px;
  color: rgba(248, 250, 252, 0.55);
}
.meta-rate {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  flex-shrink: 0;
}
.meta-pps {
  font-size: 11px;
  font-weight: 600;
  color: #38f8a6;
  line-height: 1.2;
}
.meta-approx {
  font-size: 9px;
  color: rgba(248, 250, 252, 0.5);
}

.tryon-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  width: 100%;
  padding: 10px 9px 8px;
  border-radius: 0;
  border: 1px solid #3a4256;
  background: #1c2230;
  box-shadow:
    0 8px 20px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  gap: 7px;
  overflow: visible;
}

.camera-wrap {
  position: relative;
  width: 100%;
  flex: 1;
  min-height: 46vh;
  height: 46vh;
  border-radius: 0;
  overflow: hidden;
  background: #0b0f18;
  border: 1px solid #2f3648;
  box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.25);
}

.camera-video {
  position: absolute;
  left: 0; top: 0; right: 0; bottom: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #0b0f18;
  transform: scaleX(-1);
}
.camera-video.remote {
  display: none;
  z-index: 2;
  transform: none;
  object-fit: contain;
}
.camera-video.pip {
  width: 90px;
  height: 160px;
  right: 10px;
  bottom: 14px;
  left: auto;
  top: auto;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: #111;
  z-index: 5;
  object-fit: cover;
}

.camera-placeholder {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: rgba(248, 250, 252, 0.55);
  font-size: 13px;
  padding: 20px;
  text-align: center;
  z-index: 1;
}

.cam-sketch {
  width: 60px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.cam-sketch-body {
  position: relative;
  width: 50px;
  height: 34px;
  border: 1.5px solid rgba(248, 250, 252, 0.55);
  border-radius: 7px;
  background: transparent;
}
.cam-sketch-body::before {
  content: "";
  position: absolute;
  top: -7px;
  left: 50%;
  transform: translateX(-50%);
  width: 18px;
  height: 7px;
  border: 1.5px solid rgba(248, 250, 252, 0.55);
  border-bottom: none;
  border-radius: 4px 4px 0 0;
}
.cam-sketch-lens {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 17px;
  height: 17px;
  margin-left: -8.5px;
  margin-top: -8.5px;
  border: 1.5px solid rgba(248, 250, 252, 0.55);
  border-radius: 50%;
}
.cam-sketch-lens::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 6px;
  height: 6px;
  margin-left: -3px;
  margin-top: -3px;
  border: 1px solid rgba(248, 250, 252, 0.35);
  border-radius: 50%;
}
.cam-sketch-flash {
  position: absolute;
  top: 5px;
  right: 6px;
  width: 5px;
  height: 5px;
  border: 1px solid rgba(248, 250, 252, 0.45);
  border-radius: 50%;
}
.cam-sketch-dot {
  position: absolute;
  top: 6px;
  left: 7px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: rgba(248, 250, 252, 0.35);
}
.cam-placeholder-title {
  font-size: 13px;
  color: rgba(248, 250, 252, 0.62);
  line-height: 1.4;
}
.camera-placeholder .hint {
  font-size: 11px;
  color: rgba(248, 250, 252, 0.35);
  line-height: 1.4;
}

.link-btn {
  margin-top: 4px;
  padding: 7px 16px;
  border-radius: 999px;
  background: rgba(57, 255, 136, 0.15);
  border: 1px solid rgba(57, 255, 136, 0.4);
  color: #39ff88;
  font-size: 13px;
}

.overlay-mask {
  position: absolute;
  inset: 0;
  background: transparent;
  pointer-events: none;
  z-index: 4;
}
.overlay-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  text-align: center;
  padding: 5px 9px;
  border-radius: 7px;
  background-color: rgba(0, 0, 0, 0.45);
  color: #39ff88;
  font-size: 11px;
  line-height: 1.35;
}
.overlay-timer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 36px;
  text-align: center;
  font-size: 32px;
  font-weight: 700;
  color: #ffffff;
}
.overlay-cost {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 14px;
  text-align: center;
  font-size: 12px;
  color: #e2e8f0;
}

.select-panel {
  background: transparent;
  border: none;
  padding: 2px 2px 1px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  flex-shrink: 0;
}

.ref-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 2px 2px 0 1px;
  gap: 6px;
}
.ref-toolbar-left {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
}
.add-ref-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  background: linear-gradient(145deg, #7dffbd 0%, #38f8a6 48%, #12b76a 100%);
  box-shadow:
    inset 0 1px 2px 0 rgba(255, 255, 255, 0.35),
    inset 0 -2px 6px 0 rgba(18, 183, 106, 0.55),
    0 2px 6px rgba(57, 255, 136, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
}
.add-ref-btn:active { transform: scale(0.96); opacity: 0.92; }
.add-ref-plus {
  font-size: 17px;
  font-weight: 600;
  color: #050509;
  line-height: 1;
  margin-top: -1px;
}
.ref-hint-wrapper {
  display: flex;
  flex-direction: column;
  margin-left: 7px;
  flex: 1;
  min-width: 0;
  align-items: flex-start;
  justify-content: center;
  text-align: left;
  background: transparent;
}
.ref-hint {
  display: block;
  width: 100%;
  font-size: 11px;
  color: #ffffff;
  line-height: 1.4;
  text-align: left;
}
.ref-hint-small {
  display: block;
  width: 100%;
  font-size: 9px;
  color: rgba(255, 255, 255, 0.78);
  line-height: 1.35;
  margin-top: 1px;
  text-align: left;
}
.fashion-btn {
  flex-shrink: 0;
  min-width: 80px;
  height: 32px;
  padding: 0 14px;
  border-radius: 999px;
  background: #38f8a6;
  box-shadow:
    0 2px 7px rgba(57, 255, 136, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
}
.fashion-btn:active { transform: scale(0.97); opacity: 0.92; }
.fashion-btn span {
  font-size: 12px;
  color: #050509;
  font-weight: 600;
  white-space: nowrap;
}

.garment-element-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 2px 1px 1px;
}
.ref-thumb-wrap {
  position: relative;
  width: 56px;
  height: 56px;
  flex-shrink: 0;
}
.ref-thumb {
  width: 100%;
  height: 100%;
  border-radius: 7px;
  border: 1px solid rgba(57, 255, 136, 0.65);
  object-fit: cover;
  display: block;
  background: #0b0f18;
}
.ref-thumb-close {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 16px;
  height: 16px;
  line-height: 14px;
  text-align: center;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 11px;
}
.tryon-element-input {
  flex: 1;
  min-width: 0;
  height: 32px;
  min-height: 32px;
  max-height: 100px;
  padding: 6px 6px;
  border-radius: 6px;
  background: #0b0f18;
  border: 1px solid rgba(57, 255, 136, 0.65);
  font-size: 12px;
  line-height: 1.35;
  color: #f8fafc;
  resize: none;
  overflow-y: auto;
}
.tryon-element-input::placeholder {
  color: #9ca3af;
  font-size: 11px;
  opacity: 0.95;
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 7px;
  flex-shrink: 0;
}
.primary-btn,
.danger-btn {
  height: 44px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  width: 100%;
}
.primary-btn {
  background: linear-gradient(135deg, #39ff88 0%, #1ad6a0 100%);
  color: #04140c;
  box-shadow: 0 5px 14px rgba(57, 255, 136, 0.26);
}
.primary-btn.disabled {
  opacity: 0.4;
  pointer-events: none;
}
.danger-btn {
  background: rgba(255, 80, 80, 0.18);
  border: 1px solid rgba(255, 100, 100, 0.45);
  color: #ff8b8b;
}
.secondary-row {
  display: flex;
  gap: 7px;
}
.ghost-btn {
  flex: 1;
  height: 34px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: rgba(248, 250, 252, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
}
.status-line {
  min-height: 16px;
  font-size: 11px;
  color: rgba(248, 250, 252, 0.45);
  text-align: center;
}

.result-card {
  background: rgba(22, 27, 38, 0.92);
  border: 1px solid rgba(57, 255, 136, 0.18);
  border-radius: 12px;
  padding: 12px;
  flex-shrink: 0;
}
.section-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: #e2e8f0;
}
.result-line {
  font-size: 13px;
  color: rgba(248, 250, 252, 0.7);
  margin-top: 4px;
}
.result-line.strong {
  color: #39ff88;
  font-size: 16px;
  font-weight: 700;
}
.result-warn {
  margin-top: 8px;
  color: #ffb454;
  font-size: 12px;
}

/* 选服 sheet */
.garment-sheet-mask {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0 12px calc(12px + env(safe-area-inset-bottom));
}
.garment-sheet {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 6px;
}
.garment-sheet-group {
  background: #ffffff;
  border-radius: 12px;
  overflow: hidden;
}
.garment-sheet-item {
  min-height: 48px;
  width: 100%;
  padding: 14px 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  line-height: 1.35;
  color: #111827;
  background: #ffffff;
  text-align: center;
}
.garment-sheet-item + .garment-sheet-item {
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}
.garment-sheet-item:active {
  background: #f3f4f6;
}

/* 时尚服饰全屏面板 */
.fashion-panel {
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: #0b0f18;
  display: flex;
  flex-direction: column;
}
.fashion-panel-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 560px;
  width: 100%;
  margin: 0 auto;
}
.fashion-panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid #2f3648;
  flex-shrink: 0;
}
.fashion-back {
  color: #38f8a6;
  font-size: 14px;
  padding: 4px 0;
}
.fashion-title {
  font-size: 16px;
  font-weight: 600;
  color: #f8fafc;
}
.fashion-search-bar {
  padding: 10px 14px;
  flex-shrink: 0;
}
.fashion-search {
  width: 100%;
  height: 36px;
  border-radius: 999px;
  border: 1px solid #2f3648;
  background: #1c2230;
  color: #f8fafc;
  padding: 0 14px;
  font-size: 13px;
  outline: none;
}
.fashion-tabs {
  display: flex;
  gap: 8px;
  padding: 0 14px 10px;
  overflow-x: auto;
  flex-shrink: 0;
  -webkit-overflow-scrolling: touch;
}
.fashion-tab {
  flex-shrink: 0;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  color: rgba(248, 250, 252, 0.7);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid transparent;
}
.fashion-tab.active {
  color: #04140c;
  background: #38f8a6;
  font-weight: 600;
}
.fashion-grid {
  flex: 1;
  overflow-y: auto;
  padding: 4px 14px 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-content: start;
  -webkit-overflow-scrolling: touch;
}
.fashion-loading, .fashion-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: rgba(248, 250, 252, 0.45);
  padding: 40px 12px;
  font-size: 13px;
}
.fashion-card {
  background: #1c2230;
  border: 1px solid #2f3648;
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-width: 0;
  align-self: start;
}
/* padding-top 竖图比例：兼容微信 web-view（aspect-ratio 在部分内核会塌成细条） */
.fashion-card-media {
  position: relative;
  width: 100%;
  padding-top: 133.333%; /* 3:4 竖向缩略图 */
  background: #0b0f18;
  overflow: hidden;
  flex-shrink: 0;
}
.fashion-card-media img,
.fashion-card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  background: #0b0f18;
  display: block;
  border: 0;
}
.fashion-card-body {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.fashion-card-name {
  font-size: 12px;
  color: #e2e8f0;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fashion-use-btn {
  height: 30px;
  border-radius: 999px;
  background: linear-gradient(135deg, #39ff88 0%, #1ad6a0 100%);
  color: #04140c;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-gate {
  max-width: 420px;
  margin: 40px auto;
  padding: 24px;
  background: #1c2230;
  border-radius: 16px;
  border: 1px solid #3a4256;
  text-align: center;
  color: #f8fafc;
}
.login-gate h2 { margin: 0 0 8px; font-size: 18px; }
.login-gate p { margin: 0; font-size: 13px; color: rgba(248,250,252,.55); line-height: 1.5; }

[hidden] { display: none !important; }
