:root {
--bg-dark: #121417; --sidebar-bg: #000; --card-bg: #1e2126;
--primary: #007bff; --gold: #f1c40f; --text: #e9ecef; --border: #343a40;
--danger: #dc3545; --success: #28a745;
--sidebar-width: 240px;
--sidebar-collapsed-width: 60px;
}
/* Homepage update link stays below navigation overlays and dialogs. */
.updates-shortcut { position: fixed; right: calc(18px + env(safe-area-inset-right, 0px)); bottom: calc(18px + env(safe-area-inset-bottom, 0px)); z-index: 40; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 15px; box-sizing: border-box; border: 1px solid var(--border); border-radius: 12px; background: var(--card-bg); color: var(--text); box-shadow: 0 4px 18px #0002; text-decoration: none; font-size: 12px; font-weight: 600; transition: border-color .2s, color .2s; }
.updates-shortcut:hover { border-color: var(--primary); color: var(--primary); }
.updates-shortcut:focus-visible { outline: 2px solid var(--primary); outline-offset: 4px; }
.updates-shortcut-icon { display: flex; }
.updates-shortcut-dot { position: absolute; top: -3px; right: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); border: 2px solid var(--card-bg); }
.updates-shortcut-dot[hidden], .updates-shortcut-status[hidden] { display: none; }
.updates-shortcut-status { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 600px) {
    .updates-shortcut { width: 42px; padding: 0; border-radius: 50%; }
    .updates-shortcut-label { display: none; }
}
.sidebar-setup-row { display: flex; align-items: stretch; }
.sidebar-setup-row > .sidebar-item { flex: 1; min-width: 0; }
.sidebar-setup-toggle { border: none; background: transparent; color: #999; width: 30px; flex-shrink: 0; cursor: pointer; }
.sidebar-setup-toggle:hover { color: var(--text); background: #ffffff0a; }
.sidebar-setup-children[hidden], .sidebar.collapsed .sidebar-setup-toggle { display: none; }
body { font-family: system-ui, sans-serif; margin: 0; display: flex; height: 100vh; background: var(--bg-dark); color: var(--text); overflow: hidden; }

/* --- 侧边栏与主布局 --- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    flex-shrink: 0;
    height: 100vh;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    position: fixed; /* 改为固定定位，使其可以覆盖在内容上方 */
    left: 0;
    top: 0;
    z-index: 1000;   /* 确保悬浮在所有图表和卡片之上 */
    transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s ease;
    /* 展开悬浮时加上柔和投影，覆盖感更强 */
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.5);
}

/* 默认收起形态 (60px 宽度) */
.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
    box-shadow: none; /* 收起时不需要大阴影 */
}

.sidebar-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 15px;
border-bottom: 1px solid var(--border);
height: 60px;
box-sizing: border-box;
}

.sidebar-brand {
color: var(--primary);
font-size: 1.2rem;
font-weight: bold;
text-decoration: none;
white-space: nowrap;
overflow: hidden;
transition: opacity 0.2s;
}

.sidebar.collapsed .sidebar-brand {
opacity: 0;
pointer-events: none;
width: 0;
}

.sidebar-toggle-btn {
background: transparent;
border: none;
color: #888;
cursor: pointer;
font-size: 1.2rem;
padding: 5px;
border-radius: 4px;
transition: 0.2s;
display: flex;
align-items: center;
justify-content: center;
}

.sidebar-toggle-btn:hover {
background: rgba(255,255,255,0.1);
color: #fff;
}

#games-container {
flex: 1;
overflow-y: auto;
overflow-x: hidden;
padding: 10px 10px 0 10px;
}
.sidebar.collapsed #games-container {
padding: 10px 5px 0 5px;
}

.sidebar-bottom-nav {
padding: 10px;
border-top: 1px solid var(--border);
background: var(--sidebar-bg);
}

.sidebar-group { color: #555; font-size: 0.8rem; font-weight: bold; padding: 15px 10px 5px; text-transform: uppercase; }

.sidebar-item {
display: flex;
align-items: center;
padding: 10px 12px;
color: #888;
text-decoration: none;
border-radius: 6px;
margin-bottom: 4px;
transition: 0.2s;
white-space: nowrap;
overflow: hidden;
position: relative;
}

.sidebar-item-icon {
min-width: 24px;
display: flex;
justify-content: center;
align-items: center;
margin-right: 10px;
font-size: 1.1em;
}

.sidebar.collapsed .sidebar-item-icon {
margin-right: 0;
}

.sidebar-item-text {
transition: opacity 0.2s;
}

.sidebar.collapsed .sidebar-item-text {
opacity: 0;
width: 0;
}

.sidebar-item:hover { background: rgba(255,255,255,0.05); color: #fff; }
.sidebar-item.active { background: rgba(0, 123, 255, 0.1); color: var(--primary); font-weight: bold;}
.sidebar-item.active::before {
content: '';
position: absolute;
left: 0;
top: 50%;
transform: translateY(-50%);
height: 60%;
width: 3px;
background-color: var(--primary);
border-radius: 0 3px 3px 0;
}

/* ==========================================
   侧边栏展开时的全屏变灰遮罩
   ========================================== */
.sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.55); /* 遮罩暗化背景 */
    backdrop-filter: blur(2px);       /* 轻微毛玻璃模糊，质感更高级 */
    -webkit-backdrop-filter: blur(2px);
    z-index: 999;                    /* 刚好在侧栏(z-index: 1000)下方，页面内容上方 */
    opacity: 0;
    pointer-events: none;            /* 收起时不可点击穿透 */
    transition: opacity 0.25s ease;
}

/* 激活状态：当遮罩可见时 */
.sidebar-backdrop.active {
    opacity: 1;
    pointer-events: auto;            /* 展开时捕获点击，用于点空白收回 */
}

/* 亮色主题适配 */
[data-theme="light"] .sidebar-backdrop {
    background: rgba(0, 0, 0, 0.35);
}


.main-content {
    flex: 1;
    margin-left: var(--sidebar-collapsed-width);
    padding: 30px 40px;
    overflow-y: auto;
    overflow-x: auto; /* 确保改为 auto，允许右边抽数条溢出时横向拖动查看 */
    height: 100vh;
    box-sizing: border-box;
}

/* 亮色模式下的展开投影 */
[data-theme="light"] .sidebar {
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.1);
}
[data-theme="light"] .sidebar.collapsed {
    box-shadow: none;
}

/* ==========================================
侧边栏：折叠与长按拖拽排序功能
========================================== */
.sidebar-group-wrapper {
margin-bottom: 10px;
border-bottom: 1px solid rgba(255,255,255,0.05);
padding-bottom: 5px;
transition: opacity 0.2s;
}

.sidebar-group-wrapper:last-child {
border-bottom: none;
}

.sidebar-group-header {
color: var(--text);
font-size: 13px;
font-weight: bold;
padding: 10px 12px;
cursor: grab;
display: flex;
justify-content: space-between;
align-items: center;
user-select: none;
border-radius: 6px;
-webkit-touch-callout: none;
white-space: nowrap;
overflow: hidden;
margin-bottom: 4px;
}

.sidebar-group-header:hover {
background: rgba(255,255,255,0.05);
}

.sidebar-group-header:active {
cursor: grabbing;
background: rgba(255, 255, 255, 0.08);
}

.sidebar.collapsed .sidebar-group-header {
justify-content: center;
padding: 10px 5px;
}

.sidebar.collapsed .sidebar-group-header-text,
.sidebar.collapsed .toggle-icon {
display: none;
}

/* Inset highlights do not change row height or move the pointer's halfway boundary. */
.sidebar :is(.sidebar-group-wrapper,.sidebar-item[data-pool-id]).drag-over-top {
    box-shadow: inset 0 5px 0 var(--primary), inset 0 0 0 1px var(--art-accent-line,var(--border)) !important;
    background: var(--art-accent-soft,rgba(241,196,15,.1)) !important;
    border-radius: 7px;
}
.sidebar :is(.sidebar-group-wrapper,.sidebar-item[data-pool-id]).drag-over-bottom {
    box-shadow: inset 0 -5px 0 var(--primary), inset 0 0 0 1px var(--art-accent-line,var(--border)) !important;
    background: var(--art-accent-soft,rgba(241,196,15,.1)) !important;
    border-radius: 7px;
}

.toggle-icon {
font-size: 12px;
color: #888;
transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
cursor: pointer;
padding: 0 5px;
}

.toggle-icon.collapsed {
transform: rotate(-90deg);
}

.sidebar-pool-list {
overflow: hidden;
max-height: 1500px;
transition: max-height 0.3s ease, opacity 0.2s ease, padding 0.3s ease;
opacity: 1;
}

/* 外壳收起时隐藏卡池，但不覆盖各游戏自己的展开状态。 */
.sidebar.collapsed .sidebar-pool-list,
.sidebar-pool-list.collapsed {
max-height: 0;
opacity: 0;
pointer-events: none;
padding-top: 0;
padding-bottom: 0;
}

/* 缩起状态下鼠标悬停显示 tooltip */
.sidebar.collapsed .sidebar-item[title],
.sidebar.collapsed .sidebar-group-header[title] {
position: relative;
}

.sidebar.collapsed .sidebar-item:hover::after,
.sidebar.collapsed .sidebar-group-header:hover::after {
content: attr(title);
position: absolute;
left: 100%;
top: 50%;
transform: translateY(-50%);
background: #333;
color: #fff;
padding: 6px 10px;
border-radius: 4px;
font-size: 12px;
white-space: nowrap;
z-index: 1000;
margin-left: 10px;
box-shadow: 0 2px 8px rgba(0,0,0,0.5);
pointer-events: none;
}

.sidebar.collapsed .sidebar-item:hover::before,
.sidebar.collapsed .sidebar-group-header:hover::before {
content: '';
position: absolute;
left: 100%;
top: 50%;
transform: translateY(-50%);
border-width: 5px;
border-style: solid;
border-color: transparent #333 transparent transparent;
margin-left: 0;
z-index: 1000;
pointer-events: none;
}

/* --- 概览卡片 --- */
.stats-header {
display: flex;
gap: 20px;
margin-bottom: 30px;
flex-wrap: wrap; /* 允许换行 */
justify-content: center; /* 居中对齐 */
max-width: 800px; /* 限制最大宽度，防止在大屏幕上散开 */
margin: 0 auto 30px auto; /* 居中整个面板容器，并保持底部边距 */
}
.stat-box {
flex: 1 1 auto; /* 允许伸缩，基础宽度为 140px */
min-width: 140px;
background: var(--card-bg);
padding: 20px;
border-radius: 8px;
border: 1px solid var(--border);
text-align: center;
}
.stat-value { font-size: 1.8rem; font-weight: bold; color: var(--gold); margin-top: 10px; }

/* 🌟 新增：抽卡看板专属的居中包裹器 */
.dashboard-center-wrapper {
max-width: 800px; /* 限制一个最大宽度，使其像一个整体 */
margin: 0 auto;   /* 居中 */
display: flex;
flex-direction: column;
align-items: center; /* 内部元素（统计卡片和列表）也居中对齐 */
}

/* 覆盖 .stats-header 在包裹器内的样式，让四个框居中并拢 */
.dashboard-center-wrapper .stats-header {
justify-content: center;
width: 100%;
}

/* 覆盖 #list-wrap 的样式，使其内部条形图对齐 */
.dashboard-center-wrapper #list-wrap {
width: 100%;
align-items: flex-start; /* 条形图本身还是左对齐，但整体容器居中了 */
}

/* --- 基础按钮与统一输入框 --- */
.btn { padding: 8px 16px; border: none; border-radius: 4px; cursor: pointer; color: white; transition: 0.2s; font-size: 14px; }
.btn-primary { background: var(--primary); }
.btn-primary:hover { background: #0056b3; }

.input-box {
background: rgba(0,0,0,0.2);
border: 1px solid var(--border);
color: var(--text);
padding: 8px 12px;
border-radius: 6px;
outline: none;
transition: 0.2s;
box-sizing: border-box;
}
.input-box:focus { border-color: var(--primary); }
.input-box::placeholder { color: #666; }

/* --- 弹窗与角色方块 --- */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.7); display: flex; justify-content: center; align-items: center; z-index: 1000; }
.modal-content { background: var(--card-bg); padding: 25px; border-radius: 10px; width: 90%; max-width: 800px; border: 1px solid var(--border); box-shadow: 0 10px 30px rgba(0,0,0,0.5); }
.box { width: 40px; height: 40px; background: #333; display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 6px; cursor: pointer; user-select: none; font-weight: bold; font-size: 16px; position: relative; border: 2px solid transparent; transition: all 0.2s; }
.box:hover { border-color: #666; transform: translateY(-2px); }
.box.s4 { background: #6c5ce7; color: #fff; }
.box.s5 { background: var(--gold); color: #000; box-shadow: 0 0 10px rgba(243, 156, 18, 0.5); }
.box-add-more { width: 40px; height: 40px; border: 2px dashed #555; border-radius: 6px; display: flex; align-items: center; justify-content: center; cursor: pointer; color: #888; transition: 0.2s; }
.box-add-more:hover { border-color: #aaa; color: #fff; }
.char-tag {
font-size: 10px;
line-height: 1.1;
margin-top: 2px;
text-align: center;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
width: 100%;
padding: 0 2px;
transform: scale(0.9);
}

.box { position: relative; overflow: hidden; }

.box-pull-num {
display: none;
position: absolute;
top: 2px;
left: 3px;
font-size: 11px;
font-family: monospace;
font-weight: bold;
color: #000;
background: rgba(255, 255, 255, 0.9);
padding: 0 3px;
border-radius: 3px;
z-index: 5;
}

.box.s5 .box-pull-num {
display: block;
}

/* --- 主页数据进度条 --- */
#list-wrap { display: flex; flex-direction: column; gap: 12px; padding: 10px 0; }
.char-row { display: flex; align-items: center; gap: 15px; animation: fadeIn 0.3s ease; }
.char-icon { width: 45px; height: 45px; border: 2px solid #555; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: bold; background: #222; text-align: center; overflow: hidden; }
.char-bar { height: 28px; border-radius: 4px; display: flex; align-items: center; padding: 0 10px; font-size: 12px; font-weight: bold; color: #fff; text-shadow: 1px 1px 2px rgba(0,0,0,0.3); }

/* 滚动条 */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #444; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #555; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* =========================================
✨ 模拟器与弹窗统一分离组件
========================================= */
.sim-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 10px; margin-bottom: 15px; }
.sim-cb-label { display: flex; align-items: center; gap: 5px; font-size: 13px; background: #2c3038; padding: 6px 10px; border-radius: 6px; cursor: pointer; border: 1px solid #444; color: #eee; transition: 0.2s; }
.sim-cb-label:hover { border-color: var(--primary); background: #3a3f4a; }
.sim-pull-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; background: rgba(0,0,0,0.2); padding: 10px; border-radius: 8px; align-items: center; }

.sim-item { width: 55px; height: 55px; border-radius: 6px; display: flex; font-size: 13px; font-weight: bold; text-align: center; line-height: 1.1; padding: 2px; position: relative; flex-direction: column; justify-content: flex-end; padding-bottom: 6px; }
.sim-item-5 { background: linear-gradient(135deg, #f39c12, #e67e22); color: #fff; box-shadow: 0 0 10px rgba(243, 156, 18, 0.6); border: 2px solid #fff; }
.sim-item-4 { background: linear-gradient(135deg, #9b59b6, #8e44ad); color: #fff; }
.sim-item-3 { background: #34495e; color: #95a5a6; font-weight: normal; }

#sim-results {
padding-left: 75px !important;
display: flex;
flex-direction: column;
gap: 10px;
}

.btn-action-gray { background: #444; color: #fff; border: 1px solid #555; }
.btn-action-gray:hover { background: #555; }
.btn-sim-open { background: #8e44ad; color: white; border: 1px solid #9b59b6; font-weight: bold; margin-right: 10px; }
.btn-sim-open:hover { background: #9b59b6; }
.btn-blue { background: #2980b9; color: #fff; }
.btn-blue:hover { background: #3498db; }
.btn-green { background: #27ae60; color: #fff; }
.btn-green:hover { background: #2ecc71; }
.btn-orange { background: #e67e22; color: #fff; }
.btn-orange:hover { background: #f39c12; }
.btn-red { background: #c0392b; color: #fff; }
.btn-red:hover { background: #e74c3c; }
.btn-nav-gold { background: #d35400; color: white; flex: 1; }
.btn-nav-gold:hover { background: #e67e22; }

.picker-item { padding: 6px 2px; background: #3d414a; text-align: center; border-radius: 4px; font-size: 12px; cursor: pointer; color: #ddd; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border: 1px solid transparent; }
.picker-item:hover { background: #4b515d; color: #fff; border-color: #666; }
.char-picker {
position: absolute;
background: #1e2126;
border: 1px solid #444;
border-radius: 10px;
padding: 12px;
z-index: 9999;
box-shadow: 0 8px 25px rgba(0,0,0,0.5);
display: none;
}

.sim-panel-dark { background: #222; border: 1px solid #333; }
.sim-stats-panel { background: #1a1c20; border: 1px solid #333; }
.sim-history-panel { background: #111; border: 1px inset #222; }


/* =========================================
☀️ 亮色模式 (Light Mode) 降维打击式覆盖
========================================= */
[data-theme="light"] {
--bg-dark: #f3f4f6 !important;
--sidebar-bg: #ffffff !important;
--card-bg: #ffffff !important;
--primary: #0ea5e9 !important;
--text: #1f2937 !important;
--border: #e5e7eb !important;
}

[data-theme="light"] body { background: var(--bg-dark); color: var(--text); }
[data-theme="light"] h1, [data-theme="light"] h2, [data-theme="light"] h3, [data-theme="light"] h4, [data-theme="light"] h5 { color: #111827 !important; }

[data-theme="light"] .sidebar { background: var(--sidebar-bg); border-right: 1px solid var(--border); box-shadow: 1px 0 10px rgba(0,0,0,0.02); }
[data-theme="light"] .sidebar-bottom-nav { background: var(--sidebar-bg) !important; }
[data-theme="light"] .sidebar-item { color: #4b5563 !important; }
[data-theme="light"] .sidebar-item:hover { background: #f3f4f6 !important; color: #111827 !important; }
[data-theme="light"] .sidebar-item.active { background: #e0f2fe !important; color: var(--primary) !important; }
[data-theme="light"] .sidebar-group-header { color: #111827 !important; }
[data-theme="light"] .sidebar-group-header:hover { background: #f3f4f6 !important; }
[data-theme="light"] .sidebar-toggle-btn { color: #6b7280 !important; }
[data-theme="light"] .sidebar-toggle-btn:hover { background: #f3f4f6 !important; color: #111827 !important; }

[data-theme="light"] .sidebar.collapsed .sidebar-item:hover::after,
[data-theme="light"] .sidebar.collapsed .sidebar-group-header:hover::after {
background: #ffffff !important;
color: #111827 !important;
border: 1px solid #e5e7eb;
box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
}

[data-theme="light"] .sidebar.collapsed .sidebar-item:hover::before,
[data-theme="light"] .sidebar.collapsed .sidebar-group-header:hover::before {
border-color: transparent #ffffff transparent transparent !important;
}

[data-theme="light"] .stat-box { background: var(--card-bg) !important; border: 1px solid var(--border) !important; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05); }
[data-theme="light"] .modal-content { background: var(--card-bg) !important; border: 1px solid var(--border) !important; box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1); }

[data-theme="light"] #edit-body,
[data-theme="light"] .sim-history-panel,
[data-theme="light"] .sim-panel-dark,
[data-theme="light"] .sim-stats-panel,
[data-theme="light"] .char-picker {
background: #ffffff !important;
border: 1px solid #e5e7eb !important;
box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05) !important;
}
[data-theme="light"] #edit-body, [data-theme="light"] .sim-history-panel { background: #f9fafb !important; box-shadow: inset 0 2px 4px 0 rgba(0,0,0,0.02) !important; }

[data-theme="light"] .btn-action-gray {
background: #e5e7eb !important; color: #374151 !important; border: 1px solid #d1d5db !important; font-weight: 500 !important; text-shadow: none !important;
}
[data-theme="light"] .btn-action-gray:hover { background: #d1d5db !important; }
[data-theme="light"] .box-add-more { border-color: #d1d5db !important; color: #9ca3af !important; }
[data-theme="light"] .box-add-more:hover { border-color: var(--primary) !important; color: var(--primary) !important; }

[data-theme="light"] .input-box,
[data-theme="light"] select,
[data-theme="light"] .picker-item,
[data-theme="light"] .sim-cb-label {
background: #ffffff !important; color: #111827 !important; border: 1px solid #d1d5db !important; box-shadow: 0 1px 2px 0 rgba(0,0,0,0.02) !important;
}
[data-theme="light"] .sim-cb-label:hover, [data-theme="light"] .picker-item:hover { border-color: var(--primary) !important; background: #f0f9ff !important; color: var(--primary) !important; }
[data-theme="light"] .input-box::placeholder { color: #9ca3af !important; }
[data-theme="light"] .input-box:focus { border-color: var(--primary) !important; }
[data-theme="light"] .box:hover { border-color: #9ca3af !important; }

[data-theme="light"] .box.s4 { background: #8b5cf6 !important; color: #fff !important; border-color: #8b5cf6 !important; }
[data-theme="light"] .box.s5 { background: #f59e0b !important; color: #fff !important; border-color: #f59e0b !important; }
[data-theme="light"] .char-icon { background: #fff !important; color: #333 !important; border-color: #d1d5db !important; }

[data-theme="light"] .sim-pull-row { background: #ffffff !important; border: 1px solid #e5e7eb !important; box-shadow: 0 1px 2px rgba(0,0,0,0.05) !important; }
[data-theme="light"] .sim-item-3 { background: #f3f4f6 !important; color: #6b7280 !important; border: 1px solid #e5e7eb !important; }

[data-theme="light"] div[style*="border-top"], [data-theme="light"] div[style*="border-bottom"], [data-theme="light"] div[style*="border-right"] { border-color: #e5e7eb !important; }

[data-theme="light"] .input-box option,
[data-theme="light"] .input-box optgroup {
background-color: #ffffff !important;
color: #111827 !important;
}

.sim-item .pull-num {
display: none;
position: absolute;
top: 2px;
left: 4px;
font-size: 10px;
color: #fff;
background: rgba(0,0,0,0.5);
padding: 0 3px;
border-radius: 3px;
z-index: 5;
}

.sim-item-5 .pull-num {
display: block !important;
background: rgba(255,255,255,0.9);
color: #000;
font-weight: bold;
}

/* --- 模拟器福袋显示补丁 --- */
.sim-pull-row {
position: relative !important;
overflow: visible !important;
width: 100% !important;
min-height: 65px;
box-sizing: border-box;
}

.spark-gift-card {
position: absolute !important;
left: -70px;
top: 50%;
transform: translateY(-50%) scale(0.9);
width: 55px;
height: 55px;
border: 2px solid #f1c40f;
border-radius: 8px;
background: #000;
box-shadow: 0 0 15px rgba(241, 196, 15, 0.7);
z-index: 9999;
overflow: hidden;
display: flex;
flex-direction: column;
justify-content: flex-end;
animation: giftPopIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes giftPopIn {
0% { transform: translateY(-50%) scale(0); opacity: 0; }
100% { transform: translateY(-50%) scale(0.9); opacity: 1; }
}

/* =========================================
✨ 亮色模式深度修复补丁
========================================= */
[data-theme="light"] .box {
border: 1px solid rgba(0,0,0,0.15) !important;
box-shadow: 0 2px 4px rgba(0,0,0,0.05) !important;
}

[data-theme="light"] .char-card {
background: #ffffff !important;
border-color: #d1d5db !important;
}
[data-theme="light"] .char-info {
background: linear-gradient(to top, rgba(255,255,255,0.95) 20%, rgba(255,255,255,0)) !important;
color: #111827 !important;
text-shadow: none !important;
}
[data-theme="light"] .char-star {
text-shadow: 1px 1px 0px rgba(255,255,255,0.8), 0 0 3px rgba(255,255,255,0.8) !important;
}
[data-theme="light"] .add-btn-card {
background: #f9fafb !important;
border-color: #d1d5db !important;
color: #6b7280 !important;
}
[data-theme="light"] .add-btn-card:hover {
background: #eff6ff !important;
border-color: var(--primary) !important;
color: var(--primary) !important;
}

[data-theme="light"] .char-select-card {
background: #ffffff !important;
border-color: #d1d5db !important;
}
[data-theme="light"] .char-select-name {
background: #f3f4f6 !important;
color: #374151 !important;
border-top: 1px solid #e5e7eb !important;
}
[data-theme="light"] .char-select-card.selected .char-select-name {
background: #eff6ff !important;
color: var(--primary) !important;
}
[data-theme="light"] .char-select-fallback {
background: #f3f4f6 !important;
color: #6b7280 !important;
}

[data-theme="light"] #sim-result-container {
background: #f9fafb !important;
border: 1px solid #e5e7eb !important;
box-shadow: inset 0 2px 4px rgba(0,0,0,0.02) !important;
}

[data-theme="light"] .sim-item div[style*="linear-gradient"] {
background: linear-gradient(to top, rgba(255,255,255,0.95) 15%, rgba(255,255,255,0)) !important;
}
[data-theme="light"] .sim-item div[style*="text-shadow"] {
color: #111827 !important;
text-shadow: none !important;
}
[data-theme="light"] .sim-item .pull-num {
color: #111827 !important;
background: #ffffff !important;
border: 1px solid #d1d5db !important;
}

[data-theme="light"] .soft-rule-row span,
[data-theme="light"] .minor-pity-row span,
[data-theme="light"] .spark-rule-row span,
[data-theme="light"] .gift-rule-row span,
[data-theme="light"] .rule-row span {
color: #111827 !important;
font-weight: 600 !important;
}

[data-theme="light"] .pool-section .hint-text,
[data-theme="light"] .setup-card .hint-text {
color: #4b5563 !important;
}

[data-theme="light"] p[style*="color: #888"],
[data-theme="light"] p[style*="color:#888"],
[data-theme="light"] p[style*="color: #aaa"],
[data-theme="light"] p[style*="color:#aaa"],
[data-theme="light"] div[style*="color: #888"],
[data-theme="light"] div[style*="color:#888"],
[data-theme="light"] div[style*="color: #aaa"],
[data-theme="light"] div[style*="color:#aaa"],
[data-theme="light"] span[style*="color: #888"],
[data-theme="light"] span[style*="color:#888"] {
color: #4b5563 !important;
}


/* 快捷设定气泡：不添加蒙层，不遮暗或虚化背景。 */
.quick-settings-popover { position:fixed; z-index:10002; box-sizing:border-box; width:340px; max-width:calc(100vw - 24px); max-height:calc(100dvh - 24px); overflow:auto; padding:18px; background:var(--card-bg,#252525); color:var(--text,#eee); border:1px solid var(--border,#555); border-radius:14px; box-shadow:0 10px 32px #0004; }
.quick-settings-header { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.quick-settings-header button { background:transparent; color:inherit; border:0; font-size:26px; cursor:pointer; padding:0 6px; }
.quick-settings-hint { font-size:12px; line-height:1.6; color:var(--text-muted,#888); margin:8px 0; }
.quick-settings-field { display:grid; gap:7px; margin:15px 0; font-size:14px; }
.quick-settings-field select { width:100%; }
.quick-settings-toggle { display:flex; gap:10px; align-items:center; margin:12px 0; text-align:left; line-height:1.6; }
.quick-settings-preferences { margin-bottom:25px; }
.quick-settings-home .quick-settings-header { color:var(--primary); border-bottom:1px dashed var(--border); padding-bottom:12px; margin-bottom:16px; font-size:1.15rem; }
.quick-settings-account-notice { padding:20px; border:1px solid var(--border); border-radius:8px; background:rgba(0,0,0,.15); color:var(--text-muted,#888); font-size:14px; line-height:1.7; }
.quick-settings-account-actions { width:fit-content; padding:14px 10px; margin-top:4px; border:1px solid var(--border); border-radius:8px; background:rgba(0,0,0,.15); }
.quick-settings-account-actions .btn { margin:0; }
.quick-settings-popover [role="status"]:empty { display:none; }
[data-theme="light"] .quick-settings-account-notice,
[data-theme="light"] .quick-settings-account-actions { background:#f9fafb; color:#4b5563; }

.settings-language-highlight { outline:2px solid var(--primary,#007bff); outline-offset:8px; border-radius:6px; box-shadow:0 0 0 8px rgba(0,123,255,.1); }
.settings-language-guide { color:var(--primary,#007bff); font-size:13px; line-height:1.6; margin:10px 0 0; }

.start-page-summary { display:flex; flex-direction:column; gap:6px; text-align:left; width:100%; cursor:pointer; white-space:normal; overflow-wrap:anywhere; }
.start-page-overlay { position:fixed; inset:0; z-index:100020; background:#0008; display:flex; align-items:center; justify-content:center; padding:20px; box-sizing:border-box; }
.start-page-dialog { width:720px; max-width:100%; max-height:85dvh; display:flex; flex-direction:column; padding:22px; border:1px solid var(--border); border-radius:14px; background:var(--card-bg); color:var(--text); box-sizing:border-box; }
.start-page-dialog h2 { font-size:20px; margin:0 0 14px; }
.start-page-options { overflow:auto; display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,260px),1fr)); gap:16px; padding:4px; }
.start-page-options fieldset { border:1px solid var(--border); border-radius:8px; padding:12px; min-width:0; margin:0; }
.start-page-options legend { padding:0 6px; color:var(--primary); font-weight:bold; overflow-wrap:anywhere; }
.start-page-option { display:flex; align-items:flex-start; gap:10px; padding:10px 6px; line-height:1.5; cursor:pointer; border-radius:6px; overflow-wrap:anywhere; }
.start-page-option:has(input:checked) { background:rgba(0,123,255,.15); }
.start-page-option input { margin-top:5px; flex-shrink:0; }
.start-page-actions { display:flex; justify-content:flex-end; gap:10px; padding-top:18px; }

/* Shared image and Emoji icon slots. */
.inline-icon-image { display: inline-block; width: 1.25em; height: 1.25em; object-fit: contain; vertical-align: middle; flex-shrink: 0; border-radius: 4px; }
.sidebar-item-icon .inline-icon-image { width: 24px; height: 24px; }
#btn-game-icon .inline-icon-image { width: 32px; height: 32px; }
.panel-defaults-button { width: 100%; min-height: 38px; margin: 0 0 20px; white-space: normal; }
.quick-settings-popover > .panel-defaults-button { display: block; margin: 14px 0 4px; }
.panel-defaults-dialog { width: min(600px, calc(100vw - 32px)); max-height: calc(100dvh - 40px); box-sizing: border-box; padding: 24px; overflow-x: hidden; overflow-y: auto; border: 1px solid var(--border, #444); border-radius: 14px; background: var(--card-bg, #1e2126); color: var(--text, #eee); box-shadow: 0 24px 80px #0008; }
.panel-defaults-dialog::backdrop { background: #0009; backdrop-filter: blur(4px); }
.panel-defaults-dialog h2 { margin: 0 0 8px; color: var(--primary); font-size: 20px; }
.panel-defaults-page { margin: 0 0 22px; color: var(--text-muted, #999); font-size: 14px; }
.panel-defaults-fields { display: grid; gap: 16px; }
.panel-default-setting { display: grid; grid-template-columns: minmax(0, 1fr) 170px; min-width: 0; align-items: center; gap: 16px; font-size: 13px; line-height: 1.6; }
.panel-default-setting > span { min-width: 0; overflow-wrap: anywhere; }
.panel-default-setting[hidden] { display: none; }
/* 隐藏的原生 select 必须保留 0px 宽度，避免绝对定位控件撑出弹窗。 */
.panel-default-setting select:not(.custom-select-original), .panel-default-setting > .custom-select-ui { width: 100% !important; min-width: 0; }
.panel-defaults-footer { display: flex; justify-content: flex-end; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border, #444); }
.panel-defaults-footer button { min-width: 80px; }
@media (max-width: 480px) { .panel-default-setting { grid-template-columns: minmax(0, 1fr); gap: 6px; } .panel-defaults-dialog { padding: 20px; } }
