/** 宋韵留白：米纸底、墨色字、茶绿主操作、茶橙提示。移动优先。 */
:root {
  --paper: #f6f2e8;
  --surface: #fbf9f2;
  --ink: #242a22;
  --tea-green: #42543c;
  --tea-green-light: #6b7f4e;
  --tea-amber: #b27a3a;
  --muted: #73786d;
  --hairline: rgba(36, 42, 34, .16);
  --danger: #a4552e;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
  font-family: -apple-system, "PingFang SC", "Helvetica Neue", sans-serif;
  min-height: 100vh;
}
.serif, .display-title, .section-title { font-family: "Songti SC", "STSong", "Noto Serif SC", serif; font-weight: 600; }

#app { max-width: 560px; margin: 0 auto; min-height: 100vh; }
.page { padding: 14px 16px calc(84px + env(safe-area-inset-bottom)); }
.page.nopad { padding: 0; }

/* 顶部导航 */
.topbar {
  padding: 10px 16px 12px;
  display: flex; align-items: baseline; justify-content: space-between;
  border-bottom: 1px solid var(--hairline);
  background: var(--paper);
  position: sticky; top: 0; z-index: 10;
}
.topbar .title { font-size: 18px; }
.topbar .sub { font-size: 12px; color: var(--muted); }

/* 分组：细线 + 留白，不用卡片框 */
.section { padding: 14px 0 4px; }
.section-title { font-size: 15px; margin-bottom: 10px; }
.hairline-top { border-top: 1px solid var(--hairline); }
.hairline-bottom { border-bottom: 1px solid var(--hairline); }
.muted { color: var(--muted); font-size: 12px; }
.small { font-size: 12px; }
.center { text-align: center; }
.row { display: flex; align-items: center; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; gap: 8px; }
.gap8 { gap: 8px; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; }
.mb8 { margin-bottom: 8px; }

/* 按钮 */
.btn {
  display: block; width: 100%; min-height: 44px; border-radius: 6px;
  font-size: 14px; font-family: inherit; cursor: pointer;
  transition: transform 80ms ease, opacity 160ms ease;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--tea-green); color: #fff; border: 0; font-weight: 600; }
.btn-secondary { background: transparent; color: var(--tea-green); border: 1px solid var(--hairline); }
.btn-ghost { background: transparent; color: var(--muted); border: 0; min-height: 36px; font-size: 13px; }
.btn-amber { background: transparent; color: var(--tea-amber); border: 1px solid var(--hairline); }
.btn.danger { color: var(--danger); }
.btn[disabled] { background: #a9ada3; color: #f5f4ef; opacity: .7; }

/* 标签胶囊 */
.tag {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: 12px; background: rgba(66, 84, 60, .08); color: var(--tea-green);
}
.tag.amber { background: rgba(178, 122, 58, .1); color: var(--tea-amber); }
.tag.plain { background: transparent; border: 1px solid var(--hairline); color: var(--muted); }

/* 列表条目 */
.item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--hairline);
  cursor: pointer; text-decoration: none; color: inherit;
}
.item:last-child { border-bottom: 0; }
.item .emoji { font-size: 22px; width: 34px; text-align: center; flex: none; }
.item .body { flex: 1; min-width: 0; }
.item .name { font-size: 15px; }
.item .meta { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .aside { font-size: 12px; color: var(--muted); flex: none; }

/* 表单 */
input[type=text], input[type=search], textarea, select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--hairline); border-radius: 6px;
  background: var(--surface); color: var(--ink); font-size: 14px; font-family: inherit;
}
textarea { min-height: 80px; resize: vertical; }
input:focus, textarea:focus { outline: none; border-color: var(--tea-green-light); }
.search-bar { position: relative; }
.search-bar .clear { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); }

/* 首页主操作 */
.hero { padding: 20px 0 16px; text-align: center; }
.hero .headline { font-size: 22px; margin-bottom: 4px; }
.hero .sub { color: var(--muted); font-size: 13px; margin-bottom: 16px; }
.big-count { font-size: 40px; font-family: "Songti SC", serif; color: var(--tea-green); line-height: 1.2; }
.photo-thumb { width: 44px; height: 44px; border-radius: 6px; object-fit: cover; flex: none; background: var(--surface); }

/* 图鉴网格 */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding-top: 12px; }
.sticker {
  text-align: center; padding: 12px 6px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--hairline); background: var(--surface);
}
.sticker .art {
  width: 100%; aspect-ratio: 1; border-radius: 6px; margin-bottom: 6px;
  display: flex; align-items: center; justify-content: center; font-size: 30px;
}
.sticker.collected .art { background: rgba(66, 84, 60, .1); }
.sticker.uncollected .art { background: transparent; border: 1px dashed var(--hairline); }
.sticker.uncollected { opacity: .78; }
.sticker.uncollected .tname { color: var(--muted); }
.sticker .tname { font-size: 13px; }
.sticker .tmeta { font-size: 11px; color: var(--muted); }

/* 详情 */
.params { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 12px; padding: 12px 0; }
.param { border-left: 2px solid var(--tea-green-light); padding-left: 10px; }
.param .k { font-size: 11px; color: var(--muted); }
.param .v { font-size: 15px; font-weight: 600; }
.timer-display { font-size: 44px; font-family: "Songti SC", serif; text-align: center; color: var(--tea-green); }
.timer-display.paused { color: var(--muted); }
.timer-display.done { color: var(--tea-amber); }
details.fold { border-top: 1px solid var(--hairline); padding: 10px 0; }
details.fold summary { cursor: pointer; font-weight: 600; list-style: none; }
details.fold summary::-webkit-details-marker { display: none; }
details.fold summary::before { content: '▸ '; color: var(--muted); }
details.fold[open] summary::before { content: '▾ '; }

/* 评分星 */
.stars { display: inline-flex; gap: 2px; font-size: 20px; cursor: pointer; }
.stars .st { color: var(--hairline); }
.stars .st.on { color: var(--tea-amber); }

/* 底部五项 tab */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; max-width: 560px; margin: 0 auto;
  background: var(--surface); border-top: 1px solid var(--hairline);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  flex: 1; text-align: center; padding: 8px 0 6px; text-decoration: none;
  color: var(--muted); font-size: 11px; display: block;
}
.tabbar a .icon { display: block; font-size: 20px; line-height: 1.3; }
.tabbar a.active { color: var(--tea-green); font-weight: 600; }

/* 识茶 */
.capture-stage { text-align: center; padding: 16px 0; }
.capture-preview { max-width: 100%; max-height: 320px; border-radius: 8px; }
.notice {
  background: rgba(178, 122, 58, .08); border-left: 2px solid var(--tea-amber);
  padding: 10px 12px; font-size: 13px; border-radius: 0 6px 6px 0; margin: 12px 0;
}
.spinner {
  width: 22px; height: 22px; border: 2px solid var(--hairline);
  border-top-color: var(--tea-green); border-radius: 50%;
  animation: spin .8s linear infinite; display: inline-block; vertical-align: -5px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 空状态 */
.empty { text-align: center; padding: 28px 0; color: var(--muted); font-size: 13px; }

/* 弹层（发布茶评等） */
.modal-mask {
  position: fixed; inset: 0; background: rgba(36, 42, 34, .35); z-index: 30;
  display: flex; align-items: flex-end; justify-content: center;
}
.modal {
  background: var(--surface); width: 100%; max-width: 560px;
  border-radius: 12px 12px 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  max-height: 82vh; overflow-y: auto;
}
.toast {
  position: fixed; left: 50%; bottom: 110px; transform: translateX(-50%);
  background: rgba(36, 42, 34, .85); color: #fff; font-size: 13px;
  padding: 8px 16px; border-radius: 999px; z-index: 40; max-width: 80vw;
}
