.topic-detail-wrap {
    padding-top: 22px;
}

.topic-detail-page {
    overflow-x: clip;
}

.topic-detail-page .breadcrumb b {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.topic-hero,
.entry-card,
.chapters-panel,
.update-note {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.topic-hero {
    min-height: 280px;
    padding: 14px;
    display: grid;
    grid-template-columns: 360px minmax(0, 1fr);
    gap: 40px;
    align-items: center;
}

.hero-cover {
    height: 250px;
    padding: 34px;
    position: relative;
    overflow: hidden;
    border-radius: 9px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    color: #fff;
}

.hero-cover::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    opacity: 0.17;
    background-image: linear-gradient(rgba(255, 255, 255, 0.4) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.4) 1px, transparent 1px);
    background-size: 26px 26px;
}

.hero-cover::after {
    content: "";
    width: 190px;
    height: 190px;
    position: absolute;
    right: -85px;
    bottom: -100px;
    z-index: 1;
    border: 1px solid rgba(255, 255, 255, 0.32);
    border-radius: 50%;
    box-shadow: 0 0 0 32px rgba(255, 255, 255, 0.05);
}

.hero-cover.has-image::before {
    z-index: 2;
    opacity: 1;
    background: linear-gradient(90deg, rgba(16, 23, 38, 0.84), rgba(16, 23, 38, 0.28));
}

.hero-cover > :not(.hero-cover-image) {
    position: relative;
    z-index: 3;
}

.hero-cover-image {
    width: 100%;
    height: 100%;
    position: absolute;
    inset: 0;
    z-index: 0;
    display: block;
    object-fit: cover;
}

.hero-cover span {
    color: #b9c8eb;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.15em;
}

.hero-cover strong {
    max-width: 90%;
    margin-top: 18px;
    font-size: 34px;
    line-height: 1.1;
    letter-spacing: -0.045em;
    overflow-wrap: anywhere;
}

.hero-cover small {
    margin-top: 15px;
    color: #d3dbea;
    font-size: 12px;
}

.cover-codex {
    background: linear-gradient(135deg, #141a27, #304a7d);
}

.cover-agent {
    background: linear-gradient(135deg, #16645d, #243b56);
}

.cover-content {
    background: linear-gradient(135deg, #a15d31, #5a3527);
}

.cover-project {
    background: linear-gradient(135deg, #294ea4, #172c61);
}

.cover-video {
    background: linear-gradient(135deg, #755ba7, #3e315e);
}

.cover-growth {
    background: linear-gradient(135deg, #98585a, #4f3548);
}

.hero-content {
    padding-right: 45px;
}

.hero-tags {
    display: flex;
    gap: 8px;
}

.hero-tags span {
    padding: 5px 8px;
    border-radius: 4px;
    color: var(--blue);
    background: var(--blue-soft);
    font-size: 11px;
}

.hero-tags .topic-status.updating,
.hero-tags .topic-status.long-term {
    color: var(--green);
    background: #eaf8ef;
}

.hero-tags .topic-status.planning {
    color: #b56d27;
    background: #fff1e4;
}

.hero-content h1 {
    margin: 19px 0 11px;
    font-size: 35px;
    line-height: 1.3;
    letter-spacing: -0.04em;
}

.hero-content > p {
    max-width: 740px;
    margin: 0;
    color: var(--muted);
    font-size: 15px;
    line-height: 1.8;
}

.hero-meta {
    margin-top: 26px;
    display: flex;
    flex-wrap: wrap;
    gap: 18px 28px;
    color: #788291;
    font-size: 11px;
}

.hero-meta strong {
    color: var(--text);
    font-size: 14px;
}

.entry-grid {
    margin-top: 14px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.entry-card {
    min-height: 184px;
    padding: 27px 29px;
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 21px;
    align-items: start;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

a.entry-card:hover {
    border-color: #b8c9ed;
    box-shadow: 0 8px 24px rgba(38, 77, 154, 0.08);
    transform: translateY(-2px);
}

.entry-card.is-disabled {
    color: #838b97;
    background: #fafbfc;
}

.entry-icon {
    width: 58px;
    height: 58px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    color: #fff;
    background: var(--blue);
    font-size: 18px;
    font-weight: 800;
}

.docs-entry .entry-icon {
    background: #23815a;
}

.is-disabled .entry-icon {
    background: #8a94a3;
}

.entry-kicker {
    color: #748092;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.13em;
}

.entry-card h2 {
    margin: 8px 0 7px;
    font-size: 21px;
    letter-spacing: -0.025em;
}

.entry-card p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.7;
}

.entry-card strong {
    display: inline-block;
    margin-top: 17px;
    color: var(--blue);
    font-size: 12px;
}

.docs-entry strong {
    color: #23815a;
}

.is-disabled strong {
    color: #818a97;
}

.chapters-panel {
    margin-top: 14px;
    overflow: hidden;
}

.panel-heading {
    min-height: 92px;
    padding: 20px 25px;
    border-bottom: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 30px;
}

.panel-heading h2 {
    margin: 0;
    font-size: 23px;
}

.panel-heading > p {
    margin: 0;
    color: #7c8694;
    font-size: 12px;
}

.chapter-row {
    min-height: 126px;
    padding: 22px 25px;
    border-bottom: 1px solid var(--line);
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr) auto;
    gap: 20px;
    align-items: center;
}

.chapter-row:last-child {
    border-bottom: 0;
}

.chapter-row:hover {
    background: #fbfcfe;
}

.chapter-number {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    color: var(--blue);
    background: var(--blue-soft);
    font-size: 12px;
    font-weight: 750;
}

.chapter-copy h3 {
    margin: 0 0 7px;
    font-size: 18px;
    letter-spacing: -0.02em;
}

.chapter-copy p {
    max-width: 720px;
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.65;
}

.chapter-actions {
    display: flex;
    gap: 8px;
}

.chapter-actions a {
    min-height: 36px;
    padding: 0 12px;
    border: 1px solid #cad7f0;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--blue);
    background: #f7faff;
    font-size: 11px;
    font-weight: 650;
}

.chapter-actions a.docs {
    color: #28785a;
    border-color: #cae3d6;
    background: #f6fbf8;
}

.chapter-actions a:hover {
    border-color: var(--blue);
}

.chapter-actions a.docs:hover {
    border-color: #28785a;
}

.chapter-actions i {
    font-style: normal;
}

.chapters-empty {
    padding: 70px 20px;
    text-align: center;
}

.chapters-empty strong,
.chapters-empty span {
    display: block;
}

.chapters-empty span {
    margin-top: 8px;
    color: var(--muted);
    font-size: 12px;
}

.update-note {
    margin-top: 14px;
    padding: 22px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 30px;
}

.update-note > div {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.update-dot {
    width: 9px;
    height: 9px;
    margin-top: 5px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: #34a363;
    box-shadow: 0 0 0 5px #e8f6ed;
}

.update-note strong {
    font-size: 14px;
}

.update-note p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.update-note > a {
    flex: 0 0 auto;
    color: var(--blue);
    font-size: 12px;
    font-weight: 650;
}

@media (max-width: 1100px) {
    .topic-hero {
        grid-template-columns: 310px minmax(0, 1fr);
        gap: 27px;
    }

    .hero-content {
        padding-right: 25px;
    }

    .chapter-row {
        grid-template-columns: 45px minmax(0, 1fr);
    }

    .chapter-actions {
        grid-column: 2;
    }
}

@media (max-width: 820px) {
    .topic-detail-wrap {
        padding-top: 16px;
    }

    .topic-hero {
        grid-template-columns: 250px minmax(0, 1fr);
    }

    .hero-cover {
        height: 225px;
        padding: 25px;
    }

    .hero-cover strong,
    .hero-content h1 {
        font-size: 29px;
    }

    .hero-meta {
        gap: 10px 18px;
    }

    .entry-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 620px) {
    .topic-detail-wrap {
        padding-inline: 9px;
    }

    .breadcrumb b {
        max-width: 160px;
    }

    .topic-hero {
        padding: 9px;
        display: block;
    }

    .hero-cover {
        width: 100%;
        height: 225px;
    }

    .hero-cover strong {
        width: 100%;
        max-width: none;
        font-size: 27px;
    }

    .hero-content {
        min-width: 0;
        padding: 24px 13px 18px;
    }

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

    .hero-content > p {
        font-size: 14px;
    }

    .hero-meta {
        align-items: flex-start;
        flex-direction: column;
    }

    .entry-card {
        min-width: 0;
        min-height: 0;
        padding: 21px 19px;
        grid-template-columns: 48px minmax(0, 1fr);
        gap: 15px;
    }

    .entry-icon {
        width: 48px;
        height: 48px;
    }

    .entry-card h2 {
        font-size: 19px;
    }

    .entry-card > div:last-child,
    .chapter-copy {
        min-width: 0;
    }

    .panel-heading {
        padding: 18px;
        align-items: flex-start;
        flex-direction: column;
        gap: 7px;
    }

    .chapter-row {
        padding: 20px 18px;
        grid-template-columns: 40px minmax(0, 1fr);
        gap: 15px;
        align-items: start;
    }

    .chapter-number {
        width: 38px;
        height: 38px;
    }

    .chapter-copy h3 {
        font-size: 17px;
    }

    .chapter-actions {
        width: 100%;
        grid-column: 1 / -1;
    }

    .chapter-actions a {
        flex: 1;
        justify-content: center;
    }

    .update-note {
        padding: 20px;
        align-items: flex-start;
        flex-direction: column;
        gap: 16px;
    }
}

@media (max-width: 350px) {
    .chapter-actions {
        flex-direction: column;
    }
}

@media (prefers-reduced-motion: reduce) {
    .entry-card {
        transition-duration: 0.01ms;
    }
}
