/* B站 UP 回复台 — 视觉规范来自「苹果 / Pinguo」设计系统
 * 单一主色 #fb7299（B站品牌粉）；中性灰为主；1px 描边优先于投影；静态卡片不着色不投重影。 */

:root {
  color-scheme: light;

  --background: #ffffff;
  --foreground: #1d1d1f;
  --card: #ffffff;
  --card-foreground: #1d1d1f;
  --popover: #ffffff;
  --primary: #fb7299;
  --primary-foreground: #ffffff;
  --secondary: #f2f2f7;
  --secondary-foreground: #1d1d1f;
  --muted: #f2f2f7;
  --muted-foreground: #8e8e93;
  --accent: #f7f7fa;
  --accent-foreground: #1d1d1f;
  --destructive: #ff3b30;
  --success: #34c759;
  --border: #e5e5ea;
  --input: #d1d1d6;
  --ring: #fb7299;

  --tone-1: #f2f2f7;
  --tone-2: #e5e5ea;
  --tone-3: #d1d1d6;
  --tone-text: #3c3c43;

  --radius: 1.2rem;
  --radius-sm: 0.6rem;
  --radius-md: 0.9rem;
  --shadow-2xs: 0 1px 2px -1px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05), 0 1px 3px -1px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 16px 40px -10px rgba(0, 0, 0, 0.1), 0 8px 16px -8px rgba(0, 0, 0, 0.06);
  --shadow-2xl: 0 24px 64px -12px rgba(0, 0, 0, 0.12);

  --font-sans: "DM Sans", ui-sans-serif, system-ui, -apple-system, "PingFang SC",
    "Microsoft YaHei", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --gutter: 16px;
  --header-height: 56px;
  --tabbar-height: 52px;
  --banner-height: 44px;
  --app-width: 28rem;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  /* 状态栏那一条露出来的是 WebView 背后，必须自己涂实心白：
     交给浏览器默认背景，iOS 会把 status bar 当半透明材质去合成，看起来就是糊的 */
  background: var(--card);
}

/* 浮层打开时锁住页面滚动：既不会出现第二条滚动条，也避免滚动穿透到背景 */
html.is-overlay-open {
  overflow: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
p,
figure,
blockquote,
ol,
ul {
  margin: 0;
  padding: 0;
}

ol,
ul {
  list-style: none;
}

img {
  display: block;
  max-width: 100%;
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
}

button {
  border: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

/* ---------- 布局骨架 ---------- */

.shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: 100%;
  max-width: var(--app-width);
  margin-inline: auto;
  background: var(--background);
}

.screen {
  display: none;
  flex-direction: column;
  min-height: 100vh;
  width: 100%;
}

.screen.is-active {
  display: flex;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  padding-top: var(--safe-top);
  border-bottom: 1px solid var(--border);
  background: var(--card);
  /* iOS 会把 sticky 顶栏提升成独立图层再和状态栏那条材质合成，结果是越靠上越发虚。
     显式声明成不透明图层后，系统就按实心处理，不再出现糊的那一段。 */
  transform: translateZ(0);
}

.app-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: var(--header-height);
  padding-inline: var(--gutter);
}

.app-title {
  min-width: 0;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.2;
}

.app-header__actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}

/* 浮层顶栏两侧的图标按钮：只有图标、没有底色。两个按钮同样式、同宽度，
   再各自向外让出 8px：字形更贴边，同时两边等宽，中间标题仍然是正中间 */
.app-header__back,
.app-header__open {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 9999px;
  color: var(--primary);
}

.app-header__back {
  margin-left: -8px;
}

.app-header__open {
  margin-right: -8px;
}

.app-header__title-center {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page-body {
  flex: 1 1 auto;
  min-width: 0;
  padding: 16px var(--gutter) 32px;
}

.stack {
  display: flex;
  flex-direction: column;
}

.stack--gap {
  gap: 12px;
}

.stack--gap-sm {
  gap: 8px;
}

.section-title {
  font-size: 15px;
  font-weight: 600;
}

.spacer-top {
  margin-top: 24px;
}

.muted {
  color: var(--muted-foreground);
}

.mono {
  font-family: var(--font-mono);
}

.small {
  font-size: 11px;
}

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

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nowrap {
  white-space: nowrap;
}

/* ---------- 卡片与列表 ---------- */

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

.card--flush {
  padding: 0;
  overflow: hidden;
}

.list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.summary__dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 9999px;
  background: var(--primary);
}

.summary__text {
  min-width: 0;
  flex: 1 1 auto;
  font-size: 15px;
  font-weight: 600;
}

.summary__note {
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted-foreground);
}

/* ---------- 横滑筛选条 ---------- */

.rail {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}

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

.chip {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  border-radius: 9999px;
  padding: 6px 14px;
  background: var(--secondary);
  color: var(--foreground);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  transition: opacity 150ms ease, transform 150ms ease;
}

.chip__label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chip__badge {
  flex: 0 0 auto;
  min-width: 16px;
  height: 16px;
  padding: 0 5px;
  border-radius: 9999px;
  background: var(--destructive);
  color: #ffffff;
  font-size: 10px;
  font-weight: 600;
  line-height: 16px;
  text-align: center;
}

.chip.is-active .chip__badge {
  background: #ffffff;
  color: var(--primary);
}

.chip:hover {
  opacity: 0.85;
}

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

.chip.is-active {
  background: var(--primary);
  color: var(--primary-foreground);
}

/* ---------- 回复卡片 ---------- */

.reply__head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  overflow: hidden;
  border-radius: 9999px;
  background: var(--tone-1);
  color: var(--tone-text);
  font-size: 13px;
  font-weight: 600;
}

.avatar--sm {
  width: 36px;
  height: 36px;
  font-size: 12px;
}

.avatar--xs {
  width: 32px;
  height: 32px;
  font-size: 11px;
}

.avatar--tone2 {
  background: var(--tone-2);
}

.avatar--tone3 {
  background: var(--tone-3);
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.reply__id {
  min-width: 0;
  flex: 1 1 auto;
}

.reply__name-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.reply__name {
  min-width: 0;
  overflow: hidden;
  font-size: 15px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge-up {
  flex: 0 0 auto;
  border-radius: 9999px;
  padding: 2px 8px;
  background: var(--primary);
  color: var(--primary-foreground);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.dot-unread {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 9999px;
  background: var(--primary);
}

.reply__source {
  margin-top: 12px;
  font-size: 12px;
  color: var(--muted-foreground);
}

.reply__text {
  margin-top: 8px;
  font-size: 14px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

.quote {
  margin-top: 12px;
  padding: 8px 12px;
  border-left: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--muted-foreground);
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.reply__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}

.reply__meta {
  font-size: 11px;
  color: var(--muted-foreground);
}

/* ---------- 胶囊按钮 ---------- */

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 36px;
  border-radius: 9999px;
  padding: 0 14px;
  background: var(--secondary);
  color: var(--foreground);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: opacity 150ms ease, transform 150ms ease;
}

.pill:hover {
  opacity: 0.85;
}

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

.pill:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.pill--primary {
  background: var(--primary);
  color: var(--primary-foreground);
}

.pill--danger {
  color: var(--destructive);
}

.pill--block {
  width: 100%;
  min-height: 44px;
  font-size: 14px;
}

.pill--sm {
  min-height: 32px;
  padding: 0 12px;
  font-size: 12px;
}

.iconbtn {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 9999px;
  background: var(--secondary);
  color: var(--foreground);
  transition: opacity 150ms ease, transform 150ms ease;
}

.iconbtn:hover {
  opacity: 0.85;
}

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

/* 区块标题那一行用的小号图标按钮：配色和消息页的刷新按钮保持一致 */
.iconbtn--sm {
  width: 32px;
  height: 32px;
  background: var(--secondary);
  color: var(--foreground);
}

/* ---------- 表单 ---------- */

.input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--input);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  background: var(--background);
  color: var(--foreground);
  font-size: 14px;
  outline: none;
  transition: border-color 150ms ease;
}

.input::placeholder {
  color: var(--muted-foreground);
}

.input:focus-visible {
  border-color: var(--primary);
}

.field-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.field-row .input {
  min-width: 0;
  flex: 1 1 auto;
}

.field {
  display: block;
}

.field__label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted-foreground);
}

/* ---------- 设置分组 ---------- */

.group {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
}

.group__row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
}

.group__row + .group__row {
  border-top: 1px solid var(--border);
}

.group__row--stack {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.row__label {
  min-width: 0;
  flex: 1 1 auto;
}

.row__title {
  font-size: 14px;
  font-weight: 500;
}

.row__sub {
  margin-top: 2px;
  font-size: 11px;
  color: var(--muted-foreground);
}

.row__value {
  flex: 0 0 auto;
  font-size: 12px;
  color: var(--muted-foreground);
  white-space: nowrap;
}

.badge {
  flex: 0 0 auto;
  border-radius: 9999px;
  padding: 4px 10px;
  background: var(--secondary);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.badge--ok {
  color: var(--success);
}

.badge--warn {
  color: var(--destructive);
}

.switch {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  width: 44px;
  height: 24px;
  border-radius: 9999px;
  padding: 2px;
  background: var(--tone-2);
  justify-content: flex-start;
  transition: background-color 150ms ease;
}

.switch__knob {
  width: 20px;
  height: 20px;
  border-radius: 9999px;
  background: var(--card);
  box-shadow: var(--shadow-2xs);
  transition: transform 180ms ease;
}

.switch.is-on {
  background: var(--primary);
  justify-content: flex-end;
}

/* ---------- 底部标签栏 ---------- */

.tabbar {
  position: sticky;
  bottom: 0;
  z-index: 30;
  width: 100%;
  padding-bottom: var(--safe-bottom);
  border-top: 1px solid var(--border);
  background: var(--card);
}

.tabbar__inner {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: center;
  gap: 4px;
  height: var(--tabbar-height);
  padding-inline: 8px;
}

.tabbar__item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  height: 100%;
  border-radius: 12px;
  color: var(--muted-foreground);
  transition: color 150ms ease;
}

.tabbar__item.is-active {
  color: var(--primary);
}

.tabbar__label {
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

.tabbar__badge {
  position: absolute;
  top: 6px;
  left: 50%;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 9999px;
  background: var(--primary);
  color: var(--primary-foreground);
  font-size: 10px;
  font-weight: 600;
  line-height: 16px;
  text-align: center;
  transform: translateX(10px);
}

/* ---------- 浮层页面 ---------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  justify-content: center;
  background: color-mix(in srgb, var(--foreground) 32%, transparent);
}

.overlay__panel {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: var(--app-width);
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  background: var(--background);
  box-shadow: var(--shadow-2xl);
}

/* ---------- 二维码 ---------- */

.qr {
  margin-inline: auto;
  width: 220px;
  height: 220px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #ffffff;
}

.qr svg {
  width: 100%;
  height: 100%;
}

.status-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
}

.status-line__dot {
  width: 8px;
  height: 8px;
  border-radius: 9999px;
  background: var(--primary);
}

.status-line__dot.is-idle {
  background: var(--tone-3);
}

.status-line__dot.is-ok {
  background: var(--success);
}

.steps {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}

.steps__item {
  display: flex;
  gap: 12px;
}

.steps__index {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 9999px;
  background: var(--secondary);
  font-size: 11px;
  font-weight: 600;
}

.steps__text {
  min-width: 0;
  flex: 1 1 auto;
  font-size: 13px;
  line-height: 1.65;
  color: var(--muted-foreground);
}

/* ---------- 空态 / 骨架 / 提示 ---------- */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 56px 24px;
  text-align: center;
  color: var(--muted-foreground);
}

.empty__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--foreground);
}

.empty__note {
  font-size: 12px;
  line-height: 1.6;
}

.skeleton {
  height: 132px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--accent);
  animation: pulse 1.6s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.55;
  }
}

.notice {
  margin-top: 12px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted-foreground);
}

.notice--error {
  border-color: var(--destructive);
  color: var(--destructive);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-height) + var(--safe-bottom) + 24px);
  z-index: 90;
  max-width: 82vw;
  border-radius: 9999px;
  padding: 10px 18px;
  background: var(--foreground);
  color: var(--background);
  font-size: 13px;
  box-shadow: var(--shadow-xl);
  transform: translate(-50%, 8px);
  opacity: 0;
  transition: opacity 180ms ease, transform 180ms ease;
  pointer-events: none;
}

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

.footer-note {
  margin-top: 24px;
  text-align: center;
  font-size: 11px;
  line-height: 1.6;
  color: var(--muted-foreground);
}

.setup {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: calc(24px + var(--safe-top)) 24px calc(24px + var(--safe-bottom));
  background: var(--background);
}

.setup__card {
  width: 100%;
  max-width: 26rem;
}

.setup__title {
  font-size: 24px;
  font-weight: 600;
  line-height: 1.25;
}

.setup__hint {
  margin: 8px 0 24px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted-foreground);
}

.setup__form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ---------- 登录失效横幅 ---------- */

.banner {
  position: sticky;
  top: 0;
  z-index: 25;
  display: flex;
  align-items: center;
  gap: 10px;
  height: calc(var(--banner-height) + var(--safe-top));
  padding-top: var(--safe-top);
  padding-inline: var(--gutter);
  background: var(--destructive);
  color: #ffffff;
}

.banner__icon {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
}

.banner__text {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  font-size: 12px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.banner__action {
  flex: 0 0 auto;
  border-radius: 9999px;
  padding: 5px 12px;
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  transition: background-color 150ms ease;
}

.banner__action:hover {
  background: rgba(255, 255, 255, 0.34);
}

.shell.has-banner .app-header {
  top: calc(var(--banner-height) + var(--safe-top));
  padding-top: 0;
}

.shell.has-banner .screen {
  min-height: calc(100vh - var(--banner-height));
}

/* ---------- 排序按钮 ---------- */

.pill__icon {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
}

/* ---------- 动态卡片流 ---------- */

.thread {
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease;
}

.thread:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.thread:active {
  transform: translateY(0);
}

.thread.is-unread {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 6%, var(--card));
}

/* 详情页顶部那条动态：内容与消息页的卡片完全一致，只是它本身不可点 */
.thread--static,
.thread--static:hover,
.thread--static:active {
  cursor: default;
  transform: none;
  box-shadow: none;
}

.thread__title {
  margin-top: 12px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.45;
  word-break: break-word;
}

.thumbs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.thumbs:empty {
  display: none;
}

.thumb {
  width: 100%;
  height: 96px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  object-fit: cover;
}

/* ---------- 楼层链路 ---------- */

.chainblock {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-left: 14px;
  border-left: 2px solid var(--border);
}

/* 楼层内部，回复与回复之间也拉一条分割线，做法和楼层之间的一致 */
.chainblock > .chain + .chain {
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.chain__head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chain__id {
  min-width: 0;
  flex: 1 1 auto;
}

/* UP 的回复：不单独描边圈起来，已读时和普通评论一样平铺。
   圆角只留给未读高亮，否则上面那条分割线会被圆角切短 */
.chain--up {
  padding: 12px;
  background: var(--card);
}

/* 只有未读时才和动态卡片一样高亮 */
.chain--up.is-unread {
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--primary) 6%, var(--card));
}

/* 层中层：被回复的那条评论（名字 + 内容），排在正文上面 */
.quote {
  margin: 10px 0;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--secondary);
}

.quote__who {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted-foreground);
}

.quote__time {
  margin-left: 6px;
  font-weight: 400;
}

.quote__text {
  margin-top: 4px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--tone-text);
  word-break: break-word;
}

/* ---------- 评论区 ---------- */

/* 标题在左，排序 / 全部已读 / 刷新在右 */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-head__actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}

/* 一条楼层：楼层本身 + 它下面缩进排开的回复 */
.floor {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* 楼层之间用一条分割线隔开，首层不带线 */
.floor + .floor {
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

/* 每条回复右上角：已读 / 未读切换，外加跳到 B 站对应评论 */
.comment__read {
  flex: 0 0 auto;
  color: var(--primary);
  background: var(--card);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 40%, transparent);
}

/* 已读之后按钮变成「未读」，收敛成低调的描边，别抢视线 */
.comment__read--undo {
  color: var(--muted-foreground);
  box-shadow: inset 0 0 0 1px var(--border);
}

.chain__jump {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 9999px;
  color: var(--muted-foreground);
  transition: color 150ms ease;
}

.chain__jump:active {
  color: var(--primary);
}

/* ---------- 新版本提示条 ---------- */

.updatebar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--tabbar-height) + var(--safe-bottom) + 16px);
  z-index: 95;
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(calc(100% - 32px), calc(var(--app-width) - 32px));
  margin-inline: auto;
  border-radius: 9999px;
  padding: 8px 8px 8px 16px;
  background: var(--primary);
  color: var(--primary-foreground);
  box-shadow: var(--shadow-xl);
  animation: fade-up 240ms ease-out both;
}

.updatebar__icon {
  display: inline-flex;
  flex: 0 0 auto;
}

.updatebar__text {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
}

.updatebar__action {
  flex: 0 0 auto;
  border-radius: 9999px;
  padding: 7px 14px;
  background: var(--primary-foreground);
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  transition: transform 150ms ease, opacity 150ms ease;
}

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

.updatebar__action:disabled {
  opacity: 0.6;
  transform: none;
}

/* 提示条出现时把 toast 抬起来，两者不叠在一起 */
html.is-update-available .toast {
  bottom: calc(var(--tabbar-height) + var(--safe-bottom) + 76px);
}

/* ---------- 动效 ---------- */

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slide-in-right {
  from {
    opacity: 0.5;
    transform: translateX(7%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* 居中的弹窗不横向位移，就地放大淡入，读起来是「在这里弹出来」 */
@keyframes pop-in {
  from {
    opacity: 0;
    transform: scale(0.94);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes pulse-dot {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(1.4);
  }
}

/* 切换页签：整页轻微上浮淡入。这里不用 fill 模式，避免动画结束后残留 transform
   把 .screen 变成 fixed 元素的包含块。 */
.screen.is-active {
  animation: fade-up 220ms ease-out;
}

/* 浮层：背板淡入，面板从右侧滑入 */
.overlay:not([hidden]) {
  animation: fade-in 180ms ease-out both;
}

.overlay:not([hidden]) .overlay__panel {
  animation: slide-in-right 260ms cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

/* 列表卡片：只淡入，不碰 transform，免得和 hover 的上浮冲突 */
.card.thread {
  animation: fade-in 200ms ease-out both;
}

/* 图片进入视口时淡入 */
.thumb {
  animation: fade-in 240ms ease-out both;
}

/* 未读圆点轻微呼吸 */
.dot-unread {
  animation: pulse-dot 1.8s ease-in-out infinite;
}

/* ---------- 二次确认弹窗 ---------- */

/* 居中的小弹窗：复用浮层背板，面板改成卡片。这条要带上 :not([hidden])，
   否则权重低于上面那条浮层动画，弹窗会跟着从右侧滑进来 */
.overlay--center {
  align-items: center;
  padding: 24px var(--gutter);
}

.overlay--center:not([hidden]) .overlay__panel {
  height: auto;
  max-width: 21rem;
  border-radius: var(--radius);
  padding: 20px;
  background: var(--card);
  animation: pop-in 200ms cubic-bezier(0.2, 0.9, 0.3, 1) both;
}

.confirm__title {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
}

.confirm__text {
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted-foreground);
  word-break: break-word;
}

.confirm__actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.confirm__actions > * {
  flex: 1 1 0;
  text-decoration: none;
}

/* 危险操作在弹窗里用实心红，和列表里那个红字「移除」区分开 */
.confirm__actions .pill--danger {
  background: var(--destructive);
  color: #ffffff;
}

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