/* 卡片滑动 — 社交质感 */

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

:root {
  --bg: #fce8f0;
  --surface: #ffffff;
  --surface-2: #fff0f5;
  --ink: #1a0a12;
  --ink-2: #4a3040;
  --ink-3: #9a7088;
  --line: rgba(253, 38, 122, 0.1);
  --line-strong: rgba(253, 38, 122, 0.18);
  --brand: #ff2d6a;
  --brand-2: #ff6036;
  --brand-grad: linear-gradient(135deg, #ff2d6a 0%, #ff6036 50%, #ff9a44 100%);
  --like: #ff2d6a;
  --skip: #5b8def;
  --nav-h: 56px;
  --header-h: 52px;
  --radius-lg: 28px;
  --radius-md: 16px;
  --shadow-card: 0 10px 36px rgba(255, 45, 106, 0.12), 0 4px 12px rgba(255, 96, 54, 0.08);
  --shadow-float: 0 14px 44px rgba(255, 45, 106, 0.2);
  --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 90% 60% at 20% 0%, rgba(255, 45, 106, 0.22) 0%, transparent 55%),
    radial-gradient(ellipse 70% 50% at 90% 20%, rgba(255, 154, 68, 0.2) 0%, transparent 50%),
    radial-gradient(ellipse 80% 55% at 50% 100%, rgba(155, 89, 255, 0.15) 0%, transparent 55%),
    linear-gradient(160deg, #fde0ec 0%, #fce8f0 40%, #fff0e8 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(255, 255, 255, 0.82);
  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.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(255, 255, 255, 0.88);
  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(255, 45, 106, 0.35);
}

/* ── 发现页 ── */
.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: #d42a62;
  margin-bottom: 10px;
  padding: 6px 16px;
  align-self: center;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 20px;
  border: 1px solid rgba(255, 45, 106, 0.2);
  box-shadow: 0 2px 12px rgba(255, 45, 106, 0.1);
}

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

.swipe-card {
  position: absolute;
  inset: 0;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  touch-action: none;
  user-select: none;
  will-change: transform;
  overflow: hidden;
}

.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: var(--surface);
  transform: scale(0.96) translateY(10px);
  pointer-events: none;
  box-shadow: 0 6px 20px rgba(255, 45, 106, 0.12);
}

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

/* 意境图 */
.card-scene {
  position: relative;
  flex-shrink: 0;
  height: 100px;
  overflow: hidden;
}

.card-scene--shell {
  flex: 1;
  height: auto;
}

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

.card-scene::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 48px;
  background: linear-gradient(180deg, transparent 0%, rgba(255, 255, 255, 0.95) 100%);
  pointer-events: none;
}

.card-scene-seal {
  position: absolute;
  right: 14px;
  bottom: 12px;
  z-index: 1;
  font-family: var(--font-serif);
  font-size: 11px;
  color: rgba(80, 55, 65, 0.55);
  padding: 2px 7px;
  border: 1px solid rgba(80, 55, 65, 0.18);
  border-radius: 3px;
  letter-spacing: 0.12em;
  background: rgba(255, 255, 255, 0.45);
}

.card-inner {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100%;
  padding: 16px 28px 24px;
  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(255, 255, 255, 0.92);
  transform: rotate(14deg);
}

.card-stamp-skip {
  left: 28px;
  color: var(--skip);
  border-color: var(--skip);
  background: rgba(255, 255, 255, 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: #d42a62;
  letter-spacing: 0.04em;
  margin-bottom: 20px;
}

.card-title {
  font-family: var(--font-serif);
  font-size: 32px;
  font-weight: 700;
  background: linear-gradient(135deg, #1a0a12 30%, #8b2252 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: 0.04em;
  margin-bottom: 20px;
  line-height: 1.3;
  width: 100%;
  white-space: nowrap;
}

.card-poem {
  font-family: var(--font-serif);
  font-size: 20px;
  line-height: 1.95;
  color: var(--ink-2);
  margin-bottom: 24px;
  letter-spacing: 0.03em;
  width: 100%;
  white-space: nowrap;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.tag-pill {
  font-size: 12px;
  font-weight: 600;
  color: #c42a58;
  padding: 5px 14px;
  background: linear-gradient(135deg, #fff0f5 0%, #ffe8f0 100%);
  border: 1px solid rgba(255, 45, 106, 0.25);
  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(255, 45, 106, 0.28);
}

.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: linear-gradient(180deg, #ff2d6a, #ff9a44);
}

.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: #8b2252;
  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: #ff2d6a;
  font-weight: 300;
}

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

.detail-hero {
  margin: 0 16px 0;
  padding: 32px 20px;
  text-align: center;
  background: var(--surface);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(255, 45, 106, 0.1) 0%, transparent 60%);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(255, 45, 106, 0.1);
  width: calc(100% - 32px);
  box-sizing: border-box;
}

.detail-meta {
  font-size: 13px;
  font-weight: 600;
  color: #d42a62;
  margin-bottom: 16px;
  white-space: nowrap;
  width: 100%;
}

.detail-title {
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 28px;
  letter-spacing: 0.04em;
  background: linear-gradient(135deg, #1a0a12 30%, #8b2252 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  width: 100%;
  white-space: nowrap;
}

.detail-lines {
  font-family: var(--font-serif);
  font-size: 19px;
  line-height: 2.1;
  color: var(--ink);
  letter-spacing: 0.03em;
  width: 100%;
}

.detail-lines p {
  margin: 0;
  white-space: nowrap;
  width: 100%;
}

.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: #d42a62;
  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(255, 45, 106, 0.4);
}

.toast.show { opacity: 1; }

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