:root {
  color-scheme: light;
  --paper: #f4ece0;
  --paper-2: #fbf5ea;
  --paper-3: #fffbf2;
  --ink: #1c1813;
  --ink-soft: #3a322a;
  --muted: #8b8174;
  --muted-2: #b6ac9d;
  --line: #e2d8c6;
  --line-soft: #efe7d6;
  --teal: #1f5f56;
  --teal-2: #d6e8e2;
  --teal-3: #2d7a6e;
  --red: #a23a2c;
  --red-soft: #f5e2dc;
  --gold: #b8893f;
  --gold-soft: #f5e6c4;
  --shadow-sm: 0 4px 14px rgba(40, 29, 18, 0.06);
  --shadow-md: 0 10px 30px rgba(40, 29, 18, 0.1);
  --shadow-lg: 0 24px 60px rgba(40, 29, 18, 0.18);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", -apple-system,
    BlinkMacSystemFont, "Segoe UI", Inter, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 14%, rgba(184, 137, 63, 0.1), transparent 32%),
    radial-gradient(circle at 82% 88%, rgba(31, 95, 86, 0.08), transparent 35%),
    linear-gradient(135deg, #ede1cb 0%, #f8f3e7 50%, #e7efe8 100%);
  color: var(--ink);
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  border: 0;
  cursor: pointer;
  background: transparent;
}

h1, h2, h3, h4, p {
  margin: 0;
}

h1 { font-size: 38px; font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
h3 { font-size: 17px; font-weight: 700; }
h4 { font-size: 14px; font-weight: 600; color: var(--muted); }

.eyebrow {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.02em;
}

/* ───────── Phone shell ───────── */
.app-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 24px;
}

.phone {
  position: relative;
  width: min(420px, 100vw);
  height: min(900px, calc(100vh - 64px));
  min-height: 760px;
  overflow: hidden;
  border: 8px solid #15110d;
  border-radius: 44px;
  background: var(--paper);
  box-shadow: var(--shadow-lg);
}

/* 假刘海装饰已删除 — 真机有自己的刘海/挖孔，假刘海碍事 */

.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  padding: 12px 22px 22px;
  background: var(--paper);
  background-image:
    radial-gradient(circle at 15% 8%, rgba(184, 137, 63, 0.08), transparent 30%),
    radial-gradient(circle at 92% 92%, rgba(31, 95, 86, 0.06), transparent 30%),
    linear-gradient(rgba(255, 251, 242, 0.4), rgba(244, 236, 224, 0.1));
  overflow: hidden;
}

.screen.active {
  display: flex;
}

/* ───────── Status bar ───────── */
.statusbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 32px;
  padding: 0 4px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  z-index: 10;
}

.statusbar .status-icons {
  display: flex;
  gap: 5px;
  align-items: center;
}

.statusbar svg {
  display: block;
}

/* ───────── Splash ───────── */
.splash {
  align-items: center;
  justify-content: flex-end;
  padding-bottom: 80px;
  text-align: center;
  background:
    linear-gradient(180deg, transparent 0%, var(--paper) 88%),
    url("./assets/styles/shuimo.jpg") center/cover no-repeat,
    var(--paper);
}

.splash-mark {
  position: relative;
  width: 96px;
  height: 96px;
  margin-bottom: 18px;
}

.splash-mark .ring {
  position: absolute;
  inset: 0;
  border: 4px solid var(--ink);
  border-radius: 50% 47% 51% 45% / 47% 50% 47% 53%;
  transform: rotate(-12deg);
}

.splash-mark .star {
  position: absolute;
  top: -8px;
  right: -10px;
  width: 28px;
  height: 28px;
  color: var(--red);
}

.splash h1 {
  font-size: 44px;
  letter-spacing: 0.04em;
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.splash h1 .seal {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin-left: 6px;
  font-size: 13px;
  font-weight: 700;
  color: white;
  background: var(--red);
  border-radius: 4px;
  vertical-align: middle;
}

/* 国际化：印章为空（非中文 locale）时自动隐藏 */
.splash h1 .seal:empty {
  display: none;
}

.splash p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 15px;
  letter-spacing: 0.08em;
}

.splash .primary {
  margin-top: 30px;
}

/* ───────── Buttons ───────── */
.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 0 26px;
  border-radius: 16px;
  background: var(--teal);
  color: white;
  font-weight: 700;
  font-size: 15px;
  box-shadow: 0 6px 18px rgba(31, 95, 86, 0.28);
  transition: transform 0.15s ease;
}

.primary:active {
  transform: scale(0.98);
}

.primary.wide {
  width: 100%;
  max-width: 320px;
}

.primary.docked {
  margin-top: auto;
  width: 100%;
}

.text-button {
  min-width: 46px;
  color: var(--teal);
  font-weight: 700;
  font-size: 14px;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(255, 251, 242, 0.7);
  border: 1px solid var(--line-soft);
  color: var(--ink);
  font-size: 20px;
  backdrop-filter: blur(8px);
}

/* ───────── Top bar ───────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 52px;
  margin-bottom: 8px;
}

.topbar.compact {
  justify-content: space-between;
}

.topbar.compact h2 {
  flex: 1;
  text-align: center;
}

.topbar h2 {
  display: flex;
  align-items: center;
  gap: 6px;
}

.topbar h2 .crown {
  color: var(--gold);
  font-size: 16px;
}

/* ───────── Home ───────── */
/* 双入口（草图 + 传图）*/
.dual-entries {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 18px;
}

.entry-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-start;
  text-align: left;
  min-height: 168px;
  padding: 18px 16px 16px;
  border-radius: 20px;
  overflow: hidden;
  color: white;
  box-shadow: var(--shadow-md);
  cursor: pointer;
}

.entry-card.primary-entry {
  background:
    linear-gradient(180deg, rgba(28, 24, 19, 0) 25%, rgba(28, 24, 19, 0.85) 100%),
    url("./assets/styles/shuimo.jpg") center 25%/cover no-repeat;
}

.entry-card.secondary-entry {
  background:
    linear-gradient(180deg, rgba(28, 24, 19, 0) 25%, rgba(28, 24, 19, 0.85) 100%),
    url("./assets/styles/youhua.jpg") center 30%/cover no-repeat;
}

.entry-card .entry-icon {
  position: absolute;
  top: 14px;
  left: 16px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  background: rgba(255, 251, 242, 0.92);
  color: var(--ink);
  border-radius: 12px;
  font-size: 18px;
}

.entry-card strong {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 2px;
}

.entry-card small {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.78);
  line-height: 1.35;
}

/* 兼容老 .create-card 类名（已弃用，保留防误用）*/
.create-card {
  display: none;
}

.create-card .badge {
  position: absolute;
  top: 16px;
  left: 16px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 251, 242, 0.95);
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
}

.create-card .badge .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--red);
}

.create-card strong {
  font-size: 22px;
  font-weight: 700;
}

.create-card small {
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 13px;
}

.create-card .cta-pill {
  position: absolute;
  bottom: 18px;
  right: 18px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  background: white;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 18px 0 12px;
}

.section-head h3 {
  font-size: 16px;
}

.section-head button {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

/* style chips on home — 5 chips fit container without horizontal scroll */
.style-row {
  display: flex;
  gap: 8px;
  padding-bottom: 4px;
  justify-content: space-between;
}

.style-row button {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 0;
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
}

.style-row .chip-img {
  width: 100%;
  aspect-ratio: 1;
  max-width: 64px;
  border-radius: 16px;
  background: var(--paper-3) center/cover no-repeat;
  border: 2px solid transparent;
  transition: border-color 0.15s ease;
}

.style-row .selected .chip-img {
  border-color: var(--teal);
  box-shadow: 0 4px 12px rgba(31, 95, 86, 0.22);
}

/* gallery */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  overflow-y: auto;
  padding-bottom: 96px;
  scrollbar-width: none;
}

.gallery-grid::-webkit-scrollbar { display: none; }

.gallery-grid.small {
  max-height: 200px;
  padding-bottom: 0;
}

.art-thumb {
  position: relative;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border-radius: 16px;
  background: var(--paper-3);
  box-shadow: var(--shadow-sm);
}

.art-thumb img,
.art-thumb canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.art-thumb .label {
  position: absolute;
  left: 10px;
  bottom: 10px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255, 251, 242, 0.92);
  font-size: 11px;
  font-weight: 600;
  color: var(--ink);
  backdrop-filter: blur(8px);
}

.art-thumb {
  cursor: pointer;
  transition: transform 0.15s ease;
}

.art-thumb:active {
  transform: scale(0.97);
}

.art-thumb .delete {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(28, 24, 19, 0.6);
  color: white;
  display: grid;
  place-items: center;
  border: 0;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 2;
  backdrop-filter: blur(4px);
}

.art-thumb:hover .delete {
  opacity: 1;
}

/* 触屏设备没有 hover，永远显示删除按钮 */
@media (hover: none) {
  .art-thumb .delete {
    opacity: 1;
  }
}

/* tab bar */
.tabbar {
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: 18px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 8px;
  border-radius: 22px;
  background: rgba(255, 251, 242, 0.95);
  border: 1px solid var(--line-soft);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(20px);
  z-index: 30;
}

.tabbar button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 48px;
  padding: 4px;
  border-radius: 14px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  transition: all 0.15s ease;
}

.tabbar button svg {
  width: 22px;
  height: 22px;
  display: block;
}

.tabbar .active {
  background: var(--teal-2);
  color: var(--teal);
}

/* ───────── Canvas screen ───────── */
.canvas-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.canvas-topbar .group {
  display: flex;
  gap: 8px;
}

.canvas-topbar .icon-button {
  width: 38px;
  height: 38px;
  font-size: 18px;
}

.canvas-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  margin-bottom: 14px;
  overflow: hidden;
  border-radius: 24px;
  background: #fffdf6;
  border: 1px solid var(--line-soft);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.6), var(--shadow-sm);
  touch-action: none;
}

#drawCanvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.canvas-hint {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  color: var(--muted-2);
  font-size: 14px;
  pointer-events: none;
}

.tool-rail {
  position: absolute;
  left: 14px;
  top: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 10;
}

.tool {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(255, 251, 242, 0.95);
  border: 1px solid var(--line-soft);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow-sm);
}

.tool svg {
  width: 16px;
  height: 16px;
}

.tool.active {
  background: var(--teal);
  color: white;
  border-color: var(--teal);
}

.control-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
  border-radius: 20px;
  background: rgba(255, 251, 242, 0.95);
  border: 1px solid var(--line-soft);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(8px);
}

.slider-row {
  display: grid;
  grid-template-columns: 46px 1fr 32px;
  gap: 12px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.slider-row .value {
  text-align: right;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

input[type="range"] {
  accent-color: var(--teal);
}

.swatches {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.swatches button {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--swatch);
  border: 2px solid white;
  outline: 1px solid var(--line);
  transition: transform 0.15s ease;
}

.swatches .active {
  outline: 2px solid var(--teal);
  outline-offset: 1px;
  transform: scale(1.08);
}

.swatches .add {
  background: var(--paper-3);
  outline: 1px dashed var(--muted-2);
  color: var(--muted);
  font-size: 16px;
  display: grid;
  place-items: center;
}

/* ───────── Style picker screen ───────── */
.preview-strip {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 16px;
  padding: 12px;
  border-radius: 18px;
  background: var(--paper-3);
  border: 1px solid var(--line-soft);
}

.preview-strip canvas {
  width: 88px;
  height: 110px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: white;
  flex: 0 0 88px;
}

.preview-strip .arrow {
  font-size: 20px;
  color: var(--muted);
}

.preview-strip .target {
  flex: 1;
  display: grid;
  place-items: center;
  height: 110px;
  border-radius: 12px;
  border: 2px dashed var(--muted-2);
  background: var(--paper);
  color: var(--muted);
  font-size: 32px;
}

.segments {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  padding: 4px;
  border-radius: 14px;
  background: var(--paper-3);
  border: 1px solid var(--line-soft);
}

.segments button {
  flex: 1;
  min-height: 36px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.segments .active {
  background: white;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.style-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  overflow-y: auto;
  padding-bottom: 14px;
  scrollbar-width: none;
}

.style-cards::-webkit-scrollbar { display: none; }

.style-card {
  position: relative;
  display: flex;
  flex-direction: column;
  border-radius: 18px;
  overflow: hidden;
  background: var(--paper-3);
  border: 2px solid transparent;
  transition: all 0.15s ease;
  text-align: left;
  color: var(--ink);
}

.style-card.selected {
  border-color: var(--teal);
  box-shadow: 0 8px 22px rgba(31, 95, 86, 0.22);
}

.style-card .cover {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--paper-3) center/cover no-repeat;
}

.style-card .name {
  padding: 10px 12px 12px;
  font-size: 13px;
  font-weight: 700;
}

.style-card .check {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--teal);
  color: white;
  display: none;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.style-card.selected .check {
  display: grid;
}

/* ───────── Generating screen ───────── */
.generating-screen {
  align-items: center;
  justify-content: center;
}

.generation-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
  width: 100%;
}

.generation-box h2 {
  margin-top: 4px;
}

.generation-box .hint {
  color: var(--muted);
  font-size: 13px;
}

.compare-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  width: 100%;
  align-items: center;
  margin: 12px 0;
}

.compare-row .compare-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  border-radius: 16px;
  background: var(--paper-3);
  border: 1px solid var(--line-soft);
}

.compare-row .compare-card .label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}

.compare-row canvas {
  width: 100%;
  aspect-ratio: 4 / 5;
  border-radius: 10px;
  background: white;
  display: block;
}

.compare-row .progress-circle {
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: conic-gradient(var(--teal) 0deg, var(--line-soft) 0deg);
  color: var(--ink);
  font-weight: 800;
  font-size: 13px;
}

.compare-row .progress-circle span {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--paper);
  font-size: 12px;
}

.steps {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-top: 8px;
}

.steps .step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}

.steps .step .dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--paper-3);
  border: 2px solid var(--line);
  display: grid;
  place-items: center;
  font-size: 12px;
  color: var(--muted-2);
  font-weight: 700;
}

.steps .step.done .dot {
  background: var(--teal);
  border-color: var(--teal);
  color: white;
}

.steps .step.active .dot {
  background: white;
  border-color: var(--teal);
  color: var(--teal);
  box-shadow: 0 0 0 4px rgba(31, 95, 86, 0.15);
}

.steps .step.done,
.steps .step.active {
  color: var(--ink);
}

.tip {
  margin-top: 14px;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--paper-3);
  border: 1px solid var(--line-soft);
  font-size: 12px;
  color: var(--muted);
}

/* ───────── Result screen ───────── */
.result-card {
  position: relative;
  margin-top: 14px;
  border-radius: 22px;
  overflow: hidden;
  background: var(--paper-3);
  border: 1px solid var(--line-soft);
  box-shadow: var(--shadow-md);
}

#resultCanvas {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  height: auto;
}

/* ── 通用底部选择器（语言 / 生成质量 / 默认画幅）── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(28, 24, 19, 0.55);
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: backdropIn 0.2s ease;
}

/* 必须显式声明 — hidden 属性被上面的 display:flex 覆盖时不生效 */
.modal-backdrop[hidden] {
  display: none;
}

@keyframes backdropIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.action-sheet {
  width: 100%;
  max-width: 420px;
  max-height: 70vh;
  background: var(--paper);
  border-radius: 24px 24px 0 0;
  padding: 10px 22px max(env(safe-area-inset-bottom), 18px);
  animation: sheetUp 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
  display: flex;
  flex-direction: column;
  box-shadow: 0 -8px 24px rgba(28, 24, 19, 0.12);
}

@keyframes sheetUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.sheet-handle {
  width: 40px;
  height: 4px;
  background: var(--muted-2);
  border-radius: 2px;
  margin: 6px auto 14px;
  flex-shrink: 0;
}

.action-sheet h3 {
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  text-align: center;
  margin-bottom: 14px;
  flex-shrink: 0;
}

.picker-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  padding-bottom: 10px;
  flex: 1;
  min-height: 0;
  scrollbar-width: none;
}

.picker-list::-webkit-scrollbar { display: none; }

.picker-list button {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 50px;
  padding: 0 16px;
  border-radius: 12px;
  background: transparent;
  text-align: left;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  width: 100%;
  cursor: pointer;
  transition: background 0.15s ease;
}

.picker-list button:active {
  background: var(--paper-3);
}

.picker-list button.active {
  background: var(--teal-2);
  color: var(--teal);
}

.picker-list button.active::after {
  content: "✓";
  font-size: 17px;
  font-weight: 700;
}

.picker-list button .desc {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  margin-top: 2px;
}

.picker-list button.active .desc {
  color: var(--teal);
  opacity: 0.8;
}

.sheet-cancel {
  margin-top: 12px;
  min-height: 50px;
  border-radius: 14px;
  background: var(--paper-3);
  color: var(--ink);
  font-weight: 700;
  font-size: 15px;
  border: 1px solid var(--line-soft);
  flex-shrink: 0;
}

/* ── 登录按钮 ── */
.login-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 50px;
  padding: 0 18px;
  border-radius: 14px;
  background: var(--paper-3);
  border: 1px solid var(--line-soft);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
}
.login-btn:hover { background: var(--paper-2); }
.login-btn:active { transform: scale(0.99); }
.login-btn svg { flex-shrink: 0; }
.login-btn.login-google { /* 用浅底色 */ }
.login-btn.login-facebook { background: #1877F2; color: white; border-color: #1877F2; }
.login-btn.login-facebook:hover { background: #1565d4; }
.login-btn.login-email { background: var(--ink); color: white; border-color: var(--ink); }
.login-btn.login-email:hover { background: var(--ink-soft); }

/* ── 对比滑块（草图 ↔ 成品）── */
.compare-stage {
  position: relative;
  width: 100%;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.compare-stage canvas {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  height: auto;
}

.sketch-overlay {
  position: absolute;
  inset: 0;
  background: #fffdf7;
  /* 关键：从右往左裁切，露出 var(--compare-pos) 宽度的草图 */
  clip-path: inset(0 calc(100% - var(--compare-pos)) 0 0);
  pointer-events: none;
}

.compare-handle {
  position: absolute;
  top: 0;
  left: var(--compare-pos);
  bottom: 0;
  width: 3px;
  background: rgba(255, 255, 255, 0.95);
  transform: translateX(-50%);
  pointer-events: none;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.18), 0 4px 12px rgba(0, 0, 0, 0.25);
  z-index: 3;
}

.compare-handle .grip {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 38px;
  height: 38px;
  background: white;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 16px;
  color: var(--ink);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
  font-weight: 700;
}

.compare-hint {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 12px;
  background: rgba(20, 16, 12, 0.65);
  color: white;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  pointer-events: none;
  z-index: 4;
  transition: opacity 0.4s ease;
  backdrop-filter: blur(6px);
  white-space: nowrap;
}

.compare-stage.touched .compare-hint {
  opacity: 0;
}

.result-card .seal {
  position: absolute;
  top: 18px;
  right: 18px;
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  background: var(--red);
  color: white;
  font-weight: 700;
  font-size: 14px;
  line-height: 1.05;
  text-align: center;
  border-radius: 4px;
  letter-spacing: 0.05em;
  box-shadow: 0 4px 12px rgba(162, 58, 44, 0.3);
  font-family: "Songti SC", "STSong", "PingFang SC", serif;
  transform: rotate(2deg);
}

.meta-row {
  display: flex;
  gap: 8px;
  padding: 12px 14px 14px;
  background: var(--paper-3);
}

.meta-row span {
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--paper);
  border: 1px solid var(--line-soft);
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}

.meta-row span:first-child {
  background: var(--teal-2);
  color: var(--teal);
  border-color: var(--teal-2);
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 12px;
  margin-bottom: 80px;
}

.action-grid button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-height: 56px;
  padding: 8px 4px;
  border-radius: 14px;
  background: var(--paper-3);
  border: 1px solid var(--line-soft);
  color: var(--ink);
  font-size: 11px;
  font-weight: 600;
}

.action-grid button svg {
  width: 18px;
  height: 18px;
}

/* ───────── Library ───────── */
.search-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 8px;
  margin-bottom: 12px;
}

.search-row .search {
  position: relative;
  display: flex;
  align-items: center;
}

.search-row input {
  width: 100%;
  min-height: 42px;
  border-radius: 14px;
  border: 1px solid var(--line-soft);
  background: var(--paper-3);
  padding: 0 14px 0 38px;
  color: var(--ink);
  font-size: 14px;
}

.search-row input::placeholder {
  color: var(--muted-2);
}

.search-row .search svg {
  position: absolute;
  left: 12px;
  width: 18px;
  height: 18px;
  color: var(--muted);
  pointer-events: none;
}

.search-row .filter {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  border: 1px solid var(--line-soft);
  background: var(--paper-3);
  color: var(--muted);
}

/* ───────── Profile ───────── */
.profile-card {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 16px;
  padding: 18px;
  border-radius: 20px;
  background: var(--paper-3);
  border: 1px solid var(--line-soft);
}

.profile-card .avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background-image: url("./assets/styles/youhua.jpg");
  background-size: cover;
  background-position: center;
  border: 2px solid white;
  box-shadow: var(--shadow-sm);
}

.profile-card .info {
  flex: 1;
}

.profile-card .info .name-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.profile-card .info .name-row strong {
  font-size: 16px;
  font-weight: 700;
}

.profile-card .pro-pill {
  padding: 2px 8px;
  border-radius: 6px;
  background: linear-gradient(135deg, #d4a559, #b8893f);
  color: white;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.profile-card .id {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.quota-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding: 14px 18px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--teal-2), #f1f7f4);
  border: 1px solid var(--line-soft);
}

.quota-card .quota-text {
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}

.quota-card .quota-text strong {
  color: var(--ink);
  font-size: 18px;
  font-weight: 800;
  margin-right: 4px;
}

.quota-card button {
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--teal);
  color: white;
  font-size: 12px;
  font-weight: 700;
}

.pro-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding: 16px 18px;
  border-radius: 18px;
  background: linear-gradient(135deg, #f8e5c4, #f5d99e);
  border: 1px solid #e6c98b;
}

.pro-card .pro-info strong {
  display: block;
  font-size: 15px;
  font-weight: 700;
  color: #6e5018;
  margin-bottom: 2px;
}

.pro-card .pro-info span {
  font-size: 12px;
  color: #8a6a30;
}

.pro-card button {
  padding: 8px 18px;
  border-radius: 999px;
  background: linear-gradient(135deg, #5a3a14, #3a2408);
  color: #f5d99e;
  font-size: 13px;
  font-weight: 700;
}

.settings-list {
  border-radius: 18px;
  background: var(--paper-3);
  border: 1px solid var(--line-soft);
  overflow: hidden;
  margin-bottom: 80px;
}

.settings-list button {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  min-height: 52px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  text-align: left;
}

.settings-list button:last-child {
  border-bottom: 0;
}

.settings-list .right {
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ───────── responsive ───────── */
@media (max-width: 520px) {
  .app-shell {
    padding: 0;
  }

  .phone {
    width: 100vw;
    height: 100vh;
    min-height: 0;
    border: 0;
    border-radius: 0;
  }

  .screen {
    padding-top: max(env(safe-area-inset-top), 12px);
    padding-bottom: max(env(safe-area-inset-bottom), 22px);
  }
}
