/* ==========================================================================
   Dex Manhwa - Deep Teal & Amber Theme
   Dark, matte, non-glowing. Accents sit on opposite sides of the colour
   wheel (teal hue 191, amber hue 39 — 152 deg apart) so they read as a
   complementary pair. No bloom, no neon, no glow shadows.
   ========================================================================== */

:root {
    /* Dark Matte Palette */
    --bg-void: #07090c;
    --bg-base: #07090c;
    --bg-surface: #0c1116;
    --bg-card: #0f151b;
    --bg-card-hover: #141d25;
    --bg-card-glass: rgba(15, 21, 27, 0.85);
    --bg-input: #0c1116;

    /* Complementary accents: deep teal + warm amber */
    --accent-primary: #1c8ca5;            /* Deep Teal */
    --accent-primary-hover: #22a3c0;
    --accent-teal-rgb: 28, 140, 165;
    --accent-subtle: rgba(28, 140, 165, 0.12);

    --accent-secondary: #d99413;          /* Warm Amber (complement) */
    --accent-secondary-hover: #e8a92c;
    --accent-amber-rgb: 217, 148, 19;
    --accent-secondary-subtle: rgba(217, 148, 19, 0.12);

    --accent-crimson: #b8671a;            /* Burnt amber, legacy token */
    --accent-crimson-hover: #d17d24;
    --accent-crimson-rgb: 184, 103, 26;
    --accent-crimson-subtle: rgba(184, 103, 26, 0.12);

    /* Text Colors */
    --text-pure: #ffffff;
    --text-primary: #e6edf0;
    --text-secondary: #93a3ac;
    --text-muted: #6a7983;

    /* Borders */
    --border-subtle: #1a232b;
    --border-card: rgba(28, 140, 165, 0.16);
    --border-hover: rgba(28, 140, 165, 0.42);

    /* Radii & Shadows */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    /* Matte shadows: depth only, zero colour bloom. */
    --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 8px 28px rgba(0, 0, 0, 0.65);
    --shadow-glow: 0 2px 8px rgba(0, 0, 0, 0.55);
    --shadow-crimson-glow: 0 2px 8px rgba(0, 0, 0, 0.55);

    --transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Reset & Root Setup */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    color-scheme: dark;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-void);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    background-image: 
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(28, 140, 165, 0.055), transparent 70%),
        radial-gradient(ellipse 60% 40% at 85% 15%, rgba(217, 148, 19, 0.035), transparent 60%);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
}

/* Custom Webtoon Scrollbar */
::-webkit-scrollbar {
    width: 7px;
    height: 7px;
}

::-webkit-scrollbar-track {
    background: var(--bg-void);
}

::-webkit-scrollbar-thumb {
    background: #1a232b;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
}

.container {
    width: 100%;
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Top Reading Progress Bar */
.reading-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-crimson), var(--accent-primary), var(--accent-secondary));
    width: 0%;
    z-index: 99999;
    box-shadow: 0 0 0 1px rgba(28, 140, 165, 0.5);
    transition: width 0.1s ease-out;
}

/* ==========================================================================
   Header (Hidden in Reader Mode)
   ========================================================================== */

header {
    background: var(--bg-void);
    /* No backdrop-filter: a blurred sticky backdrop is recomputed on every
       scroll frame, which makes the wordmark visibly swim even though its box
       never moves. An opaque header is rock-steady while scrolling. */
    border-bottom: 1px solid var(--border-subtle);
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: var(--transition);
}

header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

/* Header nav (Status / Report Issue) */
.header-nav {
    display: flex;
    align-items: center;
    gap: 22px;
}

.header-nav a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.86rem;
    font-weight: 600;
    letter-spacing: 0.2px;
    white-space: nowrap;
    transition: color 0.2s ease;
}

.header-nav a:hover {
    color: var(--accent-primary-hover);
}

/* Legal / status pages */
.page-wrap {
    max-width: 860px;
    margin: 0 auto;
    padding: 40px 24px 20px;
}

.page-wrap h1 {
    font-size: 1.9rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 6px;
}

.page-updated {
    color: var(--text-muted);
    font-size: 0.82rem;
    margin-bottom: 28px;
}

.legal-section {
    margin-bottom: 30px;
}

.legal-section h2 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--accent-primary-hover);
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-subtle);
}

.legal-section h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 18px 0 8px;
}

.legal-section p,
.legal-section li {
    color: var(--text-secondary);
    font-size: 0.93rem;
    line-height: 1.75;
    margin-bottom: 10px;
}

.legal-section ul {
    padding-left: 20px;
    margin-bottom: 12px;
}

.legal-section a {
    color: var(--accent-primary-hover);
    text-decoration: underline;
}

.callout {
    background: var(--bg-surface);
    border: 1px solid var(--border-card);
    border-left: 3px solid var(--accent-secondary);
    border-radius: var(--radius-sm);
    padding: 16px 18px;
    margin: 20px 0;
}

.callout p {
    margin-bottom: 6px;
    color: var(--text-primary);
}

.callout p:last-child {
    margin-bottom: 0;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
}

.status-badge .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

.status-badge.up {
    background: var(--accent-subtle);
    color: var(--accent-primary-hover);
    border: 1px solid var(--accent-primary);
}

.status-badge.down {
    background: var(--accent-secondary-subtle);
    color: var(--accent-secondary-hover);
    border: 1px solid var(--accent-secondary);
}

.service-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    margin-bottom: 10px;
}

.service-row .svc-name {
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--text-primary);
}

.service-row .svc-note {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 2px;
    /* hostnames and long notes must be allowed to break, otherwise they
       push the status badge past the edge on narrow phones */
    overflow-wrap: anywhere;
    word-break: break-word;
}

.service-row > div:first-child {
    min-width: 0;
}

.report-form {
    background: var(--bg-surface);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-lg);
    padding: 22px;
}

.form-row {
    margin-bottom: 16px;
}

.form-row label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.form-row input[type="text"],
.form-row input[type="email"],
.form-row input[type="url"],
.form-row select,
.form-row textarea {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 10px 12px;
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color 0.2s ease;
}

.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.form-row textarea {
    min-height: 130px;
    resize: vertical;
}

.form-note {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 4px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text-pure);
}

.logo-icon {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    overflow: hidden;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 0 1px rgba(28, 140, 165, 0.35), var(--shadow-crimson-glow);
    transition: var(--transition);
    flex-shrink: 0;
}

.logo-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.logo:hover .logo-icon {
    transform: scale(1.08);
    box-shadow: 0 0 0 1px var(--accent-primary);
}

.logo-text {
    font-size: 1.45rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.logo-text span {
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-badge {
    background: rgba(28, 140, 165, 0.12);
    border: 1px solid rgba(28, 140, 165, 0.3);
    color: var(--accent-primary-hover);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 1px;
    margin-left: 6px;
    vertical-align: middle;
}

.header-stats {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    background: var(--bg-surface);
    padding: 6px 16px;
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-subtle);
}

.header-stats strong {
    color: var(--accent-primary-hover);
}

/* ==========================================================================
   Home: Manhwa Spotlight Hero & Controls
   ========================================================================== */

/* Spotlight Hero Banner */
.spotlight-hero {
    position: relative;
    border-radius: var(--radius-xl);
    overflow: hidden;
    margin: 28px 0 36px;
    border: 1px solid var(--border-card);
    background: var(--bg-card);
    box-shadow: var(--shadow-md);
    display: grid;
    grid-template-columns: 1fr 340px;
    min-height: 380px;
}

.spotlight-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center 25%;
    filter: blur(28px) brightness(0.22);
    transform: scale(1.15);
    z-index: 1;
    pointer-events: none;
}

.spotlight-vignette {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, rgba(7, 9, 15, 0.95) 0%, rgba(7, 9, 15, 0.6) 60%, rgba(7, 9, 15, 0.85) 100%);
    z-index: 2;
}

.spotlight-content {
    position: relative;
    z-index: 3;
    padding: 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.spotlight-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, rgba(217, 148, 19, 0.2), rgba(28, 140, 165, 0.2));
    border: 1px solid rgba(217, 148, 19, 0.4);
    color: #e8a92c;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    padding: 6px 14px;
    border-radius: var(--radius-xl);
    width: fit-content;
    margin-bottom: 16px;
}

.spotlight-title {
    font-size: 2.3rem;
    font-weight: 900;
    color: var(--text-pure);
    letter-spacing: -0.5px;
    line-height: 1.2;
    margin-bottom: 14px;
    text-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
}

.spotlight-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.spotlight-meta span {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.spotlight-meta strong {
    color: var(--accent-secondary);
}

.spotlight-desc {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 24px;
    max-width: 580px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.spotlight-actions {
    display: flex;
    gap: 14px;
}

.spotlight-cover-side {
    position: relative;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px;
}

.spotlight-cover-art {
    width: 200px;
    aspect-ratio: 1 / 1.45;
    border-radius: var(--radius-lg);
    object-fit: cover;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.8);
    border: 2px solid rgba(28, 140, 165, 0.3);
    transform: perspective(1000px) rotateY(-8deg);
    transition: transform 0.4s ease;
}

/* Rotate back on hover but do NOT scale: scaling forces a resample from a
   lower-resolution mip and softens the cover. Rotation alone is a compositor
   transform that keeps the original bitmap crisp. */
.spotlight-hero:hover .spotlight-cover-art {
    transform: perspective(1000px) rotateY(0deg);
}

/* Home Search & Filters */
.home-controls {
    margin: 20px 0 28px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.search-box-wrapper {
    position: relative;
    width: 100%;
}

.search-icon {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.15rem;
    color: var(--text-muted);
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 18px 50px 18px 54px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    color: var(--text-pure);
    font-size: 1.05rem;
    font-family: inherit;
    outline: none;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.search-input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 4px var(--accent-subtle), var(--shadow-glow);
    background: var(--bg-surface);
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-clear-btn {
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    font-size: 0.9rem;
    cursor: pointer;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
}

.search-clear-btn:hover {
    color: var(--text-pure);
    border-color: var(--accent-primary);
}

.filter-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.genre-tags {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.genre-chip {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    padding: 7px 16px;
    border-radius: var(--radius-xl);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.genre-chip:hover {
    border-color: var(--accent-primary);
    color: var(--text-pure);
    background: var(--bg-card);
}

.genre-chip.active {
    background: linear-gradient(135deg, var(--accent-primary) 0%, #1c8ca5 100%);
    border-color: var(--accent-primary-hover);
    color: #fff;
    box-shadow: 0 2px 14px rgba(0,0,0,0.55);
}

.sort-select-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.sort-select {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    padding: 8px 14px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    outline: none;
    cursor: pointer;
    transition: var(--transition);
}

.sort-select:focus {
    border-color: var(--accent-primary);
}

/* Continue Reading Strip */
.continue-reading-section {
    margin-bottom: 36px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}

.section-title {
    font-size: 1.25rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-pure);
    letter-spacing: -0.3px;
}

.continue-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.continue-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 12px;
    text-decoration: none;
    color: var(--text-primary);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.continue-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--accent-primary);
}

.continue-card:hover {
    border-color: var(--accent-primary);
    background: var(--bg-card-hover);
    transform: translateY(-3px);
    box-shadow: var(--shadow-glow);
}

.continue-thumb {
    width: 60px;
    height: 82px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    background: var(--bg-surface);
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}

.continue-info {
    flex: 1;
    min-width: 0;
}

.continue-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-pure);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.continue-chapter {
    font-size: 0.82rem;
    color: var(--accent-primary-hover);
    font-weight: 700;
    margin-bottom: 6px;
}

.continue-resume-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #fff;
    background: rgba(28, 140, 165, 0.25);
    border: 1px solid rgba(28, 140, 165, 0.4);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
}

/* ==========================================================================
   Manhwa Cards Grid
   ========================================================================== */

.series-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 16px;
    margin-bottom: 50px;
}

.series-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    text-decoration: none;
    color: var(--text-primary);
    border: 1px solid var(--border-card);
    transition: var(--transition);
    position: relative;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
}

.series-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-hover);
}

.series-card-image {
    position: relative;
    padding-top: 142%;
    overflow: hidden;
    background: var(--bg-surface);
}

.series-card-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* No transform transition here: scaling an already-downscaled bitmap makes
       Chrome resample from a lower-resolution mip, which softens every edge
       (visible on Windows displays at dpr 1.25-1.5). The card lift + glow
       below carry the hover feedback instead, so the artwork stays crisp. */
}

/* Hover feedback: lift + glow on the CARD only, image stays pixel-exact. */

/* Card Badges */
.card-top-badges {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 2;
    pointer-events: none;
}

.series-rank-badge {
    background: rgba(4, 5, 8, 0.88);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 800;
    padding: 3px 7px;
    border-radius: var(--radius-sm);
}

.series-card-badge {
    background: linear-gradient(135deg, var(--accent-crimson), #d17d24);
    color: #fff;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

.series-card-content {
    padding: 16px;
    display: flex;
    flex-direction: column;
    flex: 1;
    justify-content: space-between;
}

.series-card-title {
    font-size: 0.98rem;
    font-weight: 800;
    margin-bottom: 8px;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--text-pure);
}

.series-card-tags {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.card-mini-tag {
    font-size: 0.68rem;
    color: var(--text-secondary);
    background: var(--bg-surface);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
}

.series-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-top: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 10px;
}

.series-card-source {
    text-transform: uppercase;
    font-size: 0.65rem;
    font-weight: 800;
    color: var(--accent-secondary);
    background: rgba(217, 148, 19, 0.08);
    border: 1px solid rgba(217, 148, 19, 0.2);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
}

/* ==========================================================================
   Series Detail View
   ========================================================================== */

.series-detail-hero {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin: 16px 0 24px;
    border: 1px solid var(--border-card);
    background: var(--bg-card);
    box-shadow: var(--shadow-md);
}

.hero-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: blur(40px) brightness(0.2);
    transform: scale(1.2);
    z-index: 1;
    pointer-events: none;
}

.hero-content {
    position: relative;
    z-index: 2;
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 18px;
    padding: 18px;
}

.series-cover-wrapper {
    width: 100%;
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.8);
    border: 2px solid rgba(28, 140, 165, 0.3);
    aspect-ratio: 1 / 1.45;
    background: var(--bg-surface);
}

.series-cover-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.series-info {
    display: flex;
    flex-direction: column;
}

.series-info h1 {
    font-size: 1.4rem;
    font-weight: 900;
    line-height: 1.2;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
    color: var(--text-pure);
}

.series-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: var(--radius-md);
    font-size: 0.82rem;
    font-weight: 700;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}

.badge.accent {
    background: linear-gradient(135deg, var(--accent-primary) 0%, #1c8ca5 100%);
    border-color: var(--accent-primary-hover);
    color: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.55);
}

.badge.crimson {
    background: linear-gradient(135deg, var(--accent-crimson) 0%, #d17d24 100%);
    border-color: var(--accent-crimson);
    color: #fff;
    box-shadow: var(--shadow-crimson-glow);
}

.badge.source {
    color: var(--accent-secondary);
    border-color: rgba(217, 148, 19, 0.3);
    background: rgba(217, 148, 19, 0.08);
}

.series-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    outline: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-crimson) 0%, #d17d24 100%);
    color: #fff;
    box-shadow: var(--shadow-crimson-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.55);
}

.btn-secondary {
    background: var(--bg-surface);
    border: 1px solid var(--border-card);
    color: var(--text-pure);
}

.btn-secondary:hover {
    border-color: var(--accent-primary);
    background: var(--bg-card);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.series-description {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-top: auto;
    max-height: 140px;
    overflow-y: auto;
}

/* Chapter Section */
.chapter-section {
    margin-bottom: 60px;
}

.chapter-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
    flex-wrap: wrap;
}

.chapter-count-title {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-pure);
}

.chapter-filters {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chapter-search-input {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    color: var(--text-pure);
    padding: 9px 16px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    outline: none;
    width: 180px;
    transition: var(--transition);
}

.chapter-search-input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-subtle);
}

.sort-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    padding: 9px 16px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
}

.sort-btn:hover {
    color: var(--text-pure);
    border-color: var(--accent-primary);
}

.chapter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(185px, 1fr));
    gap: 12px;
}

.chapter-item {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    padding: 14px 18px;
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.chapter-item:hover {
    border-color: var(--accent-primary);
    background: var(--bg-card-hover);
    transform: translateX(4px);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.4);
}

.chapter-item.read {
    opacity: 0.6;
    background: var(--bg-surface);
}

.chapter-item.read::after {
    content: '✓ READ';
    font-size: 0.68rem;
    color: var(--accent-secondary);
    font-weight: 800;
}

.chapter-number {
    font-weight: 800;
    font-size: 0.95rem;
    color: var(--text-pure);
}

.chapter-item:hover .chapter-number {
    color: var(--accent-primary-hover);
}

/* ==========================================================================
   Chapter Reader View - Pure OLED Immersive Distraction-Free
   NO HOVER DISTRACTIONS, AUTO-HIDING NAV BARS
   ========================================================================== */

body.in-reader {
    background: #000000 !important;
    background-image: none !important;
}

/* Hide site header and footer in reader mode */
body.in-reader header,
body.in-reader footer {
    display: none !important;
}

.reader-wrapper {
    position: relative;
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #000000;
}

/* Auto-hiding / Floating Reader Top Bar */
.reader-top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100vw;
    z-index: 1000;
    background: rgba(7, 9, 15, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(28, 140, 165, 0.2);
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    transform: translateY(0);
    transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.7);
}

/* When scrolling down to read, smoothly hide top bar */
.reader-top-bar.nav-hidden {
    transform: translateY(-100%);
    pointer-events: none;
}

.reader-breadcrumbs {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 40%;
}

.reader-breadcrumbs a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 700;
    transition: var(--transition);
}

.reader-breadcrumbs a:hover {
    color: var(--accent-primary-hover);
}

.reader-breadcrumbs .sep {
    color: var(--text-muted);
}

.reader-left-cluster {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

/* Home button in reader top bar (kept outside .reader-breadcrumbs so it
   survives the mobile rule that hides the breadcrumb trail) */
.reader-home-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    padding: 5px 12px;
    border: 1px solid var(--border-card);
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    color: var(--text-pure) !important;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.85rem;
    transition: var(--transition);
}

.reader-home-btn:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: #fff !important;
}

.reader-home-btn .home-glyph {
    font-size: 1rem;
    line-height: 1;
}

.reader-controls-cluster {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    max-width: 100%;
}

.chapter-select {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    color: var(--text-pure);
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    outline: none;
    cursor: pointer;
    max-width: 180px;
}

.chapter-select:focus {
    border-color: var(--accent-primary);
}

.reader-nav-btn {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    color: var(--text-pure);
    padding: 7px 16px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;          /* keep "◀ Prev" on one line on phones */
    flex-shrink: 0;
}

.reader-nav-btn:hover:not(.disabled) {
    background: var(--accent-crimson);
    border-color: var(--accent-crimson);
    color: #fff;
    box-shadow: var(--shadow-crimson-glow);
}

.reader-nav-btn.disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

/* Home button in the bottom navigation row */
.reader-home-btn-solid {
    background: var(--bg-surface);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.reader-home-btn-solid:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: #fff;
    box-shadow: none;
}

.reader-home-btn-solid .home-glyph {
    font-size: 1rem;
    line-height: 1;
}

/* Always-reachable floating Home button */
.floating-home-btn {
    text-decoration: none;
    font-size: 1.25rem;
    line-height: 1;
}

/* Compact chapter bar (bottom of the reader).
   Replaces the earlier oversized side arrows, which read as two chapter
   covers pinned to the screen edges. This is a slim horizontal strip:
   Prev • [2 before] [current] [3 after] • Next. */
.chapter-nav-bar {
    width: 100%;
    max-width: 850px;
    margin: 28px auto 0;
    padding: 10px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow-md);
}

.cnav-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    padding: 8px 14px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 700;
    transition: var(--transition);
}

.cnav-btn:hover:not(.disabled) {
    background: var(--accent-crimson);
    border-color: var(--accent-crimson);
    color: #fff;
    box-shadow: var(--shadow-crimson-glow);
}

.cnav-btn.disabled {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}

.cnav-arrow {
    font-size: 1.05rem;
    line-height: 1;
    font-weight: 700;
}

/* The numbered chapter chips. */
.cnav-jump {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
    min-width: 0;
}

.cnav-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 30px;
    padding: 0 8px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 700;
    text-decoration: none;
    transition: var(--transition);
}

.cnav-before,
.cnav-after {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}

.cnav-before:hover,
.cnav-after:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: #fff;
}

.cnav-before { opacity: 0.8; }
.cnav-after  { opacity: 1; }

/* Current chapter is not a link — highlighted, not clickable. */
.cnav-current {
    background: linear-gradient(135deg, var(--accent-primary) 0%, #1c8ca5 100%);
    color: #fff;
    cursor: default;
    box-shadow: var(--shadow-crimson-glow);
}

/* On phones the chip row wraps instead of pushing the bar sideways. */
@media (max-width: 700px) {
    .chapter-nav-bar {
        flex-wrap: wrap;
        justify-content: center;
        padding: 10px;
    }
    .cnav-jump {
        order: -1;
        flex: 1 1 100%;
        justify-content: center;
        gap: 4px;
        margin-bottom: 4px;
    }
    .cnav-num {
        min-width: 32px;
        height: 26px;
        font-size: 0.74rem;
        padding: 0 6px;
    }
    .cnav-btn {
        flex: 1 1 auto;
        justify-content: center;
    }
}

.floating-home-btn:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: #fff;
}

/* Reader Settings Toolbar */
.reader-settings-bar {
    width: 100%;
    max-width: 850px;
    margin: 64px auto 16px; /* give clearance under top bar */
    padding: 10px 18px;
    background: rgba(12, 17, 22, 0.88);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    font-size: 0.82rem;
    color: var(--text-secondary);
    flex-wrap: wrap;
    backdrop-filter: blur(10px);
}

.setting-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.setting-btn {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    padding: 5px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.setting-btn:hover {
    color: var(--text-pure);
    border-color: var(--accent-primary);
}

.setting-btn.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary-hover);
    color: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.55);
}

/* ==========================================================================
   STRICT NO-HOVER RULES ON READING MANHWA PANELS
   ========================================================================== */

.reader-canvas {
    width: 100%;
    max-width: 850px;
    display: flex;
    flex-direction: column;
    margin: 0 auto;
    background: #000000 !important;
    padding: 0;
    outline: none !important;
    border: none !important;
}

.page-wrapper {
    position: relative;
    width: 100%;
    min-height: 400px;
    background: #000000 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none !important;
    outline: none !important;
    padding: 0 !important;
    margin: 0 !important;
    transition: none !important;
    transform: none !important;
    box-shadow: none !important;
}

.page-wrapper.loaded {
    min-height: auto;
    background: #000000 !important;
}

/* Absolutely NO hover styles on reading images */
.page-image,
.reader-canvas img {
    width: 100%;
    height: auto;
    display: block;
    user-select: none;
    -webkit-user-select: none;
    vertical-align: middle;
    pointer-events: none !important;     /* Disables hover triggers completely */
    transition: none !important;         /* No animations on hover */
    transform: none !important;          /* No scale/movement */
    box-shadow: none !important;         /* No glow on image */
    outline: none !important;
    border: none !important;
}

.page-wrapper:hover,
.page-wrapper:hover img,
.reader-canvas:hover,
.reader-canvas:hover img {
    transform: none !important;
    box-shadow: none !important;
    border: none !important;
    outline: none !important;
}

/* Skeleton Loading Shimmer */
.page-skeleton {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(90deg, #090b12 0%, #141d25 50%, #090b12 100%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    color: var(--text-muted);
    font-size: 0.85rem;
    gap: 12px;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Page Error / Retry Overlay */
.page-error {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    min-height: 260px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    background: #090a10;
    border: 1px dashed rgba(217, 148, 19, 0.3);
    padding: 24px;
    text-align: center;
}

.retry-btn {
    background: linear-gradient(135deg, var(--accent-crimson), #d17d24);
    color: #fff;
    border: none;
    padding: 9px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    cursor: pointer;
    font-weight: 700;
    box-shadow: var(--shadow-crimson-glow);
}

.retry-btn:hover {
    transform: translateY(-2px);
}

/* Reader Bottom Navigation */
.reader-bottom-nav {
    width: 100%;
    max-width: 850px;
    margin: 40px auto;
    padding: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    box-shadow: var(--shadow-md);
}

/* Floating Actions (Hides on Scroll Down) */
.floating-actions {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 999;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.floating-actions.hidden {
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
}

/* Hide only the scroll-to-top button; the Home button stays reachable */
.floating-btn.hidden {
    display: none;
}

.floating-btn {
    width: 46px;
    height: 46px;
    background: rgba(12, 17, 22, 0.92);
    border: 1px solid var(--border-card);
    color: var(--text-pure);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    backdrop-filter: blur(10px);
}

.floating-btn:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
    transform: translateY(-3px);
}

/* Breadcrumbs */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 20px 0;
    font-size: 0.88rem;
    color: var(--text-secondary);
}

.breadcrumb a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
}

.breadcrumb a:hover {
    color: var(--accent-primary-hover);
}

.breadcrumb-separator {
    color: var(--text-muted);
}

/* Loaders & State Messages */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 90px 20px;
    color: var(--text-secondary);
    gap: 16px;
}

.loading-spinner {
    width: 46px;
    height: 46px;
    border: 3px solid rgba(28, 140, 165, 0.15);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.6);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.empty-state {
    text-align: center;
    padding: 70px 20px;
    color: var(--text-muted);
    grid-column: 1 / -1;
}

.empty-state-icon {
    font-size: 3.2rem;
    margin-bottom: 12px;
}

.error-message {
    text-align: center;
    padding: 70px 20px;
    color: var(--accent-crimson);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

/* Footer */
footer {
    background: var(--bg-surface);
    border-top: 1px solid var(--border-subtle);
    padding: 36px 0;
    margin-top: auto;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

footer a {
    color: var(--accent-primary-hover);
    text-decoration: none;
    font-weight: 600;
}

footer a:hover {
    text-decoration: underline;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px 22px;
    margin-bottom: 18px;
}

.footer-links a {
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.85rem;
}

.footer-links a:hover {
    color: var(--accent-primary-hover);
}

/* Responsive adjustments */
@media (max-width: 900px) {
    .spotlight-hero {
        grid-template-columns: 1fr;
    }
    .spotlight-cover-side {
        display: none;
    }
    .hero-content {
        grid-template-columns: 110px 1fr;
        gap: 14px;
        padding: 14px;
    }
    .series-info h1 {
        font-size: 1.2rem;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }
    .header-stats {
        display: none;
    }
    .hero-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
    .series-cover-wrapper {
        max-width: 200px;
        margin: 0 auto;
    }
    .series-badges, .series-actions {
        justify-content: center;
    }
    .series-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 10px;
    }
    .reader-breadcrumbs {
        display: none;
    }
    .reader-home-btn {
        padding: 6px 10px;
    }
    .reader-top-bar {
        padding: 8px 12px;
    }

    /* The top bar runs out of room on phones: keep Home + prev/next, and
       move the chapter picker + download into their own row below it. */
    .reader-top-bar {
        flex-wrap: wrap;
        row-gap: 8px;
    }
    .reader-left-cluster {
        flex: 0 0 auto;
        margin-right: auto;
    }
    .reader-controls-cluster {
        flex: 1 1 100%;
        justify-content: flex-start;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        /* Keep this row's content from widening the whole page on phones:
           it scrolls sideways inside the bar instead of overflowing. */
        max-width: 100%;
        min-width: 0;
        padding-right: 4px;
        scrollbar-width: none;
    }
    .reader-controls-cluster::-webkit-scrollbar {
        display: none;
    }
    .chapter-select {
        max-width: 128px;
        flex: 0 0 auto;
    }
    /* Fit the whole control row (picker + Prev/Next + Download) on one line
       without sideways scrolling, so nothing looks cut off at the edge. */
    .reader-controls-cluster {
        gap: 6px;
        overflow-x: visible;
        padding-right: 0;
    }
    .reader-controls-cluster .chapter-select {
        max-width: 104px;
        padding: 7px 8px;
        padding-right: 4px;
    }
    .reader-controls-cluster .reader-nav-btn {
        padding: 7px 10px;
    }
    .reader-controls-cluster .btn-download {
        padding: 6px 10px;
        font-size: 0.8rem;
        margin-left: 2px !important;
    }
    .reader-bottom-nav {
        /* Four buttons + labels don't fit a 390px row — let them wrap to a
           grid instead of forcing the whole page to scroll sideways. */
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
        padding: 18px 14px;
    }
    .reader-bottom-nav .reader-nav-btn {
        flex: 1 1 calc(50% - 10px);
        justify-content: center;
        min-width: 0;
    }
    .reader-home-btn-solid {
        order: -1;
    }
    #downloadCounter {
        display: none;
    }
    /* top bar wraps to two rows on phones -> push content clear of it */
    .reader-settings-bar {
        margin-top: 108px;
    }
    .spotlight-content {
        padding: 24px;
    }
    .spotlight-title {
        font-size: 1.6rem;
    }
}

/* Download button — amber (the palette's second hue) so the site stays a
   strict complementary teal/amber pair instead of introducing green. */
.btn-download {
    background: linear-gradient(135deg, var(--accent-secondary), var(--accent-crimson));
    color: var(--bg-void);
    border: 1px solid var(--accent-secondary);
}
.btn-download:hover {
    background: linear-gradient(135deg, var(--accent-secondary-hover), var(--accent-crimson-hover));
    border-color: var(--accent-secondary-hover);
}

/* On very small screens the Home button keeps only its icon */
@media (max-width: 480px) {
    .reader-home-btn .home-text {
        display: none;
    }
}

/* Very narrow phones (≈320px): the wordmark plus both header links no longer
   fit on one line and used to drag the whole page sideways. */
@media (max-width: 400px) {
    .header-nav {
        gap: 14px;
    }
    .header-nav a {
        font-size: 0.78rem;
    }
    .logo-text {
        font-size: 1.05rem;
    }
    .page-wrap {
        padding: 32px 16px 20px;
    }
    .service-row {
        flex-wrap: wrap;
        gap: 10px;
    }
    .service-row .status-badge {
        flex-shrink: 0;
    }
    /* Reader: the width/gap controls are wider than a 320px screen, so let
       that toolbar scroll sideways inside its own box. */
    .reader-settings-bar {
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding: 10px 12px;
    }
    .reader-settings-bar::-webkit-scrollbar {
        display: none;
    }
    .reader-settings-bar .setting-group {
        flex: 0 0 auto;
    }
    /* Keep the floating buttons fully on-screen instead of hanging off it. */
    .floating-actions {
        right: 12px;
        bottom: 16px;
    }
}

/* ==========================================================================
   Home Layout: Main + Sidebar
   ========================================================================== */

.home-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 24px;
    align-items: start;
}

.home-main {
    min-width: 0;
}

.home-sidebar {
    position: sticky;
    top: 80px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sidebar-section {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-lg);
    padding: 16px;
}

.sidebar-title {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-pure);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Top 10 Sidebar */
.top10-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.top10-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px;
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--text-primary);
    transition: var(--transition);
}

.top10-item:hover {
    background: var(--bg-card-hover);
}

.top10-rank {
    font-size: 1.1rem;
    font-weight: 900;
    color: var(--accent-secondary);
    min-width: 24px;
    text-align: center;
}

.top10-thumb {
    width: 40px;
    height: 56px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    background: var(--bg-surface);
    flex-shrink: 0;
}

.top10-info {
    flex: 1;
    min-width: 0;
}

.top10-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-pure);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.top10-chapters {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* New Manhwas Sidebar */
.new-manhwa-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.new-manhwa-card {
    text-decoration: none;
    color: var(--text-primary);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: var(--transition);
}

.new-manhwa-card:hover {
    transform: translateY(-2px);
}

.new-manhwa-thumb {
    width: 100%;
    aspect-ratio: 1 / 1.4;
    object-fit: cover;
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
}

.new-manhwa-title {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-top: 4px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Series pagination — STATIC, at the bottom of the series list.
   It stays put in the document flow; it is NOT pinned to the viewport and must
   never float over the cards. It lives inside #seriesGrid, a 7-column card
   grid, so `grid-column: 1 / -1` is required or it gets squeezed into one
   157px column and wraps into a 291px-tall stack. */
.series-pagination-bar {
    grid-column: 1 / -1;
    justify-self: center;
    position: static;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    /* A set width (not fit-content): fit-content lets the flex row shrink until
       its children wrap, which stacked the bar 163px tall on a 390px screen. */
    width: min(700px, 94vw);
    margin: 32px 0 40px;
    padding: 9px 14px;
    background: var(--bg-card-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-hover);
    border-radius: 999px;
    box-shadow: var(--shadow-md);
}

.pag-chips {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    justify-content: center;
}

.pag-num {
    min-width: 34px;
    height: 32px;
    padding: 0 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: 999px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
}

.pag-num:hover:not(.active) {
    border-color: var(--accent-primary);
    color: var(--text-primary);
    background: var(--bg-card);
}

.pag-num.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary-hover);
    color: #fff;
    box-shadow: 0 0 0 2px rgba(28, 140, 165, 0.25);
}

.pag-ellipsis {
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 0 2px;
    user-select: none;
}

.pag-nav {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
    height: 32px;
    padding: 0 13px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: 999px;
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
}

.pag-nav:hover:not(:disabled) {
    border-color: var(--accent-primary);
    color: var(--text-primary);
    background: var(--bg-card);
}

.pag-nav:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.pag-arrow {
    font-size: 1rem;
    line-height: 1;
}

.pag-info {
    flex-basis: 100%;
    text-align: center;
    font-size: 0.74rem;
    color: var(--text-muted);
    font-weight: 600;
    line-height: 1;
}

.pag-info b {
    color: var(--accent-primary-hover);
}

/* "Go to page" input — a second, direct route to any page. Lives in the bar. */
.pag-jump {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 600;
    white-space: nowrap;
}

.pag-jump-label {
    font-size: 0.7rem;
}

.pag-jump input {
    width: 56px;
    height: 28px;
    padding: 0 10px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: 999px;
    color: var(--text-primary);
    font-size: 0.8rem;
    font-weight: 700;
    font-family: inherit;
    text-align: center;
    outline: none;
    transition: var(--transition);
}

.pag-jump input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(28, 140, 165, 0.2);
}

.pag-jump input::placeholder {
    color: var(--text-muted);
    font-weight: 600;
}

@media (max-width: 768px) {
    .series-pagination-bar {
        gap: 6px;
        padding: 8px 10px;
        border-radius: 20px;
        width: 94vw;
        margin: 24px 0 32px;
    }
    .pag-num {
        min-width: 30px;
        height: 28px;
        font-size: 0.75rem;
        padding: 0 6px;
    }
    .pag-nav {
        height: 28px;
        padding: 0 10px;
        font-size: 0.76rem;
    }
    /* "Prev"/"Next" words are what force a 390px row to overflow. */
    .pag-nav .pag-label {
        display: none;
    }
    .pag-info {
        font-size: 0.68rem;
    }
    /* The jump box is what overflows a 390px row; hide it there. */
    .pag-jump {
        display: none;
    }
}

/* Responsive: Stack sidebar below main on narrow screens */
@media (max-width: 900px) {
    .home-layout {
        grid-template-columns: 1fr;
    }
    .home-sidebar {
        position: static;
        flex-direction: row;
        flex-wrap: wrap;
    }
    .sidebar-section {
        flex: 1;
        min-width: 280px;
    }
    .new-manhwa-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 600px) {
    .new-manhwa-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* New Manhwas horizontal row (above Continue Reading) */
.new-manhwa-row {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 8px;
    margin-bottom: 24px;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}

.new-manhwa-row::-webkit-scrollbar {
    height: 4px;
}

.new-manhwa-row::-webkit-scrollbar-track {
    background: transparent;
}

.new-manhwa-row::-webkit-scrollbar-thumb {
    background: var(--border-subtle);
    border-radius: 2px;
}

.new-manhwa-chip {
    flex-shrink: 0;
    width: 100px;
    text-decoration: none;
    color: var(--text-primary);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: var(--transition);
}

.new-manhwa-chip:hover {
    transform: translateY(-2px);
}

.new-manhwa-chip-thumb {
    width: 100%;
    aspect-ratio: 1 / 1.4;
    object-fit: cover;
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
}

.new-manhwa-chip-title {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-top: 4px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Top manhwa hero carousel — Asura Scans design, measured from their
   HeroCarouselEmbla component.

   Their spec (from asurascans.com/_astro/HeroCarouselEmbla):
     inactive cover : 170x243, opacity 0.7
     ACTIVE cover   : 215x308, opacity 1, with a zoomIn animation
     hover inactive : opacity 0.9
     title          : overlaid on the cover bottom, gradient scrim behind it
     rating         : star + score badge in the top-left corner, bg-black/80

   The elevation of the active card IS the design — a flat row of equal cards
   reads as a plain grid, not a hero. Keep the size difference.

   STATIC: in normal document flow, scrolls away with the page. Never fixed or
   sticky (a floating bar was rejected for exactly that reason). */

.top-hero {
    position: relative;
    width: 100%;
    max-width: 1240px;
    margin: 0 auto 28px;
    padding: 18px 8px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

/* Embla-style track: a horizontal row, one card per slide. */
.th-viewport {
    overflow: hidden;
    height: 308px;
}

.th-track {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 100%;
    will-change: transform;
    transition: transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.th-slide {
    position: relative;
    flex: 0 0 auto;
    display: block;
    text-decoration: none;
    transition: opacity 150ms ease-out;
}

/* Inactive card: smaller and dimmed, exactly like Asura. */
.th-slide .th-card {
    width: 170px;
    height: 243px;
    opacity: 0.7;
    border-radius: var(--radius-sm);
    overflow: hidden;
    position: relative;
    transition: width 0.35s ease, height 0.35s ease, opacity 150ms ease-out;
}

.th-slide:not(.is-active):hover .th-card {
    opacity: 0.9;
}

/* Active card: scaled up + zoom animation. */
.th-slide.is-active .th-card {
    width: 215px;
    height: 308px;
    opacity: 1;
    animation: th-zoom-in 180ms ease-out;
    box-shadow: var(--shadow-md);
}

@keyframes th-zoom-in {
    from { transform: scale(0.85); }
    to   { transform: scale(1); }
}

.th-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
}

.th-slide:hover .th-card img {
    transform: scale(1.06);
}

/* Title overlaid on the cover bottom, with a gradient scrim so it stays
   readable over any artwork. */
.th-scrim {
    position: absolute;
    inset-inline: 0;
    bottom: 0;
    padding: 26px 8px 8px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.88), rgba(0, 0, 0, 0.42), transparent);
}

.th-title {
    margin: 0;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.25;
    color: var(--text-pure);
    text-align: left;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
}

/* Rating badge: star + score, top-left, semi-opaque black. */
.th-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.8);
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-pure);
}

.th-badge .th-star {
    color: var(--accent-secondary);
    font-size: 0.72rem;
}

/* Arrows, matching the site's pill styling. */
.th-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 5;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid var(--border-hover);
    background: rgba(7, 9, 12, 0.75);
    color: var(--text-secondary);
    font-size: 1.15rem;
    line-height: 1;
    cursor: pointer;
    backdrop-filter: blur(8px);
    transition: var(--transition);
}

.th-arrow:hover:not(:disabled) {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: #fff;
}

.th-arrow:disabled { opacity: 0.3; cursor: not-allowed; }
.th-prev { left: 10px; }
.th-next { right: 10px; }

/* Section header with the "All" pill, like Asura's Trending header. */
.th-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    padding: 0 6px;
}

.th-heading {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-primary);
}

.th-heading-icon {
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: rgba(28, 140, 165, 0.15);
    color: var(--accent-primary);
    font-size: 0.8rem;
}

.th-all {
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    background: var(--accent-primary);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    transition: var(--transition);
}

.th-all:hover { background: var(--accent-primary-hover); }

@media (max-width: 1024px) {
    .th-viewport { height: 279px; }
    .th-slide .th-card { width: 155px; height: 222px; }
    .th-slide.is-active .th-card { width: 195px; height: 279px; }
}

@media (max-width: 700px) {
    .th-viewport { height: 250px; }
    .th-slide .th-card { width: 128px; height: 184px; }
    .th-slide.is-active .th-card { width: 160px; height: 230px; }
    .th-arrow { width: 28px; height: 28px; font-size: 1rem; }
    .th-prev { left: 6px; }
    .th-next { right: 6px; }
    .th-title { font-size: 0.68rem; }
    .th-heading { font-size: 0.9rem; }
}
