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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f5f5f5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 10px;
}

.site-header {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    padding: 0;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
    position: sticky;
    top: 0;
    z-index: 50;
}

.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 0.8rem;
    padding-bottom: 0.8rem;
}

.header-left { display: flex; align-items: center; }
.lang-switch { display: none; }
.lang-btn { display: none; }

.site-header h1 {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin: 0;
}

.site-header h1 .logo-icon {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
}

.site-header h1 a {
    color: #fff;
    text-decoration: none;
    font-size: 1.3rem;
    font-weight: bold;
    letter-spacing: 1px;
    background: linear-gradient(90deg, #e94560, #ff6b81);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.main-nav {
    display: inline-flex;
    gap: 0.2rem;
    flex-wrap: wrap;
    align-items: center;
}

.main-nav a {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    padding: 0.45rem 0.9rem;
    border-radius: 6px;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.main-nav a:hover,
.main-nav a.active {
    background: rgba(233,69,96,0.8);
    color: #fff;
}

.desktop-link { display: none; } /* Hide legacy */
.mobile-dropdown { display: none; } /* Hide legacy */

/* 桌面端菜单：完全展开，平铺显示 */
.menu-desktop {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}
/* 移动端菜单：默认隐藏，包含下拉菜单 */
.menu-mobile { display: none; }

.dropdown {
    position: relative;
    display: inline-block;
}
.dropdown-trigger {
    cursor: pointer;
    user-select: none;
    padding: 0.5rem 1rem;
    background: rgba(255,255,255,0.1);
    border-radius: 6px;
    color: rgba(255,255,255,0.9);
    font-size: 0.9rem;
}
.dropdown-trigger:hover {
    background: rgba(233,69,96,0.6);
}

.menu-divider {
    height: 1px;
    background: #eee;
    margin: 0.3rem 0;
}

.dropdown-menu-lang {
    font-weight: bold;
    color: #e94560 !important;
}
.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    min-width: 130px;
    z-index: 60;
    padding: 0.4rem 0;
    margin-top: 0.4rem;
}
.dropdown-menu a {
    display: block;
    padding: 0.55rem 1rem;
    color: #333;
    border-radius: 0;
    font-size: 0.9rem;
    white-space: nowrap;
}
.dropdown-menu a:hover {
    background: #f0f2f5;
    color: #e94560;
}
.dropdown:hover .dropdown-menu {
    display: block;
}

.site-footer {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    color: rgba(255,255,255,0.5);
    padding: 2rem 0 1.5rem;
    margin-top: 3rem;
    text-align: center;
    font-size: 0.85rem;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.footer-links a {
    color: rgba(255,255,255,0.6);
    text-decoration: none;
    transition: color 0.2s;
    font-size: 0.85rem;
}

.footer-links a:hover {
    color: #e94560;
}

.footer-divider {
    width: 80%;
    max-width: 600px;
    height: 2px;
    background: rgba(233,69,96,0.4);
    margin: 0 auto 1rem;
    border-radius: 1px;
}

.lang-selector {
    margin: 0.5rem 0;
}
.lang-selector select {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.1);
    color: #fff;
    font-size: 0.9rem;
    cursor: pointer;
    min-width: 200px;
}
.lang-selector select option {
    background: #1a1a2e;
    color: #fff;
}

.lang-flag {
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.3rem;
    margin-left: 0.3rem;
    vertical-align: middle;
}

.seo-content {
    margin: 1.5rem auto;
    padding: 2rem;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.seo-content h2 {
    font-size: 1.4rem;
    color: #333;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e94560;
}

.seo-content h3 {
    font-size: 1.2rem;
    color: #444;
}

.seo-content h4 {
    font-size: 1.1rem;
    color: #555;
    margin: 1.2rem 0 0.6rem;
}

.seo-content p {
    color: #666;
    line-height: 1.8;
    margin-bottom: 0.8rem;
}

.seo-content ul {
    padding-left: 1.5rem;
    color: #666;
    line-height: 1.8;
}

.seo-content li {
    margin-bottom: 0.4rem;
}

/* 问答百科样式 */
.faq-list {
    border-top: 1px solid #eee;
}
.faq-item {
    border-bottom: 1px solid #eee;
}
.faq-question {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    font-size: 1.1rem;
    color: #333;
    cursor: pointer;
    margin: 0;
    transition: color 0.2s;
}
.faq-question:hover {
    color: #e94560;
}
.faq-icon {
    font-size: 1.5rem;
    color: #999;
    transition: transform 0.3s;
}
.faq-item.active .faq-icon {
    transform: rotate(45deg);
}
.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out;
}
.faq-answer p {
    padding-bottom: 1.2rem;
    line-height: 1.8;
    color: #666;
}
.faq-answer a {
    color: #e94560;
    text-decoration: none;
    font-weight: bold;
}
.faq-answer a:hover {
    text-decoration: underline;
}

.puzzle-section {
    margin: 1.5rem 0;
}

.section-title {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e94560;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.section-title a {
    color: #333;
    text-decoration: none;
}

.section-title a:hover {
    color: #e94560;
}

.section-more {
    font-size: 0.85rem;
    color: #888;
    font-weight: normal;
}
.section-more:hover {
    color: #e94560;
}

.total-count {
    font-size: 0.9rem;
    color: #888;
    font-weight: normal;
}

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

.puzzle-card {
    display: block;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
    color: inherit;
}

.puzzle-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.svg-container {
    width: 100%;
    aspect-ratio: 1000 / 1100;
}

.svg-container svg {
    width: 100%;
    height: 100%;
}

.puzzle-rating {
    display: block;
    text-align: center;
    padding: 0.5rem;
    font-size: 0.85rem;
    color: #666;
    background: #fafafa;
    border-top: 1px solid #eee;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.page-link {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-decoration: none;
    color: #333;
    transition: all 0.2s;
}

.page-link:hover {
    background: #e94560;
    color: #fff;
    border-color: #e94560;
}

.page-link.active {
    background: #e94560;
    color: #fff;
    border-color: #e94560;
}

.grid-bg {
    fill: #ffffff;
}

.digit {
    fill: #333333;
    font-family: "Courier New", Courier, monospace;
    font-weight: bold;
}

.line {
    stroke: #888888;
    stroke-width: 1;
    fill: none;
}

.line-bold {
    stroke: #333333;
    stroke-width: 2;
    fill: none;
}

.difficulty-bar {
    rx: 3;
    ry: 3;
}

/* 移动端适配：桌面菜单隐藏，移动菜单显示 */
@media (max-width: 900px) {
    /* 隐藏桌面端元素 */
    .menu-desktop { display: none !important; }
    .lang-switch-desktop { display: none !important; }
    .desktop-link { display: none !important; }
    .mobile-dropdown { display: none !important; }

    /* 显示移动端下拉菜单 */
    .menu-mobile { 
        display: flex !important; 
        justify-content: center;
        align-items: center;
        gap: 0.5rem;
    }
    
    /* 允许导航换行 */
    .site-header .container {
        flex-wrap: inherit;
        justify-content: center;
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
    }

    .header-left {
        flex: 1 1 100%; /* Logo 独占一行或居中 */
        justify-content: left;
    }
    
    .main-nav {
        flex: 1 1 100%;
        justify-content: right;
    }

    .puzzle-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
}
@media (max-width: 440px) {
    .site-header h1 a{
        font-size: 1.2rem;
    }
}
@media (max-width: 412px) {
    .site-header h1 a{
        font-size: 1.1rem;
    }
}
@media (max-width: 380px) {
    .site-header h1 a{
        font-size: 1rem;
    }
}
@media (max-width: 360px) {
    .site-header h1 a{
        font-size: 0.9rem;
    }
}
@media (max-width: 340px) {
    .site-header h1 a{
        font-size: 0.8rem;
    }
    .bottom-bar{
        gap: 0.2rem;
    }
}