/* 群友打分表 · 移动端优先。零外部依赖：字体走系统栈，不引任何 CDN。 */

:root {
  --ink: #16181d;
  --ink-2: #3f4652;
  --ink-3: #79818f;
  --line: #e6e8ec;
  --bg: #f6f7f9;
  --card: #ffffff;
  --accent: #b8860b;
  --accent-soft: #fdf6e3;
  --danger: #c0392b;
  --ok: #1e8a5f;
  --radius: 14px;
  --tap: 44px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --nav-h: calc(56px + var(--safe-b));
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #eef0f3;
    --ink-2: #b9c0cb;
    --ink-3: #7d8493;
    --line: #2a2f38;
    --bg: #111318;
    --card: #191c22;
    --accent: #e0b64a;
    --accent-soft: #2a2318;
    --danger: #e57373;
    --ok: #4cc38a;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }   /* .btn/.fab 的 display 会盖掉 UA 的 [hidden]，必须显式压过 */
html, body { margin: 0; padding: 0; }
body {
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
        "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { border: 0; background: none; cursor: pointer; }
a { color: var(--accent); }

.app { max-width: 700px; margin: 0 auto; padding-bottom: calc(var(--nav-h) + 12px); }
.row .dt { display: none; }

/* ---------- 顶栏 ---------- */
.top {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
  padding: 10px 14px 8px;
}
.top h1 { margin: 0 0 8px; font-size: 17px; letter-spacing: .5px; display: flex; align-items: center; gap: 8px; }
.top h1 .who {
  margin-left: auto; font-size: 12px; font-weight: 400; color: var(--ink-3);
  max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.search { display: flex; gap: 8px; align-items: center; }
.search input {
  flex: 1; min-width: 0; height: 38px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--card);
}
.search input:focus { outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: -1px; }
.chip-row { display: flex; gap: 6px; overflow-x: auto; padding: 8px 0 2px; scrollbar-width: none; }
.chip-row::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; height: 30px; padding: 0 12px; border-radius: 15px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink-2); font-size: 13px;
}
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); margin: 12px 14px; overflow: hidden;
}
.card > h2 {
  margin: 0; padding: 12px 14px; font-size: 14px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 8px;
}
.card > h2 .more { margin-left: auto; font-size: 12px; color: var(--ink-3); font-weight: 400; }

/* ---------- 大数据面板 ---------- */
.stats { padding: 12px 14px; }
.stats .headline { font-size: 14px; color: var(--ink-2); margin-bottom: 10px; }
.stats .headline b { color: var(--accent); font-size: 17px; padding: 0 2px; }
.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.metric { background: var(--bg); border-radius: 10px; padding: 8px; text-align: center; }
.metric .v { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.metric .k { font-size: 11px; color: var(--ink-3); margin-top: 2px; }
.podium { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.pod-group { min-width: 0; }
.pod-group .t { font-size: 12px; color: var(--ink-3); margin-bottom: 4px; }
.pod-row { display: flex; gap: 6px; min-width: 0; }
.pod {
  flex: 1; min-width: 0; background: var(--bg); border-radius: 10px; padding: 7px 8px;
  display: flex; flex-direction: column; gap: 2px;
}
.pod .n { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pod .s { font-size: 13px; font-weight: 600; color: var(--accent); font-variant-numeric: tabular-nums; }

/* ---------- 排行榜 ---------- */
.board { padding: 0; }
.row {
  display: grid; grid-template-columns: 34px 1fr auto; gap: 8px; align-items: center;
  padding: 6px 12px 6px 0; border-bottom: 1px solid var(--line);
  border-left: 4px solid var(--band, transparent);
  min-height: 38px; width: 100%; text-align: left;
}
.row:last-child { border-bottom: 0; }
.row:active { background: var(--bg); }
.row .rk {
  text-align: center; font-variant-numeric: tabular-nums; font-weight: 600;
  font-size: 13px; color: var(--band, var(--ink-3));
}
/* 一本一行：名字与「N 人 ±sd」并排，名字过长时优先截名字 */
.row .nm { min-width: 0; display: flex; align-items: baseline; gap: 7px; line-height: 1.35; }
.row .nm .t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14.5px; }
.row .nm .sub { flex: 0 0 auto; font-size: 11px; color: var(--ink-3); white-space: nowrap; }
.row .sc {
  font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums;
  text-align: right; min-width: 44px;
}
.row .mine-dot {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--ok); vertical-align: middle; margin-left: 5px;
}
.band-sep {
  padding: 3px 14px; font-size: 10.5px; color: var(--ink-3); background: var(--bg);
  border-bottom: 1px solid var(--line); letter-spacing: .5px;
}

/* 首页顶部的保护提示 */
.notice {
  margin: 10px 14px 0; padding: 8px 12px; border-radius: 10px; font-size: 12.5px;
  color: var(--danger); background: color-mix(in srgb, var(--danger) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--danger) 22%, transparent); text-align: center;
}

/* 弹层里的次要文字链 */
.linkish {
  display: block; width: 100%; margin-top: 14px; padding: 6px;
  font-size: 13px; color: var(--ink-3); text-decoration: underline; text-underline-offset: 3px;
}

/* ---------- 宽屏：别浪费半个屏幕 ----------
   实测 1440px 下原来 740px（51%）是空白、一屏只有 10 行。
   放开容器宽度 + 补一列发行时间 + 压扁大数据面板，一屏能到 20 行以上。 */
@media (min-width: 900px) {
  .app { max-width: 1120px; }
  .row { grid-template-columns: 46px 1fr 74px 62px; }
  .row .dt {
    display: block; font-size: 12px; color: var(--ink-3);
    font-variant-numeric: tabular-nums; text-align: right;
  }
  .row .nm { gap: 10px; }
  .row .nm .t { font-size: 15px; }
  .board-head {
    display: grid; grid-template-columns: 46px 1fr 74px 62px; gap: 8px;
    padding: 6px 12px 6px 4px; font-size: 11.5px; color: var(--ink-3);
    background: var(--bg); border-bottom: 1px solid var(--line);
  }
  .board-head span:nth-child(1) { text-align: center; }
  .board-head span:nth-child(3),
  .board-head span:nth-child(4) { text-align: right; }
  .metrics { grid-template-columns: repeat(6, 1fr); }
  .podium { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; }
  .stats .headline { font-size: 15px; }
  .work .reason.clamp { -webkit-line-clamp: 2; }
}
.board-head { display: none; }

/* ---------- 推荐作品 ---------- */
.work { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.work:last-child { border-bottom: 0; }
.work .hd { display: flex; gap: 10px; align-items: flex-start; }
.work .ti { flex: 1; min-width: 0; font-weight: 600; }
.work .meta { font-size: 12px; color: var(--ink-3); margin-top: 3px; display: flex; flex-wrap: wrap; gap: 8px; }
.work .tag {
  font-size: 11px; padding: 1px 7px; border-radius: 9px;
  background: var(--accent-soft); color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
}
.work .ti { text-align: left; padding: 0; }
.reason { font-size: 13px; color: var(--ink-2); margin-top: 7px; white-space: pre-wrap;
  word-break: break-word; text-align: left; display: block; width: 100%; }
.reason .byline { color: var(--accent); font-weight: 600; }
.reason.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.voters { font-size: 11.5px; color: var(--ink-3); margin-top: 6px; text-align: left;
  display: block; width: 100%; word-break: break-word; }
.plus {
  flex: 0 0 auto; min-width: 62px; height: 38px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--card);
  display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1;
}
.plus .c { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.plus .l { font-size: 10px; color: var(--ink-3); }
.plus[data-mine="1"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.plus[data-mine="1"] .l { color: rgba(255,255,255,.85); }

/* ---------- 列表通用 ---------- */
.item { padding: 11px 14px; border-bottom: 1px solid var(--line); display: flex; gap: 10px; align-items: center; }
.item:last-child { border-bottom: 0; }
.item .g { flex: 1; min-width: 0; }
.item .g .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .g .s { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }
.empty { padding: 28px 16px; text-align: center; color: var(--ink-3); font-size: 13px; }

/* ---------- 按钮 ---------- */
.btn {
  height: var(--tap); padding: 0 16px; border-radius: 11px; font-size: 15px;
  background: var(--card); border: 1px solid var(--line); color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); }
.btn.sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.btn:disabled { opacity: .45; }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }

.fab {
  position: fixed; right: 16px; bottom: calc(var(--nav-h) + 14px); z-index: 25;
  height: 50px; padding: 0 20px; border-radius: 25px; background: var(--accent); color: #fff;
  font-weight: 600; box-shadow: 0 6px 20px rgba(0,0,0,.22);
  display: inline-flex; align-items: center; gap: 7px;
}

/* ---------- 底部导航 ---------- */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  height: var(--nav-h); padding-bottom: var(--safe-b);
  display: flex; background: color-mix(in srgb, var(--card) 92%, transparent);
  backdrop-filter: saturate(180%) blur(14px); border-top: 1px solid var(--line);
}
.nav button {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; font-size: 10.5px; color: var(--ink-3);
}
.nav button .ic { font-size: 19px; line-height: 1; }
.nav button[aria-current="page"] { color: var(--accent); }

/* ---------- 浮层 ---------- */
.mask {
  position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.45);
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity .18s ease;
}
.mask.on { opacity: 1; pointer-events: auto; }
@media (prefers-reduced-motion: reduce) { .mask, .sheet { transition: none !important; } }

.sheet {
  width: 100%; max-width: 700px; max-height: 88vh; overflow-y: auto;
  background: var(--card); border-radius: 18px 18px 0 0;
  transform: translateY(14px); transition: transform .2s ease;
  padding-bottom: calc(16px + var(--safe-b) + var(--kb, 0px));
  -webkit-overflow-scrolling: touch;
}
.mask.on .sheet { transform: translateY(0); }
.sheet .handle { width: 38px; height: 4px; border-radius: 2px; background: var(--line); margin: 9px auto 4px; }
.sheet h3 { margin: 6px 16px 4px; font-size: 16px; }
.sheet .sub { margin: 0 16px 12px; font-size: 12.5px; color: var(--ink-3); }
.sheet .body { padding: 0 16px; }
.sheet .foot { padding: 14px 16px 4px; position: sticky; bottom: 0; background: var(--card); }

.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; color: var(--ink-3); margin-bottom: 5px; }
.field label .opt { color: var(--ink-3); opacity: .8; }
.field input, .field select, .field textarea {
  width: 100%; min-height: var(--tap); padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 11px; background: var(--bg);
}
.field textarea { min-height: 82px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: -1px;
}

/* 打分控件 */
.score-box { text-align: center; padding: 4px 0 2px; }
.score-big {
  font-size: 46px; font-weight: 700; font-variant-numeric: tabular-nums;
  color: var(--accent); line-height: 1.1;
}
.score-stepper { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 6px 0 10px; }
.score-stepper button {
  width: 46px; height: 46px; border-radius: 23px; border: 1px solid var(--line);
  background: var(--bg); font-size: 22px; line-height: 1;
}
.score-stepper input {
  width: 96px; height: 46px; text-align: center; font-size: 19px;
  border: 1px solid var(--line); border-radius: 11px; background: var(--bg);
  font-variant-numeric: tabular-nums;
}
input[type=range] { width: 100%; height: 34px; accent-color: var(--accent); }
.quick { display: flex; flex-wrap: wrap; gap: 7px; justify-content: center; margin-bottom: 4px; }
.quick button {
  min-width: 50px; height: 34px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--bg); font-size: 13.5px; font-variant-numeric: tabular-nums;
}
.quick button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }

.rating-line { display: flex; align-items: baseline; gap: 8px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.rating-line:last-child { border-bottom: 0; }
.rating-line .who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rating-line .note { font-size: 11.5px; color: var(--ink-3); }
.rating-line .sv { font-weight: 700; font-variant-numeric: tabular-nums; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 22px); transform: translateX(-50%);
  z-index: 90; max-width: 86vw; padding: 10px 16px; border-radius: 22px;
  background: rgba(20,22,26,.94); color: #fff; font-size: 13.5px;
  opacity: 0; pointer-events: none; transition: opacity .2s ease;
}
.toast.on { opacity: 1; }

.hint { font-size: 12px; color: var(--ink-3); padding: 0 16px 10px; line-height: 1.6; }
.hr { height: 1px; background: var(--line); margin: 12px 0; }
.code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 9px;
  padding: 10px; word-break: break-all; user-select: all;
}
