/* =============================================
   Xenoth MangaReader — main.css
   Dark Ink Aesthetic
   ============================================= */

/* --- Variables --- */
:root {
    --bg:         #08080e;
    --bg-card:    #0f0f1a;
    --bg-input:   #14141f;
    --bg-hover:   #1a1a28;
    --border:     #1e1e30;
    --border-light: #2a2a40;
    --accent:     #35d0bd;
    --accent-dim: #239a8d;
    --accent-glow:rgba(53, 208, 189, 0.25);
    --gold:       #f4a261;
    --text:       #eaeaf0;
    --text-muted: #6b6b8a;
    --text-dim:   #9898b8;
    --success:    #2cb67d;
    --error:      #f4a261;
    --font-display: 'Bebas Neue', sans-serif;
    --font-body:    'Noto Sans Thai', sans-serif;
    --font-mono:    'Space Mono', monospace;
    --radius:     10px;
    --radius-lg:  16px;
    --shadow:     0 4px 24px rgba(0,0,0,0.5);
    --shadow-accent: 0 0 30px var(--accent-glow);
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
    scroll-behavior: smooth;
    width: 100%;
    overflow-x: hidden;
    overscroll-behavior-x: none;
    overscroll-behavior-y: none;
}
body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    width: 100%;
    overflow-x: hidden;
}
a { color: inherit; text-decoration: none; transition: color .2s; }
img { max-width: 100%; display: block; }
input, textarea, select { font-family: var(--font-body); }

.site-announcement {
    border-bottom: 1px solid var(--border);
    font-size: 0.86rem;
    position: relative;
    z-index: 130;
}
.site-announcement-inner {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
    padding: 8px 1.5rem;
    text-align: center;
    flex-wrap: wrap;
}
.site-announcement-label {
    font-size: 0.72rem;
    letter-spacing: .6px;
    text-transform: uppercase;
    font-weight: 700;
}
.site-announcement-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 0 0 currentColor;
    animation: annPulse 1.4s infinite;
}
@keyframes annPulse {
    0% { box-shadow: 0 0 0 0 rgba(255,255,255,.45); }
    70% { box-shadow: 0 0 0 10px rgba(255,255,255,0); }
    100% { box-shadow: 0 0 0 0 rgba(255,255,255,0); }
}
.site-announcement-info { background: rgba(53, 208, 189, .08); color: #9df8ed; }
.site-announcement-warning { background: rgba(244, 162, 97, .10); color: #ffd7b5; }
.site-announcement-success { background: rgba(44, 182, 125, .10); color: #8ef0c6; }

/* =============================================
   NAVBAR
   ============================================= */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    height: 60px;
    background: rgba(8, 8, 14, 0.9);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

.nav-logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}
.nav-logo-image {
    width: 36px;
    height: 36px;
    object-fit: contain;
    filter: drop-shadow(0 0 8px rgba(53, 208, 189, .35));
}
.nav-logo-text {
    font-family: var(--font-display);
    font-size: 1.55rem;
    letter-spacing: 2px;
    color: var(--text);
}
.logo-x    { color: var(--accent); }
.logo-rest { color: var(--text); }

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    font-size: 0.9rem;
}
.nav-links a:hover { color: var(--accent); }

.nav-avatar {
    width: 26px; height: 26px;
    border-radius: 50%;
    object-fit: cover;
    display: inline-block;
    vertical-align: middle;
    margin-right: 4px;
    border: 1px solid var(--accent);
}

.btn-nav-outline {
    border: 1px solid var(--border-light);
    padding: 5px 14px;
    border-radius: 6px;
    font-size: 0.85rem;
    transition: border-color .2s;
}
.btn-nav-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-install-app {
    background: transparent;
    color: var(--text-dim);
    cursor: pointer;
}
.btn-install-app:hover {
    background: rgba(53, 208, 189, .08);
}

.btn-nav-solid {
    background: var(--accent);
    color: #fff !important;
    padding: 5px 16px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    transition: background .2s, transform .15s;
}
.btn-nav-solid:hover { background: var(--accent-dim); transform: translateY(-1px); }

.nav-badge {
    background: var(--gold);
    color: #08080e;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    letter-spacing: .5px;
    text-transform: uppercase;
}

/* Hamburger */
.nav-hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}
.nav-hamburger span {
    display: block;
    width: 22px; height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: transform .25s, opacity .25s;
}
.nav-hamburger.active span:nth-child(1) { transform: rotate(45deg) translate(5px,5px); }
.nav-hamburger.active span:nth-child(2) { opacity: 0; }
.nav-hamburger.active span:nth-child(3) { transform: rotate(-45deg) translate(5px,-5px); }

.nav-mobile-user {
    display: none;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    margin-right: 8px;
}
.mobile-quick {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 9px;
    border: 1px solid var(--border-light);
    border-radius: 999px;
    font-size: 0.76rem;
    color: var(--text-dim);
    white-space: nowrap;
}
.mobile-quick-avatar {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--accent);
}
.mobile-quick-admin {
    border-color: rgba(53, 208, 189, .35);
    color: var(--accent);
}

/* Mobile Nav */
.nav-mobile {
    display: none;
    flex-direction: column;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    overflow: hidden;
    max-height: 0;
    transition: max-height .3s ease;
}
.nav-mobile.open { max-height: 400px; }
.nav-mobile a {
    padding: 12px 2rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.95rem;
}
.nav-mobile .nav-mobile-install {
    margin: 10px 2rem;
    width: calc(100% - 4rem);
    text-align: center;
}
.nav-mobile a:hover { color: var(--accent); background: var(--bg-hover); }

/* =============================================
   FOOTER
   ============================================= */
.footer {
    margin-top: auto;
    border-top: 1px solid var(--border);
    padding: 2.5rem 2rem 1.5rem;
    background: var(--bg-card);
}
.footer-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    text-align: center;
}
.footer-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    font-size: 1.4rem;
    font-family: var(--font-display);
    letter-spacing: 2px;
}
.footer-logo-image {
    width: 72px;
    height: 72px;
    object-fit: contain;
    filter: drop-shadow(0 0 16px rgba(53, 208, 189, .2));
}
.footer-brand p { font-size: 0.82rem; color: var(--text-muted); margin-top: 4px; font-family: var(--font-body); }
.footer-links { display: flex; gap: 1.5rem; flex-wrap: wrap; justify-content: center; }
.footer-links a { font-size: 0.85rem; color: var(--text-muted); }
.footer-links a:hover { color: var(--accent); }
.footer-copy { font-size: 0.78rem; color: var(--text-muted); }

/* =============================================
   AUTH PAGES (Login / Register)
   ============================================= */
.auth-page {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: calc(100vh - 60px);
}

/* Left panel — decorative */
.auth-panel {
    position: relative;
    background: linear-gradient(135deg, #0a0a14 0%, #12041a 50%, #0a0810 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    padding: 4rem 3rem;
    overflow: hidden;
}
.auth-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 60% 50% at 30% 60%, rgba(53, 208, 189,.15) 0%, transparent 70%),
        radial-gradient(ellipse 40% 40% at 80% 20%, rgba(180,0,200,.08) 0%, transparent 60%);
    pointer-events: none;
}
.auth-panel-bg-text {
    position: absolute;
    bottom: -20px;
    left: -10px;
    font-family: var(--font-display);
    font-size: clamp(6rem, 12vw, 10rem);
    color: rgba(53, 208, 189,.06);
    letter-spacing: 6px;
    line-height: 1;
    user-select: none;
    pointer-events: none;
}
.auth-panel-content { position: relative; z-index: 1; }
.auth-panel-tag {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--accent);
    letter-spacing: 3px;
    text-transform: uppercase;
    margin-bottom: 1.2rem;
    display: flex;
    align-items: center;
    gap: 8px;
}
.auth-panel-tag::before {
    content: '';
    width: 24px; height: 1px;
    background: var(--accent);
}
.auth-panel h1 {
    font-family: var(--font-display);
    font-size: clamp(2.5rem, 4vw, 3.8rem);
    line-height: 1.05;
    letter-spacing: 2px;
    color: var(--text);
    margin-bottom: 1.2rem;
}
.auth-panel h1 span { color: var(--accent); }
.auth-panel p {
    color: var(--text-dim);
    font-size: 0.95rem;
    max-width: 340px;
    line-height: 1.7;
}
.auth-panel-stats {
    display: flex;
    gap: 2rem;
    margin-top: 2.5rem;
}
.auth-stat { text-align: left; }
.auth-stat-num {
    font-family: var(--font-display);
    font-size: 1.8rem;
    color: var(--accent);
    letter-spacing: 1px;
}
.auth-stat-label { font-size: 0.78rem; color: var(--text-muted); }

/* Right panel — form */
.auth-form-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    background: var(--bg);
}
.auth-form-box {
    width: 100%;
    max-width: 420px;
    animation: fadeUp .4s ease both;
}
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

.auth-form-title {
    font-family: var(--font-display);
    font-size: 2rem;
    letter-spacing: 2px;
    margin-bottom: 0.3rem;
}
.auth-form-sub {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
}
.auth-form-sub a { color: var(--accent); }
.auth-form-sub a:hover { text-decoration: underline; }

/* Form elements */
.form-group { margin-bottom: 1.2rem; }
.form-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-dim);
    margin-bottom: 6px;
    letter-spacing: .5px;
    text-transform: uppercase;
}
.form-input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 11px 14px;
    color: var(--text);
    font-size: 0.95rem;
    transition: border-color .2s, box-shadow .2s;
    outline: none;
}
.form-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-input::placeholder { color: var(--text-muted); }

.form-input-wrap {
    position: relative;
}
.form-input-wrap .form-input { padding-right: 42px; }
.toggle-pw {
    position: absolute;
    right: 12px; top: 50%;
    transform: translateY(-50%);
    background: none; border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    transition: color .2s;
    line-height: 1;
}
.toggle-pw:hover { color: var(--accent); }

.form-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 5px;
}

/* Alerts */
.alert {
    border-radius: var(--radius);
    padding: 12px 16px;
    font-size: 0.88rem;
    margin-bottom: 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 4px;
    border-left: 3px solid;
}
.alert-error {
    background: rgba(53, 208, 189,.1);
    border-color: var(--error);
    color: #ffd0a8;
}
.alert-success {
    background: rgba(44,182,125,.1);
    border-color: var(--success);
    color: #5de8b2;
}

/* Divider */
.form-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 1.5rem 0;
    color: var(--text-muted);
    font-size: 0.8rem;
}
.form-divider::before, .form-divider::after {
    content: ''; flex: 1;
    height: 1px;
    background: var(--border-light);
}

/* Submit button */
.btn-primary {
    width: 100%;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    padding: 12px;
    font-size: 1rem;
    font-weight: 700;
    font-family: var(--font-body);
    cursor: pointer;
    letter-spacing: .5px;
    transition: background .2s, transform .15s, box-shadow .2s;
    margin-top: 0.5rem;
}
.btn-primary:hover {
    background: var(--accent-dim);
    transform: translateY(-1px);
    box-shadow: var(--shadow-accent);
}
.btn-primary:active { transform: translateY(0); }

/* Terms */
.form-terms {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: 1rem;
    line-height: 1.6;
}
.form-terms a { color: var(--accent); }

/* =============================================
   UTILITIES
   ============================================= */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Status tags */
.tag-genre, .tag-status {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: .6px;
    text-transform: uppercase;
    padding: 2px 10px;
    border-radius: 4px;
}
.tag-genre {
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.15);
    color: var(--text-dim);
}
.tag-ongoing   { background: rgba(44,182,125,.15); color: var(--success); border:1px solid rgba(44,182,125,.3); }
.tag-completed { background: rgba(100,180,255,.12); color: #7dc8ff; border:1px solid rgba(100,180,255,.25); }
.tag-hiatus    { background: rgba(244,162,97,.12); color: var(--gold); border:1px solid rgba(244,162,97,.25); }
.tag-cancelled { background: rgba(150,150,180,.1); color: var(--text-muted); border:1px solid var(--border); }

.empty-state {
    color: var(--text-muted);
    font-size: 0.9rem;
    padding: 2rem;
    text-align: center;
}

/* =============================================
   HERO
   ============================================= */
.hero {
    position: relative;
    min-height: 520px;
    display: flex;
    align-items: center;
    overflow: hidden;
}

.hero-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center top;
    filter: blur(2px) brightness(0.3);
    transform: scale(1.04);
}
.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        105deg,
        rgba(8,8,14,0.97) 0%,
        rgba(8,8,14,0.85) 45%,
        rgba(8,8,14,0.15) 100%
    );
}

.hero-content {
    position: relative;
    z-index: 2;
    padding: 3.5rem 1.5rem 3.5rem calc((100% - 1200px) / 2 + 1.5rem);
    max-width: 600px;
    animation: fadeUp .5s ease both;
}

.hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 1rem;
}

.hero-title {
    font-family: var(--font-display);
    font-size: clamp(2rem, 4.5vw, 3.6rem);
    letter-spacing: 2px;
    line-height: 1.08;
    margin-bottom: 1rem;
    text-shadow: 0 2px 20px rgba(0,0,0,.6);
}

.hero-desc {
    color: var(--text-dim);
    font-size: 0.93rem;
    line-height: 1.7;
    margin-bottom: 1.2rem;
    max-width: 460px;
}

.hero-stats {
    display: flex;
    gap: 1.2rem;
    margin-bottom: 1.5rem;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-family: var(--font-mono);
}
.hero-stat {
    display: flex;
    align-items: center;
    gap: 5px;
}

.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.btn-hero-primary {
    background: var(--accent);
    color: #fff;
    padding: 11px 28px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.95rem;
    transition: background .2s, transform .15s, box-shadow .2s;
    display: inline-flex; align-items: center; gap: 6px;
}
.btn-hero-primary:hover {
    background: var(--accent-dim);
    transform: translateY(-2px);
    box-shadow: var(--shadow-accent);
}

.btn-hero-outline {
    border: 1px solid var(--border-light);
    color: var(--text-dim);
    padding: 11px 24px;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: border-color .2s, color .2s;
}
.btn-hero-outline:hover { border-color: var(--text-dim); color: var(--text); }

/* Floating cover on right */
.hero-cover-float {
    position: absolute;
    right: max(1.5rem, calc((100% - 1200px) / 2 + 1.5rem));
    top: 50%;
    transform: translateY(-50%);
    width: clamp(160px, 18vw, 260px);
    z-index: 2;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,.7), 0 0 0 1px rgba(255,255,255,.06);
    animation: floatIn .6s ease both;
}
.hero-cover-float img {
    width: 100%;
    aspect-ratio: 2/3;
    object-fit: cover;
    display: block;
}
@keyframes floatIn {
    from { opacity: 0; transform: translateY(-40%) translateX(20px); }
    to   { opacity: 1; transform: translateY(-50%) translateX(0); }
}

/* =============================================
   GENRE PILLS
   ============================================= */
.section-genres {
    border-bottom: 1px solid var(--border);
    padding: 14px 0;
    background: var(--bg-card);
    position: sticky;
    top: 60px;
    z-index: 50;
}
.genre-scroll {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
}
.genre-scroll::-webkit-scrollbar { display: none; }

.genre-pill {
    white-space: nowrap;
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    border: 1px solid var(--border-light);
    color: var(--text-muted);
    transition: all .2s;
    flex-shrink: 0;
}
.genre-pill:hover { border-color: var(--accent); color: var(--accent); }
.genre-pill.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

/* =============================================
   SECTION COMMON
   ============================================= */
.home-section { padding: 2.5rem 0; }
.section-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 1.4rem;
}
.section-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    letter-spacing: 1.5px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.section-accent { color: var(--accent); }
.section-more {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    transition: color .2s;
}
.section-more:hover { color: var(--accent); }

/* =============================================
   LATEST UPDATES GRID
   ============================================= */
.latest-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 18px;
}

.latest-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    animation: fadeUp .4s ease both;
    transition: transform .2s;
}
.latest-card:hover { transform: translateY(-4px); }

.latest-cover {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 2/3;
    background: var(--bg-card);
}
.latest-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .3s;
}
.latest-card:hover .latest-cover img { transform: scale(1.05); }

.latest-cover-overlay {
    position: absolute;
    inset: 0;
    background: rgba(8,8,14,.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .2s;
}
.latest-card:hover .latest-cover-overlay { opacity: 1; }
.latest-read-btn {
    background: var(--accent);
    color: #fff;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
}

.latest-info { padding: 0 2px; }
.latest-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 5px;
}
.latest-chapters {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    margin-bottom: 3px;
}
.ch-badge {
    font-size: 0.7rem;
    font-family: var(--font-mono);
    padding: 1px 7px;
    border-radius: 4px;
    background: var(--bg-hover);
    border: 1px solid var(--border-light);
    color: var(--text-dim);
}
.ch-badge.ch-new {
    background: rgba(53, 208, 189,.15);
    border-color: rgba(53, 208, 189,.3);
    color: var(--accent);
}
.latest-time {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

/* =============================================
   DUAL COLUMN
   ============================================= */
.dual-col {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    align-items: stretch;
}
.dual-block { min-height: 100%; }

/* Keep "เพิ่มใหม่" block stretched and push empty-state to the bottom */
.dual-col > .dual-block:last-child {
    display: flex;
    flex-direction: column;
}
.dual-col > .dual-block:last-child .new-grid {
    flex: 1;
}

/* Popular list */
.popular-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.popular-list.is-empty {
    min-height: 100%;
}
.popular-list.is-empty .empty-state {
    margin-top: auto;
}
.popular-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius);
    transition: background .2s;
    border: 1px solid transparent;
}
.popular-item:hover { background: var(--bg-hover); border-color: var(--border); }

.pop-rank {
    font-family: var(--font-display);
    font-size: 1.3rem;
    color: var(--text-muted);
    min-width: 26px;
    text-align: center;
    line-height: 1;
}
.pop-rank-top { color: var(--accent); }

.pop-cover {
    flex-shrink: 0;
    width: 44px;
    height: 60px;
    border-radius: 5px;
    overflow: hidden;
    background: var(--bg-card);
}
.pop-cover img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .25s;
}
.popular-item:hover .pop-cover img { transform: scale(1.08); }

.pop-info { flex: 1; min-width: 0; }
.pop-title {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 3px;
    transition: color .2s;
}
.pop-title:hover { color: var(--accent); }
.pop-genres {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pop-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.72rem;
    font-family: var(--font-mono);
    color: var(--text-muted);
}
.pop-rating { color: var(--gold); }

/* Newly Added */
.new-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}
.new-grid.is-empty {
    display: flex;
    min-height: 100%;
}
.new-grid.is-empty .empty-state {
    width: 100%;
    margin-top: auto;
}
.new-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: transform .2s;
}
.new-card:hover { transform: translateY(-3px); }

.new-cover {
    position: relative;
    border-radius: 6px;
    overflow: hidden;
    aspect-ratio: 2/3;
    background: var(--bg-card);
}
.new-cover img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .3s;
}
.new-card:hover .new-cover img { transform: scale(1.06); }
.new-badge {
    position: absolute;
    top: 6px; left: 6px;
    background: var(--accent);
    color: #fff;
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 1px;
    padding: 2px 6px;
    border-radius: 3px;
}
.new-info { padding: 0 2px; }
.new-title {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.35;
    margin-bottom: 2px;
}
.new-type {
    font-size: 0.68rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

/* =============================================
   EXTRA PAGES
   ============================================= */
.page-block {
    padding-top: 2rem;
    padding-bottom: 2.5rem;
}

.tabs-inline {
    display: inline-flex;
    gap: 6px;
}
.tab-link {
    border: 1px solid var(--border-light);
    border-radius: 999px;
    padding: 5px 12px;
    font-size: 0.78rem;
    color: var(--text-muted);
}
.tab-link.active {
    background: var(--accent);
    color: #072521;
    border-color: var(--accent);
}

.inline-controls { display: flex; gap: 8px; }
.sort-select {
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    color: var(--text);
    border-radius: 8px;
    padding: 8px 10px;
}

.pagination {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-top: 1.2rem;
}
.pagination a, .pagination span {
    border: 1px solid var(--border-light);
    border-radius: 6px;
    min-width: 32px;
    padding: 4px 10px;
    text-align: center;
    font-size: 0.82rem;
    color: var(--text-muted);
}
.pagination .current {
    background: var(--accent);
    border-color: var(--accent);
    color: #072521;
}

.manga-detail {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 1.4rem;
    margin-bottom: 2rem;
}
.manga-cover-lg {
    width: 100%;
    aspect-ratio: 2/3;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid var(--border);
}
.manga-title {
    font-family: var(--font-display);
    letter-spacing: 1px;
    font-size: clamp(1.9rem, 3vw, 2.8rem);
}
.manga-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: .8rem 0;
}
.manga-genre-text {
    color: var(--text-dim);
    font-size: 0.88rem;
}
.manga-desc {
    color: var(--text-dim);
    margin-top: .8rem;
    line-height: 1.75;
}
.manga-actions {
    display: flex;
    gap: 10px;
    margin-top: 1.1rem;
}

.chapter-list {
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}
.chapter-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 11px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text-dim);
}
.chapter-row:last-child { border-bottom: none; }
.chapter-row:hover {
    background: var(--bg-card);
    color: var(--text);
}

.comment-wrap {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.top-comment-card {
    border: 1px solid rgba(53, 208, 189, .28);
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(53,208,189,.08) 0%, rgba(53,208,189,.02) 100%);
    padding: 14px;
}
.top-comment-head {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}
.top-comment-badge {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: .4px;
    color: #8df4e8;
    border: 1px solid rgba(53, 208, 189, .4);
    background: rgba(53, 208, 189, .14);
    border-radius: 999px;
    padding: 2px 10px;
}
.top-comment-body {
    color: var(--text);
    line-height: 1.75;
    margin-bottom: 8px;
}
.top-comment-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    color: var(--text-muted);
    font-size: 0.8rem;
}
.comment-form {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-card);
    padding: 12px;
}
.comment-input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    color: var(--text);
    border-radius: 8px;
    padding: 10px 12px;
    resize: vertical;
    min-height: 92px;
    outline: none;
}
.comment-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.comment-form-actions {
    margin-top: 10px;
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
}
.comment-login-hint {
    border: 1px dashed var(--border-light);
    border-radius: 10px;
    padding: 12px;
    color: var(--text-muted);
}
.comment-login-hint a {
    color: var(--accent);
}
.comment-list {
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}
.comment-item {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    background: rgba(255,255,255,.01);
}
.comment-item:last-child {
    border-bottom: none;
}
.comment-head {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}
.comment-user {
    display: flex;
    align-items: center;
    gap: 8px;
}
.comment-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border-light);
    background: #111;
}
.comment-body {
    color: var(--text-dim);
    line-height: 1.7;
    margin-bottom: 8px;
}
.comment-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}
.comment-delete-btn {
    background: transparent;
    border: 1px solid rgba(53, 208, 189, .35);
    color: var(--accent);
    border-radius: 6px;
    padding: 2px 8px;
    font-size: 0.75rem;
    cursor: pointer;
}
.comment-delete-btn:hover {
    background: rgba(53, 208, 189, .12);
}
.reply-list {
    margin-top: 8px;
    padding-left: 10px;
    border-left: 2px solid var(--border-light);
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.reply-item {
    font-size: 0.84rem;
    color: var(--text-dim);
    line-height: 1.65;
}
.reply-item strong {
    color: var(--text);
}
.reply-form {
    margin-top: 8px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
}
.reply-form input {
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    color: var(--text);
    border-radius: 6px;
    padding: 6px 10px;
    outline: none;
}
.reply-form input:focus {
    border-color: var(--accent);
}
.reply-form button {
    background: transparent;
    border: 1px solid rgba(53, 208, 189, .35);
    color: var(--accent);
    border-radius: 6px;
    padding: 6px 10px;
    cursor: pointer;
}
.reply-form button:hover {
    background: rgba(53, 208, 189, .12);
}

.reader-toolbar {
    position: sticky;
    top: 64px;
    z-index: 40;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 10px 12px;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(8, 8, 14, 0.88);
    backdrop-filter: blur(6px);
}
.reader-offline-btn {
    white-space: nowrap;
}
.reader-nav {
    display: flex;
    gap: 8px;
}
.reader-images {
    max-width: 920px;
    margin: 0 auto;
}
.reader-images img {
    width: 100%;
    margin-bottom: 10px;
    border-radius: 6px;
}
.reader-images.is-long-scroll img {
    margin-bottom: 0;
    border-radius: 0;
}
.reader-bottom-nav {
    margin: 1.2rem auto 0;
    max-width: 920px;
    display: grid;
    grid-template-columns: 1fr minmax(180px, 280px) 1fr;
    gap: 10px;
    align-items: center;
}
.reader-bottom-nav .btn-hero-outline,
.reader-bottom-nav .btn-hero-primary {
    justify-content: center;
    text-align: center;
}
.reader-bottom-nav .is-disabled {
    opacity: .45;
    pointer-events: none;
}
.reader-chapter-select {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    color: var(--text);
    border-radius: 8px;
    padding: 10px 12px;
    font-family: var(--font-body);
    font-size: 0.88rem;
    outline: none;
}
.reader-chapter-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-box {
    display: flex;
    gap: 8px;
    margin-bottom: 1rem;
}
.search-input {
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    color: var(--text);
    border-radius: 10px;
    padding: 12px 14px;
}
.search-result-meta {
    color: var(--text-muted);
    font-size: .85rem;
    margin-bottom: 1rem;
}

.profile-head {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1.5rem;
}
.profile-avatar {
    width: 78px;
    height: 78px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent);
}
.profile-stats {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: .4rem;
}

.category-pill-wrap {
    margin-bottom: 1rem;
}

/* Category page: slightly smaller cover cards */
.category-page .latest-grid {
    grid-template-columns: repeat(auto-fill, minmax(116px, 1fr));
    gap: 12px;
}
.category-page .latest-title {
    font-size: 0.78rem;
}

.anime-search-box {
    align-items: stretch;
}
.anime-history-section {
    padding-top: 0;
}
.anime-history-head {
    margin-bottom: 12px;
}
.anime-history-tools {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.anime-history-clear {
    padding: 8px 14px;
}
.anime-site-select {
    min-width: 140px;
}
.anime-grid .anime-card .latest-title {
    min-height: 2.6em;
}
.anime-cover img {
    object-fit: cover;
}
.anime-empty code {
    color: #93f7ec;
}

.anime-player-wrap {
    margin-top: 1rem;
    scroll-margin-top: 84px;
}
.anime-player-box {
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    background: #03050b;
}
.anime-video,
.anime-iframe {
    display: block;
    width: 100%;
    min-height: min(58vw, 460px);
    border: 0;
    background: #000;
}
.anime-quality-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}
.anime-player-head {
    align-items: center;
    gap: 12px;
}
.anime-player-tools {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.anime-save-offline-btn {
    padding: 8px 14px;
}
.anime-bottom-nav .anime-nav-mid {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.chapter-row-active {
    background: rgba(53, 208, 189, .1);
    border-left: 2px solid var(--accent);
    color: var(--text);
}
.offline-state {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-card);
    max-width: 700px;
    margin: 0 auto;
}

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 1200px) {
    .navbar { padding: 0 1.25rem; }
    .nav-links { gap: 1rem; font-size: 0.86rem; }
    .container { padding: 0 1.25rem; }
    .hero-content {
        padding-left: 1.25rem;
        padding-right: 1.25rem;
    }
    .hero-cover-float { right: 1.25rem; }
}

@media (max-width: 1024px) {
    .hero { min-height: 460px; }
    .hero-title { font-size: clamp(1.9rem, 5.5vw, 3rem); }
    .latest-grid { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 14px; }
    .new-grid { grid-template-columns: repeat(4, 1fr); }
    .section-header { gap: .8rem; flex-wrap: wrap; }
    .tabs-inline {
        width: 100%;
        overflow-x: auto;
        padding-bottom: 2px;
        scrollbar-width: none;
    }
    .tabs-inline::-webkit-scrollbar { display: none; }
    .tab-link { flex-shrink: 0; }
    .reader-images { max-width: 760px; }
    .search-input { min-height: 44px; }
}

@media (max-width: 900px) {
    .dual-col { grid-template-columns: 1fr; }
    .hero-cover-float { display: none; }
    .hero-content { padding-right: 1.5rem; max-width: 100%; }
    .manga-detail { grid-template-columns: 1fr; }
    .manga-cover-lg { max-width: 220px; }
    .reader-toolbar { position: static; flex-wrap: wrap; }
}

@media (max-width: 768px) {
    .navbar { padding: 0 1rem; }
    .nav-logo-image { width: 30px; height: 30px; }
    .nav-logo-text { font-size: 1.25rem; }
    .nav-links { display: none; }
    .nav-mobile-user { display: flex; }
    .nav-hamburger { display: flex; }
    .nav-mobile { display: flex; }
    .nav-mobile a { padding: 12px 1rem; }
    .nav-mobile .nav-mobile-install {
        margin: 10px 1rem;
        width: calc(100% - 2rem);
    }

    .auth-page { grid-template-columns: 1fr; }
    .auth-panel { padding: 2.5rem 1.5rem; min-height: 200px; }
    .auth-panel-stats { gap: 1.5rem; }
    .auth-panel h1 { font-size: 2.2rem; }
    .auth-form-panel { padding: 2rem 1.25rem; }

    .latest-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }
    .hero { min-height: 380px; }
    .search-box { flex-direction: column; }
    .anime-player-tools,
    .anime-history-tools {
        width: 100%;
    }
    .anime-save-offline-btn,
    .anime-history-clear {
        width: 100%;
        justify-content: center;
    }
    .manga-actions { flex-direction: column; align-items: stretch; }
    .manga-actions .btn-hero-primary,
    .manga-actions .btn-hero-outline { justify-content: center; text-align: center; }
    .reader-toolbar { gap: .75rem; }
    .reader-nav { width: 100%; justify-content: space-between; }
    .chapter-row { flex-direction: column; gap: 3px; }
    .comment-form-actions { flex-direction: column; align-items: stretch; }
    .comment-form-actions .btn-hero-primary { width: 100%; justify-content: center; }
    .reply-form { grid-template-columns: 1fr; }
    .profile-head { flex-direction: column; align-items: flex-start; }
    .profile-avatar { width: 64px; height: 64px; }
    .footer { padding-left: 1rem; padding-right: 1rem; }
}

@media (max-width: 600px) {
    .container { padding: 0 .9rem; }
    .page-block { padding-top: 1.2rem; padding-bottom: 1.8rem; }
    .section-title { font-size: 1.25rem; letter-spacing: 1px; }
    .section-more { font-size: 0.75rem; }
    .hero-content { padding: 2rem .9rem; }
    .hero-stats { flex-wrap: wrap; gap: .6rem 1rem; }
    .genre-pill { padding: 4px 12px; font-size: 0.76rem; }
    .new-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
    .reader-toolbar { padding: 8px 10px; }
    .reader-nav { flex-direction: column; }
    .reader-nav .btn-hero-outline,
    .reader-nav .btn-hero-primary { width: 100%; justify-content: center; }
    .reader-bottom-nav {
        grid-template-columns: 1fr;
    }
    .reader-chapter-select { order: 2; }
    .auth-form-panel { padding: 1.4rem .9rem; }
    .auth-panel { padding: 1.8rem .9rem; }
    .search-input { padding: 10px 12px; }
}

@media (max-width: 480px) {
    .latest-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
    .new-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
    .navbar { height: 56px; }
    .nav-logo-image { width: 28px; height: 28px; }
    .nav-logo-text { display: none; }
    .mobile-quick { padding: 4px 8px; font-size: 0.72rem; }
    .section-genres { top: 56px; }
    .hero { min-height: 340px; }
    .hero-title { font-size: 1.85rem; }
    .hero-actions { width: 100%; }
    .btn-hero-primary, .btn-hero-outline {
        width: 100%;
        justify-content: center;
    }
}
