/* ============================================================
   χάρις · 现代简约
   降温 / 去边框 / 增留白 / 重字阶
   首页：纯白 + 黑色大胶囊；站内：冰川浅灰 + 纯净白。
   ============================================================ */

:root {
  /* 画布与容器 */
  --bg: #f8fafc;            /* 冰川极浅灰（页面主底色） */
  --card: #ffffff;          /* 纯净白（浮于画布） */
  --stage: #eff2f6;         /* 雾灰展台（打样预览区） */
  /* 文字 */
  --ink: #0f172a;           /* 曜石炭黑 */
  --ink-2: #64748b;         /* 钢琴冷灰 */
  --ink-3: #94a3b8;         /* 浅灰（未选态） */
  /* 微弱边框 */
  --line: rgba(15, 23, 42, .06);
  --line-strong: rgba(15, 23, 42, .12);
  --sel: #0f172a;           /* 选中态：极简纯黑线条 */
  /* 圆角体系 */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --r-xl: 24px;
  /* 多层弥散阴影 */
  --shadow-card: 0 1px 3px rgba(0, 0, 0, .02), 0 6px 16px rgba(0, 0, 0, .03);
  --shadow-hover: 0 12px 24px -4px rgba(15, 23, 42, .08), 0 4px 8px -2px rgba(15, 23, 42, .03);
  --shadow-poster: 0 20px 40px -15px rgba(15, 23, 42, .12), 0 0 1px rgba(15, 23, 42, .1);
  /* 字体 */
  --sans: -apple-system, BlinkMacSystemFont, "Inter", "PingFang SC", "Noto Sans SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--sans);
  background-color: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color .9s ease;
}
body.on-home { background-color: #ffffff; }

main { flex: 1; display: flex; flex-direction: column; }
.view { flex: 1; display: flex; flex-direction: column; }
.hidden { display: none !important; }

::selection { background: #0f172a; color: #fff; }

button { font-family: inherit; }
button:focus-visible, .recent-item:focus-visible {
  outline: 2px solid #0f172a;
  outline-offset: 3px;
}

/* 首页：chrome 全部收起来，只剩白和胶囊 */
body.on-home .site-header,
body.on-home .site-footer { display: none; }

/* ---------- 页眉 ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 32px; height: 64px;
  background: rgba(255, 255, 255, .82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 11px; cursor: pointer; user-select: none; }
.brand-mark { width: 26px; height: 26px; display: block; }
.brand-name { font-weight: 700; font-size: 17px; letter-spacing: 3px; }
.brand-latin { font-size: 10px; letter-spacing: 2.5px; color: var(--ink-3); margin-top: 3px; }
.header-note { font-size: 12px; letter-spacing: 2px; color: var(--ink-3); }

/* ---------- 首页：白 + 黑胶囊 ---------- */
#view-home {
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.start-pill {
  display: inline-flex; align-items: center; justify-content: center; gap: 20px;
  width: min(86vw, 560px); height: clamp(104px, 16vw, 140px);
  border: none; border-radius: 999px;
  background: #121212; color: #fff;
  font-size: clamp(24px, 3.6vw, 30px); font-weight: 700;
  letter-spacing: 14px; text-indent: 14px;
  cursor: pointer;
  box-shadow: 0 24px 52px -18px rgba(18, 18, 18, .45);
  animation: breathe 3.6s ease-in-out infinite;
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
}
.start-pill:hover { transform: scale(1.03); background: #000; }
.start-pill:active { transform: scale(.97); }
.start-pill svg { text-indent: 0; transition: transform .2s ease; }
.start-pill:hover svg { transform: translateX(7px); }
@keyframes breathe {
  0%, 100% { box-shadow: 0 24px 52px -18px rgba(18, 18, 18, .42); }
  50% { box-shadow: 0 28px 62px -16px rgba(18, 18, 18, .52); }
}

/* 回到首页的小字链 */
.home-link {
  position: absolute; top: 20px; left: 26px; z-index: 5;
  background: none; border: none;
  font-size: 12px; letter-spacing: 2px; color: var(--ink-3);
  cursor: pointer; padding: 6px 4px;
  transition: color .15s ease;
}
.home-link:hover { color: var(--ink); }
#view-wizard, #view-result { position: relative; }

/* ---------- 向导 ---------- */
#view-wizard {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 44px 48px 72px;
}

/* 步骤：01 配色 —— 纯文字 + 黑下划线 */
.steps {
  display: flex; align-items: baseline; justify-content: center;
  gap: 48px;
  list-style: none;
  margin-bottom: 56px;
}
.steps li {
  display: flex; align-items: baseline; gap: 8px;
  padding-bottom: 8px;
  border-bottom: 2px solid transparent;
  cursor: pointer; user-select: none;
  color: var(--ink-3);
  font-size: 14px; font-weight: 500; letter-spacing: .06em;
  transition: color .18s ease, border-color .18s ease;
}
.steps li i {
  font-style: normal;
  font-family: var(--mono);
  font-size: 12px; letter-spacing: .04em;
}
.steps li.now {
  color: var(--ink);
  font-weight: 700;
  border-bottom-color: var(--ink);
}
.steps li.done { color: var(--ink-2); }

.wizard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 56px;
  align-items: start;
}

/* 步骤标题 */
.step-kicker {
  font-size: 11px; letter-spacing: .2em;
  color: var(--ink-3);
  margin-bottom: 12px;
}
.step-title {
  font-size: 36px; font-weight: 800;
  letter-spacing: -.02em;
  margin-bottom: 10px;
}
.step-sub {
  font-size: 13.5px; color: var(--ink-2);
  letter-spacing: .02em;
  margin-bottom: 30px;
}

.shuffle-row { display: flex; justify-content: flex-end; align-items: baseline; margin: -12px 0 16px; }
.shuffle-hint {
  font-size: 11px; color: var(--ink-3); letter-spacing: .05em;
  margin-right: 14px;
}
.shuffle-btn {
  background: none; border: none;
  font-size: 12px; letter-spacing: .06em;
  color: var(--ink-2);
  border-bottom: 1px solid var(--line-strong);
  padding: 2px 0;
  cursor: pointer;
  transition: color .15s ease, border-color .15s ease;
}
.shuffle-btn:hover { color: var(--ink); border-color: var(--ink); }

/* 选项卡：超淡描边 + 柔和微阴影 */
.opt-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.opt-grid.single { grid-template-columns: minmax(0, 1fr); }

.opt {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--card);
  box-shadow: var(--shadow-card);
  padding: 18px;
  cursor: pointer;
  text-align: left;
  transition: transform .18s ease, box-shadow .18s ease;
  animation: rise .32s ease backwards;
  animation-delay: calc(var(--d, 0) * 28ms);
}
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.opt:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}
.opt.sel {
  box-shadow: 0 0 0 1.5px var(--sel), var(--shadow-card);
}
.opt .check {
  position: absolute; top: -9px; right: -9px;
  width: 22px; height: 22px; border-radius: 50%;
  background: #0f172a; color: #fff;
  display: none; align-items: center; justify-content: center;
}
.opt.sel .check { display: flex; }

/* 配色选项：四块独立圆角小砖，4px 缝隙 */
.opt .swatches {
  display: flex; gap: 4px; height: 56px;
}
.opt .swatches i {
  flex: 1;
  border-radius: var(--r-sm);
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .05);
}
/* 色宽反映角色：底色最重，墨色次之，点缀最窄 */
.opt .swatches i:nth-child(1) { flex: 1.9; }
.opt .swatches i:nth-child(2) { flex: 1.15; }
.opt .swatches i:nth-child(3) { flex: 1; }
.opt .swatches i:nth-child(4) { flex: .95; }
.opt .opt-foot {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-top: 13px;
}
.opt .opt-name { font-size: 14px; font-weight: 500; color: #1e293b; letter-spacing: .02em; }
.opt .opt-hex { font-family: var(--mono); font-size: 11px; font-weight: 400; color: var(--ink-3); }

/* 分组小标（排版步按构图逻辑归档） */
.group-kicker {
  font-size: 11px; letter-spacing: .22em; color: var(--ink-3);
  margin: 38px 0 14px;
}
.group-kicker:first-child { margin-top: 0; }

/* 排版选项：线框骨架图 */
.mini-layout {
  height: 120px; border-radius: var(--r-md);
  background: var(--stage);
  position: relative; overflow: hidden;
}
.ml-bar { position: absolute; background: #b7c2cd; border-radius: 2px; }
.ml-ink { background: #1e293b; }
.ml-acc { background: #0f172a; }

/* 排版/字体选项：真·迷你海报（海报墙三列） */
.opt-grid.posters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.opt-grid.posters .opt { padding: 12px; }
.opt-grid.posters .opt-name { font-size: 13.5px; }
.mini-canvas {
  display: block;
  width: 100%; height: auto;
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-card);
}
.opt .opt-desc { margin-top: 6px; font-size: 12px; color: var(--ink-2); letter-spacing: .02em; }

/* 内容选项 */
.opt .content-demo { padding: 2px 2px 0; }
.opt .cd-title {
  font-size: 16px; font-weight: 600; letter-spacing: .01em;
  margin-bottom: 6px;
}
.opt .cd-sub { font-size: 12px; color: var(--ink-2); letter-spacing: .06em; margin-bottom: 8px; }
.opt .cd-body {
  font-size: 12.5px; color: var(--ink-2); line-height: 1.7;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: pre-line;
}
.opt .cd-foot { margin-top: 8px; font-size: 11px; color: var(--ink-3); letter-spacing: .03em; }

/* 导航 */
.wizard-nav {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 44px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
}

/* 按钮 */
.pill {
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--ink);
  font-size: 13px; font-weight: 600; letter-spacing: .08em;
  padding: 13px 34px;
  border-radius: 999px;
  cursor: pointer;
  transition: all .16s ease;
}
.pill:hover { border-color: var(--ink); }
.pill.dark { background: #0f172a; border-color: #0f172a; color: #fff; }
.pill.dark:hover { background: #1e293b; border-color: #1e293b; }
.pill.ghost { border-color: transparent; color: var(--ink-2); }
.pill.ghost:hover { color: var(--ink); }
.pill.big { font-size: 14px; padding: 15px 42px; }
.pill:disabled { opacity: .3; cursor: not-allowed; transform: none; }
.pill:not(:disabled):active { transform: scale(.97); }

/* 打样面板：雾灰展台 */
.proof-panel {
  position: sticky; top: 96px;
  border-radius: var(--r-xl);
  background: var(--stage);
  padding: 20px;
}
.proof-head {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 11px; letter-spacing: .18em; color: var(--ink-2);
  margin-bottom: 16px;
}
.proof-latin { font-size: 10px; letter-spacing: .12em; color: var(--ink-3); font-family: var(--mono); }
.proof-frame { line-height: 0; }
#proof {
  width: 100%; height: auto;
  border-radius: 12px;
  box-shadow: var(--shadow-poster);
}
.proof-meta { margin-top: 16px; }
.proof-meta div {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 2px;
  border-top: 1px solid var(--line);
  font-size: 12px;
}
.proof-meta div:first-child { border-top: none; }
.proof-meta dt { color: var(--ink-3); letter-spacing: .1em; }
.proof-meta dd { font-weight: 600; letter-spacing: .02em; display: flex; align-items: center; gap: 7px; }
.proof-meta dd .dots { display: inline-flex; gap: 3px; }
.proof-meta dd .dots i { width: 10px; height: 10px; border-radius: 3px; box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .08); }
.proof-meta .unset { color: var(--ink-3); font-weight: 400; }
.proof-meta dd.hex-data {
  font-family: var(--mono);
  font-weight: 400;
  font-size: 10px;
  letter-spacing: .05em;
  color: var(--ink-3);
}

/* ---------- 结果页 ---------- */
#view-result {
  align-items: center;
  padding: 56px 24px 88px;
}
.result-eyebrow {
  font-size: 11px; letter-spacing: .3em; color: var(--ink-3);
  margin-bottom: 14px;
}
.result-title {
  font-size: 36px; font-weight: 800; letter-spacing: -.01em;
  margin-bottom: 46px;
}
.poster-mount {
  position: relative;
  width: min(480px, 88vw);
  background: var(--card);
  border-radius: 18px;
  padding: 16px;
  line-height: 0;
  box-shadow: var(--shadow-poster);
}
.poster-mount canvas { width: 100%; height: auto; border-radius: 10px; }

.result-actions {
  display: flex; gap: 14px; flex-wrap: wrap; justify-content: center;
  margin-top: 46px;
}

.recent { width: 100%; max-width: 1100px; margin-top: 88px; }
.recent-label {
  text-align: center;
  font-size: 11px; letter-spacing: .18em; color: var(--ink-3);
  margin-bottom: 24px;
}
.recent-row {
  display: flex; gap: 16px; overflow-x: auto;
  padding: 8px 4px 18px;
  justify-content: safe center;
}
.recent-row::-webkit-scrollbar { height: 5px; }
.recent-row::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 3px; }
.recent-item {
  flex: 0 0 auto; width: 118px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 6px;
  cursor: pointer; line-height: 0;
  box-shadow: var(--shadow-card);
  transition: transform .18s ease, box-shadow .18s ease;
}
.recent-item:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}
.recent-item canvas { width: 100%; height: auto; border-radius: 5px; }
.recent-empty { color: var(--ink-3); font-size: 12.5px; letter-spacing: .08em; text-align: center; padding: 8px; width: 100%; }

/* ---------- 页脚 / toast ---------- */
.site-footer {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 16px;
  font-size: 12px; letter-spacing: .08em; color: var(--ink-3);
  border-top: 1px solid var(--line);
}
.footer-seal { width: 8px; height: 8px; border-radius: 2px; background: var(--ink-3); display: inline-block; }

.toast {
  position: fixed; left: 50%; bottom: 36px; transform: translateX(-50%);
  background: #0f172a; color: #fff;
  font-size: 13px; letter-spacing: .06em;
  padding: 12px 26px; border-radius: 999px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, .3);
  z-index: 100;
  animation: toast-in .22s ease;
}
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}


/* ---------- 响应式 ---------- */
@media (max-width: 1080px) {
  .wizard-grid { grid-template-columns: minmax(0, 1fr); gap: 40px; }
  .proof-panel { position: static; order: -1; max-width: 420px; margin: 0 auto; width: 100%; }
  #view-wizard { padding: 34px 22px 56px; }
}

@media (max-width: 640px) {
  .site-header { padding: 0 16px; height: 56px; }
  .brand-latin, .header-note { display: none; }
  .start-pill { letter-spacing: 9px; text-indent: 9px; gap: 12px; }
  .home-link { top: 14px; left: 16px; }
  .steps { gap: 26px; margin-bottom: 40px; }
  .step-title { font-size: 27px; }
  .opt-grid { grid-template-columns: minmax(0, 1fr); }
  .opt-grid.posters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .result-title { font-size: 28px; }
  .wizard-nav .pill { padding: 12px 22px; }
}

/* ---------- 减弱动效 ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ============================================================
   移动端交互壳（≤768px）：吸顶打样缩略条 + 全屏预览浮层
   + 底部固定步导航 + 选项双列收紧 —— 免去上下滑找结果
   ============================================================ */

/* 全屏预览浮层（桌面端永不显示） */
.proof-overlay {
  position: fixed; inset: 0; z-index: 120;
  background: rgba(248, 250, 251, .98);
  overflow-y: auto;
  padding: 18px 20px calc(30px + env(safe-area-inset-bottom));
}
#proof-close { display: block; margin: 0 auto 18px; }
.proof-overlay-inner .proof-frame { width: min(340px, 80vw); margin: 0 auto; }
.proof-overlay-inner #proof { width: 100%; height: auto; border-radius: 12px; box-shadow: var(--shadow-poster); }
.proof-overlay-inner .proof-meta { margin: 18px auto 0; max-width: 340px; }
@media (min-width: 769px) {
  .proof-overlay { display: none !important; }
}

@media (max-width: 768px) {
  #view-wizard { padding: 48px 16px 128px; }

  /* 步骤条：横向滑动，不再挤压换行 */
  .steps {
    justify-content: flex-start; gap: 22px;
    margin-bottom: 18px;
    flex-wrap: nowrap; overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .steps::-webkit-scrollbar { display: none; }
  .step-title { font-size: 24px; margin-bottom: 6px; }
  .step-sub { margin-bottom: 14px; font-size: 12.5px; }

  /* 选项全部两列收紧；内容步保持单列 */
  .opt-grid, .opt-grid.posters { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .opt-grid.single { grid-template-columns: minmax(0, 1fr); }
  .opt { padding: 10px; }
  .opt .swatches { height: 40px; }
  .opt .opt-name { font-size: 12.5px; }
  .opt .opt-hex { font-size: 9px; }
  .opt .opt-desc { font-size: 11px; margin-top: 4px; }
  .mini-layout { height: 84px; }
  .group-kicker { margin: 22px 0 10px; font-size: 10px; }
  .shuffle-row { margin: 0 0 10px; }

  /* 打样条：吸顶缩略图 + 摘要行，点击开全屏 */
  .wizard-grid { gap: 0; }
  .proof-panel {
    position: sticky; top: 56px; z-index: 40;
    order: -1;
    display: flex; align-items: center; gap: 12px;
    max-width: none; width: auto;
    margin: 0 -16px 14px;
    padding: 9px 44px 9px 14px;
    background: rgba(255, 255, 255, .95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    box-shadow: 0 10px 24px -16px rgba(15, 23, 42, .25);
    cursor: pointer;
  }
  .proof-panel .proof-head { display: none; }
  .proof-panel .proof-frame { flex: 0 0 50px; width: 50px; }
  .proof-panel #proof { border-radius: 7px; box-shadow: 0 2px 8px rgba(15, 23, 42, .18); }
  .proof-panel .proof-meta { margin: 0; flex: 1; min-width: 0; }
  .proof-panel .proof-meta div { padding: 3px 0; font-size: 11px; border-top: none; }
  .proof-panel .proof-meta div:nth-child(2) { display: none; }
  .proof-panel .proof-meta dd { font-weight: 600; font-size: 11px; }
  .proof-panel::after {
    content: '预览 ▸';
    position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
    font-size: 10px; letter-spacing: .08em; color: var(--ink-3);
    white-space: nowrap;
  }

  /* 步导航：固定底部，永远够得着 */
  .wizard-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 80;
    margin-top: 0; padding: 11px 16px calc(11px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, .96);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid var(--line);
  }
  .wizard-nav .pill { flex: 1; padding: 13px 0; text-align: center; }
  .wizard-nav .pill.dark { flex: 1.7; }
}
