:root {
    --bg: #ffffff;
    --bg-secondary: #f5f5f7;
    --bg-card: #ffffff;
    --text: #1d1d1f;
    --text-secondary: #6e6e73;
    --accent: #00787e;
    --accent-hover: #00848b;
    --border: #e5e5e7;
    --shadow: rgba(0,0,0,0.08);
    --nav-bg: rgba(255,255,255,0.9);
    --tag-bg: #f0f0f0;
    --tag-active-bg: #00787e;
    --tag-active-text: #fff;
    --game-card-radius: 12px;
    --max-width: 1200px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #1c1c1e;
        --bg-secondary: #2c2c2e;
        --bg-card: #2c2c2e;
        --text: #f5f5f7;
        --text-secondary: #a1a1a6;
        --accent: #00787e;
        --accent-hover: #00848b;
        --border: #38383a;
        --shadow: rgba(0,0,0,0.3);
        --nav-bg: rgba(23,25,25,0.8);
        --tag-bg: #3a3a3c;
        --tag-active-bg: #00787e;
        --tag-active-text: #fff;
    }
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    transition: background .3s, color .3s;
}

header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--nav-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 2px 5px var(--border);
}

.header-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 20px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    font-size: 22px;
    font-weight: 700;
    color: var(--accent);
    text-decoration: none;
}

nav {
    display: flex;
    gap: 8px;
}

nav a {
    padding: 8px 16px;
    border-radius: 20px;
    text-decoration: none;
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    transition: background .2s, color .2s;
}

nav a:hover {
    background: var(--tag-bg);
}

nav a.active {
    background: var(--accent);
    color: #fff;
}

.nav-search {
    display: flex;
}

.nav-search input {
    width: 240px;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--bg);
    color: var(--text);
    font-size: 13px;
    outline: none;
    transition: width .2s, border-color .2s;
}

.nav-search input:focus {
    width: 300px;
    border-color: var(--accent);
}

.back-link {
    display: none;
    text-decoration: none;
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    margin-right: 8px;
}

.second-search {
    display: none;
    margin-bottom: 12px;
}

.second-search input {
    width: 100%;
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    outline: none;
}

.second-search input:focus {
    border-color: var(--accent);
}

@media (max-width: 600px) {
    .back-link {
        display: inline;
    }
    .page-detail .logo {
        display: none;
    }
    .nav-search {
        display: none;
    }
    .second-search {
        display: block;
    }
}

main {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 20px;
    min-height: calc(100vh - 120px);
}

footer {
    text-align: center;
    padding: 15px;
    color: var(--text-secondary);
    font-size: 13px;
    border-top: 1px solid var(--border);
}

footer p a {
    color: var(--text-secondary);
    text-decoration: none;
}

footer p a:hover {
    color: var(--accent);
}

.hero {
    position: relative;
    overflow: hidden;
    text-align: center;
    padding: 40px 20px 60px;
    background: linear-gradient(180deg, #050816 0%, #080c24 40%, #0a0e27 70%, #020108 100%);
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    isolation: isolate;
    margin-bottom: 15px;
}

.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 100%, rgba(30,60,180,0.15) 0%, transparent 60%);
    pointer-events: none;
}

.stars {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    transition: transform 0.08s ease-out;
}

.star {
    position: absolute;
    border-radius: 50%;
    background: #fff;
    pointer-events: none;
}

.star-glow {
    box-shadow: 0 0 4px 1px rgba(200, 220, 255, 0.5);
}

.shooting-star {
    position: absolute;
    width: 3px;
    height: 3px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 0 6px 2px rgba(200,220,255,0.6);
    pointer-events: none;
    opacity: 0;
}

#shootingStar1 {
    top: 10%;
    left: 70%;
    animation: shootingStar 6s ease-in infinite 2s;
}

#shootingStar2 {
    top: 20%;
    left: 30%;
    animation: shootingStar 8s ease-in infinite 5s;
}

@keyframes shootingStar {
    0% { transform: translate(0, 0) rotate(-35deg); opacity: 1; }
    5% { opacity: 1; }
    15% { transform: translate(-250px, 160px) rotate(-35deg); opacity: 0; }
    100% { opacity: 0; }
}

.shooting-star::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    width: 60px;
    height: 1px;
    background: linear-gradient(90deg, rgba(255,255,255,0.5), transparent);
    transform: translateY(-50%) translateX(-100%);
}

#shootingStar1::after { width: 80px; }
#shootingStar2::after { width: 50px; }

@keyframes twinkle {
    0%, 100% { opacity: 0.15; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.3); }
}

.radar-base {
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    width: 160px;
    height: 70px;
    pointer-events: none;
}

.radar-dish {
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 30px;
    border: 2px solid rgba(0,155,162,0.25);
    border-top: none;
    border-radius: 0 0 50% 50%;
    background: radial-gradient(ellipse at 50% 100%, rgba(0,155,162,0.06) 0%, transparent 70%);
}

.radar-dish::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 3px;
    background: linear-gradient(90deg, transparent, rgba(0,155,162,0.4), transparent);
    border-radius: 2px;
    box-shadow: 0 0 10px rgba(0,155,162,0.3);
}

.radar-feed {
    position: absolute;
    bottom: 33px;
    left: 50%;
    transform: translateX(-50%);
    width: 8px;
    height: 10px;
    background: linear-gradient(180deg, rgba(0,155,162,0.4), transparent);
    border-radius: 50% 50% 0 0;
}

.radar-feed::after {
    content: '';
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 3px;
    height: 6px;
    background: rgba(0,155,162,0.5);
    border-radius: 2px;
    box-shadow: 0 0 6px rgba(0,155,162,0.4);
}

.radar-line {
    position: absolute;
    bottom: 35px;
    left: 50%;
    width: 200px;
    height: 200px;
    transform-origin: 50% 100%;
    animation: radarSpin 4s linear infinite;
    pointer-events: none;
    margin-left: -100px;
    z-index: 1;
}

.radar-line::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 200px;
    height: 1px;
    background: linear-gradient(90deg, rgba(0,155,162,0.7) 0%, rgba(0,155,162,0.1) 60%, transparent 100%);
    transform-origin: left center;
}

.radar-glow {
    position: absolute;
    bottom: 35px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 60px;
    background: radial-gradient(ellipse at 50% 0%, rgba(0,155,162,0.08) 0%, transparent 70%);
    border-radius: 50%;
}

@keyframes radarSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.hero-content {
    position: relative;
    z-index: 2;
    width: 100%;
    transition: transform 0.15s ease-out;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.tagline {
    font-size: 16px;
    color: rgba(255,255,255,0.7);
    letter-spacing: 2px;
}

.search-box {
    display: flex;
    width: 100%;
    max-width: 480px;
    margin-top: 8px;
    gap: 0;
}

.search-box input {
    flex: 1;
    padding: 12px;
    border: 1px solid rgba(255,255,255,0.2);
    border-right: none;
    border-radius: 24px 0 0 24px;
    background: rgba(255,255,255,0.06);
    backdrop-filter: blur(10px);
    color: #fff;
    font-size: 14px;
    outline: none;
    transition: border-color .3s, background .3s;
}

.search-box input::placeholder {
    color: rgba(255,255,255,0.5);
}

.search-box input:focus {
    border-color: rgba(0,155,162,0.6);
    background: rgba(255,255,255,0.15);
}

.search-box button {
    padding: 12px 24px;
    border: none;
    border-radius: 0 24px 24px 0;
    background: linear-gradient(135deg, #009ba2, var(--accent));
    color: #fff;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: background .3s;
}

.search-box button:hover {
    background: linear-gradient(135deg, #009ba2, #00787e);
}

.search-page .search-header {
    display: flex;
    justify-content: center;
    margin-bottom: 32px;
}

.search-page .search-header .search-box {
    max-width: 560px;
}

.search-page .search-header .search-box input {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-right: none;
    color: var(--text);
}

.search-page .search-header .search-box input::placeholder {
    color: var(--text-secondary);
}

.search-count {
    text-align: center;
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.search-empty {
    text-align: center;
    padding: 60px 20px;
    font-size: 16px;
    color: var(--text-secondary);
}

.category-section {
    padding-bottom: 15px;
    break-inside: avoid;
}

.focus-slider {
    max-width: var(--max-width);
    margin: 0 auto 24px;
}

.focus-slider .swiper {
    overflow: hidden;
}

.focus-slide-inner {
    display: block;
    width: 100%;
    aspect-ratio: 460 / 215;
    background-size: cover;
    background-position: center;
    position: relative;
    text-decoration: none;
    border-radius: 8px;
    overflow: hidden;
}

.focus-slide-title {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 24px 12px 10px;
    background: linear-gradient(transparent, rgba(0,0,0,0.75));
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
    opacity: 0;
    transition: opacity .25s;
}

.focus-slide-inner:hover .focus-slide-title {
    opacity: 1;
    text-shadow: 0 1px 8px rgba(0,0,0,0.6);
}

.focus-slider .swiper-slide {
    height: auto;
}

.focus-slider .swiper-button-next,
.focus-slider .swiper-button-prev {
    color: #fff;
    background: rgba(0,0,0,0.3);
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.focus-slider .swiper-button-next::after,
.focus-slider .swiper-button-prev::after {
    font-size: 16px;
}

.focus-slider .swiper-pagination-bullet {
    background: rgba(255,255,255,0.5);
}

.focus-slider .swiper-pagination-bullet-active {
    background: var(--accent);
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

@media (max-width: 800px) {
    .category-grid {
        grid-template-columns: 1fr;
    }
}

.category-section h2 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--accent);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.more-link {
    color: var(--accent);
    text-decoration: none;
    font-size: 14px;
    font-weight: 400;
    opacity: 0.7;
    transition: opacity .2s;
}

.more-link:hover {
    opacity: 1;
}

.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.four-col {
    grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 900px) {
    .four-col { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
    .four-col { grid-template-columns: 1fr; }
}

.game-card {
    display: block;
    background: var(--bg-card);
    border-radius: var(--game-card-radius);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 2px 8px var(--shadow);
    transition: transform .2s, box-shadow .2s;
    position: relative;
}

.game-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px var(--shadow);
}

.game-card.ranked .rank {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 28px;
    height: 28px;
    background: var(--accent);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    z-index: 2;
}

.game-cover {
    width: 100%;
    aspect-ratio: 460 / 215;
    background-size: cover;
    background-position: center;
    background-color: var(--bg-secondary);
    transition: transform .3s;
}

.game-card:hover .game-cover {
    transform: scale(1.08);
}

.game-info {
    padding: 12px;
}

.game-info h3 {
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.game-meta {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}

.tag-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.tag-btn {
    padding: 6px 16px;
    border-radius: 20px;
    text-decoration: none;
    font-size: 13px;
    background: var(--tag-bg);
    color: var(--text);
    transition: all .2s;
}

.tag-btn:hover {
    opacity: .8;
}

.tag-btn.active {
    background: var(--tag-active-bg);
    color: var(--tag-active-text);
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-top: 32px;
    font-size: 14px;
}

.pagination a {
    padding: 8px 20px;
    border-radius: 8px;
    background: var(--tag-bg);
    color: var(--text);
    text-decoration: none;
    transition: background .2s;
}

.pagination a:hover {
    background: var(--accent);
    color: #fff;
}

.rankings-page h1 {
    font-size: 20px;
    margin-bottom: 4px;
}

.rankings-page .subtitle {
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.year-block {
    margin-bottom: 40px;
}

.year-block h2 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--accent);
}

.detail-page {}

.detail-header {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    background: var(--bg-secondary);
    padding: 15px;
    border-radius: 12px;
}

@media (max-width: 768px) {
    .detail-header { flex-direction: column; }
}

.detail-cover {
    flex-shrink: 0;
    width: 460px;
    aspect-ratio: 460 / 215;
    background-size: cover;
    background-position: center;
    border-radius: var(--game-card-radius);
    background-color: var(--bg-secondary);
}

@media (max-width: 768px) {
    .detail-cover { width: 100%; }
}

.detail-info h1 {
    font-size: 24px;
    margin-bottom: 8px;
}

.detail-info .title-en {
    color: var(--text-secondary);
    font-size: 16px;
    margin-bottom: 16px;
}

.detail-meta {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 14px;
    margin-bottom: 16px;
}

.detail-meta strong {
    color: var(--text-secondary);
    font-weight: 500;
}

.description {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.7;
}

.screenshot-gallery {
    margin-bottom: 15px;
    background: var(--bg-secondary);
    padding: 15px;
    border-radius: 12px;
}

.game-content {
    margin-bottom: 15px;
    background: var(--bg-secondary);
    padding: 15px;
    border-radius: 12px;
}

.screenshot-gallery h2, .game-content h2 {
    font-size: 16px;
    margin-bottom: 12px;
    /* border-bottom: 1px solid var(--accent); */
}

.game-content li {
    list-style: none;
}

.screenshot-item {
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-card);
    cursor: pointer;
    transition: transform .2s;
    aspect-ratio: 16 / 9;
    display: flex;
    align-items: center;
    justify-content: center;
}

.screenshot-item:hover {
    transform: scale(1.02);
}

.screenshot-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
}

.screenshotSwiper {
    padding-bottom: 36px;
}

.screenshotSwiper .swiper-button-next,
.screenshotSwiper .swiper-button-prev {
    color: var(--accent);
    width: 36px;
    height: 36px;
    background: var(--bg-card);
    border-radius: 50%;
    box-shadow: 0 2px 8px var(--shadow);
}

.screenshotSwiper .swiper-button-next::after,
.screenshotSwiper .swiper-button-prev::after {
    font-size: 14px;
    font-weight: 700;
}

.screenshotSwiper .swiper-pagination-bullet-active {
    background: var(--accent);
}

.lightbox {
    display: none;
    position: fixed;
    z-index: 9999;
    inset: 0;
    background: rgba(0,0,0,0.9);
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.lightbox-img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 36px;
    color: #fff;
    cursor: pointer;
    line-height: 1;
}

/* 灯箱前后切换按钮 */
.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 40px;
    color: #fff;
    cursor: pointer;
    padding: 16px;
    user-select: none;
    opacity: 0.6;
    transition: opacity .2s;
    z-index: 10;
}

.lightbox-nav:hover {
    opacity: 1;
}

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}

.game-content .content-body {
    font-size: 14px;
    line-height: 1.8;
}

.game-content .content-body pre {
    display: inline;
    word-wrap: break;
}

.content-body img {
    max-width: 100%;
    border-radius: 8px;
    margin: 8px 0;
}

#back-to-top {
    position: fixed;
    right: 30px;
    bottom: 40px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size: 25px;
    line-height: 40px;
    text-align: center;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: opacity .3s, visibility .3s, transform .3s;
    z-index: 999;
    box-shadow: 0 2px 12px rgba(0,0,0,0.25);
    user-select: none;
}

#back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

#back-to-top:hover {
    transform: translateY(-3px);
}

.download-wrapper {
    background: var(--bg-secondary);
    padding: 15px;
    border-radius: 12px;
    margin-top: 15px;
}

.download-wrapper h2 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
}

.download-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.download-btn {
    padding: 8px 20px;
    border: none;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    transition: opacity .2s;
}

.download-btn:hover {
    opacity: 0.85;
}

.qr-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.qr-modal-content {
    background: #fff;
    border-radius: 12px;
    padding: 32px;
    text-align: center;
    position: relative;
    max-width: 320px;
    width: 90%;
}

.qr-modal-content h3 {
    margin-bottom: 16px;
    color: #1d1d1f;
}

.qr-modal-content img {
    width: 200px;
    height: 200px;
    display: block;
    margin: 0 auto;
}

.qr-modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    line-height: 1;
}

.requirements-wrapper {
    background: var(--bg-secondary);
    padding: 15px;
    border-radius: 12px;
    margin-top: 15px;
}

.requirements-wrapper h2 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
}

.requirements-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.requirements-tabs > input {
    display: none;
}

.requirements-tabs label {
    padding: 6px 16px;
    border-radius: 8px;
    background: var(--tag-bg);
    color: var(--text);
    font-size: 14px;
    cursor: pointer;
    user-select: none;
    transition: background .2s, color .2s;
}

.requirements-tabs label:hover {
    background: var(--accent);
    color: #fff;
}

.requirements-tabs input:checked + label {
    background: var(--accent);
    color: #fff;
}

.req-panel {
    display: none;
    flex-basis: 100%;
    margin-top: 4px;
    padding: 12px 14px;
    background: var(--bg-card);
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.8;
    word-break: break-word;
}

.requirements-tabs input#req-windows:checked ~ .req-panel[data-tab="windows"],
.requirements-tabs input#req-macos:checked ~ .req-panel[data-tab="macos"],
.requirements-tabs input#req-steamos:checked ~ .req-panel[data-tab="steamos"] {
    display: block;
}
