
/* =========================================================
   App 风格布局：底部 TabBar + 两列卡片 + 上拉加载
   追加在文件末尾，覆盖前面的桌面布局规则
   ========================================================= */

:root {
  --tabbar-h: 58px;
  --tabbar-safe: env(safe-area-inset-bottom, 0px);
  --player-h: 64px;
}

html,
body {
  background: #eef0f4;
}

body {
  overscroll-behavior-y: none;
}

.app {
  max-width: 760px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  box-shadow: 0 0 40px rgba(20, 24, 34, 0.06);
  padding-bottom: calc(var(--tabbar-h) + var(--tabbar-safe) + 16px);
  position: relative;
}

.topbar {
  padding: 10px 16px;
  gap: 10px;
}

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 10px;
}

.brand-text strong {
  font-size: 14px;
}

.brand-text small {
  font-size: 11px;
}

.view {
  max-width: none;
  margin: 0;
  padding: 14px 14px calc(var(--tabbar-h) + var(--tabbar-safe) + 24px);
}

/* ---------------- 底部 TabBar ---------------- */

.tabbar {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: 760px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  align-items: center;
  height: calc(var(--tabbar-h) + var(--tabbar-safe));
  padding-bottom: var(--tabbar-safe);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: saturate(180%) blur(14px);
  border-top: 1px solid var(--line);
  z-index: 45;
}

.tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: var(--tabbar-h);
  color: var(--ink-3);
  font-size: 11px;
  transition: color 0.15s;
}

.tab-item svg {
  width: 22px;
  height: 22px;
}

.tab-item.active {
  color: var(--brand-deep);
  font-weight: 600;
}

.tab-item.active svg {
  stroke-width: 2.2;
}

/* ---------------- 分段控件 / 筛选 chips ---------------- */

.seg {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: #eceef3;
  border-radius: 12px;
  margin-bottom: 10px;
  overflow-x: auto;
  scrollbar-width: none;
}

.seg::-webkit-scrollbar {
  display: none;
}

.seg-item {
  flex: 1;
  min-width: max-content;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 8px 12px;
  border-radius: 9px;
  font-size: 13.5px;
  color: var(--ink-2);
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.seg-item.active {
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(20, 24, 34, 0.12);
}

.seg-item em {
  font-style: normal;
  font-size: 11px;
  color: var(--ink-3);
}

.chip-row {
  display: flex;
  gap: 8px;
  align-items: center;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 8px;
  scrollbar-width: none;
}

.chip-row::-webkit-scrollbar {
  display: none;
}

.chip-select,
.chip-input,
.chip-btn {
  flex: none;
  height: 32px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  font-size: 12.5px;
  color: var(--ink-2);
}

.chip-select {
  appearance: none;
  padding: 0 26px 0 12px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' fill='none' stroke='%238b92a3' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
}

.chip-input {
  padding: 0 14px;
  width: 130px;
  min-width: 0;
}

.chip-input::placeholder {
  color: var(--ink-3);
}

.chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 12px;
  cursor: pointer;
}

.chip-btn.on {
  background: var(--brand-soft);
  border-color: #ffd0ad;
  color: var(--brand-deep);
}

.chip-btn svg {
  width: 13px;
  height: 13px;
}

/* ---------------- 两列卡片 ---------------- */

.card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

/* 卡片网格后面紧跟普通卡片 / 分段控件时补上间距（.card + .card 只覆盖卡片相邻） */
.card-grid + .card,
.card-grid + .seg,
.card-grid + .chip-row {
  margin-top: 14px;
}

.media-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  transition: transform 0.14s, box-shadow 0.14s;
}

.media-card:active {
  transform: scale(0.985);
}

.media-card:hover {
  box-shadow: 0 10px 24px -16px rgba(20, 24, 34, 0.5);
}

.media-cover {
  position: relative;
  aspect-ratio: 1 / 1;
  background: linear-gradient(135deg, #eceff5, #dfe3ec);
  overflow: hidden;
}

.media-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.media-cover-ph {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: Georgia, serif;
  font-size: 38px;
  color: #a9b0bf;
}

.media-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: rgba(17, 20, 26, 0.62);
  color: #fff;
  backdrop-filter: blur(4px);
}

.media-body {
  padding: 9px 10px 11px;
  min-width: 0;
}

.media-body h3 {
  margin: 0 0 3px;
  font-size: 13.5px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.media-body p {
  margin: 0;
  font-size: 11.5px;
  color: var(--ink-3);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.media-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 7px;
}

.media-tags .chip {
  font-size: 10.5px;
  padding: 0 6px;
}

/* ---------------- 上拉加载 ---------------- */

.feed-sentinel {
  margin: 16px 0 4px;
  padding: 14px;
  text-align: center;
  font-size: 12.5px;
  color: var(--ink-3);
  cursor: pointer;
  user-select: none;
}

.feed-sentinel::after {
  content: '';
}

.feed-sentinel.done {
  color: #b7bdc9;
  cursor: default;
}

/* ---------------- 页头 / 返回 ---------------- */

.sub-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.sub-header-text {
  min-width: 0;
}

.sub-header-text h1 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.01em;
}

.sub-header-text p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--ink-3);
  line-height: 1.45;
}

.back-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  flex: none;
}

.back-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.back-bar-label {
  font-size: 12.5px;
  color: var(--ink-3);
}

.section-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-3);
  letter-spacing: 0.04em;
  margin: 18px 2px 8px;
}

/* ---------------- 详情页字段气泡（i 图标） ---------------- */

.detail-head {
  position: relative;
}

.info-wrap {
  position: absolute;
  top: -2px;
  right: 0;
  z-index: 12;
}

.info-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-3);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.info-btn:hover,
.info-btn.active {
  color: var(--brand-deep);
  border-color: #ffd0ad;
  background: var(--brand-soft);
}

.info-pop {
  position: absolute;
  top: 34px;
  right: 0;
  width: max-content;
  min-width: 190px;
  max-width: min(260px, 72vw);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 18px 40px -22px rgba(20, 24, 34, 0.55);
  padding: 10px 12px;
  animation: info-in 0.14s ease-out;
}

@keyframes info-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
}

.info-pop-title {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 6px;
}

.info-list {
  margin: 0;
}

.info-list > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding: 3px 0;
  border-bottom: 1px dashed var(--line);
}

.info-list > div:last-child {
  border-bottom: none;
}

.info-list dt {
  font-size: 11.5px;
  color: var(--ink-3);
  white-space: nowrap;
}

.info-list dd {
  margin: 0;
  font-size: 11.5px;
  font-family: var(--mono);
  color: var(--ink);
  text-align: right;
  word-break: break-all;
}

/* ---------------- 首页 ---------------- */

.app-hero {
  position: relative;
  padding: 20px 18px;
  border-radius: 18px;
  color: #fff;
  background: linear-gradient(135deg, #1c2130 0%, #2a3040 55%, #3a2a1c 100%);
  overflow: hidden;
  margin-bottom: 12px;
}

.app-hero::after {
  content: '';
  position: absolute;
  right: -40px;
  top: -50px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 106, 0, 0.42), transparent 68%);
}

.app-hero-kicker {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
}

.app-hero-title {
  margin: 6px 0 6px;
  font-size: 22px;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.app-hero-sub {
  margin: 0;
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.68);
  max-width: 36ch;
}

.app-hero-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.app-hero .badge {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.22);
  color: #fff;
}

.app-hero-key {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
  align-self: center;
}

.credit-card {
  display: block;
  cursor: pointer;
  margin-bottom: 0;
}

.credit-card .card-head {
  margin-bottom: 10px;
}

.credit-card .metrics {
  gap: 8px;
}

.credit-card .metric {
  padding: 10px;
}

.credit-card .metric .value {
  font-size: 19px;
}

.entry-tile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--ink-2);
  font-size: 13.5px;
}

.entry-tile:active {
  background: var(--surface-2);
}

.entry-tile .entry-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--brand-soft);
  color: var(--brand-deep);
  flex: none;
}

.entry-tile .entry-label {
  flex: 1;
  min-width: 0;
  color: var(--ink);
  font-weight: 550;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entry-tile svg:last-child {
  color: var(--ink-3);
  width: 14px;
  height: 14px;
}

/* ---------------- 我的 ---------------- */

.profile-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.profile-avatar {
  width: 48px;
  height: 48px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--brand-soft), #ffe1c7);
  color: var(--brand-deep);
  flex: none;
}

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

.profile-name {
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 4px;
}

.profile-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 11.5px;
  color: var(--ink-3);
}

.menu-group {
  margin-bottom: 4px;
}

.menu-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}

.menu-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
}

.menu-row:last-child {
  border-bottom: none;
}

.menu-row:active {
  background: var(--surface-2);
}

.menu-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  color: var(--ink-2);
  flex: none;
}

.menu-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.menu-label {
  font-size: 14px;
  font-weight: 550;
}

.menu-sub {
  font-size: 11.5px;
  color: var(--ink-3);
}

.menu-chevron {
  color: #c3c8d2;
  display: grid;
  place-items: center;
}

.menu-chevron svg {
  width: 16px;
  height: 16px;
}

/* ---------------- 播放器位置：压在 TabBar 之上 ---------------- */

.player {
  bottom: calc(var(--tabbar-h) + var(--tabbar-safe) + 10px);
}

@media (max-width: 640px) {
  .player {
    bottom: calc(var(--tabbar-h) + var(--tabbar-safe) + 8px);
    width: calc(100vw - 20px);
  }

  .toasts {
    bottom: calc(var(--tabbar-h) + var(--tabbar-safe) + 84px);
  }
}

/* 旧桌面 Tab 样式（已不再使用，保留以免缓存旧 HTML 时报错） */
.tabs {
  display: none;
}

/* TTS 两栏在窄屏折叠 */
.tts-layout {
  grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 900px) {
  .app {
    box-shadow: 0 0 60px rgba(20, 24, 34, 0.1);
  }
}
