/* styles.css - Stock Monitoring App Styles */

/* 基础样式 */
html, body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: var(--bg, #f1f4f8);
    margin: 0;
    padding: 0;
    color: var(--text, #1a1f2b);
    min-height: 100vh;
    width: 100vw;
    overflow-x: hidden;
    position: relative;
    transition: background-color 0.3s, color 0.3s;
}

/* ---------- 设计令牌 ---------- */
:root {
    --bg: #f1f4f8;
    --card: #ffffff;
    --line: #e3e8ef;
    --hairline: #f0f3f7;
    --text: #1a1f2b;
    --muted: #6b7688;
    --head-bg: #f7f9fc;
    --head-bg-hover: #eef2f8;
    --tile-bg: #f7f9fc;
    --tile-bg-hover: #eaf2ff;
    --up: #e0392e;
    --down: #17a35c;
    --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .04);
}
body.dark-mode {
    --bg: #12151b;
    --card: #1c2029;
    --line: #2c3240;
    --hairline: #262b36;
    --text: #e4e8ef;
    --muted: #98a2b3;
    --head-bg: #232833;
    --head-bg-hover: #2c3240;
    --tile-bg: #22262f;
    --tile-bg-hover: #263043;
    --up: #f0554a;
    --down: #2fbf71;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
}

/* 交易量顶部展示行样式 */
.volume-header-row {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 44px;
    background: color-mix(in srgb, var(--card, #fff) 88%, transparent);
    backdrop-filter: saturate(180%) blur(10px);
    border-bottom: 1px solid var(--line, #e3e8ef);
    box-shadow: 0 1px 3px rgba(16, 24, 40, .06);
    z-index: 999;
    display: flex;
    align-items: center;
    padding: 0 14px;
    font-size: 12px;
    /* 注意：这里原本是 overflow: hidden，但它会把「控制菜单」的下拉菜单裁掉 ——
       菜单要向下溢出 header 边界才能显示，被裁剪后就完全看不见，
       表现为「点击齿轮没反应」。
       横向溢出改由 .volume-header-content 的 min-width: 0 + flex 收缩来控制，
       不会产生滚动条。 */
    overflow: visible;
    white-space: nowrap;
}

.volume-header-content {
    /* 允许 flex 子项收缩，配合上面的 overflow: visible 防止横向溢出 */
    min-width: 0;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    width: 100%;
    gap: 18px;
}

.volume-total-section {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-weight: 700;
    flex: 0 0 auto;
    padding-right: 18px;
    border-right: 1px solid var(--line, #e3e8ef);
}

.volume-market-section {
    display: flex;
    gap: 20px;
    align-items: center;
    min-width: 200px;
}

.market-item {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.market-name {
    font-size: 11px;
    color: var(--muted, #6b7688);
}

.market-up {
    font-size: 12px;
    font-weight: 700;
    color: var(--up, #e0392e);
}

.market-down {
    font-size: 12px;
    font-weight: 700;
    color: var(--down, #17a35c);
}

.market-flat {
    font-size: 12px;
    font-weight: 700;
    color: #f0a020;
}

.section-title {
    color: var(--muted, #6b7688);
    font-weight: 600;
    white-space: nowrap;
}

.total-volume {
    color: var(--text, #1a1f2b);
    font-size: 15px;
    font-weight: 800;
    letter-spacing: .2px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.volume-change {
    font-size: 11px;
    font-weight: 600;
    color: var(--muted, #6b7688);
    white-space: nowrap;
    display: inline-block;
    vertical-align: middle;
    margin: 0;
    padding: 0;
    line-height: 1;
}

.volume-indices-section {
    display: flex;
    gap: 20px;
    flex: 1 1 auto;
    overflow: hidden;
    align-items: center;
}

.index-item {
    display: flex;
    align-items: baseline;
    gap: 6px;
    white-space: nowrap;
}

.index-name {
    color: var(--muted, #6b7688);
    font-size: 11px;
    white-space: nowrap;
}

.index-volume {
    color: var(--text, #1a1f2b);
    font-size: 12px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.index-change {
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    color: var(--muted, #6b7688);
}

.volume-right-section {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    flex: 0 0 auto;
    padding-left: 14px;
    border-left: 1px solid var(--line, #e3e8ef);
}

/* 注意：.control-dropdown / .dropdown-toggle 的正式定义在文件后半部分
   （统一控制下拉框区块）。此处不再重复定义，避免前后两份规则互相覆盖 ——
   之前这里有一份 position: static 的版本，被后面 position: fixed 的覆盖，
   属于死代码，删除后行为不变但更清晰。 */

/* 取消涨跌颜色（默认关闭，可在「设置布局」中开启） */
.volume-up,
.volume-down,
.index-change.volume-up,
.index-change.volume-down {
    color: #666 !important;
}

/* 取消股票行的涨跌颜色 */
.col-change.up,
.col-change.down {
    color: inherit !important;
}

/* 开启涨跌配色后：红涨绿跌（A股习惯） */
body.color-change .col-change.up,
body.color-change .index-change.volume-up {
    color: #e0392e !important;
}
body.color-change .col-change.down,
body.color-change .index-change.volume-down {
    color: #17a35c !important;
}

/* 成交量展示区域样式 */
.volume-display {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 9999;
    background-color: white;
    padding: 15px;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    width: 300px;
    font-size: 14px;
}

.volume-display h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 16px;
    color: #333;
    text-align: center;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.volume-item {
    margin-bottom: 10px;
    padding: 8px;
    background-color: #f9f9f9;
    border-radius: 3px;
}

.volume-item .stock-name {
    font-weight: bold;
    margin-bottom: 5px;
    color: #333;
}

.volume-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.today-volume {
    color: #666;
    font-size: 12px;
}

.volume-up {
    color: #ff4444;
    font-weight: bold;
    font-size: 12px;
}

.volume-down {
    color: #4444ff;
    font-weight: bold;
    font-size: 12px;
}

.volume-unknown {
    color: #999;
    font-size: 12px;
}

/* 主题切换 */
body.dark-mode {
    background: #1a1a1a;
    color: #e0e0e0;
}

/* 成交量悬浮按钮样式 */
.volume-button {
    position: fixed;
    top: 80px;
    right: 20px;
    width: 50px;
    height: 50px;
    background-color: #4a90e2;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    transition: all 0.3s ease;
}

.volume-button:hover {
    background-color: #357abd;
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.volume-button:active {
    transform: scale(0.95);
}

.volume-icon {
    font-size: 24px;
}

/* 成交量提示框样式 */
.volume-tooltip {
    position: fixed;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    padding: 15px;
    width: 300px;
    z-index: 9999;
    font-size: 14px;
    color: #333;
    border: 1px solid #eee;
    pointer-events: auto;
}

.volume-tooltip-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.volume-tooltip-header h4 {
    margin: 0;
    font-size: 16px;
    color: #333;
}

.volume-time {
    font-size: 12px;
    color: #999;
}

.volume-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding: 10px;
    background-color: #f9f9f9;
    border-radius: 5px;
}

.total-label {
    font-weight: bold;
    color: #666;
}

.total-value {
    font-size: 18px;
    font-weight: bold;
    color: #4a90e2;
}

.volume-change {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding: 10px;
    background-color: #f9f9f9;
    border-radius: 5px;
}

.change-label {
    font-weight: bold;
    color: #666;
}

.change-value {
    font-size: 16px;
    font-weight: bold;
}

.volume-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    background-color: #f5f5f5;
    border-radius: 4px;
}

.detail-label {
    color: #666;
    font-size: 13px;
}

.detail-value {
    font-weight: bold;
    font-size: 13px;
}

/* 深色模式下的悬浮按钮和提示框样式 */
body.dark-mode .volume-button {
    background-color: #333;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

body.dark-mode .volume-button:hover {
    background-color: #444;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.7);
}

body.dark-mode .volume-tooltip {
    background-color: #2d2d2d;
    color: #ffffff;
    border-color: #444;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

body.dark-mode .volume-tooltip-header {
    border-bottom-color: #444;
}

body.dark-mode .volume-tooltip-header h4 {
    color: #ffffff;
}

body.dark-mode .volume-time {
    color: #888;
}

body.dark-mode .volume-total,
body.dark-mode .volume-change,
body.dark-mode .detail-item {
    background-color: #333;
}

body.dark-mode .total-label,
body.dark-mode .change-label,
body.dark-mode .detail-label {
    color: #aaa;
}

body.dark-mode .total-value {
    color: #66a3ff;
}

body.dark-mode .detail-value {
    color: #ddd;
}

/* 统一控制下拉框 */
.control-dropdown {
    /* 必须是 relative 而不是 fixed。
       fixed 会把齿轮从 flex 流里拽出来固定到视口右上角，
       而「深度解析」仍留在 header 流内，两者位置不一致就会视觉重叠。
       relative 让齿轮回到 .volume-right-section 的 flex 排列中，
       同时下拉菜单仍可用 absolute 相对自身定位。 */
    position: relative;
    display: inline-block;
    flex: 0 0 auto;
}

.dropdown-toggle {
    background-color: #4a90e2;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 8px;
    cursor: pointer;
    font-size: 16px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s;
    margin: 0;
    z-index: 9999;
}

.dropdown-toggle:hover {
    background-color: #357abd;
}

.dropdown-menu {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    top: 100%;
    right: 0;
    background-color: var(--card, #fff);
    border: 1px solid var(--line, #e3e8ef);
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(16, 24, 40, .13), 0 1px 3px rgba(16, 24, 40, .07);
    min-width: 140px;
    margin-top: 4px;
    overflow: hidden;
    transform: translateY(-5px);
    transition: visibility 0s, opacity 0.18s ease, transform 0.18s ease;
    z-index: 9999;
}

.control-dropdown:hover .dropdown-menu,
.dropdown-menu:hover,
/* 点击齿轮展开（JS 切换 .open 类），与 :hover 方式并存 */
.control-dropdown.open .dropdown-menu {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
}

.dropdown-item {
    display: block;
    width: 100%;
    padding: 9px 14px;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    font-size: 13px;
    color: var(--text, #1a1f2b);
    transition: background-color 0.15s;
}

.dropdown-item:hover {
    background-color: var(--tile-bg-hover, #eaf2ff);
    color: var(--accent, #3b7ddd);
}

/* 登录验证模态框 */
#loginModal {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 9999;
    backdrop-filter: blur(4px);
    transition: opacity 0.3s ease;
    overflow: hidden;
    text-align: center;
}

/* 登录弹框内容 */
.login-content {
    background-color: white;
    padding: 16px;
    border-radius: 6px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    text-align: left;
    width: 240px;
    max-width: 90%;
    transform: none;
    transition: all 0.3s ease;
    border: none;
    display: inline-block;
    vertical-align: middle;
}

/* 登录标题 - 已移除 */
.login-content h2 {
    display: none;
}

/* 登录表单 */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* 表单组 */
.form-group {
    text-align: left;
}

/* 表单标签 */
.form-group label {
    display: block;
    margin-bottom: 3px;
    font-size: 11px;
    color: #666;
    font-weight: 500;
}

/* 登录输入框 */
.login-input {
    width: 100%;
    padding: 7px 10px;
    font-size: 12px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    margin-bottom: 0;
    box-sizing: border-box;
    transition: all 0.2s ease;
    background-color: white;
}

.login-input:focus {
    outline: none;
    border-color: #3b82f6;
    background-color: white;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.login-input::placeholder {
    color: #9ca3af;
}

/* 登录按钮 */
.login-btn {
    background-color: #3b82f6;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 7px 16px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    margin-right: 0;
    transition: all 0.2s ease;
    margin-top: 4px;
}

.login-btn:hover {
    background-color: #2563eb;
    transform: none;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2);
}

.login-btn:active {
    transform: translateY(1px);
    box-shadow: 0 1px 4px rgba(59, 130, 246, 0.2);
}

/* 登录错误提示 */
.login-error {
    color: #ef4444;
    margin-top: 6px;
    font-size: 11px;
    font-weight: 500;
    display: none;
    text-align: center;
    background-color: #fef2f2;
    padding: 5px 8px;
    border-radius: 4px;
    border: 1px solid #fee2e2;
    /* 错误信息可能较长（如服务端返回的具体原因），允许换行并撑开弹窗宽度 */
    max-width: 260px;
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.5;
    text-align: left;
}

/* 密码验证模态框 */
#passwordModal {
    display: none;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    backdrop-filter: blur(5px);
    transition: opacity 0.3s ease;
}

.password-content {
    background-color: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    text-align: center;
    width: 360px;
    max-width: 90%;
    transform: translateY(-20px);
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.18);
}

.password-input {
    width: 100%;
    padding: 12px 16px;
    font-size: 15px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    margin-bottom: 15px;
    box-sizing: border-box;
    transition: all 0.3s ease;
    background-color: #f8fafc;
}

.password-input:focus {
    outline: none;
    border-color: #4a90e2;
    background-color: white;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.password-error {
    color: #dc3545;
    margin-top: 12px;
    font-size: 14px;
    display: none;
    text-align: center;
    background-color: #fef2f2;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #fee2e2;
}

/* ===== 布局核心 =====
   设计目标：一屏内尽可能多地显示股票。
   1) 看板改为「横向滑动」的分组泳道，列数完全不限，超出部分左右滑动查看
   2) 分组内用 CSS Grid 精确排布 N 列（而非 flex 换行猜测），列数由设置控制
   3) 磁贴模式下每只股票是一个双行小卡片，单位面积承载股票数最大化
   4) 整页一个滚动条，取消每个分组内部的独立滚动条
   尺寸变量 --fs/--cell-w/--gap/--pad/--cols 由 JS 按密度与设置注入 */

/* ---------- 看板容器 ---------- */
.container {
    display: flex;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 8px;
    padding: 8px 10px 10px;
    width: 100%;
    height: calc(100vh - 44px);
    box-sizing: border-box;
    position: relative;
    margin-top: 44px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
}

/* 右侧留出 38px：给 show-hint 渐隐遮罩让位。
   否则遮罩会盖住最右侧卡片右上角的删除按钮（×号），
   表现为「删除按钮被挡住」。
   只在确实溢出时才加这份留白，避免平时浪费横向空间。 */
body.show-hint .container {
    padding-right: 48px;
}
/* 排列方式 = 自动换行 */
body.layout-wrap .container {
    flex-wrap: wrap;
    overflow-x: hidden;
    overflow-y: auto;
    height: auto;
    min-height: calc(100vh - 44px);
    align-content: flex-start;
}
body.layout-wrap .group-column {
    max-height: calc(100vh - 60px);
}
body.layout-wrap .stock-list {
    overflow-y: auto;
}

/* 横向滚动条样式 —— 已改为全局隐藏，见文件末尾「隐藏滚动条」区块。
   保留此处说明以记录历史：原本只针对 .container 定义了 9px 高的滚动条，
   但页面有多个滚动容器（.stock-list / .modal-content / .results 等），
   各处样式不统一显得杂乱，现统一隐藏。 */

/* 右侧渐隐提示：还有更多分组可以向右滑动 */
body.show-hint::after {
    content: '';
    position: fixed;
    top: 44px;
    right: 0;
    bottom: 0;
    width: 38px;
    pointer-events: none;
    z-index: 5;
    background: linear-gradient(to right, rgba(241, 244, 248, 0), var(--bg, #f1f4f8) 82%);
    opacity: 1;
    transition: opacity .25s;
}
body.dark-mode.show-hint::after {
    background: linear-gradient(to right, rgba(18, 21, 27, 0), var(--bg, #12151b) 82%);
}

/* ---------- 分组面板 ---------- */
.group-column {
    background-color: var(--card, #fff);
    border: 1px solid var(--line, #e3e8ef);
    border-radius: 10px;
    box-shadow: var(--shadow, 0 1px 2px rgba(16, 24, 40, .05));
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex: 0 0 auto;
    cursor: grab;
    position: relative;
    transition: box-shadow .15s, transform .15s;
}
.group-column:hover {
    box-shadow: 0 4px 12px rgba(16, 24, 40, .10), 0 1px 3px rgba(16, 24, 40, .06);
}
/* 每个分组一条彩色顶边，便于快速区分 */
.group-column::before {
    content: '';
    display: block;
    height: 3px;
    flex: 0 0 3px;
    background: var(--accent, #4a90e2);
}
.group-column:nth-child(8n+1) { --accent: #3b7ddd; }
.group-column:nth-child(8n+2) { --accent: #00a3a3; }
.group-column:nth-child(8n+3) { --accent: #7c5cff; }
.group-column:nth-child(8n+4) { --accent: #e8833a; }
.group-column:nth-child(8n+5) { --accent: #d9488a; }
.group-column:nth-child(8n+6) { --accent: #2fa84f; }
.group-column:nth-child(8n+7) { --accent: #c2410c; }
.group-column:nth-child(8n+8) { --accent: #0891b2; }

/* ---------- 分组标题栏 ---------- */
.group-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: var(--fs, 11px);
    font-weight: 700;
    color: var(--text, #1a1f2b);
    padding: 7px 9px;
    background: var(--head-bg, #f7f9fc);
    border-bottom: 1px solid var(--line, #e3e8ef);
    white-space: nowrap;
    overflow: hidden;
    cursor: pointer;
    user-select: none;
    flex: 0 0 auto;
}
.group-title:hover { background: var(--head-bg-hover, #eef2f8); }
.group-title .g-name {
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--accent, #3b7ddd);
}
.group-title .g-count {
    color: var(--muted, #6b7688);
    background: color-mix(in srgb, var(--accent, #3b7ddd) 12%, transparent);
    border-radius: 9px;
    padding: 0 6px;
    font-weight: 700;
    font-size: calc(var(--fs, 11px) - 1px);
    line-height: 15px;
    flex: 0 0 auto;
}
.group-title .g-sort {
    margin-left: auto;
    color: var(--muted, #6b7688);
    font-size: calc(var(--fs, 11px) - 1px);
    font-weight: 600;
    flex: 0 0 auto;
}
.group-title .g-fold {
    color: #9aa4b4;
    font-size: 9px;
    flex: 0 0 auto;
    line-height: 1;
    padding: 3px;
    border-radius: 3px;
    transition: transform .15s, background .12s;
}
.group-title .g-fold:hover { background: color-mix(in srgb, var(--accent, #3b7ddd) 15%, transparent); color: var(--accent, #3b7ddd); }
.group-column.collapsed .stock-list,
.group-column.collapsed .stock-header { display: none; }
.group-column.collapsed { width: auto !important; }
.group-column.collapsed .group-title { border-bottom: none; }
.group-column.collapsed .group-title .g-fold { transform: rotate(-90deg); }

/* ---------- 股票列表：CSS Grid 精确排 N 列 ---------- */
.stock-list {
    flex: 1 1 auto;
    display: grid;
    grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr));
    align-content: start;
    gap: 3px var(--gap, 5px);
    padding: var(--pad, 4px);
    font-size: var(--fs, 11px);
    line-height: 1.2;
    min-width: 0;
    overflow-y: auto;
}

/* 表头（仅表格模式） */
.stock-header { display: none; }

/* ---------- 列基础样式 ---------- */
.col-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text, #1a1f2b);
    font-size: var(--fs, 11px);
}
.col-price {
    font-weight: 600;
    color: var(--text, #1a1f2b);
    font-size: var(--fs, 11px);
    font-variant-numeric: tabular-nums;
}
.col-change {
    font-weight: 700;
    font-size: var(--fs, 11px);
    font-variant-numeric: tabular-nums;
    text-align: right;
}
.col-code {
    font-size: calc(var(--fs, 11px) - 2px);
    color: #9aa4b4;
    font-variant-numeric: tabular-nums;
}

/* 隐藏列（由 body 上的 class 控制，无需重建 DOM） */
body.hide-price .col-price { display: none !important; }
body.hide-change .col-change { display: none !important; }
body.hide-title .group-title { display: none; }
body.show-code .col-code { display: inline; }
.col-code { display: none; }

/* ===== 磁贴模式：每只股票一个双行小卡片 ===== */
body.layout-tile .stock-row {
    display: grid;
    /* 两列：名称 | 代码。
       删除按钮用绝对定位（position:absolute），不占 grid 位置 ——
       因为卡片内容区仅 9px 高，按钮作为 grid item 放不进任何一行，
       会被 overflow:hidden 裁掉一半。
       按钮的独立空间由 padding-right 预留。 */
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
        "name code"
        "price change";
    align-items: baseline;
    column-gap: 6px;
    row-gap: 1px;
    padding: 4px 7px;
    border-radius: var(--radius, 6px);
    background: var(--tile-bg, #f7f9fc);
    border: 1px solid transparent;
    border-left: 2px solid transparent;
    cursor: grab;
    position: relative;
    overflow: hidden;
    transition: background .12s, border-color .12s, transform .12s;
}
body.layout-tile .stock-row:hover {
    background: var(--tile-bg-hover, #eaf2ff);
    border-color: color-mix(in srgb, var(--accent, #3b7ddd) 45%, transparent);
    border-left-color: var(--accent, #3b7ddd);
}
body.layout-tile .col-name {
    grid-area: name;
    font-weight: 600;
    letter-spacing: .1px;
}
body.layout-tile .col-price {
    grid-area: price;
    color: var(--muted, #6b7688);
    font-weight: 600;
    font-size: calc(var(--fs, 11px) - 1px);
}
body.layout-tile .col-change {
    grid-area: change;
    text-align: right;
    font-size: calc(var(--fs, 11px) - 1px);
}
body.layout-tile .col-code {
    grid-area: code;
    text-align: right;
    align-self: center;
}
/* 开启红绿配色时，涨跌幅用色块强化识别 */
body.color-change.layout-tile .col-change.up {
    background: color-mix(in srgb, var(--up, #e0392e) 12%, transparent);
    color: var(--up, #e0392e);
    border-radius: 3px;
    padding: 0 3px;
}
body.color-change.layout-tile .col-change.down {
    background: color-mix(in srgb, var(--down, #17a35c) 12%, transparent);
    color: var(--down, #17a35c);
    border-radius: 3px;
    padding: 0 3px;
}

/* ===== 表格模式：一行一只股票 ===== */
body.layout-table .stock-list {
    display: block;
    padding: 0;
    overflow-y: auto;
}
body.layout-table .stock-header {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    font-weight: 700;
    font-size: var(--fs, 11px);
    color: var(--muted, #6b7688);
    background: var(--head-bg, #f7f9fc);
    border-bottom: 1px solid var(--line, #e3e8ef);
    flex: 0 0 auto;
    position: sticky;
    top: 0;
    z-index: 2;
}
body.layout-table .stock-row {
    display: flex;
    align-items: center;
    gap: 5px;
    width: 100%;
    padding: 3px 6px 3px 8px;
    border-bottom: 1px solid var(--hairline, #f0f3f7);
    cursor: grab;
    position: relative;
}
body.layout-table .stock-row:hover { background: var(--tile-bg-hover, #eaf2ff); }
/* 名称按内容宽度，不再吃满整行 —— 这样名称/价格/涨跌幅/删除按钮成组靠左，
   空白整体挪到最右边，名称和涨跌幅之间只剩正常的列间距（解决「中间太空」）。
   max-width 防止超长名称把整组撑得太宽；min-width:0 保留省略号截断。 */
body.layout-table .col-name { flex: 0 1 auto; min-width: 0; max-width: 260px; }
body.layout-table .col-price { flex: 0 0 48px; text-align: right; }
body.layout-table .col-change { flex: 0 0 50px; text-align: right; }
body.layout-table .col-code { flex: 0 0 auto; }

/* 删除按钮：悬停时出现在卡片右上角 */
.delete-btn {
    background-color: #dc3545;
    color: white;
    border: none;
    border-radius: 3px;
    width: 13px;
    height: 13px;
    line-height: 1;
    padding: 0;
    font-size: 11px;
    cursor: pointer;
    opacity: 0;
    transition: opacity .15s;
    position: absolute;
    top: 1px;
    right: 1px;
    z-index: 2;
}
.stock-row:hover .delete-btn { opacity: 1; }
.delete-btn:hover { background-color: #c82333; }

/* 磁贴模式：删除按钮
   ------------------------------------------------------------
   实测数据（无头 Edge 测量）：
     卡片 .stock-row 高 17px = padding(4+4) + 行1 + gap(1) + 行2
     → 内容区仅 9px，两行各约 4px
   所以按钮绝不能作为 grid item 放进行里（13px 放不进 4px 的行），
   必须绝对定位脱离行约束；且尺寸要 ≤ 内容区高度才不会溢出被裁。

   同时：
   - 尺寸缩到 9px，正好等于内容区高度
   - 用 right 而非 right:1px，避免压住卡片右边缘
   - 磁贴模式给卡片加右内边距，给按钮留出独立空间，
     不会压住「代码」列（grid-template-areas 里 code 在右上角）
   - z-index 10 > 右侧渐隐遮罩的 5，确保不被遮罩盖住 */
body.layout-tile .stock-row {
    padding-right: 16px;   /* 给右上角的删除按钮留位置 */
}
body.layout-tile .delete-btn {
    position: absolute;
    top: 4px;              /* 与内容区顶部对齐（padding-top = 4px） */
    right: 2px;
    z-index: 10;
    width: 9px;
    height: 9px;
    font-size: 9px;
    line-height: 9px;
    border-radius: 2px;
    opacity: 0;
}
body.layout-tile .stock-row:hover .delete-btn { opacity: 1; }

/* 表格模式：删除按钮作为流内最后一个 flex 子项，
   紧跟在涨跌幅后面，永远可见、永远点得到。
   不再用绝对定位 —— 绝对定位会把按钮钉在行最右角的 padding 里，
   与右对齐的涨跌幅列贴在一起，还容易被 .group-column 的 overflow:hidden 裁掉，
   表现为「删除按钮看不到」。 */
body.layout-table .delete-btn {
    position: static;          /* 回到正常文档流 */
    flex: 0 0 auto;            /* 不被压缩 */
    align-self: center;
    margin-left: 8px;          /* 与涨跌幅列拉开一点距离 */
    width: 14px;
    height: 14px;
    font-size: 12px;
    line-height: 14px;
    border-radius: 3px;
    opacity: 0;                /* 默认隐藏，鼠标移到该行才显示 */
    cursor: pointer;
}
body.layout-table .stock-row:hover .delete-btn { opacity: 1; }
body.layout-table .delete-btn:hover { background-color: #c82333; }

/* 包裹模式（layout-wrap）
   ------------------------------------------------------------
   注意：layout-wrap 与 layout-tile/layout-table 是**正交**的两个维度 ——
   script.js 里同时 toggle，所以包裹模式下 body 既有 layout-table
   也有 layout-wrap 两个 class。这条规则的特异性必须高于
   上面那条 layout-table 的规则，否则两者会打架。

   包裹模式行高更大，13px 按钮能完整显示。 */
body.layout-wrap .delete-btn,
body.layout-wrap.layout-table .delete-btn {
    position: absolute;
    top: 2px;
    right: 4px;
    z-index: 10;
    width: 13px;
    height: 13px;
    font-size: 11px;
    line-height: 13px;
    border-radius: 3px;
    opacity: 0;
}
body.layout-wrap .stock-row:hover .delete-btn,
body.layout-wrap.layout-table .stock-row:hover .delete-btn { opacity: 1; }

/* 基础规则的 z-index 也要提高（覆盖 position:absolute 时的场景） */
.delete-btn {
    z-index: 10;
}

/* 加载状态 */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #888;
    font-size: 16px;
}

/* ===== 布局设置表单 ===== */
.layout-form { margin: 14px 0 4px; }
.lf-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.lf-row > label {
    width: 72px;
    flex: 0 0 72px;
    font-size: 13px;
    color: #555;
}
/* 分段选择器 */
.lf-seg {
    display: inline-flex;
    border: 1px solid #d8dce1;
    border-radius: 6px;
    overflow: hidden;
    background: #fafbfc;
}
.lf-seg button {
    border: none;
    background: transparent;
    padding: 6px 16px;
    font-size: 13px;
    color: #555;
    cursor: pointer;
    transition: background .15s, color .15s;
    white-space: nowrap;
}
.lf-seg button + button { border-left: 1px solid #e6e9ec; }
.lf-seg button:hover { background: #f0f4f9; }
.lf-seg button.active {
    background: #4a90e2;
    color: #fff;
    font-weight: 600;
}
/* 数字输入 */
.lf-num { display: flex; align-items: center; gap: 10px; }
.lf-num input {
    width: 64px;
    padding: 6px 8px;
    font-size: 13px;
    border: 1px solid #d8dce1;
    border-radius: 6px;
    text-align: center;
}
.lf-num input:focus { outline: none; border-color: #4a90e2; }
.lf-hint { font-size: 12px; color: #999; }
/* 复选框行 */
.lf-checks { gap: 8px 18px; }
.lf-checks label {
    width: auto;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    color: #555;
    cursor: pointer;
}
.lf-checks input { transform: scale(1.1); cursor: pointer; }
/* 提示 */
.lf-tip {
    font-size: 12px;
    color: #8a9199;
    line-height: 1.6;
    background: #f7f9fb;
    border-left: 3px solid #c9d6e4;
    padding: 8px 10px;
    border-radius: 0 4px 4px 0;
    margin-top: 4px;
}
/* 按钮行 */
.lf-actions { display: flex; gap: 10px; margin-top: 16px; }
.lf-actions button {
    padding: 9px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
}
.lf-primary { background: #4a90e2; color: #fff; }
.lf-primary:hover { background: #357abd; }
.lf-secondary { background: #6c757d; color: #fff; }
.lf-secondary:hover { background: #5a636b; }

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 20px;
    border-radius: 8px;
    width: 80%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: black;
}

/* 搜索区域 */
.search-section {
    margin-bottom: 20px;
}

.search-box {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.search-box input {
    flex: 1;
    padding: 8px;
    font-size: 14px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.group-select {
    margin-bottom: 10px;
}

.group-select label {
    margin-right: 10px;
}

.group-select select {
    padding: 6px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* 搜索结果 */
.results {
    margin-top: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    max-height: 200px;
    overflow-y: auto;
}

.result-item {
    padding: 8px 12px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.result-item:last-child {
    border-bottom: none;
}

.result-item:hover {
    background: #f5f5f5;
}

/* 状态消息 */
.status {
    margin-top: 8px;
    padding: 6px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 12px;
    display: none;
}

.status.success {
    background-color: #d4edda;
    color: #155724;
}

.status.error {
    background-color: #f8d7da;
    color: #721c24;
}

.status.info {
    background-color: #d1ecf1;
    color: #0c5460;
}

/* 新分组输入 */
#newGroupInput {
    margin-top: 10px;
    display: none;
}

/* 分组管理 */
#groupManagement {
    margin-top: 10px;
    display: none;
}

/* 分组管理项 */
#groupManagement > div {
    display: flex;
    align-items: center;
    margin-bottom: 5px;
    padding: 5px;
    border-bottom: 1px solid #eee;
}

#groupManagement > div span {
    flex: 1;
}

/* 编辑和删除按钮 */
#groupManagement button {
    padding: 3px 8px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    margin-right: 5px;
    font-size: 12px;
}

/* 编辑按钮 */
#groupManagement button:first-of-type {
    background-color: #ffc107;
    color: black;
}

/* 删除按钮 */
#groupManagement button:last-of-type {
    background-color: #dc3545;
    color: white;
    padding: 2px 4px;
    font-size: 9px;
}

/* 交易量顶部展示行深色模式样式 */
body.dark-mode .volume-header-row {
    background: color-mix(in srgb, var(--card, #1c2029) 88%, transparent);
    border-bottom-color: var(--line, #2c3240);
    color: var(--text, #e4e8ef);
}

body.dark-mode .section-title,
body.dark-mode .index-name,
body.dark-mode .market-name {
    color: var(--muted, #98a2b3);
}

body.dark-mode .market-up {
    color: var(--up, #f0554a);
}

body.dark-mode .market-down {
    color: var(--down, #2fbf71);
}

body.dark-mode .market-flat {
    color: #f0a020;
}

body.dark-mode .total-volume,
body.dark-mode .index-volume {
    color: var(--text, #e4e8ef);
}

body.dark-mode .volume-change,
body.dark-mode .index-change {
    color: var(--muted, #98a2b3);
}

body.dark-mode .volume-update-time {
    color: #888;
}

/* 黑暗模式样式 */
body.dark-mode .dropdown-toggle {
    background-color: #6c757d;
}

body.dark-mode .dropdown-toggle:hover {
    background-color: #5a6268;
}

body.dark-mode .dropdown-menu {
    background-color: var(--card, #1c2029);
    border: 1px solid var(--line, #2c3240);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .45);
}

body.dark-mode .dropdown-item {
    color: var(--text, #e4e8ef);
}

body.dark-mode .dropdown-item:hover {
    background-color: var(--tile-bg-hover, #263043);
}

body.dark-mode .password-content {
    background-color: var(--card, #1c2029);
    color: var(--text, #e4e8ef);
}

body.dark-mode .password-input {
    background-color: var(--tile-bg, #22262f);
    color: var(--text, #e4e8ef);
    border: 1px solid var(--line, #2c3240);
}

body.dark-mode .group-column {
    background-color: var(--card, #1c2029);
    border: 1px solid var(--line, #2c3240);
    color: var(--text, #e4e8ef);
}

body.dark-mode .group-title {
    background: var(--head-bg, #232833);
    border-bottom: 1px solid var(--line, #2c3240);
    color: var(--text, #e4e8ef);
}

body.dark-mode .group-title:hover { background: var(--head-bg-hover, #2c3240); }
body.dark-mode .group-title .g-count { color: var(--muted, #98a2b3); }
body.dark-mode .group-title .g-fold { color: var(--muted, #98a2b3); }

/* 磁贴模式暗色 */
body.dark-mode.layout-tile .stock-row {
    background: var(--tile-bg, #22262f);
    border-color: transparent;
}
body.dark-mode.layout-tile .stock-row:hover {
    background: var(--tile-bg-hover, #263043);
    border-color: color-mix(in srgb, var(--accent, #3b7ddd) 55%, transparent);
}
body.dark-mode.layout-tile .col-price { color: var(--muted, #98a2b3); }
body.dark-mode.layout-table .stock-row:hover { background: var(--tile-bg-hover, #263043); }
body.dark-mode .col-code { color: #6e7681; }

/* 布局设置表单暗色 */
body.dark-mode .lf-row > label,
body.dark-mode .lf-checks label { color: #b0b6be; }
body.dark-mode .lf-seg { background: #333; border-color: #4a4a4a; }
body.dark-mode .lf-seg button { color: #b0b6be; }
body.dark-mode .lf-seg button + button { border-left-color: #4a4a4a; }
body.dark-mode .lf-seg button:hover { background: #3d3d3d; }
body.dark-mode .lf-seg button.active { background: #4a90e2; color: #fff; }
body.dark-mode .lf-num input {
    background: #333;
    border-color: #4a4a4a;
    color: #e0e0e0;
}
body.dark-mode .lf-tip {
    background: var(--tile-bg, #22262f);
    border-left-color: var(--line, #2c3240);
    color: var(--muted, #98a2b3);
}

body.dark-mode .stock-header {
    background-color: var(--head-bg, #232833);
    border-bottom: 1px solid var(--line, #2c3240);
    color: var(--text, #e4e8ef);
}

body.dark-mode .stock-row {
    border-bottom: 1px solid var(--hairline, #262b36);
    color: var(--text, #e4e8ef);
}

body.dark-mode .stock-row:hover {
    background-color: var(--tile-bg-hover, #263043);
}

body.dark-mode .col-name,
body.dark-mode .col-price,
body.dark-mode .col-change {
    color: var(--text, #e4e8ef);
}

body.dark-mode .result-item {
    background-color: #2d2d2d;
    border: 1px solid #444;
    color: #e0e0e0;
}

body.dark-mode .result-info {
    color: #e0e0e0;
}

body.dark-mode .result-info code {
    color: #e0e0e0;
}

body.dark-mode .status {
    background-color: #2d2d2d;
    color: #e0e0e0;
    border: 1px solid #444;
}

body.dark-mode .status.success {
    background-color: #155724;
    border-color: #155724;
    color: #d4edda;
}

body.dark-mode .status.error {
    background-color: #721c24;
    border-color: #721c24;
    color: #f8d7da;
}

body.dark-mode .status.info {
    background-color: #0c5460;
    border-color: #0c5460;
    color: #d1ecf1;
}

body.dark-mode input,
body.dark-mode select {
    background-color: #3d3d3d;
    color: #e0e0e0;
    border: 1px solid #555;
}

body.dark-mode .modal-content {
    background-color: #2d2d2d;
    color: #e0e0e0;
}

/* 深色模式下的登录弹框 */
body.dark-mode #loginModal {
    background-color: rgba(0, 0, 0, 0.7);
}

body.dark-mode .login-content {
    background-color: #27272a;
    color: #e0e0e0;
    border: none;
}

body.dark-mode .login-content h2 {
    color: #fafafa;
}

body.dark-mode .form-group label {
    color: #a1a1aa;
}

body.dark-mode .login-input {
    background-color: #3f3f46;
    color: #e0e0e0;
    border: 1px solid #52525b;
}

body.dark-mode .login-input:focus {
    border-color: #60a5fa;
    background-color: #3f3f46;
    box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.2);
}

body.dark-mode .login-input::placeholder {
    color: #71717a;
}

body.dark-mode .login-error {
    background-color: #451a1a;
    color: #fca5a5;
    border-color: #7f1d1d;
}

/* 滚动条样式（黑暗模式）—— 已改为全局隐藏，见文件末尾「隐藏滚动条」区块。
   注意：此处原本是 body.dark-mode ::-webkit-scrollbar { width:8px; height:8px }，
   其特异性高于通用规则，删掉后才不会被深色模式下的滚动条覆盖。 */

/* 统一标题样式 */
h2 {
    font-size: 18px;
    margin-bottom: 15px;
}

h4 {
    font-size: 14px;
    margin-bottom: 10px;
}

/* ============ 掩饰文章样式 ============ */
body.decoy-mode,
body.decoy-mode html {
    overflow: auto !important;
    height: auto !important;
    min-height: 100vh;
    background: #f4f5f7;
}

.decoy-article {
    display: block;
    width: 100%;
    min-height: 100vh;
    background: #f4f5f7;
    color: #222;
    padding: 40px 20px 80px;
    box-sizing: border-box;
}

.decoy-container {
    max-width: 760px;
    margin: 0 auto;
    background: #fff;
    padding: 48px 56px;
    border-radius: 6px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
    line-height: 1.8;
    font-size: 16px;
}

.decoy-meta {
    color: #888;
    font-size: 13px;
    margin-bottom: 18px;
}

.decoy-dot {
    margin: 0 8px;
    color: #bbb;
}

.decoy-title {
    font-size: 30px;
    line-height: 1.4;
    margin: 0 0 20px;
    font-weight: 700;
}

.decoy-title a {
    color: #1a1a1a;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s;
}

.decoy-title a:hover {
    color: #4a90e2;
    text-decoration: underline;
}

.decoy-summary {
    font-size: 16px;
    color: #555;
    border-left: 4px solid #4a90e2;
    padding: 10px 16px;
    background: #f8fafc;
    margin: 0 0 28px;
    border-radius: 2px;
}

.decoy-body h2 {
    font-size: 20px;
    margin: 28px 0 14px;
    color: #1a1a1a;
    font-weight: 600;
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
}

.decoy-body p {
    margin: 0 0 16px;
    color: #333;
    text-indent: 2em;
    text-align: justify;
}

.decoy-footer {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #eee;
    color: #aaa;
    font-size: 13px;
    text-align: center;
}

/* 掩饰模式下隐藏真实页面元素 */
/* 注意：#loginModal 不能加在这里。
   若在此处写 `display: none !important`，样式表的 !important 会压过
   exitDecoyMode() 设置的内联 `display`，导致未登录用户点击标题后登录框不弹出。 */
body.decoy-mode #volumeHeader,
body.decoy-mode #app,
body.decoy-mode #addStockModal,
body.decoy-mode #layoutModal {
    display: none !important;
}

body.decoy-mode .decoy-article {
    display: block !important;
}

/* 黑暗模式下的掩饰文章 */
body.dark-mode.decoy-mode {
    background: #1a1a1a;
    color: #e0e0e0;
}

body.dark-mode .decoy-container {
    background: #252525;
    color: #e0e0e0;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}

body.dark-mode .decoy-meta {
    color: #888;
}

body.dark-mode .decoy-title a {
    color: #f0f0f0;
}

body.dark-mode .decoy-summary {
    background: #2d2d2d;
    color: #cfcfcf;
    border-left-color: #60a5fa;
}

body.dark-mode .decoy-body h2 {
    color: #f0f0f0;
    border-bottom-color: #3a3a3a;
}

body.dark-mode .decoy-body p {
    color: #cfcfcf;
}

body.dark-mode .decoy-footer {
    border-top-color: #3a3a3a;
    color: #777;
}

/* 真实页面顶部的隐蔽切换入口 */
.hidden-toggle {
    color: #6c757d;
    font-size: 12px;
    text-decoration: none;
    cursor: pointer;
    /* 右边距交给 flex 的 gap 控制，避免与 gap 叠加导致间距过大 */
    margin-right: 0;
    opacity: 0.6;
    transition: opacity 0.2s, color 0.2s;
    user-select: none;
}

.hidden-toggle:hover {
    opacity: 1;
    color: #4a90e2;
    text-decoration: underline;
}

body.dark-mode .hidden-toggle {
    color: #9ca3af;
}

body.dark-mode .hidden-toggle:hover {
    color: #60a5fa;
}

/* ========== 新闻站点样式 ========== */
.decoy-article {
    background: #ffffff;
    color: #222;
    padding: 0;
    margin: 0;
    min-height: 100vh;
}

.news-site-container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0;
}

.news-site-header {
    background: #fff;
    padding: 28px 32px 16px;
    border-bottom: 2px solid #1a1a1a;
}

.news-site-title {
    margin: 0;
    font-size: 40px;
    font-weight: 900;
    letter-spacing: 2px;
    color: #111;
    text-align: center;
}

.news-site-title a {
    color: #111;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s;
}

.news-site-title a:hover {
    color: #c0392b;
}

.news-site-subtitle {
    text-align: center;
    color: #666;
    font-size: 14px;
    margin-top: 8px;
    letter-spacing: 1px;
}

.news-site-nav {
    background: #f5f5f5;
    border-bottom: 1px solid #e5e5e5;
    padding: 0 32px;
    display: flex;
    gap: 28px;
}

.news-site-nav a {
    display: inline-block;
    padding: 12px 0;
    font-size: 15px;
    color: #333;
    text-decoration: none;
    font-weight: 500;
    position: relative;
}

.news-site-nav a:hover {
    color: #c0392b;
}

.news-site-body {
    padding: 24px 32px;
}

.news-featured {
    background: linear-gradient(135deg, #c0392b 0%, #8e2015 100%);
    color: #fff;
    padding: 20px 24px;
    border-radius: 6px;
    margin-bottom: 24px;
}

.news-featured-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 4px;
    letter-spacing: 2px;
}

.news-featured-desc {
    font-size: 14px;
    opacity: 0.9;
}

.news-list-container {
    display: block;
}

.news-loading {
    text-align: center;
    padding: 40px;
    color: #999;
    font-size: 14px;
}

.news-source {
    margin-bottom: 28px;
    border-bottom: 1px solid #eee;
    padding-bottom: 16px;
}

.news-source:last-child {
    border-bottom: none;
}

.news-source-title {
    font-size: 18px;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 12px;
    padding-left: 12px;
    border-left: 4px solid #c0392b;
}

.news-item-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.news-item-list li {
    padding: 8px 0 8px 12px;
    border-bottom: 1px dashed #eee;
    font-size: 15px;
    color: #333;
    line-height: 1.7;
}

.news-item-list li:last-child {
    border-bottom: none;
}

.news-item-list li a {
    color: #333;
    text-decoration: none;
    transition: color 0.15s;
}

.news-item-list li a:hover {
    color: #c0392b;
}

.news-item-list li a::before {
    content: attr(data-rank);
    display: inline-block;
    width: 22px;
    height: 22px;
    line-height: 22px;
    text-align: center;
    font-size: 12px;
    font-weight: 700;
    margin-right: 8px;
    border-radius: 3px;
    background: #f0f0f0;
    color: #666;
}

.news-item-list li:nth-child(1) a::before {
    background: #c0392b;
    color: #fff;
}
.news-item-list li:nth-child(2) a::before {
    background: #e67e22;
    color: #fff;
}
.news-item-list li:nth-child(3) a::before {
    background: #f1c40f;
    color: #fff;
}

.news-site-footer {
    text-align: center;
    padding: 24px;
    color: #999;
    font-size: 12px;
    border-top: 1px solid #eee;
    margin-top: 24px;
}

/* 暗色模式下的新闻站点 */
body.dark-mode .decoy-article {
    background: #0f0f0f;
    color: #e0e0e0;
}
body.dark-mode .news-site-header {
    background: #0f0f0f;
    border-bottom-color: #2a2a2a;
}
body.dark-mode .news-site-title {
    color: #f0f0f0;
}
body.dark-mode .news-site-title a {
    color: #f0f0f0;
}
body.dark-mode .news-site-title a:hover {
    color: #ff6b6b;
}
body.dark-mode .news-site-subtitle {
    color: #888;
}
body.dark-mode .news-site-nav {
    background: #1a1a1a;
    border-bottom-color: #2a2a2a;
}
body.dark-mode .news-site-nav a {
    color: #ccc;
}
body.dark-mode .news-site-nav a:hover {
    color: #ff6b6b;
}
body.dark-mode .news-source {
    border-bottom-color: #2a2a2a;
}
body.dark-mode .news-source-title {
    color: #f0f0f0;
    border-left-color: #ff6b6b;
}
body.dark-mode .news-item-list li {
    border-bottom-color: #2a2a2a;
    color: #ddd;
}
body.dark-mode .news-item-list li a {
    color: #ddd;
}
body.dark-mode .news-item-list li a:hover {
    color: #ff6b6b;
}
body.dark-mode .news-item-list li a::before {
    background: #333;
    color: #bbb;
}
body.dark-mode .news-item-list li:nth-child(1) a::before {
    background: #ff6b6b;
    color: #fff;
}
body.dark-mode .news-item-list li:nth-child(2) a::before {
    background: #e67e22;
    color: #fff;
}
body.dark-mode .news-item-list li:nth-child(3) a::before {
    background: #f1c40f;
    color: #fff;
}
body.dark-mode .news-site-footer {
    color: #666;
    border-top-color: #2a2a2a;
}
body.dark-mode .news-loading {
    color: #666;
}


/* ============================================================
   隐藏滚动条
   ------------------------------------------------------------
   需求：各模块的滚动条太丑，统一隐藏。
   但**滚动能力必须保留** —— 只是不显示滚动条轨道，
   鼠标滚轮、触控板、触摸滑动、键盘方向键都照常可用。
   这也是 macOS 系统的默认行为（系统级「自动隐藏滚动条」）。

   实现要点：
   1. ::-webkit-scrollbar  —— Chrome / Edge / Safari（覆盖 width/height 即可隐藏）
   2. scrollbar-width: none —— Firefox 的标准属性
   3. 只写这两条，不要用 display:none 隐藏滚动容器本身，
      也不要用 overflow: hidden 改掉容器的滚动属性 ——
      那会真的失去滚动能力。

   放在文件末尾，确保能覆盖前面所有针对具体容器的滚动条样式。
   ============================================================ */

/* 通用：隐藏页面上所有元素的滚动条 */
* {
    scrollbar-width: none;         /* Firefox */
    -ms-overflow-style: none;      /* 旧版 Edge / IE */
}

*::-webkit-scrollbar {
    width: 0;      /* 纵向滚动条宽度归零 */
    height: 0;     /* 横向滚动条高度归零 */
    display: none; /* Chrome / Edge / Safari */
}

/* 显式列出主要滚动容器，双保险（某些浏览器对通配符支持不完整） */
.container::-webkit-scrollbar,
body.layout-wrap .container::-webkit-scrollbar,
body.layout-wrap .stock-list::-webkit-scrollbar,
.stock-list::-webkit-scrollbar,
body.layout-table .stock-list::-webkit-scrollbar,
.modal-content::-webkit-scrollbar,
.results::-webkit-scrollbar,
html::-webkit-scrollbar,
body::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
}

/* 深色模式下的旧滚动条样式特异性更高（body.dark-mode ::-webkit-scrollbar），
   必须同等覆盖，否则切换深色主题后滚动条会重新出现。
   这里把 body.dark-mode 写在选择器列表里，特异性与旧规则相同，
   而本规则在文件更靠后的位置 → 后者胜出。 */
body.dark-mode ::-webkit-scrollbar,
body.dark-mode .container::-webkit-scrollbar,
body.dark-mode .stock-list::-webkit-scrollbar,
body.dark-mode .modal-content::-webkit-scrollbar,
body.dark-mode .results::-webkit-scrollbar,
body.dark-mode html::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
}

/* Firefox 同样需要覆盖深色模式 */
body.dark-mode,
body.dark-mode .container,
body.dark-mode .stock-list,
body.dark-mode .modal-content,
body.dark-mode .results,
body.dark-mode html {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.container,
body.layout-wrap .container,
body.layout-wrap .stock-list,
.stock-list,
body.layout-table .stock-list,
.modal-content,
.results,
html,
body {
    scrollbar-width: none;
    -ms-overflow-style: none;
}
