/* Textory Mobile · Phase 1 阅读+分享（mobile-first，与 studio.css 隔离） */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--surface, #F3EEE2);
  color: var(--ink-soft, #33291B);
  font-family: var(--sans, 'Noto Sans SC', -apple-system, sans-serif);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

#txm-app {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.txm-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.txm-topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(10px + env(safe-area-inset-top, 0)) 14px 10px;
  background: rgba(247, 243, 235, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(224, 216, 200, 0.7);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 10;
}

.txm-back {
  flex-shrink: 0;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line, #E0D8C8);
  background: rgba(255, 255, 255, 0.9);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink, #2A2118);
  cursor: pointer;
}

.txm-top-title {
  flex: 1;
  min-width: 0;
  text-align: center;
  font-family: 'Noto Serif SC', serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink, #2A2118);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.txm-top-spacer { width: 72px; flex-shrink: 0; }

.txm-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* —— 创作区 —— */
.txm-create {
  padding: 16px 16px 10px;
}

.txm-create-kicker {
  font-family: 'Space Mono', ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 1.5px;
  color: var(--gold-deep, #8A6A14);
  text-align: center;
  margin-bottom: 6px;
}

.txm-create-title {
  font-family: 'Noto Serif SC', serif;
  font-size: 24px;
  font-weight: 600;
  color: var(--ink, #2A2118);
  text-align: center;
  margin-bottom: 14px;
}

.txm-composer {
  background: var(--card, #fff);
  border: 1px solid var(--line, #E0D8C8);
  border-radius: 14px;
  box-shadow: 0 4px 18px rgba(42, 33, 24, 0.06);
  overflow: hidden;
}

.txm-idea {
  width: 100%;
  border: none;
  outline: none;
  resize: none;
  padding: 14px 14px 8px;
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink-soft, #33291B);
  background: transparent;
  min-height: 72px;
}

.txm-idea::placeholder { color: var(--faint, #A89878); }

.txm-composer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px 10px;
}

.txm-composer-bar-left,
.txm-composer-bar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.txm-plus-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line, #E0D8C8);
  background: var(--card, #fff);
  color: var(--ink, #2A2118);
  box-shadow: 0 1px 3px rgba(42, 33, 24, 0.06);
}

.txm-att-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 12px 8px;
}

.txm-att-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text, #5C4A32);
  background: var(--line-soft, #F0EBE0);
  border: 1px solid var(--line, #E0D8C8);
  border-radius: 999px;
  padding: 4px 8px 4px 10px;
  max-width: 100%;
}

.txm-att-x {
  border: none;
  background: none;
  color: var(--faint, #A89878);
  font-size: 12px;
  padding: 0 2px;
  cursor: pointer;
}

@keyframes txm-fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.txm-attach-sheet {
  position: fixed;
  inset: 0;
  z-index: 800;
  background: rgba(15, 11, 6, 0.32);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  animation: txm-fade-up .15s;
}

.txm-attach-panel {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: var(--card, #fff);
  border: 1px solid var(--line, #E0D8C8);
  border-radius: 16px;
  padding: 18px 16px 16px;
  box-shadow: 0 8px 28px rgba(42, 33, 24, 0.12);
}

.txm-attach-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.txm-attach-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 6px;
  border: 1px solid var(--line-soft, #F0EBE0);
  border-radius: 12px;
  background: linear-gradient(180deg, #fff 0%, #F3EEE2 100%);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.txm-attach-tile:active { transform: scale(0.98); }

.txm-attach-ico {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #FBF3DC;
}

.txm-attach-lbl { font-size: 12px; font-weight: 600; color: var(--ink, #2A2118); }

.txm-attach-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: var(--line-soft, #F0EBE0);
  color: var(--text-dim, #8A7A52);
  font-size: 14px;
  cursor: pointer;
  line-height: 1;
}

.txm-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--line, #E0D8C8);
  background: rgba(255, 255, 255, 0.9);
  color: var(--muted, #8A7A52);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.txm-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: none;
  background: var(--gold, #B0851C);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(176, 133, 28, 0.35);
}

.txm-send-btn:active { transform: scale(0.96); }

.txm-genre-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 2px 4px;
  scrollbar-width: none;
}

.txm-genre-row::-webkit-scrollbar { display: none; }

.txm-genre {
  flex-shrink: 0;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--line, #E0D8C8);
  background: rgba(255, 255, 255, 0.85);
  font-size: 13px;
  color: var(--text, #4A3F2C);
  cursor: pointer;
  white-space: nowrap;
}

.txm-genre.on {
  background: var(--gold-soft, #FBF3DC);
  border-color: rgba(176, 133, 28, 0.35);
  color: var(--gold-deep, #8A6A14);
  font-weight: 600;
}

.txm-surprise {
  display: block;
  margin: 8px auto 0;
  padding: 0;
  border: none;
  background: none;
  font-size: 13px;
  color: var(--muted, #8A7A52);
  cursor: pointer;
}

/* —— 橱窗单排横滑 —— */
.txm-showcase {
  padding: 8px 0 4px;
  border-top: 1px solid rgba(224, 216, 200, 0.65);
  margin-top: 6px;
}

.txm-showcase-head {
  padding: 14px 16px 10px;
  text-align: center;
}

.txm-showcase-head h2 {
  font-family: 'Noto Serif SC', serif;
  font-size: 18px;
  font-weight: 600;
  color: var(--ink, #2A2118);
  margin-bottom: 4px;
}

.txm-showcase-head p {
  font-size: 12px;
  color: var(--muted, #8A7A52);
}

.txm-row-scroll {
  display: flex;
  flex-wrap: nowrap;
  gap: 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 16px 16px;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
}

.txm-row-scroll::-webkit-scrollbar { display: none; }

.txm-card-row {
  flex: 0 0 118px;
  width: 118px;
  scroll-snap-align: start;
}

.txm-loading-inline,
.txm-empty-inline {
  padding: 28px 20px;
}

.txm-card {
  border: 1px solid var(--line, #E0D8C8);
  border-radius: 12px;
  background: var(--card, #fff);
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(42, 33, 24, 0.06);
  text-align: left;
}

.txm-card-tap {
  cursor: pointer;
}

.txm-card-tap:active { transform: scale(0.98); }

.txm-card-cover {
  aspect-ratio: 3 / 4;
  background: var(--gold-soft, #FBF3DC);
  position: relative;
  overflow: hidden;
}

.txm-card-cover::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 42%;
  background: linear-gradient(180deg, transparent 0%, rgba(20, 14, 8, 0.55) 100%);
  pointer-events: none;
}

.txm-card-write {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 2;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: rgba(42, 33, 24, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #FBF3DC;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.22);
}

.txm-card-write:active {
  transform: scale(0.96);
  background: rgba(42, 33, 24, 0.88);
}

.txm-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.txm-card-cover-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  font-family: 'Noto Serif SC', serif;
  font-size: 13px;
  color: var(--gold-deep, #8A6A14);
  padding: 8px;
  text-align: center;
  line-height: 1.35;
}

.txm-card-body { padding: 8px 9px 10px; }

.txm-card-title {
  font-family: 'Noto Serif SC', serif;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--ink, #2A2118);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.txm-card-cat {
  font-size: 10px;
  color: var(--faint, #A89878);
  margin-top: 4px;
}

.txm-read-scroll {
  display: flex;
  justify-content: center;
  padding: 20px 14px calc(24px + env(safe-area-inset-bottom, 0));
}

/* —— 微信读书式横翻阅读 —— */
.txm-shell--read {
  background: #e6e2d8;
}
.txm-read-main {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.txm-reader {
  position: relative;
  flex: 1;
  min-height: 0;
  height: 100%;
  background: var(--paper, #FBF7EC);
}
.txm-reader-viewport {
  height: 100%;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.txm-reader-slider {
  display: flex;
  height: 100%;
  will-change: transform;
  transition: transform 0.28s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.txm-reader-slider.is-dragging { transition: none; }
.txm-reader-page {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  min-height: var(--txm-reader-page-h, 100%);
  padding: 16px 22px 44px;
  background: var(--paper, #FBF7EC);
  box-shadow: -6px 0 18px rgba(42, 33, 24, 0.06);
  overflow: hidden;
}
.txm-reader-page-inner {
  height: 100%;
  overflow: hidden;
}
.txm-reader-page .txm-kicker {
  margin-bottom: 10px;
  font-size: 9px;
}
.txm-reader-page .txm-ch-title {
  font-size: 20px;
  margin-bottom: 14px;
}
.txm-reader-page .txm-paper,
.txm-reader-page .paper-body {
  font-size: 18px;
  line-height: 1.9;
}
.txm-reader-ch {
  position: absolute;
  top: 10px;
  right: 18px;
  z-index: 2;
  font-size: 12px;
  color: var(--faint, #A89878);
  pointer-events: none;
}
.txm-reader-ch:empty { display: none; }
.txm-reader-pager {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(10px + env(safe-area-inset-bottom, 0));
  z-index: 2;
  text-align: center;
  font-size: 12px;
  color: var(--faint, #A89878);
  pointer-events: none;
}
.txm-reader-measure {
  position: fixed;
  left: -9999px;
  top: 0;
  width: calc(100vw - 44px);
  max-width: 600px;
  padding: 16px 22px 44px;
  font-family: 'Noto Serif SC', serif;
  font-size: 18px;
  line-height: 1.9;
  visibility: hidden;
  pointer-events: none;
}
.txm-reader-measure .txm-kicker { font-size: 9px; margin-bottom: 10px; }
.txm-reader-measure .txm-ch-title { font-size: 20px; margin-bottom: 14px; }
.txm-reader-measure p { margin: 0 0 18px; }

.txm-read-page {
  width: 100%;
  max-width: 600px;
  background: var(--paper, #FBF7EC);
  border: 1px solid var(--line, #E0D8C8);
  border-radius: 4px;
  box-shadow: 0 4px 24px rgba(42, 33, 24, 0.08);
  padding: 36px 28px 32px;
}

.txm-kicker {
  font-family: 'Space Mono', ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--label, #B0A075);
  text-align: center;
  margin-bottom: 16px;
}

.txm-ch-title {
  font-family: 'Noto Serif SC', serif;
  font-size: 24px;
  font-weight: 600;
  color: var(--ink, #2A2118);
  text-align: center;
  margin-bottom: 20px;
  line-height: 1.35;
}

.txm-paper,
.paper-body {
  font-family: 'Noto Serif SC', serif;
  font-size: 17px;
  line-height: 1.85;
  color: var(--text, #4A3F2C);
}

.txm-paper p,
.paper-body p { margin: 0 0 18px; }

.txm-paper p.has-pn,
.paper-body p.has-pn { position: relative; }

.txm-paper p .pn,
.paper-body p .pn {
  position: absolute;
  left: -2.8em;
  top: .2em;
  width: 2.5em;
  text-align: right;
  font-family: 'Space Mono', ui-monospace, monospace;
  font-size: 10px;
  color: var(--faint, #A89878);
  opacity: .75;
}

.txm-drop {
  float: left;
  font-family: 'Noto Serif SC', serif;
  font-size: 48px;
  line-height: .82;
  font-weight: 600;
  color: var(--gold, #B0851C);
  margin: 4px 8px 0 0;
}

.txm-banner {
  font-size: 12px;
  color: var(--muted, #8A7A52);
  background: var(--surface, #F3EEE2);
  border: 1px solid var(--line, #E0D8C8);
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 16px;
  text-align: center;
  line-height: 1.5;
}

.txm-ch-nav {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--line, #E0D8C8);
}

.txm-nav-btn {
  flex: 1;
  padding: 12px 10px;
  border-radius: 10px;
  border: 1px solid var(--line, #E0D8C8);
  background: rgba(255, 255, 255, 0.75);
  font-size: 14px;
  color: var(--ink, #2A2118);
  cursor: pointer;
}

.txm-nav-btn:disabled {
  opacity: .35;
  cursor: default;
}

.txm-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 60px 20px;
  color: var(--muted, #8A7A52);
  font-size: 14px;
}

.txm-spin {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(176, 133, 28, 0.25);
  border-top-color: var(--gold, #B0851C);
  border-radius: 50%;
  animation: txm-spin 0.7s linear infinite;
}

@keyframes txm-spin { to { transform: rotate(360deg); } }

.txm-share-cover {
  text-align: center;
  padding: 16px 18px 8px;
}

.txm-share-cover img {
  width: 100%;
  max-width: 320px;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(42, 33, 24, 0.12);
}

.txm-share-cover h1 {
  font-family: 'Noto Serif SC', serif;
  font-size: 28px;
  font-weight: 600;
  color: var(--ink, #2A2118);
  margin-top: 16px;
  line-height: 1.3;
}

.txm-share-premise {
  font-size: 14px;
  color: var(--text-dim, #6B5D45);
  line-height: 1.7;
  margin-top: 10px;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

.txm-share-ch { margin-bottom: 8px; }

.txm-comments {
  max-width: 600px;
  margin: 0 auto;
  padding: 0 14px 28px;
}

.txm-comments-box {
  background: var(--panel, #FBF9F3);
  border: 1px solid var(--line, #E0D8C8);
  border-radius: 12px;
  padding: 18px;
}

.txm-comments h3 {
  font-family: 'Noto Serif SC', serif;
  font-size: 16px;
  margin-bottom: 12px;
  color: var(--ink, #2A2118);
}

.txm-cmt {
  padding: 10px 0;
  border-bottom: 1px solid var(--line-soft, #F0EADB);
  font-size: 13px;
}

.txm-cmt b { color: var(--ink, #2A2118); }

.txm-cmt-txt {
  color: var(--text-dim, #6B5D45);
  margin-top: 4px;
  line-height: 1.6;
}

.txm-cmt-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}

.txm-fld {
  width: 100%;
  border: 1px solid var(--line, #E0D8C8);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 15px;
  background: #fff;
  outline: none;
}

.txm-fld:focus { border-color: var(--gold, #B0851C); }

.txm-btn {
  padding: 12px 18px;
  border-radius: 10px;
  border: none;
  background: var(--ink, #2A2118);
  color: var(--cream, #FBF3DC);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.txm-btn-sm {
  padding: 8px 14px;
  font-size: 13px;
  margin-top: 10px;
}

.txm-foot {
  text-align: center;
  padding: 16px;
  font-size: 12px;
  color: var(--faint, #A89878);
  line-height: 1.5;
}

.txm-empty {
  padding: 48px 20px;
  text-align: center;
  color: var(--muted, #8A7A52);
  font-size: 14px;
}

@media (max-width: 380px) {
  .txm-card-row { flex-basis: 108px; width: 108px; }
  .txm-read-page { padding: 28px 20px 24px; }
  .txm-paper p .pn,
  .paper-body p .pn {
    position: static;
    display: inline-block;
    margin-right: 6px;
    text-align: left;
  }
}

.txm-share-btn { width: 34px; height: 34px; }
.txm-toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%) translateY(12px);
  max-width: min(92vw, 360px);
  padding: 10px 16px;
  border-radius: 10px;
  background: rgba(42, 33, 24, 0.92);
  color: #fff;
  font-size: 13px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 800;
}
.txm-toast.on {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
