:root {
    --bg: #ffffff;
    --surface: #ffffff;
    --surface-soft: #f7f7f8;
    --text: #171717;
    --text-soft: #777777;
    --text-light: #999999;
    --border: #eeeeee;
    --primary: #00bfa6;
    --primary-dark: #009f8c;
    --yellow: #ffb400;
    --header-height: 68px;
    --container: 1240px;
}

[data-theme="dark"] {
    --bg: #111315;
    --surface: #181b1e;
    --surface-soft: #202428;
    --text: #f5f5f5;
    --text-soft: #a9adb1;
    --text-light: #777b80;
    --border: #2b2f33;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
    transition: background .2s, color .2s;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input {
    font: inherit;
}

img {
    display: block;
    max-width: 100%;
}

.container {
    width: min(var(--container), calc(100% - 40px));
    margin-inline: auto;
}

.header {
    position: sticky;
    top: 0;
    z-index: 1000;
    height: var(--header-height);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.header-inner {
    height: 100%;
    display: flex;
    align-items: center;
    gap: 30px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 22px;
    font-weight: 900;
    white-space: nowrap;
}

.logo-mark {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    background: var(--primary);
    color: white;
    font-size: 19px;
}

.logo-text span {
    color: var(--primary);
}

.nav {
    display: flex;
    align-items: center;
    gap: 25px;
}

.nav a {
    position: relative;
    color: var(--text-soft);
    font-size: 14px;
    font-weight: 700;
    transition: color .2s;
}

.nav a:hover,
.nav a.active {
    color: var(--text);
}

.nav a.active::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -24px;
    height: 3px;
    background: var(--primary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.search-button,
.theme-button,
.menu-button {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    transition: .2s;
}

.search-button:hover,
.theme-button:hover {
    color: var(--primary);
    border-color: var(--primary);
}

.menu-button {
    display: none;
    border-radius: 8px;
}

.search-panel {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: none;
    background: rgba(0, 0, 0, .65);
    backdrop-filter: blur(5px);
}

.search-panel.open {
    display: block;
}

.search-modal {
    width: min(700px, calc(100% - 30px));
    margin: 100px auto;
    padding: 20px;
    background: var(--surface);
    border-radius: 14px;
    box-shadow: 0 25px 70px rgba(0, 0, 0, .3);
}

.search-modal-top {
    display: flex;
    gap: 10px;
}

.search-modal input {
    flex: 1;
    height: 50px;
    padding: 0 15px;
    border: 1px solid var(--border);
    border-radius: 8px;
    outline: none;
    background: var(--surface-soft);
    color: var(--text);
}

.search-submit {
    padding: 0 18px;
    border: 0;
    border-radius: 8px;
    background: var(--primary);
    color: white;
    cursor: pointer;
    font-weight: 700;
}

.search-close {
    margin-top: 12px;
    border: 0;
    background: none;
    color: var(--text-soft);
    cursor: pointer;
}

.hero {
    padding: 30px 0 45px;
}

.hero-box {
    position: relative;
    min-height: 420px;
    overflow: hidden;
    display: flex;
    align-items: center;
    border-radius: 14px;
    background:
        linear-gradient(
            90deg,
            rgba(10, 20, 22, .98) 0%,
            rgba(10, 20, 22, .90) 38%,
            rgba(10, 20, 22, .35) 75%,
            rgba(10, 20, 22, .1) 100%
        ),
        url('https://images.unsplash.com/photo-1519681393784-d120267933ba?w=1600&q=90')
        center / cover;
}

.hero-content {
    width: 600px;
    padding: 50px;
    color: white;
}

.hero-badge {
    display: inline-flex;
    padding: 6px 10px;
    border-radius: 4px;
    background: var(--primary);
    color: white;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .7px;
}

.hero h1 {
    margin: 17px 0 12px;
    font-size: clamp(32px, 5vw, 52px);
    line-height: 1.05;
}

.hero-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
    font-size: 13px;
    color: #ddd;
}

.hero-rating {
    color: var(--yellow);
}

.hero-description {
    max-width: 540px;
    margin: 0;
    color: #d1d5d6;
    font-size: 14px;
    line-height: 1.7;
}

.hero-actions {
    display: flex;
    gap: 9px;
    margin-top: 25px;
}

.hero-button {
    min-height: 42px;
    padding: 0 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 800;
}

.hero-button.primary {
    background: var(--primary);
    color: white;
}

.hero-button.secondary {
    background: rgba(255, 255, 255, .12);
    color: white;
    border: 1px solid rgba(255, 255, 255, .2);
}

.section {
    padding: 0 0 42px;
}

.section-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 17px;
}

.section-title {
    margin: 0;
    font-size: 22px;
    font-weight: 800;
}

.section-subtitle {
    margin: 5px 0 0;
    color: var(--text-soft);
    font-size: 12px;
}

.section-link {
    color: var(--primary);
    font-size: 12px;
    font-weight: 800;
}

.carousel-wrapper {
    position: relative;
}

.carousel {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: calc((100% - 50px) / 6);
    gap: 10px;
    overflow-x: auto;
    scroll-behavior: smooth;
    scrollbar-width: none;
}

.carousel::-webkit-scrollbar {
    display: none;
}

.carousel-button {
    position: absolute;
    top: 40%;
    z-index: 5;
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 4px 15px rgba(0, 0, 0, .15);
    cursor: pointer;
}

.carousel-button.left {
    left: -18px;
}

.carousel-button.right {
    right: -18px;
}

.novel-card {
    min-width: 0;
}

.novel-cover {
    position: relative;
    display: block;
    overflow: hidden;
    aspect-ratio: .70;
    border-radius: 7px;
    background: var(--surface-soft);
}

.novel-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .3s;
}

.novel-card:hover .novel-cover img {
    transform: scale(1.04);
}

.cover-status {
    position: absolute;
    top: 7px;
    left: 7px;
    padding: 4px 6px;
    border-radius: 3px;
    background: var(--primary);
    color: white;
    font-size: 8px;
    font-weight: 800;
}

.cover-status.completed {
    background: #555;
}

.cover-read {
    position: absolute;
    left: 8px;
    right: 8px;
    bottom: 8px;
    padding: 8px;
    border-radius: 5px;
    background: var(--primary);
    color: white;
    text-align: center;
    font-size: 11px;
    font-weight: 800;
    opacity: 0;
    transform: translateY(5px);
    transition: .2s;
}

.novel-card:hover .cover-read {
    opacity: 1;
    transform: translateY(0);
}

.novel-info {
    padding-top: 9px;
}

.novel-info h3 {
    height: 36px;
    margin: 0;
    overflow: hidden;
    font-size: 13px;
    line-height: 1.35;
}

.novel-info h3 a {
    transition: color .2s;
}

.novel-info h3 a:hover {
    color: var(--primary);
}

.novel-author {
    margin: 4px 0;
    overflow: hidden;
    color: var(--text-soft);
    font-size: 10px;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.novel-genres {
    height: 15px;
    overflow: hidden;
    color: var(--text-light);
    font-size: 9px;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.novel-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 5px;
    margin-top: 5px;
}

.rating {
    display: flex;
    align-items: center;
    gap: 2px;
}

.star {
    color: #c8c8c8;
    font-size: 13px;
    letter-spacing: -2px;
}

.star.active {
    color: var(--yellow);
}

.rating strong {
    margin-left: 3px;
    color: var(--text-soft);
    font-size: 10px;
    font-weight: 600;
}

.chapter {
    color: var(--text-light);
    font-size: 9px;
    white-space: nowrap;
}

.trending {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

.trend-card {
    position: relative;
    min-height: 210px;
    overflow: hidden;
    display: flex;
    align-items: flex-end;
    border-radius: 10px;
    background: #222;
}

.trend-card img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .4s;
}

.trend-card:hover img {
    transform: scale(1.05);
}

.trend-overlay {
    position: relative;
    z-index: 1;
    width: 100%;
    padding: 60px 18px 16px;
    background: linear-gradient(transparent, rgba(0, 0, 0, .9));
    color: white;
}

.trend-number {
    color: var(--primary);
    font-size: 11px;
    font-weight: 900;
}

.trend-title {
    margin: 3px 0;
    font-size: 18px;
    font-weight: 800;
}

.trend-meta {
    color: #ccc;
    font-size: 11px;
}

.genres {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 8px;
}

.genre {
    min-height: 72px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--surface);
    transition: .2s;
}

.genre:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-2px);
}

.genre-icon {
    font-size: 19px;
}

.genre-name {
    font-size: 10px;
    font-weight: 700;
    text-align: center;
}

.updates {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    border-top: 1px solid var(--border);
    border-left: 1px solid var(--border);
}

.update {
    display: flex;
    gap: 12px;
    padding: 13px;
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.update-cover {
    width: 55px;
    height: 74px;
    flex: 0 0 55px;
    object-fit: cover;
    border-radius: 5px;
}

.update-info {
    min-width: 0;
}

.update-info h3 {
    margin: 2px 0 6px;
    overflow: hidden;
    font-size: 13px;
    line-height: 1.3;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.update-chapter {
    color: var(--primary);
    font-size: 11px;
    font-weight: 700;
}

.update-time {
    display: block;
    margin-top: 6px;
    color: var(--text-light);
    font-size: 10px;
}

.footer {
    margin-top: 20px;
    padding: 45px 0 25px;
    background: #151719;
    color: #999;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 40px;
}

.footer-logo {
    color: white;
    font-size: 20px;
    font-weight: 900;
}

.footer-logo span {
    color: var(--primary);
}

.footer-description {
    max-width: 420px;
    margin-top: 12px;
    font-size: 12px;
    line-height: 1.7;
}

.footer h4 {
    margin: 0 0 12px;
    color: white;
    font-size: 12px;
}

.footer-links {
    display: grid;
    gap: 8px;
}

.footer-links a {
    font-size: 11px;
}

.footer-links a:hover {
    color: white;
}

.copyright {
    margin-top: 35px;
    padding-top: 18px;
    border-top: 1px solid #292c2f;
    font-size: 10px;
}

@media (max-width: 1050px) {

    .carousel {
        grid-auto-columns: calc((100% - 40px) / 5);
    }

    .genres {
        grid-template-columns: repeat(4, 1fr);
    }

}

@media (max-width: 850px) {

    .nav {
        position: absolute;
        top: var(--header-height);
        left: 0;
        right: 0;
        display: none;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 8px;
        background: var(--surface);
        border-bottom: 1px solid var(--border);
    }

    .nav.open {
        display: flex;
    }

    .nav a {
        padding: 13px;
    }

    .nav a.active::after {
        display: none;
    }

    .menu-button {
        display: grid;
    }

    .carousel {
        grid-auto-columns: calc((100% - 30px) / 4);
    }

    .trending {
        grid-template-columns: repeat(2, 1fr);
    }

    .updates {
        grid-template-columns: repeat(2, 1fr);
    }

    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
    }

}

@media (max-width: 600px) {

    .container {
        width: calc(100% - 24px);
    }

    .header-inner {
        gap: 12px;
    }

    .logo {
        font-size: 18px;
    }

    .logo-mark {
        width: 32px;
        height: 32px;
    }

    .hero {
        padding-top: 15px;
    }

    .hero-box {
        min-height: 480px;
        align-items: flex-end;
        background:
            linear-gradient(
                0deg,
                rgba(8, 15, 16, .98) 0%,
                rgba(8, 15, 16, .75) 48%,
                rgba(8, 15, 16, .15) 100%
            ),
            url('https://images.unsplash.com/photo-1519681393784-d120267933ba?w=1000&q=90')
            center / cover;
    }

    .hero-content {
        width: 100%;
        padding: 25px;
    }

    .hero h1 {
        font-size: 32px;
    }

    .hero-description {
        font-size: 12px;
    }

    .carousel {
        grid-auto-columns: calc((100% - 16px) / 2.4);
        gap: 8px;
    }

    .carousel-button {
        display: none;
    }

    .section-title {
        font-size: 19px;
    }

    .trending {
        grid-template-columns: 1fr;
    }

    .trend-card {
        min-height: 190px;
    }

    .genres {
        grid-template-columns: repeat(4, 1fr);
    }

    .genre {
        min-height: 65px;
    }

    .genre-name {
        font-size: 8px;
    }

    .updates {
        grid-template-columns: 1fr;
    }

    .footer-grid {
        grid-template-columns: 1fr 1fr;
        gap: 25px;
    }

}

@media (max-width: 400px) {

    .carousel {
        grid-auto-columns: calc((100% - 10px) / 2.1);
    }

}