:root {
    --bg-body: #343434;
    --bg-secondary: #2b2b2b;
    --bg-card: #3e3e3e;
    --bg-card-hover: #4a4a4a;
    --bg-header: rgba(52, 52, 52, 0.94);
    --accent: #CCCC66;
    --accent-hover: #FFCC66;
    --accent-soft: rgba(204, 204, 102, 0.15);
    --text-primary: #ffffff;
    --text-secondary: #cccccc;
    --text-muted: #999999;
    --border: #555555;
    --shadow: rgba(0, 0, 0, 0.35);
    --radius: 10px;
    --radius-sm: 6px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    background: var(--bg-body);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans TC', 'Microsoft JhengHei', sans-serif;
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--accent-hover); }

/* ===== SITE HEADER ===== */
.site-header {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, #3a3a2a 100%);
    border-bottom: 1px solid var(--border);
    padding: 28px 20px 24px;
    text-align: center;
}
.site-header h1 {
    font-size: 2em;
    font-weight: 800;
    letter-spacing: 3px;
    margin-bottom: 4px;
}
.site-header h1 a { color: var(--text-primary); }
.site-header h1 a:hover { color: var(--accent); }
.site-header .subtitle {
    color: var(--text-secondary);
    font-size: 0.9em;
}
.site-header.compact { padding: 14px 20px; display: flex; align-items: center; gap: 16px; }
.site-header.compact h1 { font-size: 1.2em; letter-spacing: 1px; flex: 1; text-align: left; }
.home-btn {
    color: var(--text-secondary);
    font-size: 0.88em;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
    flex-shrink: 0;
}
.home-btn:hover { background: var(--bg-card-hover); color: var(--text-primary); }

/* ===== USER AUTH WIDGET ===== */
.site-header { position: relative; }
.site-header .user-auth,
.site-header .login-btn { position: absolute; top: 14px; right: 20px; }
.site-header.compact .user-auth,
.site-header.compact .login-btn { position: static; }

.login-btn {
    color: var(--text-secondary);
    font-size: 0.88em;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
    flex-shrink: 0;
}
.login-btn:hover { background: var(--bg-card-hover); color: var(--text-primary); }

.user-auth { flex-shrink: 0; }
.user-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px 4px 4px;
    border: none;
    border-radius: 20px;
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.85em;
    transition: background 0.15s;
}
.user-toggle:hover { background: var(--bg-card-hover); }
.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.user-name {
    max-width: 100px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.user-menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    min-width: 220px;
    box-shadow: 0 8px 32px var(--shadow);
    z-index: 200;
    animation: userMenuIn 0.12s ease-out;
}
.user-auth.open .user-menu { display: block; }
@keyframes userMenuIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}
.user-menu-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 12px;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--border);
}
.user-menu-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.user-menu-name { font-weight: 600; font-size: 0.92em; color: var(--text-primary); }
.user-menu-email { font-size: 0.78em; color: var(--text-muted); word-break: break-all; }
.user-menu-item {
    display: block;
    padding: 8px 0;
    color: var(--text-secondary);
    font-size: 0.88em;
    transition: color 0.15s;
}
.user-menu-item:hover { color: var(--text-primary); }

@media (max-width: 768px) {
    .user-name { display: none; }
    .user-toggle { padding: 3px; }
    .user-avatar { width: 24px; height: 24px; }
    .site-header .user-auth,
    .site-header .login-btn { top: 8px; right: 12px; }
    .login-btn { padding: 4px 10px; font-size: 0.82em; }
    .site-header.compact .user-auth,
    .site-header.compact .login-btn { position: static; }
}

/* ===== APP DOWNLOAD BANNER ===== */
.app-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    margin: 0 auto 16px;
    max-width: 900px;
    background: linear-gradient(135deg, rgba(204,204,102,0.15), rgba(204,204,102,0.05));
    border: 1px solid rgba(204,204,102,0.3);
    border-radius: var(--radius);
    font-size: 0.88em;
}
.app-banner-text { flex: 1; color: var(--text-secondary); }
.app-banner-btn {
    flex-shrink: 0;
    padding: 8px 18px;
    background: var(--accent);
    color: #222;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.9em;
    transition: background 0.15s;
}
.app-banner-btn:hover { background: var(--accent-hover); color: #222; }
.app-banner-close {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.3em;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}
.app-banner-close:hover { color: var(--text-primary); }
@media (max-width: 480px) {
    .app-banner { flex-wrap: wrap; padding: 10px 14px; gap: 8px; }
    .app-banner-text { width: 100%; font-size: 0.85em; }
}

/* ===== TYPE TABS ===== */
.type-tabs {
    max-width: 1200px;
    margin: 20px auto 0;
    padding: 0 20px;
    display: flex;
    gap: 8px;
}
.type-tab {
    padding: 8px 20px;
    border-radius: 20px;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.88em;
    transition: all 0.15s;
}
.type-tab:hover { border-color: var(--accent); color: var(--text-primary); }
.type-tab.active { background: var(--accent); border-color: var(--accent); color: #222; font-weight: 600; }

.type-badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.68em;
    font-weight: 700;
    letter-spacing: 0.5px;
}
.type-original { background: #2d6a4f; color: #fff; }
.type-doujin { background: #6a4c93; color: #fff; }

/* ===== LOCK HERO ===== */
.lock-hero {
    max-width: 400px;
    margin: 40px auto 30px;
    padding: 40px 24px;
    text-align: center;
}
.lock-icon {
    font-size: 4em;
    cursor: pointer;
    display: inline-block;
    transition: transform 0.3s;
    animation: lock-pulse 2.5s ease-in-out infinite;
    user-select: none;
}
.lock-icon:hover { transform: scale(1.15); }
.lock-icon:active { transform: scale(0.95); }
@keyframes lock-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}
.lock-count {
    font-size: 1.4em;
    font-weight: 700;
    color: var(--accent);
    margin: 16px 0 8px;
}
.lock-desc {
    color: var(--text-muted);
    font-size: 0.92em;
    line-height: 1.6;
    margin-bottom: 24px;
}
.lock-desc strong { color: var(--accent); }
.lock-btn {
    display: inline-block;
    padding: 14px 36px;
    border: 2px solid var(--accent);
    border-radius: 50px;
    background: transparent;
    color: var(--accent);
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    letter-spacing: 1px;
    transition: all 0.2s;
}
.lock-btn:hover {
    background: var(--accent);
    color: #222;
    box-shadow: 0 4px 20px rgba(204, 204, 102, 0.3);
}

/* ===== UNLOCK ===== */
.unlock-tab {
    background: transparent;
    border: 1px solid var(--border);
    cursor: pointer;
    font-size: 1em;
    padding: 6px 12px;
    line-height: 1;
}
.unlock-tab:hover { border-color: var(--accent); }
.unlock-tab.unlocked { border-color: #2d6a4f; }

.unlock-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}
.unlock-overlay.show { display: flex; }
.unlock-modal {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 28px 24px;
    min-width: 300px;
    max-width: 360px;
    text-align: center;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
}
.unlock-modal h3 { font-size: 1.2em; margin-bottom: 8px; }
.unlock-hint { font-size: 0.85em; color: var(--text-muted); margin-bottom: 18px; }
.unlock-modal input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-body);
    color: var(--text-primary);
    font-size: 1.1em;
    text-align: center;
    letter-spacing: 2px;
    outline: none;
    transition: border-color 0.2s;
    margin-bottom: 8px;
}
.unlock-modal input:focus { border-color: var(--accent); }
.unlock-msg { font-size: 0.85em; min-height: 1.4em; margin-bottom: 14px; }
.unlock-msg.error { color: #e94560; }
.unlock-msg.success { color: #2d6a4f; }
.unlock-btns { display: flex; gap: 10px; justify-content: center; }
.unlock-btn {
    padding: 10px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.92em;
    cursor: pointer;
    transition: background 0.15s;
}
.unlock-btn.primary { background: var(--accent); color: #222; }
.unlock-btn.primary:hover { background: var(--accent-hover); }
.unlock-btn.cancel { background: var(--bg-card); color: var(--text-secondary); }
.unlock-btn.cancel:hover { background: var(--bg-card-hover); }
.unlock-btn.danger { background: #e94560; color: #fff; }
.unlock-btn.danger:hover { background: #c73e54; }

/* ===== SEARCH ===== */
.search-bar {
    max-width: 520px;
    margin: 24px auto 8px;
    padding: 0 20px;
}
.search-bar input {
    width: 100%;
    padding: 12px 22px;
    border: 1px solid var(--border);
    border-radius: 50px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.95em;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.search-bar input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.search-bar input::placeholder { color: var(--text-muted); }

/* ===== SECTION TITLE ===== */
.section-title {
    max-width: 1200px;
    margin: 24px auto 0;
    padding: 0 20px;
    font-size: 1.1em;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 12px;
}
.section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* ===== MANGA GRID ===== */
.manga-grid {
    max-width: 1200px;
    margin: 16px auto 0;
    padding: 0 20px 40px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 20px;
}
.manga-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
}
.manga-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 32px var(--shadow);
}
.manga-card a { color: inherit; display: block; }
.manga-card .cover-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 4;
    overflow: hidden;
    background: var(--bg-secondary);
}
.manga-card .cover-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.35s;
}
.manga-card:hover .cover-wrap img { transform: scale(1.06); }

.status-badge {
    position: absolute;
    top: 0;
    left: 0;
    background: #2d6a4f;
    color: #fff;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.68em;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.manga-card .card-body {
    padding: 12px;
}
.manga-card .card-body h3 {
    font-size: 0.95em;
    font-weight: 600;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.manga-card .card-body .meta {
    font-size: 0.78em;
    color: var(--text-muted);
}

/* ===== MANGA DETAIL ===== */
.manga-detail {
    max-width: 960px;
    margin: 0 auto;
    padding: 28px 20px;
}
.manga-hero {
    display: flex;
    gap: 28px;
    margin-bottom: 36px;
}
.manga-hero .cover {
    flex-shrink: 0;
    width: 220px;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 6px 24px var(--shadow);
    align-self: flex-start;
}
.manga-hero .cover img { width: 100%; display: block; }

.manga-hero .info { flex: 1; min-width: 0; }
.manga-hero .info h1 { font-size: 1.8em; margin-bottom: 14px; line-height: 1.3; }
.manga-hero .info .mobile-author { display: none; }
.mobile-meta { display: none; }

.meta-table {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 6px 16px;
    font-size: 0.9em;
    margin-bottom: 16px;
}
.meta-table .label { color: var(--text-muted); white-space: nowrap; }
.meta-table .value { color: var(--text-secondary); }

.genres { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.genre-tag {
    background: var(--accent-soft);
    color: var(--accent);
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 0.82em;
    font-weight: 500;
}

.description {
    color: var(--text-secondary);
    font-size: 0.92em;
    line-height: 1.8;
    margin-bottom: 22px;
}

.action-btns { display: flex; gap: 12px; flex-wrap: wrap; }

.mobile-bottom-bar {
    display: none;
}
@media (max-width: 768px) {
    .mobile-bottom-bar {
        display: block;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        padding: 10px 16px;
        padding-bottom: max(10px, env(safe-area-inset-bottom));
        background: var(--bg-secondary);
        border-top: 1px solid var(--border);
        z-index: 90;
        box-shadow: 0 -4px 16px var(--shadow);
    }
    .mobile-bottom-btns {
        display: flex;
        gap: 10px;
    }
    .mobile-bottom-bar .btn {
        flex: 1;
        justify-content: center;
        padding: 13px 12px;
        font-size: 0.95em;
        text-align: center;
    }
    .manga-hero .info .action-btns { display: none; }
}


.source-links {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}
.source-links-label {
    font-size: 0.82em;
    color: var(--text-muted);
    white-space: nowrap;
}
.source-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    border-radius: 20px;
    background: rgba(233, 69, 96, 0.12);
    color: #e94560;
    font-size: 0.82em;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.15s;
}
.source-link:hover {
    background: rgba(233, 69, 96, 0.25);
}
.source-link::before {
    content: '♥';
    font-size: 0.9em;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 11px 28px;
    border-radius: var(--radius-sm);
    font-size: 0.95em;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--accent); color: #222; }
.btn-primary:hover { background: var(--accent-hover); color: #222; }
.btn-secondary { background: var(--bg-card); color: var(--text-primary); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg-card-hover); color: var(--text-primary); }

/* ===== CHAPTER LIST ===== */
.chapter-section { margin-top: 4px; }
.chapter-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}
.chapter-header h2 {
    font-size: 1.15em;
    color: var(--text-primary);
}
.sort-btn {
    padding: 5px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.8em;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
    white-space: nowrap;
}
.sort-btn:hover { border-color: var(--accent); color: var(--text-primary); }
/* ── Continue reading ── */


/* ── Chapter read marker ── */
.chapter-list li.ch-read .ch-title { color: var(--text-muted); }
.chapter-list li.ch-read .ch-title::after {
    content: ' ✓';
    font-size: 0.8em;
    color: var(--accent);
}

.chapter-list { list-style: none; }
.chapter-list li { border-bottom: 1px solid rgba(42, 42, 62, 0.4); position: relative; }
.chapter-list li:last-child { border-bottom: none; }
.chapter-list li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    transition: background 0.12s;
}
.chapter-list li a:hover { background: var(--bg-card); }
.chapter-cat-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}
.chapter-cat-tab {
    padding: 6px 18px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.85em;
    cursor: pointer;
    transition: all 0.15s;
}
.chapter-cat-tab:hover { border-color: var(--accent); color: var(--text-primary); }
.chapter-cat-tab.active { background: var(--accent); border-color: var(--accent); color: #222; font-weight: 600; }

.chapter-list .ch-cover-thumb {
    width: 36px;
    min-width: 36px;
    height: 48px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
}
.chapter-list.hide-covers .ch-cover-thumb { display: none; }

/* Card mode for category views (e.g. 實體本) */
.chapter-list.card-mode {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 20px;
}
.chapter-list.card-mode li {
    border-bottom: none;
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.chapter-list.card-mode li a {
    flex-direction: column;
    align-items: stretch;
    padding: 0;
    gap: 0;
}
.chapter-list.card-mode li a:hover { background: var(--bg-card-hover); }
.chapter-list.card-mode .ch-cover-thumb {
    width: 100%;
    height: auto;
    min-width: unset;
    object-fit: unset;
    border-radius: 0;
}
.chapter-list.card-mode .ch-title {
    padding: 10px 12px 4px;
    font-size: 0.9em;
    font-weight: 600;
}
.chapter-list.card-mode .ch-date {
    padding: 0 12px 10px;
    font-size: 0.75em;
}
.ch-dl-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border: 2px solid var(--accent);
    border-radius: 50%;
    background: transparent;
    color: var(--accent);
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    transition: all 0.2s;
    padding: 0;
    line-height: 1;
}
.ch-dl-btn:active { transform: translateY(-50%) scale(0.9); }
.ch-dl-btn.downloaded {
    background: var(--accent);
    color: #222;
    border-color: var(--accent);
}
.ch-dl-btn.downloading {
    border-color: var(--accent);
    color: var(--accent);
    font-size: 0.65em;
    animation: pulse-dl 1s infinite;
}
.ch-dl-btn.failed {
    border-color: #e94560;
    color: #e94560;
}
@keyframes pulse-dl {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}
.chapter-list.has-dl li a { padding-right: 52px; }

.ch-ext-link {
    display: block;
    text-align: center;
    padding: 8px 12px;
    margin: 0 10px 10px;
    background: var(--accent);
    color: #222;
    border-radius: var(--radius-sm);
    font-size: 0.82em;
    font-weight: 600;
    transition: background 0.15s;
}
.ch-ext-link:hover { background: var(--accent-hover); color: #222; }

@media (max-width: 480px) {
    .chapter-list.card-mode {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    .chapter-list.card-mode .ch-cover-thumb {
        aspect-ratio: 3 / 4;
        object-fit: cover;
    }
}
.chapter-list li a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    transition: background 0.12s;
}
.chapter-list .ch-title { font-size: 0.93em; flex: 1; }
.chapter-list .ch-date { font-size: 0.8em; color: var(--text-muted); flex-shrink: 0; }

/* ===== READER HEADER ===== */
.reader-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-header);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    gap: 12px;
}
.reader-header .left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.reader-header .back-btn {
    color: var(--text-secondary);
    font-size: 1.3em;
    padding: 2px 8px;
    border-radius: 4px;
    transition: background 0.12s;
    flex-shrink: 0;
}
.reader-header .back-btn:hover { background: rgba(255,255,255,0.08); color: var(--text-primary); }
.reader-header .title {
    font-size: 0.95em;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.reader-header .right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.reader-header .chapter-select {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    font-size: 0.85em;
    cursor: pointer;
    max-width: 160px;
}
.reader-header .page-count { color: var(--text-muted); font-size: 0.82em; white-space: nowrap; }
.offline-badge {
    display: inline-block;
    background: var(--accent);
    color: #222;
    font-size: 0.7em;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    white-space: nowrap;
}

/* ===== READER MODE BAR ===== */
.reader-mode-bar {
    position: sticky;
    top: 48px;
    z-index: 99;
    background: rgba(15, 15, 15, 0.9);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 8px;
    border-bottom: 1px solid rgba(42, 42, 62, 0.5);
}
.reader-mode-bar button {
    padding: 5px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.82em;
    transition: all 0.15s;
}
.reader-mode-bar button.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #222;
}
.mode-sep { color: var(--border); user-select: none; line-height: 30px; }
.mode-link {
    padding: 5px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.82em;
    text-decoration: none;
    transition: all 0.15s;
}
.mode-link:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* ===== SCROLL VIEW ===== */
.scroll-view {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 0 20px;
}
.scroll-view .page { width: 100%; display: flex; justify-content: center; margin-bottom: 12px; }
.scroll-view .page img { max-width: 100%; height: auto; display: block; }

/* ===== SINGLE VIEW ===== */
.single-view {
    display: none;
    max-width: 900px;
    margin: 0 auto;
    padding: 20px 0 100px;
    text-align: center;
    position: relative;
    min-height: calc(100vh - 120px);
}
.single-view img {
    max-width: 100%;
    max-height: calc(100vh - 160px);
    object-fit: contain;
    user-select: none;
}
.single-view .nav-area {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 40%;
    cursor: pointer;
    z-index: 10;
}
.single-view .nav-area.left { left: 0; }
.single-view .nav-area.right { right: 0; }
.single-view .nav-area::after {
    content: '';
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
    background-repeat: no-repeat;
    background-position: center;
    background-size: 18px;
}
.single-view .nav-area.left::after {
    left: 16px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='15 18 9 12 15 6'/%3E%3C/svg%3E");
}
.single-view .nav-area.right::after {
    right: 16px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='9 6 15 12 9 18'/%3E%3C/svg%3E");
}
@media (hover: hover) {
    .single-view .nav-area:hover::after { opacity: 1; }
}
.single-view .nav-area:active::after { opacity: 0.8; }
.single-view .nav-area.hint::after {
    opacity: 1;
    animation: navHintPulse 1.5s ease-out forwards;
}
@keyframes navHintPulse {
    0% { opacity: 0; transform: translateY(-50%) scale(0.8); }
    20% { opacity: 1; transform: translateY(-50%) scale(1.1); }
    40% { opacity: 1; transform: translateY(-50%) scale(1); }
    100% { opacity: 0; transform: translateY(-50%) scale(1); }
}
.single-view .page-info { margin-top: 14px; color: var(--text-muted); font-size: 0.9em; }

/* ===== CHAPTER TOAST ===== */
.ch-toast {
    position: fixed;
    bottom: -200px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 14px;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 18px;
    z-index: 200;
    box-shadow: 0 -4px 24px rgba(0,0,0,0.5);
    transition: bottom 0.35s cubic-bezier(0.22,1,0.36,1);
    max-width: 400px;
    width: calc(100% - 32px);
}
.ch-toast.show { bottom: 80px; }
.ch-toast-cover {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    flex-shrink: 0;
}
.ch-toast-body { flex: 1; min-width: 0; }
.ch-toast-label { font-size: 0.75em; color: var(--text-muted); margin-bottom: 2px; }
.ch-toast-title { font-size: 0.95em; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 8px; }
.ch-toast-btns { display: flex; gap: 8px; }
.ch-toast-btn {
    display: inline-block;
    padding: 5px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.82em;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: background 0.15s;
}
.ch-toast-btn.secondary { background: transparent; border: 1px solid var(--border); color: var(--text-secondary); }
.ch-toast-btn.secondary:hover { background: var(--bg-card-hover); }
.ch-toast-btn.primary { background: var(--accent); color: #222; }
.ch-toast-btn.primary:hover { background: var(--accent-hover); }

/* ===== BOTTOM PAGE NAV ===== */
.page-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-header);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 10px 20px 12px;
    border-top: 1px solid var(--border);
    z-index: 100;
}
.page-nav .slider-row { display: flex; align-items: center; gap: 12px; }
.page-nav input[type=range] { flex: 1; accent-color: var(--accent); height: 6px; }
.page-nav.rtl .slider-row { direction: rtl; }
.page-nav .pg-label { font-size: 0.85em; min-width: 56px; text-align: center; color: var(--text-secondary); }
.page-nav .btn-row { display: flex; justify-content: center; gap: 8px; margin-top: 8px; }
.page-nav .btn-row button {
    padding: 7px 22px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.85em;
    transition: background 0.12s;
}
.page-nav .btn-row button:hover { background: var(--bg-card); }

/* ===== IMMERSIVE READER (MOBILE) ===== */
@media (max-width: 768px) {
    .reader-header,
    .reader-mode-bar,
    .page-nav {
        transition: transform 0.3s ease;
    }
    .reader-header {
        position: fixed;
        left: 0;
        right: 0;
    }
    .reader-mode-bar {
        position: fixed;
        left: 0;
        right: 0;
    }
    .scroll-view {
        padding-top: 92px;
    }
    .single-view {
        padding-top: 92px;
    }
    body.reader-chrome-hidden .reader-header {
        transform: translateY(-100%);
    }
    body.reader-chrome-hidden .reader-mode-bar {
        transform: translateY(calc(-100% - 48px));
    }
    body.reader-chrome-hidden .page-nav {
        transform: translateY(100%);
    }

    /* Mobile single-page: lock viewport, center image */
    body.reader-single-mode {
        overflow: hidden;
    }
    body.reader-single-mode .single-view {
        position: fixed !important;
        inset: 0;
        display: flex !important;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 92px 0 80px;
        min-height: unset;
        overflow: hidden;
        z-index: 50;
        margin: 0;
        touch-action: pinch-zoom;
    }
    body.reader-single-mode .single-view img {
        max-height: 100%;
        max-width: 100%;
        flex-shrink: 1;
        min-height: 0;
    }
    body.reader-single-mode .single-view .page-info {
        flex-shrink: 0;
        margin-top: 6px;
    }
    body.reader-single-mode.reader-chrome-hidden .single-view {
        padding: 10px 0;
    }
}

/* ===== CHAPTER END NAV ===== */
.chapter-end-nav {
    max-width: 900px;
    margin: 20px auto 40px;
    padding: 36px 20px;
    text-align: center;
    border-top: 1px solid var(--border);
}
.chapter-end-nav .end-label { color: var(--text-muted); margin-bottom: 20px; font-size: 1em; font-weight: 400; }
.chapter-end-nav .nav-btns { display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; margin-top: 16px; }

.next-chapter-card {
    display: flex;
    align-items: center;
    gap: 16px;
    max-width: 420px;
    margin: 0 auto 8px;
    padding: 16px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    color: inherit;
    text-align: left;
    transition: background 0.15s, border-color 0.15s;
}
.next-chapter-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent);
}
.next-chapter-cover {
    width: 72px;
    height: 72px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    flex-shrink: 0;
}
.next-chapter-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}
.next-chapter-label {
    font-size: 0.75em;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.next-chapter-title {
    font-size: 1.05em;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.next-chapter-go {
    font-size: 0.85em;
    color: var(--accent);
    font-weight: 600;
}

/* ===== PULL TO REFRESH ===== */
#pullRefreshIndicator {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%) translateY(-40px);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.2s;
    font-size: 0.85em;
    color: var(--text-secondary);
    pointer-events: none;
}
#pullRefreshIndicator .ptr-arrow {
    font-size: 1.1em;
    transition: transform 0.2s;
}
#pullRefreshIndicator.ptr-ready .ptr-arrow {
    color: var(--accent);
}
#pullRefreshIndicator.ptr-ready .ptr-text {
    color: var(--accent);
}
@keyframes ptr-spin {
    to { transform: rotate(360deg); }
}
#pullRefreshIndicator.ptr-loading .ptr-arrow {
    animation: ptr-spin 0.6s linear infinite;
}

/* ===== COMMENT SECTION ===== */
.comment-page-wrap {
    padding-top: 16px;
}
.comment-section {
    max-width: 900px;
    margin: 0 auto 40px;
    padding: 0 20px;
}
.comment-section h3 {
    font-size: 1.1em;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}
.comment-form {
    margin-bottom: 24px;
}
.comment-form-user {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    font-size: 0.92em;
    font-weight: 600;
    color: var(--text-secondary);
}
.comment-form-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}
.comment-login-prompt {
    text-align: center;
    padding: 32px 20px;
    margin-bottom: 24px;
    background: linear-gradient(135deg, rgba(204,204,102,0.1), rgba(204,204,102,0.04));
    border: 1px solid rgba(204,204,102,0.25);
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 0.95em;
}
.comment-login-prompt p { margin-bottom: 16px; }
.comment-login-prompt .btn { font-size: 0.95em; }
.comment-form-row {
    margin-bottom: 10px;
}
.comment-form input[type="text"] {
    width: 200px;
    padding: 9px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.9em;
    outline: none;
    transition: border-color 0.15s;
}
.comment-form input[type="text"]:focus {
    border-color: var(--accent);
}
.comment-form textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.9em;
    font-family: inherit;
    resize: vertical;
    outline: none;
    transition: border-color 0.15s;
    margin-bottom: 10px;
}
.comment-form textarea:focus {
    border-color: var(--accent);
}
.comment-form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.comment-hint {
    font-size: 0.85em;
}
.comment-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.comment-item {
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
}
.comment-head {
    display: flex;
    gap: 12px;
}
.comment-head-right { flex: 1; min-width: 0; }
.comment-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.comment-avatar-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card-hover);
    color: var(--text-muted);
    font-size: 0.85em;
    font-weight: 600;
}
.comment-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.comment-nick {
    font-weight: 600;
    font-size: 0.9em;
    color: var(--accent);
}
.comment-time {
    font-size: 0.78em;
    color: var(--text-muted);
}
.comment-text {
    font-size: 0.9em;
    line-height: 1.6;
    color: var(--text-secondary);
    word-break: break-word;
}
.comment-reply {
    margin-top: 10px;
    padding: 10px 14px;
    background: rgba(204, 204, 102, 0.08);
    border-left: 3px solid var(--accent);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: 0.88em;
    line-height: 1.5;
    color: var(--text-secondary);
    word-break: break-word;
}
.reply-badge {
    display: inline-block;
    background: var(--accent);
    color: #1a1a1a;
    font-size: 0.72em;
    font-weight: 700;
    padding: 1px 8px;
    border-radius: 3px;
    margin-right: 8px;
    vertical-align: middle;
}
.no-comments {
    color: var(--text-muted);
    font-size: 0.9em;
    text-align: center;
    padding: 20px;
}

/* ===== EMPTY STATE ===== */
.empty-state { text-align: center; padding: 80px 20px; color: var(--text-muted); }
.empty-state p { font-size: 1.1em; }

/* ===== FOOTER ===== */
.site-footer {
    text-align: center;
    padding: 24px 20px;
    color: var(--text-muted);
    font-size: 0.78em;
    border-top: 1px solid var(--border);
    margin-top: 40px;
}
.site-footer a {
    color: var(--text-muted);
    text-decoration: none;
}
.site-footer a:hover {
    color: var(--accent);
}
@media (max-width: 768px) {
    .site-footer { padding-bottom: 120px; }
}

/* ===== SOCIAL LINKS ===== */
.social-links {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin: 14px 0 6px;
}
.social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-card);
    transition: background 0.15s, transform 0.15s;
}
.social-link:hover {
    background: var(--bg-card-hover);
    transform: scale(1.1);
}
.social-icon {
    display: block;
    width: 18px;
    height: 18px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}
.social-icon[data-icon="x"] {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23ccc'%3E%3Cpath d='M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z'/%3E%3C/svg%3E");
}
.social-icon[data-icon="pixiv"] {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23ccc'%3E%3Cpath d='M4.935 0A4.924 4.924 0 0 0 0 4.935v14.13A4.924 4.924 0 0 0 4.935 24h14.13A4.924 4.924 0 0 0 24 19.065V4.935A4.924 4.924 0 0 0 19.065 0zm7.81 4.547c2.181 0 4.058.676 5.399 1.847a6.118 6.118 0 0 1 2.116 4.66c.005 1.854-.88 3.476-2.257 4.563-1.375 1.1-3.215 1.688-5.258 1.688-2.044 0-3.63-.348-3.63-.348v3.514H6.213V5.855S9.67 4.547 12.745 4.547zm-.177 2.394c-1.334 0-3.243.482-3.243.482v7.27s1.467.378 3.065.378c1.39 0 2.622-.396 3.453-1.07.843-.683 1.32-1.67 1.32-2.895 0-1.226-.453-2.295-1.32-2.977-.856-.672-2.048-1.188-3.275-1.188z'/%3E%3C/svg%3E");
}
.social-icon[data-icon="plurk"] {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23ccc'%3E%3Cpath d='M12 0C5.373 0 0 5.373 0 12s5.373 12 12 12 12-5.373 12-12S18.627 0 12 0zm5.5 14c-.828 0-1.5-.672-1.5-1.5s.672-1.5 1.5-1.5 1.5.672 1.5 1.5-.672 1.5-1.5 1.5zm-5.5 0c-.828 0-1.5-.672-1.5-1.5S11.172 11 12 11s1.5.672 1.5 1.5S12.828 14 12 14zm-5.5 0c-.828 0-1.5-.672-1.5-1.5S5.672 11 6.5 11 8 11.672 8 12.5 7.328 14 6.5 14z'/%3E%3C/svg%3E");
}
.social-icon[data-icon="youtube"] {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23ccc'%3E%3Cpath d='M23.498 6.186a3.016 3.016 0 0 0-2.122-2.136C19.505 3.545 12 3.545 12 3.545s-7.505 0-9.377.505A3.017 3.017 0 0 0 .502 6.186C0 8.07 0 12 0 12s0 3.93.502 5.814a3.016 3.016 0 0 0 2.122 2.136c1.871.505 9.376.505 9.376.505s7.505 0 9.377-.505a3.015 3.015 0 0 0 2.122-2.136C24 15.93 24 12 24 12s0-3.93-.502-5.814zM9.545 15.568V8.432L15.818 12l-6.273 3.568z'/%3E%3C/svg%3E");
}
.social-icon[data-icon="threads"] {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23ccc'%3E%3Cpath d='M12.186 24h-.007c-3.581-.024-6.334-1.205-8.184-3.509C2.35 18.44 1.5 15.586 1.472 12.01v-.017c.03-3.579.879-6.43 2.525-8.482C5.845 1.205 8.6.024 12.18 0h.014c2.746.02 5.043.725 6.826 2.098 1.677 1.29 2.858 3.13 3.509 5.467l-2.04.569c-1.104-3.96-3.898-5.984-8.304-6.015-2.91.022-5.11.936-6.54 2.717C4.307 6.504 3.616 8.914 3.59 12c.025 3.086.718 5.496 2.057 7.164 1.432 1.781 3.632 2.695 6.54 2.717 2.623-.02 4.358-.631 5.8-2.045 1.647-1.613 1.618-3.593 1.09-4.798-.346-.789-.96-1.42-1.744-1.838.164 1.528-.076 2.736-.739 3.593-.793 1.025-2.048 1.545-3.735 1.545h-.004c-1.426-.009-2.559-.462-3.37-1.35-.734-.805-1.117-1.881-1.117-3.127 0-2.546 1.726-4.323 4.194-4.323 1.263 0 2.283.432 2.952 1.248.563.687.878 1.596.913 2.618l-1.963.067c-.025-.709-.217-1.273-.57-1.674-.42-.477-1.052-.718-1.879-.718-1.616 0-2.341 1.312-2.341 2.782 0 1.694.953 2.479 2.168 2.487 1.105-.007 1.816-.322 2.296-.964.34-.454.534-1.06.577-1.81l.003-.046c1.038.218 1.9.61 2.548 1.167.878.755 1.371 1.78 1.371 3.052 0 1.487-.6 2.89-1.736 4.059C17.558 23.205 15.354 23.98 12.186 24z'/%3E%3C/svg%3E");
}
.social-icon[data-icon="facebook"] {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23ccc'%3E%3Cpath d='M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z'/%3E%3C/svg%3E");
}

/* ===== LOADING PLACEHOLDER ===== */
.cover-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-card));
    color: var(--text-muted);
    font-size: 2.5em;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .manga-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 12px;
        padding: 0 12px 32px;
    }
    .manga-detail { padding: 0 0 20px; }
    .manga-hero {
        flex-direction: column;
        gap: 0;
        margin-bottom: 24px;
    }
    .manga-hero .cover {
        width: 100%;
        max-height: 50vh;
        border-radius: 0;
        box-shadow: none;
        position: relative;
    }
    .manga-hero .cover img {
        width: 100%;
        max-height: 50vh;
        object-fit: cover;
        object-position: center center;
    }
    .manga-hero .cover::after {
        content: '';
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        height: 60px;
        background: linear-gradient(transparent, var(--bg-body));
        pointer-events: none;
    }
    .manga-hero .info {
        padding: 0 16px;
    }
    .manga-hero .info h1 {
        font-size: 1.4em;
        margin-bottom: 10px;
    }
    .meta-table {
        grid-template-columns: auto 1fr;
        gap: 4px 12px;
        font-size: 0.85em;
        margin-bottom: 12px;
    }
    .manga-hero .info h1 {
        font-size: 1.2em;
        margin-bottom: 4px;
    }
    .meta-table { display: none; }
    .manga-hero .info .mobile-author {
        display: block;
        font-size: 0.85em;
        color: var(--text-muted);
        margin-bottom: 6px;
    }
    .mobile-meta {
        display: flex;
        align-items: center;
        gap: 0;
        font-size: 0.82em;
        color: var(--text-muted);
        margin-bottom: 10px;
    }
    .mobile-meta .sep {
        margin: 0 6px;
        opacity: 0.5;
    }
    .genres {
        gap: 6px;
        margin-bottom: 12px;
    }
    .genres .genre-tag {
        padding: 2px 10px;
        font-size: 0.75em;
    }
    .description { font-size: 0.88em; margin-bottom: 16px; }
    .action-btns { margin-bottom: 12px; }
    .chapter-section { padding: 0 16px; }
    .manga-hero .cover .cover-placeholder {
        aspect-ratio: 3 / 2;
        font-size: 3em;
    }
    .site-header.compact h1 { text-align: center; }
    .site-header h1 { font-size: 1.6em; }
    .section-title { margin-top: 16px; }
    .reader-header .title { font-size: 0.85em; }
}

@media (max-width: 480px) {
    .manga-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
        padding: 0 8px 24px;
    }
    .manga-card .card-body { padding: 8px; }
    .manga-card .card-body h3 { font-size: 0.82em; }
    .manga-card .card-body .meta { font-size: 0.72em; }
    .manga-hero .cover { max-height: 40vh; }
    .manga-hero .cover img { max-height: 40vh; }
}

/* ── Share button + popup ── */
.share-wrap {
    position: relative;
    display: inline-block;
}
.share-trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.88em;
    transition: background 0.15s, color 0.15s;
}
.share-trigger:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}
.share-menu {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    z-index: 100;
    min-width: 260px;
    box-shadow: 0 8px 32px var(--shadow);
    animation: shareMenuIn 0.15s ease-out;
}
.share-menu.open { display: block; }
.share-menu::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 8px solid transparent;
    border-top-color: var(--bg-secondary);
}
@keyframes shareMenuIn {
    from { opacity: 0; transform: translateX(-50%) translateY(6px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.share-menu-title {
    font-size: 0.78em;
    color: var(--text-muted);
    margin-bottom: 10px;
    text-align: center;
}
.share-menu-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}
.share-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    color: var(--text-secondary);
    cursor: pointer;
    border: none;
    background: none;
    padding: 8px 4px;
    border-radius: var(--radius-sm);
    transition: background 0.15s;
    font-family: inherit;
}
.share-item:hover {
    background: var(--bg-card);
}
.share-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
}
.share-name {
    font-size: 0.72em;
    white-space: nowrap;
}
.share-copied {
    display: block;
    text-align: center;
    font-size: 0.82em;
    color: var(--accent);
    margin-top: 8px;
    opacity: 0;
    transition: opacity 0.3s;
}
.share-copied.show { opacity: 1; }

.share-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}
.share-overlay.open { display: block; }

@media (max-width: 768px) {
    .share-menu.open {
        position: fixed;
        top: 50%;
        left: 50%;
        bottom: auto;
        transform: translate(-50%, -50%);
        z-index: 1000;
        width: calc(100vw - 48px);
        max-width: 340px;
        animation: shareMenuMobileIn 0.2s ease-out;
    }
    .share-menu.open::after { display: none; }
    @keyframes shareMenuMobileIn {
        from { opacity: 0; transform: translate(-50%, -48%); }
        to { opacity: 1; transform: translate(-50%, -50%); }
    }
}
