/* 基础重置与暖色调变量 */
:root {
    --bg-color: #f7f4f0;
    --text-main: #2c2825;
    --text-sub: #888580;
    --theme-color: #d97736;
    --theme-light: #fbebd9;
    --card-bg: #ffffff;
    --border-radius: 12px;
    --shadow-soft: 0 4px 12px rgba(0,0,0,0.04);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    padding-bottom: 60px;
}

.app-header { text-align: center; padding: 24px 0 16px; }
.app-header h1 { font-size: 22px; font-weight: 600; letter-spacing: 1px; }

/* 源卡片区 */
.source-section { padding: 0 16px; margin-bottom: 16px; }
.source-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.source-card {
    background: var(--card-bg); border: 1px solid #e8e0d5; border-radius: 10px;
    padding: 10px 4px; text-align: center; font-size: 13px; font-weight: 500;
    color: var(--text-main); box-shadow: var(--shadow-soft); transition: all 0.2s;
    cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.source-card.active {
    border-color: var(--theme-color); background-color: var(--theme-light);
    color: var(--theme-color); font-weight: 600;
}
.source-card.add-btn {
    border: 1px dashed var(--text-sub); background: transparent;
    color: var(--text-sub); font-size: 20px; line-height: 1.1; box-shadow: none;
}

/* 搜索区 */
.search-section { padding: 0 16px; margin-bottom: 16px; position: relative; z-index: 10; }
.search-bar {
    display: flex; align-items: center; background: var(--card-bg);
    border-radius: 50px; padding: 4px; box-shadow: 0 2px 10px rgba(217, 119, 54, 0.1);
    border: 1px solid #f0e6d8;
}
.search-dropdown {
    padding: 8px 12px 8px 16px; font-size: 14px; font-weight: 500;
    color: var(--theme-color); display: flex; align-items: center; gap: 4px;
    cursor: pointer; position: relative; white-space: nowrap;
}
.search-dropdown .arrow { font-size: 10px; }
.dropdown-menu {
    position: absolute; top: 100%; left: 0; background: #fff; border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1); display: none; flex-direction: column;
    min-width: 100px; overflow: hidden; border: 1px solid #eee;
}
.dropdown-menu.show { display: flex; }
.dropdown-item { padding: 10px 16px; font-size: 14px; color: var(--text-main); }
.dropdown-item:hover { background: var(--theme-light); color: var(--theme-color); }
#searchInput { flex: 1; border: none; outline: none; font-size: 15px; background: transparent; padding: 8px 0; min-width: 0; }
.search-btn { background: var(--theme-color); color: #fff; border: none; border-radius: 50px; padding: 10px 20px; font-size: 15px; font-weight: 500; cursor: pointer; transition: opacity 0.2s; }
.search-btn:active { opacity: 0.8; }

/* 分类导航 */
.category-nav {
    display: flex; overflow-x: auto; padding: 0 16px; margin-bottom: 16px; gap: 16px; scrollbar-width: none;
}
.category-nav::-webkit-scrollbar { display: none; }
.cat-item { font-size: 15px; color: var(--text-sub); white-space: nowrap; padding-bottom: 6px; cursor: pointer; }
.cat-item.active { color: var(--theme-color); font-weight: 600; border-bottom: 2px solid var(--theme-color); }

/* 主展示区与海报 */
.main-content { padding: 0 16px; }
.poster-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 24px; }
.poster-card { background: var(--card-bg); border-radius: var(--border-radius); overflow: hidden; box-shadow: var(--shadow-soft); cursor: pointer; }
.poster-img-wrap { position: relative; width: 100%; aspect-ratio: 3 / 4; background: #e8e0d5; }
.poster-img-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
.poster-tag { position: absolute; top: 6px; left: 6px; background: rgba(0, 0, 0, 0.6); color: #fff; font-size: 11px; padding: 2px 6px; border-radius: 4px; backdrop-filter: blur(2px); }
.poster-name { padding: 8px; font-size: 13px; font-weight: 500; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 全站搜索排版 */
.search-title { font-size: 18px; margin-bottom: 12px; font-weight: 600; }
.summary-grid { margin-bottom: 20px; }
.group-section { margin-bottom: 24px; }
.group-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; padding-bottom: 6px; border-bottom: 1px solid #e8e0d5; }
.group-header h3 { font-size: 16px; font-weight: 600; }
.all-btn { font-size: 13px; color: var(--theme-color); cursor: pointer; }

/* 页脚 */
.app-footer { text-align: center; font-size: 12px; color: var(--text-sub); padding: 20px 0; position: absolute; bottom: 0; width: 100%; }

/* 弹窗遮罩 */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.4); display: none; justify-content: center; align-items: center; z-index: 100; }
.modal-overlay.show { display: flex; }
.modal-content { background: var(--bg-color); width: 85%; max-width: 340px; border-radius: var(--border-radius); padding: 20px; box-shadow: 0 10px 30px rgba(0,0,0,0.2); }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-header h3 { font-size: 16px; font-weight: 600; }
.guest-btn { font-size: 13px; color: var(--text-sub); border: 1px solid #ccc; padding: 2px 8px; border-radius: 10px; cursor: pointer; }
.modal-content input { width: 100%; padding: 10px 12px; margin-bottom: 12px; border: 1px solid #e8e0d5; border-radius: 8px; background: var(--card-bg); font-size: 14px; outline: none; }
.modal-content input:focus { border-color: var(--theme-color); }
.modal-btns { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }
.modal-btns button { padding: 8px 16px; border-radius: 8px; border: none; font-size: 14px; cursor: pointer; }
.btn-cancel { background: #e0e0e0; color: #333; }
.btn-confirm { background: var(--theme-color); color: #fff; }

/* 🚀 调试窗口样式 */
#debugBox {
    position: fixed; bottom: 0; left: 0; right: 0; height: 150px;
    background: rgba(20, 20, 20, 0.95); color: #0f0; font-family: monospace;
    font-size: 12px; padding: 8px; overflow-y: auto; z-index: 9999;
    border-top: 1px solid #333;
}