/* ============================================================
   PackOne Studio — 设计系统
   原创实现。暖中性底色 + 纸品/印刷质感橙色调。
   ============================================================ */

:root {
  --bg:        #faf9f7;
  --surface:   #ffffff;
  --surface-2: #f5f3f0;
  --surface-3: #ece9e4;
  --ink:       #1c1917;
  --ink-2:     #57534e;
  --ink-3:     #8a8580;
  --line:      #e7e4df;
  --line-2:    #d6d2cb;

  --accent:      #ea580c;
  --accent-dark: #c2410c;
  --accent-soft: #fff1e7;
  --ok:          #157f3d;
  --ok-soft:     #e8f6ee;
  --warn:        #a16207;
  --warn-soft:   #fdf6e3;
  --bad:         #c2251f;
  --bad-soft:    #fdeceb;

  --cut:   #e02020;
  --fold:  #1d4ed8;

  --radius:    10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(28, 25, 23, .06);
  --shadow:    0 4px 16px rgba(28, 25, 23, .08);
  --shadow-lg: 0 12px 40px rgba(28, 25, 23, .12);
  --sans: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Consolas, monospace;
  --maxw: 1200px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.3; letter-spacing: -.01em; }
h1 { font-size: 40px; }
h2 { font-size: 26px; }
h3 { font-size: 18px; }
h4 { font-size: 15px; }
p  { margin: 0; }
a  { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }

[hidden] { display: none !important; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.muted { color: var(--ink-2); }
.small { font-size: 13px; }
.tiny  { font-size: 12px; }
.mono  { font-family: var(--mono); }

/* ── 顶栏 ───────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 60;
  background: #1c1917;
  color: #f5f3f0;
  border-bottom: 1px solid #292524;
}
.topbar-in {
  max-width: var(--maxw); margin: 0 auto; padding: 0 24px;
  height: 60px; display: flex; align-items: center; gap: 28px;
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 600; font-size: 16px; letter-spacing: -.01em; }
.brand-mark {
  width: 26px; height: 26px; border-radius: 7px; flex: none;
  background: var(--accent);
  display: grid; place-items: center;
}
.brand-mark svg { width: 16px; height: 16px; }
.topnav { display: flex; align-items: center; gap: 4px; margin-left: 6px; }
.topnav a {
  padding: 7px 12px; border-radius: 7px; font-size: 14px;
  color: #d6d3d1; transition: background .15s, color .15s;
}
.topnav a:hover { background: #292524; color: #fff; }
.topnav a.on { background: #292524; color: #fff; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.topbar .btn-ghost { color: #d6d3d1; border-color: #44403c; }
.topbar .btn-ghost:hover { background: #292524; color: #fff; }

/* ── 按钮 ───────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px; border-radius: 9px; border: 1px solid transparent;
  background: var(--accent); color: #fff; font-size: 14px; font-weight: 500;
  cursor: pointer; transition: background .15s, border-color .15s, transform .06s;
  white-space: nowrap;
}
.btn:hover { background: var(--accent-dark); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line-2); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--ink-3); }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: #292524; }
.btn-sm { padding: 6px 11px; font-size: 13px; border-radius: 7px; }
.btn-lg { padding: 12px 24px; font-size: 15px; border-radius: 10px; }
.btn-block { width: 100%; }

/* ── 表单 ───────────────────────────────────────────── */
label { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 5px; }
.input, select.input, textarea.input {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line-2);
  border-radius: 8px; background: #fff; font-size: 14px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
select.input { cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2357534e' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px; }
.field { margin-bottom: 13px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }

.switch { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.switch input { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; }

/* ── 卡片 / 区块 ─────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.card-pad { padding: 20px; }
.card-h { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-h h3 { font-size: 15px; }
.step-no {
  width: 22px; height: 22px; border-radius: 6px; flex: none;
  background: var(--accent); color: #fff; font-size: 12px; font-weight: 600;
  display: grid; place-items: center;
}

section.band { padding: 72px 0; }
section.band.alt { background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.sec-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.sec-head p { color: var(--ink-2); margin-top: 6px; max-width: 620px; }
.eyebrow {
  display: inline-block; font-size: 12px; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; color: var(--accent); margin-bottom: 10px;
}

/* ── Hero ───────────────────────────────────────────── */
.hero { padding: 76px 0 64px; background: var(--surface); border-bottom: 1px solid var(--line); }
.hero-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 56px; align-items: center; }
.hero h1 { font-size: 44px; letter-spacing: -.025em; }
.hero p.lede { font-size: 17px; color: var(--ink-2); margin-top: 18px; max-width: 520px; }
.hero-cta { display: flex; gap: 12px; margin-top: 28px; flex-wrap: wrap; }
.hero-stats { display: flex; gap: 32px; margin-top: 36px; padding-top: 26px; border-top: 1px solid var(--line); }
.hero-stats b { display: block; font-size: 22px; font-weight: 600; }
.hero-stats span { font-size: 13px; color: var(--ink-2); }

.hero-visual {
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 18px; min-height: 380px;
  display: flex; flex-direction: column;
}
.hero-visual-top { display: flex; gap: 6px; margin-bottom: 14px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--line-2); }
.hero-visual-body { flex: 1; display: grid; place-items: center; background: #fff; border-radius: var(--radius); border: 1px solid var(--line); overflow: hidden; }
.hero-visual-body svg { width: 100%; height: auto; max-height: 340px; }

/* ── 网格 ───────────────────────────────────────────── */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.tile {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; transition: border-color .15s, box-shadow .15s, transform .12s;
  cursor: pointer; text-align: left; padding: 0;
}
.tile:hover { border-color: var(--line-2); box-shadow: var(--shadow); transform: translateY(-2px); }
.tile-thumb {
  aspect-ratio: 4 / 3; background: var(--surface-2);
  display: grid; place-items: center; border-bottom: 1px solid var(--line);
  overflow: hidden; position: relative;
}
.tile-thumb svg { width: 100%; height: 100%; }
.tile-body { padding: 11px 13px 13px; }
.tile-body h4 { font-size: 14px; margin-bottom: 2px; }
.tile-body p { font-size: 12px; color: var(--ink-3); line-height: 1.5; }
.tile-tag {
  position: absolute; top: 8px; left: 8px; font-size: 11px; padding: 2px 7px;
  border-radius: 5px; background: rgba(255,255,255,.92); color: var(--ink-2);
  border: 1px solid var(--line);
}
.tile-badge {
  position: absolute; top: 8px; right: 8px; font-size: 11px; padding: 2px 7px;
  border-radius: 5px; background: var(--ink); color: #fff;
}

/* ── 功能点 ─────────────────────────────────────────── */
.feat { display: flex; gap: 14px; }
.feat-ico {
  width: 36px; height: 36px; border-radius: 9px; flex: none;
  background: var(--accent-soft); color: var(--accent-dark);
  display: grid; place-items: center;
}
.feat-ico svg { width: 19px; height: 19px; }
.feat h3 { font-size: 15px; margin-bottom: 4px; }
.feat p { font-size: 13px; color: var(--ink-2); }

/* ── 定价 ───────────────────────────────────────────── */
.plan {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 26px; display: flex; flex-direction: column;
}
.plan.hot { border-color: var(--accent); box-shadow: var(--shadow); position: relative; }
.plan.hot::after {
  content: "推荐"; position: absolute; top: -11px; left: 26px;
  background: var(--accent); color: #fff; font-size: 11px; font-weight: 600;
  padding: 3px 10px; border-radius: 20px;
}
.plan h3 { font-size: 17px; }
.plan .price { font-size: 32px; font-weight: 600; margin: 12px 0 4px; letter-spacing: -.02em; }
.plan .price small { font-size: 14px; font-weight: 400; color: var(--ink-2); }
.plan ul { list-style: none; padding: 0; margin: 18px 0 22px; display: grid; gap: 9px; }
.plan li { font-size: 13.5px; color: var(--ink-2); padding-left: 22px; position: relative; }
.plan li::before {
  content: ""; position: absolute; left: 0; top: 7px;
  width: 13px; height: 13px; border-radius: 50%; background: var(--ok-soft);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='13' height='13' viewBox='0 0 24 24' fill='none' stroke='%23157f3d' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6L9 17l-5-5'/%3E%3C/svg%3E");
  background-size: 13px; background-repeat: no-repeat;
}
.plan .btn { margin-top: auto; }

/* ── 编辑器布局 ─────────────────────────────────────── */
.editor { display: grid; grid-template-columns: 288px 1fr 306px; height: calc(100vh - 60px); }
.pane { overflow-y: auto; background: var(--surface); }
.pane-l { border-right: 1px solid var(--line); }
.pane-r { border-left: 1px solid var(--line); }
.pane-mid { background: var(--surface-2); display: flex; flex-direction: column; min-width: 0; }

.pane-h {
  padding: 11px 16px; border-bottom: 1px solid var(--line);
  font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-3); background: var(--surface); position: sticky; top: 0; z-index: 5;
}
.pane-sec { padding: 16px; border-bottom: 1px solid var(--line); }
.pane-sec:last-child { border-bottom: none; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); background: var(--surface); }
.tab {
  padding: 10px 14px; font-size: 13px; color: var(--ink-2); cursor: pointer;
  border: none; background: none; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--ink); }
.tab.on { color: var(--accent-dark); border-bottom-color: var(--accent); font-weight: 500; }

.toolstrip {
  display: flex; align-items: center; gap: 8px; padding: 9px 14px;
  background: var(--surface); border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.toolstrip .spacer { margin-left: auto; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; }
.seg button {
  padding: 6px 11px; font-size: 13px; background: #fff; border: none;
  border-right: 1px solid var(--line-2); cursor: pointer; color: var(--ink-2);
}
.seg button:last-child { border-right: none; }
.seg button.on { background: var(--ink); color: #fff; }

.stage { flex: 1; overflow: auto; padding: 22px; display: grid; place-items: center; min-height: 0; }
/* 注意：这里必须给容器一个确定宽度，否则 place-items:center 会把
   .stage-inner 按 max-content 收缩，而内联 SVG 没有固有宽度 → 整块塌成 0 宽。 */
.stage-inner {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 12px;
  width: 100%; max-width: 920px;
  display: grid; place-items: center; position: relative;
}
.stage-inner svg { display: block; width: 100%; height: auto; max-height: 62vh; }
.stage-inner canvas { display: block; max-width: 100%; }

.vp { flex: 1; min-height: 0; position: relative; }
.vp canvas { display: block; width: 100%; height: 100%; }

/* ── 提示条 ─────────────────────────────────────────── */
.note {
  display: flex; gap: 9px; padding: 10px 12px; border-radius: 8px;
  font-size: 12.5px; line-height: 1.55; background: var(--accent-soft);
  color: #7c2d12; border: 1px solid #ffd9bf;
}
.note.ok  { background: var(--ok-soft);   color: #14532d; border-color: #bbf7d0; }
.note.warn{ background: var(--warn-soft); color: #713f12; border-color: #fde68a; }
.note.bad { background: var(--bad-soft);  color: #7f1d1d; border-color: #fecaca; }
.note svg { width: 15px; height: 15px; flex: none; margin-top: 1px; }

/* ── 自检表 ─────────────────────────────────────────── */
.checks { display: grid; gap: 5px; }
.check { display: flex; gap: 8px; font-size: 12.5px; align-items: flex-start; }
.check .mk { width: 14px; flex: none; font-weight: 700; }
.check.pass .mk { color: var(--ok); }
.check.fail .mk { color: var(--bad); }
.check .dt { color: var(--ink-3); font-family: var(--mono); font-size: 11.5px; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 13px; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; font-family: var(--mono); font-size: 12.5px; }

/* ── 图层行 ─────────────────────────────────────────── */
.layer {
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px;
  margin-bottom: 8px; background: #fff; font-size: 12.5px;
}
.layer.on { border-color: var(--accent); background: var(--accent-soft); }
.layer-top { display: flex; align-items: center; gap: 7px; margin-bottom: 7px; }
.layer-top b { font-weight: 500; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.layer-row { display: flex; align-items: center; gap: 7px; margin-top: 6px; }
.layer-row input[type=range] { flex: 1; accent-color: var(--accent); min-width: 0; }
.icon-btn {
  width: 24px; height: 24px; border-radius: 6px; border: 1px solid var(--line-2);
  background: #fff; cursor: pointer; display: grid; place-items: center; color: var(--ink-2);
  flex: none;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn.danger:hover { background: var(--bad-soft); color: var(--bad); border-color: #fecaca; }
.icon-btn svg { width: 13px; height: 13px; }

/* ── 缩略卡（盒型库封面墙） ─────────────────────────── */
.face-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.face-tab {
  padding: 5px 11px; border-radius: 20px; border: 1px solid var(--line-2);
  background: #fff; font-size: 12.5px; cursor: pointer; color: var(--ink-2);
}
.face-tab:hover { border-color: var(--ink-3); }
.face-tab.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.face-tab[disabled] { opacity: .4; cursor: not-allowed; }

/* ── 页脚 ───────────────────────────────────────────── */
.foot { background: #1c1917; color: #a8a29e; padding: 52px 0 30px; margin-top: 0; }
.foot-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 32px; }
.foot h4 { color: #f5f3f0; font-size: 13px; margin-bottom: 12px; }
.foot a { display: block; font-size: 13px; padding: 3px 0; color: #a8a29e; }
.foot a:hover { color: #fff; }
.foot-bot {
  margin-top: 36px; padding-top: 22px; border-top: 1px solid #292524;
  display: flex; justify-content: space-between; gap: 16px; font-size: 12.5px; flex-wrap: wrap;
}
.foot .brand { color: #f5f3f0; margin-bottom: 12px; }

/* ── 通用 ───────────────────────────────────────────── */
.stack { display: grid; gap: 12px; }
.stack-8 { display: grid; gap: 8px; }
.flex { display: flex; align-items: center; gap: 10px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.flex-wrap { flex-wrap: wrap; }
.spin {
  width: 13px; height: 13px; border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; animation: sp .7s linear infinite; display: inline-block;
}
@keyframes sp { to { transform: rotate(360deg); } }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 6px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-3); background-clip: content-box; }

/* ── 响应式 ─────────────────────────────────────────── */
@media (max-width: 1080px) {
  .editor { grid-template-columns: 250px 1fr 270px; }
}
@media (max-width: 900px) {
  .hero { padding: 52px 0 44px; }
  .hero h1 { font-size: 32px; }
  .hero-grid { grid-template-columns: 1fr; gap: 32px; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .foot-grid { grid-template-columns: 1fr 1fr; }
  .topnav { display: none; }
  section.band { padding: 48px 0; }
  .sec-head { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 720px) {
  .editor { grid-template-columns: 1fr; height: auto; }
  .pane { overflow: visible; }
  .pane-l, .pane-r { border: none; border-top: 1px solid var(--line); }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .stage { padding: 14px; }
  h1 { font-size: 28px; }
  .wrap { padding: 0 16px; }
}
