/* ===== TongBlog Dark Theme - inspired by lizhinb.com ===== */
:root {
  --bg: #0a0a0a;
  --bg-elevated: #111111;
  --surface: rgba(255,255,255,0.035);
  --surface-hover: rgba(255,255,255,0.065);
  --border: rgba(255,255,255,0.08);
  --border-hover: rgba(255,255,255,0.16);
  --text: #f5f5f5;
  --text-secondary: rgba(255,255,255,0.55);
  --text-tertiary: rgba(255,255,255,0.32);
  --accent: #d6aa57;
  --accent-hover: #edc878;
  --nav-active: #e33b3f;
  --link: #60a5fa;
  --radius: 16px;
  --radius-sm: 10px;
  --nav-h: 56px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "SF Pro Text", "Helvetica Neue", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

* { margin:0; padding:0; box-sizing:border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }
input, textarea { font-family: inherit; }

/* ===== Top Navigation ===== */
.tb-nav {
  position: sticky; top: 0; z-index: 999;
  background: rgba(17,17,17,0.92);
  backdrop-filter: blur(12px) saturate(1.8);
  -webkit-backdrop-filter: blur(12px) saturate(1.8);
  border-bottom: 1px solid var(--border);
  height: var(--nav-h);
}
.tb-nav-inner {
  max-width: 960px; margin: 0 auto;
  padding: 0 20px; height: 100%;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
}
.tb-nav-logo {
  font-size: 18px; font-weight: 800; color: var(--text);
  text-decoration: none !important; letter-spacing: -0.02em;
  display: flex; align-items: center; gap: 8px; flex-shrink: 0;
}
.tb-nav-logo svg { width: 26px; height: 26px; }
.tb-nav-items {
  display: flex; align-items: center; gap: 4px;
  overflow-x: auto; scrollbar-width: none;
}
.tb-nav-items::-webkit-scrollbar { display: none; }
.tb-nav-item {
  padding: 7px 16px; border-radius: 999px;
  font-size: 14px; font-weight: 600; color: var(--text-secondary);
  text-decoration: none !important; white-space: nowrap;
  transition: all 0.2s;
}
.tb-nav-item:hover { color: var(--text); background: var(--surface-hover); }
.tb-nav-item.active { color: var(--nav-active); background: rgba(227,59,63,0.08); }
.tb-nav-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.tb-nav-icon-btn {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s; text-decoration: none !important;
}
.tb-nav-icon-btn:hover { color: var(--text); background: var(--surface-hover); border-color: var(--border-hover); }
.tb-nav-icon-btn svg { width: 18px; height: 18px; }

/* ===== Container ===== */
.tb-container { max-width: 960px; margin: 0 auto; padding: 0 20px; }

/* ===== Hero ===== */
.tb-hero {
  position: relative;
  padding: 56px 0 44px;
  text-align: center;
  overflow: hidden;
}
.tb-hero::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(214,170,87,0.06), transparent 60%);
  pointer-events: none;
}
.tb-hero h1 {
  font-size: 34px; font-weight: 800; letter-spacing: -0.03em;
  position: relative;
}
.tb-hero p {
  margin-top: 8px; font-size: 15px; color: var(--text-secondary);
  position: relative;
}

/* ===== Home Nav Cards (2-col grid like lizhinb) ===== */
.tb-home-nav {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 10px; margin: 0 auto 36px;
}
.tb-nav-card {
  position: relative; display: flex; align-items: center; gap: 12px;
  min-height: 72px; padding: 12px 14px;
  border-radius: var(--radius); text-decoration: none !important;
  color: #fff !important; overflow: hidden;
  background: linear-gradient(135deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02) 50%, rgba(214,170,87,0.03));
  border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.04);
  transition: transform 0.22s ease, border-color 0.22s ease, background 0.22s ease, box-shadow 0.22s ease;
}
.tb-nav-card::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.04), transparent 40%);
  pointer-events: none;
}
.tb-nav-card:hover {
  transform: translateY(-2px);
  border-color: rgba(214,170,87,0.3);
  background: linear-gradient(135deg, rgba(255,255,255,0.08), rgba(255,255,255,0.025) 50%, rgba(214,170,87,0.05));
  box-shadow: 0 14px 32px rgba(0,0,0,0.32), inset 0 1px 0 rgba(255,255,255,0.06);
}
.tb-nav-card-glow {
  position: absolute; left: -30px; bottom: -40px;
  width: 120px; height: 100px;
  background: radial-gradient(circle, rgba(214,170,87,0.15), transparent 66%);
  opacity: 0.7; pointer-events: none;
}
.tb-nav-card-icon {
  position: relative; z-index: 1; flex: 0 0 38px; width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 24%, rgba(255,255,255,0.14), rgba(255,255,255,0.04));
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), 0 4px 12px rgba(0,0,0,0.18);
  color: var(--accent);
}
.tb-nav-card-icon svg { width: 20px; height: 20px; stroke: currentColor; stroke-width: 1.8; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.tb-nav-card-text { position: relative; z-index: 1; display: flex; flex-direction: column; min-width: 0; flex: 1; }
.tb-nav-card-text strong { font-size: 17px; line-height: 1.2; font-weight: 800; letter-spacing: -0.02em; color: #f5f5f5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-nav-card-text em { margin-top: 3px; font-style: normal; font-size: 12px; line-height: 1.3; color: rgba(255,255,255,0.4); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-nav-card-arrow { position: relative; z-index: 1; flex: 0 0 14px; color: var(--accent); font-size: 18px; opacity: 0.85; transition: transform 0.22s; }
.tb-nav-card:hover .tb-nav-card-arrow { transform: translateX(3px); opacity: 1; }

/* ===== Section Title ===== */
.tb-section-title {
  font-size: 18px; font-weight: 700; margin-bottom: 16px;
  display: flex; align-items: center; gap: 8px;
}
.tb-section-title::before {
  content: ""; width: 3px; height: 18px; border-radius: 2px;
  background: var(--accent);
}

/* ===== Post Cards ===== */
.tb-post-list { display: flex; flex-direction: column; gap: 12px; padding-bottom: 60px; }
.tb-post-card {
  display: block; padding: 20px 22px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all 0.22s ease; text-decoration: none !important;
  color: var(--text) !important;
}
.tb-post-card:hover {
  background: var(--surface-hover); border-color: var(--border-hover);
  transform: translateY(-1px);
}
.tb-post-meta { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.tb-post-cat {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
  background: rgba(214,170,87,0.1); color: var(--accent);
  border: 1px solid rgba(214,170,87,0.15);
}
.tb-post-date { font-size: 13px; color: var(--text-tertiary); }
.tb-post-pin {
  padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: rgba(227,59,63,0.1); color: var(--nav-active);
  border: 1px solid rgba(227,59,63,0.15);
}
.tb-post-title { font-size: 18px; font-weight: 700; margin-bottom: 6px; letter-spacing: -0.01em; }
.tb-post-excerpt { font-size: 14px; color: var(--text-secondary); line-height: 1.7; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ===== Category Pills ===== */
.tb-cats { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 28px; }
.tb-cat-pill {
  padding: 7px 16px; border-radius: 999px; font-size: 13px; font-weight: 600;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-secondary); text-decoration: none !important;
  transition: all 0.2s; white-space: nowrap;
}
.tb-cat-pill:hover { color: var(--text); background: var(--surface-hover); border-color: var(--border-hover); }
.tb-cat-pill.active { color: var(--accent); background: rgba(214,170,87,0.08); border-color: rgba(214,170,87,0.25); }

/* ===== Footer ===== */
.tb-footer {
  text-align: center; padding: 32px 0; color: var(--text-tertiary);
  font-size: 13px; border-top: 1px solid var(--border);
}

/* ===== Empty State ===== */
.tb-empty { text-align: center; padding: 60px 0; color: var(--text-tertiary); }
.tb-empty-icon { font-size: 44px; margin-bottom: 12px; opacity: 0.5; }

/* ===== Article Page ===== */
.tb-article {
  max-width: 760px; margin: 32px auto; padding: 36px 40px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius);
}
.tb-article-header { margin-bottom: 28px; }
.tb-article-title { font-size: 30px; font-weight: 800; line-height: 1.3; letter-spacing: -0.02em; margin-bottom: 12px; }
.tb-article-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--text-tertiary); }
.tb-article-cover { width: 100%; max-height: 380px; object-fit: cover; border-radius: var(--radius-sm); margin-bottom: 24px; }
.tb-article-content { font-size: 16px; line-height: 1.9; color: rgba(255,255,255,0.82); }
.tb-article-content p { margin-bottom: 16px; }
.tb-article-content img { max-width: 100%; border-radius: var(--radius-sm); margin: 12px 0; }
.tb-article-content a { color: var(--link); }
.tb-article-content h1, .tb-article-content h2, .tb-article-content h3 { margin: 24px 0 12px; color: var(--text); }
.tb-article-content h2 { font-size: 22px; }
.tb-article-content h3 { font-size: 18px; }
.tb-article-content blockquote {
  border-left: 3px solid var(--accent); padding: 8px 16px; margin: 16px 0;
  color: var(--text-secondary); background: rgba(214,170,87,0.04); border-radius: 0 8px 8px 0;
}
.tb-article-content code {
  background: rgba(255,255,255,0.08); padding: 2px 7px; border-radius: 5px;
  font-size: 14px; font-family: "SF Mono", Menlo, Consolas, monospace;
}
.tb-article-content pre {
  background: #0d0d0d; border: 1px solid var(--border); padding: 18px;
  border-radius: var(--radius-sm); overflow-x: auto; margin: 16px 0;
}
.tb-article-content pre code { background: none; padding: 0; }
.tb-article-content ul, .tb-article-content ol { margin: 12px 0; padding-left: 24px; }
.tb-article-content li { margin-bottom: 6px; }
.tb-article-content video, .tb-article-content audio { max-width: 100%; border-radius: var(--radius-sm); margin: 12px 0; }

/* ===== Audio Player in Article ===== */
.tb-audio-player {
  display: flex; align-items: center; gap: 14px;
  background: rgba(255,255,255,0.04); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px; margin: 16px 0;
}
.tb-audio-cover { width: 56px; height: 56px; flex-shrink: 0; border-radius: 8px; overflow: hidden; background: var(--bg-elevated); }
.tb-audio-cover img { width: 100%; height: 100%; object-fit: cover; }
.tb-audio-info { flex: 1; min-width: 0; }
.tb-audio-title { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.tb-audio-artist { font-size: 13px; color: var(--text-tertiary); }
.tb-audio-controls { flex-shrink: 0; }
.tb-audio-controls audio { height: 38px; border-radius: 8px; filter: invert(0.92) hue-rotate(180deg); }

/* ===== Search Page ===== */
.tb-search-box {
  display: flex; gap: 10px; max-width: 560px; margin: 40px auto 0;
}
.tb-search-box input {
  flex: 1; padding: 12px 18px; font-size: 15px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; color: var(--text); outline: none;
  transition: border-color 0.2s;
}
.tb-search-box input:focus { border-color: var(--accent); }
.tb-search-box input::placeholder { color: var(--text-tertiary); }
.tb-search-box button {
  padding: 12px 24px; border: none; border-radius: 999px;
  background: var(--accent); color: #0a0a0a; font-size: 15px; font-weight: 700;
  transition: all 0.2s;
}
.tb-search-box button:hover { background: var(--accent-hover); }
.tb-search-count { text-align: center; margin: 20px 0; color: var(--text-tertiary); font-size: 14px; }

/* ===== Pagination ===== */
.tb-pagination { display: flex; justify-content: center; gap: 8px; margin-top: 24px; }
.tb-page-btn {
  padding: 8px 16px; border-radius: 8px; font-size: 14px; font-weight: 600;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-secondary); text-decoration: none !important;
  transition: all 0.2s;
}
.tb-page-btn:hover { color: var(--text); background: var(--surface-hover); }
.tb-page-btn.active { color: var(--accent); border-color: rgba(214,170,87,0.3); background: rgba(214,170,87,0.06); }
.tb-page-btn.disabled { opacity: 0.35; pointer-events: none; }

/* ===== Toast ===== */
.tb-toast {
  position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: rgba(20,20,20,0.95); color: #fff; padding: 12px 24px;
  border-radius: 12px; font-size: 14px; font-weight: 500;
  border: 1px solid var(--border); box-shadow: 0 8px 30px rgba(0,0,0,0.4);
  z-index: 9999; opacity: 0; transition: all 0.3s ease;
  pointer-events: none;
}
.tb-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.18); }

/* ===== Responsive ===== */
@media (max-width: 640px) {
  .tb-nav-inner { padding: 0 14px; gap: 10px; }
  .tb-nav-logo span { display: none; }
  .tb-nav-item { padding: 6px 12px; font-size: 13px; }
  .tb-container { padding: 0 14px; }
  .tb-hero { padding: 40px 0 32px; }
  .tb-hero h1 { font-size: 26px; }
  .tb-hero p { font-size: 14px; }
  .tb-home-nav { gap: 8px; }
  .tb-nav-card { min-height: 64px; padding: 10px; gap: 9px; border-radius: 14px; }
  .tb-nav-card-icon { width: 34px; height: 34px; flex-basis: 34px; }
  .tb-nav-card-icon svg { width: 17px; height: 17px; }
  .tb-nav-card-text strong { font-size: 15px; }
  .tb-nav-card-text em { font-size: 11px; }
  .tb-post-card { padding: 16px; }
  .tb-post-title { font-size: 16px; }
  .tb-article { padding: 24px 18px; margin: 16px 0; }
  .tb-article-title { font-size: 23px; }
  .tb-search-box { flex-direction: column; }
}
