:root {
  --bg: #141414;
  --bg2: #1c1c1c;
  --panel: #242424;
  --line: #333;
  --text: #f3f0e8;
  --muted: #a8a49a;
  --gold: #febf00;
  --gold-dim: #c99700;
  --danger: #e07060;
  --radius: 14px;
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  background: radial-gradient(900px 480px at 50% -8%, #2a2418 0%, var(--bg) 55%);
  color: var(--text);
  font-family: var(--font);
  -webkit-text-size-adjust: 100%;
}
button, input { font: inherit; }
.hidden { display: none !important; }

/* ===== 顶栏：手机优先 ===== */
.top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 14px;
  backdrop-filter: blur(10px);
  background: rgba(20, 20, 20, 0.88);
  border-bottom: 1px solid var(--line);
}
.brand-block {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 10px;
  max-width: 100%;
}
.brand {
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--gold);
  font-size: 18px;
  white-space: nowrap;
}
.slogan {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.02em;
  line-height: 1.3;
  border-left: 1px solid var(--line);
  padding-left: 10px;
}
/* 微信内仍显示站名，避免换品牌后看起来像没改 */
html.in-app-title .top {
  padding-top: 8px;
  padding-bottom: 8px;
}
.ghost {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 13px;
}
.ghost-inline {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}

.view {
  padding: 14px 10px calc(88px + env(safe-area-inset-bottom));
  max-width: 960px;
  margin: 0 auto;
  width: 100%;
}

/* 我的：备案号贴底栏上方 */
#view-mine {
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - 56px);
  box-sizing: border-box;
  /* 比默认 view 底边距更贴 tabbar，让备案号再往下 */
  padding-bottom: calc(58px + env(safe-area-inset-bottom));
}

.hero { margin: 6px 0 16px; text-align: center; }
.hero h1 {
  margin: 0 0 10px;
  font-size: 24px;
  line-height: 1.35;
  letter-spacing: 0.02em;
}
.lead {
  margin: 0 auto 16px;
  color: var(--muted);
  line-height: 1.65;
  font-size: 15px;
  max-width: 100%;
  padding: 0 2px;
}
.search-wrap {
  width: 100%;
  max-width: none;
  margin: 0;
}
.search-wrap input {
  width: 100%;
  padding: 14px 18px;
  font-size: 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #111;
  color: var(--text);
  outline: none;
}
.search-wrap input:focus { border-color: var(--gold-dim); }
.search-wrap input::placeholder { color: #6f6b63; }

.book-list {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr;
  width: 100%;
}
.book-card {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 10px;
  padding: 8px;
  align-items: stretch;
  background: linear-gradient(160deg, #262626, #1a1a1a);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-align: left;
  color: inherit;
  width: 100%;
  cursor: pointer;
}
.book-card img {
  width: 100px;
  height: 132px;
  object-fit: cover;
  border-radius: 6px;
  background: #000;
  display: block;
}
.book-card-body {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
  min-height: 132px;
  padding: 2px 0 0;
}
.book-card-main {
  min-width: 0;
}
.book-card h3 {
  margin: 0 0 6px;
  font-size: 17px;
  line-height: 1.3;
}
.book-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.view-with-back {
  padding-top: 0;
  padding-left: 0;
  padding-right: 0;
}
.view-with-back .detail,
.view-with-back .claims-page-title,
.view-with-back .book-list {
  padding-left: 10px;
  padding-right: 10px;
}
.back {
  position: sticky;
  top: 8px;
  z-index: 40;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin: 8px 10px 6px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(20, 20, 20, 0.92);
  backdrop-filter: blur(12px);
  color: var(--text);
  cursor: pointer;
}
.back-ico {
  width: 20px;
  height: 20px;
  display: block;
}
.detail .cover-wrap {
  width: 100%;
  max-width: 180px;
  margin: 0 auto 14px;
}
.detail img {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--line);
  display: block;
  background: #000;
}
.detail h1 {
  margin: 0 0 8px;
  font-size: 22px;
  text-align: center;
  line-height: 1.35;
}
.subtitle {
  margin: 0 0 12px;
  text-align: center;
  color: var(--gold);
  font-size: 14px;
}
.blurb {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.65;
  font-size: 14px;
  white-space: pre-wrap;
}

.primary, .secondary {
  border: 0;
  border-radius: 12px;
  padding: 13px 16px;
  cursor: pointer;
  width: 100%;
  font-size: 16px;
}
.primary {
  background: linear-gradient(180deg, #ffd24d, var(--gold));
  color: #1a1400;
  font-weight: 700;
}
.primary:disabled { opacity: 0.55; cursor: not-allowed; }
.secondary {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  width: auto;
  white-space: nowrap;
  font-size: 14px;
  padding: 10px 12px;
}
.text-btn {
  margin-top: 10px;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 12px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  font-size: 14px;
}
.hint {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
  min-height: 1.2em;
  text-align: center;
}
.hint.err { color: var(--danger); }

.sheet { position: fixed; inset: 0; z-index: 50; }
.sheet-mask {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.62);
}
.sheet-panel {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  background: var(--bg2);
  border-radius: 18px 18px 0 0;
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  max-width: 560px;
  margin: 0 auto;
  max-height: min(92vh, 720px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.sheet-panel h2 { margin: 0 0 6px; font-size: 18px; }
.sheet-desc { margin: 0 0 14px; color: var(--muted); font-size: 13px; }
.field {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.field > span {
  flex: 0 0 4.5em;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
  text-align: right;
  white-space: nowrap;
  line-height: 1.2;
}
.field > input,
.field > .row {
  flex: 1;
  min-width: 0;
}
.field input {
  width: 100%;
  border: 1px solid var(--line);
  background: #111;
  color: var(--text);
  border-radius: 10px;
  padding: 12px;
  outline: none;
  font-size: 16px; /* 避免 iOS 自动放大 */
}
.field input:focus { border-color: var(--gold-dim); }
.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 0 0 14px;
}
.auth-tab {
  border: 1px solid var(--line);
  background: #181818;
  color: var(--muted);
  border-radius: 10px;
  padding: 10px 8px;
  cursor: pointer;
  font-size: 14px;
}
.auth-tab.active {
  border-color: var(--gold-dim);
  color: var(--gold);
  background: #241f12;
}
.row { display: flex; gap: 8px; align-items: center; }
.row input { flex: 1; min-width: 0; }
.row .secondary {
  flex: 0 0 auto;
  padding: 10px 12px;
  font-size: 13px;
}

.agree-note {
  margin: 8px 0 4px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}
.agree-note a {
  color: var(--gold);
  text-decoration: none;
}
.agree-note.hidden { display: none !important; }

.agree-box {
  margin: 8px 0 14px;
  padding: 12px;
  background: #241f12;
  border: 1px solid var(--gold-dim);
  border-radius: 10px;
}
.agree-read-btn {
  width: 100%;
  border: 1px solid var(--gold-dim);
  background: #1a160c;
  color: var(--gold);
  border-radius: 8px;
  padding: 11px 12px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 10px;
}
.agree-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  background: transparent;
  border: 0;
}
.agree-row.hidden,
.agree-box.hidden { display: none !important; }
.agree-row input {
  margin: 0;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  accent-color: var(--gold);
}
.agree-row input:disabled {
  opacity: 0.45;
}
.agree-row.is-ready {
  color: var(--text);
}
.agree-panel {
  max-height: 88vh;
  display: flex;
  flex-direction: column;
}
.agree-body {
  flex: 1;
  overflow: auto;
  max-height: 46vh;
  margin: 8px 0 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #111;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-wrap;
}
.primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.secondary.full { width: 100%; margin-top: 8px; }

.preview-entry {
  display: block;
  margin-top: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 10px;
  padding: 12px 10px;
  font-size: 14px;
  width: 100%;
  cursor: pointer;
}
.preview-entry-one {
  font-weight: 600;
  color: var(--gold);
  border-color: #3a3220;
  background: #241f12;
}
.preview-entry:active {
  border-color: var(--gold-dim);
  color: var(--gold);
}

.preview-panel {
  /* 预览上移到顶栏下方（不挡品牌条） */
  top: 56px;
  bottom: 0;
  max-height: none;
  height: auto;
  border-radius: 16px 16px 0 0;
  padding-top: 14px;
}
.preview-panel h2 { font-size: 16px; margin-bottom: 10px; }
.preview-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: 0 0 10px;
  padding: 4px;
  border-radius: 12px;
  background: #151515;
  border: 1px solid var(--line);
}
.preview-tab {
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  min-height: 36px;
  cursor: pointer;
}
.preview-tab.active {
  background: #2a2418;
  color: var(--gold);
}
.preview-tab:active { opacity: 0.85; }

/* ===== 排序 ===== */
.sort-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 14px;
  width: 100%;
}
.sort-btn {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 4px;
  font-size: 13px;
  cursor: pointer;
  width: 100%;
  text-align: center;
  white-space: nowrap;
}
.sort-btn.active {
  color: #1a1408;
  background: var(--gold);
  border-color: var(--gold);
  font-weight: 600;
}

.card-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  margin-top: 10px;
  width: 100%;
}
.card-stats .stat-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: 100%;
  min-width: 0;
  padding: 6px 2px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #1a1a1a;
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}
.card-stats .stat-ico {
  font-size: 12px;
  line-height: 1;
}

/* ===== 点赞评论转发 ===== */
.engage-bar {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin: 14px 0 16px;
}
.engage-btn {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  border-radius: 12px;
  padding: 10px 8px;
  cursor: pointer;
  font-size: 12px;
}
.engage-btn.is-on {
  color: var(--gold);
  border-color: var(--gold-dim);
}
.engage-btn.is-download {
  background: linear-gradient(180deg, #ffd24d, var(--gold));
  color: #1a1400;
  border-color: var(--gold);
  font-weight: 700;
}
.engage-btn.is-download .engage-n {
  color: #1a1400;
}
.engage-ico { font-size: 18px; line-height: 1; }
.engage-n { color: var(--text); font-weight: 600; font-size: 13px; }

.comment-section {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.comment-title {
  margin: 0 0 10px;
  font-size: 16px;
  font-weight: 700;
}
.comment-list {
  display: grid;
  gap: 8px;
  margin: 0 0 10px;
  max-height: 220px;
  overflow: auto;
}
.comment-compose {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.comment-send {
  flex-shrink: 0;
  width: 4.4em;
  min-height: 40px;
  padding: 0;
  white-space: nowrap;
}
.comment-input {
  flex: 1;
  min-width: 0;
  resize: none;
  min-height: 40px;
  height: 40px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #111;
  color: var(--text);
  padding: 8px 12px;
  line-height: 1.4;
  font: inherit;
}
.comment-item {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
}
.comment-meta {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}
.comment-text {
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.mine-menu {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}
.mine-menu-item {
  text-align: left;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 12px;
  padding: 14px 16px;
  cursor: pointer;
  font-size: 15px;
}
.mine-menu-item.danger { color: var(--danger); }
.info-body {
  margin: 8px 0 16px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
}

.site-footer {
  padding: 20px 8px 8px;
  text-align: center;
}
.mine-footer {
  margin-top: auto;
  padding: 20px 8px 2px;
  text-align: center;
  flex-shrink: 0;
}
.beian {
  color: var(--muted);
  font-size: 12px;
  text-decoration: none;
}
.beian:hover { color: var(--gold-dim); }
.preview-gallery {
  max-height: calc(100vh - 56px - 190px);
  overflow: auto;
  display: grid;
  gap: 10px;
  margin: 8px 0 12px;
}
.preview-gallery img {
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #000;
  display: block;
}

/* 思维导图：竖屏手机里旋转成横屏阅读，可双指缩放/拖动 */
.preview-panel.is-mind .preview-hint {
  margin: 0 0 6px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}
.preview-gallery.is-mind {
  max-height: calc(100vh - 56px - 210px);
  height: calc(100vh - 56px - 210px);
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y pinch-zoom;
  background: #111;
  border-radius: 10px;
}
.preview-gallery.is-mind img {
  width: auto;
  max-width: none;
  height: min(100vw - 48px, 92vh);
  max-height: none;
  transform: rotate(90deg);
  transform-origin: center center;
  border: none;
  background: #f5f6f8;
}
@media (orientation: landscape) {
  .preview-gallery.is-mind img {
    transform: none;
    width: 100%;
    height: auto;
    max-height: calc(100vh - 56px - 160px);
  }
}

.qr-wrap {
  width: min(150px, 40vw);
  margin: 6px auto 12px;
  padding: 0;
  background: transparent;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.qr-wrap img {
  width: 100%;
  height: auto;
  max-height: 220px;
  object-fit: contain;
  display: block;
  vertical-align: top;
  background: #fff;
}
.tip-panel .qr-wrap {
  width: min(140px, 38vw);
}
.tip-panel .primary { margin-top: 4px; }
.tip-panel .tip-skip {
  margin-top: 8px;
  color: #6e6a62;
  font-size: 13px;
  text-decoration: none;
  opacity: 0.85;
}
.tip-panel .tip-skip:active {
  color: var(--muted);
}

.browser-panel {
  text-align: left;
  position: relative;
  padding-top: 28px;
}
.browser-arrow {
  position: absolute;
  top: 10px;
  right: 18px;
  color: var(--gold);
  font-size: 13px;
  font-weight: 700;
  animation: browser-bounce 1.2s ease-in-out infinite;
}
@keyframes browser-bounce {
  0%, 100% { transform: translateY(0); opacity: 1; }
  50% { transform: translateY(-4px); opacity: 0.7; }
}
.browser-steps {
  margin: 0 0 16px;
  padding-left: 22px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.8;
}
.browser-steps strong { color: var(--gold); }
.browser-panel .primary { margin-top: 4px; }

.empty {
  padding: 24px 14px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  font-size: 14px;
}

/* ===== 我的 ===== */
.mine-card {
  background: linear-gradient(160deg, #262626, #1a1a1a);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 16px;
  margin-bottom: 16px;
}
.mine-card h2 {
  margin: 0 0 6px;
  font-size: 18px;
}
.mine-desc {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}
.mine-user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.mine-label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}
.mine-phone {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--gold);
  margin-top: 4px;
}
.claims-page-title {
  margin: 0 0 14px;
  font-size: 20px;
  font-weight: 700;
}
.mine-section-title {
  margin: 4px 0 12px;
  font-size: 15px;
  color: var(--muted);
  font-weight: 600;
}
.claim-card .claim-meta {
  margin-top: 8px;
  font-size: 12px;
  color: var(--gold-dim);
}

/* ===== 底部导航 ===== */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  max-width: 560px;
  margin: 0 auto;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  background: rgba(18, 18, 18, 0.96);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(12px);
}
.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 12px 4px;
  cursor: pointer;
  font-size: 14px;
}
.tab.active {
  color: var(--gold);
}

/* ===== 大屏再放大 ===== */
@media (min-width: 768px) {
  .top { padding: 16px 24px; }
  .brand { font-size: 24px; }
  .slogan { font-size: 15px; padding-left: 14px; }
  .ghost { right: 18px; font-size: 14px; padding: 6px 12px; }
  .view { padding: 24px 20px calc(96px + env(safe-area-inset-bottom)); max-width: 1080px; }
  .view-with-back { padding-top: 0; padding-left: 0; padding-right: 0; }
  .view-with-back .detail,
  .view-with-back .claims-page-title,
  .view-with-back .book-list { padding-left: 20px; padding-right: 20px; }
  .hero h1 { font-size: 38px; }
  .lead { font-size: 18px; max-width: none; }
  .search-wrap { max-width: none; width: 100%; }
  .search-wrap input { padding: 16px 20px; font-size: 17px; }
  .book-list { grid-template-columns: 1fr 1fr; gap: 18px; }
  .book-card {
    grid-template-columns: 112px 1fr;
    gap: 12px;
    padding: 10px;
  }
  .book-card img { width: 112px; height: 148px; }
  .book-card h3 { font-size: 22px; }
  .book-card p { font-size: 15px; }
  .detail h1 { font-size: 28px; }
  .tabbar { max-width: 720px; }
  .tab { font-size: 13px; }
}
