
:root {
    --color-gray: #8f8787;
    --color-warm: #ebcbae;
    --color-light: #f9f9f9;
    --color-teal: #a6e4e7;
    --color-teal-dark: #7dc9cd;
    --color-text: #2c2c2c;
    --color-text-light: #5a5a5a;
    --color-white: #ffffff;
    --color-border: #e8e4e1;
    --color-accent: #e8876b;
    --color-star: #f0a050;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.10);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.12);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --max-width: 1320px;
    --nav-height: 60px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: var(--nav-height); }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Noto Sans SC', sans-serif;
    background-color: #f5f2ef;
    color: var(--color-text);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.top-nav {
    width: 100%; height: var(--nav-height); background: var(--color-white);
    border-bottom: 1px solid var(--color-border); position: sticky; top: 0; z-index: 1000;
    box-shadow: var(--shadow-sm); display: flex; align-items: center; padding: 0 20px;
}
.top-nav-inner {
    width: 100%; max-width: var(--max-width); margin: 0 auto;
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.nav-brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; text-decoration: none; color: var(--color-text); }
.nav-brand h1 { font-size: 1.45rem; font-weight: 700; letter-spacing: 0.5px; color: #3a3a3a; white-space: nowrap; margin: 0; line-height: 1; }
.nav-brand .brand-icon {
    width: 34px; height: 34px; border-radius: var(--radius-sm); background: var(--color-teal);
    display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1rem; color: #fff; flex-shrink: 0;
}
.nav-links { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; list-style: none; }
.nav-links a {
    display: inline-block; padding: 8px 15px; text-decoration: none; color: var(--color-text-light);
    font-size: 0.9rem; font-weight: 500; border-radius: 20px; transition: var(--transition); white-space: nowrap; letter-spacing: 0.3px;
}
.nav-links a:hover, .nav-links a:focus-visible { color: #3a3a3a; background: #f0ece8; outline: none; }
.nav-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.btn-login {
    padding: 8px 18px; border: 1.5px solid var(--color-gray); background: transparent; color: var(--color-text);
    border-radius: 20px; cursor: pointer; font-size: 0.85rem; font-weight: 500; transition: var(--transition); white-space: nowrap; letter-spacing: 0.3px;
}
.btn-login:hover { background: #f5f2ef; border-color: #6b6363; }
.btn-cta {
    padding: 9px 20px; border: none; background: var(--color-teal); color: #1a3a3c; border-radius: 20px;
    cursor: pointer; font-size: 0.85rem; font-weight: 600; transition: var(--transition); white-space: nowrap; letter-spacing: 0.3px;
}
.btn-cta:hover { background: var(--color-teal-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(166, 228, 231, 0.5); }

.nav-toggle { display: none; background: none; border: none; cursor: pointer; padding: 6px; flex-shrink: 0; }
.nav-toggle span { display: block; width: 24px; height: 2.5px; background: var(--color-text); margin: 5px 0; border-radius: 2px; transition: var(--transition); }

.main-container { width: 100%; max-width: var(--max-width); margin: 0 auto; display: flex; gap: 24px; padding: 20px 20px 40px; }
.main-content { flex: 1; min-width: 0; }
.sidebar { width: 340px; flex-shrink: 0; display: flex; flex-direction: column; gap: 20px; }

.section {
    background: var(--color-white); border-radius: var(--radius-lg); padding: 24px;
    box-shadow: var(--shadow-sm); margin-bottom: 20px; scroll-margin-top: calc(var(--nav-height) + 10px);
}
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; flex-wrap: wrap; gap: 10px; }
.section-title { font-size: 1.25rem; font-weight: 700; color: #3a3a3a; letter-spacing: 0.4px; position: relative; padding-left: 14px; }
.section-title::before {
    content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
    width: 4px; height: 22px; background: var(--color-teal); border-radius: 2px;
}
.section-more { font-size: 0.85rem; color: var(--color-gray); text-decoration: none; font-weight: 500; transition: var(--transition); cursor: pointer; border: none; background: none; }
.section-more:hover { color: var(--color-teal-dark); }

.comic-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 16px; }
.comic-card {
    background: var(--color-white); border-radius: var(--radius-md); overflow: hidden;
    transition: var(--transition); cursor: pointer; border: 1px solid transparent;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04); display: flex; flex-direction: column;
}
.comic-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--color-teal); }
.comic-card-img-wrap { position: relative; width: 100%; aspect-ratio: 3 / 4; overflow: hidden; background: #e8e4e1; }
.comic-card-img-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.4s ease; }
.comic-card:hover .comic-card-img-wrap img { transform: scale(1.06); }
.comic-card-badge {
    position: absolute; top: 8px; left: 8px; background: var(--color-accent); color: #fff;
    font-size: 0.7rem; font-weight: 700; padding: 3px 9px; border-radius: 12px; letter-spacing: 0.5px; z-index: 2;
}
.comic-card-info { padding: 10px 12px 12px; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.comic-card-title {
    font-size: 0.9rem; font-weight: 700; color: #3a3a3a; line-height: 1.3;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.comic-card-meta { font-size: 0.7rem; color: var(--color-gray); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.comic-card-meta span { display: block; }

.featured-scroll {
    display: flex; gap: 14px; overflow-x: auto; padding-bottom: 6px;
    scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch;
}
.featured-scroll::-webkit-scrollbar { height: 4px; }
.featured-scroll::-webkit-scrollbar-thumb { background: #d5cfca; border-radius: 4px; }
.featured-item {
    min-width: 170px; flex-shrink: 0; scroll-snap-align: start; border-radius: var(--radius-md);
    overflow: hidden; background: var(--color-white); box-shadow: var(--shadow-sm);
    transition: var(--transition); cursor: pointer; border: 1px solid transparent;
}
.featured-item:hover { box-shadow: var(--shadow-md); border-color: var(--color-teal); }
.featured-item img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; display: block; }
.featured-item-info { padding: 8px 10px; }
.featured-item-info .ftitle { font-weight: 700; font-size: 0.85rem; color: #3a3a3a; }
.featured-item-info .fmeta { font-size: 0.7rem; color: var(--color-gray); }

.detail-layout { display: flex; gap: 20px; flex-wrap: wrap; }
.detail-cover { width: 180px; flex-shrink: 0; border-radius: var(--radius-md); overflow: hidden; box-shadow: var(--shadow-md); aspect-ratio: 3 / 4; }
.detail-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.detail-body { flex: 1; min-width: 240px; }
.detail-body h3 { font-size: 1.2rem; font-weight: 700; margin-bottom: 6px; color: #3a3a3a; }
.detail-body .d-meta { font-size: 0.8rem; color: var(--color-gray); margin-bottom: 10px; display: flex; flex-wrap: wrap; gap: 4px 16px; }
.detail-body .d-meta span { white-space: nowrap; }
.detail-body .d-desc { font-size: 0.9rem; color: var(--color-text-light); line-height: 1.7; }
.detail-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.detail-tags .tag { background: #f0ece8; color: var(--color-text-light); padding: 4px 12px; border-radius: 14px; font-size: 0.75rem; font-weight: 500; }

.character-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 14px; }
.character-card {
    text-align: center; background: #fafaf9; border-radius: var(--radius-md);
    padding: 14px 10px; transition: var(--transition); cursor: pointer; border: 1px solid transparent;
}
.character-card:hover { border-color: var(--color-teal); box-shadow: var(--shadow-sm); }
.character-avatar {
    width: 72px; height: 72px; border-radius: 50%; object-fit: cover;
    margin: 0 auto 8px; display: block; border: 3px solid var(--color-warm);
}
.character-card .c-name { font-weight: 700; font-size: 0.85rem; color: #3a3a3a; }
.character-card .c-role { font-size: 0.7rem; color: var(--color-gray); margin-top: 2px; }

.sidebar .section { padding: 18px 16px; margin-bottom: 0; border-radius: var(--radius-md); }
.sidebar .section-title { font-size: 1.05rem; padding-left: 12px; }
.sidebar .section-title::before { height: 18px; width: 3px; }
.rank-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.rank-list li {
    display: flex; align-items: center; gap: 10px; padding: 8px 10px;
    border-radius: var(--radius-sm); transition: var(--transition); cursor: pointer; background: #fafaf9;
}
.rank-list li:hover { background: #f0ece8; }
.rank-num {
    width: 26px; height: 26px; border-radius: 50%; font-weight: 700; font-size: 0.75rem;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: #fff; background: var(--color-gray);
}
.rank-list li:nth-child(1) .rank-num { background: #e8876b; }
.rank-list li:nth-child(2) .rank-num { background: #f0a050; }
.rank-list li:nth-child(3) .rank-num { background: #d4a843; }
.rank-info { flex: 1; min-width: 0; }
.rank-info .r-title { font-weight: 600; font-size: 0.82rem; color: #3a3a3a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-info .r-sub { font-size: 0.7rem; color: var(--color-gray); }
.rank-change { font-size: 0.75rem; font-weight: 700; flex-shrink: 0; }
.rank-change.up { color: #e8876b; }
.rank-change.down { color: #8f8787; }

.total-read-box {
    text-align: center; padding: 16px; background: linear-gradient(135deg, #fdfcfb 0%, #f7f3ef 100%);
    border-radius: var(--radius-md); border: 2px dashed var(--color-warm);
}
.total-read-num { font-size: 2rem; font-weight: 800; color: #3a3a3a; letter-spacing: 1px; }
.total-read-label { font-size: 0.8rem; color: var(--color-gray); margin-top: 4px; }
.total-read-time { font-size: 0.7rem; color: #b0a9a4; margin-top: 2px; }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; }
.stat-item { background: #fafaf9; border-radius: var(--radius-sm); padding: 12px 6px; }
.stat-num { font-size: 1.3rem; font-weight: 700; color: #3a3a3a; }
.stat-label { font-size: 0.68rem; color: var(--color-gray); margin-top: 2px; }

.comment-list { display: flex; flex-direction: column; gap: 14px; }
.comment-item {
    background: #fafaf9; border-radius: var(--radius-md); padding: 14px 16px;
    transition: var(--transition); border-left: 3px solid transparent;
}
.comment-item:hover { border-left-color: var(--color-teal); background: #f8f7f5; }
.comment-header { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.comment-user { font-weight: 600; font-size: 0.85rem; color: #3a3a3a; }
.comment-time { font-size: 0.7rem; color: var(--color-gray); margin-left: auto; }
.comment-text { font-size: 0.85rem; color: var(--color-text-light); line-height: 1.65; }

.download-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 12px; }
.download-card {
    background: #fafaf9; border-radius: var(--radius-md); padding: 18px 14px; text-align: center;
    transition: var(--transition); cursor: pointer; text-decoration: none; color: inherit;
    border: 1.5px solid transparent; display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.download-card:hover { border-color: var(--color-teal); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.download-card .app-icon { width: 44px; height: 44px; object-fit: contain; flex-shrink: 0; }
.download-card .d-label { font-weight: 700; font-size: 0.85rem; color: #3a3a3a; }
.download-card .d-ver { font-size: 0.7rem; color: var(--color-gray); }

.footer-nav { width: 100%; background: #3a3a3a; color: #c5c0bb; padding: 32px 20px 20px; margin-top: 20px; }
.footer-inner { max-width: var(--max-width); margin: 0 auto; display: flex; flex-wrap: wrap; gap: 24px; justify-content: space-between; }
.footer-col h4 { color: #e8e4e1; font-size: 0.95rem; margin-bottom: 10px; letter-spacing: 0.5px; }
.footer-col a { display: block; color: #b0a9a4; text-decoration: none; font-size: 0.8rem; padding: 3px 0; transition: var(--transition); }
.footer-col a:hover { color: var(--color-teal); }
.footer-bottom {
    max-width: var(--max-width); margin: 20px auto 0; padding-top: 16px;
    border-top: 1px solid #4a4440; text-align: center; font-size: 0.75rem;
    color: #8a827d; display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; align-items: center;
}
.footer-bottom a { color: #b0a9a4; text-decoration: none; font-weight: 500; transition: var(--transition); }
.footer-bottom a:hover { color: var(--color-teal); }

.back-to-top {
    position: fixed; bottom: 30px; right: 30px; width: 42px; height: 42px; border-radius: 50%;
    background: var(--color-teal); color: #1a3a3c; border: none; cursor: pointer;
    font-size: 1.2rem; font-weight: 700; box-shadow: var(--shadow-md); z-index: 999;
    transition: var(--transition); display: flex; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none;
}
.back-to-top.visible { opacity: 1; pointer-events: auto; }
.back-to-top:hover { background: var(--color-teal-dark); transform: translateY(-2px); }

@media (max-width: 1200px) {
    .comic-grid { grid-template-columns: repeat(4, 1fr); gap: 12px; }
    .sidebar { width: 300px; }
    .download-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 992px) {
    .main-container { flex-direction: column; gap: 16px; }
    .sidebar { width: 100%; display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
    .sidebar .section { margin-bottom: 0; }
    .comic-grid { grid-template-columns: repeat(3, 1fr); }
    .nav-links { gap: 2px; }
    .nav-links a { padding: 6px 10px; font-size: 0.8rem; }
    .detail-layout { flex-direction: column; align-items: center; }
    .detail-cover { width: 150px; }
}
@media (max-width: 768px) {
    .nav-links { display: none; }
    .nav-toggle { display: block; }
    .nav-links.mobile-open {
        display: flex; flex-direction: column; position: absolute; top: var(--nav-height);
        left: 0; width: 100%; background: var(--color-white); box-shadow: var(--shadow-md);
        padding: 12px 20px; gap: 4px; z-index: 1001; border-bottom: 2px solid var(--color-teal);
    }
    .nav-links.mobile-open a { padding: 10px 14px; font-size: 0.9rem; border-radius: var(--radius-sm); width: 100%; }
    .comic-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .sidebar { grid-template-columns: 1fr; }
    .download-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .character-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
    .character-avatar { width: 50px; height: 50px; }
    .section { padding: 16px 12px; }
    .section-title { font-size: 1.1rem; }
    .btn-login, .btn-cta { padding: 7px 14px; font-size: 0.78rem; }
    .nav-brand h1 { font-size: 1.2rem; }
    .footer-inner { flex-direction: column; gap: 16px; }
}
@media (max-width: 480px) {
    .comic-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .comic-card-info { padding: 6px 8px 10px; }
    .comic-card-title { font-size: 0.78rem; }
    .comic-card-meta { font-size: 0.65rem; }
    .detail-cover { width: 120px; }
    .character-grid { grid-template-columns: repeat(2, 1fr); }
    .stats-grid { grid-template-columns: repeat(3, 1fr); gap: 4px; }
    .stat-num { font-size: 1rem; }
    .download-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .nav-actions { gap: 6px; }
    .top-nav { padding: 0 10px; }
    .back-to-top { bottom: 20px; right: 16px; width: 36px; height: 36px; }
}
