/* ===== 鸿蒙/iOS 风格美化 - T+1选股系统 ===== */
/* 基于stock-backtest的style-harmony.css */

/* ===== 全局样式 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===== 颜色主题变量 ===== */
:root {
    /* 浅色主题（默认） */
    --bg-primary: linear-gradient(135deg, #f5f7fa 0%, #e4e8ec 100%);
    --bg-card: rgba(255, 255, 255, 0.8);
    --bg-card-inner: rgba(255, 255, 255, 0.9);
    --bg-input: rgba(255, 255, 255, 0.9);
    --bg-param-section: rgba(245, 247, 250, 0.5);
    --bg-table-header: rgba(0, 122, 255, 0.05);
    --bg-table-row-hover: rgba(0, 122, 255, 0.04);
    --bg-btn-secondary: rgba(0, 0, 0, 0.05);
    --bg-status-info: rgba(0, 122, 255, 0.08);
    --bg-status-success: rgba(48, 209, 88, 0.08);
    --bg-status-error: rgba(255, 59, 48, 0.08);
    --bg-progress: rgba(0, 0, 0, 0.06);

    --text-primary: #1d1d1f;
    --text-secondary: #86868b;
    --text-muted: #8b949e;
    --text-link: #007aff;

    --border-color: rgba(0, 0, 0, 0.1);
    --border-light: rgba(0, 0, 0, 0.06);
    --border-card: rgba(255, 255, 255, 0.9);

    --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.04);
    --shadow-card-hover: 0 8px 30px rgba(0, 0, 0, 0.08), 0 2px 6px rgba(0, 0, 0, 0.06);
    --shadow-banner: 0 8px 24px rgba(255, 159, 10, 0.3);
    --shadow-table: 0 2px 12px rgba(0, 0, 0, 0.04);
    --shadow-progress: inset 0 1px 3px rgba(0, 0, 0, 0.1);

    --color-profit: #34c759;
    --color-loss: #ff3b30;
    --color-primary: #007aff;
    --color-primary-dark: #0056cc;

    --banner-gradient: linear-gradient(135deg, #ff9f0a 0%, #ffcc00 100%);
}

/* ===== 深色主题 ===== */
body.dark-theme {
    --bg-primary: linear-gradient(135deg, #0f0f11 0%, #1a1a1e 100%);
    --bg-card: rgba(28, 28, 30, 0.95);
    --bg-card-inner: rgba(44, 44, 46, 0.95);
    --bg-input: rgba(44, 44, 46, 0.95);
    --bg-param-section: rgba(28, 28, 30, 0.7);
    --bg-table-header: rgba(0, 122, 255, 0.1);
    --bg-table-row-hover: rgba(0, 122, 255, 0.08);
    --bg-btn-secondary: rgba(255, 255, 255, 0.05);
    --bg-status-info: rgba(0, 122, 255, 0.12);
    --bg-status-success: rgba(48, 209, 88, 0.12);
    --bg-status-error: rgba(255, 59, 48, 0.12);
    --bg-progress: rgba(255, 255, 255, 0.06);

    --text-primary: #f5f5f7;
    --text-secondary: #a1a1a6;
    --text-muted: #8e8e93;
    --text-link: #0a84ff;

    --border-color: rgba(255, 255, 255, 0.1);
    --border-light: rgba(255, 255, 255, 0.06);
    --border-card: rgba(255, 255, 255, 0.08);

    --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.4), 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-card-hover: 0 8px 30px rgba(0, 0, 0, 0.5), 0 2px 6px rgba(0, 0, 0, 0.4);
    --shadow-banner: 0 8px 24px rgba(255, 159, 10, 0.4);
    --shadow-table: 0 2px 12px rgba(0, 0, 0, 0.3);
    --shadow-progress: inset 0 1px 3px rgba(0, 0, 0, 0.3);

    --color-profit: #30d158;
    --color-loss: #ff453a;
    --color-primary: #0a84ff;
    --color-primary-dark: #0056cc;

    --banner-gradient: linear-gradient(135deg, #ff9f0a 0%, #ffcc00 100%);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    transition: background 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* ===== 头部 ===== */
.banner {
    text-align: center;
    padding: 16px 0 14px;
    margin-bottom: 14px;
    border-radius: 20px;
    background: var(--banner-gradient);
    color: white;
    box-shadow: var(--shadow-banner);
    position: relative;
    overflow: hidden;
}

.banner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="50" cy="50" r="40" fill="none" stroke="rgba(255,255,255,0.1)" stroke-width="0.5"/></svg>') center/200px;
    opacity: 0.3;
}

.banner h1 {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.5px;
    position: relative;
    z-index: 1;
}

.banner h1::before {
    content: '🎯 ';
    margin-right: 8px;
}

/* ===== 主题切换按钮 ===== */
.theme-toggle {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    right: 8px;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    font-size: 20px;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 10;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

body.dark-theme .theme-toggle {
    background: rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark-theme .theme-toggle:hover {
    background: rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.2);
}

/* ===== 面板通用样式 ===== */
.panel {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-card);
    border-radius: 20px;
    padding: 16px;
    margin-bottom: 14px;
    box-shadow: var(--shadow-card);
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), box-shadow 0.3s ease, background 0.3s ease;
}

.panel:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-card-hover);
}

.panel h2 {
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel h2::before {
    content: '';
    width: 4px;
    height: 18px;
    background: linear-gradient(180deg, #007aff, #58a6ff);
    border-radius: 2px;
}

/* ===== 参数分区样式 ===== */
.param-section {
    background: var(--bg-param-section);
    border: 1px solid var(--border-card);
    border-radius: 16px;
    padding: 14px;
    margin-bottom: 10px;
}

.param-section h3 {
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 6px;
}

.param-section h3::before {
    content: '⚙️';
    font-size: 14px;
}

/* ===== 参数配置网格 ===== */
.params-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 12px;
}

.param-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.param-group label {
    font-size: 12px;
    color: #555559;
    font-weight: 600;
    letter-spacing: 0.2px;
}

body.dark-theme .param-group label {
    color: #d1d1d6;
}

.param-group input,
.param-group select {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    padding: 8px 12px;
    color: #1d1d1f;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
    outline: none;
}

.param-group input:focus,
.param-group select:focus {
    border-color: #007aff;
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.1);
    transform: scale(1.01);
}

body.dark-theme .param-group input,
body.dark-theme .param-group select {
    background: rgba(44, 44, 46, 0.95);
    color: #f5f5f7;
    border-color: rgba(255, 255, 255, 0.1);
}

.param-group .hint {
    font-size: 11px;
    color: #86868b;
    margin-top: 2px;
    line-height: 1.4;
}

/* ===== 按钮组 ===== */
.btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-light);
    align-items: center;
}

.action-buttons {
    margin-top: 6px;
}

/* ===== 参数预设 ===== */
.param-preset {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-right: auto;
}

.param-preset label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
}

.param-preset select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 13px;
    background: var(--bg-input);
    color: var(--text-primary);
    min-width: 120px;
    cursor: pointer;
}

.param-preset select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15);
}

/* ===== 模态框 ===== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 24px;
    min-width: 360px;
    max-width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.modal-content h3 {
    margin: 0 0 16px 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.modal-body label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.modal-body select,
.modal-body input {
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    background: var(--bg-input);
    color: var(--text-primary);
}

.modal-body select:focus,
.modal-body input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.modal-footer .btn {
    padding: 10px 20px;
    font-size: 13px;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    letter-spacing: 0.2px;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--color-primary-dark) 0%, #003d99 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 122, 255, 0.4);
}

.btn-primary:disabled {
    background: rgba(0, 0, 0, 0.1);
    color: var(--text-muted);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ===== 彩色按钮系列 ===== */
.btn-compare {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}
.btn-compare:hover {
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(139, 92, 246, 0.4);
}
.btn-compare:disabled {
    background: rgba(0, 0, 0, 0.1);
    color: var(--text-muted);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-cache {
    background: linear-gradient(135deg, #14b8a6 0%, #0d9488 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(20, 184, 166, 0.3);
}
.btn-cache:hover {
    background: linear-gradient(135deg, #0d9488 0%, #0f766e 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(20, 184, 166, 0.4);
}
.btn-cache:disabled {
    background: rgba(0, 0, 0, 0.1);
    color: var(--text-muted);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-import {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}
.btn-import:hover {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(245, 158, 11, 0.4);
}
.btn-import:disabled {
    background: rgba(0, 0, 0, 0.1);
    color: var(--text-muted);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-manage {
    background: linear-gradient(135deg, #f43f5e 0%, #e11d48 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(244, 63, 94, 0.3);
}
.btn-manage:hover {
    background: linear-gradient(135deg, #e11d48 0%, #be123c 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(244, 63, 94, 0.4);
}
.btn-manage:disabled {
    background: rgba(0, 0, 0, 0.1);
    color: var(--text-muted);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

body.dark-theme .btn-compare {
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.2);
}
body.dark-theme .btn-cache {
    box-shadow: 0 4px 12px rgba(20, 184, 166, 0.2);
}
body.dark-theme .btn-import {
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.2);
}
body.dark-theme .btn-manage {
    box-shadow: 0 4px 12px rgba(244, 63, 94, 0.2);
}

/* ===== 状态栏 ===== */
.status-bar {
    margin-top: 16px;
    padding: 14px 18px;
    border-radius: 12px;
    font-size: 14px;
    display: none;
    animation: slideIn 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.status-bar.info {
    display: block;
    background: var(--bg-status-info);
    border: 1px solid rgba(0, 122, 255, 0.2);
    color: var(--color-primary);
}

.status-bar.success {
    display: block;
    background: var(--bg-status-success);
    border: 1px solid rgba(48, 209, 88, 0.2);
    color: var(--color-profit);
}

.status-bar.error {
    display: block;
    background: var(--bg-status-error);
    border: 1px solid rgba(255, 59, 48, 0.2);
    color: var(--color-loss);
}

/* ===== 进度条 ===== */
.progress-bar {
    margin-top: 16px;
    height: 8px;
    background: var(--bg-progress);
    border-radius: 4px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-progress);
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--color-primary), #58a6ff);
    border-radius: 4px;
    transition: width 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 122, 255, 0.3);
}

body.dark-theme .progress-fill {
    box-shadow: 0 2px 8px rgba(10, 132, 255, 0.4);
}

.progress-text {
    position: absolute;
    top: -24px;
    right: 0;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

/* ===== 结果信息 ===== */
.result-info {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    padding: 12px 16px;
    background: var(--bg-param-section);
    border-radius: 12px;
    border: 1px solid var(--border-light);
}

/* ===== 结果表格 ===== */
.table-wrapper {
    overflow-x: auto;
    border-radius: 16px;
    border: 1px solid var(--border-light);
    background: var(--bg-card-inner);
    box-shadow: var(--shadow-table);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

thead {
    background: var(--bg-table-header);
    position: sticky;
    top: 0;
    z-index: 1;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

th {
    padding: 14px 12px;
    text-align: right;
    color: var(--text-primary);
    font-weight: 600;
    border-bottom: 1px solid var(--border-light);
    white-space: nowrap;
    font-size: 12px;
    letter-spacing: 0.2px;
}

th:first-child,
th:nth-child(2),
th:nth-child(3),
th:nth-child(4) {
    text-align: center;
}

td {
    padding: 12px;
    text-align: right;
    border-bottom: 1px solid var(--border-light);
    white-space: nowrap;
    transition: background 0.2s;
}

td:first-child,
td:nth-child(2),
td:nth-child(3),
td:nth-child(4) {
    text-align: center;
}

tbody tr:hover {
    background: var(--bg-table-row-hover);
}

/* ===== 档位颜色 ===== */
.tier-1 { color: var(--color-profit); font-weight: 700; }
.tier-2 { color: #ff9500; font-weight: 700; }
.tier-3 { color: var(--color-loss); font-weight: 700; }

/* ===== 载入动画 ===== */
.loading {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(0, 122, 255, 0.2);
    border-radius: 50%;
    border-top-color: #007aff;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
    margin-right: 8px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    .container {
        padding: 12px;
        margin: 0;
    }

    .banner {
        border-radius: 16px;
        padding: 20px 16px;
    }

    .banner h1 {
        font-size: 20px;
    }

    .panel {
        border-radius: 16px;
        padding: 18px;
        margin-bottom: 16px;
    }

    .params-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .btn-group {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }
}

/* ===== 平滑滚动 ===== */
html {
    scroll-behavior: smooth;
}

/* ===== 数字输入美化 ===== */
.param-group input[type="number"]::-webkit-inner-spin-button,
.param-group input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.param-group input[type="number"] {
    -moz-appearance: textfield;
}

/* ===== 板块筛选复选框 ===== */
.board-filter-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.board-filter-group > label {
    margin: 0;
    white-space: nowrap;
}

.checkbox-row {
    display: flex;
    gap: 12px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    user-select: none;
}

.checkbox-item input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: var(--color-primary);
    cursor: pointer;
}

/* ===== 多组对比 - 预设复选框 ===== */
.comparison-preset {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-right: auto;
    flex-wrap: wrap;
}

.comparison-preset > label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
    margin-top: 4px;
}

.comparison-preset-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.comparison-preset-item {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: var(--bg-param-section);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
}

.comparison-preset-item:hover {
    border-color: var(--color-primary);
    background: rgba(0, 122, 255, 0.05);
}

.comparison-preset-item input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: var(--color-primary);
    cursor: pointer;
}

.comparison-empty {
    font-size: 12px;
    color: var(--text-muted);
    font-style: italic;
}

/* ===== 多组对比 - 结果面板 ===== */
.comparison-summary {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    padding: 12px 16px;
    background: var(--bg-param-section);
    border-radius: 12px;
    border: 1px solid var(--border-light);
    line-height: 1.8;
}

.comparison-summary strong {
    color: var(--color-primary);
    font-size: 16px;
}

.comparison-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.comparison-details-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    background: var(--bg-param-section);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 12px;
}

.comparison-details-toggle:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.comparison-detail-list {
    margin-top: 12px;
    display: none;
}

.comparison-detail-list.visible {
    display: block;
}

.comparison-detail-preset {
    margin-bottom: 12px;
    padding: 10px 14px;
    background: var(--bg-param-section);
    border-radius: 10px;
    border: 1px solid var(--border-light);
}

.comparison-detail-preset h4 {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.comparison-detail-preset .count-badge {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    background: rgba(0, 122, 255, 0.1);
    color: var(--color-primary);
    margin-left: 6px;
}

/* ===== 打印优化 ===== */
@media print {
    .btn-group, .btn {
        display: none;
    }

    body {
        background: white;
        color: black;
    }

    .panel {
        box-shadow: none;
        border: 1px solid #ccc;
    }
}

/* ===== 设备切换按钮 ===== */
.device-toggle {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    font-size: 20px;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 10;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.device-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

body.dark-theme .device-toggle {
    background: rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark-theme .device-toggle:hover {
    background: rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.2);
}

/* ===== 强制手机端视图 ===== */
body.mobile-view {
    font-size: 12px;
}

body.mobile-view .container {
    padding: 8px;
    max-width: 100%;
}

body.mobile-view .banner {
    padding: 8px 80px 8px 8px;
    font-size: 14px;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    position: relative;
    height: auto;
}

body.mobile-view .banner h1 {
    font-size: 16px;
}

body.mobile-view .theme-toggle {
    position: absolute;
    top: 6px;
    right: 6px;
    padding: 4px 8px;
    font-size: 14px;
}

body.mobile-view .device-toggle {
    position: absolute;
    top: 6px;
    right: 44px;
    padding: 4px 8px;
    font-size: 14px;
}

body.mobile-view .panel {
    padding: 8px;
    margin-bottom: 8px;
}

body.mobile-view .panel h3 {
    font-size: 13px;
    padding: 4px 8px;
    margin-bottom: 8px;
}

body.mobile-view .param-section h3 {
    font-size: 12px;
}

body.mobile-view .params-grid {
    grid-template-columns: 1fr;
    gap: 8px;
}

body.mobile-view .param-group {
    padding: 4px 6px;
}

body.mobile-view .param-group label {
    font-size: 11px;
    margin-bottom: 2px;
}

body.mobile-view .param-group input[type="text"],
body.mobile-view .param-group input[type="number"] {
    padding: 4px 6px;
    font-size: 11px;
}

body.mobile-view .param-group .hint {
    font-size: 9px;
}

body.mobile-view .checkbox-row {
    gap: 6px;
}

body.mobile-view .checkbox-item {
    font-size: 10px;
}

body.mobile-view .actions {
    padding: 6px;
    gap: 6px;
}

body.mobile-view .btn-primary,
body.mobile-view .btn-secondary {
    padding: 6px 12px;
    font-size: 11px;
    flex: 1 1 auto;
}

body.mobile-view .stats-bar {
    padding: 6px 8px;
    font-size: 10px;
    flex-wrap: wrap;
    gap: 6px;
}

body.mobile-view .stats-item {
    padding: 2px 6px;
}

body.mobile-view .results-container {
    margin-top: 8px;
    padding: 6px;
}

body.mobile-view .results-header {
    font-size: 12px;
    padding: 4px 6px;
    margin-bottom: 6px;
}

body.mobile-view .results-table {
    font-size: 10px;
}

body.mobile-view .results-table th,
body.mobile-view .results-table td {
    padding: 3px 2px;
    white-space: nowrap;
}

body.mobile-view .results-table th:nth-child(4),
body.mobile-view .results-table td:nth-child(4),
body.mobile-view .results-table th:nth-child(5),
body.mobile-view .results-table td:nth-child(5),
body.mobile-view .results-table th:nth-child(6),
body.mobile-view .results-table td:nth-child(6),
body.mobile-view .results-table th:nth-child(7),
body.mobile-view .results-table td:nth-child(7),
body.mobile-view .results-table th:nth-child(12),
body.mobile-view .results-table td:nth-child(12) {
    display: none;
}

body.mobile-view .progress-container {
    padding: 6px;
}

body.mobile-view .progress-text {
    font-size: 10px;
}

body.mobile-view .progress-bar {
    height: 8px;
}

body.mobile-view .modal-content {
    padding: 8px;
    margin: 8px;
    max-width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
}

body.mobile-view .modal-title {
    font-size: 13px;
    padding: 6px 8px;
    margin-bottom: 6px;
}

body.mobile-view .modal-close {
    font-size: 18px;
    padding: 2px 8px;
}

body.mobile-view .history-section {
    padding: 6px;
    margin-top: 8px;
}

body.mobile-view .history-header {
    font-size: 12px;
    padding: 4px 6px;
    margin-bottom: 6px;
}

body.mobile-view .history-list {
    font-size: 10px;
    max-height: 150px;
}

body.mobile-view .history-item {
    padding: 4px 6px;
    flex-wrap: wrap;
    gap: 4px;
}

/* ===== 导入/导出模态框 ===== */
.import-export-section {
    padding: 12px;
    background: var(--bg-param-section);
    border-radius: 8px;
}

.import-export-section h4 {
    font-size: 14px;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.import-export-section .btn {
    margin-top: 8px;
    width: 100%;
}

/* 移动端适配 */
@media (max-width: 600px) {
    .btn-group {
        flex-direction: column;
        gap: 6px;
    }
    
    .btn-group .btn {
        width: 100%;
    }
}

/* ===== 管理预设列表 ===== */
.presets-list {
    max-height: 300px;
    overflow-y: auto;
}

.preset-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--bg-param-section);
    border-radius: 8px;
    margin-bottom: 8px;
}

.preset-item .preset-name {
    flex: 1;
    font-size: 14px;
    color: var(--text-primary);
    cursor: text;
    padding: 2px 4px;
    border-radius: 4px;
    border: 1px solid transparent;
}

.preset-item .preset-name:hover {
    border-color: var(--border-color);
    background: var(--bg-card);
}

.preset-item .preset-name:focus {
    border-color: var(--color-primary);
    outline: none;
    background: var(--bg-card);
}

.preset-item .btn-delete {
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    padding: 4px 8px;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.preset-item .btn-delete:hover {
    opacity: 1;
}