/*
 * 台灣盾 theme
 * Dark cyber-pop with neon edges, tuned for a Traditional Chinese (zh-Hant)
 * technical community. Overrides Bootstrap 5 dark variables in one place
 * so individual pages stay clean.
 */

:root,
[data-bs-theme="dark"] {
  --bbs-bg: #0a0c14;
  --bbs-bg-soft: #10131c;
  --bbs-surface: #161a26;
  --bbs-surface-2: #1d2230;
  --bbs-elevated: #232a3b;
  --bbs-border: #262c3d;
  --bbs-border-strong: #353d54;
  --bbs-text: #e7eaf3;
  --bbs-text-muted: #9aa3bb;
  --bbs-primary: #5ee2ff;
  --bbs-primary-strong: #2bd3f3;
  --bbs-accent: #ff4dab;
  --bbs-warn: #ffd166;
  --bbs-danger: #ff6b81;
  --bbs-success: #5eead4;
  --bbs-glow-primary: rgba(94, 226, 255, 0.45);
  --bbs-glow-accent: rgba(255, 77, 171, 0.45);
  --bbs-nav-h: 56px;
  --bbs-radius-lg: 1rem;
  --bbs-radius-md: 0.85rem;
  --bbs-transition-fast: 0.18s ease;
  --bbs-transition-soft: 0.28s cubic-bezier(0.33, 1, 0.68, 1);
  --bbs-focus-ring: 0 0 0 2px var(--bbs-bg), 0 0 0 4px rgba(94, 226, 255, 0.55);

  --bs-body-bg: var(--bbs-bg);
  --bs-body-color: var(--bbs-text);
  --bs-body-color-rgb: 231, 234, 243;
  --bs-secondary-color: var(--bbs-text-muted);
  --bs-tertiary-bg: var(--bbs-surface);
  --bs-emphasis-color: #ffffff;
  --bs-link-color: var(--bbs-primary);
  --bs-link-color-rgb: 94, 226, 255;
  --bs-link-hover-color: var(--bbs-primary-strong);
  --bs-border-color: var(--bbs-border);
  --bs-card-bg: var(--bbs-surface);
  --bs-card-color: var(--bbs-text);
  --bs-card-border-color: var(--bbs-border);
  --bs-list-group-bg: var(--bbs-surface);
  --bs-list-group-color: var(--bbs-text);
  --bs-list-group-border-color: var(--bbs-border);
  --bs-list-group-action-color: var(--bbs-text);
  --bs-list-group-action-hover-bg: var(--bbs-surface-2);
  --bs-list-group-action-hover-color: var(--bs-emphasis-color);
}

html,
body {
  background: var(--bbs-bg);
  color: var(--bbs-text);
}

body {
  font-family: "Noto Sans TC", -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  letter-spacing: 0.01em;
  background-image:
    radial-gradient(1200px 700px at 90% -10%, rgba(94, 226, 255, 0.08), transparent 60%),
    radial-gradient(900px 500px at -10% 30%, rgba(255, 77, 171, 0.06), transparent 60%),
    linear-gradient(180deg, #0a0c14 0%, #07090f 100%);
  background-attachment: fixed;
  min-height: 100vh;
}

.bbs-mono,
code,
kbd,
pre,
samp {
  font-family: "JetBrains Mono", "Fira Code", ui-monospace, SFMono-Regular,
    Consolas, monospace;
}

a {
  color: var(--bs-link-color);
}

/* navbar ------------------------------------------------------------- */
.bbs-navbar {
  background: rgba(10, 12, 20, 0.78);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--bbs-border);
  box-shadow: 0 1px 0 rgba(94, 226, 255, 0.18),
    0 0 24px -10px var(--bbs-glow-primary);
  transition: box-shadow var(--bbs-transition-soft), border-color var(--bbs-transition-fast);
}

.bbs-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-decoration: none;
}

.bbs-brand-glyph {
  color: var(--bbs-primary);
  text-shadow: 0 0 10px var(--bbs-glow-primary);
}

.bbs-brand-shield {
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

.bbs-brand-logo {
  display: block;
  height: 1.75rem;
  width: auto;
  max-width: 2.5rem;
  object-fit: contain;
  filter: drop-shadow(0 0 8px var(--bbs-glow-primary));
}

.bbs-brand-shield--lg .bbs-brand-logo {
  height: 2.75rem;
  max-width: 4rem;
}

.bbs-brand-suffix {
  font-weight: 500;
  letter-spacing: 0.08em;
  opacity: 0.85;
}

.bbs-brand-text {
  background: linear-gradient(90deg, var(--bbs-primary) 0%, var(--bbs-accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Navbar: search grows; action links must not shrink (prevents CJK per-char wrap) */
@media (min-width: 992px) {
  .bbs-navbar .bbs-navbar-collapse {
    display: flex !important;
    flex-wrap: nowrap;
    align-items: center;
    flex-grow: 1;
    gap: 0.75rem;
    min-width: 0;
  }

  .bbs-navbar .bbs-search-form {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 28rem;
    margin-left: 0.75rem;
  }

  .bbs-navbar .bbs-navbar-actions {
    flex: 0 0 auto;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.15rem;
  }
}

.bbs-navbar .bbs-search-form {
  width: 100%;
}

.bbs-search-input {
  width: 100%;
  min-width: 0;
  background: var(--bbs-bg-soft);
  border-color: var(--bbs-border);
  color: var(--bbs-text);
}

@media (min-width: 992px) {
  .bbs-search-input {
    min-width: 12rem;
  }
}

/* Nav actions: keep links and buttons on one baseline */
.bbs-navbar .bbs-navbar-actions {
  align-items: center;
}

.bbs-navbar .bbs-navbar-actions .nav-item {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.bbs-navbar .bbs-navbar-actions .nav-link,
.bbs-navbar .bbs-navbar-actions .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  margin: 0;
  line-height: 1.25;
}

.bbs-navbar .bbs-navbar-actions .btn-sm {
  padding: 0.45rem 0.75rem;
  min-height: 0;
  align-self: center;
}

.bbs-navbar .bbs-nav-user-btn {
  max-width: 11rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bbs-navbar .bbs-nav-user-btn .bbs-mono {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
}

.bbs-search-input::placeholder {
  color: var(--bbs-text-muted);
}

.bbs-search-input:focus {
  background: var(--bbs-surface);
  border-color: var(--bbs-primary);
  box-shadow: 0 0 0 0.18rem var(--bbs-glow-primary);
  color: var(--bbs-text);
}

.navbar .nav-link {
  color: var(--bbs-text-muted);
  font-weight: 500;
  border-radius: 0.4rem;
  padding: 0.45rem 0.65rem;
  transition: color var(--bbs-transition-fast), background var(--bbs-transition-fast);
}

.navbar .nav-link:hover {
  color: var(--bbs-text);
  background: rgba(94, 226, 255, 0.06);
}

.navbar .nav-link.active {
  color: var(--bbs-text);
  background: rgba(94, 226, 255, 0.1);
}

/* Hero / page search: single line flex, input takes remaining width */
.bbs-search-hero {
  min-width: 0;
}

.bbs-search-hero .form-control {
  min-width: 0;
}

/* surfaces ----------------------------------------------------------- */
.card {
  background: var(--bbs-surface);
  border-color: var(--bbs-border);
  color: var(--bbs-text);
  border-radius: 0.85rem;
}

.card.bbs-card-glow {
  box-shadow: 0 0 0 1px var(--bbs-border),
    0 14px 40px -18px var(--bbs-glow-primary);
}

.list-group {
  --bs-list-group-border-color: var(--bbs-border);
}

.list-group-item {
  background: var(--bbs-surface);
  color: var(--bbs-text);
  border-color: var(--bbs-border);
}

.list-group-item-action:hover,
.list-group-item-action:focus {
  background: var(--bbs-surface-2);
  color: var(--bs-emphasis-color);
}

.bbs-soft {
  background: var(--bbs-bg-soft);
  border: 1px solid var(--bbs-border);
  border-radius: 0.75rem;
}

/* buttons ------------------------------------------------------------ */
.btn-bbs-primary {
  background: linear-gradient(135deg, var(--bbs-primary) 0%, #56b8ff 100%);
  border: 1px solid rgba(94, 226, 255, 0.6);
  color: #06121a;
  font-weight: 600;
  box-shadow: 0 0 18px -6px var(--bbs-glow-primary);
}

.btn-bbs-primary:hover,
.btn-bbs-primary:focus {
  color: #03161e;
  filter: brightness(1.08);
  box-shadow: 0 0 26px -4px var(--bbs-glow-primary);
}

.btn-bbs-ghost {
  background: transparent;
  color: var(--bbs-text);
  border: 1px solid var(--bbs-border-strong);
}

.btn-bbs-ghost:hover,
.btn-bbs-ghost:focus {
  background: var(--bbs-surface-2);
  color: var(--bs-emphasis-color);
  border-color: var(--bbs-primary);
}

.btn-bbs-ghost.active {
  color: var(--bbs-primary);
  border-color: rgba(94, 226, 255, 0.5);
  box-shadow: inset 0 0 0 1px rgba(94, 226, 255, 0.35);
}

.btn-bbs-accent {
  background: linear-gradient(135deg, var(--bbs-accent) 0%, #ff7ad9 100%);
  color: #1a0612;
  border: 0;
  font-weight: 600;
  box-shadow: 0 0 18px -6px var(--bbs-glow-accent);
}

.btn-bbs-accent:hover,
.btn-bbs-accent:focus {
  color: #1a0612;
  filter: brightness(1.06);
}

.btn-link {
  color: var(--bbs-primary);
}

/* forms -------------------------------------------------------------- */
.form-control,
.form-select {
  background: var(--bbs-bg-soft);
  border-color: var(--bbs-border);
  color: var(--bbs-text);
}

.form-control::placeholder {
  color: var(--bbs-text-muted);
}

.form-control:focus,
.form-select:focus {
  background: var(--bbs-surface);
  color: var(--bbs-text);
  border-color: var(--bbs-primary);
  box-shadow: 0 0 0 0.2rem var(--bbs-glow-primary);
}

textarea.form-control {
  line-height: 1.65;
}

.form-label {
  color: var(--bbs-text-muted);
  font-weight: 500;
  letter-spacing: 0.04em;
}

/* tabs --------------------------------------------------------------- */
.nav-pills .nav-link {
  color: var(--bbs-text-muted);
  border-radius: 0.5rem;
  padding: 0.4rem 0.95rem;
  font-weight: 500;
}

.nav-pills .nav-link.active {
  background: var(--bbs-surface-2);
  color: var(--bs-emphasis-color);
  box-shadow: inset 0 0 0 1px rgba(94, 226, 255, 0.32);
}

/* badges ------------------------------------------------------------- */
.bbs-tag,
.bbs-tag-accent,
.bbs-tag-mute {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 500;
  border: 1px solid var(--bbs-border);
}

.bbs-tag {
  color: var(--bbs-primary);
  background: rgba(94, 226, 255, 0.12);
  border-color: rgba(94, 226, 255, 0.28);
}

.bbs-tag-accent {
  color: var(--bbs-accent);
  background: rgba(255, 77, 171, 0.12);
  border-color: rgba(255, 77, 171, 0.3);
}

.bbs-tag-mute {
  color: var(--bbs-text-muted);
  background: var(--bbs-surface-2);
}

/* section title ------------------------------------------------------ */
.bbs-section-title {
  font-weight: 700;
  letter-spacing: 0.04em;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--bbs-text);
  margin-bottom: 0.85rem;
}

.bbs-section-title::before {
  content: "";
  display: inline-block;
  width: 0.35rem;
  height: 1.1rem;
  background: linear-gradient(180deg, var(--bbs-primary), var(--bbs-accent));
  border-radius: 0.18rem;
  box-shadow: 0 0 12px -2px var(--bbs-glow-primary);
}

/* hero --------------------------------------------------------------- */
.bbs-hero {
  position: relative;
  min-height: clamp(11rem, 26vw, 15rem);
  padding: clamp(1.25rem, 3vw, 2rem) clamp(1.25rem, 3vw, 2rem);
  border-radius: 1rem;
  background:
    linear-gradient(135deg, rgba(94, 226, 255, 0.12), rgba(255, 77, 171, 0.06) 60%, transparent),
    var(--bbs-surface);
  border: 1px solid var(--bbs-border);
  overflow: hidden;
  isolation: isolate;
}

/* Logo watermark: cover hero, blend away dark PNG matte, fade out toward card edges */
.bbs-hero::before {
  content: "";
  position: absolute;
  inset: -2%;
  pointer-events: none;
  z-index: 0;
  background: url("/static/img/logo.png") 68% 50% / cover no-repeat;
  mix-blend-mode: screen;
  opacity: 0.9;
  -webkit-mask-image: radial-gradient(
    ellipse 120% 100% at 68% 50%,
    rgba(0, 0, 0, 0.35) 0%,
    rgba(0, 0, 0, 0.22) 38%,
    rgba(0, 0, 0, 0.1) 58%,
    rgba(0, 0, 0, 0.03) 75%,
    transparent 92%
  );
  mask-image: radial-gradient(
    ellipse 120% 100% at 68% 50%,
    rgba(0, 0, 0, 0.35) 0%,
    rgba(0, 0, 0, 0.22) 38%,
    rgba(0, 0, 0, 0.1) 58%,
    rgba(0, 0, 0, 0.03) 75%,
    transparent 92%
  );
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
}

/* Keep left copy readable over the watermark */
.bbs-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: linear-gradient(
    100deg,
    rgba(22, 26, 38, 0.94) 0%,
    rgba(22, 26, 38, 0.72) 38%,
    rgba(22, 26, 38, 0.2) 58%,
    transparent 72%
  );
}

.bbs-hero > .row {
  position: relative;
  z-index: 1;
}

.bbs-hero h1 {
  font-weight: 800;
  letter-spacing: 0.04em;
}

/* posts list --------------------------------------------------------- */
.bbs-post-card {
  transition: transform 0.15s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.bbs-post-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 40px -22px var(--bbs-glow-primary);
  border-color: var(--bbs-border-strong);
}

.bbs-post-title {
  font-weight: 600;
  font-size: 1.05rem;
  line-height: 1.45;
  margin: 0;
}

.bbs-post-title a {
  color: var(--bbs-text);
  text-decoration: none;
}

.bbs-post-title a:hover {
  color: var(--bbs-primary);
}

.bbs-post-meta {
  color: var(--bbs-text-muted);
  font-size: 0.85rem;
}

.bbs-post-meta a {
  color: var(--bbs-text-muted);
  text-decoration: none;
}

.bbs-post-meta a:hover {
  color: var(--bbs-primary);
}

.bbs-post-stats {
  color: var(--bbs-text-muted);
  font-size: 0.82rem;
  display: inline-flex;
  align-items: center;
  gap: 0.85rem;
}

.bbs-post-stats .num {
  color: var(--bbs-text);
  font-weight: 600;
  margin-right: 0.18rem;
}

.bbs-rank {
  display: inline-flex;
  width: 1.6rem;
  height: 1.6rem;
  align-items: center;
  justify-content: center;
  border-radius: 0.4rem;
  background: rgba(94, 226, 255, 0.12);
  color: var(--bbs-primary);
  font-family: "JetBrains Mono", monospace;
  font-weight: 600;
  font-size: 0.82rem;
}

.bbs-rank.is-top {
  background: rgba(255, 77, 171, 0.18);
  color: var(--bbs-accent);
  box-shadow: 0 0 10px -2px var(--bbs-glow-accent);
}

/* Home: 24h hot list — prevent flex/grid min-width:auto from horizontal overflow */
.bbs-hot-sidebar {
  min-width: 0;
}

.bbs-hot-card {
  overflow: hidden;
  min-width: 0;
}

a.bbs-hot-item.list-group-item {
  min-width: 0;
  overflow: hidden;
}

.bbs-hot-meta {
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* prose (markdown body) --------------------------------------------- */
.bbs-prose {
  color: var(--bbs-text);
  line-height: 1.85;
  font-size: 1rem;
  word-wrap: break-word;
}

.bbs-prose h1,
.bbs-prose h2,
.bbs-prose h3,
.bbs-prose h4 {
  color: #ffffff;
  margin-top: 1.6em;
  font-weight: 700;
}

.bbs-prose a {
  color: var(--bbs-primary);
}

.bbs-prose a:hover {
  color: var(--bbs-primary-strong);
}

.bbs-prose code {
  background: rgba(94, 226, 255, 0.08);
  border: 1px solid rgba(94, 226, 255, 0.2);
  color: var(--bbs-primary);
  padding: 0.1em 0.38em;
  border-radius: 0.35rem;
  font-size: 0.92em;
}

.bbs-prose pre {
  background: var(--bbs-bg-soft);
  border: 1px solid var(--bbs-border);
  border-radius: 0.65rem;
  padding: 1rem 1.1rem;
  overflow: auto;
  box-shadow: inset 0 0 0 1px rgba(94, 226, 255, 0.05);
}

.bbs-prose pre code {
  background: transparent;
  border: 0;
  color: var(--bbs-text);
  padding: 0;
  font-size: 0.92em;
}

.bbs-prose blockquote {
  border-left: 3px solid var(--bbs-primary);
  padding: 0.4em 1rem;
  color: var(--bbs-text-muted);
  background: rgba(94, 226, 255, 0.05);
  border-radius: 0 0.5rem 0.5rem 0;
}

.bbs-prose img {
  max-width: 100%;
  border-radius: 0.5rem;
}

.bbs-prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
}

.bbs-prose th,
.bbs-prose td {
  border: 1px solid var(--bbs-border);
  padding: 0.5rem 0.75rem;
}

.bbs-prose th {
  background: var(--bbs-bg-soft);
}

/* comments ----------------------------------------------------------- */
.bbs-comment {
  min-width: 0;
  background: var(--bbs-surface);
  border: 1px solid var(--bbs-border);
  border-left: 3px solid var(--bbs-primary);
  border-radius: 0 0.65rem 0.65rem 0;
  padding: 0.9rem 1.05rem;
}

.bbs-comment + .bbs-comment {
  margin-top: 0.65rem;
}

.bbs-comment-author {
  color: var(--bbs-primary);
  font-weight: 600;
  font-size: 0.92rem;
}

.bbs-comment-meta {
  color: var(--bbs-text-muted);
  font-size: 0.78rem;
}

.bbs-comment-head {
  min-width: 0;
  gap: 0.5rem;
}

.bbs-comment-head .bbs-comment-author {
  min-width: 0;
  overflow-wrap: anywhere;
}

.bbs-comment-body {
  margin-top: 0.35rem;
  white-space: pre-wrap;
  line-height: 1.75;
  overflow-wrap: anywhere;
  word-wrap: break-word;
}

/* downloads ---------------------------------------------------------- */
.bbs-download {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--bbs-border);
  border-radius: 0.65rem;
  background: var(--bbs-bg-soft);
  flex-wrap: wrap;
  min-width: 0;
}

/* Author upload form: align file input with other .form-control-sm */
.bbs-dl-upload .form-control-sm[type="file"] {
  min-height: 2.125rem;
  padding: 0.2rem 0.5rem;
  line-height: 1.5;
}

.bbs-download + .bbs-download {
  margin-top: 0.55rem;
}

.bbs-download-meta {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.78rem;
  color: var(--bbs-text-muted);
  word-break: break-all;
}

/* pagination --------------------------------------------------------- */
.pagination .page-link {
  background: var(--bbs-surface);
  border-color: var(--bbs-border);
  color: var(--bbs-text);
}

.pagination .page-link:hover {
  background: var(--bbs-surface-2);
  color: var(--bbs-primary);
}

.pagination .page-item.active .page-link {
  background: var(--bbs-primary);
  border-color: var(--bbs-primary);
  color: #04181f;
}

.pagination .page-item.disabled .page-link {
  background: var(--bbs-surface);
  color: var(--bbs-text-muted);
  border-color: var(--bbs-border);
}

/* footer ------------------------------------------------------------- */
.bbs-footer {
  border-top: 1px solid var(--bbs-border);
  background: linear-gradient(180deg, transparent, rgba(94, 226, 255, 0.03));
}

/* toasts ------------------------------------------------------------- */
.bbs-toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 1060;
  padding: 0.65rem 1rem;
  border-radius: 0.5rem;
  background: var(--bbs-surface);
  border: 1px solid var(--bbs-border);
  color: var(--bbs-text);
  box-shadow: 0 10px 30px -10px var(--bbs-glow-primary);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.bbs-toast.is-error {
  border-color: var(--bbs-danger);
  color: var(--bbs-danger);
}

.bbs-toast.is-hide {
  opacity: 0;
  transform: translateY(6px);
}

/* scrollbar (webkit) ------------------------------------------------- */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bbs-bg);
}

::-webkit-scrollbar-thumb {
  background: var(--bbs-border-strong);
  border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--bbs-primary);
}

/* alerts ------------------------------------------------------------- */
.alert {
  background: var(--bbs-surface);
  border: 1px solid var(--bbs-border);
  color: var(--bbs-text);
}

.alert-info {
  border-color: rgba(94, 226, 255, 0.35);
  background: rgba(94, 226, 255, 0.08);
}

.alert-danger {
  border-color: rgba(255, 107, 129, 0.4);
  background: rgba(255, 107, 129, 0.08);
  color: var(--bbs-danger);
}

.alert-success {
  border-color: rgba(94, 234, 212, 0.35);
  background: rgba(94, 234, 212, 0.08);
  color: var(--bbs-success);
}

.text-muted,
.text-body-secondary {
  color: var(--bbs-text-muted) !important;
}

/* admin shell (cmd/admin) -------------------------------------------- */
.admin-app {
  min-height: calc(100vh - 56px);
}

.admin-sidebar {
  width: 220px;
  min-width: 220px;
  background: var(--bbs-surface);
  border-right: 1px solid var(--bbs-border);
  padding: 1rem 0.75rem;
}

@media (max-width: 991.98px) {
  .admin-app {
    flex-direction: column;
  }
  .admin-sidebar {
    width: 100%;
    min-width: 0;
    border-right: 0;
    border-bottom: 1px solid var(--bbs-border);
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    padding: 0.75rem;
  }
}

.admin-sidebar .nav-link {
  color: var(--bbs-text-muted);
  border-radius: 0.45rem;
  padding: 0.45rem 0.65rem;
  font-size: 0.92rem;
}

.admin-sidebar .nav-link:hover {
  color: var(--bbs-text);
  background: var(--bbs-surface-2);
}

.admin-sidebar .nav-link.active {
  color: var(--bbs-primary);
  background: rgba(94, 226, 255, 0.1);
  box-shadow: inset 0 0 0 1px rgba(94, 226, 255, 0.25);
}

.admin-main {
  background: var(--bbs-bg);
  min-width: 0;
}

.admin-stat-card {
  background: var(--bbs-surface);
  border: 1px solid var(--bbs-border);
  border-radius: 0.75rem;
  padding: 1rem 1.15rem;
  height: 100%;
}

.admin-stat-card .label {
  font-size: 0.78rem;
  color: var(--bbs-text-muted);
  letter-spacing: 0.04em;
}

.admin-stat-card .value {
  font-size: 1.45rem;
  font-weight: 700;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  color: var(--bbs-text);
  line-height: 1.2;
}

.admin-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--bbs-border);
  border-radius: 0.65rem;
}

/* utility ------------------------------------------------------------ */
.bbs-divider {
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--bbs-border-strong) 50%,
    transparent 100%
  );
  margin: 1rem 0;
}

/* ---------- layout & shell (UX upgrade, keeps 台灣盾 neon tone) ---------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

:focus-visible {
  outline: none;
  box-shadow: var(--bbs-focus-ring);
}

.bbs-skip-link {
  position: absolute;
  left: 0.75rem;
  top: -100%;
  z-index: 1090;
  padding: 0.45rem 0.9rem;
  border-radius: 0.35rem;
  background: var(--bbs-primary);
  color: #06121a !important;
  font-weight: 600;
  font-size: 0.85rem;
  text-decoration: none;
  transition: top var(--bbs-transition-fast);
}

.bbs-skip-link:focus {
  top: 0.75rem;
}

body.bbs-body {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main#main-content,
main#main-content.bbs-main {
  flex: 1 0 auto;
}

.bbs-main--narrow {
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}

.bbs-navbar.is-scrolled {
  box-shadow: 0 4px 32px -12px rgba(0, 0, 0, 0.55),
    0 1px 0 rgba(94, 226, 255, 0.22),
    0 0 36px -14px var(--bbs-glow-primary);
}

/* Hero — headline scale (padding lives in base .bbs-hero) */
.bbs-hero-headline {
  font-weight: 900;
  letter-spacing: 0.06em;
  line-height: 1.25;
}

@media (min-width: 768px) {
  .bbs-hero-headline {
    font-size: clamp(1.35rem, 2.5vw, 1.85rem);
  }
}

.bbs-page-kicker {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--bbs-text-muted);
  margin-bottom: 0.35rem;
}

.bbs-hero-actions .btn {
  min-height: 2.6rem;
  padding-left: 1.35rem;
  padding-right: 1.35rem;
}

/* Board grid cards — left accent rail */
.bbs-board-card {
  position: relative;
  overflow: hidden;
}

.bbs-board-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--bbs-primary), var(--bbs-accent));
  opacity: 0.95;
  border-radius: var(--bbs-radius-md) 0 0 var(--bbs-radius-md);
}

.bbs-board-card .card-body {
  padding-left: 1.35rem;
}

.bbs-board-card-link:focus-visible .bbs-board-card {
  border-color: var(--bbs-primary);
}

@media (prefers-reduced-motion: no-preference) {
  .bbs-board-card-link:hover .bbs-board-card {
    transform: translateY(-2px);
  }
}

.bbs-board-desc {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.55;
}

/* Hot sidebar — stays visible while scrolling feed */
@media (min-width: 992px) {
  .bbs-hot-sticky {
    position: sticky;
    top: calc(var(--bbs-nav-h) + 1rem);
    align-self: flex-start;
  }

  .bbs-hot-card-inner {
    border-radius: var(--bbs-radius-md);
    overflow: visible;
  }
}

/* Empty / idle states */
.bbs-empty {
  border: 1px dashed var(--bbs-border-strong);
  border-radius: var(--bbs-radius-md);
  background: rgba(16, 19, 28, 0.65);
  padding: clamp(2rem, 5vw, 3rem);
  text-align: center;
  color: var(--bbs-text-muted);
}

.bbs-empty-title {
  font-weight: 600;
  color: var(--bbs-text);
  margin-bottom: 0.35rem;
}

/* Segmented control look for sort tabs */
.bbs-segmented {
  display: inline-flex;
  padding: 0.2rem;
  border-radius: 999px;
  background: var(--bbs-bg-soft);
  border: 1px solid var(--bbs-border);
  gap: 0.15rem;
}

.bbs-segmented .btn-bbs-ghost {
  border-radius: 999px;
  border-color: transparent;
  padding: 0.35rem 1rem;
}

.bbs-segmented .btn-bbs-ghost.active {
  background: rgba(94, 226, 255, 0.14);
  border-color: rgba(94, 226, 255, 0.35);
  color: var(--bbs-primary);
}

/* Post detail — article chrome */
.bbs-article-shell {
  border-radius: var(--bbs-radius-lg);
}

.bbs-article-toolbar {
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
}

.bbs-stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  font-size: 0.8rem;
  background: var(--bbs-bg-soft);
  border: 1px solid var(--bbs-border);
  color: var(--bbs-text-muted);
}

.bbs-stat-chip .num {
  color: var(--bbs-text);
  font-weight: 700;
  font-family: "JetBrains Mono", ui-monospace, monospace;
}

/* Comment composer */
.bbs-comment-composer {
  border-radius: var(--bbs-radius-md);
  border: 1px solid var(--bbs-border);
  background: linear-gradient(165deg, var(--bbs-bg-soft) 0%, var(--bbs-surface) 100%);
  padding: 1rem 1.15rem;
}

/* Search hero input */
.bbs-search-hero .form-control {
  min-height: 3rem;
  border-radius: 0.65rem;
}

.bbs-search-hero .btn-bbs-primary {
  min-height: 3rem;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
  border-radius: 0.65rem;
}

/* Me — tab strip breathing room */
.bbs-me-tabs {
  flex-wrap: wrap;
  gap: 0.35rem;
}

.bbs-me-tabs .nav-link {
  white-space: nowrap;
}

/* Footer — structured */
.bbs-footer-inner {
  display: grid;
  gap: 1rem 2rem;
  align-items: start;
}

@media (min-width: 768px) {
  .bbs-footer-inner {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1.25rem 2.5rem;
    align-items: center;
  }
}

.bbs-footer-brand-block {
  min-width: 0;
}

.bbs-footer-links {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.5rem;
  justify-content: flex-start;
}

@media (min-width: 768px) {
  .bbs-footer-links {
    justify-content: flex-end;
  }
}

.bbs-footer-links a {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--bbs-text-muted);
  text-decoration: none;
  padding: 0.25rem 0;
  white-space: nowrap;
}

.bbs-footer-links a:hover {
  color: var(--bbs-primary);
}

.bbs-footer-note {
  max-width: 38rem;
  font-size: 0.9rem;
  line-height: 1.6;
  margin-top: 0.45rem;
}

.bbs-footer-brand {
  margin-bottom: 0;
}

/* Toast — position & motion */
@media (prefers-reduced-motion: no-preference) {
  .bbs-toast {
    animation: bbs-toast-in 0.35s var(--bbs-transition-soft) both;
  }

  @keyframes bbs-toast-in {
    from {
      opacity: 0;
      transform: translateY(10px) scale(0.98);
    }
    to {
      opacity: 1;
      transform: translateY(0) scale(1);
    }
  }
}

/* Admin dashboard polish */
.admin-sidebar .nav-link {
  transition: background var(--bbs-transition-fast), color var(--bbs-transition-fast);
}

.admin-stat-card {
  transition: transform var(--bbs-transition-fast), border-color var(--bbs-transition-fast);
}

@media (prefers-reduced-motion: no-preference) {
  .admin-stat-card:hover {
    transform: translateY(-2px);
    border-color: rgba(94, 226, 255, 0.35);
  }
}

.admin-main > .container-fluid > section > h1:first-child {
  letter-spacing: 0.02em;
}

/* ---------- compose / leak — workbench pages ---------- */

.bbs-tool-masthead {
  position: relative;
  overflow: hidden;
  padding: clamp(1.35rem, 3.5vw, 2rem) clamp(1.25rem, 3vw, 2rem);
  border-radius: var(--bbs-radius-lg);
  background:
    linear-gradient(135deg, rgba(94, 226, 255, 0.14), rgba(255, 77, 171, 0.07) 52%, transparent),
    var(--bbs-surface);
  border: 1px solid var(--bbs-border);
  box-shadow: 0 18px 48px -28px var(--bbs-glow-primary),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.bbs-tool-masthead::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 70% 55% at 96% -10%, rgba(94, 226, 255, 0.22), transparent 52%);
}

.bbs-tool-masthead--leak {
  background:
    linear-gradient(135deg, rgba(255, 77, 171, 0.11), rgba(94, 226, 255, 0.09) 48%, transparent),
    var(--bbs-surface);
}

.bbs-tool-masthead--leak::before {
  background: radial-gradient(ellipse 65% 50% at 96% -8%, rgba(255, 77, 171, 0.2), transparent 50%);
}

.bbs-tool-masthead > .row:first-child,
.bbs-tool-masthead > .alert {
  position: relative;
  z-index: 1;
}

.bbs-tool-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--bbs-primary);
  background: rgba(94, 226, 255, 0.12);
  border: 1px solid rgba(94, 226, 255, 0.35);
}

.bbs-tool-badge--warn {
  color: var(--bbs-warn);
  background: rgba(255, 209, 102, 0.1);
  border-color: rgba(255, 209, 102, 0.35);
}

.bbs-workbench-card {
  border-color: var(--bbs-border);
  background: var(--bbs-surface);
  box-shadow: 0 0 0 1px rgba(94, 226, 255, 0.05),
    0 22px 56px -34px rgba(0, 0, 0, 0.55);
}

.bbs-form-section {
  padding-bottom: 1.35rem;
  margin-bottom: 1.35rem;
  border-bottom: 1px solid var(--bbs-border);
}

.bbs-form-section:last-of-type {
  border-bottom: 0;
  margin-bottom: 0;
  padding-bottom: 0;
}

.bbs-form-section-head {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
}

.bbs-form-step {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.55rem;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--bbs-bg);
  background: linear-gradient(135deg, var(--bbs-primary), #56b8ff);
  box-shadow: 0 0 16px -6px var(--bbs-glow-primary);
}

.bbs-editor-wrap {
  border-radius: 0.65rem;
  border: 1px solid var(--bbs-border-strong);
  background: var(--bbs-bg-soft);
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(94, 226, 255, 0.06);
}

.bbs-editor-wrap textarea {
  resize: vertical;
  min-height: 14rem;
}

.bbs-form-actions {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

@media (min-width: 768px) {
  .bbs-form-actions {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

@media (min-width: 992px) {
  .bbs-workbench-sidebar {
    position: sticky;
    top: calc(var(--bbs-nav-h) + 1rem);
  }
}

.bbs-sidebar-card {
  border-color: var(--bbs-border);
  background: linear-gradient(165deg, var(--bbs-bg-soft) 0%, var(--bbs-surface) 100%);
}

.bbs-sidebar-card--accent {
  border-color: rgba(94, 226, 255, 0.28);
  box-shadow: inset 0 0 0 1px rgba(94, 226, 255, 0.08);
}

.bbs-sidebar-card--danger {
  border-color: rgba(255, 107, 129, 0.35);
  background: linear-gradient(165deg, rgba(255, 107, 129, 0.07), var(--bbs-surface));
}

.bbs-sidebar-title {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--bbs-text-muted);
  margin-bottom: 0.65rem;
}

.bbs-sidebar-list {
  padding-left: 1.1rem;
  margin: 0;
}

.bbs-sidebar-list li {
  margin-bottom: 0.35rem;
}

.bbs-sidebar-list li:last-child {
  margin-bottom: 0;
}

.bbs-sidebar-steps {
  padding-left: 1.15rem;
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.65;
  color: var(--bbs-text-muted);
}

.bbs-sidebar-steps li {
  margin-bottom: 0.6rem;
}

.bbs-sidebar-steps li:last-child {
  margin-bottom: 0;
}

.bbs-sidebar-steps strong {
  font-weight: 600;
}

/* Leak check — panels */
.bbs-leak-strip {
  border-color: rgba(94, 226, 255, 0.25);
  background: linear-gradient(90deg, rgba(94, 226, 255, 0.06), transparent);
}

.bbs-leak-strip-icon {
  flex-shrink: 0;
  font-size: 1.35rem;
  line-height: 1;
  color: var(--bbs-primary);
  text-shadow: 0 0 14px var(--bbs-glow-primary);
}

.bbs-leak-input {
  min-height: 3rem;
  font-size: 1rem;
}

.bbs-section-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--bbs-text-muted);
}

.bbs-leak-hit {
  padding: 1rem 1.1rem;
  border-radius: 0.55rem;
  border: 1px solid var(--bbs-border);
  background: var(--bbs-bg-soft);
}

.bbs-leak-hit-pre {
  margin: 0.5rem 0 0;
  font-size: 0.82rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--bbs-text);
}

.bbs-leak-alert {
  padding: 0.85rem 1rem;
  border-radius: 0.5rem;
  border: 1px solid rgba(255, 107, 129, 0.35);
  background: rgba(255, 107, 129, 0.06);
}

/* Post — download policy badges */
.bbs-dl-policy-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: 0.4rem;
  border: 1px solid var(--bbs-border);
  max-width: 100%;
}

.bbs-dl-policy-badge--public {
  color: var(--bbs-success);
  border-color: rgba(94, 234, 212, 0.45);
  background: rgba(94, 234, 212, 0.09);
}

.bbs-dl-policy-badge--login {
  color: var(--bbs-primary);
  border-color: rgba(94, 226, 255, 0.45);
  background: rgba(94, 226, 255, 0.12);
}

.bbs-dl-policy-badge--reply {
  color: var(--bbs-accent);
  border-color: rgba(255, 77, 171, 0.45);
  background: rgba(255, 77, 171, 0.12);
}

.bbs-publish-flow {
  padding-left: 1.15rem;
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.75;
  color: var(--bbs-text-muted);
}

.bbs-publish-flow li {
  margin-bottom: 0.65rem;
}

.bbs-publish-flow li:last-child {
  margin-bottom: 0;
}

.bbs-dl-author-panel {
  border-color: rgba(94, 226, 255, 0.28);
  background: linear-gradient(165deg, rgba(94, 226, 255, 0.07), var(--bbs-surface));
}

.bbs-dl-author-badge {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0.22rem 0.55rem;
  border-radius: 0.35rem;
  background: rgba(94, 226, 255, 0.12);
  color: var(--bbs-primary);
  border: 1px solid rgba(94, 226, 255, 0.38);
}

.bbs-dl-steps {
  padding-left: 1.25rem;
  margin: 0;
}

.bbs-compose-dl-row .dl-remove {
  white-space: nowrap;
}

.bbs-scroll-anchor {
  scroll-margin-top: calc(var(--bbs-nav-h) + 1rem);
}

#section-downloads {
  scroll-margin-top: calc(var(--bbs-nav-h) + 0.75rem);
}

/* Profile avatar (default image lives under /static/img/) */
.bbs-profile-avatar {
  object-fit: cover;
  background: var(--bbs-surface-2);
  border: 1px solid var(--bbs-border-strong);
  box-shadow: 0 0 0 1px rgba(94, 226, 255, 0.12);
}

/* Post detail: left = avatar + pseudonym under avatar; right = meta + title + body */
.bbs-post-head-layout {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  column-gap: 1.5rem;
  align-items: start;
}

.bbs-post-head-aside {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 0.25rem 1rem 0.25rem 0;
  border-right: 1px solid var(--bbs-border-strong);
}

.bbs-post-author-handle {
  width: 100%;
  max-width: 132px;
  line-height: 1.35;
}

.bbs-post-author-handle .bbs-post-author-display {
  word-break: break-word;
}

.bbs-post-head-main {
  min-width: 0;
  padding-top: 0.15rem;
}

.bbs-avatar-post {
  width: 96px;
  height: 96px;
}

@media (max-width: 575.98px) {
  .bbs-post-head-layout {
    grid-template-columns: 1fr;
    row-gap: 1rem;
  }

  .bbs-post-head-aside {
    padding: 0 0 1rem;
    border-right: none;
    border-bottom: 1px solid var(--bbs-border-strong);
  }

  .bbs-post-head-main {
    padding-top: 0;
  }

  .bbs-avatar-post {
    width: 88px;
    height: 88px;
  }
}

.bbs-avatar-sm {
  width: 40px;
  height: 40px;
}

.bbs-comment-head .bbs-comment-author {
  font-size: 0.92rem;
}
