/* Giao diện tối kiểu shadcn (neutral dark) — bám layout tangthuvien.org */
:root {
  --background: #0a0a0a;
  --foreground: #fafafa;
  --card: #141414;
  --secondary: #262626;
  --muted-foreground: #a1a1a1;
  --border: rgba(255, 255, 255, 0.1);
  --input: rgba(255, 255, 255, 0.15);
  --star: #facc15;
  --radius: 0.5rem;
  --container: 1280px;
}

*, *::before, *::after { box-sizing: border-box; border: 0 solid var(--border); }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif,
    "Apple Color Emoji", "Segoe UI Emoji";
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; cursor: pointer; padding: 0; }
img { display: block; max-width: 100%; }
svg { flex-shrink: 0; }
h1, h2, h3 { margin: 0; }
ul { list-style: none; margin: 0; padding: 0; }

.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 8px; }
@media (min-width: 768px) { .container { padding: 0 16px; } }
@media (min-width: 1024px) { .container { padding: 0 32px; } }

.muted { color: var(--muted-foreground); }
.line-clamp-2 {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  border-bottom-width: 1px;
  background: rgba(10, 10, 10, 0.75);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.site-header .container { display: flex; align-items: center; gap: 16px; padding-top: 8px; padding-bottom: 8px; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 6px; border-width: 1px; border-color: var(--input);
  background: rgba(255, 255, 255, 0.045);
  transition: background .15s;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.1); }
.icon-btn svg { width: 16px; height: 16px; }
.brand { display: flex; align-items: center; gap: 8px; }
.brand svg { width: 20px; height: 20px; }
.brand span { font-size: 18px; font-weight: 600; letter-spacing: -0.025em; }
.search { display: none; align-items: center; gap: 8px; flex: 1; max-width: 240px; padding-left: 8px; }
.search svg { width: 16px; height: 16px; color: var(--muted-foreground); }
.search form { width: 100%; }
.search input {
  width: 100%; background: transparent; color: var(--foreground); font-size: 14px; outline: none;
  padding: 0 0 4px; border: 0; border-bottom: 1px solid var(--border); transition: border-color .15s;
}
.search input::placeholder { color: var(--muted-foreground); }
.search input:focus { border-color: rgba(250, 250, 250, 0.6); }
.header-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.nav { display: none; align-items: center; gap: 24px; font-size: 14px; color: var(--muted-foreground); margin-right: 8px; }
.nav a { display: inline-flex; align-items: center; gap: 6px; transition: color .15s; }
.nav a:hover { color: var(--foreground); }
.nav svg { width: 16px; height: 16px; }
.only-mobile { display: inline-flex; }
@media (min-width: 768px) { .search { display: flex; } .only-mobile { display: none; } }
@media (min-width: 1280px) { .nav { display: flex; } }

/* ---------- Layout ---------- */
main { padding: 24px 0; }
@media (min-width: 768px) { main { padding: 32px 0; } }
.grid-12 { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
@media (min-width: 1024px) {
  .grid-12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }
  .col-8 { grid-column: span 8; }
  .col-4 { grid-column: span 4; }
  .col-12 { grid-column: span 12; }
}
/* Mobile: card tràn sát mép như bản gốc (rounded-none) */
@media (max-width: 767px) { main > .container { padding: 0; } }

/* ---------- Card ---------- */
.card {
  display: flex; flex-direction: column; gap: 8px;
  background: var(--card); border-width: 1px; padding: 8px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
@media (min-width: 768px) { .card { border-radius: var(--radius); } }
.card-head { display: flex; align-items: center; justify-content: space-between; border-bottom-width: 1px; padding-bottom: 8px; }
.card-head h2 { font-size: 20px; font-weight: 600; letter-spacing: -0.025em; display: flex; align-items: center; gap: 8px; }
@media (min-width: 768px) { .card-head h2 { font-size: 24px; } }
.card-head h2 .flame { width: 22px; height: 22px; color: #f97316; }
.btn-outline {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; padding: 0 12px; border-radius: 6px; font-size: 14px; font-weight: 500; white-space: nowrap;
  border-width: 1px; border-color: var(--input); background: rgba(255, 255, 255, 0.045);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); transition: background .15s;
}
.btn-outline:hover { background: rgba(255, 255, 255, 0.1); }
.btn-outline svg { width: 16px; height: 16px; }

/* ---------- Bìa truyện ---------- */
.cover { position: relative; aspect-ratio: 3 / 4; width: 100%; overflow: hidden; background: var(--secondary); }
.cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
/* Bìa giả khi chưa có ảnh: nền gradient + tên truyện */
.cover-ph {
  position: absolute; inset: 0; display: flex; align-items: flex-end; padding: 10px;
  font-weight: 700; font-size: 13px; line-height: 1.3; text-transform: uppercase; letter-spacing: .02em;
  color: rgba(255, 255, 255, 0.92); text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}
.cover-ph::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 45%, rgba(0, 0, 0, 0.55));
}
.cover-ph span { position: relative; }
.cover-sm .cover-ph { font-size: 0; padding: 0; }

/* ---------- Truyện HOT (carousel) ---------- */
.carousel { position: relative; }
.rail {
  display: flex; gap: 8px; overflow-x: auto; scroll-behavior: smooth;
  scroll-snap-type: x mandatory; padding-bottom: 8px;
  scrollbar-width: thin; scrollbar-color: #555 #1f1f1f;
}
.rail::-webkit-scrollbar { height: 12px; }
.rail::-webkit-scrollbar-track { background: #1f1f1f; }
.rail::-webkit-scrollbar-thumb { background: #555; border-radius: 6px; border: 3px solid #1f1f1f; }
.rail-item { scroll-snap-align: start; flex-shrink: 0; width: 180px; }
@media (max-width: 767px) { .rail-item { width: 140px; } }
.story-card { overflow: hidden; border-radius: var(--radius); border-width: 1px; background: var(--card); height: 100%; display: flex; flex-direction: column; }
.story-card .body { padding: 12px; }
.story-card .title { font-size: 14px; font-weight: 600; line-height: 1.375; }
.story-card .title:hover, .random-item .title:hover, .rank-item a:hover .rank-title { text-decoration: underline; }
.story-card .meta { padding: 0 12px 12px; margin-top: auto; font-size: 12px; color: var(--muted-foreground); }
.story-card .meta .row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.story-card .meta .row + .row { margin-top: 4px; }
.story-card .meta .row span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.story-card .meta .row span:last-child { white-space: nowrap; }
.story-card .meta .views { display: inline-flex; align-items: center; gap: 4px; }
.story-card .meta svg { width: 12px; height: 12px; }
.hot-badge {
  position: absolute; top: 6px; left: 6px; z-index: 1;
  font-size: 11px; font-weight: 700; line-height: 1; padding: 4px 6px; border-radius: 4px;
  background: #dc2626; color: #fff; letter-spacing: .03em;
}
.rail-btn {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 10;
  display: none; align-items: center; justify-content: center; width: 32px; height: 40px;
  border-radius: 6px; border-width: 1px; background: rgba(10, 10, 10, 0.8); transition: background .15s;
}
.rail-btn:hover { background: rgba(38, 38, 38, 0.9); }
.rail-btn svg { width: 16px; height: 16px; }
.rail-btn.prev { left: 12px; }
.rail-btn.next { right: 12px; }
@media (min-width: 768px) { .rail-btn { display: inline-flex; } }
.rail-btn[hidden] { display: none; }

/* ---------- BXH ---------- */
.tabs { display: flex; align-items: flex-end; gap: 24px; border-bottom-width: 1px; }
.tab { position: relative; padding-bottom: 8px; font-size: 16px; color: var(--muted-foreground); transition: color .15s; }
.tab:hover { color: var(--foreground); }
.tab[aria-selected="true"] { color: var(--foreground); }
.tab[aria-selected="true"]::after {
  content: ""; position: absolute; left: 0; bottom: -1px; width: 100%; height: 3px; border-radius: 4px; background: var(--foreground);
}
.rank-list { padding: 12px 0; display: flex; flex-direction: column; gap: 12px; }
.rank-item { display: flex; align-items: center; gap: 12px; border-radius: 4px; background: rgba(38, 38, 38, 0.5); border-width: 1px; padding-right: 8px; }
.rank-item .cover { width: 60px; flex-shrink: 0; border-radius: 4px; border-width: 1px; }
.rank-item .info { flex: 1; min-width: 0; }
.rank-title { font-size: 16px; line-height: 1.375; }
.rank-meta { margin-top: 4px; display: flex; align-items: center; gap: 16px; font-size: 14px; color: var(--muted-foreground); }
.rank-meta span { display: inline-flex; align-items: center; gap: 4px; }
.rank-meta svg { width: 14px; height: 14px; }
.star { color: var(--star); }
.star svg { fill: currentColor; }

/* ---------- Truyện ngẫu nhiên (full width) ---------- */
.random-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 640px) { .random-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 768px) { .random-grid { gap: 12px; } }
/* Tối đa 6 truyện / hàng để bìa to */
@media (min-width: 1024px) { .random-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 16px; } }
.random-item { overflow: hidden; }
.random-item .cover { border-radius: 4px; }
.random-item .rating {
  position: absolute; top: 4px; right: 4px; z-index: 1;
  display: flex; align-items: center; gap: 4px; padding: 2px 4px; border-radius: 4px;
  font-size: 12px; line-height: 1rem; background: var(--background); border-width: 1px; color: var(--star);
}
.random-item .rating b { font-weight: 400; color: var(--foreground); }
.random-item .rating svg { width: 12px; height: 12px; fill: currentColor; }
.random-item .info { padding: 12px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.random-item .title { font-size: 14px; font-weight: 500; }
.random-item .genre { font-size: 12px; color: var(--muted-foreground); }

/* ---------- Footer ---------- */
.site-footer {
  position: relative; overflow: hidden; margin-top: 48px; padding: 48px 0 24px;
  background: linear-gradient(180deg, rgba(20, 20, 20, 0) 0%, #0d0d0f 30%, #08080a 100%);
  border-top: 1px solid var(--border); font-size: 14px; color: var(--muted-foreground);
}
/* dải sáng gradient ở mép trên + quầng sáng mờ */
.site-footer::before {
  content: ""; position: absolute; top: -1px; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, #f59e0b 20%, #a855f7 50%, #f59e0b 80%, transparent);
  opacity: .85;
}
.footer-glow {
  position: absolute; top: -180px; left: 50%; width: 720px; height: 360px; transform: translateX(-50%);
  background: radial-gradient(closest-side, rgba(168, 85, 247, 0.16), rgba(245, 158, 11, 0.06) 55%, transparent);
  pointer-events: none;
}
.site-footer .container { position: relative; }
.footer-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 32px; }
@media (min-width: 640px) { .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* minmax(0, …): tên truyện dài (nowrap) không được kéo giãn cột — cắt bằng "…" */
@media (min-width: 1024px) { .footer-grid { grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.9fr) minmax(0, 1.4fr) minmax(0, 1.1fr); gap: 40px; } }
.footer-brand p { margin: 12px 0 0; line-height: 1.7; max-width: 380px; }
.footer-logo span {
  font-size: 20px; background: linear-gradient(90deg, #fafafa, #fcd34d); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.footer-logo svg { width: 22px; height: 22px; color: #fcd34d; }
.footer-title { margin: 0 0 14px; font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--foreground); }
.footer-col ul { display: flex; flex-direction: column; gap: 10px; }
.footer-col li a { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; transition: color .15s, transform .15s; }
.footer-col li a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.footer-col li a svg { width: 15px; height: 15px; flex-shrink: 0; color: #a1a1aa; transition: color .15s; }
.footer-col li a:hover { color: var(--foreground); transform: translateX(3px); }
.footer-col li a:hover svg { color: #fcd34d; }
.footer-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.footer-tags a {
  padding: 5px 12px; border-radius: 999px; border: 1px solid var(--border); background: rgba(255, 255, 255, 0.03);
  font-size: 13px; transition: border-color .15s, color .15s, background .15s;
}
.footer-tags a:hover { color: var(--foreground); border-color: rgba(252, 211, 77, 0.6); background: rgba(252, 211, 77, 0.08); }
.footer-bottom {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--border); font-size: 13px;
}
.footer-bottom-links { display: flex; align-items: center; gap: 16px; }
.site-footer a:hover { color: var(--foreground); }
.footer-top {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--input); background: rgba(255, 255, 255, 0.04); color: var(--muted-foreground); font-size: 13px;
  transition: color .15s, border-color .15s;
}
.footer-top svg { width: 15px; height: 15px; }
.footer-top:hover { color: var(--foreground); border-color: rgba(252, 211, 77, 0.6); }
@media (max-width: 639px) { .footer-bottom { flex-direction: column-reverse; align-items: flex-start; } .site-footer { padding-top: 36px; } }

/* ---------- Menu trượt (sheet) ---------- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, 0.5); opacity: 0; pointer-events: none; transition: opacity .2s; }
.sheet {
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 51; width: 75%; max-width: 320px;
  background: var(--background); border-right-width: 1px; padding: 16px;
  transform: translateX(-100%); transition: transform .25s ease;
  display: flex; flex-direction: column; gap: 16px;
}
.sheet-open .sheet { transform: none; }
.sheet-open .sheet-backdrop { opacity: 1; pointer-events: auto; }
.sheet .sheet-head { display: flex; align-items: center; justify-content: space-between; }
.sheet nav a { display: flex; align-items: center; gap: 10px; padding: 10px 8px; border-radius: 6px; font-size: 15px; }
.sheet nav a:hover { background: var(--secondary); }
.sheet nav svg { width: 18px; height: 18px; color: var(--muted-foreground); }
.sheet .search { display: flex; max-width: none; padding: 0; }

/* ---------- Trang truyện ---------- */
#story-root, #reader-root { display: flex; flex-direction: column; gap: 16px; }
.empty { padding: 24px; text-align: center; color: var(--muted-foreground); }
.link { text-decoration: underline; color: var(--foreground); }
.story-head { flex-direction: row; gap: 16px; padding: 16px; }
.story-cover { width: 180px; flex-shrink: 0; border-radius: var(--radius); border-width: 1px; }
.story-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.story-info h1 { font-size: 24px; font-weight: 600; letter-spacing: -0.025em; line-height: 1.3; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0; font-size: 14px; }
.facts dt { color: var(--muted-foreground); }
.facts dd { margin: 0; display: inline-flex; align-items: center; gap: 4px; }
.facts .star svg { width: 14px; height: 14px; }
.desc { font-size: 15px; line-height: 1.7; color: #d4d4d4; }
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; height: 40px; padding: 0 20px;
  border-radius: 6px; background: var(--foreground); color: var(--background); font-weight: 600; font-size: 14px;
}
.btn-primary:hover { opacity: .9; }
@media (max-width: 639px) {
  .story-head { flex-direction: column; align-items: center; text-align: center; }
  .story-cover { width: 60%; max-width: 220px; }
  .facts { justify-content: center; text-align: left; }
}
.toc { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 24px; padding: 4px 4px 8px; }
.toc li { min-width: 0; }
@media (min-width: 768px) { .toc { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .toc { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.toc a { display: block; padding: 8px 4px; font-size: 14px; border-bottom: 1px dashed var(--border); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toc a:hover { color: var(--foreground); text-decoration: underline; }

/* ---------- Trang đọc ---------- */
.reader { max-width: 860px; width: 100%; margin: 0 auto; padding: 16px; gap: 16px; }
@media (min-width: 768px) { .reader { padding: 24px 40px; } }
.reader-story { text-align: center; color: var(--muted-foreground); font-size: 14px; }
.reader-story:hover { color: var(--foreground); }
.reader h1 { text-align: center; font-size: 22px; font-weight: 600; line-height: 1.35; }
.reader-nav { display: flex; justify-content: center; gap: 8px; }
.btn-outline.is-disabled { opacity: .4; pointer-events: none; }
.reader-body { font-size: 19px; line-height: 1.85; color: #e5e5e5; overflow-wrap: anywhere; }
.reader-body p { margin: 0 0 1.1em; }

/* Chương cuối trên site ⇒ mời đọc full tại VER */
.ver-cta {
  display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
  margin: 8px 0; padding: 20px 16px; border-radius: var(--radius);
  border: 1px solid rgba(250, 204, 21, 0.35); background: rgba(250, 204, 21, 0.06);
}
.ver-cta p { margin: 0; font-size: 16px; line-height: 1.6; }
.ver-cta .muted { font-size: 14px; }
.ver-cta .btn-primary { margin-top: 8px; gap: 6px; }
.ver-cta .btn-primary svg { width: 16px; height: 16px; }

/* ---------- Trang truyện tĩnh (truyen/<slug>/) ---------- */
.story-page { display: flex; flex-direction: column; gap: 16px; }
.breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; color: var(--muted-foreground); padding: 0 8px; }
.breadcrumb a:hover { color: var(--foreground); text-decoration: underline; }
.breadcrumb [aria-current] { color: var(--foreground); }
.story-head .lead { margin: 0; font-size: 16px; line-height: 1.7; color: #d4d4d4; }
.story-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.story-actions .btn-outline { height: 40px; padding: 0 16px; }
@media (max-width: 639px) { .story-actions { justify-content: center; } }
.prose { padding: 16px; gap: 12px; }
@media (min-width: 768px) { .prose { padding: 20px 24px; } }
.prose h2 { font-size: 20px; font-weight: 600; letter-spacing: -0.02em; padding-bottom: 8px; border-bottom-width: 1px; }
@media (min-width: 768px) { .prose h2 { font-size: 22px; } }
.prose h3 { font-size: 16px; font-weight: 600; margin-top: 4px; }
.prose p { margin: 0; font-size: 15px; line-height: 1.75; color: #d4d4d4; }
.prose ul { list-style: disc; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 15px; line-height: 1.7; color: #d4d4d4; }
.small { font-size: 13px !important; }
.fact-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.fact-table th, .fact-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.fact-table th { width: 38%; max-width: 200px; font-weight: 500; color: var(--muted-foreground); }
@media (min-width: 768px) { .fact-table th { width: 200px; } }
.toc-ver { list-style: none; padding: 0; counter-reset: none; }
.toc-latest a, .toc-more a { color: var(--foreground); }
.toc-latest a { text-decoration: underline; }
/* Phân trang danh sách chương */
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; padding-top: 4px; }
.pager-btn {
  display: inline-flex; align-items: center; justify-content: center; min-width: 36px; height: 36px; padding: 0 10px;
  border-radius: 6px; border: 1px solid var(--input); background: rgba(255, 255, 255, 0.045); font-size: 14px;
}
.pager-btn:hover { background: rgba(255, 255, 255, 0.1); }
.pager-btn svg { width: 16px; height: 16px; }
.pager-btn.is-current { background: var(--foreground); color: var(--background); border-color: var(--foreground); font-weight: 600; }
.pager-btn.is-disabled { opacity: .35; }
.pager-gap { color: var(--muted-foreground); padding: 0 2px; }
.pager-select {
  height: 36px; padding: 0 8px; border-radius: 6px; border: 1px solid var(--input);
  background: var(--card); color: var(--foreground); font: inherit; font-size: 14px; max-width: 100%;
}
.faq h3 { margin-top: 8px; }
.related { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 4px; }
.related a { display: flex; flex-direction: column; gap: 8px; font-size: 14px; font-weight: 500; text-align: center; }
.related a:hover span { text-decoration: underline; }
.related img { width: 100%; height: auto; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 4px; border: 1px solid var(--border); }
@media (min-width: 768px) { .related { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.story-cover img { position: static; }

/* Chương cuối trên site: dòng chữ thường + link đầy đủ sang VER */
.ver-next { margin: 0 0 1.1em; font-size: 19px; line-height: 1.85; color: #e5e5e5; overflow-wrap: anywhere; }
.ver-next a { color: #93c5fd; text-decoration: underline; }

/* Ẩn khỏi màn hình nhưng vẫn cho trình đọc màn hình + bot (H1 trang chủ) */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
/* Tiêu đề thẻ truyện là h3 (cấu trúc heading) nhưng giữ cỡ chữ của thẻ */
.story-card h3.title, .random-item h3.title { margin: 0; }
h3.rank-title { margin: 0; font-weight: 400; }

/* ---------- Tìm kiếm: hộp gợi ý dưới ô tìm + trang tim-kiem.html ---------- */
.search form { position: relative; }
.search input[type=search]::-webkit-search-cancel-button { -webkit-appearance: none; }
.search-results {
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 60; width: min(380px, calc(100vw - 32px));
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5); padding: 6px; display: flex; flex-direction: column; gap: 2px;
}
.search-results[hidden] { display: none; }
.search-item { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: 6px; }
.search-item:hover, .search-item:focus { background: var(--secondary); outline: none; }
.search-item .cover { width: 36px; flex-shrink: 0; border-radius: 4px; }
.search-text { display: flex; flex-direction: column; min-width: 0; }
.search-text b { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-text small { font-size: 12px; color: var(--muted-foreground); }
.search-all { display: block; padding: 8px 6px 4px; font-size: 13px; color: var(--muted-foreground); text-align: center; border-top: 1px solid var(--border); margin-top: 4px; }
.search-all:hover { color: var(--foreground); }
.search-empty { padding: 10px 6px; font-size: 13px; color: var(--muted-foreground); }
.sheet .search-results { position: static; width: 100%; box-shadow: none; margin-top: 8px; }
.search-page h1 { font-size: 22px; font-weight: 600; }
.search-page-form { display: flex; gap: 8px; }
.search-page-form input {
  flex: 1; min-width: 0; height: 40px; padding: 0 12px; border-radius: 6px; border: 1px solid var(--input);
  background: var(--background); color: var(--foreground); font: inherit; font-size: 15px; outline: none;
}
.search-page-form input:focus { border-color: rgba(250, 250, 250, 0.6); }
