/* vix::forum — 主题风格参考 vix-lang.org（assets/site.css） */
:root {
  --bg: #353b45;
  --bg-alt: #3e4652;
  --gray-dark: #282c33;
  --code-bg: #282c34;
  --code-border: #3e4452;
  --border: #5c6678;
  --text: #f5f5f5;
  --muted: #cccccc;
  --accent: #e67e22;
  --accent-hover: #d35400;
  --accent-light: #ffd6c2;
  --danger: #e06c75;
  --radius: 8px;
  --mono: "Iosevka", "Cascadia Code", "JetBrains Mono", Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

/* ---------- nav (liquid glass) ---------- */
.nav { position: sticky; top: 0; z-index: 10; background: rgba(40, 44, 51, 0.55); backdrop-filter: blur(20px) saturate(1.4); -webkit-backdrop-filter: blur(20px) saturate(1.4); border-bottom: 1px solid rgba(92, 102, 120, 0.45); }
.nav-inner { display: flex; align-items: center; gap: 28px; height: 62px; }
.logo { font-weight: 700; font-size: 1.35rem; color: var(--text); text-decoration: none; }
.logo b { color: var(--accent); font-family: var(--mono); }
.logo:hover { color: var(--accent-light); }
.nav-links { display: flex; gap: 22px; flex: 1; }
.nav-links a { color: var(--muted); text-decoration: none; font-size: 14px; padding: 4px 0; }
.nav-links a:hover { color: var(--text); }
.nav-links a.active { color: var(--accent); border-bottom: 2px solid var(--accent); }
.nav-user { display: flex; gap: 10px; align-items: center; }

/* ---------- buttons (liquid glass) ---------- */
.btn { display: inline-block; padding: 8px 18px; border-radius: 6px; border: 2px solid rgba(92, 102, 120, 0.6); background: rgba(62, 70, 82, 0.35); backdrop-filter: blur(10px) saturate(1.3); -webkit-backdrop-filter: blur(10px) saturate(1.3); color: var(--text); font-size: 14px; font-weight: 500; text-decoration: none; cursor: pointer; transition: all 0.15s; }
.btn:hover { border-color: var(--accent); color: var(--accent-light); background: rgba(230, 126, 34, 0.12); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; backdrop-filter: none; }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.btn.ghost { border-color: var(--border); }
.btn.block { display: block; width: 100%; text-align: center; }
.btn.danger:hover { border-color: var(--danger); color: var(--danger); }

/* ---------- cards (liquid glass) ---------- */
.card {
  position: relative;
  overflow: hidden;
  background: rgba(62, 70, 82, 0.5);
  backdrop-filter: blur(22px) saturate(1.35);
  -webkit-backdrop-filter: blur(22px) saturate(1.35);
  border: 1px solid rgba(92, 102, 120, 0.45);
  border-radius: var(--radius);
  padding: 20px;
}
.card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  filter: url(#glass-distortion);
  pointer-events: none;
  z-index: 0;
}
.card > * { position: relative; z-index: 1; }
.card:hover { border-color: rgba(118, 130, 153, 0.75); }

/* ---------- hero (collapse on scroll) ---------- */
.hero { padding: 56px 0; text-align: left; overflow: hidden; perspective: 1200px; max-height: 660px; transition: max-height 0.55s ease, padding 0.55s ease; }
.hero.collapse { max-height: 0; padding: 0; }
.hero-inner { display: grid; grid-template-columns: 1fr auto; gap: 48px; align-items: center; }
.hero h1 { font-size: 2.9rem; font-weight: 800; letter-spacing: -1px; }
.hero h1 em { font-style: normal; color: var(--accent); font-family: var(--mono); }
.hero p { color: var(--muted); margin-top: 14px; font-size: 1.05rem; }
.hero-actions { display: flex; gap: 14px; margin-top: 26px; flex-wrap: wrap; }
.hero-left, .hero-right { transform-style: preserve-3d; transition: transform 0.55s ease, opacity 0.45s ease; will-change: transform, opacity; }
.hero.collapse .hero-left { transform: translate(-14vw, -30vh) rotateX(90deg); opacity: 0; }
.hero.collapse .hero-right { transform: translate(14vw, -30vh) rotateX(90deg); opacity: 0; }

/* ---------- code window (vix-lang.org style) ---------- */
.code-window { display: inline-block; min-width: min(680px, 100%); margin-top: 32px; background: var(--code-bg); border: 1px solid var(--code-border); border-radius: 8px; overflow: hidden; text-align: left; box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45); }
.code-tabs { display: flex; gap: 4px; padding: 8px 10px 0; background: #21252b; border-bottom: 1px solid var(--code-border); }
.code-tab { font-family: var(--mono); font-size: 12px; color: #abb2bf; padding: 6px 16px; border-radius: 6px 6px 0 0; background: var(--code-bg); }
.code-body { padding: 22px 26px; font-family: var(--mono); font-size: 14px; line-height: 1.75; color: #abb2bf; overflow-x: auto; white-space: pre; }
.code-body .kw { color: #c678dd; }
.code-body .typ { color: #e5c07b; }
.code-body .str { color: #98c379; }
.code-body .fn { color: #61afef; }
.code-body .num { color: #d19a66; }
.code-body .com { color: #5c6370; }
.code-body .op { color: #56b6c2; }

/* ---------- layout / sidebar / categories ---------- */
.layout { display: grid; grid-template-columns: 200px 1fr; gap: 28px; align-items: start; padding-bottom: 8px; }
.sidebar { position: sticky; top: 78px; background: rgba(62, 70, 82, 0.35); backdrop-filter: blur(16px) saturate(1.3); -webkit-backdrop-filter: blur(16px) saturate(1.3); border: 1px solid rgba(92, 102, 120, 0.4); border-radius: var(--radius); padding: 10px; }
.cat-list { display: flex; flex-direction: column; gap: 4px; }
.cat-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 6px; cursor: pointer; border-left: 3px solid transparent; color: var(--muted); font-size: 14px; user-select: none; }
.cat-item .dot { width: 10px; height: 10px; border-radius: 3px; background: var(--cat-color, var(--accent)); flex-shrink: 0; }
.cat-item .cnt { margin-left: auto; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.cat-item:hover { background: var(--gray-dark); color: var(--text); }
.cat-item.active { background: var(--gray-dark); color: var(--text); border-left-color: var(--cat-color, var(--accent)); }
.cat-全部 { --cat-color: #abb2bf; }
.cat-语法 { --cat-color: #61afef; }
.cat-工具链 { --cat-color: #98c379; }
.cat-编译器 { --cat-color: #e5c07b; }
.cat-示例 { --cat-color: #56b6c2; }
.cat-生态 { --cat-color: #c678dd; }
.cat-底层 { --cat-color: #e06c75; }
.cat-新手 { --cat-color: #d19a66; }

/* ---------- mobile menu ---------- */
.menu-btn { display: none; background: none; border: 1px solid var(--border); color: var(--text); border-radius: 6px; padding: 5px 12px; font-size: 16px; cursor: pointer; line-height: 1.4; }
.menu-btn:hover { border-color: var(--accent); color: var(--accent-light); }
.mobile-menu { display: none; }
@media (max-width: 768px) {
  .hero { display: none; }
  .layout { display: block; }
  .sidebar { display: none; }
  .menu-btn { display: inline-block; }
  .mobile-menu.open { display: block; position: fixed; top: 66px; right: 12px; z-index: 30; width: 200px; background: rgba(62, 70, 82, 0.7); backdrop-filter: blur(20px) saturate(1.35); -webkit-backdrop-filter: blur(20px) saturate(1.35); border: 1px solid rgba(92, 102, 120, 0.5); border-radius: 8px; padding: 8px; box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45); }
  /* 移动端性能：关闭卡片液体扭曲层 */
  .card::after { filter: none; }
}

/* ---------- page head ---------- */
.page-head { display: flex; align-items: center; gap: 16px; padding: 34px 0 18px; }
.page-head h2 { font-size: 1.6rem; font-weight: 700; flex: 1; }
.search { flex: 1; max-width: 320px; background: rgba(40, 44, 51, 0.5); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid var(--border); color: var(--text); padding: 9px 14px; border-radius: 6px; font-size: 14px; outline: none; font-family: var(--sans); }
.search:focus { border-color: var(--accent); }

/* ---------- post modal + toast ---------- */
.modal-mask { position: fixed; inset: 0; z-index: 100; display: none; align-items: flex-start; justify-content: center; padding: 10vh 16px 16px; background: rgba(0, 0, 0, 0.55); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.modal { width: 100%; max-width: 640px; }
.toast { position: fixed; left: 50%; bottom: 30px; z-index: 200; transform: translateX(-50%) translateY(16px); padding: 10px 20px; border-radius: 8px; background: rgba(40, 44, 52, 0.85); backdrop-filter: blur(12px) saturate(1.3); -webkit-backdrop-filter: blur(12px) saturate(1.3); border: 1px solid rgba(92, 102, 120, 0.5); color: var(--text); font-size: 14px; opacity: 0; pointer-events: none; transition: opacity 0.25s, transform 0.25s; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- posts ---------- */
.post { display: block; text-decoration: none; color: inherit; margin-bottom: 14px; transition: transform 0.15s, border-color 0.15s; }
.post:hover { transform: translateY(-2px); border-color: var(--accent); }
.post-top { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.tag { font-size: 12px; color: var(--accent); border: 1px solid rgba(230, 126, 34, 0.5); padding: 2px 10px; border-radius: 999px; font-family: var(--mono); }
.post h3 { font-size: 17px; font-weight: 600; margin-bottom: 8px; }
.post h3:hover { color: var(--accent-light); }
.post-meta { display: flex; gap: 16px; font-size: 13px; color: var(--muted); }
.post-meta .author { font-family: var(--mono); color: var(--accent); }
.reply-count { margin-left: auto; font-family: var(--mono); }
.num { color: var(--muted); font-family: var(--mono); font-size: 13px; font-weight: 400; margin-right: 6px; }
.ref { color: var(--accent); text-decoration: none; font-family: var(--mono); }
.ref:hover { color: var(--accent-light); text-decoration: underline; }

/* ---------- pagination ---------- */
.pager { display: none; align-items: center; justify-content: center; gap: 12px; padding: 18px 0 40px; }
.pager .page-jump { width: 76px; max-width: 76px; text-align: center; }
.pager .btn:disabled { opacity: 0.4; cursor: default; }
.pager .btn:disabled:hover { border-color: var(--border); color: var(--text); background: rgba(62, 70, 82, 0.35); }

/* ---------- forms ---------- */
.auth-wrap { flex: 1; display: flex; align-items: center; justify-content: center; padding: 48px 0; }
.auth-card { width: min(400px, 92vw); }
.auth-card h2 { font-size: 1.5rem; margin-bottom: 4px; }
.auth-card .sub { color: var(--muted); font-size: 14px; margin-bottom: 24px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input { width: 100%; background: rgba(40, 44, 51, 0.5); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid var(--border); color: var(--text); padding: 10px 14px; border-radius: 6px; font-size: 14px; outline: none; font-family: var(--sans); }
.field input:focus { border-color: var(--accent); }
.field input.mono { font-family: var(--mono); }
.hint { font-size: 12px; color: var(--muted); margin-top: 6px; }
.alert { display: none; padding: 10px 14px; border-radius: 6px; font-size: 14px; margin-bottom: 16px; }
.alert.show { display: block; }
.alert.error { background: rgba(224, 108, 117, 0.12); border: 1px solid rgba(224, 108, 117, 0.5); color: var(--danger); }
.alert.ok { background: rgba(152, 195, 121, 0.12); border: 1px solid rgba(152, 195, 121, 0.5); color: #98c379; }
.auth-foot { margin-top: 18px; text-align: center; font-size: 14px; color: var(--muted); }
.auth-foot a { color: var(--accent); text-decoration: none; }
.steps { display: flex; gap: 8px; margin-bottom: 20px; }
.step { flex: 1; height: 3px; border-radius: 2px; background: var(--border); }
.step.on { background: var(--accent); }

/* ---------- profile ---------- */
.profile-grid { display: grid; grid-template-columns: 220px 1fr; gap: 20px; padding-bottom: 48px; }
.avatar { width: 110px; height: 110px; border-radius: 50%; background: var(--accent); color: #fff; font-family: var(--mono); font-size: 44px; font-weight: 700; display: flex; align-items: center; justify-content: center; margin: 0 auto 16px; }
.avatar-card { text-align: center; }
.avatar-card .pname { font-family: var(--mono); font-weight: 700; font-size: 18px; }
.avatar-card .prole { color: var(--muted); font-size: 13px; margin-top: 4px; }
.info-row { display: flex; justify-content: space-between; padding: 14px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.info-row:last-child { border-bottom: none; }
.info-row .k { color: var(--muted); }
.info-row .v { font-family: var(--mono); }

/* ---------- post detail ---------- */
.post-body { white-space: pre-wrap; font-size: 15px; color: var(--text); margin-top: 16px; padding: 18px; background: var(--code-bg); border: 1px solid var(--code-border); border-radius: 8px; font-family: var(--mono); }
.reply { display: flex; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--border); }
.reply:last-child { border-bottom: none; }
.reply-ava { width: 38px; height: 38px; border-radius: 50%; background: rgba(40, 44, 51, 0.55); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); color: var(--accent); font-family: var(--mono); display: flex; align-items: center; justify-content: center; flex-shrink: 0; border: 1px solid rgba(92, 102, 120, 0.5); }
.reply .rhead { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.reply .rhead .author { color: var(--accent); font-family: var(--mono); }
.reply .rbody { font-size: 14px; }
textarea.reply-input { width: 100%; background: rgba(40, 44, 51, 0.5); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid var(--border); color: var(--text); padding: 12px 14px; border-radius: 6px; font-size: 14px; resize: vertical; min-height: 90px; outline: none; font-family: var(--sans); }
textarea.reply-input:focus { border-color: var(--accent); }

/* ---------- footer ---------- */
.footer { margin-top: auto; border-top: 1px solid var(--border); padding: 26px 0; text-align: center; color: var(--muted); font-size: 13px; font-family: var(--mono); }
.footer a { color: var(--accent); text-decoration: none; }

.hidden { display: none !important; }

/* ---------- admin ---------- */
.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 20px; }
.stat { text-align: center; }
.stat .num { font-family: var(--mono); font-size: 34px; font-weight: 700; color: var(--accent); }
.stat .lbl { color: var(--muted); font-size: 13px; margin-top: 4px; }
.section { margin-bottom: 20px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--muted); font-weight: 500; font-size: 13px; }
td.mono { font-family: var(--mono); }
td.ops { text-align: right; }
td.ops .btn { margin-left: 6px; padding: 4px 10px; font-size: 13px; }
.muted { color: var(--muted); }
