/* ─── Font Declarations ─────────────────────────────────────────────────── */
@font-face {
    font-family: 'Material Icons';
    font-style: normal;
    font-weight: 400;
    font-display: block;
    src: url('/font/MaterialIcons-Regular.ttf') format('truetype');
}

@font-face {
    font-family: 'Google Sans';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('/font/GoogleSans-VariableFont_GRAD,opsz,wght.ttf') format('truetype');
}

@font-face {
    font-family: 'Google Sans';
    font-style: italic;
    font-weight: 100 900;
    font-display: swap;
    src: url('/font/GoogleSans-Italic-VariableFont_GRAD,opsz,wght.ttf') format('truetype');
}

/* ─── Material Icons Base ────────────────────────────────────────────────── */
.material-icons {
    font-family: 'Material Icons';
    font-weight: normal;
    font-style: normal;
    font-size: 24px;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    font-feature-settings: 'liga';
    -webkit-font-smoothing: antialiased;
}

/* ─── Material Icon Utilities ────────────────────────────────────────────── */
.icon-star {
    font-size: 1em;
    color: #fbbf24;
    margin-right: 2px;
    vertical-align: -2px;
}

.icon-trending {
    font-size: 1.1em;
    margin-right: 4px;
    vertical-align: middle;
}

.icon-info {
    font-size: 1.1em;
    vertical-align: -2px;
}

.icon-price {
    font-size: 1.1em;
    vertical-align: -3px;
}

.icon-love {
    font-size: 1.1em;
    color: #f43f5e;
    vertical-align: middle;
}

/* ─── Design Tokens ──────────────────────────────────────────────────────── */
:root {
    /* Colors */
    --card-bg: #ffffff;
    --card-border: 1px solid #f0f0f0;
    --card-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    --accent: #111111;
    --accent-hover: #000000;
    --accent-text: #ffffff;
    --text: #1f2937;
    --text-muted: #6b7280;
    --text-light: #9ca3af;
    --bg: #ffffff;
    --bg-soft: #f9fafb;
    --border-color: #e5e7eb;
    --footer-bg: #f9fafb;

    /* Layout */
    --radius: 14px;
    --radius-sm: 8px;
    --header-h: 64px;
    --max-w: 1200px;

    /* Animation */
    --transition: 0.25s ease;
    --transition-slow: 0.4s ease;

    /* Focus ring */
    --focus-ring: 0 0 0 3px rgba(59, 130, 246, 0.45);
}

/* Mode Malam */
[data-theme="dark"] {
    --card-bg: #1e1e1e;
    --card-border: 1px solid #2e2e2e;
    --card-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    --accent: #ffffff;
    --accent-hover: #e2e8f0;
    --accent-text: #0f172a;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --text-light: #64748b;
    --bg: #141414;
    --bg-soft: #1e1e1e;
    --border-color: #2e2e2e;
    --footer-bg: #141414;
}

/* ─── Reset & Base ───────────────────────────────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Google Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: background var(--transition), color var(--transition);
}

img {
    display: block;
    max-width: 100%;
}

a {
    color: inherit;
}

button {
    font-family: inherit;
}

/* Global focus-visible */
:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
    border-radius: var(--radius-sm);
}

/* ─── Header ─────────────────────────────────────────────────────────────── */
header {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--header-h);
}

/*
 * PENTING: backdrop-filter dipindah ke ::before agar tidak menjadi
 * "containing block" untuk position:fixed children (nav drawer).
 * Jika backdrop-filter ada di element induk, position:fixed anak-anaknya
 * akan terkunci relatif terhadap elemen tersebut, bukan viewport.
 */
header::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    z-index: -1;
    transition: background var(--transition), border-color var(--transition);
}

[data-theme="dark"] header::before {
    background: rgba(20, 20, 20, 0.9);
}

header .container {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 24px;
    height: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.left-header {
    display: flex;
    align-items: center;
    gap: 32px;
}

.right-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Logo */
.logo {
    font-weight: 900;
    font-size: 1.35em;
    letter-spacing: -0.5px;
    color: var(--accent);
    text-decoration: none;
    transition: opacity var(--transition);
}

.logo:hover {
    opacity: 0.7;
}

/* Nav */
nav {
    display: flex;
    gap: 4px;
}

nav a {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9em;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    transition: color var(--transition), background var(--transition);
}

nav a:hover {
    color: var(--accent);
    background: var(--bg-soft);
}

nav a.active {
    color: var(--accent);
    font-weight: 700;
    background: var(--bg-soft);
}

/* ─── Search ─────────────────────────────────────────────────────────────── */
.search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 12px;
    font-size: 1.1em;
    color: var(--text-light);
    pointer-events: none;
    z-index: 1;
}

.search-box {
    padding: 8px 16px 8px 36px;
    border: var(--card-border);
    border-radius: 20px;
    outline: none;
    font-family: inherit;
    font-size: 0.88em;
    background: var(--bg-soft);
    color: var(--text);
    width: 200px;
    transition: border-color var(--transition), width var(--transition), background var(--transition);
}

.search-box:focus {
    border-color: var(--accent);
    width: 260px;
    background: var(--card-bg);
}

/* Search dropdown */
.search-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--card-bg);
    border: var(--card-border);
    border-radius: var(--radius-sm);
    box-shadow: var(--card-shadow);
    z-index: 200;
    overflow: hidden;
    max-height: 320px;
    overflow-y: auto;
}

.search-results[hidden] {
    display: none;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background var(--transition);
    font-size: 0.9em;
    border-bottom: var(--card-border);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover,
.search-result-item[aria-selected="true"] {
    background: var(--bg-soft);
}

.search-result-item img {
    width: 32px;
    height: 48px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
}

.search-result-item span {
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-empty {
    padding: 14px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.88em;
}

/* ─── Hamburger ──────────────────────────────────────────────────────────── */
.menu-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: none;
    border: none;
    padding: 6px;
    border-radius: var(--radius-sm);
    color: var(--text);
    transition: background var(--transition), color var(--transition);
}

.menu-toggle:hover {
    background: var(--bg-soft);
}

.menu-toggle .material-icons {
    font-size: 22px;
}

/* ─── Nav Overlay (Mobile Drawer Backdrop) ───────────────────────────────── */
#nav-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 98;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    cursor: pointer;
}

#nav-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* ─── Dark Mode Button ───────────────────────────────────────────────────── */
.btn-dark-mode {
    background: var(--bg-soft);
    border: var(--card-border);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1em;
    color: var(--text);
    transition: background var(--transition), transform var(--transition), border-color var(--transition);
    flex-shrink: 0;
}

.btn-dark-mode:hover {
    background: var(--border-color);
    transform: rotate(20deg);
}

/* ─── Main Layout ────────────────────────────────────────────────────────── */
main {
    max-width: var(--max-w);
    width: 100%;
    margin: 0 auto;
    padding: 32px 24px 60px;
    flex-grow: 1;
}

/* ─── Loading Skeleton ───────────────────────────────────────────────────── */
@keyframes shimmer {
    0% {
        background-position: -600px 0;
    }

    100% {
        background-position: 600px 0;
    }
}

.skeleton {
    background: linear-gradient(90deg,
            var(--bg-soft) 25%,
            var(--border-color) 50%,
            var(--bg-soft) 75%);
    background-size: 600px 100%;
    animation: shimmer 1.4s infinite linear;
    border-radius: var(--radius-sm);
}

.skeleton-hero {
    height: 420px;
    border-radius: 20px;
}

.skeleton-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 20px;
}

.skeleton-card {
    aspect-ratio: 2 / 3;
    border-radius: 12px;
}

.skeleton-detail {
    display: flex;
    gap: 24px;
}

.skeleton-detail-left {
    width: 280px;
    flex-shrink: 0;
    height: 420px;
    border-radius: var(--radius);
}

.skeleton-detail-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.skeleton-line {
    border-radius: 4px;
}

/* ─── Error Page ─────────────────────────────────────────────────────────── */
.error-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 80px 24px;
    min-height: 40vh;
    gap: 16px;
}

.error-code {
    font-size: clamp(4em, 12vw, 8em);
    font-weight: 900;
    letter-spacing: -4px;
    color: var(--text-light);
    line-height: 1;
}

.error-msg {
    font-size: 1.1em;
    color: var(--text-muted);
    max-width: 360px;
}

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 12px 28px;
    background: var(--accent);
    color: var(--accent-text);
    border: none;
    border-radius: 50px;
    font-size: 0.95em;
    font-weight: 700;
    cursor: pointer;
    transition: background var(--transition), transform var(--transition);
    text-decoration: none;
    margin-top: 8px;
}

.btn-back:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
}

/* ─── Hero Section ───────────────────────────────────────────────────────── */
.hero {
    position: relative;
    overflow: hidden;
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 48px;
    align-items: center;
    padding: 80px 60px;
    background: linear-gradient(160deg, var(--card-bg) 0%, var(--bg-soft) 100%);
    border-radius: 20px;
    border: var(--card-border);
    min-height: 420px;
}

.hero::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 10% 50%, rgba(100, 100, 255, 0.05) 0%, transparent 55%),
        radial-gradient(circle at 90% 10%, rgba(255, 100, 100, 0.04) 0%, transparent 45%);
    pointer-events: none;
}

.hero-content {
    position: relative;
    text-align: left;
}

.hero h1 {
    font-size: clamp(1.8em, 4vw, 3.4em);
    font-weight: 900;
    letter-spacing: -2px;
    line-height: 1.05;
    margin-bottom: 20px;
    background: linear-gradient(135deg, #111 30%, #555);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    position: relative;
}

[data-theme="dark"] .hero h1 {
    background: linear-gradient(135deg, #fff 30%, #aaa);
    -webkit-background-clip: text;
    background-clip: text;
}

.hero p {
    font-size: clamp(0.95em, 1.8vw, 1.15em);
    color: var(--text-muted);
    max-width: 480px;
    margin: 0 0 36px;
    line-height: 1.7;
    position: relative;
}

/* Hero images */
.hero-images {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
    position: relative;
    height: 320px;
}

.hero-img {
    border-radius: 12px;
    object-fit: cover;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
    transition: transform var(--transition-slow);
    pointer-events: none;
}

.hero-img:nth-child(1) {
    width: 110px;
    height: 160px;
    transform: rotate(-6deg) translateY(20px);
}

.hero-img:nth-child(2) {
    width: 120px;
    height: 180px;
    transform: rotate(0deg);
    z-index: 2;
}

.hero-img:nth-child(3) {
    width: 110px;
    height: 160px;
    transform: rotate(6deg) translateY(20px);
}

.hero-images:hover .hero-img:nth-child(1) {
    transform: rotate(-10deg) translateY(10px) scale(1.04);
}

.hero-images:hover .hero-img:nth-child(2) {
    transform: scale(1.06);
}

.hero-images:hover .hero-img:nth-child(3) {
    transform: rotate(10deg) translateY(10px) scale(1.04);
}

/* CTA Button */
.btn-mulai {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--accent);
    color: var(--accent-text);
    border: none;
    padding: 16px 36px;
    font-size: 1em;
    font-weight: 700;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    transition: background var(--transition), transform var(--transition), box-shadow var(--transition), color var(--transition);
    position: relative;
}

.btn-mulai:hover {
    background: var(--accent-hover);
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.18);
}

.btn-mulai:active {
    transform: translateY(-1px);
}

/* Stats */
.hero-stats {
    display: flex;
    gap: 36px;
    margin-top: 40px;
    padding-top: 32px;
    border-top: 1px solid var(--border-color);
}

.stat-item {
    text-align: center;
}

.stat-value {
    font-size: 1.8em;
    font-weight: 900;
    letter-spacing: -1px;
    color: var(--accent);
    display: block;
}

.stat-label {
    font-size: 0.8em;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 2px;
    display: block;
}

/* Preserve newlines in text content */
.hero-content p,
.detail-synopsis p,
.grid-header p,
.content-box p {
    white-space: pre-line;
}

/* ─── Content Box (Tentang, Kontak) ──────────────────────────────────────── */
.content-box {
    background: var(--card-bg);
    padding: 48px;
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    border: var(--card-border);
}

.content-box h1 {
    font-size: 2em;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 16px;
}

.content-box p {
    color: var(--text-muted);
    line-height: 1.8;
    font-size: 1.05em;
}

/* Contact extras */
.content-box .contact-links {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 24px;
}

.contact-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--bg-soft);
    border: var(--card-border);
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.9em;
    text-decoration: none;
    color: var(--text);
    transition: background var(--transition), transform var(--transition);
}

.contact-link:hover {
    background: var(--border-color);
    transform: translateY(-2px);
}

/* ─── Blog / Grid Seri ───────────────────────────────────────────────────── */
.grid-header {
    margin-bottom: 24px;
}

.grid-header h1 {
    font-size: 1.8em;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.grid-header p {
    color: var(--text-muted);
    margin-top: 4px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 20px;
}

.grid-item {
    cursor: pointer;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    transition: transform var(--transition), box-shadow var(--transition);
}

.grid-item:hover {
    transform: translateY(-6px);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.15);
}

.grid-cover {
    width: 100%;
    aspect-ratio: 2 / 3;
    object-fit: cover;
    display: block;
}

/* Overlay info */
.grid-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 40px 12px 12px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, transparent 100%);
    border-radius: 0 0 12px 12px;
}

.grid-rating {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    color: #fff;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.75em;
    font-weight: 700;
    display: flex;
    align-items: center;
}

.grid-info h3 {
    font-size: 0.9em;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.grid-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.grid-genre {
    font-size: 0.72em;
    color: rgba(255, 255, 255, 0.75);
    font-weight: 500;
}

.grid-status {
    font-size: 0.68em;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
}

.status-tamat {
    background: #d1fae5;
    color: #065f46;
}

.status-berlangsung {
    background: #dbeafe;
    color: #1e40af;
}

[data-theme="dark"] .status-tamat {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
}

[data-theme="dark"] .status-berlangsung {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}

/* ─── Detail Seri ────────────────────────────────────────────────────────── */
.detail-layout {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

/* Left column (sticky sidebar) */
.detail-left {
    flex: 0 0 280px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    background: var(--card-bg);
    padding: 28px 20px;
    border-radius: var(--radius);
    border: var(--card-border);
    position: sticky;
    top: calc(var(--header-h) + 20px);
}

.cover-wrapper {
    position: relative;
    width: 100%;
}

.detail-cover {
    width: 100%;
    border-radius: 10px;
}

.trending-badge {
    display: inline-flex;
    align-items: center;
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    color: #fff;
    font-size: 0.7em;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    letter-spacing: 0.5px;
    margin-top: 8px;
    gap: 4px;
}

.detail-left h1 {
    font-size: 1.5em;
    font-weight: 800;
    text-align: center;
    letter-spacing: -0.5px;
    line-height: 1.2;
}

/* Info group wrapper (h1 + meta + badges) */
.detail-left-info {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.detail-meta {
    font-size: 0.82em;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.6;
}

.detail-badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
}

.badge {
    font-size: 0.75em;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    background: var(--bg-soft);
    color: var(--text-muted);
    border: var(--card-border);
}

.btn-start-reading {
    background: var(--accent);
    color: var(--accent-text);
    width: 100%;
    border: none;
    padding: 14px 20px;
    border-radius: 50px;
    font-size: 1em;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    transition: background var(--transition), transform var(--transition), color var(--transition);
}

.btn-start-reading:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
}

.plus-icon {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9em;
    font-weight: 700;
}

/* Right column */
.detail-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 0;
    overflow: hidden;
    width: 100%;
}

.detail-synopsis {
    background: var(--card-bg);
    border: var(--card-border);
    border-radius: var(--radius);
    padding: 24px 28px;
    font-size: 1em;
    line-height: 1.8;
}

.detail-synopsis h2 {
    font-size: 0.8em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-light);
    margin-bottom: 10px;
}

.detail-synopsis p {
    color: var(--text);
}

/* Discount Banner */
.right-top-banner {
    display: flex;
    gap: 12px;
    min-width: 0;
    overflow: hidden;
}

.discount-banner {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    background: linear-gradient(135deg, #f0f7ff, #e8f4ff);
    border: 1px solid #bfdbfe;
    border-radius: 12px;
    font-size: 0.88em;
    font-weight: 600;
    color: #1e40af;
    gap: 12px;
    flex-wrap: wrap;
    min-width: 0;
    overflow: hidden;
}

[data-theme="dark"] .discount-banner {
    background: linear-gradient(135deg, rgba(30, 64, 175, 0.2), rgba(30, 64, 175, 0.1));
    border-color: rgba(59, 130, 246, 0.3);
    color: #93c5fd;
}

.badge-purple {
    background: #7c3aed;
    color: #fff;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.8em;
    margin-right: 6px;
}

[data-theme="dark"] .badge-purple {
    background: rgba(124, 58, 237, 0.3);
    color: #c4b5fd;
}

.btn-unlock {
    background: #1e40af;
    color: #fff;
    border: none;
    padding: 8px 18px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.85em;
    cursor: pointer;
    white-space: nowrap;
    transition: background var(--transition);
}

.btn-unlock:hover {
    background: #1e3a8a;
}

[data-theme="dark"] .btn-unlock {
    background: #3b82f6;
    color: #eff6ff;
}

[data-theme="dark"] .btn-unlock:hover {
    background: #2563eb;
}

/* ─── Chapter List ───────────────────────────────────────────────────────── */
.chapters-section {
    background: var(--card-bg);
    border: var(--card-border);
    border-radius: var(--radius);
    overflow: hidden;
    min-width: 0;
    width: 100%;
}

.chapters-header {
    padding: 16px 20px;
    border-bottom: var(--card-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chapters-header h3 {
    font-size: 0.85em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
}

.chapter-list {
    list-style: none;
}

.chapter-list li a {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    gap: 16px;
    text-decoration: none;
    color: var(--text);
    border-bottom: var(--card-border);
    transition: background var(--transition);
}

.chapter-list li:last-child a {
    border-bottom: none;
}

.chapter-list li a:hover {
    background: var(--bg-soft);
}

.chap-thumb {
    width: 90px;
    height: 55px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    object-position: center top;
    flex-shrink: 0;
    background: var(--bg-soft);
}

.chap-info {
    flex: 1;
    min-width: 0;
}

.chap-title {
    font-weight: 600;
    color: var(--text);
    font-size: 0.95em;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chap-date {
    font-size: 0.8em;
    color: var(--text-light);
}

.chap-price {
    font-size: 0.85em;
    font-weight: 700;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

.chap-price.free {
    color: #059669;
    background: #d1fae5;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.78em;
}

[data-theme="dark"] .chap-price.free {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
}

/* ─── Manga Reader ───────────────────────────────────────────────────────── */
.manga-reader {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.manga-page {
    width: 720px;
    max-width: 100%;
    height: auto;
    display: block;
}

.chapter-nav {
    display: flex;
    justify-content: space-between;
    max-width: 100%;
    margin-top: 24px;
    gap: 8px;
}

.btn-nav-chap {
    flex: 1;
    background: var(--accent);
    color: var(--accent-text);
    border: none;
    padding: 12px 16px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9em;
    transition: background var(--transition), transform var(--transition), color var(--transition);
}

.btn-nav-chap:hover:not(:disabled) {
    background: var(--accent-hover);
    transform: translateY(-2px);
}

.btn-nav-chap:disabled {
    background: var(--bg-soft);
    color: var(--text-light);
    border: var(--card-border);
    cursor: not-allowed;
    opacity: 0.6;
}

/* ─── Footer ─────────────────────────────────────────────────────────────── */
footer {
    background: var(--footer-bg);
    padding: 0 24px;
    border-top: 1px solid var(--border-color);
    transition: background var(--transition), border-color var(--transition);
}

.footer-bar {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 18px 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.footer-copy {
    font-size: 0.82em;
    color: var(--text-muted);
}

/* ─── Responsive: 768px ──────────────────────────────────────────────────── */
@media (max-width: 768px) {
    main {
        padding: 24px 16px 50px;
    }

    header .container {
        padding: 0 16px;
    }

    .left-header {
        gap: 16px;
    }

    .logo {
        font-size: 1.2em;
    }

    /* Mobile nav: left side drawer */
    nav {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: var(--header-h);
        left: 0;
        bottom: 0;
        width: 280px;
        background: var(--card-bg);
        border-right: var(--card-border);
        box-shadow: 4px 0 40px rgba(0, 0, 0, 0.15);
        padding: 12px 0 32px;
        gap: 2px;
        z-index: 99;
        overflow-y: auto;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    nav.show {
        transform: translateX(0);
    }

    nav a {
        margin: 0 10px;
        border-radius: var(--radius-sm);
        padding: 13px 16px;
        font-size: 1em;
    }

    .menu-toggle {
        display: flex;
    }

    /* Collapsed search on mobile */
    .search-box {
        width: 38px;
        padding-left: 38px;
        padding-right: 0;
        color: transparent;
        background: transparent;
        border-color: transparent;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }

    .search-box::placeholder {
        color: transparent;
    }

    .search-box:focus {
        width: 150px;
        padding-left: 34px;
        padding-right: 12px;
        color: var(--text);
        background: var(--bg-soft);
        border-color: var(--accent);
        cursor: text;
    }

    /* Hero: single column */
    .hero {
        grid-template-columns: 1fr;
        padding: 48px 24px 40px;
        text-align: center;
    }

    .hero p {
        margin: 0 auto 32px;
    }

    .hero-images {
        display: none;
    }

    .hero-stats {
        justify-content: center;
        gap: 24px;
    }

    /* Grid 3 columns on mobile */
    .grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .grid-info {
        padding: 30px 8px 10px;
    }

    .grid-info h3 {
        font-size: 0.8em;
        margin-bottom: 2px;
    }

    .grid-rating {
        font-size: 0.65em;
        padding: 2px 6px;
        top: 6px;
        right: 6px;
    }

    /* Detail: horizontal card layout */
    .detail-layout {
        flex-direction: column;
    }

    .detail-left {
        flex: none;
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        /* memungkinkan btn turun ke baris baru */
        align-items: flex-start;
        gap: 16px 20px;
        position: static;
        padding: 20px;
        top: 0;
    }

    .cover-wrapper {
        width: 130px;
        flex-shrink: 0;
    }

    /* Info kolom: tumbuh mengisi sisa ruang di sebelah cover */
    .detail-left-info {
        flex: 1;
        min-width: 0;
        /* cegah overflow di flex child */
        align-items: flex-start;
        gap: 8px;
    }

    .detail-left h1 {
        font-size: 1.2em;
        text-align: left;
    }

    .detail-meta {
        text-align: left;
    }

    .detail-badges {
        justify-content: flex-start;
    }

    /* Tombol turun ke baris baru, full-width */
    .btn-start-reading {
        flex-basis: 100%;
        order: 10;
    }

    .discount-banner {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }

    .btn-unlock {
        width: 100%;
    }

    .detail-synopsis {
        padding: 18px 16px;
    }

    .detail-right {
        width: 100%;
    }

    .content-box {
        padding: 28px 20px;
    }

    .chapter-nav {
        flex-direction: column;
    }

    /* Skeleton responsive */
    .skeleton-detail {
        flex-direction: column;
    }

    .skeleton-detail-left {
        width: 100%;
        height: 200px;
    }
}

/* ─── Responsive: 480px (HP kecil, portrait) ────────────────────────────── */
@media (max-width: 480px) {

    /* Detail: kembali ke stack vertikal, cover di tengah */
    .detail-left {
        flex-direction: column;
        align-items: center;
        padding: 20px 16px;
        gap: 16px;
    }

    .cover-wrapper {
        width: 160px;
    }

    .detail-left-info {
        width: 100%;
        align-items: center;
    }

    .detail-left h1 {
        text-align: center;
        font-size: 1.25em;
    }

    .detail-meta {
        text-align: center;
    }

    .detail-badges {
        justify-content: center;
    }

    /* Reset agar btn tidak ter-push oleh flex-wrap */
    .btn-start-reading {
        flex-basis: auto;
        order: 0;
        width: 100%;
    }
}

/* ─── Responsive: 540px ──────────────────────────────────────────────────── */
@media (max-width: 540px) {
    .hero-stats {
        gap: 16px;
        flex-wrap: wrap;
    }

    .stat-value {
        font-size: 1.4em;
    }

    .btn-nav-chap {
        padding: 10px;
        font-size: 0.85em;
    }

    .chap-thumb {
        width: 70px;
        height: 44px;
    }

    .right-top-banner {
        flex-direction: column;
    }

    .chapters-section {
        border-radius: var(--radius-sm);
    }

    .chapter-list li a {
        padding: 12px 14px;
        gap: 10px;
    }

    .skeleton-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
}

/* ─── Animasi ────────────────────────────────────────────────────────────── */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}
