/* ==========================================
   base.css —— 全局变量、重置、Banner、面板、布局、按钮、图标（桌面端 + 共用）
   ========================================== */

/* ---------- 全局变量（浅色主题） ---------- */
:root {
    --bg-body: #f0f2f5;
    --bg-panel: #ffffff;
    --bg-content: #f7f9fc;
    --bg-card: #ffffff;
    --bg-banner: linear-gradient(135deg, #e8ecf1 0%, #d5dbe3 50%, #cbd2d9 100%);
    --bg-resource-item: #f5f7fa;
    --bg-resource-active: #fff6e5;
    --bg-category-header: #e9edf2;
    --bg-sub-item: #edeff3;
    --bg-btn-disabled: #b0bec5;
    --bg-modal: #1a1a2e;
    --bg-tooltip: #333;

    --text-primary: #2c3e50;
    --text-secondary: #546e7a;
    --text-tertiary: #7f8c8d;
    --text-card-desc: #555;
    --text-cost: #333;
    --text-cost-label: #444;
    --text-on-modal: #eee;
    --text-on-tooltip: #fff;

    --accent-gold: #b8860b;
    --accent-gold-light: rgba(184, 134, 11, 0.3);

    --color-production: #2e7d32;
    --color-consumption: #d35400;
    --color-tech: #7e57c2;
    --color-tech-btn: #5a3f8a;
    --color-success: #4caf50;

    --btn-primary: #2e5a88;
    --btn-primary-hover: #1e3f5f;
    --btn-secondary: #2a9d8f;
    --btn-secondary-hover: #1e7a6e;
    --btn-danger: #d32f2f;
    --btn-danger-hover: #b71c1c;
    --btn-claim: #ffd700;

    --border-panel: #d0d7de;
    --border-card: #e1e4e8;
    --border-active: #b8860b;
    --border-banner-bottom: #b8860b;
    --border-modal: #333;
    --shadow-card: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-btn: 0 2px 5px rgba(0,0,0,0.1);
    --shadow-banner-btn: rgba(0, 0, 0, 0.06);
    --shadow-modal: 0 4px 24px rgba(0, 0, 0, 0.12);
    --shadow-clicker: 0 8px 20px rgba(0,0,0,0.15);

    --radius-sm: 8px;
    --radius-md: 10px;
    --radius-lg: 12px;
    --radius-xl: 20px;
    --radius-btn: 20px;
    --radius-clicker: 80px;
}

/* ---------- 基础重置 ---------- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-text-size-adjust: 100%;
    touch-action: pan-y;
}

/* ---------- 游戏大标题条 ---------- */
#gameBanner {
    width: 100%;
    background: var(--bg-banner);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    border-bottom: 2px solid var(--border-banner-bottom);
    overflow: visible;
}
.banner-title {
    font-size: 2rem;
    font-weight: bold;
    color: var(--accent-gold);
    letter-spacing: 6px;
    text-shadow: 0 0 8px var(--accent-gold-light);
}
.banner-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* 三个按钮统一尺寸 */
.banner-actions button {
    background: var(--shadow-banner-btn);
    border: 1px solid #a0aab5;
    color: var(--text-primary);
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.1s;
    padding: 0;
    line-height: 1;
}
.banner-actions button:active {
    transform: scale(0.92);
    background: rgba(0, 0, 0, 0.12);
}

/* 按钮内图标统一：24x24 容器，contain 等比缩放 */
.banner-actions button img {
    display: block;
    width: 24px;
    height: 24px;
    object-fit: contain;
}

/* 语言按钮需要相对定位，下拉菜单才能正确定位 */
#langBtn {
    position: relative;
}

/* ---------- 主容器 ---------- */
#mainContainer {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ---------- 左侧资源面板 ---------- */
#resourcePanel {
    width: 320px;
    background: var(--bg-panel);
    border-right: 1px solid var(--border-panel);
    padding: 10px;
    overflow-y: auto;
    flex-shrink: 0;
}

.panel-category { margin-top: 4px; }

.category-header {
    font-weight: bold;
    font-size: 0.95rem;
    padding: 8px 12px;
    background: #f5f7fa;
    border-radius: var(--radius-sm);
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-primary);
    margin-bottom: 6px;
    transition: background 0.2s;
}
.category-header:hover {
    background: #dde3ea;
}

.category-items {
    padding-left: 4px;
    margin-top: 0;
}

/* ===== 统一的资源标签 ===== */
.resource-item {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    min-height: 24px;
    margin-bottom: 4px;
    padding: 2px 12px;
    background: var(--bg-resource-item);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
    color: var(--text-primary);
    box-sizing: border-box;
}

.resource-item:hover {
    border-color: rgba(100, 180, 255, 0.6);
    box-shadow: 0 0 6px rgba(100, 180, 255, 0.3);
    background: #f0f4fc;
}

.resource-item.sub-item:hover {
    border-color: rgba(100, 180, 255, 0.6);
    box-shadow: 0 0 6px rgba(100, 180, 255, 0.3);
    background: #f0f4fc;
}

.resource-item.active {
    border-color: var(--border-active);
    background: var(--bg-resource-active);
    box-shadow: 0 0 8px rgba(184, 134, 11, 0.3);
}

.resource-item .res-name {
    font-weight: bold;
    font-size: 0.95rem;
    line-height: 1.3;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.resource-item .res-stats {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 0;
    font-size: 0.8rem;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.res-per-sec {
    color: var(--color-production);
}

.resource-item.sub-item {
    background: #f5f7fa;
    border: 2px solid transparent;
}
.resource-item.sub-item.active {
    background: var(--bg-resource-active);
    border-color: var(--border-active);
}

.rebirth-item .res-name {
    color: #8a6bb0;
}
.rebirth-item:hover {
    border-color: rgba(138, 107, 176, 0.6);
    box-shadow: 0 0 6px rgba(138, 107, 176, 0.3);
}

/* ---------- 内容区域 ---------- */
#contentArea {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--bg-content);
}

#clickerZone { text-align: center; margin-bottom: 25px; }
#clickBtn {
    background: radial-gradient(circle at 30% 30%, #ffe082, #d4a017);
    border: none;
    border-radius: var(--radius-clicker);
    padding: 20px 40px;
    font-size: 1.8rem;
    font-weight: bold;
    color: #1e272e;
    cursor: pointer;
    box-shadow: var(--shadow-clicker);
    transition: transform 0.1s;
    touch-action: manipulation;
    width: 260px;
    max-width: 90vw;
}
#clickBtn:active { transform: scale(0.93); }
#clickHint {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    margin-top: 6px;
}

#buildingsContainer { width: 100%; max-width: 600px; }
#selectedResourceName {
    margin-bottom: 15px;
    font-size: 1.3rem;
    text-align: center;
    color: var(--text-primary);
}

/* ---------- 通用按钮 ---------- */
.btn {
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius-btn);
    font-weight: bold;
    font-size: 0.9rem;
    cursor: pointer;
    color: white;
    transition: background 0.2s, transform 0.1s;
    box-shadow: var(--shadow-btn);
    white-space: nowrap;
}
.btn:active { transform: scale(0.95); }
.btn:disabled {
    background: var(--bg-btn-disabled) !important;
    color: #eceff1;
    cursor: not-allowed;
    box-shadow: none;
}
.btn-primary { background: var(--btn-primary); }
.btn-primary:hover:not(:disabled) { background: var(--btn-primary-hover); }
.btn-secondary { background: var(--btn-secondary); }
.btn-secondary:hover:not(:disabled) { background: var(--btn-secondary-hover); }
.btn-danger { background: var(--btn-danger); }
.btn-danger:hover:not(:disabled) { background: var(--btn-danger-hover); }

/* ---------- 通用图标 ---------- */
.res-icon, .cat-icon, .title-icon {
    width: 1.2em;
    height: 1.2em;
    vertical-align: middle;
    margin-right: 0.2em;
}
.cost-icon, .io-icon { vertical-align: middle; margin-right: 2px; }

/* ===== 暗物质按钮：统一尺寸 + 横向排列 ===== */
#dmShopSideBtn {
    min-height: 24px;
    padding: 2px 12px;
    flex-direction: row !important;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

#dmShopSideBtn .res-stats {
    margin-top: 0;
    width: auto;
    flex-shrink: 0;
}

/* ==========================================
   语言切换下拉菜单
   ========================================== */
.lang-dropdown {
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 4px;
    background: #222;
    border: 1px solid #555;
    border-radius: 6px;
    padding: 4px 0;
    z-index: 1000;
    min-width: 110px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    display: none;
}

.lang-option {
    padding: 8px 14px;
    cursor: pointer;
    color: #ddd;
    font-size: 0.95em;
    white-space: nowrap;
    transition: background 0.15s;
}

.lang-option:hover {
    background: #444;
    color: #fff;
}

/* ==========================================
   深空侦察燃料区（新增样式）
   ========================================== */
.fuel-info-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 8px 0;
}

.fuel-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.fuel-label {
    font-size: 0.9rem;
    color: var(--text-primary);
}

.fuel-bar {
    display: flex;
    gap: 4px;
}

.fuel-segment {
    width: 24px;
    height: 12px;
    border-radius: 3px;
    background: rgba(128, 128, 128, 0.25);
    transition: background 0.3s, box-shadow 0.3s;
}

.fuel-segment.filled {
    background: linear-gradient(180deg, #ffd700 0%, #b8860b 100%);
    box-shadow: 0 0 6px rgba(255, 215, 0, 0.7);
}

/* ★ 修改：移除 partial 的固定背景，完全交给 JS 内联渐变 */
.fuel-segment.partial {
    /* 之前这行 background: ... !important 会覆盖掉内联样式，导致半格效果永远不显示 */
    box-shadow: none;
}

.fuel-recovery-hint {
    font-size: 12px;
    color: #aaa;
    white-space: nowrap;
}

/* 燃料操作按钮容器 */
.fuel-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    row-gap: 2px;            /* 竖屏换行时两排间距 */
    margin-top: 4px;
}

.fuel-actions .btn {
    flex: 1 1 auto;
    min-width: 80px;
    height: 36px;            /* 统一高度 */
    padding: 0 8px;
    text-align: center;
    white-space: nowrap;
}