/* 设计令牌：深色暖调 + 单一金色强调。无外链字体。 */
:root {
  --bg: #12100e;
  --bg-raised: #1b1815;
  --bg-card: #211d19;
  --line: #332d27;
  --line-strong: #4a4033;
  --text: #ece5da;
  --text-dim: #a89c8c;
  --text-faint: #776c5e;
  --gold: #c9a227;
  --gold-soft: #e3c766;
  --gold-ink: #17130a;
  --ok: #6fb98f;
  --warn: #d9a441;
  --danger: #c96f5a;
  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 20px;
  --tap: 44px;
  --pad: 16px;
  --tabbar-h: 62px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-size-adjust: 100%;
  overflow-x: hidden;
}

/* flex / grid 子项默认 min-width:auto 会让 input 的固有宽度撑破布局 */
.row > *, .item > *, .field > * { min-width: 0; }
.item .title { overflow-wrap: anywhere; }

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }

.app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(120% 60% at 50% 0%, #1e1913 0%, transparent 70%),
    var(--bg);
}

/* 顶栏 */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(env(safe-area-inset-top) + 10px) var(--pad) 10px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 10px; min-height: var(--tap); }
.brand-mark {
  width: 22px; height: 22px; border-radius: 6px;
  background: linear-gradient(135deg, var(--gold) 0 45%, #8a5a2b 45% 100%);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.35);
}
.brand-text { font-weight: 650; letter-spacing: .04em; }
.age-chip {
  font-size: 12px; font-weight: 700; letter-spacing: .06em;
  color: var(--gold-soft);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 3px 9px;
}

/* 视图 */
.view {
  flex: 1;
  padding: var(--pad);
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 24px);
  outline: none;
  animation: fade .18s ease-out;
}
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .view { animation: none; } }

h1 { font-size: 22px; line-height: 1.3; margin: 4px 0 6px; letter-spacing: .01em; }
h2 { font-size: 15px; margin: 22px 0 10px; color: var(--text-dim); font-weight: 600; letter-spacing: .06em; }
p.lede { color: var(--text-dim); margin: 0 0 18px; font-size: 14px; }

/* 卡片与通用块 */
.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 14px;
}
.stack { display: grid; gap: 10px; }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.muted { color: var(--text-dim); }
.faint { color: var(--text-faint); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }

/* 表单 */
label.field { display: grid; gap: 6px; font-size: 13px; color: var(--text-dim); }
input[type="number"], input[type="text"], select, textarea {
  width: 100%;
  min-width: 0;
  min-height: var(--tap);
  padding: 10px 12px;
  color: var(--text);
  background: var(--bg-raised);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  font: inherit;
}
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
.hint { font-size: 12px; color: var(--text-faint); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap);
  padding: 0 16px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-strong);
  background: var(--bg-raised);
  cursor: pointer;
  font-weight: 600;
}
.btn:hover { border-color: var(--gold); }
.btn.primary {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--gold-ink);
}
.btn.primary:hover { background: var(--gold-soft); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* 尺寸示意：008 起由 web/lib/shape-art.mjs 生成 SVG 轮廓 */
.cigar { display: flex; justify-content: center; align-items: center; width: 100%; height: 84px; }
.cigar svg.cigar-svg { height: 80px; width: auto; max-width: 44px; overflow: visible; display: block; }
.item .cigar, .result-title + .cigar { height: 64px; }
.item .cigar svg.cigar-svg { height: 60px; }

/* 列表项 */
.list { display: grid; gap: 8px; }
.item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 10px;
  align-items: center;
  padding: 12px 14px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.item:hover, .item:focus-visible { border-color: var(--line-strong); background: var(--bg-raised); }
.item .title { font-weight: 600; }
.item .meta { grid-column: 1 / -1; color: var(--text-dim); font-size: 12.5px; }
.pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 8px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
}
.pill.gold { color: var(--gold-soft); border-color: #5a4a1e; background: #1f1a10; }
.pill.warn { color: var(--warn); border-color: #5a4620; }

/* 结果 / 识别 */
.result-title { font-size: 17px; font-weight: 650; }
.score {
  font-variant-numeric: tabular-nums;
  color: var(--gold-soft);
  font-weight: 600;
}
.evidence { margin: 8px 0 0; padding-left: 16px; color: var(--text-dim); font-size: 12.5px; }
.evidence li { margin: 2px 0; }
.notice {
  border: 1px solid #5a4620;
  background: #201a10;
  color: var(--warn);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  font-size: 13px;
}
.notice.info { border-color: var(--line-strong); background: var(--bg-raised); color: var(--text-dim); }
.badge { display: inline-block; margin-right: 6px; padding: 1px 6px; border-radius: 999px; font-size: 11px; vertical-align: 2px; }
.badge.warn { border: 1px solid #5a4620; background: #201a10; color: var(--warn); }
.drop {
  display: grid; place-items: center; gap: 6px;
  min-height: 160px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--r-md);
  color: var(--text-faint);
  text-align: center;
  padding: 16px;
  cursor: pointer;
}
.drop input { display: none; }
.drop img { max-width: 100%; max-height: 220px; border-radius: var(--r-sm); }

/* 空状态 */
.empty { text-align: center; color: var(--text-faint); padding: 40px 16px; }
.empty strong { display: block; color: var(--text-dim); margin-bottom: 4px; }

/* 底部标签栏 */
.tabbar {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: 560px;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  z-index: 20;
}
.tab {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 2px;
  font-size: 11px;
  color: var(--text-faint);
  border-radius: var(--r-sm);
}
.tab svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.tab[aria-current="page"] { color: var(--gold-soft); }

.noscript { padding: 24px; color: var(--text-dim); }

@media (min-width: 600px) {
  .app { border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
}
