.np-home .ad-slot {
    margin-top: 0;
}

.np-topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    padding-top: env(safe-area-inset-top);
    background: var(--np-canvas);
    border-bottom: 1px solid var(--np-border);
}

.np-topbar__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: min(100%, 1120px);
    min-height: 58px;
    margin: 0 auto;
    padding: 8px 16px 4px;
}

.np-brand {
    display: inline-flex;
    min-width: 0;
    min-height: 44px;
    align-items: center;
    gap: 9px;
}

.np-brand__logo {
    width: auto;
    max-width: 132px;
    max-height: 36px;
    object-fit: contain;
}

.np-brand__mark {
    display: grid;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    place-items: center;
    border: 1px solid var(--np-border);
    border-radius: 8px;
    background: var(--np-surface);
    color: var(--np-accent);
    font-size: 17px;
    font-weight: 700;
}

.np-brand__text {
    display: flex;
    min-width: 0;
    flex-direction: column;
    justify-content: center;
}

.np-brand__text strong {
    overflow: hidden;
    max-width: 46vw;
    color: var(--np-ink);
    font-size: 16px;
    font-weight: 700;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.np-brand__text small {
    color: var(--np-muted);
    font-size: 11px;
    line-height: 1.35;
}

.np-theme-toggle {
    display: grid;
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    place-items: center;
    border: 1px solid var(--np-border);
    border-radius: 8px;
    background: var(--np-surface);
    color: var(--np-muted);
    cursor: pointer;
}

.np-theme-toggle:active {
    transform: scale(0.97);
}

.np-theme-icon {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.np-theme-icon--moon {
    display: none;
}

html[data-theme="dark"] .np-theme-icon--moon {
    display: block;
    fill: currentColor;
    stroke: none;
}

html[data-theme="dark"] .np-theme-icon--sun {
    display: none;
}

.np-search {
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr) auto;
    align-items: center;
    width: calc(100% - 32px);
    max-width: 1088px;
    height: 46px;
    margin: 0 auto 12px;
    padding-left: 13px;
    overflow: hidden;
    border: 1px solid var(--np-border);
    border-radius: 8px;
    background: var(--np-surface);
}

.np-search:focus-within {
    border-color: var(--np-accent);
    box-shadow: 0 0 0 3px var(--np-accent-soft);
}

.np-search__icon {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: var(--np-muted);
    stroke-width: 1.8;
    stroke-linecap: round;
}

.np-search input {
    width: 100%;
    min-width: 0;
    height: 44px;
    padding: 0 10px;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--np-ink);
    font-size: 15px;
}

.np-search input:focus-visible {
    outline: 0;
}

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

.np-search button {
    align-self: stretch;
    min-width: 64px;
    padding: 0 16px;
    border: 0;
    background: var(--np-accent);
    color: var(--np-on-accent);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

.np-search button:active {
    opacity: 0.82;
}

.np-main {
    width: min(100%, 1120px);
    margin: 0 auto;
    padding: 18px 16px calc(92px + env(safe-area-inset-bottom));
}

.np-categories {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 6px;
    margin-bottom: 22px;
}

.np-category {
    display: flex;
    min-width: 0;
    min-height: 72px;
    align-items: center;
    flex-direction: column;
    justify-content: center;
    gap: 7px;
    border-radius: 8px;
}

.np-category__mark {
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    border: 1px solid var(--np-border);
    border-radius: 8px;
    background: var(--np-surface);
    color: var(--np-accent);
    font-size: 17px;
    font-weight: 700;
}

.np-category__name {
    overflow: hidden;
    width: 100%;
    color: var(--np-ink);
    font-size: 11px;
    line-height: 1.3;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.np-hero {
    padding: 16px;
    border: 1px solid var(--np-border);
    border-radius: 8px;
    background: var(--np-surface);
}

.np-hero__eyebrow {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    color: var(--np-accent);
    font-size: 12px;
    letter-spacing: 0.04em;
}

.np-hero__eyebrow span {
    display: block;
    width: 3px;
    height: 14px;
    border-radius: 2px;
    background: var(--np-accent);
}

.np-hero__layout {
    display: flex;
    min-width: 0;
    align-items: flex-start;
    gap: 15px;
}

.np-cover {
    position: relative;
    display: block;
    flex: 0 0 auto;
    overflow: hidden;
    border: 1px solid var(--np-border);
    border-radius: 8px;
    background: var(--np-surface-2);
}

.np-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.np-cover--hero {
    width: 92px;
    aspect-ratio: 2 / 3;
}

.np-cover__status {
    position: absolute;
    top: 6px;
    left: 6px;
    max-width: calc(100% - 12px);
    padding: 2px 6px;
    overflow: hidden;
    border-radius: 4px;
    background: rgba(24, 32, 30, 0.8);
    color: #ffffff;
    font-size: 10px;
    line-height: 1.5;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.np-hero__body {
    min-width: 0;
    flex: 1 1 auto;
}

.np-hero__meta-line {
    display: flex;
    min-height: 22px;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.np-tag {
    display: inline-flex;
    max-width: 120px;
    align-items: center;
    padding: 1px 7px;
    overflow: hidden;
    border-radius: 999px;
    font-size: 11px;
    line-height: 1.6;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.np-tag--accent {
    background: var(--np-accent-soft);
    color: var(--np-accent);
}

.np-score {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 3px;
    color: var(--np-accent);
    font-size: 12px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.np-score svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}

.np-hero h1 {
    margin: 7px 0 0;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.3;
}

.np-hero h1 a {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.np-hero__author {
    margin: 5px 0 0;
    color: var(--np-muted);
    font-size: 12px;
}

.np-hero__desc {
    display: -webkit-box;
    margin: 10px 0 0;
    overflow: hidden;
    color: var(--np-muted);
    font-family: "Source Han Serif SC", "Noto Serif SC", "Songti SC", serif;
    font-size: 14px;
    line-height: 1.75;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.np-primary-link {
    display: inline-flex;
    min-height: 40px;
    align-items: center;
    gap: 5px;
    margin-top: 12px;
    padding: 0 13px;
    border-radius: 8px;
    background: var(--np-accent);
    color: var(--np-on-accent);
    font-size: 13px;
    font-weight: 700;
}

.np-primary-link svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.np-primary-link:active {
    transform: translateY(1px);
}

.np-section {
    margin-top: 30px;
    padding-top: 24px;
    border-top: 1px solid var(--np-border);
}

.np-section__head {
    display: flex;
    min-height: 44px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.np-section__head h2 {
    margin: 0;
    color: var(--np-ink);
    font-size: 20px;
    font-weight: 700;
    line-height: 1.35;
}

.np-section__head > a {
    display: inline-flex;
    min-height: 44px;
    flex: 0 0 auto;
    align-items: center;
    color: var(--np-muted);
    font-size: 13px;
}

.np-section__head--tabs {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
}

.np-tabs {
    display: flex;
    width: 100%;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: none;
}

.np-tabs::-webkit-scrollbar,
.np-horizontal-scroll::-webkit-scrollbar {
    display: none;
}

.np-tab {
    min-height: 44px;
    flex: 1 1 0;
    padding: 0 12px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--np-muted);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.np-tab.is-active {
    background: var(--np-accent-soft);
    color: var(--np-accent);
}

.np-horizontal-scroll {
    display: flex;
    gap: 12px;
    margin: 0 -16px;
    padding: 0 16px 4px;
    overflow-x: auto;
    scroll-padding-inline: 16px;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
}

.np-book-card {
    display: flex;
    width: 104px;
    flex: 0 0 104px;
    min-width: 0;
    flex-direction: column;
    scroll-snap-align: start;
}

.np-cover--card {
    width: 104px;
    aspect-ratio: 2 / 3;
}

.np-book-card__title {
    display: -webkit-box;
    margin-top: 8px;
    overflow: hidden;
    color: var(--np-ink);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.np-book-card__meta {
    margin-top: 3px;
    overflow: hidden;
    color: var(--np-muted);
    font-size: 11px;
    line-height: 1.4;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.np-rank-panel {
    margin-top: 4px;
}

.np-rank-panel[hidden] {
    display: none;
}

.np-rank-item {
    display: grid;
    grid-template-columns: 24px 48px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    min-height: 88px;
    padding: 13px 0;
    border-bottom: 1px solid var(--np-border);
}

.np-rank-item:last-child {
    border-bottom: 0;
}

.np-rank-item__number {
    display: grid;
    width: 24px;
    height: 24px;
    place-items: center;
    border-radius: 6px;
    background: var(--np-surface-2);
    color: var(--np-muted);
    font-size: 12px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.np-rank-item:first-child .np-rank-item__number {
    background: var(--np-accent-soft);
    color: var(--np-accent);
}

.np-cover--rank {
    width: 48px;
    aspect-ratio: 2 / 3;
}

.np-rank-item__body {
    min-width: 0;
}

.np-rank-item__body h3 {
    margin: 0;
    overflow: hidden;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.4;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.np-rank-item__body > p {
    margin: 3px 0 0;
    overflow: hidden;
    color: var(--np-muted);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.np-rank-item__meta {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    color: var(--np-muted);
    font-size: 11px;
}

.np-rank-item__meta span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.np-featured-grid,
.np-hot-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
}

.np-featured-item {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr);
    align-items: start;
    gap: 13px;
    padding: 16px 0;
    border-bottom: 1px solid var(--np-border);
}

.np-cover--featured {
    width: 76px;
    aspect-ratio: 2 / 3;
}

.np-featured-item__body {
    min-width: 0;
}

.np-featured-item__title-line {
    display: flex;
    min-width: 0;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.np-featured-item__title-line h3 {
    min-width: 0;
    margin: 0;
    overflow: hidden;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.4;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.np-featured-item__author {
    margin: 4px 0 0;
    color: var(--np-muted);
    font-size: 12px;
}

.np-featured-item__desc {
    display: -webkit-box;
    margin: 7px 0 0;
    overflow: hidden;
    color: var(--np-muted);
    font-size: 12px;
    line-height: 1.65;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.np-hot-item {
    display: grid;
    grid-template-columns: 68px minmax(0, 1fr);
    align-items: start;
    gap: 12px;
    padding: 15px 0;
    border-bottom: 1px solid var(--np-border);
}

.np-cover--hot {
    width: 68px;
    aspect-ratio: 2 / 3;
}

.np-hot-item__body {
    min-width: 0;
}

.np-hot-item h3 {
    margin: 0;
    overflow: hidden;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.4;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.np-hot-item__body > p {
    margin: 3px 0 0;
    color: var(--np-muted);
    font-size: 12px;
}

.np-hot-item__desc {
    display: -webkit-box !important;
    overflow: hidden;
    line-height: 1.65 !important;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.np-update-list {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
}

.np-update-item {
    display: flex;
    min-width: 0;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid var(--np-border);
}

.np-update-item__main {
    min-width: 0;
    flex: 1 1 auto;
}

.np-update-item__main h3 {
    margin: 0;
    overflow: hidden;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.4;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.np-update-item__main p {
    margin: 4px 0 0;
    overflow: hidden;
    color: var(--np-muted);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.np-update-item__desc {
    display: -webkit-box;
    margin-top: 4px;
    overflow: hidden;
    color: var(--np-muted);
    font-size: 12px;
    line-height: 1.55;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.np-update-item__side {
    display: flex;
    min-width: 66px;
    flex: 0 0 auto;
    align-items: flex-end;
    flex-direction: column;
    gap: 5px;
    color: var(--np-muted);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.np-update-item__side a {
    max-width: 90px;
    overflow: hidden;
    padding: 1px 6px;
    border-radius: 4px;
    background: var(--np-surface-2);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.np-empty {
    margin: 0;
    padding: 20px 0;
    color: var(--np-muted);
    font-size: 13px;
    text-align: center;
}

.np-bottom-nav {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 50;
    display: flex;
    align-items: stretch;
    padding: 6px max(8px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    border-top: 1px solid var(--np-border);
    background: var(--np-surface);
    box-shadow: 0 -8px 24px rgba(24, 32, 30, 0.06);
}

html[data-theme="dark"] .np-bottom-nav {
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.2);
}

.np-bottom-nav__item {
    display: flex;
    min-width: 0;
    min-height: 50px;
    flex: 1 1 0;
    align-items: center;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    border-radius: 8px;
    color: var(--np-muted);
    font-size: 11px;
}

.np-bottom-nav__item svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.np-bottom-nav__item.is-active {
    background: var(--np-accent-soft);
    color: var(--np-accent);
    font-weight: 700;
}

.np-bottom-nav__item:active {
    transform: scale(0.98);
}

@media (min-width: 600px) {
    .np-main {
        padding-right: 24px;
        padding-left: 24px;
    }

    .np-topbar__inner {
        padding-right: 24px;
        padding-left: 24px;
    }

    .np-search {
        width: calc(100% - 48px);
    }

    .np-horizontal-scroll {
        margin-right: 0;
        margin-left: 0;
        padding-right: 0;
        padding-left: 0;
    }

    .np-featured-grid,
    .np-hot-grid,
    .np-update-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        column-gap: 24px;
    }
}

@media (min-width: 760px) {
    .np-hero {
        padding: 22px;
    }

    .np-hero__layout {
        align-items: center;
        gap: 22px;
    }

    .np-cover--hero {
        width: 124px;
    }

    .np-hero h1 {
        font-size: 28px;
    }

    .np-hero__desc {
        max-width: 62ch;
    }

    .np-section__head--tabs {
        align-items: center;
        flex-direction: row;
        justify-content: space-between;
    }

    .np-tabs {
        width: auto;
    }

    .np-tab {
        flex: 0 0 auto;
    }
}

@media (min-width: 1024px) {
    .np-main {
        padding: 28px 32px calc(108px + env(safe-area-inset-bottom));
    }

    .np-topbar__inner {
        padding-right: 32px;
        padding-left: 32px;
    }

    .np-search {
        width: calc(100% - 64px);
    }

    .np-featured-grid,
    .np-hot-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .np-book-card {
        width: 118px;
        flex-basis: 118px;
    }

    .np-cover--card {
        width: 118px;
    }
}

@media (max-width: 359px) {
    .np-topbar__inner,
    .np-main {
        padding-right: 12px;
        padding-left: 12px;
    }

    .np-search {
        width: calc(100% - 24px);
    }

    .np-categories {
        gap: 4px;
    }

    .np-category__mark {
        width: 40px;
        height: 40px;
    }

    .np-hero {
        padding: 14px;
    }

    .np-cover--hero {
        width: 82px;
    }

    .np-hero h1 {
        font-size: 20px;
    }

    .np-horizontal-scroll {
        margin-right: -12px;
        margin-left: -12px;
        padding-right: 12px;
        padding-left: 12px;
    }
}

@media (prefers-reduced-motion: no-preference) {
    body.np-home,
    .np-topbar,
    .np-theme-toggle,
    .np-search,
    .np-category__mark,
    .np-hero,
    .np-tab,
    .np-bottom-nav {
        transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease;
    }

    .np-theme-toggle,
    .np-primary-link,
    .np-bottom-nav__item {
        transition: transform 120ms ease, background-color 180ms ease, color 180ms ease;
    }
}

@media (hover: hover) {
    .np-category:hover .np-category__mark,
    .np-theme-toggle:hover {
        border-color: var(--np-accent);
        color: var(--np-accent);
    }

    .np-book-card:hover .np-book-card__title,
    .np-rank-item a:hover,
    .np-featured-item a:hover,
    .np-hot-item a:hover,
    .np-update-item a:hover {
        color: var(--np-accent);
    }

    .np-bottom-nav__item:hover {
        background: var(--np-surface-2);
        color: var(--np-ink);
    }
}
