:root {
  --bg: #f6f1e7;
  --card: #ffffff;
  --ink: #2d2a24;
  --sub: #8a8272;
  --brand: #c2402a;
  --brand-dark: #a03320;
  --gold: #c9a05a;
  --line: #e8e0d0;
  --ok: #3d8b57;
  --radius: 14px;
  /* 字体：标题/装饰用衬线，正文用无衬线（品牌规范 §1.2） */
  --font-serif: "Noto Serif SC", "Songti SC", "STSong", serif;
  --font-sans: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", -apple-system, sans-serif;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, .logo, .brand { font-family: var(--font-serif); }
a { color: inherit; text-decoration: none; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px;
  background: rgba(246,241,231,.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.logo { font-weight: 700; font-size: 18px; letter-spacing: 1px; display: flex; align-items: center; gap: 8px; }
.logo .seal {
  display: inline-flex; width: 28px; height: 28px; border-radius: 6px;
  background: var(--brand); color: #fff; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800;
}
.topbar nav { display: flex; gap: 18px; font-size: 14px; color: var(--sub); }
.topbar nav a:hover { color: var(--brand); }

.container { max-width: 1100px; margin: 0 auto; padding: 26px 20px 60px; }

.hero { text-align: center; padding: 34px 0 26px; }
.hero h1 { font-size: 30px; letter-spacing: 2px; }
.hero h1 em { color: var(--brand); font-style: normal; }
.hero p { color: var(--sub); margin-top: 10px; font-size: 14px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; margin-top: 18px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; transition: transform .18s, box-shadow .18s; cursor: pointer;
}
.card:hover { transform: translateY(-4px); box-shadow: 0 12px 28px rgba(90,70,40,.12); }
.card .thumb { height: 170px; display: flex; align-items: center; justify-content: center; background: linear-gradient(160deg,#fbf7ef,#f0e7d6); font-size: 64px; }
.card .info { padding: 14px 16px 16px; }
.card .info h3 { font-size: 16px; }
.card .info p { font-size: 12.5px; color: var(--sub); margin-top: 5px; line-height: 1.5; }
.card .tags { margin-top: 9px; display: flex; gap: 6px; flex-wrap: wrap; }
.tag { font-size: 11px; padding: 2px 8px; border-radius: 20px; background: #f4ece0; color: #94804f; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; cursor: pointer; border-radius: 10px;
  background: var(--brand); color: #fff; font-size: 14px; padding: 11px 22px;
  transition: background .15s;
}
.btn:hover { background: var(--brand-dark); }
.btn.ghost { background: transparent; color: var(--brand); border: 1px solid var(--brand); }
.btn.ghost:hover { background: rgba(194,64,42,.06); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.block { width: 100%; }

/* 定制页布局 */
.custom-layout { display: grid; grid-template-columns: 1.35fr 1fr; gap: 22px; align-items: start; }
@media (max-width: 860px) { .custom-layout { grid-template-columns: 1fr; } }

.viewer-wrap {
  background: linear-gradient(165deg, #fdfaf3, #efe5d2);
  border: 1px solid var(--line); border-radius: var(--radius);
  height: 480px; position: relative; overflow: hidden;
}
.viewer-wrap canvas { display: block; }
.viewer-hint {
  position: absolute; bottom: 12px; left: 0; right: 0; text-align: center;
  font-size: 12px; color: var(--sub); pointer-events: none;
}
.viewer-fallback { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--sub); font-size: 13px; }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.panel h2 { font-size: 17px; margin-bottom: 4px; }
.panel .sub { font-size: 12.5px; color: var(--sub); margin-bottom: 14px; }

.area-block { border: 1px dashed var(--line); border-radius: 10px; padding: 14px; margin-bottom: 12px; }
.area-block h4 { font-size: 14px; display: flex; justify-content: space-between; align-items: center; }
.area-block .spec { font-size: 12px; color: var(--sub); margin: 6px 0 10px; line-height: 1.6; }
.upload-zone {
  border: 2px dashed #d8cbb0; border-radius: 10px; padding: 18px; text-align: center;
  font-size: 13px; color: var(--sub); cursor: pointer; transition: border-color .15s, background .15s;
  background: #fbf8f1;
}
.upload-zone:hover, .upload-zone.drag { border-color: var(--brand); background: #fdf3ef; }
.upload-zone img.preview { max-width: 100%; max-height: 120px; border-radius: 6px; margin-bottom: 8px; }
.color-row { display: flex; gap: 8px; align-items: center; }
.color-row input[type="color"] { width: 44px; height: 34px; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; padding: 2px; }
.color-row .swatch { width: 26px; height: 26px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); cursor: pointer; }

.notice { font-size: 12px; color: var(--sub); line-height: 1.7; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.notice b { color: #94804f; }

.toast {
  position: fixed; top: 70px; left: 50%; transform: translateX(-50%);
  background: rgba(45,42,36,.92); color: #fff; padding: 10px 20px; border-radius: 10px;
  font-size: 13.5px; z-index: 99; opacity: 0; pointer-events: none; transition: opacity .25s;
}
.toast.show { opacity: 1; }
.toast.ok { background: rgba(61,139,87,.94); }
.toast.err { background: rgba(178,52,38,.94); }

/* 弹层 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(40,34,26,.45); z-index: 50;
  display: none; align-items: center; justify-content: center; padding: 20px;
}
.modal-mask.show { display: flex; }
.modal { background: #fff; border-radius: 16px; padding: 24px; width: 100%; max-width: 430px; }
.modal h3 { font-size: 17px; margin-bottom: 14px; }
.modal .field { margin-bottom: 12px; }
.modal label { font-size: 13px; color: var(--sub); display: block; margin-bottom: 5px; }
.modal input, .modal textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px;
  font-size: 14px; font-family: inherit; outline: none;
}
.modal input:focus, .modal textarea:focus { border-color: var(--brand); }
.share-link-box {
  display: flex; gap: 8px; margin: 12px 0;
}
.share-link-box input { flex: 1; background: #faf6ee; }

/* 分享页 */
.share-head { text-align: center; padding: 18px 0 6px; }
.share-head h1 { font-size: 21px; }
.share-head p { font-size: 13px; color: var(--sub); margin-top: 6px; }
.badge { display: inline-block; font-size: 12px; padding: 3px 12px; border-radius: 20px; margin-top: 10px; }
.badge.created { background: #f4ece0; color: #94804f; }
.badge.confirmed { background: #e4f2e9; color: var(--ok); }

/* 管理后台 */
.admin-layout { display: grid; grid-template-columns: 180px 1fr; gap: 20px; align-items: start; }
@media (max-width: 760px) { .admin-layout { grid-template-columns: 1fr; } }
.admin-nav { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.admin-nav a { display: block; padding: 13px 18px; font-size: 14px; color: var(--sub); border-left: 3px solid transparent; }
.admin-nav a.active { color: var(--brand); border-left-color: var(--brand); background: #fdf5ef; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px,1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; text-align: center; }
.stat b { font-size: 26px; color: var(--brand); display: block; }
.stat span { font-size: 12px; color: var(--sub); }
table.list { width: 100%; border-collapse: collapse; background: var(--card); border-radius: 12px; overflow: hidden; font-size: 13px; }
table.list th, table.list td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--line); }
table.list th { background: #f8f3e9; color: #7c7461; font-weight: 600; font-size: 12.5px; }
table.list tr:last-child td { border-bottom: none; }
table.list img.mini { width: 46px; height: 34px; object-fit: cover; border-radius: 6px; }
.op-link { color: var(--brand); cursor: pointer; font-size: 12.5px; margin-right: 8px; }
select.status-sel { border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; font-size: 12.5px; }

.footer { text-align: center; font-size: 12px; color: #b3a98f; padding: 30px 0 20px; line-height: 1.8; }
.loading-mask {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(251,247,239,.7); z-index: 5; font-size: 13px; color: var(--sub);
}
.spinner { width: 22px; height: 22px; border: 3px solid #e5d9c2; border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; margin-right: 10px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== 图片生成3D / 上传模型 ===== */
.topbar .brand { font-weight: 700; font-size: 18px; letter-spacing: 1px; }
.topbar .brand a { color: var(--brand); }

.ai3d-main {
  max-width: 1080px; margin: 0 auto; padding: 26px 20px 40px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 22px; align-items: start;
}
@media (max-width: 880px) { .ai3d-main { grid-template-columns: 1fr; } }

.panel h2 { font-size: 17px; margin-bottom: 6px; }
.panel .hint { font-size: 12.5px; color: var(--sub); margin-bottom: 14px; line-height: 1.6; }

.dropzone {
  border: 2px dashed #d8cbb0; border-radius: 12px; padding: 30px 18px; text-align: center;
  background: #fbf8f1; cursor: pointer; transition: border-color .15s, background .15s; margin-bottom: 14px;
}
.dropzone:hover, .dropzone.drag { border-color: var(--brand); background: #fdf3ef; }
.dropzone .dz-icon { font-size: 40px; }
.dropzone .dz-inner > div:nth-child(2) { font-size: 14px; margin-top: 8px; }
.dropzone .dz-sub { font-size: 12px; color: var(--sub); margin-top: 6px; word-break: break-all; }

.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.text-input {
  flex: 1; min-width: 160px; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px;
  font-size: 14px; font-family: inherit; outline: none;
}
.text-input:focus { border-color: var(--brand); }
.status { font-size: 13px; color: var(--sub); }

.progress { margin-top: 14px; display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--sub); }
.progress.hidden { display: none; }
.progress .bar { height: 8px; width: 5%; background: var(--brand); border-radius: 6px; transition: width .4s; }
.progress .ptext { white-space: nowrap; }

.model-viewer {
  width: 100%; height: 440px; border-radius: 12px; overflow: hidden;
  background: linear-gradient(165deg, #fbf8f1, #efe5d2); border: 1px solid var(--line);
}
.viewer-ctrls { display: flex; gap: 16px; align-items: center; margin-top: 12px; font-size: 12.5px; color: var(--sub); }
.viewer-ctrls label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.result { margin-top: 14px; display: flex; gap: 10px; }
.result.hidden { display: none; }

.models-list { max-width: 1080px; margin: 0 auto 50px; padding: 0 20px; }
.model-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin-top: 14px; }
.model-card { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: var(--card); }
.model-card .mc-name { font-size: 14px; font-weight: 600; }
.model-card .mc-meta { font-size: 12px; color: var(--sub); margin: 6px 0 12px; }
.model-card .mc-actions { display: flex; gap: 8px; }
.btn.small { padding: 7px 14px; font-size: 12.5px; }
.empty { color: var(--sub); font-size: 13px; padding: 20px; text-align: center; grid-column: 1/-1; }

/* 首页功能入口 */
.entry-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 4px 0 26px; }
@media (max-width: 720px) { .entry-row { grid-template-columns: 1fr; } }
.entry-card {
  display: flex; gap: 16px; align-items: center; padding: 18px 20px; border-radius: 14px;
  background: var(--card); border: 1px solid var(--line); text-decoration: none; color: var(--ink);
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.entry-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(180,140,90,.14); border-color: var(--brand); }
.entry-ico { font-size: 32px; width: 54px; height: 54px; display: flex; align-items: center; justify-content: center; background: #fbf3ea; border-radius: 12px; flex-shrink: 0; }
.entry-card h3 { font-size: 15.5px; margin-bottom: 4px; }
.entry-card p { font-size: 12.5px; color: var(--sub); line-height: 1.5; }

/* ===== 线稿图标 & Logo（品牌规范：零 emoji，统一 stroke 线稿） ===== */
.logo-img { width: 26px; height: 26px; object-fit: contain; border-radius: 6px; }
/* 深色背景场景：logo 反白（规范 §1.0c） */
.on-dark .logo-img { filter: brightness(0) invert(1); }

.ln { width: 100%; height: 100%; display: block; }
/* 行内图标：与文字基线对齐 */
.ico { display: inline-flex; width: 18px; height: 18px; vertical-align: -4px; color: var(--brand); }
.ico svg { width: 100%; height: 100%; }
.btn .ico { width: 16px; height: 16px; color: #fff; }
.btn.ghost .ico { color: var(--brand); }
.modal h3 .ico, .modal h3 .ico svg { width: 20px; height: 20px; }
.entry-ico svg { width: 30px; height: 30px; color: var(--brand); }
.thumb svg { width: 56px; height: 56px; color: var(--brand); opacity: .9; }
.dz-icon svg { width: 40px; height: 40px; color: var(--brand); }
.dropzone .dz-icon { width: 48px; height: 48px; display: inline-flex; margin: 0 auto; }
.card .thumb { font-size: 0; } /* 清除残留 emoji 字号，交给 svg */

/* ===== 滚动入场动画（规范 §2.16，尊重 prefers-reduced-motion） ===== */
.anim-up, .anim-scale { opacity: 0; will-change: transform, opacity; }
.anim-up { transform: translateY(22px); transition: opacity .6s ease, transform .6s ease; }
.anim-scale { transform: scale(.95); transition: opacity .6s ease, transform .6s ease; }
.anim-up.in, .anim-scale.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .anim-up, .anim-scale { opacity: 1 !important; transform: none !important; transition: none !important; }
  * { scroll-behavior: auto !important; }
}
html { scroll-behavior: smooth; }
