:root {
  color-scheme: light;
  --brand-color: #141413;
  --accent-rose: #e11d48;
  --accent-rose-soft: #fff1f2;
  --bg-outer: #efece6;
  --bg-shell: #fafaf8;
  --bg-card: #ffffff;
  --bg-muted: #f4f1ec;
  --text-primary: #141413;
  --text-secondary: #52504c;
  --text-muted: #7c7872;
  --border-light: #ece7df;
  --border-input: #767676;
  --danger: #be123c;
  --danger-bg: #fff1f2;
  --success: #15803d;
  --success-bg: #f0fdf4;
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow-card: 0 2px 14px rgba(20, 20, 19, 0.04);
  --shadow-shell: 0 18px 60px rgba(20, 20, 19, 0.1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "SF Pro Display", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg-outer);
  color: var(--text-primary);
  accent-color: var(--brand-color);
  min-block-size: 100dvb;
}

.app-shell {
  inline-size: min(100%, 460px);
  margin-inline: auto;
  min-block-size: 100dvb;
  background: var(--bg-shell);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-shell);
  position: relative;
}

/* ==================== 顶部极简导航 ==================== */
.topbar {
  position: sticky;
  inset-block-start: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: rgba(250, 250, 248, 0.88);
  backdrop-filter: blur(18px);
  border-block-end: 1px solid rgba(236, 231, 223, 0.8);
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.brand-wordmark {
  margin: 0;
  font-family: Georgia, "Times New Roman", "Songti SC", serif;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  line-height: 1;
}

.brand-sub {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.engine-pill {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-block-size: 34px;
  max-inline-size: 158px;
  padding-inline: 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border-light);
  background: var(--bg-card);
  color: var(--text-primary);
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-dot {
  inline-size: 7px;
  block-size: 7px;
  border-radius: 50%;
  background: #f59e0b;
  flex-shrink: 0;
}

.status-dot.is-ready {
  background: #10b981;
}

/* ==================== 主内容容器 ==================== */
.main-stage {
  flex: 1;
}

.view-pane {
  padding: 0.875rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.studio-pane {
  padding-block-end: 9.25rem;
}

.library-pane,
.profile-pane,
.admin-pane {
  padding-block-end: 5.5rem;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-inline-size: 0;
}

.wallet-pill {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  min-block-size: 34px;
  padding-inline: 0.65rem;
  border-radius: 999px;
  border: 1px solid #f5d0d8;
  background: var(--accent-rose-soft);
  color: var(--accent-rose);
  font: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.wallet-bolt {
  font-size: 0.8rem;
}

/* 形象师问候 */
.stylist-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-inline: 0.125rem;
}

.stylist-greeting {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--text-secondary);
}

.stylist-greeting strong {
  color: var(--text-primary);
  font-weight: 700;
}

.login-chip {
  appearance: none;
  border: 0;
  background: var(--accent-rose);
  color: #ffffff;
  border-radius: 999px;
  min-block-size: 34px;
  padding-inline: 0.85rem;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
}

/* 三大造型模式分段栏 */
.mode-segment {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.35rem;
  padding: 0.28rem;
  background: var(--bg-muted);
  border-radius: var(--radius-lg);
}

.segment-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  border-radius: 13px;
  min-block-size: 48px;
  padding: 0.35rem 0.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.05rem;
  font: inherit;
  cursor: pointer;
  transition: background-color 0.18s ease, color 0.18s ease;
}

.segment-title {
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1.2;
}

.segment-sub {
  font-size: 0.6875rem;
  color: var(--text-muted);
}

.segment-btn.is-active {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: 0 3px 10px rgba(20, 20, 19, 0.08);
}

.segment-btn.is-active .segment-sub {
  color: var(--accent-rose);
  font-weight: 600;
}

#tryon-form,
.panel-stack {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

/* ==================== 一键灵感配方条 ==================== */
.recipe-strip-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.mini-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-inline: 0.125rem;
}

.mini-section-title {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text-primary);
}

.mini-section-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.recipe-scroller {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  padding-block-end: 0.15rem;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}

.recipe-card {
  flex: 0 0 auto;
  scroll-snap-align: start;
  appearance: none;
  border: 1px solid var(--border-light);
  background: var(--bg-card);
  border-radius: 999px;
  min-block-size: 40px;
  padding: 0.35rem 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.recipe-card.is-active {
  border-color: var(--text-primary);
  background: var(--text-primary);
  color: #ffffff;
}

.recipe-badge {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--accent-rose);
  background: var(--accent-rose-soft);
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
}

.recipe-card.is-active .recipe-badge {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.recipe-label {
  font-size: 0.8125rem;
  font-weight: 600;
}

/* ==================== 画报卡片通用 ==================== */
.editorial-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: 1rem;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.compact-card {
  padding-block: 0.875rem;
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.card-head h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.25;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.card-sub {
  margin: 0.15rem 0 0;
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.opt-tag {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-muted);
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
}

.format-badge {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-muted);
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  white-space: nowrap;
}

/* ==================== 3:4 传图舞台 ==================== */
.editorial-card:has(.upload-grid) {
  container: upload-stage / inline-size;
}

.upload-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.75rem;
}

.upload-grid.is-dual {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.upload-grid.is-triple {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.upload-grid.is-triple #slot-scene-lock {
  grid-column: 1 / -1;
}

@container upload-stage (inline-size >= 24rem) {
  .upload-grid.is-triple {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5rem;
  }

  .upload-grid.is-triple #slot-scene-lock {
    grid-column: auto;
  }
}

.upload-slot {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-inline-size: 0;
}

.slot-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem;
}

.slot-label {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text-primary);
}

.slot-btns {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.pill-link {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--accent-rose);
  font: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  min-block-size: 30px;
  padding-inline: 0.35rem;
  cursor: pointer;
}

.pill-link.is-muted {
  color: var(--text-muted);
}

.lookbook-dropzone {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 3 / 4;
  inline-size: 100%;
  border-radius: var(--radius-lg);
  border: 1.5px dashed #d5cdc3;
  background: linear-gradient(180deg, #fcfbf9 0%, #f5f1eb 100%);
  overflow: clip;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.lookbook-dropzone:hover,
.lookbook-dropzone.is-dragover {
  border-color: var(--text-primary);
  background: #f3eee7;
}

.dropzone-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1rem;
  gap: 0.35rem;
}

.dropzone-plus {
  inline-size: 46px;
  block-size: 46px;
  border-radius: 50%;
  background: var(--bg-card);
  color: var(--text-primary);
  display: grid;
  place-items: center;
  font-size: 1.4rem;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(20, 20, 19, 0.08);
}

.dropzone-main {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-primary);
}

.dropzone-note {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.lookbook-preview,
.crop-stage {
  display: block;
  inline-size: 100%;
  block-size: 100%;
}

.lookbook-preview {
  object-fit: cover;
}

.crop-stage {
  position: relative;
}

.crop-overlay {
  position: absolute;
  inset-block-start: 0;
  inset-inline: 0;
  block-size: var(--crop-pct, 22%);
  background: rgba(20, 20, 19, 0.62);
  border-block-end: 2px dashed #fbbf24;
  display: grid;
  place-items: center;
  padding: 0.25rem;
  pointer-events: none;
}

.crop-pill {
  font-size: 0.6875rem;
  font-weight: 700;
  color: #fef3c7;
  background: rgba(20, 20, 19, 0.8);
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
}

.crop-panel {
  background: var(--bg-muted);
  border-radius: var(--radius-md);
  padding: 0.5rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.crop-slider-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.slider-caption {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* ==================== 视觉色板横向滑卡 ==================== */
.filter-group {
  display: flex;
  gap: 0.3rem;
}

.filter-chip {
  appearance: none;
  border: 1px solid var(--border-light);
  background: var(--bg-shell);
  color: var(--text-secondary);
  border-radius: 999px;
  min-block-size: 32px;
  padding-inline: 0.65rem;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

.filter-chip.is-active {
  background: var(--text-primary);
  color: #ffffff;
  border-color: var(--text-primary);
}

.swatch-scroller {
  display: flex;
  gap: 0.6rem;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  padding-block-end: 0.25rem;
  scrollbar-gutter: stable;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}

.swatch-card {
  flex: 0 0 150px;
  scroll-snap-align: start;
  appearance: none;
  text-align: start;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-lg);
  background: var(--bg-shell);
  padding: 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.15s ease;
}

.swatch-card.is-selected {
  border-color: var(--text-primary);
  background: var(--bg-card);
  box-shadow: 0 6px 18px rgba(20, 20, 19, 0.08);
}

.swatch-orb {
  inline-size: 100%;
  block-size: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-inline: 0.45rem;
}

.swatch-check {
  inline-size: 18px;
  block-size: 18px;
  border-radius: 50%;
  background: rgba(20, 20, 19, 0.78);
  color: #ffffff;
  font-size: 0.65rem;
  font-weight: 700;
  display: grid;
  place-items: center;
  opacity: 0;
}

.swatch-card.is-selected .swatch-check {
  opacity: 1;
}

.swatch-title {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.25;
}

.swatch-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  line-height: 1.3;
}

/* 次级分段与标签 */
.sub-segment {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.3rem;
  padding: 0.25rem;
  border-radius: var(--radius-md);
  background: var(--bg-muted);
}

.sub-segment-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  border-radius: 10px;
  min-block-size: 40px;
  padding: 0.35rem 0.25rem;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.25;
  cursor: pointer;
}

@media (pointer: coarse) {
  .sub-segment-btn {
    min-block-size: 44px;
  }
}

.sub-segment-btn.is-active {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: 0 2px 8px rgba(20, 20, 19, 0.07);
}

.sub-block {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.sub-block-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.pill-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.chip-btn {
  appearance: none;
  border: 1px solid var(--border-light);
  background: var(--bg-shell);
  color: var(--text-primary);
  border-radius: 999px;
  min-block-size: 36px;
  padding: 0.3rem 0.75rem;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.chip-btn.is-selected {
  border-color: var(--text-primary);
  background: var(--text-primary);
  color: #ffffff;
}

/* 可选附带参考图（场景 / 首饰） */
.inline-ref-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.inline-ref-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding-block-start: 0.35rem;
  border-block-start: 1px solid var(--border-light);
}

.mini-outline-btn {
  appearance: none;
  border: 1px solid var(--border-light);
  background: var(--bg-card);
  color: var(--text-primary);
  border-radius: 999px;
  min-block-size: 32px;
  padding-inline: 0.65rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

.mini-dark-btn {
  appearance: none;
  border: 0;
  background: var(--text-primary);
  color: #ffffff;
  border-radius: 999px;
  min-block-size: 36px;
  padding-inline: 0.9rem;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 700;
  cursor: pointer;
}

.attached-ref {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem;
  border-radius: var(--radius-md);
  background: var(--bg-muted);
}

.attached-ref img {
  inline-size: 44px;
  block-size: 58px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}

.attached-ref-info {
  flex: 1;
  min-inline-size: 0;
  display: flex;
  flex-direction: column;
  font-size: 0.75rem;
}

.attached-ref-info strong {
  color: var(--text-primary);
}

.attached-ref-info span {
  color: var(--text-muted);
}

/* ==================== 进阶微调抽屉 ==================== */
.pro-drawer-card {
  padding: 0;
  overflow: clip;
}

.pro-disclosure summary {
  list-style: none;
  padding: 0.9rem 1rem;
  min-block-size: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
}

.pro-disclosure summary::-webkit-details-marker {
  display: none;
}

.pro-disclosure summary::after {
  content: "▾";
  font-size: 0.85rem;
  color: var(--text-muted);
}

.pro-disclosure[open] summary::after {
  content: "▴";
}

.summary-meta {
  margin-inline-start: auto;
  margin-inline-end: 0.5rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
}

.pro-body {
  padding: 0 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  border-block-start: 1px solid var(--border-light);
  padding-block-start: 0.875rem;
}

.prompt-preview-box {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.prompt-box-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.prompt-code {
  margin: 0;
  padding: 0.75rem;
  border-radius: var(--radius-md);
  background: #18181b;
  color: #f4f4f5;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.72rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  max-block-size: 180px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.inner-disclosure summary {
  padding: 0.5rem 0;
  min-block-size: 40px;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.redline-list {
  margin: 0.25rem 0 0;
  padding-inline-start: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

/* ==================== 表单控件 ==================== */
.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.field > label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
}

input[type="text"],
input[type="password"],
input[type="url"],
textarea,
select {
  inline-size: 100%;
  font: inherit;
  font-size: max(1rem, 1em);
  line-height: 1.45;
  padding: 0.65rem 0.8rem;
  min-block-size: 48px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-input);
  background: #ffffff;
  color: var(--text-primary);
}

textarea {
  resize: vertical;
  font-size: max(0.9375rem, 16px);
}

input:user-invalid,
textarea:user-invalid {
  border-color: var(--danger);
}

input:focus-visible,
textarea:focus-visible,
select:focus-visible,
button:focus-visible,
summary:focus-visible,
a:focus-visible {
  outline: 3px solid var(--accent-rose);
  outline-offset: 2px;
}

.toggle-line {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-block-size: 40px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
}

.subtle-toggle {
  color: var(--text-muted);
  font-weight: 500;
}

.toggle-line input[type="checkbox"] {
  inline-size: 1.1rem;
  block-size: 1.1rem;
  margin: 0;
}

.password-wrap {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.toggle-pwd-btn {
  appearance: none;
  border: 1px solid var(--border-light);
  background: var(--bg-muted);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  min-block-size: 48px;
  padding-inline: 0.8rem;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}

/* ==================== 主按钮与悬浮操作栏 ==================== */
.cta-btn {
  appearance: none;
  border: 0;
  background: var(--text-primary);
  color: #ffffff;
  border-radius: 999px;
  min-block-size: 50px;
  padding-inline: 1.25rem;
  inline-size: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(20, 20, 19, 0.2);
}

.cta-btn:disabled {
  opacity: 0.65;
  cursor: progress;
}

.file-cta-label {
  cursor: pointer;
}

.toolbar-btn {
  appearance: none;
  border: 1px solid var(--border-light);
  background: var(--bg-shell);
  color: var(--text-primary);
  border-radius: 999px;
  min-block-size: 42px;
  padding-inline: 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.toolbar-btn.is-primary {
  background: var(--text-primary);
  border-color: var(--text-primary);
  color: #ffffff;
}

.danger-outline-btn {
  appearance: none;
  border: 1px solid #fecdd3;
  background: var(--danger-bg);
  color: var(--danger);
  border-radius: 999px;
  min-block-size: 46px;
  inline-size: 100%;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
}

@media (prefers-reduced-motion: no-preference) {
  .cta-btn:active:not(:disabled),
  .swatch-card:active,
  .recipe-card:active {
    transform: scale(0.98);
  }
}

/* 状态提示 */
.toast-banner {
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  font-weight: 600;
  background: var(--bg-muted);
  color: var(--text-primary);
}

.toast-banner.is-error {
  background: var(--danger-bg);
  color: var(--danger);
}

.toast-banner.is-success {
  background: var(--success-bg);
  color: var(--success);
}

/* ==================== 成片展示卡片（小红书 / INS 画报感） ==================== */
.lookbook-stage {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: clip;
  background: var(--bg-muted);
}

.lookbook-zoom-btn {
  appearance: none;
  border: 0;
  padding: 0;
  margin: 0;
  display: block;
  inline-size: 100%;
  background: transparent;
  cursor: zoom-in;
}

.lookbook-result-img {
  display: block;
  inline-size: 100%;
  block-size: auto;
  aspect-ratio: 3 / 4;
  object-fit: cover;
}

.zoom-hint-pill {
  position: absolute;
  inset-block-end: 0.75rem;
  inset-inline-end: 0.75rem;
  background: rgba(20, 20, 19, 0.65);
  backdrop-filter: blur(8px);
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  pointer-events: none;
}

.lookbook-toolbar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
}

.session-strip-wrap h3 {
  margin: 0 0 0.45rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.history-strip {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
}

.history-thumb {
  flex: 0 0 64px;
  aspect-ratio: 3 / 4;
  border-radius: 10px;
  border: 2px solid transparent;
  padding: 0;
  overflow: clip;
  cursor: pointer;
  background: var(--bg-muted);
}

.history-thumb.is-active {
  border-color: var(--accent-rose);
}

.history-thumb img {
  display: block;
  inline-size: 100%;
  block-size: 100%;
  object-fit: cover;
}

/* ==================== 悬浮生成栏 + 底部 App Dock ==================== */
.floating-cta-dock {
  position: fixed;
  inset-block-end: calc(64px + env(safe-area-inset-bottom, 0px));
  inset-inline: 0;
  margin-inline: auto;
  inline-size: min(100%, 460px);
  padding: 0.5rem 1rem 0.6rem;
  background: linear-gradient(180deg, rgba(250, 250, 248, 0) 0%, rgba(250, 250, 248, 0.96) 35%);
  z-index: 16;
}

.bottom-dock {
  position: fixed;
  inset-block-end: 0;
  inset-inline: 0;
  margin-inline: auto;
  inline-size: min(100%, 460px);
  block-size: calc(64px + env(safe-area-inset-bottom, 0px));
  padding-block-end: env(safe-area-inset-bottom, 0px);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(20px);
  border-block-start: 1px solid var(--border-light);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  z-index: 25;
}

.dock-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  position: relative;
}

.dock-btn.is-active {
  color: var(--text-primary);
  font-weight: 800;
}

.dock-btn.is-active::after {
  content: "";
  position: absolute;
  inset-block-end: 10px;
  inline-size: 20px;
  block-size: 2.5px;
  border-radius: 999px;
  background: var(--accent-rose);
}

.dock-label-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.dock-badge {
  position: absolute;
  inset-block-start: -7px;
  inset-inline-end: -16px;
  min-inline-size: 16px;
  block-size: 16px;
  padding-inline: 4px;
  border-radius: 999px;
  background: var(--accent-rose);
  color: #ffffff;
  font-size: 0.625rem;
  font-weight: 700;
  display: grid;
  place-items: center;
}

/* ==================== 我的衣橱（小红书/INS 瀑布流） ==================== */
.guest-empty-card {
  align-items: center;
  text-align: center;
  padding: 2rem 1.25rem;
}

.empty-aura {
  inline-size: 56px;
  block-size: 56px;
  border-radius: 50%;
  background: var(--accent-rose-soft);
  color: var(--accent-rose);
  font-size: 1.5rem;
  display: grid;
  place-items: center;
}

.wardrobe-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-inline: 0.125rem;
}

.wardrobe-top-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.wardrobe-title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 800;
}

.lib-tablist {
  display: flex;
  overflow-x: auto;
  gap: 0.25rem;
  border-block-end: 1px solid var(--border-light);
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.lib-tablist::-webkit-scrollbar {
  display: none;
}

.lib-tablist [role="tab"] {
  flex: none;
  position: relative;
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  min-block-size: 40px;
  padding: 0.45rem 0.65rem;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
}

.lib-tablist [role="tab"][aria-selected="true"] {
  color: var(--text-primary);
  font-weight: 700;
}

.lib-tablist [role="tab"][aria-selected="true"]::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  border-block-end: 3px solid var(--text-primary);
}

/* 紧凑单行搜索 + 排序 + 列数切换栏（不与顶部导航叠放 sticky，最大化照片视野） */
.wardrobe-sticky-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}

.wardrobe-search-input {
  flex: 1 1 150px;
  min-inline-size: 0;
  min-block-size: 36px;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--border-light);
  background: var(--bg-card);
  color: var(--text-primary);
  font: inherit;
  font-size: 0.8rem;
}

.wardrobe-search-input:focus {
  outline: 2px solid var(--brand-color);
  outline-offset: 1px;
  border-color: var(--brand-color);
}

.wardrobe-view-controls {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex: none;
}

.density-switch {
  display: inline-flex;
  align-items: center;
  padding: 2px;
  border-radius: 999px;
  background: var(--bg-muted);
  border: 1px solid var(--border-light);
}

.density-btn {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  min-block-size: 30px;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}

#lib-sort-btn {
  border-color: var(--border-light);
  background: var(--bg-card);
  min-block-size: 34px;
  padding: 0.2rem 0.65rem;
}

.density-btn.is-active {
  background: var(--bg-dark);
  color: #ffffff;
}

/* 时间分组画廊容器 */
.wardrobe-timeline {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.wardrobe-date-group {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

/* 仅对首屏以下的分组应用 content-visibility: auto 并配 contain-intrinsic-size */
.wardrobe-date-group.is-deferred {
  content-visibility: auto;
  contain-intrinsic-size: auto none auto 320px;
}

.wardrobe-group-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  padding-inline: 0.125rem;
}

.wardrobe-group-title {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--text-primary);
}

.wardrobe-group-count {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
}

.wardrobe-group-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.35rem;
}

.wardrobe-timeline[data-cols="2"] .wardrobe-group-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

.wardrobe-timeline[data-cols="3"] .wardrobe-group-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.32rem;
}

.wardrobe-timeline[data-cols="4"] .wardrobe-group-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.22rem;
}

.asset-card {
  position: relative;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  overflow: clip;
  display: flex;
  flex-direction: column;
}

.wardrobe-timeline[data-cols="2"] .asset-card {
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.wardrobe-timeline[data-cols="4"] .asset-card {
  border-radius: 8px;
}

.asset-card.is-deferred {
  content-visibility: auto;
  contain-intrinsic-size: auto none auto 160px;
}

.asset-card.is-selected {
  outline: 2.5px solid var(--accent-rose, #e11d48);
  outline-offset: -2px;
}

.asset-media-wrap {
  position: relative;
  display: block;
  background: var(--bg-muted);
}

.asset-zoom-trigger {
  appearance: none;
  border: 0;
  padding: 0;
  display: block;
  inline-size: 100%;
  background: transparent;
  cursor: pointer;
}

.asset-thumb {
  display: block;
  inline-size: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
}

.asset-cat-pill {
  position: absolute;
  inset-block-start: 0.35rem;
  inset-inline-start: 0.35rem;
  background: rgba(20, 20, 19, 0.66);
  backdrop-filter: blur(4px);
  color: #ffffff;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 0.1rem 0.38rem;
  border-radius: 999px;
  pointer-events: none;
}

.wardrobe-timeline[data-cols="4"] .asset-cat-pill {
  display: none;
}

.asset-select-check {
  position: absolute;
  inset-block-start: 0.35rem;
  inset-inline-end: 0.35rem;
  inline-size: 22px;
  block-size: 22px;
  border-radius: 999px;
  border: 2px solid #ffffff;
  background: rgba(20, 20, 19, 0.45);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 800;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.asset-card.is-selected .asset-select-check {
  background: var(--accent-rose, #e11d48);
  border-color: #ffffff;
}

.asset-body {
  padding: 0.45rem 0.5rem 0.55rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

/* 3列与4列相册模式下隐藏卡片底部冗长按钮，点图进入全屏查看器操作，一屏可看 9-16 张图 */
.wardrobe-timeline[data-cols="3"] .asset-body,
.wardrobe-timeline[data-cols="4"] .asset-body {
  display: none;
}

.asset-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.asset-compact-actions {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 0.25rem;
}

.asset-use-btn {
  inline-size: 100%;
  min-block-size: 30px;
  padding-inline: 0.35rem;
  font-size: 0.72rem;
}

.asset-dl-btn {
  min-block-size: 30px;
  padding: 0 0.45rem;
  font-size: 0.72rem;
}

.wardrobe-load-more {
  display: flex;
  justify-content: center;
  padding-block: 0.75rem 0.25rem;
}

.wardrobe-batch-bar {
  position: fixed;
  inset-inline: 0.75rem;
  inset-block-end: calc(4.6rem + env(safe-area-inset-bottom, 0px));
  max-inline-size: 460px;
  margin-inline: auto;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-lg);
  background: rgba(20, 20, 19, 0.94);
  backdrop-filter: blur(10px);
  color: #ffffff;
  box-shadow: 0 12px 28px rgba(20, 20, 19, 0.28);
}

.batch-info {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.8rem;
  font-weight: 700;
}

.wardrobe-batch-bar .pill-link {
  color: #fda4af;
}

.batch-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.mini-danger-btn {
  appearance: none;
  border: 0;
  border-radius: 999px;
  background: #e11d48;
  color: #ffffff;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 700;
  min-block-size: 34px;
  padding: 0.25rem 0.8rem;
  cursor: pointer;
}

.mini-danger-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.back-top-pill {
  position: fixed;
  inset-inline-end: max(1rem, calc((100vw - 480px) / 2 + 0.75rem));
  inset-block-end: calc(5.2rem + env(safe-area-inset-bottom, 0px));
  z-index: 24;
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(20, 20, 19, 0.84);
  backdrop-filter: blur(8px);
  color: #ffffff;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  min-block-size: 36px;
  padding: 0.3rem 0.8rem;
  box-shadow: 0 6px 18px rgba(20, 20, 19, 0.22);
  cursor: pointer;
}

.empty-wardrobe {
  padding: 2.5rem 1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

/* ==================== 个人主页与头像资料设置 ==================== */
.profile-row {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.profile-avatar-btn {
  appearance: none;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
  border-radius: 50%;
}

.profile-avatar {
  inline-size: 56px;
  block-size: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #141413 0%, #52504c 100%);
  color: #ffffff;
  display: grid;
  place-items: center;
  font-size: 1.25rem;
  font-weight: 700;
  flex-shrink: 0;
  overflow: clip;
  border: 2px solid var(--border-light);
}

.profile-avatar.is-large {
  inline-size: 68px;
  block-size: 68px;
  font-size: 1.5rem;
}

.profile-avatar-img {
  display: block;
  inline-size: 100%;
  block-size: 100%;
  object-fit: cover;
}

.avatar-editor-box {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem 0.85rem;
  border-radius: var(--radius-md);
  background: var(--bg-shell);
  border: 1px solid var(--border-light);
}

.avatar-editor-actions {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-inline-size: 0;
}

.sheet-divider {
  border: 0;
  border-block-start: 1px solid var(--border-light);
  margin: 0.25rem 0;
}

.profile-meta {
  flex: 1;
  min-inline-size: 0;
}

.profile-meta h2 {
  margin: 0;
  font-size: 1.05rem;
}

.profile-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
}

.stat-tile {
  padding: 0.65rem 0.4rem;
  border-radius: var(--radius-md);
  background: var(--bg-shell);
  border: 1px solid var(--border-light);
  text-align: center;
}

.stat-num {
  display: block;
  font-size: 1.1rem;
  font-weight: 800;
}

.stat-label {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* ==================== 底部 Sheet 弹层与顶层动画 ==================== */
dialog.sheet-dialog {
  inline-size: min(100%, 460px);
  max-block-size: 88dvb;
  margin: auto auto 0;
  border: 0;
  border-radius: 26px 26px 0 0;
  padding: 0;
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: 0 -16px 50px rgba(20, 20, 19, 0.22);
  opacity: 0;
  transition-property: opacity, transform, display, overlay;
  transition-duration: 0.26s;
  transition-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
  transition-behavior: allow-discrete;
}

@media (prefers-reduced-motion: no-preference) {
  dialog.sheet-dialog {
    transform: translateY(28px);
  }
}

dialog.sheet-dialog[open]:where(:not([data-closing])) {
  opacity: 1;
  @starting-style {
    opacity: 0;
  }
  @media (prefers-reduced-motion: no-preference) {
    transform: translateY(0);
    @starting-style {
      transform: translateY(28px);
    }
  }
}

dialog:modal {
  overscroll-behavior: contain;
}

dialog::backdrop {
  background-color: rgba(20, 20, 19, 0);
  backdrop-filter: blur(4px);
  overflow: hidden;
  overscroll-behavior: contain;
  transition-property: background-color, display, overlay;
  transition-duration: 0.24s;
  transition-timing-function: ease-out;
  transition-behavior: allow-discrete;
}

dialog[open]:where(:not([data-closing]))::backdrop {
  background-color: rgba(20, 20, 19, 0.52);
  @starting-style {
    background-color: rgba(20, 20, 19, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  dialog.sheet-dialog,
  dialog::backdrop {
    transition-duration: 0.1s;
  }
}

.sheet-handle {
  inline-size: 40px;
  block-size: 4px;
  border-radius: 999px;
  background: #d6d3cd;
  margin: 0.6rem auto 0;
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-block-end: 1px solid var(--border-light);
}

.dialog-header h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.icon-close-btn {
  appearance: none;
  border: 0;
  background: var(--bg-muted);
  color: var(--text-primary);
  inline-size: 34px;
  block-size: 34px;
  border-radius: 50%;
  font-size: 0.95rem;
  cursor: pointer;
}

.dialog-body {
  padding: 1rem 1rem calc(1.25rem + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  overflow-y: auto;
  max-block-size: 74dvb;
}

.demo-note {
  margin: 0;
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius-md);
  background: var(--bg-muted);
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.auth-form,
.provider-group {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.dialog-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.625rem;
}

.dialog-footer {
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  gap: 0.625rem;
}

.picker-search-wrap {
  margin-block-end: 0.6rem;
}

.picker-search-wrap .wardrobe-search-input {
  inline-size: 100%;
}

.picker-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
}

.picker-item {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0;
  background: var(--bg-shell);
  overflow: clip;
  cursor: pointer;
  text-align: start;
  font: inherit;
}

.picker-item.is-deferred {
  content-visibility: auto;
  contain-intrinsic-size: auto none auto 150px;
}

.picker-item img {
  display: block;
  inline-size: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
}

.picker-item-caption {
  display: block;
  padding: 0.35rem 0.4rem;
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.empty-picker {
  margin: 1rem 0;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* ==================== 全屏高清 Lightbox ==================== */
dialog.lightbox-dialog {
  inline-size: min(96vw, 460px);
  max-block-size: 94dvb;
  border: 0;
  border-radius: var(--radius-xl);
  padding: 0;
  background: #141413;
  color: #ffffff;
  overflow: clip;
}

.lightbox-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.75rem 0.95rem;
}

.lightbox-title-wrap {
  min-inline-size: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.lightbox-title {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lightbox-counter {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.65);
}

.lightbox-close-btn {
  appearance: none;
  border: 0;
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  inline-size: 36px;
  block-size: 36px;
  border-radius: 50%;
  font-size: 1rem;
  cursor: pointer;
  flex: none;
}

.lightbox-stage {
  position: relative;
  display: grid;
  place-items: center;
  background: #000000;
  max-block-size: 66dvb;
  min-block-size: 240px;
  overflow: auto;
}

.lightbox-stage img {
  display: block;
  max-inline-size: 100%;
  max-block-size: 66dvb;
  object-fit: contain;
  /* 确保 iOS Safari 与微信/小红书内置浏览器可原生「长按保存到相册」 */
  -webkit-touch-callout: default;
  pointer-events: auto;
}

.lightbox-nav-btn {
  position: absolute;
  inset-block-start: 50%;
  transform: translateY(-50%);
  z-index: 2;
  appearance: none;
  border: 0;
  inline-size: 36px;
  block-size: 48px;
  border-radius: 999px;
  background: rgba(20, 20, 19, 0.56);
  color: #ffffff;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.lightbox-nav-btn.is-prev {
  inset-inline-start: 0.5rem;
}

.lightbox-nav-btn.is-next {
  inset-inline-end: 0.5rem;
}

.lightbox-footer {
  padding: 0.75rem 0.95rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.lightbox-save-hint {
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.4;
  text-align: center;
  color: rgba(255, 255, 255, 0.72);
  padding: 0.35rem 0.6rem;
  border-radius: 10px;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.lightbox-save-hint.is-highlight {
  background: rgba(251, 113, 133, 0.22);
  color: #ffe4e6;
  font-weight: 700;
}

.lightbox-action-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.lightbox-footer .cta-btn {
  flex: 1;
  min-block-size: 42px;
  background: #ffffff;
  color: #141413;
  font-size: 0.85rem;
}

.lightbox-secondary-btn,
.lightbox-danger-btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  min-block-size: 42px;
  padding: 0 0.85rem;
  cursor: pointer;
  white-space: nowrap;
}

.lightbox-danger-btn {
  border-color: rgba(251, 113, 133, 0.45);
  color: #fda4af;
}

.visually-hidden {
  position: absolute;
  clip-path: inset(50%);
  overflow: hidden;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  white-space: nowrap;
}

@supports not (accent-color: var(--brand-color)) {
  input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
  }

  input[type="range"]::-webkit-slider-runnable-track {
    width: 100%;
    height: 8px;
    background: linear-gradient(
      to right,
      var(--brand-color) var(--progress, 22%),
      #d6cfc6 var(--progress, 22%)
    );
    border-radius: 4px;
  }

  input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    height: 18px;
    width: 18px;
    border-radius: 50%;
    background: var(--brand-color);
    margin-top: -5px;
    cursor: pointer;
  }
}

/* ==================== 算力钱包与充值弹层 ==================== */
.bottom-dock.has-admin {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.wallet-balance-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

.wallet-stat-box {
  padding: 0.65rem 0.6rem;
  border-radius: var(--radius-md);
  background: var(--bg-shell);
  border: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.wallet-stat-box.is-highlight {
  background: var(--accent-rose-soft);
  border-color: #f5d0d8;
}

.wallet-stat-num {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-primary);
}

.wallet-stat-box.is-highlight .wallet-stat-num {
  color: var(--accent-rose);
}

.wallet-stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.ledger-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  max-block-size: 220px;
  overflow-y: auto;
}

.ledger-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 0.6rem;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  font-size: 0.75rem;
}

.ledger-row-main {
  display: flex;
  flex-direction: column;
  min-inline-size: 0;
}

.ledger-row-note {
  font-weight: 600;
  color: var(--text-primary);
}

.ledger-row-time {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.ledger-delta {
  font-weight: 800;
  white-space: nowrap;
}

.ledger-delta.is-plus {
  color: var(--success);
}

.ledger-delta.is-minus {
  color: var(--danger);
}

.recharge-balance-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius-md);
  background: #141413;
  color: #ffffff;
}

.recharge-bar-label {
  display: block;
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.7);
}

.recharge-bar-value {
  font-size: 1.1rem;
  font-weight: 800;
}

.recharge-bar-sub {
  font-size: 0.72rem;
  background: rgba(255, 255, 255, 0.14);
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
}

.conversion-rule-box {
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-md);
  background: var(--bg-muted);
  border: 1px solid var(--border-light);
}

.conversion-rule-title {
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-primary);
}

.conversion-rule-list {
  margin: 0;
  padding-inline-start: 1.05rem;
  font-size: 0.73rem;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.package-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}

.package-card {
  position: relative;
  appearance: none;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-md);
  background: var(--bg-shell);
  padding: 0.75rem 0.65rem;
  text-align: start;
  font: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.package-card.is-selected {
  border-color: var(--accent-rose);
  background: var(--accent-rose-soft);
}

.package-badge {
  align-self: flex-start;
  font-size: 0.64rem;
  font-weight: 700;
  color: var(--accent-rose);
  background: #ffffff;
  border: 1px solid #f5d0d8;
  padding: 0.08rem 0.42rem;
  border-radius: 999px;
}

.package-points {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-primary);
}

.package-price {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent-rose);
}

.package-desc {
  font-size: 0.68rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.custom-recharge-box {
  padding: 0.7rem 0.75rem;
  border-radius: var(--radius-md);
  background: var(--bg-shell);
  border: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.custom-recharge-box label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-primary);
}

.custom-recharge-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.45rem;
}

.custom-conversion-preview {
  margin: 0;
  font-size: 0.74rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* ==================== 后台管理与响应式数据表格 ==================== */
.admin-kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

.kpi-tile {
  padding: 0.65rem 0.6rem;
  border-radius: var(--radius-md);
  background: var(--bg-shell);
  border: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.kpi-value {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-primary);
}

.kpi-label {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.kpi-sub {
  font-size: 0.66rem;
  color: var(--accent-rose);
  font-weight: 600;
}

.formula-breakdown-box {
  padding: 0.75rem 0.85rem;
  border-radius: var(--radius-md);
  background: #141413;
  color: #f8f7f4;
  font-size: 0.78rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.formula-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  border-block-end: 1px dashed rgba(255, 255, 255, 0.16);
  padding-block-end: 0.3rem;
}

.formula-row:last-child {
  border-block-end: 0;
  padding-block-end: 0;
}

.formula-key {
  color: rgba(255, 255, 255, 0.72);
}

.formula-val {
  font-weight: 700;
  text-align: end;
}

.formula-val.is-accent {
  color: #fda4af;
}

.table-wrapper {
  container-type: inline-size;
  overflow: auto;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: var(--bg-shell);
}

.admin-table {
  border-collapse: collapse;
  inline-size: 100%;
  font-size: 0.75rem;
  --label-1: "项目";
  --label-2: "指标 1";
  --label-3: "指标 2";
  --label-4: "指标 3";
  --label-5: "指标 4";
  --label-6: "指标 5";
}

.admin-table caption {
  padding: 0.55rem 0.75rem;
  text-align: start;
  font-weight: 700;
  font-size: 0.75rem;
  color: var(--text-secondary);
  background: var(--bg-muted);
  border-block-end: 1px solid var(--border-light);
}

.admin-table th,
.admin-table td {
  padding: 0.55rem 0.65rem;
  text-align: start;
  border-block-end: 1px solid var(--border-light);
  vertical-align: middle;
}

.admin-table thead th {
  background: var(--bg-muted);
  font-weight: 700;
  color: var(--text-secondary);
  white-space: nowrap;
}

.admin-table tbody th {
  position: sticky;
  inset-inline-start: 0;
  background: var(--bg-card);
  font-weight: 700;
  z-index: 1;
}

@container (width < 400px) {
  .admin-table thead {
    display: none;
  }

  .admin-table tr {
    display: flex;
    flex-direction: column;
    padding: 0.55rem 0.75rem;
    border-block-end: 1px solid var(--border-light);
    background: var(--bg-card);
  }

  .admin-table th,
  .admin-table td {
    padding: 0.2rem 0;
    border: 0;
  }

  .admin-table tbody th {
    position: static;
    font-size: 0.82rem;
    color: var(--text-primary);
  }

  .admin-table td:nth-child(2)::before { content: var(--label-2) "："; font-weight: 600; color: var(--text-muted); }
  .admin-table td:nth-child(3)::before { content: var(--label-3) "："; font-weight: 600; color: var(--text-muted); }
  .admin-table td:nth-child(4)::before { content: var(--label-4) "："; font-weight: 600; color: var(--text-muted); }
  .admin-table td:nth-child(5)::before { content: var(--label-5) "："; font-weight: 600; color: var(--text-muted); }
  .admin-table td:nth-child(6)::before { content: var(--label-6) "："; font-weight: 600; color: var(--text-muted); }
}

.inline-point-editor {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.inline-point-input {
  inline-size: 62px;
  min-block-size: 30px;
  padding: 0.2rem 0.4rem;
  border: 1px solid var(--border-input);
  border-radius: 8px;
  font: inherit;
  font-size: 0.75rem;
}

.mini-action-btn {
  appearance: none;
  border: 1px solid var(--border-light);
  background: var(--bg-card);
  color: var(--text-primary);
  border-radius: 8px;
  min-block-size: 28px;
  padding-inline: 0.45rem;
  font: inherit;
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
}

.mini-action-btn.is-primary {
  background: var(--text-primary);
  color: #ffffff;
  border-color: var(--text-primary);
}

/* Modal scroll-chaining guard & 4003 / tier-disabled styling */
dialog:modal {
  overscroll-behavior: contain;
}

dialog::backdrop {
  overflow: hidden;
  overscroll-behavior: contain;
}

.package-card.is-disabled {
  opacity: 0.48;
  cursor: not-allowed;
  pointer-events: none;
}

.quota-full-actions {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

[hidden] {
  display: none !important;
}
