:root {
    --bg-page: #f3ecdf;
    --bg-page-accent: rgba(203, 111, 52, 0.18);
    --bg-page-cool: rgba(15, 118, 110, 0.14);
    --surface: rgba(255, 248, 239, 0.76);
    --surface-strong: rgba(255, 252, 247, 0.92);
    --surface-muted: rgba(255, 255, 255, 0.54);
    --hero-bg: linear-gradient(135deg, #111827 0%, #19212d 45%, #0f766e 140%);
    --hero-panel: rgba(12, 18, 26, 0.64);
    --text-primary: #122033;
    --text-secondary: #45556d;
    --text-muted: #6f7d90;
    --text-inverse: #f8fafc;
    --accent: #c56b2b;
    --accent-strong: #ab4f17;
    --accent-soft: rgba(197, 107, 43, 0.14);
    --accent-cool: #2c9c94;
    --border: rgba(18, 32, 51, 0.12);
    --border-strong: rgba(18, 32, 51, 0.22);
    --shadow-soft: 0 24px 60px rgba(34, 37, 41, 0.14);
    --shadow-hero: 0 42px 96px rgba(7, 10, 17, 0.26);
}

[data-theme="dark"] {
    --bg-page: #0d1218;
    --bg-page-accent: rgba(244, 162, 97, 0.12);
    --bg-page-cool: rgba(88, 199, 194, 0.14);
    --surface: rgba(20, 27, 36, 0.76);
    --surface-strong: rgba(18, 25, 33, 0.94);
    --surface-muted: rgba(148, 163, 184, 0.08);
    --hero-bg: linear-gradient(135deg, #111827 0%, #171f2a 46%, #0d5f61 145%);
    --hero-panel: rgba(6, 10, 15, 0.62);
    --text-primary: #f6f7fb;
    --text-secondary: #c5cfdd;
    --text-muted: #90a0b4;
    --text-inverse: #f8fafc;
    --accent: #f4a261;
    --accent-strong: #ffd2a8;
    --accent-soft: rgba(244, 162, 97, 0.12);
    --accent-cool: #58c7c2;
    --border: rgba(148, 163, 184, 0.15);
    --border-strong: rgba(148, 163, 184, 0.24);
    --shadow-soft: 0 28px 72px rgba(0, 0, 0, 0.32);
    --shadow-hero: 0 42px 96px rgba(0, 0, 0, 0.42);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text-primary);
    font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
    line-height: 1.7;
    background:
        radial-gradient(circle at top left, var(--bg-page-accent), transparent 34%),
        radial-gradient(circle at 88% 12%, var(--bg-page-cool), transparent 28%),
        linear-gradient(180deg, var(--bg-page) 0%, color-mix(in srgb, var(--bg-page) 88%, #ffffff 12%) 100%);
    transition: background 0.3s ease, color 0.3s ease;
}

body::before,
body::after {
    content: "";
    position: fixed;
    inset: auto;
    width: 36vw;
    height: 36vw;
    pointer-events: none;
    z-index: 0;
    filter: blur(80px);
    opacity: 0.4;
}

body::before {
    top: -10vw;
    right: -10vw;
    background: var(--bg-page-accent);
}

body::after {
    bottom: -12vw;
    left: -14vw;
    background: var(--bg-page-cool);
}

a {
    color: inherit;
}

.page-shell {
    position: relative;
    z-index: 1;
    width: min(1440px, calc(100% - 32px));
    margin: 0 auto;
    padding: 24px 0 52px;
}

.theme-toggle-container {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 30;
}

.theme-toggle {
    width: 52px;
    height: 52px;
    position: relative;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: color-mix(in srgb, var(--surface-strong) 84%, transparent 16%);
    color: var(--text-primary);
    backdrop-filter: blur(18px);
    box-shadow: var(--shadow-soft);
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: transform 0.25s ease, border-color 0.25s ease, background 0.25s ease;
}

.theme-toggle:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
}

.theme-toggle .sun-icon,
.theme-toggle .moon-icon {
    position: absolute;
    font-size: 1.05rem;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.theme-toggle .sun-icon {
    opacity: 1;
    transform: rotate(0deg) scale(1);
    color: var(--accent);
}

.theme-toggle .moon-icon {
    opacity: 0;
    transform: rotate(-18deg) scale(0.8);
    color: var(--accent-cool);
}

[data-theme="dark"] .theme-toggle .sun-icon {
    opacity: 0;
    transform: rotate(18deg) scale(0.8);
}

[data-theme="dark"] .theme-toggle .moon-icon {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

.hero {
    position: relative;
    overflow: hidden;
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
    gap: 36px;
    min-height: calc(100svh - 48px);
    padding: clamp(80px, 11vw, 136px) clamp(26px, 4vw, 56px) 44px;
    border-radius: 36px;
    background: var(--hero-bg);
    box-shadow: var(--shadow-hero);
}

.hero::before,
.hero::after {
    content: "";
    position: absolute;
    border-radius: 999px;
    pointer-events: none;
}

.hero::before {
    width: 42vw;
    height: 42vw;
    top: -16vw;
    right: -8vw;
    background: radial-gradient(circle, rgba(255, 218, 185, 0.26) 0%, rgba(255, 218, 185, 0) 68%);
}

.hero::after {
    width: 28vw;
    height: 28vw;
    bottom: -12vw;
    left: 32%;
    background: radial-gradient(circle, rgba(88, 199, 194, 0.18) 0%, rgba(88, 199, 194, 0) 74%);
}

.hero-copy,
.hero-spotlight {
    position: relative;
    z-index: 1;
}

.hero-copy {
    display: flex;
    flex-direction: column;
    justify-content: center;
    max-width: 720px;
}

.hero-topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: "Space Grotesk", "Segoe UI", sans-serif;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    color: rgba(248, 250, 252, 0.76);
    text-transform: uppercase;
}

.eyebrow::before {
    content: "";
    width: 42px;
    height: 1px;
    background: rgba(248, 250, 252, 0.4);
}

.date-badge {
    display: inline-flex;
    align-items: center;
    padding: 10px 16px;
    border-radius: 999px;
    background: rgba(248, 250, 252, 0.12);
    border: 1px solid rgba(248, 250, 252, 0.14);
    color: rgba(248, 250, 252, 0.88);
    font-family: "Space Grotesk", "Segoe UI", sans-serif;
    font-size: 0.92rem;
    font-weight: 500;
    backdrop-filter: blur(12px);
}

.hero h1,
.section-intro h2,
.section-copy h2,
.repo-title,
.spotlight-label,
.tab-btn,
.hero-stat strong,
.section-count {
    font-family: "Space Grotesk", "Noto Sans SC", sans-serif;
}

.hero h1 {
    margin: 0;
    font-size: clamp(3.3rem, 8vw, 6.6rem);
    line-height: 0.96;
    letter-spacing: -0.08em;
    color: var(--text-inverse);
}

.hero-lead {
    max-width: 36rem;
    margin: 22px 0 0;
    font-size: clamp(1.04rem, 1.8vw, 1.24rem);
    color: rgba(248, 250, 252, 0.8);
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 34px;
}

.primary-link,
.history-btn,
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 0 20px;
    border-radius: 999px;
    text-decoration: none;
    transition: transform 0.24s ease, background 0.24s ease, border-color 0.24s ease, color 0.24s ease;
}

.primary-link {
    background: var(--accent);
    color: #fff9f4;
    font-weight: 700;
    box-shadow: 0 18px 28px rgba(197, 107, 43, 0.2);
}

.history-btn {
    border: 1px solid rgba(248, 250, 252, 0.18);
    background: rgba(248, 250, 252, 0.08);
    color: rgba(248, 250, 252, 0.92);
    backdrop-filter: blur(12px);
}

.primary-link:hover,
.history-btn:hover,
.btn:hover {
    transform: translateY(-2px);
}

.primary-link:hover {
    background: var(--accent-strong);
}

.history-btn:hover {
    border-color: rgba(248, 250, 252, 0.34);
    background: rgba(248, 250, 252, 0.12);
}

.hero-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-top: 34px;
}

.hero-stat {
    padding: 16px 18px;
    border: 1px solid rgba(248, 250, 252, 0.12);
    border-radius: 22px;
    background: rgba(248, 250, 252, 0.06);
    backdrop-filter: blur(14px);
}

.hero-stat strong {
    display: block;
    color: var(--text-inverse);
    font-size: clamp(1.5rem, 2.2vw, 2.2rem);
    letter-spacing: -0.06em;
}

.hero-stat span {
    display: block;
    margin-top: 4px;
    color: rgba(248, 250, 252, 0.72);
    font-size: 0.95rem;
}

.hero-caption {
    margin: 18px 0 0;
    color: rgba(248, 250, 252, 0.62);
    font-size: 0.92rem;
}

.hero-spotlight {
    align-self: end;
    padding: 28px;
    border-radius: 28px;
    border: 1px solid rgba(248, 250, 252, 0.12);
    background: var(--hero-panel);
    backdrop-filter: blur(18px);
}

.spotlight-label {
    display: inline-block;
    margin-bottom: 16px;
    color: rgba(248, 250, 252, 0.64);
    font-size: 0.76rem;
    letter-spacing: 0.22em;
}

.hero-spotlight h2 {
    margin: 0;
    font-size: clamp(1.7rem, 3vw, 2.6rem);
    line-height: 1.05;
}

.hero-spotlight h2 a {
    color: var(--text-inverse);
    text-decoration: none;
}

.hero-spotlight h2 a:hover {
    color: #ffffff;
}

.spotlight-desc {
    margin: 16px 0 0;
    color: rgba(248, 250, 252, 0.78);
}

.spotlight-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
}

.spotlight-meta span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    padding: 0 14px;
    border-radius: 999px;
    background: rgba(248, 250, 252, 0.08);
    color: rgba(248, 250, 252, 0.86);
}

.spotlight-summary {
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid rgba(248, 250, 252, 0.12);
}

.spotlight-summary span {
    display: inline-block;
    color: var(--accent-strong);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.spotlight-summary p {
    margin: 12px 0 0;
    color: rgba(248, 250, 252, 0.88);
}

.tabs-shell {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 24px;
    margin: 30px 0 12px;
    padding: 0 12px;
}

.section-intro {
    max-width: 620px;
}

.section-intro .eyebrow,
.section-copy .eyebrow {
    color: var(--text-muted);
}

.section-intro .eyebrow::before,
.section-copy .eyebrow::before {
    background: var(--border-strong);
}

.section-intro h2,
.section-copy h2 {
    margin: 10px 0 0;
    font-size: clamp(2rem, 4vw, 3.4rem);
    line-height: 1;
    letter-spacing: -0.06em;
}

.section-intro p,
.section-copy p,
.repo-desc,
.repo-summary p,
.page-footer p {
    color: var(--text-secondary);
}

.tab-navigation {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.tab-btn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    min-width: 132px;
    padding: 15px 18px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: color-mix(in srgb, var(--surface) 78%, transparent 22%);
    color: var(--text-primary);
    cursor: pointer;
    backdrop-filter: blur(16px);
    transition: transform 0.22s ease, border-color 0.22s ease, background 0.22s ease;
}

.tab-btn:hover {
    transform: translateY(-2px);
    border-color: var(--border-strong);
}

.tab-btn.active {
    border-color: color-mix(in srgb, var(--accent) 56%, var(--border-strong) 44%);
    background: color-mix(in srgb, var(--accent-soft) 46%, var(--surface-strong) 54%);
}

.tab-label {
    font-size: 1rem;
    font-weight: 700;
}

.tab-sub {
    color: var(--text-muted);
    font-size: 0.78rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.repo-sections {
    padding: 0 12px;
}

.tab-content {
    padding-top: 20px;
}

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 24px;
    padding-bottom: 22px;
    border-bottom: 1px solid var(--border-strong);
}

.section-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    color: var(--text-muted);
}

.section-count {
    font-size: clamp(2rem, 4vw, 3.4rem);
    line-height: 1;
    letter-spacing: -0.08em;
    color: var(--accent);
}

.section-note {
    font-size: 0.86rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.repo-list {
    display: flex;
    flex-direction: column;
}

.repo-entry {
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr) minmax(240px, 284px);
    gap: 24px;
    padding: 28px 8px;
    border-bottom: 1px solid var(--border);
    opacity: 0;
    transform: translateY(32px);
    transition:
        opacity 0.6s ease,
        transform 0.6s ease,
        background 0.24s ease,
        border-color 0.24s ease;
    transition-delay: var(--entry-delay, 0ms);
}

.repo-entry:first-child {
    padding-top: 34px;
}

.repo-entry:hover {
    background: color-mix(in srgb, var(--surface) 78%, transparent 22%);
    border-color: var(--border-strong);
}

.repo-entry.in-view,
.hero.in-view,
.hero-spotlight.in-view,
.tabs-shell.in-view,
.section-head.in-view,
.empty-state.in-view {
    opacity: 1;
    transform: translateY(0);
}

.hero,
.hero-spotlight,
.tabs-shell,
.section-head,
.empty-state {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.65s ease, transform 0.65s ease;
}

.repo-rank {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    color: var(--accent);
    font-size: clamp(2.2rem, 4vw, 3.5rem);
    font-weight: 700;
    line-height: 0.9;
    letter-spacing: -0.08em;
    opacity: 0.82;
}

.repo-main {
    min-width: 0;
}

.repo-heading {
    display: grid;
    gap: 8px;
}

.repo-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--accent);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.repo-kicker::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--accent);
    box-shadow: 0 0 0 8px var(--accent-soft);
}

.repo-title {
    margin: 0;
    font-size: clamp(1.35rem, 2vw, 2rem);
    line-height: 1.08;
    letter-spacing: -0.04em;
}

.repo-title a {
    text-decoration: none;
}

.repo-title a:hover {
    color: var(--accent);
}

.repo-desc {
    margin: 16px 0 0;
    max-width: 72ch;
}

.repo-summary {
    margin-top: 18px;
    padding-left: 18px;
    border-left: 2px solid color-mix(in srgb, var(--accent) 52%, transparent 48%);
}

.summary-label {
    display: inline-block;
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.repo-summary p {
    margin: 10px 0 0;
}

.repo-side {
    display: flex;
    flex-direction: column;
    gap: 14px;
    align-items: flex-start;
}

.repo-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.meta-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-muted);
    color: var(--text-secondary);
    font-size: 0.9rem;
    backdrop-filter: blur(12px);
}

.meta-pill i,
.author-line i {
    color: var(--accent);
}

.author-line {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
}

.btn {
    padding-inline: 18px;
    background: transparent;
    border: 1px solid var(--border-strong);
    color: var(--text-primary);
    font-weight: 700;
}

.btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.empty-state {
    padding: 48px 12px;
}

.page-footer {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap;
    margin-top: 38px;
    padding: 24px 12px 0;
    border-top: 1px solid var(--border);
}

::selection {
    background: var(--accent);
    color: #fff;
}

::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--text-muted) 38%, transparent 62%);
    border-radius: 999px;
}

.theme-toggle:focus-visible,
.tab-btn:focus-visible,
.primary-link:focus-visible,
.history-btn:focus-visible,
.btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

@media (max-width: 1180px) {
    .hero {
        min-height: auto;
        grid-template-columns: 1fr;
    }

    .hero-spotlight {
        max-width: 720px;
    }

    .tabs-shell,
    .section-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .tab-navigation {
        justify-content: flex-start;
    }

    .section-meta {
        align-items: flex-start;
    }

    .repo-entry {
        grid-template-columns: 72px minmax(0, 1fr);
    }

    .repo-side {
        grid-column: 2;
    }
}

@media (max-width: 780px) {
    .page-shell {
        width: min(100% - 20px, 100%);
        padding-top: 14px;
    }

    .theme-toggle-container {
        top: 12px;
        right: 12px;
    }

    .theme-toggle {
        width: 46px;
        height: 46px;
    }

    .hero {
        padding: 74px 18px 26px;
        border-radius: 28px;
    }

    .hero-topline {
        align-items: flex-start;
    }

    .hero-strip {
        grid-template-columns: 1fr;
    }

    .tabs-shell,
    .repo-sections,
    .page-footer {
        padding-inline: 4px;
    }

    .tab-navigation {
        width: 100%;
    }

    .tab-btn {
        flex: 1 1 calc(50% - 10px);
        min-width: 0;
    }

    .repo-entry {
        grid-template-columns: 1fr;
        gap: 18px;
        padding: 22px 4px;
    }

    .repo-rank {
        justify-content: flex-start;
    }

    .repo-side {
        grid-column: auto;
    }
}

@media (max-width: 540px) {
    .hero h1 {
        font-size: clamp(2.7rem, 15vw, 4rem);
    }

    .section-intro h2,
    .section-copy h2 {
        font-size: clamp(1.8rem, 10vw, 2.6rem);
    }

    .tab-btn {
        width: 100%;
    }

    .primary-link,
    .history-btn,
    .btn {
        width: 100%;
    }

    .hero-actions {
        flex-direction: column;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }

    .repo-entry,
    .hero,
    .hero-spotlight,
    .tabs-shell,
    .section-head,
    .empty-state {
        opacity: 1 !important;
        transform: none !important;
    }
}
