:root {
  --bean: #7bc24d;
  --bean-deep: #4e9630;
  --bean-soft: #cdeeb4;
  --bean-pale: #eef8e3;
  --cream: #fffaf1;
  --cream-2: #fff3dc;
  --ink: #383528;
  --ink-soft: #6f6a58;
  --sun: #ffb64d;
  --sun-deep: #f0962b;
  --rose: #ff9db1;
  --card: #ffffff;
  --line: #eee3cf;
  --shadow: 0 10px 30px rgba(122, 92, 41, 0.12);
  --shadow-sm: 0 4px 14px rgba(122, 92, 41, 0.10);
  --radius: 22px;
  --radius-sm: 14px;
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(900px 420px at 8% -5%, rgba(205, 238, 180, 0.75), transparent 60%),
    radial-gradient(800px 420px at 96% 4%, rgba(255, 237, 200, 0.9), transparent 55%),
    radial-gradient(700px 500px at 55% 110%, rgba(205, 238, 180, 0.45), transparent 60%),
    var(--cream);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 24px;
  background: rgba(255, 250, 241, 0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(238, 227, 207, 0.8);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 46px; height: 46px; display: grid; place-items: center; }
.brand-mark svg { width: 100%; height: 100%; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name {
  font-size: 21px; font-weight: 800; letter-spacing: 2px; color: var(--bean-deep);
}
.brand-sub { font-size: 11px; color: var(--ink-soft); letter-spacing: 1px; }
.header-actions { display: flex; align-items: center; gap: 10px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 700;
  transition: transform 0.12s ease, box-shadow 0.15s ease, background 0.15s ease;
  user-select: none;
}
.btn:active { transform: translateY(1px) scale(0.98); }
.btn-primary { background: linear-gradient(135deg, var(--bean), var(--bean-deep)); color: #fff; box-shadow: 0 6px 16px rgba(78, 150, 48, 0.35); }
.btn-primary:hover { box-shadow: 0 8px 20px rgba(78, 150, 48, 0.45); transform: translateY(-1px); }
.btn-sun { background: linear-gradient(135deg, var(--sun), var(--sun-deep)); color: #fff; box-shadow: 0 6px 16px rgba(240, 150, 43, 0.35); }
.btn-ghost { background: #fff; color: var(--ink); border: 1.5px solid var(--line); box-shadow: var(--shadow-sm); }
.btn-ghost:hover { border-color: var(--bean); color: var(--bean-deep); }
.btn-danger { background: #fff; color: #d64550; border: 1.5px solid #f3c9cd; box-shadow: var(--shadow-sm); }
.btn-danger:hover { background: #fff5f5; border-color: #e18b93; }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-block { width: 100%; }

.site-footer {
  margin-top: auto;
  text-align: center;
  padding: 26px 16px 30px;
  color: var(--ink-soft);
  font-size: 13px;
}

/* ---------- Home ---------- */
.home { max-width: 1080px; margin: 0 auto; padding: 8px 20px 40px; width: 100%; }
.hero {
  display: flex;
  align-items: center;
  gap: 28px;
  margin: 18px 0 26px;
  padding: 30px 34px;
  border-radius: 28px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(255, 243, 220, 0.85)),
    var(--cream-2);
  border: 1.5px solid rgba(238, 227, 207, 0.9);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: "";
  position: absolute;
  right: -70px; top: -70px;
  width: 220px; height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(205, 238, 180, 0.85), transparent 70%);
}
.hero-mark { width: 150px; height: 150px; flex: 0 0 auto; filter: drop-shadow(0 10px 16px rgba(122, 92, 41, 0.18)); }
.hero-mark svg { width: 100%; height: 100%; }
.hero-mark img { width: 100%; height: 100%; object-fit: cover; border-radius: 24px; border: 3px solid #fff; box-shadow: 0 4px 14px rgba(122, 92, 41, 0.18); }
.hero-copy { position: relative; z-index: 1; flex: 1; }
.hero-title { font-size: 30px; font-weight: 900; letter-spacing: 1px; color: var(--bean-deep); }
.hero-title .accent { color: var(--sun-deep); }
.hero-desc { margin-top: 8px; color: var(--ink-soft); font-size: 15px; line-height: 1.7; max-width: 560px; }
.hero-stats { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.stat-chip {
  background: #fff; border: 1.5px solid var(--line); border-radius: 999px;
  padding: 7px 14px; font-size: 13px; font-weight: 600; color: var(--ink);
  box-shadow: var(--shadow-sm);
}
.stat-chip b { color: var(--bean-deep); }

.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 8px 0 18px; }
.search-box {
  flex: 1; min-width: 220px; position: relative;
}
.search-box input {
  width: 100%;
  padding: 11px 16px 11px 40px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.search-box input:focus { border-color: var(--bean); box-shadow: 0 0 0 4px rgba(123, 194, 77, 0.16); }
.search-box::before {
  content: "🔍";
  position: absolute; left: 14px; top: 50%;
  transform: translateY(-50%);
  font-size: 14px; opacity: 0.7;
}
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  border: 1.5px solid var(--line); background: #fff; color: var(--ink-soft);
  border-radius: 999px; padding: 8px 15px; font-size: 13px; font-weight: 600;
  transition: all 0.14s ease;
}
.chip:hover { border-color: var(--bean); color: var(--bean-deep); }
.chip.active { background: var(--bean); border-color: var(--bean); color: #fff; box-shadow: 0 4px 12px rgba(123, 194, 77, 0.35); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(225px, 1fr));
  gap: 20px;
}
.card {
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
  position: relative;
  display: flex;
  flex-direction: column;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.card-thumb {
  aspect-ratio: 4 / 3;
  background: linear-gradient(135deg, var(--bean-pale), var(--cream-2));
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  cursor: pointer;
}
.card-thumb img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.card-spin-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.card-thumb .no-photo {
  font-size: 40px;
  opacity: 0.75;
  filter: drop-shadow(0 4px 8px rgba(122, 92, 41, 0.15));
}
.card-badge {
  position: absolute; top: 10px; left: 10px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px; font-weight: 700; color: var(--bean-deep);
  backdrop-filter: blur(4px);
}
.card-3d-badge {
  position: absolute; top: 10px; right: 10px;
  background: rgba(78, 150, 48, 0.92); color: #fff;
  padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; gap: 4px;
}
.card-body { padding: 13px 15px 15px; display: flex; flex-direction: column; gap: 6px; flex: 1; align-items: center; text-align: center; }
.card-name { font-size: 16px; font-weight: 800; }
.card-meta { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 12px; color: var(--ink-soft); }
.card-size { font-size: 12px; color: var(--bean-deep); font-weight: 700; }
.card-actions { display: flex; gap: 8px; margin-top: 4px; }
.card-actions .btn { flex: 1; padding: 7px 8px; font-size: 12.5px; }

/* ---------- 留言板 ---------- */
.guestbook {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 55;
  margin: 0; max-width: 100%;
  background: rgba(255, 255, 255, 0.96);
  border-top: 1.5px solid var(--line);
  padding: 8px 16px;
  box-shadow: 0 -4px 18px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; gap: 14px;
}
.guestbook h2 { font-size: 14px; font-weight: 800; margin: 0; flex: 0 0 auto; }
.guestbook-marquee {
  flex: 1; overflow: hidden; height: 56px; min-width: 0;
  border: 1.5px dashed var(--line); border-radius: 12px;
  background: var(--bean-pale); padding: 4px 10px;
}
.guestbook-track { animation: guestbookScroll 10s linear infinite; }
.guestbook-item {
  display: flex; align-items: center; gap: 10px;
  height: 26px; font-size: 13px; color: var(--ink-soft);
  white-space: nowrap; overflow: hidden;
}
.guestbook-item .guestbook-time {
  flex: 0 0 auto; font-size: 11px; color: var(--bean); font-weight: 700;
}
.guestbook-item .guestbook-who {
  flex: 0 0 auto; font-size: 12px; color: var(--sun-deep); font-weight: 800;
}
.guestbook-item .guestbook-text { overflow: hidden; text-overflow: ellipsis; }
.guestbook-form { display: flex; gap: 8px; flex: 0 0 auto; width: 300px; }
.guestbook-form input {
  flex: 1; padding: 9px 12px; border: 1.5px solid var(--line);
  border-radius: 999px; font-size: 13px; background: #fffdf8; outline: none;
  transition: border-color 0.15s ease;
}
.guestbook-form input:focus { border-color: var(--bean); }
.home { padding-bottom: 84px; }
@keyframes guestbookScroll {
  from { transform: translateY(0); }
  to { transform: translateY(-50%); }
}

.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--ink-soft);
}
.empty .empty-mark { width: 120px; margin: 0 auto 16px; opacity: 0.9; }
.empty h3 { color: var(--ink); font-size: 20px; margin-bottom: 6px; }
.empty p { font-size: 14px; line-height: 1.7; }

/* ---------- Upload ---------- */
.upload { max-width: 860px; margin: 0 auto; padding: 10px 20px 60px; width: 100%; }
.page-title { font-size: 26px; font-weight: 900; margin: 16px 0 4px; }
.page-sub { color: var(--ink-soft); font-size: 14px; margin-bottom: 18px; }
.steps { display: flex; gap: 10px; margin: 14px 0 24px; flex-wrap: wrap; }
.step {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 999px;
  background: #fff; border: 1.5px solid var(--line);
  font-size: 13px; font-weight: 700; color: var(--ink-soft);
}
.step .num {
  width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--bean-pale); color: var(--bean-deep);
  font-size: 12px;
}
.step.on { border-color: var(--bean); color: var(--bean-deep); box-shadow: var(--shadow-sm); }
.step.on .num { background: var(--bean); color: #fff; }

.panel {
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}
.panel h2 { font-size: 17px; font-weight: 800; margin-bottom: 4px; display: flex; align-items: center; gap: 8px; }
.panel .hint { font-size: 13px; color: var(--ink-soft); margin-bottom: 14px; line-height: 1.6; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 700; color: var(--ink); }
.field label .req { color: #e05d68; }
.field input, .field select, .field textarea {
  padding: 11px 13px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  font-size: 14px;
  background: #fffdf8;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--bean);
  box-shadow: 0 0 0 4px rgba(123, 194, 77, 0.15);
}
.field textarea { resize: vertical; min-height: 72px; }
.unit-suffix { position: relative; }
.unit-suffix input { padding-right: 40px; }
.unit-suffix::after {
  content: "cm";
  position: absolute; right: 13px; top: 50%;
  transform: translateY(-50%);
  font-size: 12px; color: var(--ink-soft); font-weight: 700;
}

.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; }
.photo-slot { position: relative; }
.photo-slot input[type="file"] { display: none; }
.photo-box {
  aspect-ratio: 1 / 1;
  border: 2px dashed #d8cbb0;
  border-radius: 16px;
  background: #fffdf6;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  color: var(--ink-soft);
  font-size: 12.5px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
  overflow: hidden;
  position: relative;
}
.photo-box:hover { border-color: var(--bean); background: var(--bean-pale); }
.photo-box .big { font-size: 26px; }
.photo-box.drag { border-color: var(--sun-deep); background: var(--cream-2); transform: scale(1.02); }
.photo-box.has-photo { border-style: solid; border-color: var(--line); }
.photo-box.has-photo:hover { background: #fff; }
.photo-box img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo-label {
  margin-top: 6px; text-align: center; font-size: 12.5px; font-weight: 700; color: var(--ink-soft);
}
.photo-remove {
  position: absolute; top: 6px; right: 6px; z-index: 2;
  width: 26px; height: 26px; border-radius: 50%;
  border: none; background: rgba(255, 255, 255, 0.94);
  color: #d64550; font-size: 14px; font-weight: 800;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  display: none;
}
.photo-box.has-photo ~ .photo-remove, .has-photo .photo-remove { display: grid; place-items: center; }

.mode-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.mode-card {
  border: 2px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.14s ease;
  background: #fffdf8;
}
.mode-card:hover { border-color: var(--bean); }
.mode-card.on { border-color: var(--bean); background: var(--bean-pale); box-shadow: 0 0 0 4px rgba(123, 194, 77, 0.14); }
.mode-card .icon { font-size: 26px; }
.mode-card h3 { font-size: 15px; margin: 6px 0 4px; }
.mode-card p { font-size: 12px; color: var(--ink-soft); line-height: 1.5; }

.ai-panel { display: none; margin-top: 16px; padding: 18px; background: #fffdf6; border: 1.5px dashed #d8cbb0; border-radius: 16px; }
.ai-panel.show { display: block; }
.ai-status-row { display: flex; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.progress-wrap { flex: 1; min-width: 200px; height: 12px; border-radius: 999px; background: #eee4d0; overflow: hidden; }
.progress-bar { height: 100%; width: 0%; border-radius: 999px; background: linear-gradient(90deg, var(--bean), var(--sun)); transition: width 0.4s ease; }
.ai-status { font-size: 13px; color: var(--ink-soft); }
.ai-note { font-size: 12.5px; color: var(--ink-soft); line-height: 1.7; margin-top: 10px; }
.ai-note b { color: var(--bean-deep); }
.file-picked { display: none; margin-top: 12px; padding: 12px 14px; border-radius: 12px; background: var(--bean-pale); font-size: 13px; font-weight: 700; color: var(--bean-deep); }
.file-picked.show { display: flex; align-items: center; gap: 8px; }
.upload-model-box {
  display: flex; align-items: center; gap: 16px;
  margin-top: 14px; padding: 26px 22px;
  border: 2px dashed #d8cbb0; border-radius: 16px;
  background: #fffdf6; cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
}
.upload-model-box:hover, .upload-model-box.drag { border-color: var(--bean); background: var(--bean-pale); transform: scale(1.01); }
.upload-model-box .icon { font-size: 34px; }
.upload-model-box .upload-model-copy { display: flex; flex-direction: column; gap: 3px; }
.upload-model-box .upload-model-copy b { font-size: 15px; color: var(--ink); }
.upload-model-box .upload-model-copy span { font-size: 12.5px; color: var(--ink-soft); }
.save-bar {
  display: flex; justify-content: flex-end; gap: 10px;
  margin-top: 16px;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 16px;
  padding: 10px 14px;
  box-shadow: var(--shadow-sm);
}

/* ---------- Item viewer ---------- */
.item-page { max-width: 1240px; margin: 0 auto; padding: 10px 20px 40px; width: 100%; }
.item-top { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 10px 0 16px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--ink-soft); font-size: 14px; }
.back-link:hover { color: var(--bean-deep); }
.item-title { font-size: 24px; font-weight: 900; }
.cat-tag {
  background: var(--bean-pale); color: var(--bean-deep);
  padding: 4px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 700;
}
.size-tag {
  background: var(--cream-2); color: var(--sun-deep);
  padding: 4px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 700;
}
.item-actions { margin-left: auto; display: flex; gap: 8px; }

.update-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: linear-gradient(135deg, #fff1df, #ffe9c2);
  border: 1.5px solid #f3d9a4;
  border-radius: 16px;
  padding: 10px 14px 10px 18px;
  margin: 0 0 14px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--sun-deep);
  box-shadow: var(--shadow-sm);
}

.viewer-layout { display: grid; grid-template-columns: minmax(0, 1fr) 230px; gap: 14px; align-items: start; }
.viewer-stage {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1.5px solid var(--line);
  background:
    radial-gradient(560px 340px at 50% 10%, rgba(255, 255, 255, 0.5), transparent 62%),
    linear-gradient(180deg, #dde7f0, #c7d3e2);
  box-shadow: var(--shadow);
  min-height: 560px;
}
.viewer-stage canvas { display: block; width: 100%; height: 100%; min-height: 560px; }
.viewer-toolbar {
  position: absolute; top: 12px; left: 12px; right: 12px;
  display: flex; flex-wrap: wrap; gap: 8px;
  z-index: 5;
}
.tool-btn {
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 12.5px;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  transition: all 0.12s ease;
}
.tool-btn:hover { border-color: var(--bean); color: var(--bean-deep); }
.tool-btn.on { background: var(--bean); border-color: var(--bean); color: #fff; }
.tool-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.speed-wrap { display: none; align-items: center; gap: 6px; }
.speed-wrap.show { display: inline-flex; }
.speed-wrap input { width: 90px; accent-color: var(--bean); }

.viewer-hint {
  position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 12px;
  z-index: 5;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}
.viewer-empty {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  color: var(--ink-soft);
}
.viewer-empty-mark { font-size: 52px; opacity: 0.55; }
.viewer-empty p { font-size: 15px; font-weight: 700; }
.viewer-loading {
  position: absolute; inset: 0; z-index: 4;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(3px);
  color: var(--ink-soft);
}
.viewer-loading p { font-size: 14px; font-weight: 700; }
.viewer-loading .spinner {
  width: 34px; height: 34px;
  border: 3px solid var(--bean-pale);
  border-top-color: var(--bean);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.true-scale-badge {
  position: absolute; top: 58px; left: 12px; z-index: 5;
  background: rgba(78, 150, 48, 0.95); color: #fff;
  border-radius: 12px; padding: 8px 12px; font-size: 12px; font-weight: 700;
  display: none; box-shadow: 0 4px 14px rgba(78, 150, 48, 0.35); line-height: 1.5;
}
.true-scale-badge.show { display: block; }
.measure-tip {
  position: absolute; bottom: 46px; left: 50%; transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.95);
  border-radius: 12px; border: 1px solid var(--line);
  padding: 8px 14px; font-size: 12.5px; color: var(--ink);
  box-shadow: var(--shadow-sm); z-index: 5;
  display: none;
}
.measure-tip.show { display: block; }

.side-panel { display: flex; flex-direction: column; gap: 14px; }
.side-card {
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.side-card h3 { font-size: 14px; font-weight: 800; margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }
.side-photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.side-photo {
  aspect-ratio: 1; border-radius: 10px; overflow: hidden;
  border: 1.5px solid var(--line); cursor: zoom-in;
  background: var(--bean-pale);
}
.side-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.side-photo .no-img { width: 100%; height: 100%; display: grid; place-items: center; font-size: 20px; opacity: 0.5; }
.side-info { font-size: 13px; line-height: 1.9; color: var(--ink-soft); }
.side-info b { color: var(--ink); }
.side-note-inline {
  margin-top: 8px; padding-top: 8px;
  border-top: 1px dashed var(--line);
  line-height: 1.7; white-space: pre-wrap;
}
.side-note { font-size: 13px; line-height: 1.7; color: var(--ink-soft); white-space: pre-wrap; }
.src-chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700; background: var(--bean-pale); color: var(--bean-deep); }
.src-chip.ai { background: #fff1df; color: var(--sun-deep); }
.src-chip.local { background: #e9f0ff; color: #3d6fd6; }
.src-chip.hunyuan { background: #eaf3ff; color: #2f6fb8; }
.src-chip.demo { background: #fdeef1; color: #d64550; }

/* ---------- Modals & toast ---------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(46, 42, 28, 0.45);
  display: grid; place-items: center;
  padding: 20px;
  animation: fadeIn 0.18s ease;
}
.modal {
  background: #fff;
  border-radius: 22px;
  max-width: 520px;
  width: 100%;
  padding: 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  animation: popIn 0.2s ease;
  max-height: 90vh;
  overflow: auto;
}
.modal h3 { font-size: 18px; font-weight: 800; margin-bottom: 10px; }
.modal p { font-size: 14px; color: var(--ink-soft); line-height: 1.7; margin-bottom: 12px; }
.modal .cal-row { margin: 14px 0; }
.modal .cal-slider { width: 100%; accent-color: var(--bean); }
.modal .cal-card-preview {
  margin: 10px auto;
  width: 170px; height: 107px;
  background: linear-gradient(135deg, #f4d9c0, #e8c39e);
  border-radius: 10px;
  border: 1.5px solid #d8a877;
  display: grid; place-items: center;
  color: #a9794c; font-size: 12px; font-weight: 800; letter-spacing: 1px;
  box-shadow: 0 6px 16px rgba(0,0,0,0.12);
}
.modal-btns { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.upload-modal { max-width: 600px; }
.upload-modal { padding-top: 6px; position: relative; }
.upload-modal .upload { padding: 0; }
.upload-modal-head { display: flex; align-items: center; justify-content: center; position: relative; margin-bottom: 14px; }
.upload-modal-title { font-size: 20px; font-weight: 900; margin: 0; }
.modal-close {
  width: 30px; height: 30px; border-radius: 50%;
  border: none; background: var(--cream-2); color: var(--ink-soft);
  font-size: 18px; line-height: 1; cursor: pointer;
  display: grid; place-items: center;
  transition: all 0.12s ease; flex: 0 0 auto;
}
.modal-close:hover { background: #f3d9a4; color: var(--sun-deep); }
.upload-modal .modal-close {
  position: absolute; top: 0; right: -4px;
}
/* 上传弹窗内容紧凑，减少整体高度 */
.upload-modal .page-sub { margin: 2px 0 10px; font-size: 13px; }
.upload-modal .panel { padding: 12px 14px; margin-bottom: 10px; }
.upload-modal .panel h2 { font-size: 14px; margin-bottom: 16px; }
.upload-modal .panel .hint { font-size: 12.5px; margin-bottom: 8px; }
.upload-modal .form-row { gap: 12px; }
.upload-modal .field { gap: 6px; margin-bottom: 10px; }
.upload-modal .field input, .upload-modal .field textarea { padding: 8px 11px; font-size: 13px; }
.upload-modal .field textarea { min-height: 48px; }
.upload-modal .upload-model-box { margin-top: 6px; padding: 13px 15px; }
.upload-modal .save-bar { margin-top: 10px; }
.upload-modal .file-picked { margin-top: 8px; }
.lightbox {
  position: fixed; inset: 0; z-index: 110;
  background: rgba(25, 23, 15, 0.88);
  display: grid; place-items: center;
  padding: 30px;
  cursor: zoom-out;
}
.lightbox img { max-width: 92vw; max-height: 88vh; border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,0.5); }

.toast-root { position: fixed; bottom: 24px; 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: 11px 20px; border-radius: 999px;
  font-size: 13.5px; font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  animation: toastIn 0.22s ease;
  max-width: 90vw;
}
.toast.ok { background: var(--bean-deep); }
.toast.err { background: #d64550; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: scale(0.94) translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ---------- 生成照片（单选） ---------- */
.gen-photo-row { display: flex; gap: 16px; align-items: center; margin-top: 14px; flex-wrap: wrap; }
.photo-slot.single { width: 190px; flex: 0 0 auto; }
.photo-slot.single .photo-box { aspect-ratio: 1; }
.gen-photo-tip { flex: 1; min-width: 220px; font-size: 12.5px; color: var(--ink-soft); line-height: 1.7; }

/* ---------- 故事长廊 ---------- */
.gallery-page { max-width: 1280px; margin: 0 auto; padding: 10px 20px 40px; width: 100%; }
.gallery-head { margin: 10px 0 16px; }
.gallery-head .back-link { margin-bottom: 8px; }
.gallery-head .page-sub { margin-top: 6px; }
.gallery-stage {
  position: relative;
  height: calc(100vh - 220px);
  min-height: 520px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1.5px solid var(--line);
  background:
    radial-gradient(560px 340px at 50% 10%, rgba(255, 255, 255, 0.5), transparent 62%),
    linear-gradient(180deg, #dde7f0, #c7d3e2);
  box-shadow: var(--shadow);
}
.gallery-stage canvas { display: block; width: 100%; height: 100%; }
.gallery-empty {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: rgba(255, 255, 255, 0.95); border: 1.5px solid var(--line);
  border-radius: 16px; padding: 20px 28px; font-size: 14px; color: var(--ink-soft);
  z-index: 5; display: none; box-shadow: var(--shadow);
}
.gallery-empty.show { display: block; }
.gallery-loading {
  position: absolute; top: 16px; left: 50%; transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.94); border: 1px solid var(--line);
  border-radius: 999px; padding: 7px 16px;
  font-size: 12.5px; color: var(--ink-soft); font-weight: 700;
  z-index: 5; box-shadow: var(--shadow-sm);
}

/* ---------- 小音乐播放器 ---------- */
.music-player {
  position: fixed; right: 14px; top: 25%; transform: translateY(-50%);
  z-index: 60;
  width: 54px; height: 54px;
  background: rgba(255, 255, 255, 0.96);
  border: 1.5px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
  display: flex; flex-direction: column;
  overflow: hidden;
  transition: width 0.28s ease, height 0.28s ease;
}
.music-player:hover { width: 178px; height: auto; }
.music-tab {
  width: 54px; height: 54px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; cursor: pointer; flex: 0 0 auto;
  touch-action: none; user-select: none; -webkit-user-select: none;
  transition: all 0.25s ease;
}
.music-player:hover .music-tab {
  width: 100%; height: 26px; font-size: 14px;
  justify-content: flex-start; padding: 0 12px;
}
.music-body {
  width: 178px; padding: 2px 12px 12px;
  display: flex; flex-direction: column; gap: 8px;
  flex-shrink: 0;
  opacity: 0; visibility: hidden;
  transition: opacity 0.22s ease, visibility 0.22s;
}
.music-player:hover .music-body { opacity: 1; visibility: visible; }
.music-top { display: flex; align-items: center; gap: 6px; min-width: 0; }
.music-icon { font-size: 15px; flex: 0 0 auto; }
.music-title {
  font-size: 11.5px; font-weight: 700; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1;
  display: inline-block; min-width: 0;
}
.music-title.scroll { animation: musicMarquee 6s linear infinite; }
.mq-copy { display: inline-block; white-space: nowrap; }
.music-btns { display: flex; align-items: center; justify-content: space-between; }
.music-btn {
  width: 28px; height: 28px; border-radius: 50%;
  border: 1px solid var(--line); background: #fff;
  color: var(--ink); font-size: 12px; cursor: pointer;
  display: grid; place-items: center;
  transition: all 0.12s ease;
}
.music-btn:hover { border-color: var(--bean); color: var(--bean-deep); }
.music-btn.play { background: var(--bean); border-color: var(--bean); color: #fff; }
.music-btn.play.need-tap { animation: musicPulse 1.2s infinite; }
.music-volume { display: flex; align-items: center; gap: 6px; }
.vol-icon { font-size: 11px; }
.music-volume input[type="range"] { flex: 1; height: 4px; accent-color: var(--bean); }
.music-playlist {
  max-height: 160px; overflow-y: auto;
  border-top: 1px dashed var(--line);
  padding-top: 8px; margin-top: 2px;
  display: flex; flex-direction: column; gap: 4px;
}
.music-item {
  display: flex; align-items: center; gap: 4px; min-width: 0;
  font-size: 11.5px; color: var(--ink-soft);
  padding: 5px 8px; border-radius: 8px;
  cursor: pointer;
  transition: background 0.12s ease;
}
.music-item:hover { background: var(--bean-pale); color: var(--bean-deep); }
.music-item.playing { background: var(--bean-pale); color: var(--bean-deep); font-weight: 700; }
.music-item-mark { flex: 0 0 auto; width: 12px; font-size: 10px; }
.music-item-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: inline-block; }
.music-item.scroll .music-item-name { animation: musicMarquee 5s linear infinite; }
.music-builtin { margin-left: auto; flex: 0 0 auto; font-size: 10px; color: var(--bean); border: 1px solid var(--bean); border-radius: 999px; padding: 0 5px; }
@keyframes musicPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(123, 194, 77, 0.45); }
  50% { box-shadow: 0 0 0 6px rgba(123, 194, 77, 0); }
}
@keyframes musicMarquee {
  from { transform: translateX(var(--scroll-dist, -40px)); }
  to { transform: translateX(0); }
}

/* ---------- 管理后台 ---------- */
.admin-body { background: #f6f1e6; }
.admin-login {
  min-height: 100vh; display: grid; place-items: center; padding: 20px;
}
.admin-login-card {
  width: 100%; max-width: 380px;
  background: #fff; border: 1.5px solid var(--line); border-radius: 22px;
  padding: 32px 28px; text-align: center; box-shadow: var(--shadow);
}
.admin-login-logo { font-size: 46px; margin-bottom: 10px; }
.admin-login-card h1 { font-size: 20px; font-weight: 900; margin-bottom: 6px; }
.admin-login-card p { color: var(--ink-soft); font-size: 13.5px; margin-bottom: 18px; }
.admin-login-form { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.admin-login-form input {
  padding: 11px 14px; border: 1.5px solid var(--line); border-radius: 12px;
  font-size: 14px; background: #fffdf8; outline: none; text-align: center;
}
.admin-login-form input:focus { border-color: var(--bean); }
.admin {
  max-width: 900px; margin: 0 auto; padding: 14px 16px 40px;
}
.admin-header {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 0 14px; flex-wrap: wrap;
}
.admin-header .brand-name { font-size: 17px; font-weight: 900; color: var(--bean-deep); }
.admin-header-actions { display: flex; gap: 8px; }
.admin-tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.admin-tab {
  padding: 9px 16px; border-radius: 999px; border: 1.5px solid var(--line);
  background: #fff; font-size: 13.5px; font-weight: 700; color: var(--ink-soft);
  cursor: pointer; transition: all 0.12s ease;
}
.admin-tab:hover { border-color: var(--bean); color: var(--bean-deep); }
.admin-tab.on { background: var(--bean); border-color: var(--bean); color: #fff; }
.admin-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.admin-tip { font-size: 12px; color: var(--ink-soft); }
.admin-list { display: flex; flex-direction: column; gap: 10px; }
.admin-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: #fff; border: 1.5px solid var(--line); border-radius: 14px;
  padding: 12px 14px; box-shadow: var(--shadow-sm); flex-wrap: wrap;
}
.admin-row-main { flex: 1; min-width: 160px; }
.admin-row-name { font-size: 14.5px; font-weight: 800; color: var(--ink); word-break: break-all; }
.admin-row-meta { font-size: 12px; color: var(--ink-soft); margin-top: 3px; }
.admin-row-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.music-drag { flex: 0 0 auto; cursor: grab; color: var(--ink-soft); font-size: 17px; line-height: 1; padding: 2px 4px; user-select: none; -webkit-user-select: none; }
.admin-row.dragging { opacity: 0.45; }
.admin-empty {
  text-align: center; color: var(--ink-soft); font-size: 14px;
  padding: 40px 0; background: #fff; border: 1.5px dashed var(--line);
  border-radius: 14px;
}
.admin-loading { text-align: center; color: var(--ink-soft); padding: 40px 0; }
.admin-msg-input {
  flex: 1; min-width: 200px; padding: 9px 13px;
  border: 1.5px solid var(--line); border-radius: 999px;
  font-size: 13px; background: #fffdf8; outline: none;
}
.admin-msg-input:focus { border-color: var(--bean); }
.upload-progress {
  display: flex; align-items: center; gap: 10px;
  margin-top: 10px;
}
.upload-progress-bar {
  flex: 1; height: 10px; border-radius: 999px;
  background: linear-gradient(90deg, var(--bean), var(--sun));
  width: 0;
  transition: width 0.2s ease;
  position: relative;
}
.upload-progress-text {
  flex: 0 0 auto; font-size: 12px; font-weight: 700; color: var(--bean-deep);
  min-width: 36px; text-align: right;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .viewer-layout { grid-template-columns: 1fr; }
  .hero { flex-direction: column; text-align: center; padding: 24px; }
  .hero-desc { margin-inline: auto; }
  .hero-stats { justify-content: center; }
  .hero-mark { width: 110px; height: 110px; }
  .viewer-stage, .viewer-stage canvas { min-height: 420px; }
  .gallery-stage { min-height: 420px; height: 68vh; }
  .brand-sub { display: none; }
  .item-actions { margin-left: 0; }
  .music-player { right: 8px; }
  .admin { padding: 10px 12px 32px; }
  .admin-row { flex-direction: column; align-items: stretch; }
  .admin-row-actions { justify-content: flex-end; }
}
@media (max-width: 560px) {
  .site-header { padding: 10px 14px; }
  .brand-name { font-size: 18px; }
  .header-actions .btn { padding: 8px 12px; font-size: 12px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
  .hero-title { font-size: 24px; }
  .viewer-hint { display: none; }
  .viewer-toolbar { top: 8px; left: 8px; right: 8px; gap: 6px; }
  .tool-btn { padding: 6px 9px; font-size: 11.5px; }
  .viewer-stage, .viewer-stage canvas { min-height: 340px; }
  .side-panel { gap: 10px; }
  .side-card { padding: 12px; }
  .item-page { padding: 6px 12px 30px; }
  .item-top { gap: 8px; margin: 6px 0 12px; }
  .item-title { font-size: 20px; }
  .gallery-stage { min-height: 320px; height: 60vh; }
  .guestbook { flex-direction: column; gap: 6px; align-items: stretch; padding: 8px 10px; }
  .guestbook h2 { display: none; }
  .guestbook-marquee { width: 100%; flex: none; height: 55px; }
  .guestbook-item { height: 22px; font-size: 12px; }
  .guestbook-form { width: 100%; flex: none; display: flex; gap: 6px; }
  .guestbook-form input { padding: 7px 10px; font-size: 12px; }
  .guestbook-form .btn { padding: 6px 10px; font-size: 12px; }
  .home { padding-bottom: 118px; }
  .hero { padding: 18px 14px; }
  .hero-mark { width: 88px; height: 88px; }
  .hero-desc { font-size: 13.5px; }
  .stat-chip { padding: 5px 10px; font-size: 12px; }
  .page-sub { font-size: 13px; }
  .admin-header .brand-name { font-size: 14px; }
  .admin-tab { padding: 8px 12px; font-size: 12.5px; }
  .upload-modal { max-width: 100%; }
  .modal { padding: 16px; }
}

/* 触摸设备：移除点击高亮，按钮更易点按 */
@media (hover: none), (pointer: coarse) {
  * { -webkit-tap-highlight-color: transparent; }
  .tool-btn, .music-btn, .chip, .btn { min-height: 38px; }
  .music-btn { width: 34px; height: 34px; }
}
