/* 续命一杯 · 网页版样式
 *
 * 设计语言：柔和弥散渐变底 + 磨砂玻璃卡片 + 大圆角胶囊控件。
 * 配色沿用小程序 V3 令牌（草木绿 + 米白）：不出现粗黑描边、硬阴影与高饱和撞色块。
 * 超限态一律「深墨绿底 + 米白字」，禁止使用红色（设计原则 2「不评判」）。
 */

:root {
  --forest: #4A6B4F;
  --forest-deep: #3A5540;
  --bamboo: #7BA05B;
  --sprout: #A8C09A;
  --moss: #C9D8BE;
  --cream: #F7F5EF;
  --paper: #FFFFFF;
  --brand-wash: #EAF0E4;
  --clay: #C67B5C;
  --ink: #2F3B31;
  --ink-soft: rgba(47, 59, 49, 0.62);
  --ink-faint: rgba(47, 59, 49, 0.42);
  --line-ink: rgba(74, 107, 79, 0.16);
  --line-soft: rgba(74, 107, 79, 0.09);
  --bd: 1px solid rgba(74, 107, 79, 0.16);
  --bd-thin: 1px solid rgba(74, 107, 79, 0.09);
  /* 玻璃面：半透明白 + 亮色发丝边，叠在弥散渐变底上 */
  --glass: rgba(255, 255, 255, 0.66);
  --glass-strong: rgba(255, 255, 255, 0.82);
  --glass-edge: 1px solid rgba(255, 255, 255, 0.72);
  --sh-soft: 0 18px 48px rgba(74, 107, 79, 0.10);
  --sh-lift: 0 26px 64px rgba(74, 107, 79, 0.16);
  --sh-pill: 0 6px 18px rgba(74, 107, 79, 0.14);
  --r-card: 28px;
  --r-tile: 22px;
  --r-pill: 999px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  font: 400 16px/1.65 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  background: var(--cream);
  min-height: 100vh;
}

/* 弥散渐变底：四团低饱和绿/米/陶土光斑，固定不随滚动 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(52% 44% at 10% 4%, rgba(168, 192, 154, 0.42), transparent 62%),
    radial-gradient(44% 38% at 92% 2%, rgba(198, 123, 92, 0.13), transparent 60%),
    radial-gradient(50% 46% at 88% 88%, rgba(201, 216, 190, 0.5), transparent 66%),
    radial-gradient(42% 40% at 6% 92%, rgba(123, 160, 91, 0.18), transparent 62%);
}

a { color: var(--forest); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- 骨架：左侧玻璃导航 + 右侧主区 ---------- */
.shell {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  gap: clamp(16px, 2.6vw, 32px);
  max-width: 1280px;
  margin: 0 auto;
  padding: clamp(14px, 2.4vw, 26px) clamp(14px, 3vw, 34px) 40px;
  align-items: start;
}

.side {
  position: sticky;
  top: clamp(14px, 2.4vw, 26px);
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 22px 18px;
  border-radius: 32px;
  background: var(--glass);
  border: var(--glass-edge);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow: var(--sh-soft);
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 34px; height: 34px; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-name { font-size: 19px; font-weight: 600; color: var(--forest); letter-spacing: .02em; }
.brand-sub { font-size: 11px; color: var(--ink-faint); letter-spacing: .06em; }

.nav { display: flex; flex-direction: column; gap: 6px; }
.nav a {
  padding: 11px 18px;
  border-radius: var(--r-pill);
  color: var(--ink-soft);
  font-size: 15px;
  border: 1px solid transparent;
  transition: background .15s ease, color .15s ease;
}
.nav a:hover { background: rgba(255, 255, 255, 0.6); text-decoration: none; color: var(--forest); }
.nav a.on {
  background: var(--paper);
  color: var(--forest);
  font-weight: 500;
  box-shadow: var(--sh-pill);
}

.side-note {
  margin-top: auto;
  padding: 14px 16px;
  border-radius: var(--r-tile);
  background: rgba(234, 240, 228, 0.66);
  font-size: 12px;
  line-height: 1.9;
  color: var(--ink-soft);
}

/* 侧栏底部的退出入口 */
.side > .side-logout { margin-top: 12px; width: 100%; padding: 9px 18px; font-size: 14px; }
/* .btn 的 display:inline-flex 会盖掉 hidden 属性的默认 display:none，必须显式兜住 */
[hidden] { display: none !important; }

.main { min-width: 0; }
/* 视图内所有顶层块（页头、筛选行、卡片、面板）交给 grid 统一间距，
   不再靠各自的 margin，避免「这块贴那块、那块又空一大截」 */
.view {
  display: grid;
  gap: 20px;
  align-content: start;
  padding: clamp(8px, 1.6vw, 18px) 0 40px;
}

/* ---------- 页头 ---------- */
.head { margin: 0; }
.head h1 {
  margin: 0 0 6px;
  font-size: clamp(22px, 2.6vw, 28px);
  font-weight: 600;
  letter-spacing: .01em;
  color: var(--forest);
}
.head p { margin: 0; color: var(--ink-soft); font-size: 15px; max-width: 62ch; }

.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row > .input { flex: 1 1 180px; min-width: 0; }
.spacer { flex: 1 1 auto; }

/* ---------- 页签：小红书式下划线（窄屏可横滑） ---------- */
.tabs {
  display: flex;
  align-items: flex-end;
  gap: clamp(16px, 3.4vw, 34px);
  margin: 0 0 -6px;
  padding: 0 2px 1px;
  border-bottom: 1px solid var(--line-soft);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative;
  flex: none;
  padding: 10px 2px 12px;
  color: var(--ink-soft);
  font-size: 16px;
  white-space: nowrap;
  transition: color .15s ease;
}
.tab:hover { text-decoration: none; color: var(--forest); }
.tab.on { color: var(--forest); font-weight: 600; font-size: 17px; }
.tab.on::after {
  content: "";
  position: absolute;
  left: 50%; bottom: 4px;
  transform: translateX(-50%);
  width: 20px; height: 3px; border-radius: 999px;
  background: linear-gradient(90deg, var(--forest), var(--bamboo));
}

/* ---------- 控件 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 11px 24px; border: 0; border-radius: var(--r-pill);
  background: linear-gradient(135deg, var(--forest), #587F5E); color: var(--cream);
  font: inherit; font-size: 15px; cursor: pointer;
  box-shadow: var(--sh-pill);
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 10px 26px rgba(74, 107, 79, 0.24); text-decoration: none; }
.btn:disabled { background: var(--moss); box-shadow: none; transform: none; cursor: default; }
.btn-ghost {
  background: var(--glass); color: var(--forest);
  border: var(--glass-edge); box-shadow: var(--sh-soft);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.btn-ghost:hover { background: var(--glass-strong); }

.chip {
  padding: 8px 18px; border-radius: var(--r-pill);
  border: var(--glass-edge); background: var(--glass); color: var(--ink-soft);
  font: inherit; font-size: 14px; cursor: pointer;
  transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.chip:hover { color: var(--forest); background: var(--glass-strong); }
.chip.on {
  background: linear-gradient(135deg, var(--forest), #587F5E);
  border-color: transparent; color: var(--cream); box-shadow: var(--sh-pill);
}

.input {
  padding: 12px 18px; border: 1px solid rgba(255, 255, 255, 0.85); border-radius: var(--r-pill);
  background: var(--glass-strong); color: var(--ink); font: inherit; font-size: 15px;
  min-width: 0; box-shadow: inset 0 1px 2px rgba(74, 107, 79, 0.05);
}
.input::placeholder { color: var(--ink-faint); }
.input:focus { outline: 2px solid var(--sprout); outline-offset: 1px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field span { font-size: 13px; color: var(--ink-soft); }

/* ---------- 表格 ---------- */
.table-wrap {
  flex: 1 1 auto; min-height: 0; max-height: 420px; overflow: auto;
  border-radius: 20px; border: var(--bd-thin);
  scrollbar-width: thin;
}
table {
  width: 100%; border-collapse: separate; border-spacing: 0;
  background: var(--glass-strong); overflow: hidden;
}
th, td { padding: 13px 18px; text-align: right; font-size: 14px; border-bottom: var(--bd-thin); font-variant-numeric: tabular-nums; }
th:first-child, td:first-child { text-align: left; }
thead th {
  position: sticky; top: 0; z-index: 1;
  background: rgba(234, 240, 228, 0.96); color: var(--forest);
  font-weight: 500; font-size: 13px; white-space: nowrap;
}
td.date { white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(255, 255, 255, 0.55); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.stat {
  background: var(--glass); border: var(--glass-edge); border-radius: var(--r-tile);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--sh-soft); padding: 20px 22px;
}
.stat b { display: block; font-size: 28px; font-weight: 600; color: var(--forest); font-variant-numeric: tabular-nums; }
.stat span { font-size: 13px; color: var(--ink-soft); }

/* 面板统一为纵向 flex：grid2 里两栏等高时内容跟着撑开，不留一侧空白一侧截断 */
.panel {
  display: flex; flex-direction: column; gap: 4px;
  background: var(--glass); border: var(--glass-edge); border-radius: var(--r-card);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--sh-soft); padding: 24px 26px;
}
.panel h2 { margin: 0 0 16px; font-size: 17px; font-weight: 600; color: var(--forest); }

.stack { display: flex; flex-direction: column; gap: 18px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; align-items: stretch; }

.list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; flex: 1 1 auto; }
.list li {
  display: flex; justify-content: space-between; gap: 12px; font-size: 14px;
  padding: 10px 14px; border-radius: 16px; background: rgba(255, 255, 255, 0.55);
}
.list li span:last-child { color: var(--ink-soft); font-variant-numeric: tabular-nums; white-space: nowrap; }

.note { font-size: 13px; color: var(--ink-soft); }
.state {
  padding: 52px 20px; text-align: center; color: var(--ink-soft);
  background: var(--glass); border: var(--glass-edge); border-radius: var(--r-card);
  box-shadow: var(--sh-soft);
}
.state.err { background: rgba(243, 239, 231, 0.8); color: var(--forest-deep); }

/* ---------- 发现 · 喝什么流（小红书式瀑布流卡片） ---------- */
.feed-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.feed-card {
  display: flex; flex-direction: column;
  background: var(--paper);
  border: var(--bd-thin);
  border-radius: var(--r-tile);
  overflow: hidden;
  box-shadow: 0 6px 18px rgba(74, 107, 79, 0.06);
  transition: transform .18s ease, box-shadow .18s ease;
}
.feed-card:hover { transform: translateY(-3px); box-shadow: var(--sh-lift); }
/* 记录照片是 1:1，这里按 3:4 居中裁切出小红书那种竖图卡片 */
.card-media { position: relative; }
.rate-badge {
  position: absolute; right: 8px; top: 8px;
  padding: 2px 9px; border-radius: var(--r-pill);
  background: rgba(58, 85, 64, 0.82); color: var(--cream);
  font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.rate-badge::before { content: "★ "; font-size: 10px; }
.feed-photo { aspect-ratio: 3 / 4; background: var(--brand-wash); }
/* 类别底色在发现卡与排行榜缩略图之间保持一致 */
.feed-photo.coffee, .rank-thumb.coffee { background: #F0E7DE; }
.feed-photo.milktea, .rank-thumb.milktea { background: #F6EDE4; }
.feed-photo.tea, .rank-thumb.tea { background: var(--brand-wash); }
.feed-photo.alcohol, .rank-thumb.alcohol { background: #EAEEF1; }
.feed-photo.other, .rank-thumb.other { background: #EFF1E9; }
.feed-photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.feed-photo .illus { width: 100%; height: 100%; }
.feed-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; }
.card-title {
  font-size: 14px; font-weight: 500; line-height: 1.5; color: var(--ink);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-sub {
  font-size: 12px; color: var(--ink-faint);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-foot { display: flex; align-items: center; gap: 6px; margin-top: 6px; min-height: 24px; }
.card-foot .spacer { flex: 1 1 auto; }
/* 图标组整体靠右：昵称为空（如品牌小记）时也不会挤在左边 */
.card-foot .act:first-of-type { margin-left: auto; }
.who {
  display: flex; align-items: center; gap: 6px; min-width: 0;
  font-size: 12px; color: var(--ink-soft);
}
.who > span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar {
  width: 22px; height: 22px; border-radius: 50%; object-fit: cover; flex: none;
  background: var(--moss); box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.9);
}
/* 点赞/想试：图标 + 计数，选中态用深墨绿（不用红色，见文件头设计约束） */
.act {
  display: inline-flex; align-items: center; gap: 4px; flex: none;
  padding: 3px 7px; border: 0; border-radius: var(--r-pill);
  background: transparent; color: var(--ink-faint);
  font: inherit; font-size: 12px; font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, transform .1s ease;
}
.act .ic { width: 15px; height: 15px; flex: none; }
button.act:hover { background: rgba(234, 240, 228, 0.9); color: var(--forest); }
button.act:active { transform: scale(0.92); }
button.act.on { background: rgba(234, 240, 228, 0.95); color: var(--forest); font-weight: 600; }
button.act:disabled { opacity: .45; cursor: default; transform: none; }
.act.static { cursor: default; }
.meta-pill {
  padding: 3px 12px; border-radius: var(--r-pill);
  background: rgba(234, 240, 228, 0.75); color: var(--ink-soft);
  font-size: 12px; font-variant-numeric: tabular-nums;
}

/* ---------- 排行榜 ---------- */
.rank-list { display: flex; flex-direction: column; gap: 12px; counter-reset: rank; }
.rank-row {
  display: grid; grid-template-columns: 34px 56px 1fr auto; grid-template-rows: auto auto;
  align-items: center; gap: 4px 14px; width: 100%;
  padding: 13px 20px 13px 16px; text-align: left;
  background: var(--glass); border: var(--glass-edge); border-radius: 24px;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--sh-soft); font: inherit; color: var(--ink); cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
}
.rank-row:hover { transform: translateY(-2px); box-shadow: var(--sh-lift); text-decoration: none; }
/* 名次徽章由 CSS counter 生成，不改 DOM */
.rank-row::before {
  counter-increment: rank;
  content: counter(rank);
  grid-column: 1; grid-row: 1 / 3;
  width: 30px; height: 30px; display: grid; place-items: center;
  border-radius: 50%; background: rgba(234, 240, 228, 0.9);
  color: var(--forest); font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.rank-row:nth-child(1)::before { background: linear-gradient(135deg, #E4D3AE, #D8BE8A); color: #6B5A33; }
.rank-row:nth-child(2)::before { background: linear-gradient(135deg, #E2E5E0, #C6CDC6); color: #5A655C; }
.rank-row:nth-child(3)::before { background: linear-gradient(135deg, #E9D6C6, #D6B69E); color: #7A5A42; }
.rank-thumb { grid-column: 2; grid-row: 1 / 3; width: 56px; height: 56px; border-radius: 18px; overflow: hidden; background: var(--brand-wash); }
.rank-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.rank-thumb .illus { width: 100%; height: 100%; }
.rank-name { grid-column: 3; grid-row: 1; font-weight: 600; }
.rank-num { grid-column: 4; grid-row: 1; color: var(--forest); font-weight: 600; font-variant-numeric: tabular-nums; }
.rank-sub { grid-column: 3 / 5; grid-row: 2; font-size: 13px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips .chip { cursor: default; }
.chips .chip:hover { background: var(--glass); color: var(--ink-soft); }

/* ---------- 窄屏：侧栏收起为顶部玻璃条 ---------- */
@media (max-width: 1180px) {
  .feed-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; padding-top: 12px; }
  .side {
    position: static;
    flex-direction: row; align-items: center; flex-wrap: wrap;
    gap: 12px; padding: 12px 14px; border-radius: 22px;
  }
  .nav { flex-direction: row; }
  .nav a { padding: 8px 16px; font-size: 14px; }
  .side-note { display: none; }
  .side > .side-logout { width: auto; margin-top: 0; margin-left: auto; }
  .brand-sub { display: none; }
  .head p { font-size: 14px; }
  .feed-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .feed-body { padding: 9px 10px 10px; }
}

@media (max-width: 720px) {
  .rank-thumb { width: 44px; height: 44px; }
  .rank-row { grid-template-columns: 30px 44px 1fr auto; padding: 10px 14px; }
  .rank-row::before { width: 26px; height: 26px; font-size: 13px; }
  .head h1 { font-size: 24px; }
  .tab { font-size: 15px; padding-bottom: 10px; }
  .tab.on { font-size: 16px; }
}

/* 手机竖屏：卡片是主要阅读对象，保留两列，只收紧文字与图标 */
@media (max-width: 460px) {
  .feed-grid { gap: 8px; }
  .card-title { font-size: 13px; }
  .card-sub { font-size: 11px; }
  .act { padding: 3px 5px; font-size: 11px; }
  .act .ic { width: 14px; height: 14px; }
  .who { font-size: 11px; }
  .avatar { width: 20px; height: 20px; }
  .rate-badge { font-size: 11px; padding: 1px 7px; }
}
