:root {
    --primary: #5D8233;
    --primary-dark: #4A6828;
    --primary-light: #7BA048;
    --secondary: #8B4513;
    --secondary-dark: #6B3E26;
    --accent: #FFD700;
    --bg-gradient: linear-gradient(135deg, #87CEEB 0%, #98D8C8 50%, #7CB342 100%);
    --bg-light: #F5F5DC;
    --bg-warm: #FFF8DC;
    --text-dark: #2F1810;
    --text-light: #5D4037;
    --card-bg: #FFFEF7;
    --shadow: rgba(93, 130, 51, 0.2);
    --shadow-lg: rgba(93, 130, 51, 0.3);
    --danger: #dc3545;
    --info: #17a2b8;
    --sidebar-width: 320px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
    background: var(--bg-gradient);
    min-height: 100vh;
    color: var(--text-dark);
}

.main-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    padding: 15px 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 4px 20px var(--shadow);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: 70px;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo-icon {
    width: 45px;
    height: 45px;
    background: rgba(255,255,255,0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
}

.logo-text h1 {
    color: white;
    font-size: 1.5rem;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.logo-text p {
    color: rgba(255,255,255,0.8);
    font-size: 0.75rem;
}

.search-container {
    flex: 1;
    max-width: 500px;
    margin: 0 30px;
}

.search-box {
    position: relative;
    width: 100%;
}

.search-box input {
    width: 100%;
    padding: 12px 20px 12px 45px;
    border: none;
    border-radius: 25px;
    background: rgba(255,255,255,0.95);
    font-size: 0.95rem;
    box-shadow: 0 3px 15px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.search-box input:focus {
    outline: none;
    background: white;
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
}

.search-box::before {
    content: "\1F50D";
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.1rem;
}

.search-results {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
    max-height: 400px;
    overflow-y: auto;
    z-index: 2000;
    margin-top: 8px;
}

.search-results.show {
    display: block;
}

.search-result-item {
    padding: 12px 20px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: #f0f7e6;
}

.search-result-item .result-icon {
    font-size: 1.2rem;
}

.search-result-item .result-text {
    flex: 1;
}

.search-result-item .result-text .result-title {
    font-weight: 600;
    color: var(--text-dark);
}

.search-result-item .result-text .result-category {
    font-size: 0.75rem;
    color: var(--text-light);
}

.no-results {
    padding: 20px;
    text-align: center;
    color: var(--text-light);
}

.search-highlight {
    background: #fff3cd;
    padding: 2px 4px;
    border-radius: 3px;
}

.quick-stats {
    display: flex;
    gap: 15px;
}

.stat-pill {
    background: rgba(255,255,255,0.15);
    padding: 8px 15px;
    border-radius: 20px;
    color: white;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.app-container {
    display: flex;
    padding-top: 70px;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--card-bg);
    height: calc(100vh - 70px);
    position: fixed;
    top: 70px;
    left: 0;
    overflow-y: auto;
    box-shadow: 4px 0 20px var(--shadow);
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-section {
    padding: 15px;
}

.sidebar-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--text-light);
    letter-spacing: 1px;
    margin-bottom: 10px;
    padding-left: 10px;
}

.nav-list {
    list-style: none;
}

.nav-item {
    margin-bottom: 3px;
}

.nav-item a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    border-radius: 10px;
    color: var(--text-dark);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.nav-item a:hover {
    background: rgba(93, 130, 51, 0.1);
    color: var(--primary);
}

.nav-item a.active {
    background: var(--primary);
    color: white;
    font-weight: 500;
}

.nav-icon {
    font-size: 1.2rem;
    width: 28px;
    text-align: center;
}

.nav-divider {
    height: 1px;
    background: #eee;
    margin: 15px 10px;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: white;
}

.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 30px;
    max-width: calc(100% - var(--sidebar-width));
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.quick-card {
    background: white;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 5px 20px var(--shadow);
    transition: all 0.3s ease;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: block;
}

.quick-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px var(--shadow-lg);
}

.quick-card-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.quick-card-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.quick-card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-dark);
}

.quick-card-desc {
    font-size: 0.85rem;
    color: var(--text-light);
    line-height: 1.5;
}

.section {
    display: none;
}

.section.active {
    display: block;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.page-header {
    background: linear-gradient(135deg, var(--bg-warm) 0%, var(--card-bg) 100%);
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 25px;
    box-shadow: 0 10px 40px var(--shadow);
}

.page-header h2 {
    color: var(--primary);
    font-size: 1.8rem;
    margin-bottom: 10px;
}

.page-header p {
    color: var(--text-light);
    font-size: 1rem;
    line-height: 1.6;
}

.content-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 25px;
    box-shadow: 0 5px 25px var(--shadow);
    margin-bottom: 25px;
}

.content-card + .content-card {
    margin-top: 0;
}

.section-title-bar {
    background: linear-gradient(135deg, var(--secondary) 0%, var(--secondary-dark) 100%);
    color: white;
    padding: 18px 25px;
    border-radius: 12px 12px 0 0;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 12px;
    margin: -25px -25px 25px -25px;
}

.section-title-bar h3 {
    margin: 0;
    padding: 0;
    border: none;
    color: white;
    font-size: 1.2rem;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 3px 15px var(--shadow);
    font-size: 0.9rem;
}

th {
    background: var(--primary);
    color: white;
    padding: 14px 12px;
    text-align: left;
    font-weight: 600;
}

td {
    padding: 12px 12px;
    border-bottom: 1px solid #f0f0f0;
}

tr:hover {
    background: rgba(93, 130, 51, 0.08);
}

h3 {
    color: var(--primary);
    font-size: 1.15rem;
    margin: 25px 0 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--primary);
}

h4 {
    color: var(--secondary);
    font-size: 1rem;
    margin: 20px 0 10px;
}

h5 {
    color: var(--text-dark);
    font-size: 0.95rem;
    margin: 15px 0 8px;
}

p {
    line-height: 1.7;
    margin-bottom: 12px;
}

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: bold;
    margin: 2px;
}

.badge-new { background: #4CAF50; color: white; }
.badge-hidden { background: #9C27B0; color: white; }
.badge-event { background: #2196F3; color: white; }
.badge-top { background: #FF9800; color: white; }
.badge-good { background: #8BC34A; color: white; }
.badge-neutral { background: #9E9E9E; color: white; }
.badge-bad { background: #f44336; color: white; }

.tip-box {
    background: linear-gradient(135deg, #E8F5E9 0%, #C8E6C9 100%);
    border-left: 4px solid var(--primary);
    padding: 18px 20px;
    border-radius: 0 12px 12px 0;
    margin: 20px 0;
}

.tip-box.warning {
    background: linear-gradient(135deg, #FFF3E0 0%, #FFE0B2 100%);
    border-left-color: #FF9800;
}

.tip-box.info {
    background: linear-gradient(135deg, #E3F2FD 0%, #BBDEFB 100%);
    border-left-color: #2196F3;
}

.tip-box.danger {
    background: linear-gradient(135deg, #FFEBEE 0%, #FFCDD2 100%);
    border-left-color: #f44336;
}

.tip-box .tip-title {
    font-weight: bold;
    color: var(--primary);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin: 15px 0;
}

.info-item {
    background: white;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 3px 10px var(--shadow);
}

.info-item .label {
    color: var(--text-light);
    font-size: 0.8rem;
}

.info-item .value {
    color: var(--primary);
    font-weight: bold;
    font-size: 1rem;
    margin-top: 5px;
}

.npc-card {
    background: white;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 4px 15px var(--shadow);
}

.npc-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.npc-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
}

.npc-info h5 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--text-dark);
}

.birthday {
    font-size: 0.85rem;
    color: var(--text-light);
}

.npc-gifts {
    font-size: 0.9rem;
    line-height: 1.6;
}

.ad-label {
    font-size: 0.7rem;
    color: #999;
    text-align: center;
    margin-bottom: 8px;
}

.ad-container {
    background: white;
    border-radius: 12px;
    padding: 15px;
    margin: 20px 0;
    box-shadow: 0 3px 15px var(--shadow);
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    overflow: hidden;
}

.ad-banner-container {
    background: white;
    border-radius: 12px;
    padding: 10px;
    margin: 30px 0 0;
    box-shadow: 0 3px 15px var(--shadow);
    text-align: center;
    overflow: hidden;
    max-width: 100%;
}

.ad-banner-container .ad-label {
    margin-bottom: 5px;
}

/* 确保广告容器内的iframe和内容不超过容器宽度 */
.ad-container iframe,
.ad-banner-container iframe,
.ad-container > div,
.ad-banner-container > div {
    max-width: 100% !important;
    width: auto !important;
    max-height: 100% !important;
}

@media (max-width: 768px) {
    .ad-container {
        margin: 15px 0;
        padding: 10px;
        min-height: 100px;
    }
}

footer {
    background: var(--primary-dark);
    color: white;
    text-align: center;
    padding: 25px;
    margin-top: 40px;
    border-radius: 16px 16px 0 0;
}

footer a {
    color: var(--accent);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

.collapsible {
    background: var(--primary);
    color: white;
    cursor: pointer;
    padding: 15px 20px;
    border: none;
    border-radius: 10px;
    margin: 10px 0;
    width: 100%;
    text-align: left;
    font-size: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}

.collapsible:hover {
    background: var(--primary-dark);
}

.collapsible::after {
    content: "+";
    font-size: 1.3rem;
}

.collapsible.active::after {
    content: "\2212";
}

.collapsible-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    background: white;
    border-radius: 0 0 10px 10px;
}

.collapsible-content.show {
    max-height: 5000px;
    padding: 20px;
}

@media (max-width: 1024px) {
    :root {
        --sidebar-width: 280px;
    }
}

@media (max-width: 768px) {
    .main-header {
        padding: 12px 15px;
    }

    .logo-text h1 {
        font-size: 1.2rem;
    }

    .logo-text p {
        display: none;
    }

    .search-container {
        display: none;
    }

    .quick-stats {
        display: none;
    }

    .menu-toggle {
        display: block;
    }

    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .overlay.open {
        display: block;
    }

    .main-content {
        margin-left: 0;
        max-width: 100%;
        padding: 20px 15px;
    }

    .page-header {
        padding: 20px;
    }

    .page-header h2 {
        font-size: 1.4rem;
    }

    .content-card {
        padding: 20px 15px;
    }

    .section-title-bar {
        margin: -20px -15px 20px -15px;
        padding: 15px 20px;
    }

    .card-grid {
        grid-template-columns: 1fr;
    }

    table {
        font-size: 0.8rem;
    }

    th, td {
        padding: 10px 8px;
    }

    .sidebar-ad {
        margin: 10px;
        padding: 10px;
    }
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--primary-light);
    border-radius: 3px;
}

.sidebar-footer {
    padding: 15px;
    margin-top: auto;
    border-top: 1px solid var(--border);
}

.external-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 15px;
    background: var(--primary);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.external-link:hover {
    background: var(--primary-dark);
    transform: translateX(3px);
}

/* 底部固定广告栏 */
.floating-ad {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
    z-index: 999;
    text-align: center;
    padding: 8px 0;
    animation: slideInUp 0.3s ease;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(100%);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.floating-ad-label {
    font-size: 0.65rem;
    color: #999;
    margin-bottom: 5px;
}

.floating-ad-close {
    position: absolute;
    top: 5px;
    right: 10px;
    width: 24px;
    height: 24px;
    border: none;
    background: rgba(0,0,0,0.1);
    color: #666;
    font-size: 16px;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.floating-ad-close:hover {
    background: rgba(0,0,0,0.2);
    color: #333;
}

#floatingAdContent {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 50px;
}

#floatingAdContent iframe,
#floatingAdContent > div {
    max-width: 100% !important;
}

/* 为底部广告留出空间 */
body {
    padding-bottom: 70px;
}

.highlight {
    background: yellow;
    padding: 2px 4px;
    border-radius: 3px;
}
