:root {
  --bg: #f7f7f5;
  --card: #fff;
  --line: #e4e4e0;
  --ink: #1d1d1b;
  --muted: #7b7b74;
  --brand: #2f6b4f;
  --brand-soft: #e8f0eb;
  --danger: #b3261e;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
}

a { color: var(--brand); text-decoration: none; }

button {
  font: inherit;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 8px;
  padding: 6px 14px;
  color: var(--ink);
}
button:hover { border-color: #c9c9c2; }
button.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
button.primary:hover { background: #275c43; }
button.ghost { border-color: transparent; background: transparent; }
button.danger { color: var(--danger); border-color: #e7c7c4; }
button:disabled { opacity: .5; cursor: not-allowed; }

input, textarea, select {
  font: inherit;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  background: #fff;
  color: var(--ink);
}
input:focus, textarea:focus, select:focus {
  outline: 2px solid var(--brand-soft);
  border-color: var(--brand);
}
textarea { resize: vertical; }

.app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 210px;
  border-right: 1px solid var(--line);
  background: var(--card);
  padding: 16px 12px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand {
  font-weight: 700;
  font-size: 16px;
  padding: 0 8px 14px;
  color: var(--brand);
}
.nav-item {
  display: block;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--ink);
  margin-bottom: 2px;
}
.nav-item:hover { background: var(--bg); }
.nav-item.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }

.main {
  flex: 1;
  min-width: 0;
  padding: 24px 28px 60px;
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  gap: 12px;
}
.page-title { font-size: 20px; font-weight: 700; margin: 0; }
.page-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}

.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 120px; }
.field { margin-bottom: 12px; }
.field > label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  background: var(--bg);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 12px;
  color: var(--muted);
}

.thumb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, 96px);
  gap: 8px;
}
.thumb {
  width: 96px; height: 96px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--bg);
  border: 1px solid var(--line);
}

.empty {
  color: var(--muted);
  text-align: center;
  padding: 40px 10px;
}

.muted { color: var(--muted); }
.small { font-size: 12px; }
.right { text-align: right; }
.grow { flex: 1; }
.mt { margin-top: 12px; }
.mb { margin-bottom: 12px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 40px;
  transform: translateX(-50%);
  background: #1d1d1b;
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  z-index: 99;
}

/* 未登录时的居中卡片 */
.login-wrap {
  width: 100%;
  max-width: 360px;
  margin: 60px auto;
  padding: 0 16px;
  box-sizing: border-box;
}

/* ---------- 数据看板 ---------- */
.stat-h {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin: 22px 0 8px;
}
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
}
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 12px;
}
.stat-n {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
}
.stat-l {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}
.rank-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
}
.rank-row:last-child { border-bottom: none; }
.rank-no {
  width: 18px;
  color: var(--muted);
  font-size: 12px;
}

.legend {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
}
.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 4px;
}
.bars {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 120px;
}
.bar-col {
  flex: 1;
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
.bar-pair {
  flex: 1;
  display: flex;
  align-items: flex-end;
  gap: 2px;
}
.bar {
  flex: 1;
  border-radius: 2px 2px 0 0;
  min-height: 2px;
}
.bar-x {
  font-size: 10px;
  color: var(--muted);
  text-align: center;
  margin-top: 4px;
  white-space: nowrap;
}

/* ---------- 图文流：三列方图 + 旁白断行 ---------- */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 10px;
}
.photo-cell {
  position: relative;
  /* padding-top 百分比是相对宽度算的，等于强制正方形。
     比 aspect-ratio 兼容性好——有些安卓 Chrome 上 aspect-ratio 不生效。 */
  padding-top: 100%;
  overflow: hidden;
  border-radius: 8px;
  background: var(--bg);
}
.photo-cell > img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.note-block {
  border-left: 3px solid var(--line);
  padding: 6px 0 6px 12px;
  margin: 10px 0;
  color: var(--muted);
  white-space: pre-wrap;
}

.stage-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 4px;
  border-radius: 6px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
}
