/* ==========================================================
   DocTruyen Design System — Vanilla CSS
   Primary: #f2a60d | Font: Inter | Icons: Material Icons
   ========================================================== */

/* ---------- CSS Variables ---------- */
:root {
    --primary: #f2a60d;
    --primary-dark: #d98e00;
    --primary-light: rgba(242, 166, 13, .1);
    --bg: #f8f7f5;
    --surface: #ffffff;
    --text: #1f2937;
    --text-muted: #6b7280;
    --text-light: #9ca3af;
    --border: #e5e7eb;
    --border-light: #f3f4f6;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, .06);
    --shadow: 0 4px 12px rgba(0, 0, 0, .08);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, .12);
    --radius: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;
    --max-w: 1200px;
    --header-h: 64px;
    --transition: .25s ease;
}

/* ---------- Reset & Base ---------- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column
}

img {
    max-width: 100%;
    height: auto;
    display: block
}

a {
    color: inherit;
    text-decoration: none
}

a:hover {
    color: var(--primary)
}

ul,
ol {
    list-style: none
}

button {
    cursor: pointer;
    border: none;
    background: none;
    font: inherit;
    color: inherit
}

input,
select,
textarea {
    font: inherit;
    color: inherit
}

/* ---------- Typography ---------- */
h1 {
    font-size: 1.75rem;
    font-weight: 800;
    line-height: 1.3
}

h2 {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.3
}

h3 {
    font-size: 1.1rem;
    font-weight: 600
}

h4 {
    font-size: .95rem;
    font-weight: 600
}

.section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: .03em
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2px solid var(--border);
    padding-bottom: 10px;
    margin-bottom: 16px
}

.section-link {
    font-size: .8rem;
    color: var(--primary);
    font-weight: 600
}

.section-link:hover {
    text-decoration: underline
}

/* ---------- Layout ---------- */
.container {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 16px
}

.main-content {
    flex: 1;
    padding: 24px 0
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px
}

.grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px
}

.grid-5 {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px
}

.grid-6 {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 20px
}

.col-span-2 {
    grid-column: span 2
}

.flex {
    display: flex
}

.flex-col {
    flex-direction: column
}

.items-center {
    align-items: center
}

.justify-between {
    justify-content: space-between
}

.gap-4 {
    gap: 16px
}

.gap-6 {
    gap: 24px
}

.gap-8 {
    gap: 32px
}

/* ---------- Header ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    transition: background var(--transition)
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-h);
    gap: 16px
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0
}

.logo-icon {
    background: var(--primary);
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.1rem
}

.logo-text {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.02em
}

.logo-text span {
    color: var(--primary)
}

/* Nav */
.nav-main {
    display: flex;
    align-items: center;
    gap: 24px
}

.nav-link {
    font-size: .9rem;
    font-weight: 500;
    color: var(--text-muted);
    transition: color var(--transition);
    display: flex;
    align-items: center;
    gap: 4px
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary)
}

/* Category Dropdown */
.dropdown {
    position: relative
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 360px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: .2s ease;
    z-index: 200;
    margin-top: 8px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px
}

.dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0)
}

.dropdown-item {
    display: block;
    padding: 8px 14px;
    font-size: .87rem;
    color: var(--text);
    border-radius: 6px;
    transition: background var(--transition)
}

.dropdown-item:hover {
    background: var(--primary-light);
    color: var(--primary)
}

/* Search */
.search-box {
    flex: 1;
    max-width: 500px;
    position: relative
}

.search-box input {
    width: 100%;
    height: 40px;
    padding: 0 44px 0 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    background: var(--border-light);
    font-size: .87rem;
    transition: all var(--transition)
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--surface);
    box-shadow: 0 0 0 3px var(--primary-light)
}

.search-box button {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition)
}

.search-box button:hover {
    background: var(--primary-dark)
}

/* Header tools */
.header-tools {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0
}

.btn-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: all var(--transition)
}

.btn-icon:hover {
    background: var(--border-light);
    color: var(--primary)
}

.btn-login {
    font-size: .87rem;
    font-weight: 500;
    color: var(--text);
    padding: 6px 12px;
    border-radius: var(--radius)
}

.btn-login:hover {
    color: var(--primary)
}

.btn-register {
    font-size: .87rem;
    font-weight: 600;
    color: #fff;
    background: var(--primary);
    padding: 8px 20px;
    border-radius: var(--radius-full);
    box-shadow: 0 2px 8px rgba(242, 166, 13, .3);
    transition: all var(--transition)
}

.btn-register:hover {
    background: var(--primary-dark);
    box-shadow: 0 4px 12px rgba(242, 166, 13, .4)
}

/* Mobile menu */
.mobile-toggle {
    display: none
}

@media(max-width:768px) {

    .nav-main,
    .btn-login,
    .btn-register,
    .search-box {
        display: none
    }

    .mobile-toggle {
        display: flex
    }
}

/* ---------- Hero / Featured Stories ---------- */
.hero-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 16px
}

.hero-card {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    height: 210px;
    background: #1a1a1a
}

.hero-card.featured {
    grid-column: span 1;
    grid-row: span 2;
    height: 100%
}

.hero-card-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    transition: transform .6s ease
}

.hero-card:hover .hero-card-bg {
    transform: scale(1.05)
}

.hero-card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, .85) 0%, rgba(0, 0, 0, .3) 50%, transparent 100%)
}

.hero-card-body {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 14px;
    color: #fff;
    z-index: 2
}

.hero-card .badge-hot {
    display: inline-block;
    padding: 2px 8px;
    font-size: .7rem;
    font-weight: 700;
    color: #fff;
    background: #ef4444;
    border-radius: 4px;
    margin-bottom: 8px
}

.hero-card h3 {
    font-size: .9rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 4px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical
}

.hero-card.featured h3 {
    font-size: 1.15rem
}

.hero-card .meta {
    font-size: .75rem;
    color: rgba(255, 255, 255, .7);
    display: flex;
    align-items: center;
    gap: 8px
}

.hero-card .meta .material-icons {
    font-size: 14px
}

.hero-card .chapter-info {
    font-size: .75rem;
    color: var(--primary);
    font-weight: 600;
    margin-top: 4px
}

.btn-read {
    display: inline-block;
    padding: 6px 16px;
    background: var(--primary);
    color: #fff;
    font-size: .8rem;
    font-weight: 600;
    border-radius: 4px;
    transition: background var(--transition)
}

.btn-read:hover {
    background: var(--primary-dark);
    color: #fff
}

/* ---------- Three Column Home Layout ---------- */
.home-grid {
    display: grid;
    grid-template-columns: 1.2fr 1.5fr 1.3fr;
    gap: 28px
}

/* Text list (compact, dotted separators) */
.text-list {
    display: flex;
    flex-direction: column
}

.text-list li {
    border-bottom: 1px dotted var(--border);
    overflow: hidden
}

.text-list li:last-child {
    border-bottom: none
}

.text-list li a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 4px;
    font-size: .87rem;
    color: var(--text);
    transition: color var(--transition)
}

.text-list li a:hover {
    color: var(--primary)
}

.text-list-title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500
}

.text-list-date {
    flex-shrink: 0;
    width: 80px;
    text-align: right;
    font-size: .72rem;
    color: var(--text-light);
    white-space: nowrap
}

/* Update items */
.update-list {
    display: flex;
    flex-direction: column;
    gap: 12px
}

.update-item {
    display: flex;
    gap: 12px;
    padding: 10px;
    border-radius: var(--radius);
    border: 1px solid transparent;
    transition: all var(--transition)
}

.update-item:hover {
    background: var(--surface);
    border-color: var(--border-light);
    box-shadow: var(--shadow-sm)
}

.update-thumb {
    width: 56px;
    height: 80px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
    background: #eee
}

.update-body {
    flex: 1;
    min-width: 0
}

.update-body .genre-badge {
    display: inline-block;
    padding: 1px 6px;
    font-size: .65rem;
    font-weight: 600;
    color: var(--primary);
    border: 1px solid rgba(242, 166, 13, .3);
    border-radius: 4px;
    background: var(--primary-light)
}

.update-body h4 {
    font-size: .9rem;
    font-weight: 700;
    margin: 4px 0 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis
}

.update-body h4:hover {
    color: var(--primary)
}

.update-body .desc {
    font-size: .8rem;
    color: var(--text-muted);
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical
}

.update-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: .72rem;
    color: var(--text-light);
    margin-top: 4px
}

.update-meta .material-icons {
    font-size: 12px;
    vertical-align: middle
}

.update-meta .time {
    color: var(--primary)
}

.update-chapter {
    font-size: .75rem;
    font-weight: 500;
    margin-top: 4px;
    color: var(--text)
}

/* Ranking */
.rank-list {
    display: flex;
    flex-direction: column;
    gap: 12px
}

.rank-item {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer
}

.rank-item:hover h4 {
    color: var(--primary)
}

.rank-num {
    width: 32px;
    height: 32px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .85rem;
    flex-shrink: 0;
    background: var(--border-light);
    color: var(--text-muted)
}

.rank-num.top-1 {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(242, 166, 13, .4)
}

.rank-num.top-2 {
    background: #475569;
    color: #fff
}

.rank-num.top-3 {
    background: #78716c;
    color: #fff
}

.rank-body {
    flex: 1;
    min-width: 0
}

.rank-body h4 {
    font-size: .85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color var(--transition)
}

.rank-body .views {
    font-size: .72rem;
    color: var(--text-light)
}

.rank-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    padding: 16px;
    box-shadow: var(--shadow-sm)
}

.rank-footer {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-light);
    text-align: center
}

.rank-footer a {
    font-size: .78rem;
    font-weight: 600;
    color: var(--primary)
}

/* Suggestion Cards */
.suggest-card {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 12px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition)
}

.suggest-card:hover {
    box-shadow: var(--shadow)
}

.suggest-featured {
    background: linear-gradient(135deg, #1e1b4b, #0f172a);
    color: #fff;
    padding: 20px;
    position: relative;
    overflow: hidden
}

.suggest-featured .bg-icon {
    position: absolute;
    top: 0;
    right: 0;
    font-size: 64px;
    opacity: .1
}

.suggest-featured h3 {
    font-weight: 700;
    font-size: 1.05rem;
    margin: 8px 0 4px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical
}

.suggest-featured p {
    font-size: .78rem;
    opacity: .8;
    margin-bottom: 12px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical
}

.suggest-featured .btn-ghost {
    width: 100%;
    padding: 8px;
    background: rgba(255, 255, 255, .1);
    border: 1px solid rgba(255, 255, 255, .2);
    color: #fff;
    border-radius: 6px;
    font-size: .8rem;
    font-weight: 600;
    text-align: center;
    transition: background var(--transition)
}

.suggest-featured .btn-ghost:hover {
    background: rgba(255, 255, 255, .2)
}

.suggest-mini {
    display: flex;
    gap: 10px
}

.suggest-mini-thumb {
    width: 44px;
    height: 60px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
    background: #eee
}

.suggest-mini h4 {
    font-size: .85rem;
    font-weight: 700;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical
}

.suggest-mini .sub {
    font-size: .72rem;
    color: var(--text-light);
    margin: 2px 0
}

.suggest-mini .rating {
    font-size: .78rem;
    color: var(--primary);
    font-weight: 600
}

.history-cta {
    background: var(--primary-light);
    border: 1px solid rgba(242, 166, 13, .2);
    border-radius: var(--radius-lg);
    padding: 12px;
    text-align: center
}

.history-cta p {
    font-size: .78rem;
    color: var(--text-muted);
    margin-bottom: 6px
}

.history-cta a {
    font-size: .85rem;
    font-weight: 700;
    color: var(--primary)
}

/* ---------- Story Card (Category/Search Grid) ---------- */
.story-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid transparent;
    box-shadow: var(--shadow-sm);
    transition: all .3s ease;
    display: flex;
    flex-direction: column
}

.story-card:hover {
    box-shadow: var(--shadow-lg);
    border-color: rgba(242, 166, 13, .3);
    transform: translateY(-2px)
}

.story-card-cover {
    position: relative;
    aspect-ratio: 3/4;
    overflow: hidden;
    background: #eee
}

.story-card-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .5s ease
}

.story-card:hover .story-card-cover img {
    transform: scale(1.05)
}

.story-card-cover .badge {
    position: absolute;
    top: 8px;
    left: 8px;
    padding: 2px 8px;
    font-size: .65rem;
    font-weight: 700;
    border-radius: 4px;
    color: #fff
}

.badge-hot-bg {
    background: #ef4444
}

.badge-new-bg {
    background: #22c55e
}

.story-card-cover .rating-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, .6);
    backdrop-filter: blur(4px);
    color: #fff;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: .72rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 2px
}

.rating-badge .material-icons {
    font-size: 12px;
    color: var(--primary)
}

.story-card-body {
    padding: 12px;
    flex: 1;
    display: flex;
    flex-direction: column
}

.story-card-body h3 {
    font-size: .95rem;
    font-weight: 700;
    margin-bottom: 4px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical
}

.story-card-body h3:hover {
    color: var(--primary)
}

.story-card-body .author {
    font-size: .75rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 8px
}

.story-card-body .author .material-icons {
    font-size: 14px
}

.story-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto
}

.status-badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: .68rem;
    font-weight: 600;
    border-radius: 4px;
    border: 1px solid
}

.status-ongoing {
    color: #f59e0b;
    border-color: #f59e0b;
    background: rgba(245, 158, 11, .08)
}

.status-complete {
    color: #10b981;
    border-color: #10b981;
    background: rgba(16, 185, 129, .08)
}

.chapter-count {
    font-size: .72rem;
    color: var(--text-muted)
}

/* ---------- Story Detail Page ---------- */
.story-hero {
    position: relative;
    background: linear-gradient(135deg, #f8f7f5, #ede9e0);
    border-radius: var(--radius-xl);
    padding: 32px;
    margin-bottom: 24px;
    overflow: hidden
}

.story-hero-inner {
    display: flex;
    gap: 28px
}

.story-cover {
    width: 200px;
    flex-shrink: 0;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    border: 4px solid var(--surface)
}

.story-cover img {
    width: 100%;
    aspect-ratio: 3/4;
    object-fit: cover
}

.story-info {
    flex: 1
}

.story-info h1 {
    font-size: 1.6rem;
    margin-bottom: 8px
}

.story-meta-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: .85rem;
    margin-bottom: 12px
}

.story-meta-row a {
    color: var(--primary);
    font-weight: 500
}

.story-meta-row .divider {
    color: var(--border)
}

.story-stats {
    display: flex;
    gap: 32px;
    margin: 16px 0
}

.story-stat {
    text-align: center
}

.story-stat .value {
    font-size: 1.3rem;
    font-weight: 700
}

.story-stat .value .material-icons {
    font-size: 18px;
    color: var(--primary);
    vertical-align: middle
}

.story-stat .label {
    font-size: .72rem;
    color: var(--text-muted);
    margin-top: 2px
}

.story-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 24px;
    background: var(--primary);
    color: #fff;
    font-weight: 600;
    font-size: .9rem;
    border-radius: var(--radius);
    transition: all var(--transition)
}

.btn-primary:hover {
    background: var(--primary-dark);
    color: #fff
}

.btn-outline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 24px;
    border: 1px solid var(--border);
    color: var(--text);
    font-weight: 500;
    font-size: .9rem;
    border-radius: var(--radius);
    transition: all var(--transition)
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary)
}

.synopsis {
    margin-top: 20px
}

.synopsis h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px
}

.synopsis h3 .bar {
    width: 3px;
    height: 20px;
    background: var(--primary);
    border-radius: 2px
}

.synopsis p {
    font-size: .9rem;
    color: var(--text-muted);
    line-height: 1.7;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical
}

.synopsis.expanded p {
    -webkit-line-clamp: unset
}

/* Chapter list */
.chapter-section {
    margin-top: 24px
}

.chapter-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px
}

.sort-tabs {
    display: flex;
    background: var(--border-light);
    border-radius: var(--radius);
    padding: 3px;
    gap: 4px
}

.sort-tab {
    padding: 6px 14px;
    font-size: .78rem;
    font-weight: 500;
    border-radius: 6px;
    color: var(--text-muted);
    transition: all var(--transition)
}

.sort-tab.active {
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-sm)
}

.chapter-list {
    max-height: 400px;
    overflow-y: auto
}

.chapter-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: var(--radius);
    transition: background var(--transition)
}

.chapter-item:hover {
    background: var(--border-light)
}

.chapter-item .name {
    font-size: .87rem;
    font-weight: 500;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap
}

.chapter-item .name:hover {
    color: var(--primary)
}

.chapter-item .badge-new {
    display: inline-block;
    padding: 1px 6px;
    font-size: .6rem;
    font-weight: 700;
    color: #fff;
    background: var(--primary);
    border-radius: 4px;
    margin-left: 8px
}

.chapter-item .time {
    font-size: .72rem;
    color: var(--text-light);
    flex-shrink: 0;
    margin-left: 12px
}

/* Story sidebar */
.story-sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px
}

.author-card {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 20px;
    text-align: center
}

.author-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--border-light);
    margin: 0 auto 8px;
    overflow: hidden
}

.author-card h4 {
    font-size: .9rem;
    margin-bottom: 2px
}

.author-card .sub {
    font-size: .75rem;
    color: var(--text-muted)
}

.related-stories {
    display: flex;
    flex-direction: column;
    gap: 12px
}

.related-item {
    display: flex;
    gap: 10px;
    align-items: center
}

.related-item-thumb {
    width: 48px;
    height: 64px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
    background: #eee
}

.related-body h4 {
    font-size: .82rem;
    font-weight: 600;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical
}

.related-body .sub {
    font-size: .72rem;
    color: var(--text-muted)
}

.related-body .rating {
    font-size: .75rem;
    color: var(--primary);
    font-weight: 600
}

/* ---------- Chapter Read Page ---------- */
.read-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, .97);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
    height: var(--header-h);
    display: flex;
    align-items: center
}

.read-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%
}

.read-title {
    flex: 1;
    min-width: 0
}

.read-title h3 {
    font-size: .9rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis
}

.read-title p {
    font-size: .72rem;
    color: var(--text-muted)
}

.progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--border-light);
    z-index: 200
}

.progress-bar .fill {
    height: 100%;
    background: var(--primary);
    transition: width .3s ease
}

.read-tools {
    display: flex;
    gap: 6px;
    align-items: center
}

/* Read content */
.read-layout {
    display: flex;
    gap: 0;
    position: relative
}

.read-toc {
    width: 240px;
    position: fixed;
    left: 0;
    top: var(--header-h);
    bottom: 0;
    overflow-y: auto;
    padding: 20px 12px;
    border-right: 1px solid var(--border-light);
    background: var(--surface)
}

.read-toc h4 {
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-muted);
    margin-bottom: 12px;
    padding: 0 8px
}

.read-toc a {
    display: block;
    padding: 8px 12px;
    font-size: .82rem;
    color: var(--text-muted);
    border-radius: var(--radius);
    transition: all var(--transition);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap
}

.read-toc a:hover {
    background: var(--border-light);
    color: var(--text)
}

.read-toc a.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
    border-left: 3px solid var(--primary)
}

.read-main {
    flex: 1;
    max-width: 740px;
    margin: 0 auto;
    padding: 32px 20px
}

.read-chapter-title {
    text-align: center;
    margin-bottom: 24px
}

.read-chapter-title h1 {
    font-size: 1.5rem;
    margin-bottom: 8px
}

.read-chapter-meta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: .78rem;
    color: var(--text-muted)
}

.read-chapter-meta .material-icons {
    font-size: 14px;
    vertical-align: middle
}

.read-content {
    font-size: 1.05rem;
    line-height: 1.9;
    color: #374151
}

.read-content p {
    margin-bottom: 20px
}

/* Chapter navigation */
.chapter-nav {
    display: flex;
    gap: 12px;
    margin-top: 32px
}

.chapter-nav .btn-prev,
.chapter-nav .btn-next {
    flex: 1;
    padding: 14px 20px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 500;
    transition: all var(--transition)
}

.chapter-nav .btn-prev {
    border: 1px solid var(--border);
    color: var(--text-muted)
}

.chapter-nav .btn-prev:hover {
    border-color: var(--primary);
    color: var(--primary)
}

.chapter-nav .btn-next {
    background: var(--primary);
    color: #fff
}

.chapter-nav .btn-next:hover {
    background: var(--primary-dark);
    color: #fff
}

/* Reactions */
.reactions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin: 32px 0;
    padding: 20px;
    border-top: 1px solid var(--border-light)
}

.reaction-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: transform var(--transition)
}

.reaction-btn:hover {
    transform: scale(1.15)
}

.reaction-btn .emoji {
    font-size: 1.8rem
}

.reaction-btn .label {
    font-size: .68rem;
    color: var(--text-muted)
}

/* Comments sidebar */
.read-comments {
    width: 280px;
    position: fixed;
    right: 0;
    top: var(--header-h);
    bottom: 0;
    overflow-y: auto;
    padding: 20px;
    border-left: 1px solid var(--border-light);
    background: var(--surface)
}

.comment-item {
    margin-bottom: 16px
}

.comment-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px
}

.comment-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--border-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .7rem;
    font-weight: 600;
    color: var(--primary)
}

.comment-name {
    font-size: .82rem;
    font-weight: 600
}

.comment-time {
    font-size: .68rem;
    color: var(--text-light);
    margin-left: auto
}

.comment-text {
    font-size: .8rem;
    color: var(--text-muted);
    line-height: 1.5
}

/* ---------- Sidebar Filter (Category/Search) ---------- */
.filter-sidebar {
    width: 260px;
    flex-shrink: 0
}

.filter-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    padding: 20px;
    position: sticky;
    top: calc(var(--header-h) + 16px)
}

.filter-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px
}

.filter-title h3 {
    font-size: .9rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px
}

.filter-title .clear {
    font-size: .72rem;
    color: var(--text-muted);
    cursor: pointer
}

.filter-title .clear:hover {
    color: var(--primary)
}

.filter-section {
    margin-bottom: 20px
}

.filter-section h4 {
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text);
    margin-bottom: 10px
}

.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px
}

.filter-chip {
    padding: 6px 12px;
    font-size: .8rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    gap: 4px
}

.filter-chip .material-icons {
    font-size: 16px
}

.filter-chip:hover {
    border-color: var(--primary);
    color: var(--primary)
}

.filter-chip.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary)
}

.filter-radio {
    display: flex;
    flex-direction: column;
    gap: 8px
}

.filter-radio label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .85rem;
    cursor: pointer
}

.filter-radio input[type="radio"] {
    accent-color: var(--primary);
    width: 16px;
    height: 16px
}

.btn-filter {
    width: 100%;
    padding: 10px;
    background: var(--primary);
    color: #fff;
    font-weight: 600;
    font-size: .87rem;
    border-radius: var(--radius);
    margin-top: 12px;
    transition: background var(--transition)
}

.btn-filter:hover {
    background: var(--primary-dark)
}

/* Active filter tags */
.active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px
}

.filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    background: var(--primary-light);
    border: 1px solid rgba(242, 166, 13, .3);
    border-radius: var(--radius-full);
    font-size: .78rem;
    color: var(--primary);
    font-weight: 500
}

.filter-tag button {
    display: flex;
    color: var(--primary);
    opacity: .6
}

.filter-tag button:hover {
    opacity: 1
}

/* Sort bar */
.sort-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px
}

.sort-bar h1 {
    font-size: 1.3rem
}

.sort-bar h1 span {
    color: var(--primary)
}

.sort-bar h1 .count {
    font-size: .9rem;
    font-weight: 400;
    color: var(--text-muted);
    margin-left: 4px
}

.sort-select {
    padding: 8px 32px 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: .85rem;
    background: var(--surface);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='%236b7280'%3E%3Cpath d='M7 10l5 5 5-5H7z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center
}

.sort-select:focus {
    outline: none;
    border-color: var(--primary)
}

/* ---------- Footer ---------- */
.site-footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 48px 0 0;
    margin-top: 48px
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr 1fr;
    gap: 32px
}

.footer-brand .logo {
    margin-bottom: 12px
}

.footer-brand p {
    font-size: .82rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 16px
}

.footer-social {
    display: flex;
    gap: 12px
}

.footer-social a {
    color: var(--text-light);
    transition: color var(--transition)
}

.footer-social a:hover {
    color: var(--primary)
}

.footer-col h4 {
    font-weight: 700;
    margin-bottom: 12px;
    font-size: .9rem
}

.footer-col ul {
    display: flex;
    flex-direction: column;
    gap: 8px
}

.footer-col a {
    font-size: .82rem;
    color: var(--text-muted);
    transition: color var(--transition)
}

.footer-col a:hover {
    color: var(--primary)
}

.footer-bottom {
    border-top: 1px solid var(--border-light);
    margin-top: 32px;
    padding: 20px 0;
    text-align: center;
    font-size: .78rem;
    color: var(--text-light)
}

/* ---------- Breadcrumb ---------- */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: .82rem;
    color: var(--text-muted);
    padding: 12px 0;
    flex-wrap: wrap
}

.breadcrumb a {
    color: var(--text-muted);
    transition: color var(--transition)
}

.breadcrumb a:hover {
    color: var(--primary)
}

.breadcrumb .sep {
    font-size: .7rem;
    color: var(--text-light)
}

.breadcrumb .current {
    color: var(--text);
    font-weight: 500
}

/* ---------- Floating CTA ---------- */
.floating-cta {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 90
}

.floating-cta a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--primary);
    color: #fff;
    font-weight: 600;
    font-size: .87rem;
    border-radius: var(--radius-full);
    box-shadow: 0 4px 20px rgba(242, 166, 13, .4);
    transition: all var(--transition)
}

.floating-cta a:hover {
    background: var(--primary-dark);
    box-shadow: 0 6px 24px rgba(242, 166, 13, .5);
    transform: translateY(-2px);
    color: #fff
}

/* Scroll to top */
.scroll-top {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 40px;
    height: 40px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow);
    cursor: pointer;
    z-index: 80;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition)
}

.scroll-top.show {
    opacity: 1;
    visibility: visible
}

.scroll-top:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary)
}

/* ---------- Pagination ---------- */
.pagination {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-top: 24px
}

.pagination a,
.pagination span {
    min-width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    font-size: .85rem;
    font-weight: 500;
    border: 1px solid var(--border);
    color: var(--text-muted);
    transition: all var(--transition)
}

.pagination a:hover {
    border-color: var(--primary);
    color: var(--primary)
}

.pagination .active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary)
}

/* ---------- Loading ---------- */
.loading-more {
    text-align: center;
    padding: 24px;
    color: var(--text-muted);
    font-size: .87rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite
}

@keyframes spin {
    to {
        transform: rotate(360deg)
    }
}

/* ---------- Responsive ---------- */
@media(max-width:1024px) {
    .home-grid {
        grid-template-columns: 1fr 1fr
    }

    .home-grid> :last-child {
        display: none
    }

    .hero-grid {
        grid-template-columns: 1fr 1fr
    }

    .hero-card {
        height: 240px
    }

    .grid-4 {
        grid-template-columns: repeat(3, 1fr)
    }

    .story-hero-inner {
        flex-direction: column;
        align-items: center;
        text-align: center
    }

    .story-cover {
        width: 160px
    }

    .story-stats {
        justify-content: center
    }

    .story-actions {
        justify-content: center
    }

    .read-toc,
    .read-comments {
        display: none
    }

    .read-main {
        max-width: 100%;
        padding: 20px 16px
    }

    .footer-grid {
        grid-template-columns: 1fr 1fr
    }
}

@media(max-width:768px) {
    .container {
        padding: 0 12px
    }

    .hero-grid {
        grid-template-columns: 1fr
    }

    .hero-card.featured {
        grid-row: span 1
    }

    .hero-card {
        height: 200px
    }

    .home-grid {
        grid-template-columns: 1fr
    }

    .home-grid> :nth-child(2),
    .home-grid> :last-child {
        display: none
    }

    .grid-4 {
        grid-template-columns: repeat(2, 1fr)
    }

    .grid-6 {
        grid-template-columns: repeat(3, 1fr)
    }

    .filter-sidebar {
        width: 100%
    }

    .sort-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px
    }

    .story-cover {
        width: 140px
    }

    .chapter-nav {
        flex-direction: column
    }

    .footer-grid {
        grid-template-columns: 1fr
    }

    h1 {
        font-size: 1.3rem
    }
}

/* ---------- Utility ---------- */
.text-primary {
    color: var(--primary) !important
}

.text-muted {
    color: var(--text-muted) !important
}

.text-center {
    text-align: center
}

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap
}

.line-clamp-1 {
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical
}

.line-clamp-2 {
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical
}

.hidden {
    display: none !important
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0
}

.mb-0 {
    margin-bottom: 0
}

.mb-4 {
    margin-bottom: 16px
}

.mb-6 {
    margin-bottom: 24px
}

.mt-4 {
    margin-top: 16px
}

.mt-6 {
    margin-top: 24px
}

/* ---------- Overflow Protection ---------- */
/* Prevent long titles from breaking grid/flex layouts */
.home-grid>* {
    overflow: hidden;
    min-width: 0
}

.rank-card {
    overflow: hidden
}

.suggest-card {
    overflow: hidden
}

.update-item {
    overflow: hidden
}

.hero-card-body h3 {
    word-break: break-word
}

/* ---------- Reading History Modal ---------- */
.rh-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, .5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s, visibility .25s
}

.rh-modal-overlay.show {
    opacity: 1;
    visibility: visible
}

.rh-modal {
    background: var(--surface);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 480px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
    transform: translateY(20px) scale(.96);
    transition: transform .25s
}

.rh-modal-overlay.show .rh-modal {
    transform: translateY(0) scale(1)
}

.rh-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border)
}

.rh-modal-header h3 {
    font-size: .95rem;
    font-weight: 700;
    color: var(--text);
    margin: 0
}

.rh-modal-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-light);
    padding: 4px;
    border-radius: 50%;
    transition: background .2s
}

.rh-modal-close:hover {
    background: var(--border);
    color: var(--text)
}

.rh-modal-body {
    overflow-y: auto;
    padding: 8px 0;
    flex: 1
}

.rh-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-top: 1px solid var(--border)
}

.rh-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light)
}

.rh-empty p {
    margin: 4px 0
}

.rh-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: var(--text);
    transition: background .15s
}

.rh-item:hover {
    background: var(--bg);
    color: var(--primary)
}

.rh-item-thumb {
    width: 44px;
    height: 60px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--bg)
}

.rh-thumb-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light)
}

.rh-item-info {
    flex: 1;
    min-width: 0
}

.rh-item-title {
    font-size: .85rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap
}

.rh-item-meta {
    font-size: .72rem;
    color: var(--text-light);
    margin-top: 3px;
    display: flex;
    gap: 6px
}

.rh-item-arrow {
    color: var(--text-light);
    font-size: 18px;
    flex-shrink: 0
}

.rh-clear-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px 14px;
    font-size: .78rem;
    color: var(--text-light);
    cursor: pointer;
    transition: all .2s
}

.rh-clear-btn:hover {
    border-color: #e74c3c;
    color: #e74c3c
}

.rh-count {
    font-size: .75rem;
    color: var(--text-light)
}