/* 微博纯阅读站 — tokens & base. From the product design system (neutral theme). */
:root {
  --bg: #fbfaf8;
  --surface: #f2efe9;
  --surface-2: #e9e5dd;
  --field: #ffffff;
  --fg: #0f1115;
  --muted: #6c6b72;
  --border: #e4e0d8;
  --border-2: #d4cfc4;
  --brand: #0f1115;
  --link: #3f74c9;
  --retweet-bg: #f3f1ec;
  --retweet-border: #d9d5cc;
  --success: #22c55e;
  --error: #e01010;
  --on-brand: #fbfaf8;
  --shadow: 0 18px 50px rgba(30, 28, 24, 0.28);
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1d21;
    --surface: #26282d;
    --surface-2: #2f3238;
    --field: #26282d;
    --fg: #e7e8ea;
    --muted: #9a9ca3;
    --border: #383b42;
    --border-2: #4a4e57;
    --brand: #e7e8ea;
    --link: #6fa8ff;
    --retweet-bg: #2c2f35;
    --retweet-border: #40454d;
    --success: #4ed17e;
    --error: #f25a5a;
    --on-brand: #1c1d21;
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  }
}

* { box-sizing: border-box; -webkit-font-smoothing: antialiased; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--link); text-decoration: none; }
button { font-family: inherit; }

/* ---------- app shell ---------- */
.app { max-width: 680px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }

.site-head {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 16px 10px;
  background: linear-gradient(to bottom, var(--bg) 74%, transparent);
  backdrop-filter: blur(8px);
}
.brand { display: flex; align-items: center; gap: 8px; min-width: 0; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--brand); color: var(--on-brand);
  display: inline-flex; align-items: center; justify-content: center; flex: none; }
.brand-name { font-size: 16px; font-weight: 700; letter-spacing: .01em; }
.brand-badge { font-size: 10.5px; padding: 1px 7px; border-radius: 999px; background: var(--surface-2);
  color: var(--muted); }
.head-right { margin-left: auto; display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.src-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); flex: none; }
.src-dot.is-off { background: var(--error); }

/* channel tabs */
.chips { display: flex; gap: 6px; padding: 4px 16px 8px; overflow-x: auto; scrollbar-width: none;
  position: sticky; top: 52px; z-index: 19; background: var(--bg); }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; height: 32px; padding: 0 15px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--muted); font-size: 13.5px; cursor: pointer; }
.chip.is-on { background: var(--brand); color: var(--on-brand); border-color: var(--brand); font-weight: 600; }

/* toolbar */
.toolbar { display: flex; gap: 8px; padding: 2px 16px 10px; align-items: center; flex-wrap: wrap; }
.select-wrap { position: relative; }
.select { height: 32px; padding: 0 26px 0 11px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--fg); font-size: 13px; appearance: none; cursor: pointer;
  max-width: 160px; text-overflow: ellipsis; }
.select-wrap::after { content: ""; position: absolute; right: 11px; top: 50%; width: 6px; height: 6px;
  border-right: 1.6px solid var(--muted); border-bottom: 1.6px solid var(--muted);
  transform: translateY(-70%) rotate(45deg); pointer-events: none; }
.search { display: flex; align-items: center; gap: 7px; flex: 1; min-width: 150px; height: 32px;
  padding: 0 11px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface);
  color: var(--muted); }
.search input { flex: 1; min-width: 0; border: none; outline: none; background: transparent; color: var(--fg);
  font-size: 13px; }
.search svg { flex: none; }

/* main scroll */
.main { flex: 1; padding: 0 16px calc(env(safe-area-inset-bottom, 0px) + 40px); }
.state { padding: 40px 8px; text-align: center; color: var(--muted); font-size: 13.5px; line-height: 1.7; }
.state .btn { margin-top: 14px; }
.spinner { width: 22px; height: 22px; border: 2.5px solid var(--border-2); border-top-color: var(--brand);
  border-radius: 50%; animation: spin .7s linear infinite; margin: 0 auto 12px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- post card ---------- */
.post { padding: 15px 0; border-top: 1px solid var(--border); animation: fade .25s ease; }
.post:first-child { border-top: none; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.phead { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; }
.av { width: 37px; height: 37px; border-radius: 50%; flex: none; object-fit: cover; background: var(--surface-2);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px;
  color: var(--muted); overflow: hidden; }
.av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.who { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.who .name { font-size: 13.5px; font-weight: 650; line-height: 1.35; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; }
.who .meta { font-size: 11.5px; color: var(--muted); }
.ptext { font-size: 15px; line-height: 1.72; white-space: pre-wrap; word-break: break-word;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 9; overflow: hidden; }
.single .ptext { -webkit-line-clamp: unset; }
.retweet { margin-top: 9px; padding: 9px 11px; border-left: 2px solid var(--retweet-border);
  border-radius: 6px; background: var(--retweet-bg); color: var(--muted); font-size: 13.5px; line-height: 1.55;
  white-space: pre-wrap; word-break: break-word; display: -webkit-box; -webkit-box-orient: vertical;
  -webkit-line-clamp: 4; overflow: hidden; }
.retweet .ru { color: var(--link); font-weight: 600; }

/* media */
.media { margin-top: 10px; }
.grid { display: grid; gap: 5px; }
.grid.g1 { grid-template-columns: 1fr; }
.grid.g2 { grid-template-columns: repeat(2, 1fr); }
.grid.g3 { grid-template-columns: repeat(3, 1fr); }
.tile { position: relative; border-radius: 7px; overflow: hidden; background: var(--surface-2);
  aspect-ratio: 1 / 1; cursor: zoom-in; }
.grid.g1 .tile { aspect-ratio: 4 / 3; }
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile .more { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.52); color: #fff; font-size: 18px; font-weight: 600; }
.vid { position: relative; width: 100%; aspect-ratio: 16 / 10; border-radius: 8px; overflow: hidden;
  background: #000; }
.vid video, .vid img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vid .play { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); width: 46px; height: 46px;
  border-radius: 999px; background: rgba(0,0,0,.55); color: #fff; display: inline-flex; align-items: center;
  justify-content: center; backdrop-filter: blur(2px); }
.vid .dur { position: absolute; right: 8px; bottom: 8px; padding: 1px 6px; border-radius: 4px;
  background: rgba(0,0,0,.66); color: #fff; font-size: 11.5px; }

.pstats { display: flex; gap: 20px; margin-top: 10px; color: var(--muted); font-size: 12.5px; }
.pstats span { display: inline-flex; align-items: center; gap: 5px; }

/* ---------- media grid (album) ---------- */
.album { display: grid; grid-template-columns: repeat(auto-fill, minmax(31vw, 1fr)); gap: 4px;
  max-width: 680px; }
@media (min-width: 560px) { .album { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); } }
.album .cell { aspect-ratio: 1/1; border-radius: 6px; overflow: hidden; background: var(--surface-2);
  cursor: zoom-in; position: relative; }
.album .cell img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---------- bloggers ---------- */
.blogger { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-top: 1px solid var(--border);
  cursor: pointer; }
.blogger:first-child { border-top: none; }
.blogger .av { width: 46px; height: 46px; font-size: 18px; }
.blogger .binfo { flex: 1; min-width: 0; }
.blogger .bname { font-size: 14.5px; font-weight: 650; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; }
.blogger .bmeta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.blogger .chev { color: var(--muted); flex: none; }

/* ---------- detail modal ---------- */
.backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.46);
  display: flex; align-items: flex-end; justify-content: center; animation: fade .18s ease; }
@media (min-width: 640px) { .backdrop { align-items: center; padding: 24px; } }
.sheet { width: 100%; max-width: 640px; max-height: 92vh; background: var(--bg); border-radius: 18px 18px 0 0;
  box-shadow: var(--shadow); display: flex; flex-direction: column; animation: slideUp .26s cubic-bezier(.2,.8,.2,1);
  overflow: hidden; }
@media (min-width: 640px) { .sheet { border-radius: 14px; max-height: min(86vh, 900px); } }
@keyframes slideUp { from { transform: translateY(30px); opacity: .6; } to { transform: none; opacity: 1; } }
.sheet-bar { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--border);
  flex: none; position: sticky; top: 0; background: var(--bg); }
.sheet-bar .st { flex: 1; font-size: 12.5px; color: var(--muted); }
.icon-btn { width: 32px; height: 32px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface);
  color: var(--fg); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.sheet-body { padding: 16px; overflow: auto; -webkit-overflow-scrolling: touch; }
.sheet .ptext { -webkit-line-clamp: unset; font-size: 16px; }

/* ---------- lightbox ---------- */
.lightbox { position: fixed; inset: 0; z-index: 80; background: rgba(0,0,0,.9); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 10px; padding: 16px; }
.lightbox img, .lightbox video { max-width: 100%; max-height: 78vh; object-fit: contain; border-radius: 6px; }
.lightbox .lb-bar { display: flex; align-items: center; justify-content: space-between; width: 100%; max-width: 1000px;
  color: #fff; font-size: 13px; }
.lightbox .lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 42px; height: 42px;
  border-radius: 999px; border: none; background: rgba(0,0,0,.5); color: #fff; display: inline-flex;
  align-items: center; justify-content: center; cursor: pointer; }
.lightbox .lb-prev { left: 10px; }
.lightbox .lb-next { right: 10px; }

/* ---------- gate ---------- */
.gate { position: fixed; inset: 0; z-index: 100; background: var(--bg); display: flex; align-items: center;
  justify-content: center; padding: 24px; }
.gate-card { width: 100%; max-width: 360px; text-align: center; }
.gate-card .brand-mark { width: 52px; height: 52px; border-radius: 15px; margin: 0 auto 16px; }
.gate-card h1 { font-size: 20px; margin: 0 0 6px; }
.gate-card p { color: var(--muted); font-size: 13.5px; margin: 0 0 20px; line-height: 1.6; }
.gate-input { width: 100%; height: 46px; padding: 0 14px; border-radius: 11px; border: 1px solid var(--border);
  background: var(--surface); color: var(--fg); font-size: 15px; outline: none; text-align: center; }
.gate-input:focus { border-color: var(--border-2); }
.gate-btn { width: 100%; height: 46px; margin-top: 10px; border: none; border-radius: 11px; background: var(--brand);
  color: var(--on-brand); font-size: 15px; font-weight: 600; cursor: pointer; }
.gate-btn:disabled { opacity: .5; }
.gate-err { color: var(--error); font-size: 12.5px; margin-top: 10px; min-height: 18px; }

/* toast */
.toast { position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%); z-index: 200;
  max-width: calc(100vw - 32px); padding: 9px 16px; border-radius: 9px; background: rgba(40,40,44,.95); color: #fff;
  font-size: 13px; box-shadow: 0 8px 24px rgba(0,0,0,.3); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 38px; padding: 0 16px;
  border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--fg);
  font-size: 14px; cursor: pointer; }
.btn-primary { background: var(--brand); color: var(--on-brand); border-color: var(--brand); font-weight: 600; }

.list-foot { text-align: center; padding: 20px 0 8px; color: var(--muted); font-size: 12.5px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
