:root {
  --bg: #f4f4f1;
  --card: #ffffff;
  --ink: #16181c;
  --ink-soft: #3e4249;
  --muted: #8b8f96;
  --line: #e9e9e4;
  --good: #e2535b;
  --good-soft: #fdeff0;
  --bad: #34383e;
  --bad-soft: #eef0f2;
  --accent: #3d5c45;
  --shadow: 0 1px 2px rgba(20, 22, 26, 0.05), 0 8px 24px rgba(20, 22, 26, 0.04);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  padding-bottom: 96px;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, 'Segoe UI', 'Microsoft YaHei', 'PingFang SC', sans-serif;
  font-size: 15px;
  line-height: 1.6;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

/* ---------------------------------------------------------------- 椤舵爮 */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  max-width: 640px;
  margin: 0 auto;
  padding: 18px 16px 12px;
  background: linear-gradient(var(--bg) 72%, rgba(244, 244, 241, 0));
  backdrop-filter: blur(8px);
}

.brand h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.ver {
  margin-left: 6px;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0;
}

.slogan {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.login {
  flex: none;
  padding: 6px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  font-size: 13px;
  color: var(--ink-soft);
}

.login:active {
  transform: scale(0.97);
}

.account {
  flex: none;
  display: flex;
  align-items: center;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 6px 5px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  font-size: 13px;
}

.chip-name {
  font-weight: 600;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 3px 6px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.chip-name:hover,
.chip-name:focus-visible {
  background: #f1f1ec;
  text-decoration: underline;
}

.chip-out {
  padding: 3px 10px;
  border: none;
  border-radius: 999px;
  background: #f1f1ec;
  font-size: 12px;
  color: var(--muted);
}

/* ---------------------------------------------------------------- 工具条 */

main {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 16px;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  flex: 1;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  flex: none;
  padding: 7px 14px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  font-size: 13px;
  color: var(--muted);
}

.tab.is-active {
  border-color: var(--line);
  background: var(--card);
  color: var(--ink);
  font-weight: 600;
}

.search input {
  width: 132px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  font-size: 13px;
  color: var(--ink);
  outline: none;
}

.search input:focus {
  border-color: #c9c9c1;
}

/* ---------------------------------------------------------------- 姒滃崟鍗＄墖 */

.rank {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.row {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}

.rank-no {
  font-size: 15px;
  font-weight: 800;
  color: #c2c5cb;
  font-variant-numeric: tabular-nums;
  padding-top: 1px;
}

.top-1 .rank-no {
  color: #d9a441;
}

.top-2 .rank-no {
  color: #9aa3ad;
}

.top-3 .rank-no {
  color: #b07c58;
}

.row-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px 8px;
}

.name {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.meta {
  font-size: 11.5px;
  color: var(--muted);
}

.score {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
}

.score b {
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.score b.pos {
  color: #3f8a5a;
}

.score b.neg {
  color: #cf4b52;
}

.reason {
  margin: 6px 0 12px;
  font-size: 14.5px;
  line-height: 1.62;
  color: var(--ink-soft);
  white-space: pre-wrap;
  word-break: break-word;
}

.votes {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.vote {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fbfbf9;
  font-size: 13px;
  color: var(--ink-soft);
  transition: transform 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}

.vote b {
  font-variant-numeric: tabular-nums;
}

.vote:active {
  transform: scale(0.96);
}

.vote.good .flower {
  color: var(--good);
}

.vote.bad .flower {
  color: var(--bad);
}

.vote.good.is-on {
  border-color: #f2c9cc;
  background: var(--good-soft);
}

.vote.bad.is-on {
  border-color: #cfd3d8;
  background: var(--bad-soft);
}

.vote:disabled {
  opacity: 0.6;
}

.flower {
  font-size: 14px;
  line-height: 1;
}

.revoke {
  margin-left: auto;
  padding: 5px 10px;
  border: none;
  background: transparent;
  font-size: 12px;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---------------------------------------------------------------- 璇勮 */

.comment-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  font-size: 13px;
  color: var(--muted);
}

.comments {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}

.comment-list {
  margin: 0 0 10px;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.comment {
  padding: 10px 12px;
  border-radius: 12px;
  background: #fafaf7;
}

.comment-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.comment-head b {
  color: var(--ink-soft);
  font-size: 13px;
}

.comment-del {
  margin-left: auto;
  padding: 0;
  border: none;
  background: transparent;
  font-size: 12px;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.comment p {
  margin: 4px 0 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink-soft);
  white-space: pre-wrap;
  word-break: break-word;
}

.comment-empty {
  padding: 6px 2px;
  font-size: 12.5px;
  color: var(--muted);
}

.comment-form {
  display: flex;
  gap: 8px;
}

.comment-form input {
  flex: 1;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  font: inherit;
  font-size: 13.5px;
  outline: none;
}

.comment-form input:focus {
  border-color: #c6c6bd;
}

.comment-form button {
  flex: none;
  padding: 0 16px;
  border: none;
  border-radius: 999px;
  background: #22252a;
  color: #fff;
  font-size: 13px;
}

/* ---------------------------------------------------------------- 鐧诲綍 / 娉ㄥ唽 */

.seg {
  display: flex;
  gap: 6px;
  padding: 3px;
  margin-bottom: 12px;
  border-radius: 999px;
  background: #ecece6;
}

.seg-item {
  flex: 1;
  padding: 8px 0;
  border: none;
  border-radius: 999px;
  background: transparent;
  font-size: 13.5px;
  color: var(--muted);
}

.seg-item.is-active {
  background: var(--card);
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.auth-tip {
  margin: 0 0 12px;
  font-size: 12px;
  color: var(--muted);
}

#auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ---------------------------------------------------------------- 绌烘€?/ 缁熻 */

.empty {
  margin: 40px 0;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.9;
}

.totals {
  margin: 22px 0 8px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

.totals b {
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------- 鎮诞鎸夐挳 / 搴曢儴瀵艰埅 */

.fab {
  position: fixed;
  right: 16px;
  bottom: 84px;
  z-index: 30;
  padding: 13px 20px;
  border: none;
  border-radius: 999px;
  background: #22252a;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 10px 26px rgba(20, 22, 26, 0.28);
}

.fab:active {
  transform: scale(0.97);
}

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 25;
  display: flex;
  justify-content: space-around;
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
}

.tabbar-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 2px 18px;
  border: none;
  background: transparent;
  font-size: 11px;
  color: var(--muted);
}

.tabbar-item .ic {
  font-size: 16px;
  line-height: 1;
}

.tabbar-item.is-active {
  color: var(--ink);
  font-weight: 600;
}

/* ---------------------------------------------------------------- 鎻愬悕鎶藉眽 */

.sheet {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.sheet[hidden] {
  display: none;
}

.sheet-mask {
  position: absolute;
  inset: 0;
  background: rgba(16, 18, 22, 0.42);
  backdrop-filter: blur(2px);
}

.sheet-panel {
  position: relative;
  width: 100%;
  max-width: 640px;
  max-height: 88vh;
  overflow-y: auto;
  padding: 10px 18px calc(22px + env(safe-area-inset-bottom));
  border-radius: 22px 22px 0 0;
  background: var(--bg);
  animation: rise 0.22s ease;
}

@keyframes rise {
  from {
    transform: translateY(16px);
    opacity: 0.6;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.sheet-grab {
  width: 38px;
  height: 4px;
  margin: 4px auto 12px;
  border-radius: 999px;
  background: #d5d5cd;
}

.sheet-panel h2 {
  margin: 0 0 14px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--ink-soft);
}

.sheet-panel form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sheet-panel label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12.5px;
  color: var(--muted);
}

.sheet-panel label em {
  font-style: normal;
  float: right;
}

.sheet-panel input,
.sheet-panel textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  font: inherit;
  font-size: 14.5px;
  color: var(--ink);
  outline: none;
  resize: vertical;
}

.sheet-panel input:focus,
.sheet-panel textarea:focus {
  border-color: #c6c6bd;
}

.submit-btn {
  margin-top: 4px;
  padding: 13px;
  border: none;
  border-radius: 14px;
  background: #22252a;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.12em;
}

.submit-btn:disabled {
  opacity: 0.65;
}

.submit-btn.is-danger {
  background: var(--good);
}

.sheet-sub {
  margin: 18px 0 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--ink);
}

.sheet-sub.is-danger {
  color: var(--good);
}

#password-form,
#delete-form {
  display: grid;
  gap: 10px;
}

.hint {
  margin: 0;
  font-size: 11.5px;
  color: var(--muted);
  text-align: center;
}

.rules {
  margin-top: 18px;
  padding: 14px 16px;
  border: 1px dashed var(--line);
  border-radius: 14px;
}

.rules h3 {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--ink-soft);
}

.rules ul {
  margin: 0;
  padding-left: 18px;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.9;
}

.rules .flower.good {
  color: var(--good);
}

.rules .flower.bad {
  color: var(--bad);
}

/* ---------------------------------------------------------------- 鎻愮ず */

.toast {
  position: fixed;
  left: 50%;
  bottom: 150px;
  z-index: 50;
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(24, 26, 30, 0.92);
  color: #fff;
  font-size: 13px;
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, 8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.error {
  background: #b8383f;
}

/* ---------------------------------------------------------------- 澶у睆 */

@media (min-width: 760px) {
  body {
    padding-bottom: 40px;
  }

  .sheet {
    align-items: center;
  }

  .sheet-panel {
    border-radius: 22px;
    max-width: 520px;
    max-height: 84vh;
  }

  .fab {
    bottom: 28px;
  }

  .tabbar {
    display: none;
  }

  .toast {
    bottom: 40px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* 闀囨锛氭案杩滄帓绗?0 浣嶃€佺疆椤?*/
.row.is-pinned {
  border-color: rgba(61, 92, 69, 0.35);
  background: #fff;
  box-shadow: 0 1px 0 rgba(61, 92, 69, 0.08), 0 10px 24px -18px rgba(61, 92, 69, 0.5);
}
.row.is-pinned .rank-no,
.rank-no.pin {
  color: var(--accent);
}
.row.is-pinned .name {
  color: var(--accent);
}

.chip-badge {
  padding: 2px 7px;
  border-radius: 7px;
  background: rgba(180, 66, 58, 0.12);
  color: #b4423a;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.revoke-admin {
  color: #b4423a;
  font-weight: 700;
}

/* 鍏憡鏉?*/
.notice {
  display: flex;
  align-items: baseline;
  gap: 8px;
  width: calc(100% - 32px);
  max-width: 608px;
  box-sizing: border-box;
  margin: 0 auto 14px;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(180, 66, 58, 0.08);
  border: 1px solid rgba(180, 66, 58, 0.18);
  color: #8d3a34;
  font-size: 13px;
  line-height: 1.5;
}

.notice-tag {
  flex: none;
  padding: 2px 7px;
  border-radius: 7px;
  background: #b4423a;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.notice-text {
  color: #5e3a37;
}

.notice-edit {
  flex: none;
  margin-left: auto;
  padding: 3px 9px;
  border: 1px solid rgba(180, 66, 58, 0.35);
  border-radius: 8px;
  background: transparent;
  color: #b4423a;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.notice-edit:hover {
  background: rgba(180, 66, 58, 0.1);
}

.notice-text.is-empty { color: #9a8b89; font-style: italic; }


/* 管理员手动加减花 */
.admin-votes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed rgba(180, 66, 58, 0.25);
}

.adj-group {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px 4px 2px 8px;
  border-radius: 10px;
  background: rgba(180, 66, 58, 0.07);
}

.adj-label {
  font-size: 12px;
  font-weight: 700;
  color: #8d3a34;
  margin-right: 2px;
}

.adj {
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 7px;
  background: #fff;
  color: #8d3a34;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
}

.adj:hover { background: #fdeceb; }
.adj:disabled { opacity: 0.5; cursor: default; }

/* ---------- 加载更多 / 分页 ---------- */

.load-more {
  display: block;
  width: 100%;
  max-width: 608px;
  margin: 4px auto 18px;
  padding: 12px;
  border: 1px dashed rgba(61, 92, 69, 0.35);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.7);
  color: #3d5c45;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.load-more:hover { background: #fff; border-color: #3d5c45; }
.load-more:disabled { opacity: 0.55; cursor: default; }
.load-more[hidden] { display: none; }

.comment-more {
  max-width: none;
  margin: 6px 0 10px;
  padding: 8px;
  font-size: 12.5px;
  border-radius: 10px;
}

/* ---------- 举报 / 申诉 ---------- */

.row-report,
.comment-report {
  border: none;
  background: none;
  color: #8a8f94;
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 8px;
}

.row-report:hover,
.comment-report:hover { background: rgba(0, 0, 0, 0.05); color: #3d5c45; }

.report-target {
  margin: 10px 0 4px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(61, 92, 69, 0.07);
  color: #4b5563;
  font-size: 13.5px;
  line-height: 1.55;
  word-break: break-word;
}

#report-count { font-style: normal; color: #9aa0a6; font-size: 12px; margin-left: 4px; }

/* ---------- 举报箱（管理员） ---------- */

.admin-tools { display: flex; align-items: center; gap: 8px; }
.admin-tools[hidden] { display: none; }

.inbox {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: 1px solid rgba(180, 66, 58, 0.3);
  border-radius: 999px;
  background: #fff;
  color: #8d3a34;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.inbox:hover { background: #fdeceb; }

.inbox b {
  min-width: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #b4423a;
  color: #fff;
  font-size: 11.5px;
  line-height: 18px;
  text-align: center;
}

.inbox-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 10px; }

.inbox-item {
  padding: 12px;
  border: 1px solid #ecebe6;
  border-radius: 14px;
  background: #fdfdfb;
}

.inbox-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }

.inbox-kind {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  background: #fdeceb;
  color: #b4423a;
}

.inbox-kind.appeal { background: rgba(61, 92, 69, 0.12); color: #3d5c45; }

.inbox-who { font-size: 12px; color: #9aa0a6; }

.inbox-target,
.inbox-reason {
  margin: 4px 0 0;
  font-size: 13px;
  line-height: 1.6;
  color: #4b5563;
  word-break: break-word;
}

.inbox-reason { color: #8d3a34; }

.inbox-actions { display: flex; gap: 8px; margin-top: 10px; }

.inbox-action {
  padding: 6px 14px;
  border: 1px solid #e3e1da;
  border-radius: 10px;
  background: #fff;
  color: #4b5563;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.inbox-action:hover { background: #f4f3ee; }
.inbox-action.is-danger { border-color: rgba(180, 66, 58, 0.35); color: #b4423a; }
.inbox-action.is-danger:hover { background: #fdeceb; }
.inbox-action:disabled { opacity: 0.5; cursor: default; }
