/* 卡片滑动 — 典籍质感 · 成语典故 */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #ebe4d8;
  --surface: #f7f3ec;
  --surface-2: #f0e9de;
  --ink: #2a1f18;
  --ink-2: #4a3c32;
  --ink-3: #7a6558;
  --line: rgba(42, 31, 24, 0.08);
  --line-strong: rgba(42, 31, 24, 0.14);
  --brand: #9c3d2e;
  --brand-2: #b8523f;
  --brand-grad: linear-gradient(135deg, #7a3224 0%, #9c3d2e 50%, #7a5c18 100%);
  --title-grad: linear-gradient(135deg, #2a1f18 15%, #7a3020 85%);
  --meta-color: #8b3a2a;
  --paper-overlay: rgba(247, 243, 236, 0.88);
  --like: #9c3d2e;
  --skip: #5a6878;
  --nav-h: 56px;
  --header-h: 52px;
  --radius-lg: 28px;
  --radius-md: 16px;
  --shadow-card: 0 10px 36px rgba(42, 31, 24, 0.1), 0 2px 8px rgba(42, 31, 24, 0.06);
  --shadow-float: 0 14px 44px rgba(42, 31, 24, 0.14);
  --font-serif: "Songti SC", "STSong", "Noto Serif SC", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", sans-serif;
}

html, body {
  height: 100%;
  color: var(--ink);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

body {
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 50% at 12% 0%, rgba(122, 92, 24, 0.09) 0%, transparent 55%),
    radial-gradient(ellipse 70% 45% at 88% 12%, rgba(156, 61, 46, 0.07) 0%, transparent 50%),
    linear-gradient(165deg, #ebe4d8 0%, #e3dbd0 50%, #e8e0d4 100%);
  background-attachment: fixed;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100%;
  position: relative;
}

/* 顶栏 — 发现/喜欢/详情共用 */
.header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  background: rgba(247, 243, 236, 0.92);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--line);
}

.header-title {
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 700;
  background: var(--brand-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: 0.06em;
}

.header.header--detail {
  justify-content: flex-start;
}

.header-back {
  flex: 0 0 56px;
  border: none;
  background: none;
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 500;
  color: var(--ink-2);
  text-align: left;
  cursor: pointer;
  padding: 0;
}

.header-title--page {
  flex: 1;
  min-width: 0;
  text-align: center;
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
  display: block;
}

.header-side {
  flex: 0 0 56px;
}

.main {
  min-height: calc(100vh - var(--header-h) - var(--nav-h));
  padding-bottom: var(--nav-h);
}

body.immersive .nav { display: none !important; }

body.standalone-contact .header { display: none !important; }

body.standalone-contact .main {
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: 0;
}

body.standalone-contact .toast {
  bottom: calc(env(safe-area-inset-bottom, 0px) + 16px);
}

body.immersive .main {
  min-height: calc(100vh - var(--header-h));
  padding-bottom: 0;
}

.is-hidden { display: none !important; }

/* 底栏 — 胶囊 Tab */
.nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
  padding: 0 20px env(safe-area-inset-bottom, 0px);
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(247, 243, 236, 0.94);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-top: 1px solid var(--line);
  max-width: 480px;
  margin: 0 auto;
}

.nav-item {
  flex: 1;
  height: 40px;
  border: none;
  border-radius: 20px;
  background: none;
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 500;
  color: var(--ink-3);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.nav-item.active {
  background: var(--brand-grad);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(42, 31, 24, 0.18);
}

/* ── 发现页 ── */
.discover-page {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--header-h) - var(--nav-h));
  padding: 8px 16px 0;
}

.swipe-hint {
  flex-shrink: 0;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--meta-color);
  margin-bottom: 10px;
  padding: 6px 16px;
  align-self: center;
  background: rgba(247, 243, 236, 0.9);
  border-radius: 20px;
  border: 1px solid var(--line-strong);
  box-shadow: 0 2px 12px rgba(42, 31, 24, 0.06);
}

.card-stack {
  flex: 1;
  position: relative;
  min-height: 200px;
  margin-bottom: 4px;
  isolation: isolate;
}

.swipe-card {
  position: absolute;
  inset: 0;
  background: transparent;
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 40px rgba(42, 31, 24, 0.12), 0 4px 14px rgba(42, 31, 24, 0.06);
  display: flex;
  flex-direction: column;
  touch-action: none;
  user-select: none;
  will-change: transform;
  overflow: hidden;
  border: 1px solid rgba(247, 243, 236, 0.6);
}

.swipe-card.is-animating {
  transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.32s ease;
}

.swipe-card-top {
  z-index: 2;
}

.swipe-card-behind {
  z-index: 1;
  background: transparent;
  transform: scale(0.96) translateY(10px);
  pointer-events: none;
  box-shadow: 0 8px 24px rgba(42, 31, 24, 0.08);
  opacity: 0.72;
}

.swipe-card-behind .card-scene--shell {
  opacity: 1;
}

/* 淡雅典故背景 — 铺满卡片 */
.card-scene {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

.card-scene--shell {
  position: absolute;
  inset: 0;
}

.card-scene-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.card-scene::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    transparent 0%,
    transparent 52%,
    rgba(247, 243, 236, 0.22) 75%,
    var(--paper-overlay) 100%
  );
  pointer-events: none;
}

.card-scene--photo::after {
  background: linear-gradient(
    180deg,
    transparent 0%,
    transparent 45%,
    rgba(247, 243, 236, 0.28) 72%,
    var(--paper-overlay) 100%
  );
}

.card-scene--photo .card-scene-img {
  object-position: center;
}

.card-scene-seal {
  display: none;
}

.card-inner {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: stretch;
  width: 100%;
  min-height: 0;
  padding: 0;
  text-align: center;
  background: transparent;
}

.card-text-panel {
  width: 100%;
  padding: 14px 22px 18px;
  background: rgba(247, 243, 236, 0.94);
  border-radius: 20px 20px 0 0;
  box-sizing: border-box;
  max-height: 62%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  text-align: center;
}

.card-stamp {
  position: absolute;
  top: 50%;
  margin-top: -22px;
  padding: 10px 20px;
  border: 3px solid;
  border-radius: 8px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.08em;
  opacity: 0;
  pointer-events: none;
  z-index: 3;
}

.card-stamp-like {
  right: 28px;
  color: var(--like);
  border-color: var(--like);
  background: rgba(247, 243, 236, 0.92);
  transform: rotate(14deg);
}

.card-stamp-skip {
  left: 28px;
  color: var(--skip);
  border-color: var(--skip);
  background: rgba(247, 243, 236, 0.92);
  transform: rotate(-14deg);
}

.swipe-card[data-dir="left"] .card-stamp-like { opacity: 1; }
.swipe-card[data-dir="right"] .card-stamp-skip { opacity: 1; }

.card-meta {
  font-size: 13px;
  font-weight: 600;
  color: var(--meta-color);
  letter-spacing: 0.04em;
  margin-bottom: 10px;
  flex-shrink: 0;
}

.card-title {
  font-family: var(--font-serif);
  font-size: 32px;
  font-weight: 700;
  background: var(--title-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: 0.04em;
  margin-bottom: 12px;
  line-height: 1.3;
  width: 100%;
  white-space: nowrap;
  flex-shrink: 0;
}

.card-poem {
  flex: 1;
  min-height: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 6px;
  margin-bottom: 12px;
  overflow: hidden;
  text-align: left;
}

.card-poem-line {
  font-family: var(--font-serif);
  font-size: clamp(15px, 4.2vw, 18px);
  line-height: 1.72;
  color: var(--ink-2);
  letter-spacing: 0.04em;
  margin: 0;
}

.card-poem-more {
  font-family: var(--font-serif);
  font-size: 15px;
  line-height: 1.5;
  color: rgba(74, 60, 50, 0.38);
  margin: 2px 0 0;
  letter-spacing: 0.2em;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  flex-shrink: 0;
  margin-top: auto;
  padding-top: 4px;
}

.tag-pill {
  font-size: 12px;
  font-weight: 600;
  color: var(--brand);
  padding: 5px 14px;
  background: rgba(247, 243, 236, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(139, 58, 42, 0.2);
  border-radius: 20px;
}

/* 操作钮 */
.swipe-actions {
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 36px;
  padding: 10px 0 14px;
}

.action-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  line-height: 1;
  transition: transform 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

.action-btn:active { transform: scale(0.9); }

.action-btn-like {
  background: var(--brand-grad);
  color: #fff;
  box-shadow: 0 4px 14px rgba(42, 31, 24, 0.2);
}

.action-btn-like .icon-heart {
  width: 22px;
  height: 22px;
  fill: currentColor;
  display: block;
  margin-top: 1px;
}

.action-btn-skip {
  background: var(--surface);
  color: var(--skip);
  font-size: 20px;
  font-weight: 400;
  border: 1px solid var(--line-strong);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}

/* ── 喜欢列表 — Feed 卡片流 */
.likes-page {
  min-height: calc(100vh - var(--header-h) - var(--nav-h));
  padding: 0 16px 16px;
}

.likes-head {
  padding: 16px 4px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-3);
}

.likes-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.like-row {
  display: flex;
  align-items: center;
  width: 100%;
  text-align: left;
  padding: 16px 18px 16px 22px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.15s;
  position: relative;
  overflow: hidden;
}

.like-row::before {
  content: '';
  position: absolute;
  left: 0;
  top: 14px;
  bottom: 14px;
  width: 4px;
  border-radius: 0 2px 2px 0;
  background: var(--brand-grad);
}

.like-row:active { transform: scale(0.98); }

.like-row-main { flex: 1; min-width: 0; width: 100%; }

.like-row-title {
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 700;
  color: var(--brand);
  margin-bottom: 4px;
  letter-spacing: 0.02em;
  white-space: nowrap;
  width: 100%;
}

.like-row-line {
  font-family: var(--font-serif);
  font-size: 14px;
  color: var(--ink-2);
  margin-bottom: 4px;
  line-height: 1.5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.like-row-meta {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-3);
}

.like-row-arrow {
  flex-shrink: 0;
  margin-left: 12px;
  font-size: 22px;
  color: var(--brand);
  font-weight: 300;
}

/* ── 详情页 */
.detail-page {
  min-height: calc(100vh - var(--header-h));
  padding-top: 12px;
  background: var(--bg);
}

.detail-hero {
  position: relative;
  margin: 0 16px;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(247, 243, 236, 0.6);
  width: calc(100% - 32px);
  box-sizing: border-box;
}

.detail-hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.detail-hero-bg-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
}

.detail-hero-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(247, 243, 236, 0.42) 36%,
    rgba(247, 243, 236, 0.88) 100%
  );
  pointer-events: none;
}

.detail-hero-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding: 14px 18px 20px;
  text-align: center;
  box-sizing: border-box;
}

.detail-meta {
  font-size: 13px;
  font-weight: 600;
  color: var(--meta-color);
  margin-bottom: 12px;
  line-height: 1.55;
  width: 100%;
  white-space: normal;
  word-break: break-word;
}

.detail-title {
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 16px;
  letter-spacing: 0.04em;
  background: var(--title-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  width: 100%;
  white-space: nowrap;
}

.detail-lines {
  font-family: var(--font-serif);
  font-size: 17px;
  line-height: 1.85;
  color: var(--ink);
  letter-spacing: 0.03em;
  width: 100%;
  text-align: left;
}

.detail-lines p {
  margin: 0 0 0.65em;
  white-space: normal;
  word-break: break-word;
  width: 100%;
}

.detail-lines p:last-child {
  margin-bottom: 0;
}

.detail-body {
  padding: 12px 16px 48px;
}

.detail-section {
  margin-bottom: 12px;
  padding: 18px;
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.detail-section h3 {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--meta-color);
  letter-spacing: 0.04em;
  margin-bottom: 10px;
}

.detail-section p {
  font-size: 15px;
  line-height: 1.75;
  color: var(--ink);
  font-family: var(--font-sans);
}

.detail-unlike {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 15px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  color: var(--ink-3);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
}

.detail-unlike:active { opacity: 0.7; }

/* ── 通用 ── */
.empty {
  padding: 80px 24px;
  text-align: center;
  color: var(--ink-3);
  font-size: 15px;
}

.empty small {
  display: block;
  margin-top: 8px;
  font-size: 13px;
}

.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 50vh;
  color: var(--ink-3);
}

.loading-spinner {
  width: 28px;
  height: 28px;
  border: 2.5px solid var(--line-strong);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-bottom: 12px;
}

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

.toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 16px);
  background: var(--brand-grad);
  color: #fff;
  padding: 11px 22px;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 200;
  box-shadow: 0 6px 24px rgba(42, 31, 24, 0.22);
}

.toast.show { opacity: 1; }

/* ── 联系我们 ── */
.contact-page {
  min-height: calc(100vh - var(--header-h) - var(--nav-h));
  padding: 20px 16px 24px;
}

body.standalone-contact .contact-page {
  min-height: 100vh;
  min-height: 100dvh;
  padding: max(20px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
}

.contact-hero {
  text-align: center;
  padding: 28px 20px 24px;
  margin-bottom: 12px;
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, rgba(247, 243, 236, 0.98) 0%, rgba(240, 233, 222, 0.95) 100%);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--line);
}

.contact-hero-emoji {
  font-size: 44px;
  line-height: 1;
  margin-bottom: 10px;
}

.contact-hero-title {
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 700;
  background: var(--brand-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.contact-hero-tagline {
  font-size: 14px;
  color: var(--ink-3);
  letter-spacing: 0.02em;
}

.contact-section {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 20px 18px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--line);
}

.contact-section h2 {
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 700;
  color: var(--brand);
  margin-bottom: 12px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.contact-section p {
  font-size: 14px;
  line-height: 1.85;
  color: var(--ink-2);
  margin-bottom: 10px;
}

.contact-section p:last-child { margin-bottom: 0; }

.contact-list {
  list-style: none;
  font-size: 14px;
  line-height: 1.85;
  color: var(--ink-2);
}

.contact-list li {
  padding: 6px 0;
  border-bottom: 1px dashed var(--line);
}

.contact-list li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.contact-list strong {
  color: var(--brand);
  font-weight: 600;
}

.contact-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.contact-stat {
  text-align: center;
  padding: 14px 6px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.contact-stat strong {
  display: block;
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 700;
  background: var(--brand-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 4px;
}

.contact-stat span {
  font-size: 11px;
  color: var(--ink-3);
  font-weight: 500;
}

.contact-note {
  font-size: 13px !important;
  color: var(--ink-3) !important;
  line-height: 1.75 !important;
}

.contact-intro {
  margin-bottom: 14px !important;
}

.contact-channels {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.contact-channel {
  display: flex;
  align-items: center;
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.15s, box-shadow 0.15s;
}

.contact-channel:active {
  transform: scale(0.98);
}

.contact-channel--static {
  cursor: default;
}

.contact-channel--static:active {
  transform: none;
}

.contact-channel-icon {
  flex-shrink: 0;
  font-size: 22px;
  margin-right: 14px;
  line-height: 1;
}

.contact-channel-body {
  flex: 1;
  min-width: 0;
}

.contact-channel-label {
  display: block;
  font-size: 12px;
  color: var(--ink-3);
  margin-bottom: 2px;
}

.contact-channel-value {
  display: block;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.contact-channel-action {
  flex-shrink: 0;
  margin-left: 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--brand);
}

.contact-footer {
  text-align: center;
  padding: 20px 12px 8px;
  font-size: 12px;
  color: var(--ink-3);
  letter-spacing: 0.04em;
}

body.immersive .toast { bottom: 24px; }
