/* ===== 全局重置 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --bg-primary: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --bg-card: #16213e;
    --bg-input: #0d1b2a;
    --text-primary: #e8e8e8;
    --text-secondary: #8892b0;
    --text-muted: #5a6a8a;
    --accent: #e94560;
    --accent-glow: rgba(233, 69, 96, 0.3);
    --up-color: #ff4757;
    --down-color: #2ed573;
    --strong-color: #ffa502;
    --border: #2a2a4a;
    --nav-height: 60px;
    --header-height: 52px;
}

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    overflow: hidden;
    user-select: none;
}

/* ===== 顶部栏 ===== */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    border-bottom: 1px solid var(--border);
    z-index: 100;
}

.header-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent-glow);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.header-title h1 {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: 1px;
}

.header-time {
    font-size: 13px;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

/* ===== 主内容区 ===== */
.app-main {
    position: fixed;
    top: var(--header-height);
    bottom: var(--nav-height);
    left: 0;
    right: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.page {
    display: none;
    padding: 12px;
    min-height: 100%;
}

.page.active {
    display: block;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 4px 16px;
}

.page-header h2 {
    font-size: 20px;
    font-weight: 600;
}

.page-count {
    font-size: 13px;
    color: var(--text-secondary);
    background: var(--bg-card);
    padding: 4px 10px;
    border-radius: 12px;
}

/* ===== 策略卡片 ===== */
.strategy-card {
    background: linear-gradient(135deg, var(--bg-card) 0%, #1a1a3e 100%);
    border-radius: 14px;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    border: 1px solid var(--border);
}

.strategy-name {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
}

.strategy-desc {
    font-size: 12px;
    color: var(--text-secondary);
}

.btn-settings {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(233, 69, 96, 0.15);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s;
}

.btn-settings:active {
    transform: scale(0.9);
}

/* ===== 扫描按钮 ===== */
.scan-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 30px 0 24px;
}

.btn-scan {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #e94560 0%, #c23152 100%);
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 8px 30px var(--accent-glow);
    transition: all 0.3s;
    position: relative;
}

.btn-scan:active {
    transform: scale(0.95);
}

.btn-scan:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-scan.scanning .scan-icon {
    animation: spin 1.5s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.scan-hint {
    margin-top: 16px;
    font-size: 12px;
    color: var(--text-muted);
}

/* ===== 进度条 ===== */
.progress-container {
    margin-bottom: 20px;
}

.progress-bar {
    height: 6px;
    background: var(--bg-input);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #ff6b81);
    border-radius: 3px;
    width: 0%;
    transition: width 0.3s;
}

.progress-text {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}

/* ===== 统计行 ===== */
.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 20px;
}

.stat-item {
    background: var(--bg-card);
    border-radius: 10px;
    padding: 12px 8px;
    text-align: center;
    border: 1px solid var(--border);
}

.stat-value {
    font-size: 18px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.stat-value.up { color: var(--up-color); }
.stat-value.strong { color: var(--strong-color); }

.stat-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ===== 结果区 ===== */
.result-section {
    margin-bottom: 20px;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 4px 12px;
}

.result-title {
    font-size: 16px;
    font-weight: 600;
}

.result-sort {
    font-size: 12px;
    color: var(--accent);
    cursor: pointer;
    padding: 4px 8px;
}

/* ===== 股票列表 ===== */
.stock-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stock-item {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 14px;
    display: flex;
    align-items: center;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.2s;
}

.stock-item:active {
    background: var(--bg-secondary);
    transform: scale(0.98);
}

.stock-info {
    flex: 1;
    min-width: 0;
}

.stock-name {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 3px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.stock-tag {
    font-size: 10px;
    padding: 1px 5px;
    border-radius: 3px;
    font-weight: 500;
}

.tag-tail { background: rgba(255, 165, 2, 0.2); color: var(--strong-color); }
.tag-strong { background: rgba(233, 69, 96, 0.2); color: var(--accent); }

.stock-code {
    font-size: 12px;
    color: var(--text-muted);
}

.stock-price-info {
    text-align: right;
    margin-right: 10px;
}

.stock-price {
    font-size: 16px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.stock-change {
    font-size: 13px;
    font-weight: 600;
    margin-top: 2px;
    font-variant-numeric: tabular-nums;
}

.stock-change.up { color: var(--up-color); }
.stock-change.down { color: var(--down-color); }

.stock-fav {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s;
}

.stock-fav.active {
    color: var(--strong-color);
}

/* ===== 空状态 ===== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state svg {
    margin-bottom: 16px;
    opacity: 0.4;
}

.empty-state p {
    font-size: 14px;
    margin-bottom: 6px;
}

.empty-state .empty-sub {
    font-size: 12px;
    opacity: 0.6;
}

.empty-state.small {
    padding: 40px 20px;
}

/* ===== 设置页 ===== */
.settings-group {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 4px 16px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
}

.settings-title {
    font-size: 13px;
    color: var(--accent);
    font-weight: 600;
    padding: 14px 0 10px;
    border-bottom: 1px solid var(--border);
}

.setting-item {
    padding: 14px 0;
    border-bottom: 1px solid rgba(42, 42, 74, 0.5);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.setting-item:last-child {
    border-bottom: none;
}

.setting-item label {
    font-size: 14px;
    color: var(--text-primary);
    flex-shrink: 0;
}

.setting-item input[type="number"] {
    width: 80px;
    padding: 8px 10px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.setting-item input[type="number"]:focus {
    outline: none;
    border-color: var(--accent);
}

.range-inputs {
    display: flex;
    align-items: center;
    gap: 8px;
}

.range-inputs input {
    width: 70px !important;
}

.range-sep {
    color: var(--text-muted);
    font-size: 14px;
}

/* 开关 */
.switch-item {
    cursor: pointer;
}

.switch {
    position: relative;
    width: 48px;
    height: 28px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-input);
    border-radius: 28px;
    transition: 0.3s;
    border: 1px solid var(--border);
}

.slider:before {
    content: "";
    position: absolute;
    height: 22px;
    width: 22px;
    left: 2px;
    bottom: 2px;
    background: var(--text-secondary);
    border-radius: 50%;
    transition: 0.3s;
}

.switch input:checked + .slider {
    background: var(--accent);
    border-color: var(--accent);
}

.switch input:checked + .slider:before {
    transform: translateX(20px);
    background: white;
}

.settings-actions {
    display: flex;
    gap: 12px;
    margin: 24px 0;
}

.btn-primary, .btn-secondary {
    flex: 1;
    padding: 14px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:active {
    transform: scale(0.97);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.app-info {
    text-align: center;
    padding: 20px 0 40px;
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.8;
}

/* ===== 底部导航 ===== */
.app-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    display: flex;
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom);
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 11px;
    cursor: pointer;
    transition: color 0.2s;
}

.nav-item.active {
    color: var(--accent);
}

.nav-item svg {
    width: 22px;
    height: 22px;
}

/* ===== 详情弹窗 ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 200;
    display: none;
    align-items: flex-end;
    justify-content: center;
}

.modal-overlay.show {
    display: flex;
}

.modal-content {
    background: var(--bg-secondary);
    width: 100%;
    max-width: 500px;
    max-height: 80vh;
    border-radius: 20px 20px 0 0;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--bg-secondary);
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
}

.modal-code {
    font-size: 13px;
    color: var(--text-muted);
    margin-left: 8px;
    font-weight: 400;
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-body {
    padding: 16px 20px 30px;
}

.detail-price-row {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 20px;
}

.detail-price {
    font-size: 32px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.detail-change {
    font-size: 16px;
    font-weight: 600;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.detail-cell {
    background: var(--bg-card);
    border-radius: 10px;
    padding: 12px;
}

.detail-cell-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.detail-cell-value {
    font-size: 15px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.detail-section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--accent);
    margin: 16px 0 10px;
}

.signal-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.signal-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg-card);
    border-radius: 8px;
    font-size: 13px;
}

.signal-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.signal-dot.pass { background: var(--down-color); }
.signal-dot.fail { background: var(--text-muted); }
.signal-dot.warn { background: var(--strong-color); }

/* ===== Toast ===== */
.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 14px;
    z-index: 300;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    max-width: 80%;
    text-align: center;
}

.toast.show {
    opacity: 1;
}

/* ===== 滚动条 ===== */
::-webkit-scrollbar {
    width: 0;
    display: none;
}

/* ===== 主力动向标签 ===== */
.tag-inst-1 { background: rgba(240,160,32,0.15); color: #f0a020; border: 1px solid rgba(240,160,32,0.4); }
.tag-inst-2 { background: rgba(232,80,42,0.15); color: #e8502a; border: 1px solid rgba(232,80,42,0.4); }
.tag-inst-3 { background: rgba(232,32,32,0.2); color: #ff4444; border: 1px solid rgba(232,32,32,0.5); font-weight: 600; }

/* ===== 主力分析详情 ===== */
.inst-score-box {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(255,255,255,0.03);
    border-radius: 8px;
    margin-bottom: 12px;
}
.inst-score { font-size: 36px; font-weight: 700; line-height: 1; }
.inst-label { font-size: 16px; font-weight: 600; }

.inst-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}
.inst-metric {
    background: rgba(255,255,255,0.03);
    border-radius: 6px;
    padding: 8px 10px;
    text-align: center;
}
.inst-metric span { display: block; font-size: 11px; color: var(--text-muted); margin-bottom: 4px; }
.inst-metric b { font-size: 15px; color: var(--text-primary); }

.inst-details { display: flex; flex-direction: column; gap: 4px; }
.inst-detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    background: rgba(255,255,255,0.02);
    border-radius: 4px;
    font-size: 13px;
}
.inst-detail-item span { color: var(--text-secondary); }
.inst-detail-item b { font-size: 13px; min-width: 30px; text-align: right; }

/* ===== 拉升概率标签 ===== */
.tag-rally-0 { background: rgba(136,136,136,0.15); color: #888; border: 1px solid rgba(136,136,136,0.3); }
.tag-rally-1 { background: rgba(76,175,80,0.15); color: #4caf50; border: 1px solid rgba(76,175,80,0.4); }
.tag-rally-2 { background: rgba(255,152,0,0.15); color: #ff9800; border: 1px solid rgba(255,152,0,0.4); }
.tag-rally-3 { background: rgba(244,67,54,0.2); color: #f44336; border: 1px solid rgba(244,67,54,0.5); font-weight: 600; }

/* ===== 拉升概率详情 ===== */
.rally-score-box {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(255,255,255,0.03);
    border-radius: 8px;
    margin-bottom: 10px;
}
.rally-score { font-size: 36px; font-weight: 700; line-height: 1; }
.rally-label { font-size: 16px; font-weight: 600; }
.rally-sub { font-size: 12px; color: var(--text-muted); margin-left: auto; }

.rally-signals { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.rally-signal-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    background: rgba(255,255,255,0.02);
    border-radius: 4px;
    font-size: 13px;
}
.rally-signal-item span { color: var(--text-secondary); }
.rally-signal-item b { font-size: 13px; min-width: 30px; text-align: right; }

.setting-desc {
    font-size: 12px;
    color: var(--text-muted);
    padding: 8px 12px;
    line-height: 1.5;
}

/* ===== 市场情绪条 ===== */
.sentiment-bar {
    display: flex;
    justify-content: space-around;
    background: rgba(255,255,255,0.03);
    border-radius: 8px;
    padding: 10px 8px;
    margin: 10px 0;
}
.sentiment-item {
    text-align: center;
    flex: 1;
}
.sentiment-label {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 2px;
}
.sentiment-label.up { color: var(--up-color); }
.sentiment-label.down { color: var(--down-color); }
.sentiment-label.strong { color: var(--strong-color); }
.sentiment-value {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

/* 版本号显示 */
.app-version {
    font-size: 11px;
    color: var(--text-muted);
    margin-left: 6px;
    background: rgba(255,255,255,0.08);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: normal;
}

/* ===== 交易计划 ===== */
.trade-plan-box {
    background: rgba(255,255,255,0.03);
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 8px;
}
.trade-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.trade-row:last-child { border-bottom: none; }
.trade-label { font-size: 13px; color: var(--text-muted); }
.trade-label.stop { color: #f44336; }
.trade-label.profit { color: #4caf50; }
.trade-value { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.trade-value.stop { color: #f44336; }
.trade-value.profit { color: #4caf50; }
.trade-tip {
    font-size: 11px;
    color: var(--text-muted);
    padding: 6px 10px;
    background: rgba(255,152,0,0.08);
    border-radius: 4px;
    margin-bottom: 12px;
    line-height: 1.4;
}

/* ===== 周线趋势 ===== */
.weekly-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255,255,255,0.03);
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 12px;
}
.weekly-label { font-size: 15px; font-weight: 600; }
.weekly-change { font-size: 14px; font-weight: 600; }

/* ===== 连板/板块标签 ===== */
.tag-limitup { background: rgba(244,67,54,0.2); color: #ff5252; border: 1px solid rgba(244,67,54,0.5); font-weight: 600; }
.tag-board { background: rgba(33,150,243,0.12); color: #42a5f5; border: 1px solid rgba(33,150,243,0.3); font-size: 10px; }

/* ===== 板块热度 ===== */
.board-heat {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 10px;
    padding: 8px;
    background: rgba(255,255,255,0.02);
    border-radius: 8px;
}
.board-item {
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(255,255,255,0.04);
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 11px;
}
.board-name { color: var(--text-secondary); font-weight: 500; }
.board-count { color: var(--text-muted); }
.board-change { font-weight: 600; }
.board-limit { color: #f44336; font-weight: 600; }

/* ===== 自选股操作 ===== */
.fav-actions {
    padding: 0 16px 10px;
}
.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
}

/* ===== 卖出信号 ===== */
.sell-signals {
    margin-top: 4px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.sell-signal {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: 500;
}
.sell-signal.danger { background: rgba(244,67,54,0.2); color: #f44336; }
.sell-signal.warn { background: rgba(255,152,0,0.2); color: #ff9800; }
.sell-signal.safe { background: rgba(76,175,80,0.15); color: #4caf50; }

/* ===== 详情页操作 ===== */
.detail-actions {
    padding: 10px 16px;
    text-align: center;
}

/* ===== 回测结果 ===== */
.backtest-result {
    padding: 12px 16px;
    background: rgba(255,255,255,0.03);
    margin: 0 16px 16px;
    border-radius: 8px;
}
.bt-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-primary);
}
.bt-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}
.bt-item {
    background: rgba(255,255,255,0.04);
    border-radius: 6px;
    padding: 8px;
    text-align: center;
}
.bt-item span {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 3px;
}
.bt-item b {
    font-size: 14px;
    color: var(--text-primary);
}
.bt-trades-title {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.bt-trade {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    padding: 3px 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}

/* ===== 筹码分布 ===== */
.chip-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-bottom: 10px;
}
.chip-metric {
    background: rgba(255,255,255,0.03);
    border-radius: 6px;
    padding: 6px 8px;
    text-align: center;
}
.chip-metric span { display: block; font-size: 10px; color: var(--text-muted); margin-bottom: 2px; }
.chip-metric b { font-size: 13px; color: var(--text-primary); }

.chip-chart {
    background: rgba(255,255,255,0.02);
    border-radius: 6px;
    padding: 8px;
    margin-bottom: 8px;
    max-height: 300px;
    overflow-y: auto;
}
.chip-bar-row {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 6px;
    margin-bottom: 1px;
}
.chip-price {
    font-size: 9px;
    color: var(--text-muted);
    width: 42px;
    text-align: right;
    flex-shrink: 0;
}
.chip-bar-bg {
    flex: 1;
    height: 5px;
    background: rgba(255,255,255,0.05);
    border-radius: 2px;
    overflow: hidden;
}
.chip-bar {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s;
}
.chip-legend {
    display: flex;
    gap: 12px;
    font-size: 11px;
    color: var(--text-muted);
    padding: 4px 8px;
    margin-bottom: 12px;
}
.legend-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 2px;
    margin-right: 3px;
    vertical-align: middle;
}
.tag-chip-1 { background: rgba(255,152,0,0.15); color: #ff9800; border: 1px solid rgba(255,152,0,0.4); }
.tag-chip-2 { background: rgba(255,87,34,0.15); color: #ff5722; border: 1px solid rgba(255,87,34,0.4); }
.tag-chip-3 { background: rgba(244,67,54,0.2); color: #f44336; border: 1px solid rgba(244,67,54,0.5); font-weight: 600; }

.setting-item:last-child .setting-hint {
    border-bottom: none;
}

/* ===== 设置项可点击 ===== */
.setting-item {
    cursor: pointer;
    transition: background 0.2s;
}
.setting-item:active {
    background: rgba(255,255,255,0.05);
}

/* ===== 帮助弹窗 ===== */
.help-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}
.help-modal.show {
    display: flex;
}
.help-content {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 20px;
    max-width: 400px;
    width: 100%;
    max-height: 70vh;
    overflow-y: auto;
    border: 1px solid rgba(255,255,255,0.1);
}
.help-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.help-body {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 16px;
}
.help-body p {
    margin: 6px 0;
}
.help-body b {
    color: var(--text-primary);
}

/* ===== 帮助问号按钮 ===== */
.help-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    margin-left: 6px;
    vertical-align: middle;
    user-select: none;
    transition: all 0.2s;
}
.help-btn:hover, .help-btn:active {
    background: var(--accent);
    color: #fff;
}

/* ===== 智能推荐按钮 ===== */
.setting-with-btn {
    display: flex;
    gap: 8px;
    align-items: center;
}
.setting-with-btn input {
    flex: 1;
}
.btn-smart {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
    transition: opacity 0.2s;
}
.btn-smart:active {
    opacity: 0.8;
}

/* ===== 主力资金标签 ===== */
.tag-fund-0 { background: rgba(136,136,136,0.2); color: #888; }
.tag-fund-1 { background: rgba(255,152,0,0.2); color: #ff9800; }
.tag-fund-2 { background: rgba(255,87,34,0.2); color: #ff5722; }
.tag-fund-3 { background: rgba(244,67,54,0.2); color: #f44336; }

/* ===== 主力资金详情 ===== */
.fund-note {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 8px;
    padding: 6px 10px;
    background: rgba(255,255,255,0.03);
    border-radius: 6px;
}

/* ===== 选股模式切换 ===== */
.mode-switch {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    background: rgba(255,255,255,0.05);
    padding: 4px;
    border-radius: 10px;
}
.mode-btn {
    flex: 1;
    padding: 10px 4px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    text-align: center;
}
.mode-btn.active {
    background: var(--accent);
    color: #fff;
}

/* ===== 设置项说明文字 ===== */
.setting-desc {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
    line-height: 1.4;
}

/* ===== K线走势图 ===== */
.kline-chart {
    display: flex;
    align-items: stretch;
    height: 120px;
    gap: 2px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.kline-bar {
    flex: 1;
    position: relative;
    min-width: 4px;
}
.kline-wick {
    position: absolute;
    width: 1px;
    left: 50%;
    transform: translateX(-50%);
}
.kline-body {
    position: absolute;
    width: 60%;
    left: 20%;
    min-height: 1px;
}
.kline-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-muted);
    padding: 4px 0;
}

/* ===== 选股历史 ===== */
.history-item {
    padding: 10px;
    margin-bottom: 8px;
    background: rgba(255,255,255,0.03);
    border-radius: 8px;
}
.history-time {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.history-stocks {
    font-size: 12px;
    line-height: 1.8;
}
.history-stock {
    display: inline-block;
    margin-right: 8px;
    color: var(--text-secondary);
}

/* ===== 取消按钮 ===== */
.scan-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
}
.btn-cancel {
    background: rgba(244,67,54,0.2);
    color: #f44336;
    border: 1px solid #f44336;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
}

/* ===== 数据时间 ===== */
.data-time {
    font-size: 11px;
    color: var(--text-muted);
    text-align: right;
    padding: 4px 12px;
}

/* ===== 自选股编辑 ===== */
.fav-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
#favEditBar {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    padding: 10px;
    background: rgba(255,255,255,0.05);
    border-radius: 8px;
}
.fav-checkbox {
    width: 20px;
    height: 20px;
    margin-right: 10px;
    accent-color: var(--accent);
}
.btn-danger {
    background: rgba(244,67,54,0.2);
    color: #f44336;
    border: 1px solid #f44336;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
}

/* ===== 设置分组折叠 ===== */
.settings-title {
    cursor: pointer;
    user-select: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.group-arrow {
    font-size: 10px;
    color: var(--text-muted);
    transition: transform 0.2s;
}

/* ===== 大盘行情条 ===== */
.market-bar {
    display: flex;
    align-items: center;
    background: var(--card-bg);
    border-radius: 10px;
    padding: 10px 8px;
    margin-bottom: 10px;
    gap: 4px;
}
.market-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    padding: 4px 2px;
    border-radius: 6px;
    transition: background 0.2s;
}
.market-item:active {
    background: rgba(255,255,255,0.05);
}
.market-name {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 2px;
}
.market-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}
.market-change {
    font-size: 11px;
    font-weight: 500;
    margin-top: 1px;
}
.market-change.up { color: var(--up-color); }
.market-change.down { color: var(--down-color); }
.market-refresh {
    flex: 0 0 32px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== 重大消息提醒 ===== */
.news-alert {
    display: flex;
    align-items: flex-start;
    background: linear-gradient(135deg, rgba(255,107,107,0.15), rgba(255,107,107,0.05));
    border: 1px solid rgba(255,107,107,0.3);
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 10px;
    gap: 8px;
}
.news-alert-icon {
    color: #ff6b6b;
    flex-shrink: 0;
    margin-top: 1px;
}
.news-alert-content {
    flex: 1;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
}
.news-alert-content .news-time {
    color: var(--text-muted);
    font-size: 10px;
    margin-right: 6px;
}
.news-alert-content .news-tag {
    display: inline-block;
    background: rgba(255,107,107,0.2);
    color: #ff6b6b;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 10px;
    margin-right: 6px;
}

/* ===== 全盘资金面板 ===== */
.fund-panel {
    background: var(--card-bg);
    border-radius: 10px;
    margin: 8px 12px;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
}
.fund-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.fund-panel-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}
.fund-panel-refresh {
    color: var(--text-secondary);
    cursor: pointer;
    padding: 2px;
}
.fund-panel-refresh:active {
    opacity: 0.6;
}
.fund-summary {
    display: flex;
    justify-content: space-around;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}
.fund-summary-item {
    text-align: center;
}
.fund-summary-label {
    font-size: 10px;
    color: var(--text-secondary);
    margin-bottom: 2px;
}
.fund-summary-value {
    font-size: 14px;
    font-weight: 600;
}
.fund-summary-value.up { color: #ff4d4f; }
.fund-summary-value.down { color: #52c41a; }
.fund-sector-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.fund-sector-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
}
.fund-sector-name {
    color: var(--text-primary);
    flex-shrink: 0;
    width: 60px;
}
.fund-sector-bar-wrap {
    flex: 1;
    height: 6px;
    background: var(--bg-dark);
    border-radius: 3px;
    margin: 0 8px;
    overflow: hidden;
}
.fund-sector-bar {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s;
}
.fund-sector-bar.inflow { background: linear-gradient(90deg, #ff4d4f, #ff7875); }
.fund-sector-bar.outflow { background: linear-gradient(90deg, #52c41a, #73d13d); }
.fund-sector-value {
    font-size: 11px;
    font-weight: 500;
    width: 55px;
    text-align: right;
    flex-shrink: 0;
}
.fund-loading {
    text-align: center;
    color: var(--text-secondary);
    font-size: 12px;
    padding: 10px 0;
}

/* ===== 涨跌平股数统计 ===== */
.market-breadth {
    display: flex;
    justify-content: space-around;
    align-items: center;
    background: var(--card-bg);
    border-radius: 10px;
    margin: 8px 12px;
    padding: 12px 8px;
    border: 1px solid var(--border-color);
}
.breadth-item {
    text-align: center;
    flex: 1;
}
.breadth-value {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 2px;
}
.breadth-item.up .breadth-value { color: #ff4d4f; }
.breadth-item.down .breadth-value { color: #52c41a; }
.breadth-item.flat .breadth-value { color: #faad14; }
.breadth-item.ratio .breadth-value { color: var(--text-primary); font-size: 16px; }
.breadth-label {
    font-size: 11px;
    color: var(--text-secondary);
}

/* ===== 自选自动检测 ===== */
.fav-auto-check {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--card-bg);
    border-radius: 8px;
    margin-bottom: 10px;
}
.switch-inline {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
    flex-shrink: 0;
}
.switch-inline input {
    opacity: 0;
    width: 0;
    height: 0;
}
.switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #444;
    transition: .3s;
    border-radius: 20px;
}
.switch-slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}
.switch-inline input:checked + .switch-slider {
    background-color: var(--accent);
}
.switch-inline input:checked + .switch-slider:before {
    transform: translateX(16px);
}
.auto-check-label {
    font-size: 12px;
    color: var(--text-secondary);
    flex: 1;
}
.auto-check-status {
    font-size: 11px;
    color: var(--text-muted);
}

/* ===== 机构动向样式 ===== */
.inst-score-box {
    background: rgba(233, 69, 96, 0.05);
    border-radius: 8px;
    padding: 12px;
    text-align: center;
    margin-bottom: 8px;
}
.inst-score {
    font-size: 32px;
    font-weight: bold;
}
.inst-label {
    font-size: 14px;
    margin-top: 4px;
}
.inst-details {
    margin-bottom: 8px;
}
.inst-detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    font-size: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.inst-detail-item:last-child {
    border-bottom: none;
}
.inst-summary {
    background: rgba(233, 69, 96, 0.05);
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 8px;
}
.inst-summary-date {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.holder-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.holder-item {
    background: var(--card-bg);
    border-radius: 6px;
    padding: 8px 10px;
    border-left: 3px solid var(--accent);
}
.holder-name {
    font-size: 12px;
    color: var(--text-primary);
    margin-bottom: 4px;
    line-height: 1.3;
}
.holder-info {
    display: flex;
    gap: 10px;
    font-size: 11px;
    flex-wrap: wrap;
}
.holder-type {
    color: var(--text-secondary);
    background: rgba(255,255,255,0.05);
    padding: 1px 6px;
    border-radius: 3px;
}
.holder-ratio {
    color: var(--accent);
    font-weight: bold;
}
.holder-change {
    font-weight: bold;
}

/* ===== iOS PWA 安全区域适配 ===== */
@supports (padding: max(0px)) {
    .app-header {
        padding-top: max(12px, env(safe-area-inset-top));
        padding-left: max(12px, env(safe-area-inset-left));
        padding-right: max(12px, env(safe-area-inset-right));
    }
    .app-nav {
        padding-bottom: max(8px, env(safe-area-inset-bottom));
        padding-left: max(0px, env(safe-area-inset-left));
        padding-right: max(0px, env(safe-area-inset-right));
    }
    .app-main {
        padding-left: max(0px, env(safe-area-inset-left));
        padding-right: max(0px, env(safe-area-inset-right));
        padding-bottom: max(0px, env(safe-area-inset-bottom));
    }
}

/* iOS PWA 全屏模式下禁止长按选中 */
* {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}
input, textarea {
    -webkit-user-select: text;
    user-select: text;
}
