/* 51探花论坛 · 51tanhua.lol
   token 与组件结构提取自本地 UI 快照的 Xiuno BBS + Bootstrap 4.0.0-beta.3 样式表。
   中浅灰纸面 #dee2e6、深色页头 #343a40、浅灰卡片 #f8f9fa + 软阴影、3.5px 圆角、
   次级灰条 #868e96、1f4977 主按钮按快照还原；根字号 14 → 16（见 internal tokens.md）。 */

:root {
  --bg: #dee2e6;
  --surface: #ffffff;
  --surface-2: #f8f9fa;
  --surface-3: #e9ecef;

  --header: #343a40;
  --header-2: #454d55;
  /* 源站次级条是 #868e96，白字在上面对比只有 3.3:1；压深一档到 5.1:1（A32） */
  --nav-2: #5c636a;
  --nav-2-fg: #e9ecef;

  --text: #212529;
  --text-2: #495057;
  --text-3: #545b62;
  --faint: #6c757d;

  --line: #dee2e6;
  --line-2: #e9ecef;

  --primary: #1f4977;
  --primary-hover: #16375c;
  --quote-from: #177f2e;

  --on-dark: #ffffff;
  --badge-bg: #6c757d;
  --badge-hot-bg: #9c3a29;
  --header-link: rgba(255, 255, 255, 0.8);
  --header-hairline: var(--header-hairline);
  --nav2-hairline: var(--nav2-hairline);
  --nav2-hover: rgba(0, 0, 0, 0.14);
  --crumb-bg: var(--crumb-bg);
  --focus-ring: var(--focus-ring);

  --shadow-card: 2px 2px 3px rgba(173, 181, 189, 0.25);
  --shadow-crumb: 1px 1px 2px rgba(233, 236, 239, 0.25);
  --shadow-pop: 0 6px 18px rgba(33, 37, 41, 0.15);

  /* CTA（库 85 号：双光汇聚） */
  --cta-bg: #1e1b4b;
  --cta-ink: #f1efff;
  --cta-l1: rgba(34, 211, 238, 0.55);
  --cta-l2: rgba(244, 114, 182, 0.55);
  --cta-flash: #4c1d95;
  --cta-shadow: rgba(30, 27, 75, 0.5);

  --radius: 4px;
  --radius-sm: 3px;
  --radius-pill: 140px;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --font: "Helvetica Neue", Helvetica, "Microsoft Yahei", "Hiragino Sans GB",
    "WenQuanYi Micro Hei", "微软雅黑", "华文细黑", STHeiti, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  padding-bottom: 170px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.7;
  overflow-wrap: break-word;
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

img {
  max-width: 100%;
  height: auto;
}

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

a:hover {
  color: var(--primary);
  text-decoration: underline;
}

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

h1,
h2,
h3 {
  color: var(--text);
  font-weight: 600;
}

h1 {
  font-size: 23px;
  line-height: 1.35;
  margin: 0 0 12px;
}

h2 {
  font-size: 19px;
  line-height: 1.4;
  margin: 0 0 10px;
}

h3 {
  font-size: 17px;
  line-height: 1.4;
  margin: 20px 0 8px;
}

p {
  margin: 0 0 14px;
}

p:last-child {
  margin-bottom: 0;
}

ul,
ol {
  margin: 0 0 14px;
  padding-left: 22px;
}

li {
  margin-bottom: 6px;
}

strong,
b {
  font-weight: 700;
}

code {
  font-family: Monaco, Consolas, "Lucida Console", monospace;
  font-size: 0.92em;
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0 4px;
  overflow-wrap: anywhere;
}

[hidden] {
  display: none !important;
}

.text-small {
  font-size: 14px;
}

.text-muted {
  color: var(--faint);
}

/* 容器 */

.container {
  width: 100%;
  max-width: 1170px;
  margin: 0 auto;
  padding: 0 15px;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-start;
}

.row > .main {
  flex: 1 1 640px;
  min-width: 0;
}

.row > .aside {
  flex: 0 1 320px;
  min-width: 0;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 8px 12px;
  z-index: 300;
}

.skip-link:focus {
  left: 12px;
  top: 12px;
}

/* 页头 #header（深色导航条，A31 允许的「表头」小面积深色） */

#header {
  background: var(--header);
  color: var(--on-dark);
  flex: 0 0 auto;
}

#header .container {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  flex-wrap: wrap;
}

.navbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--on-dark);
  flex-shrink: 0;
}

.navbar-brand:hover {
  color: var(--on-dark);
  text-decoration: none;
}

.navbar-brand img {
  display: block;
  width: 26px;
  height: 26px;
  border-radius: var(--radius);
}

.navbar-brand .brand-name {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.header-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin-left: auto;
  font-size: 15px;
}

.header-links a {
  color: var(--header-link);
}

.header-links a:hover {
  color: var(--on-dark);
  text-decoration: none;
}

.navbar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--header-link);
  border-radius: var(--radius);
  background: transparent;
  color: var(--on-dark);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

/* 次级灰条 #nav_pc_2 */

#nav_pc_2 {
  background: var(--nav-2);
  flex: 0 0 auto;
}

#nav_pc_2 .container {
  display: flex;
  align-items: stretch;
  gap: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

#nav_pc_2 .container::-webkit-scrollbar {
  display: none;
}

#nav_pc_2 ul {
  display: flex;
  align-items: stretch;
  margin: 0;
  padding: 0;
  list-style: none;
  flex: 0 0 auto;
}

#nav_pc_2 li {
  display: flex;
  align-items: stretch;
  flex: 0 0 auto;
  margin: 0;
}

#nav_pc_2 a {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  padding: 9px 12px;
  color: var(--nav-2-fg);
  font-size: 16px;
}

#nav_pc_2 a:hover {
  color: var(--on-dark);
  background: var(--nav2-hover);
  text-decoration: none;
}

#nav_pc_2 .active a {
  color: var(--on-dark);
  font-weight: 800;
}

/* 主体 */

#body {
  flex: 1 0 auto;
  padding-top: 16px;
  padding-bottom: 16px;
}

/* 卡片 .card */

.card {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  margin-bottom: 16px;
  overflow: hidden;
}

.card > .card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  color: var(--header-2);
  font-size: 15px;
  font-weight: 600;
  border-bottom: 1px solid var(--line);
  background-image: linear-gradient(0deg, var(--surface-3), var(--surface-2));
}

.card > .card-header h2,
.card > .card-header h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--header-2);
}

.card > .card-header .count {
  margin-left: auto;
  font-size: 12px;
  font-weight: 400;
  color: var(--faint);
}

.card-block {
  padding: 16px 20px;
  background: var(--surface-2);
}

.card-block.white {
  background: var(--surface);
}

.card-block > :last-child {
  margin-bottom: 0;
}

/* 面包屑 */

.breadcrumb {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin: 0 0 16px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background-color: var(--crumb-bg);
  box-shadow: var(--shadow-crumb);
  font-size: 14px;
}

.breadcrumb:hover {
  background-color: var(--on-dark);
}

.breadcrumb li {
  margin: 0;
  display: inline-flex;
  color: var(--faint);
}

.breadcrumb li + li::before {
  content: "/";
  margin: 0 8px;
  color: var(--faint);
}

.breadcrumb a {
  color: var(--faint);
}

.breadcrumb a:hover {
  color: var(--primary);
  text-decoration: none;
}

/* 按钮 */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 8px 14px;
  border: 1px solid var(--primary);
  border-radius: var(--radius);
  background: var(--primary);
  color: var(--on-dark);
  font-family: inherit;
  font-size: 16px;
  font-weight: 400;
  cursor: pointer;
  transition: background 0.15s var(--ease);
}

.btn:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: var(--on-dark);
  text-decoration: none;
}

.btn-ghost {
  background: var(--surface);
  border-color: var(--line);
  color: var(--text-2);
}

.btn-ghost:hover {
  background: var(--surface-3);
  border-color: var(--line);
  color: var(--text);
}

/* 徽标 .badge */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  background: var(--badge-bg);
  color: var(--on-dark);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
  white-space: nowrap;
}

.badge-soft {
  background: var(--surface-3);
  color: var(--text-2);
}

.badge-hot {
  background: var(--badge-hot-bg);
  color: var(--on-dark);
}

/* 列表行（对应快照的 .thread / .post） */

.threadlist {
  list-style: none;
  margin: 0;
  padding: 0;
}

.thread {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 11px 0;
  margin: 0;
  border-bottom: 1px solid var(--line-2);
  transition: background 0.15s var(--ease);
}

.thread:last-child {
  border-bottom: 0;
}

.thread:hover {
  background-color: var(--surface);
}

.thread .subject {
  font-size: 18px;
  font-weight: 600;
  min-width: 0;
}

.thread .subject a {
  color: var(--text);
}

.thread .meta {
  margin-left: auto;
  flex-shrink: 0;
  font-size: 14px;
  color: var(--faint);
  white-space: nowrap;
}

.thread-desc {
  display: block;
  margin-top: 3px;
  font-size: 15px;
  color: var(--text-3);
  line-height: 1.65;
}

/* 筛选条 */

.filterbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.filterbar label {
  font-size: 15px;
  color: var(--text-2);
  white-space: nowrap;
}

.form-control {
  flex: 1 1 240px;
  min-width: 0;
  min-height: 40px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 16px;
}

.form-control:focus {
  outline: 0;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--focus-ring);
}

.form-control::placeholder {
  color: var(--faint);
}

/* 表格 */

.table-wrap {
  overflow-x: auto;
  margin: 0;
}

table.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

table.table caption {
  text-align: left;
  padding: 10px 0;
  font-size: 14px;
  color: var(--faint);
}

table.table th,
table.table td {
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line-2);
  line-height: 1.65;
}

table.table thead th {
  border-bottom: 1px solid var(--line);
  color: var(--header-2);
  font-weight: 600;
  font-size: 15px;
}

table.table tbody tr:last-child td {
  border-bottom: 0;
}

/* 定义清单 */

.fields {
  list-style: none;
  margin: 0;
  padding: 0;
}

.fields > li {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 14px;
  padding: 11px 0;
  margin: 0;
  border-bottom: 1px solid var(--line-2);
}

.fields > li:last-child {
  border-bottom: 0;
}

.fields .k {
  flex: 0 0 7.5rem;
  font-weight: 600;
}

.fields .v {
  flex: 1 1 18rem;
  min-width: 0;
  color: var(--text-3);
}

/* 步骤 */

.steps {
  list-style: none;
  counter-reset: step;
  margin: 0;
  padding: 0;
}

.steps > li {
  position: relative;
  counter-increment: step;
  padding: 12px 0 14px 44px;
  margin: 0;
  border-bottom: 1px solid var(--line-2);
}

.steps > li:first-child {
  padding-top: 0;
}

.steps > li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-pill);
  background: var(--primary);
  color: var(--on-dark);
  font-size: 14px;
  font-weight: 700;
}

.steps > li:first-child::before {
  top: 0;
}

.steps b {
  display: block;
}

/* FAQ */

.faq details {
  border-bottom: 1px solid var(--line-2);
}

.faq details:last-child {
  border-bottom: 0;
}

.faq summary {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 12px 0;
  cursor: pointer;
  font-size: 17px;
  font-weight: 600;
}

.faq summary::-webkit-details-marker {
  display: none;
}

.faq summary::before {
  content: "+";
  flex: 0 0 auto;
  color: var(--primary);
  font-weight: 700;
}

.faq details[open] summary::before {
  content: "\2212";
}

.faq summary:hover {
  color: var(--primary);
}

.faq .answer {
  padding: 0 0 14px 24px;
  color: var(--text-3);
  font-size: 16px;
}

.faq .answer p {
  margin: 0 0 10px;
}

/* 提示块（对应源站 .blockquote / .blockquote 的底纹，但不用左侧强调条 A25） */

.note {
  margin: 0 0 16px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-3);
  font-size: 15px;
  color: var(--text-2);
}

.note strong {
  color: var(--text);
}

/* 侧栏 */

.aside .card-block {
  padding: 12px 16px;
}

.aside .linklist {
  list-style: none;
  margin: 0;
  padding: 0;
}

.aside .linklist li {
  margin: 0;
  border-bottom: 1px solid var(--line-2);
}

.aside .linklist li:last-child {
  border-bottom: 0;
}

.aside .linklist a {
  display: block;
  padding: 9px 0;
  font-size: 15px;
  color: var(--text-2);
}

.aside .linklist a:hover {
  color: var(--primary);
}

/* 分页（源站 .pagination{flex-wrap:wrap} 防溢出） */

.pagination {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 16px 0 0;
  padding: 0;
}

.pagination li {
  margin: 0;
}

.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-2);
  font-size: 15px;
}

.pagination .current {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-dark);
  font-weight: 700;
}

.pagination .disabled {
  color: var(--faint);
}

/* 页脚 #footer */

#footer {
  flex: 0 0 auto;
  margin-top: 16px;
  padding: 18px 0 60px;
  background: var(--surface);
  border-top: 1px solid var(--line);
  font-size: 14px;
  color: var(--faint);
}

#footer .container {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 32px;
  justify-content: space-between;
}

#footer .brandline {
  margin: 0 0 6px;
}

#footer .brandline a {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

#footer h2 {
  margin: 0 0 5px;
  font-size: 13px;
  font-weight: 600;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

#footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
}

/* 返回顶部 */

#scrolltop {
  position: fixed;
  right: 16px;
  bottom: 150px;
  z-index: 50;
  display: none;
}

#scrolltop a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--faint);
  font-size: 13px;
}

#scrolltop a::before {
  content: "\25B2";
  font-size: 11px;
}

#scrolltop a:hover {
  color: var(--primary);
  text-decoration: none;
}

#scrolltop.on {
  display: block;
}

/* 固定寻芳 CTA —— CTA 库 85 号「双光汇聚」，文案原样使用。
   主通道（面）= 两束光相遇时整个钮面提亮（::after 覆盖全脸）；回声通道（动）= 青、品红两束光向中心汇聚（::before）。
   两条通道各一个动画，按钮本体不位移、不缩放、不旋转。3.4s 一轮，一轮里约四成时间静止。 */

.site-cta {
  position: fixed;
  z-index: 60;
  left: 50%;
  bottom: 64px;
  transform: translateX(-50%);
  width: min(560px, calc(100% - 32px));
  min-height: 58px;
  padding: 21px 24px;
  border-radius: 14px;
  background: var(--cta-bg);
  color: var(--cta-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 1px;
  text-decoration: none;
  overflow: hidden;
  box-shadow: 0 14px 30px var(--cta-shadow);
}

.site-cta:hover,
.site-cta:focus-visible {
  color: var(--on-dark);
  text-decoration: none;
}

.site-cta:focus-visible {
  outline: 2px solid var(--cta-l1);
  outline-offset: 3px;
}

.site-cta .cta-label {
  position: relative;
  z-index: 2;
}

.site-cta::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(90px 120px at 10% 50%, var(--cta-l1), transparent 70%),
    radial-gradient(90px 120px at 90% 50%, var(--cta-l2), transparent 70%);
  background-repeat: no-repeat;
  animation: cta-gather 3.4s ease-in-out infinite;
}

.site-cta::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--cta-flash);
  opacity: 0;
  animation: cta-face 3.4s ease-in-out infinite;
}

@keyframes cta-gather {
  0%,
  26% {
    background-position: 0% 50%, 100% 50%;
  }
  56%,
  74% {
    background-position: 30% 50%, 70% 50%;
  }
  100% {
    background-position: 0% 50%, 100% 50%;
  }
}

@keyframes cta-face {
  0%,
  44% {
    opacity: 0;
  }
  54%,
  66% {
    opacity: 0.5;
  }
  78%,
  100% {
    opacity: 0;
  }
}

/* 断点：照搬 Bootstrap 4 beta3 */

@media (min-width: 576px) {
  #body {
    padding-top: 16px;
  }
}

@media (min-width: 1200px) {
  #scrolltop {
    right: 24px;
  }
}

@media (max-width: 991px) {
  .row {
    display: block;
  }

  .row > .aside {
    margin-top: 16px;
  }

  #header .container {
    flex-wrap: wrap;
  }

  .navbar-toggle {
    display: inline-flex;
    order: 3;
  }

  .header-links {
    order: 4;
    flex: 1 1 100%;
    margin-left: 0;
    padding-bottom: 12px;
    border-top: 1px solid var(--header-hairline);
    padding-top: 10px;
  }

  .header-links a {
    display: block;
    width: 100%;
    padding: 6px 0;
    border-bottom: 1px solid var(--nav2-hairline);
  }
}

@media (max-width: 575px) {
  .card-block {
    padding: 12px 14px;
  }

  .card > .card-header {
    padding: 10px 14px;
  }

  .filterbar {
    padding: 10px 14px;
  }

  .thread {
    display: block;
  }

  .thread .meta {
    display: block;
    margin: 4px 0 0;
    white-space: normal;
  }

  .fields > li {
    display: block;
  }

  .fields .k {
    display: block;
    flex: none;
    margin-bottom: 2px;
  }

  .fields .v {
    display: block;
  }

  .steps > li {
    padding-left: 40px;
  }

  .site-cta {
    left: 12px;
    right: 12px;
    width: auto;
    transform: none;
    bottom: calc(48px + env(safe-area-inset-bottom));
    font-size: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .site-cta::before {
    animation: none;
    background-position: 30% 50%, 70% 50%;
  }

  .site-cta::after {
    animation: none;
    opacity: 0.4;
  }
}
