#app { max-width: 560px; margin: 0 auto; min-height: 100%; display: flex; flex-direction: column; }
.hd {
  position: sticky; top: 0; z-index: 5; background: var(--cream);
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.hd h2 { font-size: 20px; flex: 1; }
.hd .back { color: var(--rose); font-size: 17px; }
.hd .nav { display: flex; gap: 16px; }
.hd .count { color: var(--mid); font-size: 16px; }
.body { flex: 1; padding: 0 16px calc(120px + env(safe-area-inset-bottom)); }
.foot {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; background: var(--cream);
  padding: 10px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line);
}
.foot .inner { max-width: 528px; margin: 0 auto; }
.foot .row { display: flex; gap: 10px; }
.foot .row .ghost { flex: 0 0 34%; }
.foot .row .primary { flex: 1; }
.sec { display: flex; justify-content: space-between; align-items: baseline; margin: 16px 2px 8px; }
.sec b { font-size: 16px; }

/* 缩略图网格 3:4 */
.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.grid.g3 { grid-template-columns: repeat(3, 1fr); }
.grid.g2 { grid-template-columns: repeat(2, 1fr); gap: 10px; }
.tile {
  position: relative; aspect-ratio: 3 / 4; border-radius: 10px; overflow: hidden; background: #eee;
}
.tile img { width: 100%; height: 100%; object-fit: cover; }
.tile.sel { outline: 2.5px solid var(--rose); outline-offset: -2.5px; }
.tile .x {
  position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%;
  background: rgba(0, 0, 0, .45); color: #fff; font-size: 14px; line-height: 22px; text-align: center;
}
.tile .ck {
  position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid #fff; background: rgba(0, 0, 0, .18);
}
.tile.sel .ck { background: var(--rose); border-color: var(--rose); }
.tile.sel .ck::after { content: "✓"; color: #fff; font-size: 13px; display: block; text-align: center; line-height: 18px; }
.tile .cap {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 6px 5px; font-size: 14px;
  color: #fff; background: linear-gradient(transparent, rgba(0, 0, 0, .5));
}
.add {
  aspect-ratio: 3 / 4; border-radius: 10px; border: 1.5px dashed var(--rose-m); color: var(--rose);
  display: flex; align-items: center; justify-content: center; font-size: 28px; background: #fff;
}
.add.wide { aspect-ratio: auto; height: 120px; flex-direction: column; font-size: 16px; gap: 4px; }
.add.wide::before { content: "+"; font-size: 26px; line-height: 1; }

/* 出图要求 */
.req { background: #fff; border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 10px; }
.req .top { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; }
.req .top b { font-size: 16px; }
.req .body2 { padding: 0 14px 14px; }
.req label { display: block; font-size: 15px; color: var(--mid); margin: 10px 0 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font-size: 16px;
}
.chip.on { background: var(--rose-l); border-color: var(--rose-m); color: var(--rose-d); }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; }

/* 结果 */
.result { border-radius: 12px; overflow: hidden; background: #fff; border: 1px solid var(--line); }
.result img { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; }
.result .wait {
  aspect-ratio: 2 / 3; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; color: var(--mid); font-size: 15px; background: #f4eeea;
}
.result button { width: 100%; padding: 9px; color: var(--rose); font-weight: 600; font-size: 16px; }
.err { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 14px; margin-top: 12px; }

/* 记录 */
.day { display: flex; justify-content: space-between; margin: 16px 2px 8px; font-size: 16px; font-weight: 600; }
.day span { color: var(--mid); font-weight: 400; font-size: 15px; }

/* 看大图 */
.viewer {
  position: fixed; inset: 0; z-index: 50; background: rgba(20, 14, 16, .94);
  display: flex; flex-direction: column; padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}
.viewer .stage { flex: 1; min-height: 0; display: flex; }
.viewer .pic { flex: 1; min-width: 0; min-height: 0; display: flex; align-items: center; justify-content: center; }
.viewer .pic img { max-width: 100%; max-height: 100%; }
.viewer .refs {
  width: 340px; flex: none; overflow-y: auto; padding: 16px; color: #fff; cursor: default;
  border-left: 1px solid rgba(255,255,255,.15);
}
.viewer .refs h4 { margin: 0 0 8px; font-size: 14px; font-weight: 400; opacity: .6; }
.viewer .refs .row { margin-bottom: 18px; }
.viewer .refs p { margin: 0; font-size: 15px; }
.viewer .refs pre { margin: 0; font: 12px/1.6 ui-monospace, Menlo, monospace; white-space: pre-wrap; opacity: .85; }
.viewer .refs .pics { display: flex; flex-wrap: wrap; gap: 8px; }
.viewer .refs .pics div { width: 96px; aspect-ratio: 3/4; border-radius: 8px; overflow: hidden; cursor: zoom-in; }
.viewer .refs .pics img { width: 100%; height: 100%; object-fit: cover; }
.viewer.plain { z-index: 60; }
.viewer.plain { align-items: center; justify-content: center; cursor: zoom-out; }
.viewer.plain img { flex: none; width: auto; max-width: 100%; max-height: 100%; cursor: default; }
.viewer .bar { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; padding: 12px 16px; align-items: center; color: #fff; }
.viewer .bar .meta { font-size: 15px; opacity: .8; }
.viewer .bar button { color: #fff; min-width: 180px; padding: 11px 14px; border-radius: 10px; background: var(--rose-d); font-weight: 600; }
@media (max-width: 760px) { /* 手机：大图在上，参考往下滑着看，保存钉在底部 */
  .viewer .stage { flex-direction: column; overflow-y: auto; }
  .viewer .pic { flex: none; height: 62vh; }
  .viewer .pic:only-child { flex: 1; height: auto; }
  .viewer .refs { width: auto; overflow: visible; border-left: 0; border-top: 1px solid rgba(255,255,255,.15); }
  .viewer .refs .pics div { width: 84px; }
  .viewer .bar { grid-template-columns: 1fr; gap: 8px; text-align: center; }
  .viewer .bar .meta { font-size: 13px; }
  .viewer .bar button { width: 100%; }
}

/* 设置 */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 12px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; }
.stats div { padding: 14px; }
.stats div + div { border-left: 1px solid var(--line); }
.stats .n { font-size: 26px; font-weight: 700; color: var(--rose-d); }
.stats .n small { font-size: 15px; color: var(--mid); font-weight: 400; margin-left: 2px; }
.list a, .list button, .list .li {
  display: flex; justify-content: space-between; width: 100%; padding: 14px; text-decoration: none;
  color: inherit; text-align: left;
}
.list > * + * { border-top: 1px solid var(--line); }
.list .v { color: var(--mid); }

/* 登录 */
.login { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 0 28px 12vh; gap: 12px; }
.logo { text-align: center; margin-bottom: 28px; }
.logo b { font-family: Georgia, "Times New Roman", serif; font-size: 40px; color: var(--rose-d); letter-spacing: 3px; }
.logo div { color: var(--mid); margin-top: 2px; }

/* 微信授权话术（设置页） */
.consent { background: var(--rose-l); border-radius: var(--r); padding: 12px 14px; margin-top: 16px; font-size: 16px; }
.consent .row { display: flex; justify-content: space-between; align-items: center; }

/* 电脑上:收成手机宽度的一张卡片,底栏跟着卡片走 */
@media (min-width: 700px) {
  html { background: #EFE8E1; }
  body { background: transparent; }
  #app {
    max-width: 430px; margin: 24px auto; min-height: calc(100vh - 48px); background: var(--cream);
    border-radius: 20px; box-shadow: 0 10px 40px rgba(80, 40, 50, .12); overflow: hidden;
  }
  .hd { border-radius: 20px 20px 0 0; }
  .foot { left: 50%; right: auto; width: 430px; transform: translateX(-50%); bottom: 24px; border-radius: 0 0 20px 20px; }
  /* 底栏下面那 24px 用页面底色盖住，长内容滚动时不从底栏下方露出来 */
  .foot::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 24px; background: #EFE8E1; }
  .login { padding-bottom: 6vh; }
}
.hd .nav a.link { text-decoration: none; }
.hd .title { flex: 1; min-width: 0; }
.hd .who { font-size: 15px; color: var(--mid); margin-top: 1px; }

/* 过程日志：只有我方测试账号的结果页有 */
.trace {
  margin-top: 14px; padding: 10px 12px; background: #2B2326; color: #E9DDD8; border-radius: 10px;
  font: 12.5px/1.6 ui-monospace, Menlo, monospace; white-space: pre-wrap; word-break: break-all;
}
