/* R88 电子画册 H5 */
:root {
  --primary: #1A56DB;
  --accent: #F97316;
  --dark: #0F172A;
  --text: #1E293B;
  --text-secondary: #64748B;
  --bg: #F1F5F9;
  --card: #fff;
  --radius: 16px;
  --tabbar-h: 56px;
  --contact-footer-h: 58px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, 'PingFang SC', sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}
body.has-tab-bar { padding-bottom: calc(var(--tabbar-h) + var(--contact-footer-h) + env(safe-area-inset-bottom, 0)); }
body.tab-hidden { padding-bottom: calc(var(--contact-footer-h) + env(safe-area-inset-bottom, 0)); }
.hidden { display: none !important; }

.app { max-width: 480px; margin: 0 auto; min-height: 100vh; }
.panel { padding-bottom: 16px; }

.hero-card {
  margin: 16px; padding: 24px; border-radius: var(--radius);
  background: linear-gradient(135deg, var(--primary), #3730A3); color: #fff;
}
.hero-card h1 { margin: 0 0 8px; font-size: 22px; }
.hero-card p { margin: 0; opacity: 0.9; font-size: 14px; }

.search-row { padding: 0 16px 12px; }
.search-row input { width: 100%; border: 0; border-radius: 999px; padding: 12px 16px; font-size: 14px; }

.filter-tabs { display: flex; gap: 8px; padding: 0 16px 12px; overflow-x: auto; }
.filter-tab { border: 0; background: var(--card); padding: 8px 16px; border-radius: 999px; font-size: 12px; white-space: nowrap; cursor: pointer; }
.filter-tab.active { background: var(--primary); color: #fff; }

.shelf-scroll { display: flex; gap: 20px; padding: 8px 16px 24px; overflow-x: auto; scroll-snap-type: x mandatory; }
.book-3d {
  flex-shrink: 0; width: 160px; scroll-snap-align: start; cursor: pointer;
  transform: perspective(800px) rotateY(-14deg) rotateX(4deg);
  transition: transform 0.25s;
}
.book-3d:active { transform: perspective(800px) rotateY(-6deg) scale(0.98); }
.book-3d { position: relative; }
.book-spine { position: absolute; left: -6px; top: 6px; bottom: 6px; width: 10px; background: #334155; border-radius: 3px 0 0 3px; }
.book-3d img { width: 160px; height: 220px; object-fit: cover; border-radius: 6px 12px 12px 6px; box-shadow: -6px 10px 20px rgba(0,0,0,0.22); display: block; }
.book-info { margin-top: 12px; transform: none; }
.book-info strong { display: block; font-size: 13px; line-height: 1.3; }
.book-info small { color: var(--text-secondary); font-size: 11px; }
.progress { height: 4px; background: #E2E8F0; border-radius: 2px; margin-top: 6px; overflow: hidden; }
.progress div { height: 100%; background: var(--primary); }

.masonry { column-count: 2; column-gap: 12px; padding: 0 16px; }
.m-card { break-inside: avoid; margin-bottom: 12px; padding: 0; overflow: hidden; cursor: pointer; }
.m-card img { width: 100%; height: 140px; object-fit: cover; display: block; }
.m-card h4 { margin: 10px 12px 4px; font-size: 14px; }
.m-card small { display: block; padding: 0 12px 12px; color: var(--text-secondary); font-size: 11px; }

.tpl-grid { display: flex; flex-wrap: wrap; gap: 12px; padding: 0 16px; }
.tpl-card { width: calc(50% - 6px); border: 0; background: var(--card); border-radius: var(--radius); overflow: hidden; text-align: left; cursor: pointer; box-shadow: 0 4px 16px rgba(0,0,0,0.06); padding: 0; }
.tpl-card img { width: 100%; height: 140px; object-fit: cover; display: block; }
.tpl-card strong, .tpl-card small { display: block; padding: 8px 12px 0; font-size: 13px; }
.tpl-card small { color: var(--text-secondary); padding-bottom: 12px; font-size: 11px; }

.card { background: var(--card); border-radius: var(--radius); margin: 0 16px 12px; padding: 16px; box-shadow: 0 4px 16px rgba(26,86,219,0.06); }
.section-title { padding: 8px 16px; font-size: 15px; margin: 0; font-weight: 600; }

.profile-hero { text-align: center; padding: 32px 20px; background: linear-gradient(135deg, var(--primary), #3730A3); color: #fff; margin-bottom: 0; }
.profile-hero .avatar { font-size: 48px; display: block; }
.stats-row { display: flex; text-align: center; }
.stats-row div { flex: 1; }
.stats-row strong { display: block; font-size: 22px; color: var(--primary); }
.stats-row span { font-size: 11px; color: var(--text-secondary); }
.mine-row { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid #E2E8F0; cursor: pointer; align-items: center; }
.mine-row img { width: 48px; height: 66px; object-fit: cover; border-radius: 6px; }

.sub-header { display: flex; align-items: center; gap: 12px; padding: 16px; background: var(--dark); color: #fff; }
.sub-back { border: 0; background: rgba(255,255,255,0.12); color: #fff; padding: 8px 12px; border-radius: 8px; cursor: pointer; font-size: 13px; }

.reader-stage { position: relative; background: var(--dark); padding: 16px; min-height: 420px; display: flex; align-items: center; justify-content: center; }
.flipbook { width: 100%; max-width: 360px; margin: 0 auto; }
.flipbook .album-page { background: #1e293b; }
.page-inner { width: 100%; height: 100%; min-height: 420px; background-size: cover; background-position: center; border-radius: 8px; }
.flipbook--swipe .swipe-page { width: 100%; min-height: 420px; background-size: contain; background-repeat: no-repeat; background-position: center; border-radius: 8px; }

.hotspot-layer { position: absolute; inset: 16px; max-width: 360px; margin: 0 auto; left: 0; right: 0; pointer-events: none; }
.hotspot { position: absolute; width: 28px; height: 28px; margin: -14px 0 0 -14px; border: 0; background: none; pointer-events: auto; cursor: pointer; padding: 0; }
.hotspot .pulse { display: block; width: 100%; height: 100%; border-radius: 50%; background: rgba(249,115,22,0.9); animation: pulse 1.5s ease infinite; box-shadow: 0 0 0 6px rgba(249,115,22,0.25); }
@keyframes pulse { 0%,100%{ transform: scale(1); } 50%{ transform: scale(1.12); } }

.thumb-bar { display: flex; gap: 8px; padding: 12px 16px; overflow-x: auto; background: rgba(15,23,42,0.95); }
.thumb { width: 48px; height: 64px; object-fit: cover; border-radius: 4px; opacity: 0.45; cursor: pointer; flex-shrink: 0; }
.thumb.active { opacity: 1; border: 2px solid var(--primary); }

.reader-toolbar { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 12px 16px; background: var(--dark); color: #94A3B8; font-size: 13px; }

.btn-primary { background: var(--primary); color: #fff; border: 0; border-radius: 999px; padding: 12px 24px; font-size: 15px; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-block; text-align: center; }
.btn-primary.btn-full, .btn-outline.btn-full { width: 100%; display: block; }
.btn-outline { background: transparent; border: 1px solid var(--primary); color: var(--primary); border-radius: 999px; padding: 10px 20px; cursor: pointer; margin-top: 8px; }
.btn-sm { padding: 8px 14px; font-size: 12px; }
.reader-toolbar .btn-outline { color: #fff; border-color: rgba(255,255,255,0.35); margin: 0; }

.tab-bar {
  position: fixed; left: 0; right: 0; bottom: calc(var(--contact-footer-h) + env(safe-area-inset-bottom, 0));
  max-width: 480px; margin: 0 auto; height: var(--tabbar-h);
  display: flex; background: var(--card); border-top: 1px solid #E2E8F0; z-index: 50;
}
.tab-bar.hidden { display: none; }
.tab-bar-item { flex: 1; border: 0; background: none; font-size: 10px; color: var(--text-secondary); cursor: pointer; padding-top: 6px; }
.tab-bar-item span { display: block; font-size: 20px; margin-bottom: 2px; }
.tab-bar-item.active { color: var(--primary); font-weight: 600; }

.modal { position: fixed; inset: 0; z-index: 200; display: flex; align-items: flex-end; justify-content: center; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.45); }
.modal__sheet { position: relative; background: var(--card); width: 100%; max-width: 480px; border-radius: 16px 16px 0 0; padding: 20px 20px calc(20px + env(safe-area-inset-bottom)); max-height: 85vh; overflow: auto; }
.modal__close { position: absolute; top: 12px; right: 16px; border: 0; background: none; font-size: 24px; cursor: pointer; }
.modal .price { color: var(--accent); font-size: 20px; font-weight: 700; }
.lead-form label { display: block; margin-bottom: 12px; font-size: 13px; font-weight: 600; }
.lead-form input, .lead-form textarea { width: 100%; margin-top: 6px; border: 1px solid #E2E8F0; border-radius: 8px; padding: 10px; font-size: 14px; }

.toast { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background: rgba(0,0,0,0.78); color: #fff; padding: 12px 20px; border-radius: 8px; z-index: 300; }
.empty-tip { text-align: center; color: var(--text-secondary); padding: 24px; font-size: 14px; }

.contact-footer {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  background: var(--card); border-top: 1px solid #E2E8F0; padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0));
  max-width: 480px; margin: 0 auto;
}
.contact-footer__btns { display: flex; gap: 8px; }
.contact-footer__cta { flex: 1; text-align: center; background: var(--primary); color: #fff !important; padding: 10px; border-radius: 999px; font-size: 13px; font-weight: 600; text-decoration: none; }
.contact-footer__btn { flex: 1; text-align: center; background: var(--bg); padding: 10px; border-radius: 999px; font-size: 13px; border: 0; cursor: pointer; text-decoration: none; color: inherit; }
.contact-footer__brand { margin: 6px 0 0; text-align: center; font-size: 10px; color: var(--text-secondary); }

.share-page { min-height: 100vh; display: flex; align-items: flex-start; justify-content: center; padding: 24px 16px calc(24px + var(--contact-footer-h)); }
.share-card { max-width: 400px; text-align: center; width: 100%; padding-top: 12px; }
.share-card h1 { font-size: 24px; margin: 0 0 6px; }
.share-card__eyebrow { margin: 0 0 12px; font-size: 13px; font-weight: 700; color: var(--primary); }
.share-logo-wrap { font-size: 48px; margin-bottom: 8px; }
.share-card__tagline { margin: 0 0 8px; font-size: 14px; color: var(--text-secondary); }
.share-card__desc { margin: 0 0 16px; font-size: 13px; color: var(--text-secondary); line-height: 1.6; text-align: left; }
.share-stats { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-bottom: 16px; }
.share-stat { background: var(--card); border-radius: 10px; padding: 10px 6px; box-shadow: 0 2px 8px rgba(26,86,219,0.06); }
.share-stat strong { display: block; font-size: 18px; color: var(--primary); }
.share-stat span { font-size: 11px; color: var(--text-secondary); }
.share-book-list { list-style: none; margin: 0 0 16px; padding: 0; text-align: left; }
.share-book-list li { display: flex; justify-content: space-between; gap: 8px; padding: 10px 0; border-bottom: 1px solid #E2E8F0; font-size: 13px; }
.share-book-list li strong { flex: 1; }
.share-book-list li span { color: var(--text-secondary); white-space: nowrap; }
.share-poster-panel { margin-top: 20px; padding-top: 20px; border-top: 1px solid #E2E8F0; text-align: left; }
.share-poster-panel h2 { margin: 0 0 6px; font-size: 17px; text-align: center; }
.share-poster-hint { margin: 0 0 12px; font-size: 12px; color: var(--text-secondary); text-align: center; }
.poster-wrap canvas { max-width: 100%; border-radius: 8px; margin-top: 8px; }
.share-card .btn-primary, .share-card .btn-outline { margin-top: 10px; text-decoration: none; display: block; box-sizing: border-box; }
.share-mine-link { text-align: center; text-decoration: none; display: block; margin: 0 16px 12px; }

.hero-card--share { position: relative; }
.hero-share-link {
  position: absolute; top: 16px; right: 16px;
  width: 36px; height: 36px; line-height: 36px; text-align: center;
  background: rgba(255,255,255,0.2); border-radius: 50%; text-decoration: none; font-size: 16px;
}

/* ── P1 ── */
.p1-desc { font-size: 13px; color: var(--text-secondary); margin: 0 0 12px; line-height: 1.5; }
.ai-photo-block h4 { margin: 0 0 8px; font-size: 15px; }
.ai-preview {
  min-height: 160px; border: 2px dashed #CBD5E1; border-radius: 12px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; margin-bottom: 12px; cursor: pointer; background: var(--bg); overflow: hidden;
}
.ai-preview.has-image { border-style: solid; padding: 8px; }
.ai-preview img { max-width: 100%; max-height: 200px; object-fit: contain; border-radius: 8px; }
.ai-preview small { font-size: 11px; color: var(--accent); }
.ai-input {
  width: 100%; border: 1px solid #E2E8F0; border-radius: 8px; padding: 10px 12px;
  font-size: 14px; margin-bottom: 8px; box-sizing: border-box;
}
.reader-extra { display: flex; gap: 6px; margin-left: 8px; }
.reader-extra .btn-outline.active { background: rgba(249,115,22,0.25); border-color: var(--accent); color: #fff; }
.chart-wrap canvas { width: 100% !important; max-height: 220px; }
.chart-wrap h4 { margin: 0 0 12px; font-size: 14px; }
.col-pick-list { padding: 0 16px 12px; display: flex; flex-direction: column; gap: 8px; }
.col-pick-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  background: var(--card); border-radius: var(--radius); border: 2px solid transparent; cursor: pointer;
}
.col-pick-item.active { border-color: var(--primary); background: rgba(26,86,219,0.06); }
.col-pick-item img { width: 40px; height: 54px; object-fit: cover; border-radius: 4px; }
.col-pick-item input { flex-shrink: 0; }
.col-pick-item span { font-size: 13px; flex: 1; }
.p1-mine-extra .card h4 { margin: 0 0 8px; font-size: 14px; }
.menu-link { margin-top: 0; }

/* P2 */
.p2-desc { font-size: 12px; color: var(--text-secondary); margin: 8px 0; }
.p2-ai-block { margin-bottom: 12px; }
.flipbook--scroll { position: relative; max-width: 100%; }
.scroll-rods { position: absolute; top: 8px; left: 0; right: 0; display: flex; justify-content: space-between; pointer-events: none; z-index: 2; padding: 0 4px; }
.scroll-rod { width: 14px; height: 100%; min-height: 380px; border-radius: 8px; background: linear-gradient(90deg, #8B6914, #D4AF37, #8B6914); opacity: 0.85; }
.scroll-viewport { overflow-x: auto; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; padding: 24px 20px 12px; }
.scroll-strip { display: flex; gap: 16px; min-width: min-content; }
.scroll-page { flex-shrink: 0; width: min(280px, 72vw); scroll-snap-align: center; }
.scroll-page-inner { width: 100%; aspect-ratio: 3/4; background-size: cover; background-position: center; border-radius: 4px; box-shadow: 0 8px 24px rgba(0,0,0,0.35); border: 2px solid #D4AF37; }
.scroll-caption { font-size: 12px; color: #94A3B8; text-align: center; margin-top: 8px; }
.p2-reader-tools { display: flex; gap: 4px; margin-right: 8px; }
.p2-reader-tools .btn-outline.active { background: rgba(212,175,55,0.3); border-color: #D4AF37; }
.particle-overlay { position: fixed; inset: 0; pointer-events: none; z-index: 500; opacity: 0; transition: opacity 0.3s; }
.particle-overlay.active { opacity: 1; }
.opening-particle { position: absolute; width: 8px; height: 8px; border-radius: 50%; animation: p2-burst ease-out forwards; }
@keyframes p2-burst { 0% { opacity: 1; transform: translate(0,0) scale(1); } 100% { opacity: 0; transform: translate(calc(var(--dx, 80px) - 40px), calc(var(--dy, -120px))) scale(0); } }
.collab-panel { position: fixed; left: 16px; right: 16px; bottom: calc(72px + env(safe-area-inset-bottom)); max-width: 400px; margin: 0 auto; background: var(--card); border-radius: 16px; padding: 16px; box-shadow: 0 8px 32px rgba(0,0,0,0.2); z-index: 300; max-height: 50vh; overflow: auto; }
.collab-panel.hidden { display: none; }
.collab-panel__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.collab-panel label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 8px; }
.collab-panel textarea { width: 100%; border: 1px solid #E2E8F0; border-radius: 8px; padding: 8px; font-size: 13px; margin-bottom: 10px; box-sizing: border-box; }
.p2-mine-tip { padding: 0 16px 12px; }
