/* Tiên Nghịch — Dark Cultivation Theme, Zero External Dependencies */
:root {
  --bg: #0a0e14;
  --bg2: #121820;
  --card: #151d28;
  --card-hover: #1c2737;
  --line: #222e3f;
  --text: #e6e9ee;
  --muted: #9aa7b8;
  --gold: #d4a94e;
  --gold2: #f0c96a;
  --gold-glow: rgba(240, 201, 106, 0.15);
  --red: #e06c5a;
  --teal: #6fc3b8;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--gold2);
  text-decoration: none;
  transition: color 0.2s ease, text-shadow 0.2s ease;
}
a:hover {
  text-decoration: underline;
  text-shadow: 0 0 10px var(--gold-glow);
}

/* Header & Navigation */
header.top {
  border-bottom: 1px solid var(--line);
  background: var(--bg2);
  padding: 14px 20px;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
}
header.top nav {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}
header.top .brand {
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--gold2);
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  gap: 8px;
}
header.top .brand span.sub {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--line);
}
header.top nav a {
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 500;
  padding: 4px 0;
  transition: all 0.2s ease;
}
header.top nav a:hover {
  color: var(--gold2);
  text-decoration: none;
}
header.top nav a.active {
  color: var(--gold2);
  font-weight: 700;
  border-bottom: 2px solid var(--gold);
}

/* Main Container */
main {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 20px 80px;
}

/* Hero Section */
.hero {
  padding: 38px 30px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(160deg, #182333 0%, #0d121a 75%);
  box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.5);
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, var(--gold-glow) 0%, transparent 70%);
  pointer-events: none;
}
.hero h1 {
  margin: 0 0 10px;
  font-size: 2.2rem;
  color: var(--gold2);
  font-weight: 800;
  letter-spacing: -0.5px;
}
.hero p.lead {
  font-size: 1.12rem;
  color: #d8e2ec;
  margin-bottom: 12px;
  line-height: 1.6;
}
.hero p {
  margin: 0;
  color: var(--muted);
  font-size: 0.98rem;
}

/* Headings */
h1 { font-size: 1.85rem; color: var(--gold2); margin: 0 0 16px; }
h2 {
  color: var(--gold);
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
  margin-top: 36px;
  margin-bottom: 18px;
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
h3 { color: #e8c87e; margin-top: 24px; font-size: 1.15rem; }

/* Category Card Grid */
.cardgrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin: 20px 0;
}
.card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 20px;
  color: var(--text);
  transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
  text-decoration: none;
  min-height: 90px;
}
.card:hover {
  background: var(--card-hover);
  border-color: var(--gold);
  transform: translateY(-2px);
  box-shadow: 0 10px 25px -10px var(--gold-glow);
  text-decoration: none;
}
.card .card-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.card .card-icon {
  font-size: 1.4rem;
}
.card b {
  font-size: 1.1rem;
  color: var(--gold2);
  font-weight: 700;
}
.card span {
  color: var(--muted);
  font-size: 0.88rem;
  margin-top: 8px;
}

/* Search Box & Results */
.search-wrapper {
  margin: 20px 0 10px;
}
.searchbox {
  width: 100%;
  padding: 14px 18px;
  font-size: 1.05rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.searchbox:focus {
  border-color: var(--gold);
  box-shadow: 0 0 15px var(--gold-glow);
}
#results-container {
  display: none;
  max-height: 380px;
  overflow-y: auto;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 16px;
  margin: 12px 0 20px;
  box-shadow: 0 15px 35px rgba(0,0,0,0.4);
}
#results {
  list-style: none;
  padding: 0;
  margin: 0;
}
#results li {
  border-bottom: 1px solid var(--line);
  padding: 12px 4px;
}
#results li:last-child {
  border-bottom: none;
}
#results li a {
  font-weight: 600;
  font-size: 1.05rem;
}
#results li small {
  color: var(--muted);
  display: block;
  margin-top: 4px;
  line-height: 1.5;
}
.badge-cat {
  display: inline-block;
  padding: 2px 8px;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: 4px;
  background: rgba(212, 169, 78, 0.15);
  color: var(--gold2);
  border: 1px solid rgba(212, 169, 78, 0.3);
}
.no-result {
  color: var(--muted);
  padding: 14px 4px;
  text-align: center;
}

/* Warnings and Notes */
.warn {
  background: #251714;
  border: 1px solid #5a2e24;
  color: #f2b8a6;
  border-radius: 12px;
  padding: 14px 18px;
  margin: 20px 0;
  font-size: 0.95rem;
}
.note {
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 20px;
  color: #cfd8e3;
  margin: 18px 0;
  font-size: 0.98rem;
  line-height: 1.7;
}
.note.gold-box {
  border-color: rgba(212, 169, 78, 0.35);
  background: linear-gradient(160deg, #18202c 0%, #111722 100%);
}
.note.gold-box b.title {
  display: block;
  color: var(--gold2);
  font-size: 1.1rem;
  margin-bottom: 6px;
}

/* Article List in Category & Home */
ul.list {
  list-style: none;
  padding: 0;
  margin: 16px 0;
}
ul.list li {
  border-bottom: 1px solid var(--line);
  padding: 14px 4px;
  transition: background 0.2s ease;
}
ul.list li:hover {
  background: rgba(255, 255, 255, 0.02);
}
ul.list li a {
  font-size: 1.1rem;
  font-weight: 600;
}
ul.list li small {
  color: var(--muted);
  display: block;
  margin-top: 5px;
  line-height: 1.55;
  font-size: 0.92rem;
}

/* Featured Articles Grid on Homepage */
.featured-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin: 20px 0;
}
.featured-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
  text-decoration: none;
  transition: all 0.25s ease;
}
.featured-card:hover {
  border-color: var(--gold);
  transform: translateY(-2px);
  box-shadow: 0 10px 25px -10px var(--gold-glow);
  text-decoration: none;
}
.featured-card-title {
  color: var(--gold2);
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 8px;
}
.featured-card-desc {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.55;
  flex-grow: 1;
  margin-bottom: 12px;
}
.featured-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--gold);
  padding-top: 10px;
  border-top: 1px solid rgba(255,255,255,0.05);
}

/* Article Page Layout */
article p { margin: 0 0 16px; line-height: 1.8; }
article blockquote {
  border-left: 3px solid var(--gold);
  margin: 20px 0;
  padding: 8px 18px;
  color: #cfd8e3;
  background: var(--bg2);
  border-radius: 0 8px 8px 0;
}
article code {
  background: #1e2836;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
}
article ul {
  padding-left: 24px;
  margin-bottom: 20px;
}
article ul li {
  margin-bottom: 8px;
}

/* Footer & Breadcrumbs */
footer {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
  padding: 30px 20px;
  text-align: center;
  line-height: 1.6;
}
.breadcrumb {
  color: var(--muted);
  font-size: 0.92rem;
  margin-bottom: 12px;
}

/* Responsive */
@media (max-width: 640px) {
  header.top { padding: 12px 16px; }
  header.top nav { gap: 10px; }
  header.top .brand { width: 100%; margin-bottom: 4px; }
  main { padding: 20px 16px 60px; }
  .hero { padding: 26px 20px; }
  .hero h1 { font-size: 1.7rem; }
  .cardgrid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .featured-grid { grid-template-columns: 1fr; }
}
@media (max-width: 400px) {
  .cardgrid { grid-template-columns: 1fr; }
}
