:root {
  --paper: #F5F4F0;
  --surface: #FFFFFF;
  --surface-2: #FBFAF8;
  --ink: #191A1C;
  --ink-2: #45474D;
  --muted: #7A7C83;
  --line: #E2E0D9;
  --line-2: #D3D0C7;
  --accent: #1F4D40;
  --accent-soft: #E4EDE8;
  --warn: #8A5A12;
  --warn-soft: #FBF1DF;
  --danger: #9B2E2E;
  --danger-soft: #FBE9E9;
  --info: #22406B;
  --info-soft: #E7EEF8;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(20, 20, 20, .05);
  --shadow: 0 6px 24px rgba(20, 20, 20, .08);
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  --mono: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--paper);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 26px; line-height: 1.35; }
h2 { font-size: 19px; }
h3 { font-size: 15px; }
p { margin: 0 0 8px; }
button { font-family: inherit; font-size: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.wrap-narrow { max-width: 720px; margin: 0 auto; padding: 0 20px; }

/* 顶部导航 */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(245, 244, 240, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar-in { display: flex; align-items: center; gap: 16px; height: 58px; }
.logo { display: flex; align-items: center; gap: 9px; font-weight: 700; letter-spacing: .02em; }
.logo-mark {
  width: 26px; height: 26px; border-radius: 7px; background: var(--ink); color: #fff;
  display: grid; place-items: center; font-size: 13px; font-weight: 700;
}
.nav { display: flex; gap: 4px; margin-left: 12px; }
.nav a { padding: 6px 11px; border-radius: 8px; color: var(--ink-2); }
.nav a:hover { background: #EAE8E2; }
.nav a.on { background: var(--ink); color: #fff; }
.spacer { flex: 1; }

/* 模式提示条 */
.modebar {
  background: var(--warn-soft); color: var(--warn);
  border-bottom: 1px solid #EFE0C4; font-size: 12.5px;
}
.modebar-in { display: flex; gap: 10px; align-items: center; padding: 7px 20px; max-width: 1180px; margin: 0 auto; }

.btn {
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
  padding: 9px 15px; border-radius: 9px; border: 1px solid var(--line-2);
  background: var(--surface); color: var(--ink); font-weight: 550; transition: .15s;
}
.btn:hover { background: var(--surface-2); border-color: #B9B6AC; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.primary:hover { background: #2B2D31; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: #EDEBE5; }
.btn.danger { color: var(--danger); border-color: #E7C9C9; background: var(--danger-soft); }
.btn.sm { padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.btn.lg { padding: 12px 22px; font-size: 15px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

.tag {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px;
  background: #EEECE6; color: var(--ink-2); font-size: 12px; font-weight: 550;
}
.tag.demo { background: var(--warn-soft); color: var(--warn); }
.tag.ok { background: var(--accent-soft); color: var(--accent); }
.tag.bad { background: var(--danger-soft); color: var(--danger); }
.small.bad { color: var(--danger); }
.tag.info { background: var(--info-soft); color: var(--info); }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.pad { padding: 16px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mono { font-family: var(--mono); }
.row { display: flex; align-items: center; gap: 10px; }
.row-b { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.grid { display: grid; gap: 14px; }
.stack { display: flex; flex-direction: column; gap: 10px; }

label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-size: 12.5px; color: var(--ink-2); margin-bottom: 5px; font-weight: 550; }
input:not([type]), input[type="text"], input[type="email"], input[type="password"], textarea, select {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line-2); border-radius: 9px; background: var(--surface);
}
input:focus, textarea:focus, select:focus { outline: 2px solid #C9D8D2; outline-offset: 1px; border-color: var(--accent); }
textarea { resize: vertical; min-height: 76px; }

.hr { height: 1px; background: var(--line); margin: 14px 0; }

/* Toast */
#toasts { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: var(--ink); color: #fff; padding: 9px 15px; border-radius: 10px; font-size: 13.5px;
  box-shadow: var(--shadow); animation: up .18s ease; max-width: 90vw;
}
.toast.bad { background: var(--danger); }
.toast.good { background: var(--accent); }
@keyframes up { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Modal */
.modal-mask {
  position: fixed; inset: 0; background: rgba(18, 18, 20, .42); z-index: 150;
  display: grid; place-items: center; padding: 20px;
}
.modal {
  background: var(--surface); border-radius: 16px; max-width: 520px; width: 100%;
  box-shadow: var(--shadow); max-height: 88vh; overflow: auto;
}
.modal header { padding: 16px 18px 10px; }
.modal .body { padding: 4px 18px 16px; }
.modal footer { padding: 12px 18px 18px; display: flex; gap: 8px; justify-content: flex-end; }

/* 空状态 */
.empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty .big { font-size: 15px; color: var(--ink-2); margin-bottom: 6px; font-weight: 600; }

/* 表格 */
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); }
th { font-weight: 600; color: var(--ink-2); font-size: 12.5px; }
tbody tr:hover { background: var(--surface-2); }

.notice {
  border: 1px solid var(--line); border-left: 3px solid var(--info); background: var(--info-soft);
  padding: 10px 13px; border-radius: 8px; font-size: 13px; color: #16324F;
}
.notice.warn { border-left-color: var(--warn); background: var(--warn-soft); color: #6B4409; }
.notice.danger { border-left-color: var(--danger); background: var(--danger-soft); color: #7A2222; }
.notice.ok { border-left-color: var(--accent); background: var(--accent-soft); color: #123F34; }

@media (max-width: 720px) {
  .hide-sm { display: none !important; }
  h1 { font-size: 22px; }
  .wrap, .wrap-narrow { padding: 0 14px; }
  .nav { gap: 2px; }
  .nav a { padding: 6px 8px; font-size: 13px; }
}
/* Resource sheets: comfortable phone inputs and explicit color roles. */
.resource-form { gap: 16px; }
.resource-form label.field { margin-bottom: 0; }
.resource-form label.field > span { font-size: 14px; margin-bottom: 7px; }
.resource-form input:not([type]), .resource-form input[type="text"], .resource-form textarea { width: 100%; box-sizing: border-box; min-height: 48px; padding: 12px 14px; border: 1px solid #DADDD9; border-radius: 12px; background: #F8F9F7; font-size: 16px; }
.resource-form input:focus { background: #fff; }
.pack-colors { padding: 14px; background: #F5F6F3; border: 1px solid #E3E6E0; border-radius: 14px; }
.pack-color-toggle { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.pack-color-toggle input { width: 20px; height: 20px; }
.pack-color-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; margin: 12px 0; }
.pack-color-row { display: flex; align-items: center; gap: 8px; padding: 10px 6px; background: #fff; border-radius: 10px; min-width: 0; }
.pack-color-row input[type="color"] { flex: 0 0 42px; width: 42px; height: 44px; border: 1px solid #ddd; border-radius: 8px; padding: 3px; background: #fff; }
.pack-color-row b, .pack-color-row small, .color-code { display: block; }
.pack-color-row b { font-size: 13px; }
.pack-color-row small { font-size: 11px; color: #656B65; }
.color-code { font-size: 11px; color: #656B65; font-variant-numeric: tabular-nums; }
.pack-color-preview { border: 1px solid #ddd; border-radius: 10px; padding: 18px; margin-bottom: 10px; }
.material-picker { margin: 18px 0; }
.hub-main { padding-top:20px; padding-bottom:110px; }
.hub-hero { padding:24px 0 32px; }
.hub-hero .btn { min-height:52px; min-width:200px; }
.hub-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.hub-template { padding:12px; min-width:0; }
.hub-template h3 { font-size:16px; }
.hub-template .btn { display:flex; margin-top:8px; min-height:44px; }
.hub-preview { display:flex; align-items:center; justify-content:center; min-height:200px; background:#f3f5f1; border-radius:12px; overflow:hidden; }
.hub-preview canvas { max-width:100%; height:auto; }
.hub-section { margin-top:28px; }
.hub-menu { display:grid; gap:12px; margin-top:18px; }
.hub-menu a { display:flex; flex-direction:column; gap:6px; min-height:76px; padding:16px; border:1px solid #ddd; border-radius:14px; background:white; }
.hub-menu span { font-size:13px; color:#59615B; }
@media(min-width:721px){.hub-grid{grid-template-columns:repeat(3,minmax(0,1fr));}}
.creation-wizard [data-wizard-page][hidden] { display:none !important; }
.creation-wizard main { padding-bottom:170px; }
.creation-wizard #quick-upload { display:block; width:100%; min-height:144px; font-size:20px; border-radius:18px; }
.creation-wizard #quick-reuse { width:100%; min-height:48px; }
.creation-wizard #quick-photo { text-align:center; padding:16px 0; }
.creation-wizard #quick-photo img { display:block; margin:0 auto 12px !important; }
.creation-wizard #pick-auto, .creation-wizard #pick-create, .creation-wizard #mod-export-btn { display:none; }
.creation-wizard #conv-go { min-height:48px; }
.creation-wizard .step-number { display:none; }
.wizard-progress { font-size:16px; font-weight:700; padding:12px 0; }
.wizard-actions { position:fixed; z-index:50; left:0; right:0; bottom:calc(62px + env(safe-area-inset-bottom)); display:flex; gap:12px; padding:12px 16px; background:#fff; border-top:1px solid #ddd; }
.wizard-actions .btn { min-height:52px; font-size:16px; }
.wizard-actions .primary { flex:1; }
@media(min-width:721px) { .wizard-actions { bottom:0; justify-content:center; } .wizard-actions .primary { flex:0 1 480px; } }
.material-picker h3 { font-size: 16px; margin: 0 0 8px; }
.creation-step, .material-picker h3.creation-step { display:flex; align-items:center; gap:10px; margin:0 0 12px; font-size:16px; line-height:1.5; }
.step-number { display:inline-flex; align-items:center; justify-content:center; flex:0 0 28px; width:28px; height:28px; border-radius:50%; background:#202A24; color:#fff; font-size:14px; font-weight:700; }
.touch-disclosure > summary { display:flex; align-items:center; justify-content:space-between; gap:12px; box-sizing:border-box; width:100%; min-height:56px; padding:14px 16px; border:1px solid #DADDD9; border-radius:12px; background:#fff; color:var(--ink); font-size:16px; font-weight:600; line-height:1.5; cursor:pointer; list-style:none; touch-action:manipulation; }
.touch-disclosure > summary::-webkit-details-marker { display:none; }
.touch-disclosure > summary::after { content:'展开 ＋'; flex-shrink:0; color:#59615B; font-size:13px; font-weight:400; }
.touch-disclosure[open] > summary { background:#EFF5F2; border-color:#A5BAAE; margin-bottom:12px; }
.touch-disclosure[open] > summary::after { content:'收起 −'; }
.touch-disclosure > summary:focus-visible { outline:3px solid #537D68; outline-offset:3px; }
.material-details { margin-top:12px; }
#material-sets { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
#material-sets .chip { width:100%; min-height:48px; padding:12px; border-radius:12px; font-size:14px; line-height:1.4; white-space:normal; }
#material-sets .chip[aria-pressed="true"], .creation-wizard button[aria-pressed="true"] { background:#263A30; color:#fff; border-color:#263A30; box-shadow:inset 0 0 0 1px #263A30; }
.creation-wizard #conv-status { position:relative; padding:10px 0; }
.creation-wizard[data-creation-step="4"] main > section:first-of-type,
.creation-wizard[data-creation-step="5"] main > section:first-of-type { display:none; }
.material-options { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; margin-top: 10px; }
.material-option { display:flex; align-items:flex-start; gap:8px; padding:12px; border:1px solid var(--line); border-radius:12px; cursor:pointer; min-width:0; }
.material-option.selected { border-color:var(--accent); background:#EFF5F2; }
.material-option input { width:20px; height:20px; flex:0 0 20px; margin:2px 0; }
.material-option strong, .material-option small { display:block; }
.material-option small { margin-top:3px; font-size:11px; color:var(--muted); }
.order-wall { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; }
.order-art-card { padding:14px; min-width:0; }
.order-art-card h3 { margin:12px 0 4px; overflow-wrap:anywhere; }
.order-art-card .btn { min-height:44px; }
.order-art-card details { overflow-wrap:anywhere; }
.order-preview { display:flex; align-items:center; justify-content:center; gap:8px; min-height:180px; padding:10px; background:#f1f0eb; border-radius:10px; }
.order-preview-tile { flex:1; min-width:0; text-align:center; font-size:11px; }
.order-preview-tile canvas { display:block; max-width:100%; height:auto; margin:auto; }
.order-preview-tile span { display:block; margin-top:6px; }
@media(max-width:720px){ .order-wall { grid-template-columns:1fr; } }
