/* =========================================================
   双色球实战控制台 - 高级现代化排版 (清爽舒朗版)
   ========================================================= */

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --red-ball: #ef4444;
    --blue-ball: #3b82f6;
    --bg-color: #f1f5f9;       /* 更柔和的全局背景色 */
    --card-bg: #ffffff;
    --text-main: #334155;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    padding: 30px 20px;
    line-height: 1.6;
}

.container {
    max-width: 1300px; /* 稍微拓宽，防止拥挤 */
    margin: 0 auto;
}

/* ================== 顶部主控栏 ================== */
.master-toolbar {
    background: var(--card-bg);
    padding: 20px 30px;
    border-radius: 16px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05); /* 更柔和立体的阴影 */
    display: flex;
    flex-wrap: wrap;
    gap: 25px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 30px;
    position: sticky;
    top: 10px;
    z-index: 100;
    border: 1px solid var(--border-color);
    backdrop-filter: blur(10px); /* 滚动时的毛玻璃效果 */
}

.tool-group {
    display: flex;
    gap: 18px;
    align-items: center;
    flex-wrap: wrap;
}

.brand {
    font-size: 20px;
    font-weight: 800;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 10px;
    border-right: 2px solid var(--border-color);
    padding-right: 25px;
    letter-spacing: 0.5px;
}

.official-tag {
    background: #10b981;
    color: white;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    vertical-align: middle;
}

/* ================== 按钮与表单控件 ================== */
.action-btn {
    cursor: pointer;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 10px -1px rgba(0,0,0,0.15);
}

.action-btn:active {
    transform: translateY(0);
}

.btn-blue { background-color: var(--primary); }
.btn-red { background-color: var(--red-ball); }
.btn-dark { background-color: #475569; }

.toggle-switch {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    background: #f8fafc;
    padding: 8px 15px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    cursor: pointer;
    transition: background 0.2s;
}

.toggle-switch:hover {
    background: #f1f5f9;
}

.toggle-switch input {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary);
}

/* ================== 标签页切换 ================== */
.tabs-header {
    display: flex;
    gap: 12px;
    margin-bottom: 25px;
}

.tab-btn {
    padding: 14px 28px;
    font-size: 16px;
    font-weight: bold;
    background: #e2e8f0;
    color: var(--text-muted);
    border: none;
    border-radius: 12px 12px 0 0;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.tab-btn.active {
    background: var(--card-bg);
    color: var(--primary);
    box-shadow: 0 -4px 15px rgba(0,0,0,0.03);
}

.tab-content {
    display: none;
    background: var(--card-bg);
    padding: 35px;
    border-radius: 0 16px 16px 16px;
    box-shadow: 0 10px 25px -5px rgba(0,0,0,0.05);
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ================== 矩阵分析专属样式 ================== */
.matrix-flex-container {
    display: flex;
    gap: 40px;
    flex-wrap: wrap;
    margin-bottom: 40px;
}

.matrix-col {
    flex: 1;
    min-width: 480px;
}

.matrix-col h2 {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border-color);
    color: #1e293b;
    display: flex;
    align-items: center;
}

/* 响应式表格容器 */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 10px;
}

table.matrix-table {
    border-collapse: collapse;
    width: 100%;
    font-size: 15px;
    margin-bottom: 10px;
}

table.matrix-table td, table.matrix-table th {
    padding: 12px 8px; /* 加大单元格间距 */
    text-align: center;
    border: none;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    border-radius: 6px;
}

table.matrix-table tr:hover {
    background-color: #f8fafc;
}

.col-header {
    font-weight: bold;
    color: var(--text-muted);
    transition: background 0.2s;
    min-width: 35px;
    height: 30px;
    border-radius: 6px;
}

.col-header:hover {
    background-color: #e2e8f0;
}

.row-header {
    font-weight: bold;
    text-align: left;
    padding-right: 20px;
    border-right: 2px solid #cbd5e1;
    width: 140px;
    color: #475569;
}

/* ================== 画笔工具栏 ================== */
.drawing-tools {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    padding: 15px 25px;
    border-radius: 12px;
    margin-bottom: 30px;
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

.tool-label {
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #475569;
    padding: 6px 12px;
    border-radius: 6px;
    transition: background 0.2s;
}

.tool-label:hover {
    background: #e2e8f0;
}

.tool-label input {
    margin-right: 6px;
    accent-color: var(--primary);
}

/* ================== 现状面板 ================== */
.stats-panel {
    background-color: #f8fafc;
    border: 1px solid var(--border-color);
    padding: 20px 25px;
    border-radius: 12px;
    margin-bottom: 30px;
    font-size: 14px;
    line-height: 2.0;
    word-break: break-word;
    box-shadow: 0 2px 10px rgba(0,0,0,0.02);
}

.stats-panel.alert {
    background-color: #fffbeb;
    border-left: 5px solid #f59e0b;
}

.stats-panel.success {
    background-color: #f0fdf4;
    border-left: 5px solid #10b981;
}

/* ================== 数字球视觉与状态 ================== */
.num-cell {
    transition: all 0.2s;
    position: relative;
}

.num-cell > span {
    display: inline-block;
    width: 34px; /* 增大球体 */
    height: 34px;
    line-height: 30px;
    text-align: center;
    border-radius: 50%;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-sizing: border-box;
    font-weight: bold;
    font-size: 15px; /* 增大字体 */
    pointer-events: none;
}

/* 空心状态 */
.red-matrix .num-cell:not(.highlight-bg):not(.strike-text):not(.underline-text) > span {
    background: transparent;
    color: var(--red-ball);
    border: 2px solid var(--red-ball);
}

.blue-matrix .num-cell:not(.highlight-bg):not(.strike-text):not(.underline-text) > span {
    background: transparent;
    color: var(--blue-ball);
    border: 2px solid var(--blue-ball);
}

/* 实心状态 (开出中奖号) */
.red-matrix .num-cell.win-red > span {
    background-color: var(--red-ball) !important;
    color: white !important;
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.4);
    border: none;
    line-height: 34px;
    transform: scale(1.05); /* 中奖号微微放大 */
}

.blue-matrix .num-cell.win-blue > span {
    background-color: var(--blue-ball) !important;
    color: white !important;
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.4);
    border: none;
    line-height: 34px;
    transform: scale(1.05);
}

/* 画笔标记状态 */
.highlight-bg {
    background-color: #fcd34d !important; /* 更柔和的高亮黄 */
    color: #000;
    border-radius: 6px;
    box-shadow: inset 0 0 0 1px #f59e0b;
}

.underline-text > span {
    text-decoration: underline;
    text-decoration-thickness: 3px;
    text-underline-offset: 5px;
    color: #475569;
}

.strike-text > span {
    text-decoration: line-through;
    text-decoration-thickness: 2px;
    color: #94a3b8;
    opacity: 0.6;
}

/* 重复开出次数的角标 */
.num-cell[data-freq]::after {
    content: attr(data-freq);
    position: absolute;
    top: -6px;
    right: 0px;
    background: #f59e0b;
    color: white;
    font-size: 12px;
    font-weight: 900;
    border-radius: 50%;
    min-width: 18px;
    height: 18px;
    line-height: 18px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    z-index: 5;
    pointer-events: none;
}

.strike-text[data-freq]::after, 
.row-deleted-box .num-cell[data-freq]::after, 
.col-deleted-box[data-freq]::after {
    filter: grayscale(100%);
    opacity: 0.5;
}

.mod-tag {
    font-size: 12px;
    color: #94a3b8;
    margin-left: 4px;
    font-weight: normal;
    user-select: none;
    pointer-events: none;
}

.info-cell {
    color: var(--blue-ball);
    font-weight: bold;
    border-top: 1px dashed var(--border-color);
    font-size: 14px;
    padding-top: 12px !important;
}

/* ================== 行列联动杀号视觉 ================== */
.row-highlight-bg td, .col-highlight-bg {
    background-color: #fef3c7 !important;
}

.row-deleted-box td {
    border-top: 2px dashed #fca5a5 !important;
    border-bottom: 2px dashed #fca5a5 !important;
    background-color: #fef2f2 !important;
}

.row-deleted-box td:first-child { border-left: 2px dashed #fca5a5 !important; }
.row-deleted-box td:last-child { border-right: 2px dashed #fca5a5 !important; }

.col-deleted-box {
    border-left: 2px dashed #bfdbfe !important;
    border-right: 2px dashed #bfdbfe !important;
    background-color: #eff6ff !important;
}

.col-deleted-top { border-top: 2px dashed #bfdbfe !important; }
.col-deleted-bottom { border-bottom: 2px dashed #bfdbfe !important; }

/* ================== 算法推演数据卡片 ================== */
.data-card {
    background: #fff;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    margin-bottom: 30px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.04);
}

.data-card h3 {
    background: #f8fafc;
    padding: 16px 25px;
    font-size: 16px;
    color: #1e293b;
    border-bottom: 1px solid var(--border-color);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    text-align: center;
}

table.data-table th, table.data-table td {
    padding: 12px 15px; /* 加大数据表间距 */
    border-bottom: 1px solid #f1f5f9;
    border-right: 1px solid #f1f5f9;
}

table.data-table th {
    background-color: #f8fafc;
    color: #475569;
    font-weight: 600;
    white-space: nowrap;
}

table.data-table td:last-child, table.data-table th:last-child {
    border-right: none;
}

table.data-table tbody tr:hover {
    background-color: #fcfcfc;
}

table.data-table .hl-col {
    background-color: #eff6ff;
    font-weight: bold;
    color: var(--primary);
}

.badge-red {
    display: inline-block;
    background: #fee2e2;
    color: #b91c1c;
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: bold;
    font-size: 13px;
    box-shadow: 0 1px 2px rgba(185, 28, 28, 0.1);
}

.badge-gray {
    display: inline-block;
    background: #f1f5f9;
    color: #475569;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
}

.sop-panel-card {
    height: 100%;
    margin: 0;
    padding: 25px 30px;
    box-sizing: border-box;
    background: #f8fafc;
    border-left: 5px solid var(--blue-ball);
}

/* ================== 手机端深度响应式配置 ================== */
@media (max-width: 768px) {
    body { padding: 10px; }
    
    .master-toolbar { 
        flex-direction: column; 
        align-items: stretch; 
        gap: 15px; 
        padding: 15px; 
        border-radius: 12px;
    }
    
    .brand { 
        border-right: none; 
        padding-right: 0; 
        justify-content: center; 
        border-bottom: 1px solid #e2e8f0; 
        padding-bottom: 15px; 
        font-size: 18px;
    }
    
    .tool-group { 
        flex-wrap: wrap; 
        justify-content: center; 
        width: 100%; 
    }
    
    .action-btn { 
        flex: 1 1 calc(50% - 10px); 
        justify-content: center; 
        padding: 12px; 
        font-size: 14px; 
    }
    
    .tabs-header { 
        flex-wrap: wrap; 
        gap: 5px; 
        margin-bottom: 15px;
    }
    
    .tab-btn { 
        flex: 1 1 100%; 
        border-radius: 8px; 
        font-size: 16px; 
        padding: 14px; 
    }
    
    .tab-content { padding: 20px 12px; border-radius: 12px; }
    
    .matrix-col { 
        min-width: 100% !important; 
        flex: 0 0 100%; 
    }
    
    .matrix-flex-container { gap: 25px; margin-bottom: 25px;}
    
    /* 手机端触控防误触 */
    .num-cell > span { 
        width: 30px; 
        height: 30px; 
        line-height: 26px; 
        font-size: 14px; 
    }
    
    .red-matrix .num-cell.win-red > span, 
    .blue-matrix .num-cell.win-blue > span { 
        line-height: 30px; 
    }
    
    table.matrix-table td, table.matrix-table th { padding: 10px 4px; }
    .row-header { font-size: 13px; padding-right: 8px; min-width: 90px; width: auto; }
    
    .drawing-tools { flex-direction: row; justify-content: space-between; padding: 15px; gap: 10px; }
    .drawing-tools .action-btn { flex: 1 1 auto; margin-top: 5px; }
    #btn-clear-all { width: 100%; margin-left: 0 !important; margin-top: 15px; }
    
    .sop-panel-card { border-left: none; border-top: 5px solid var(--blue-ball); padding: 20px 15px; }
    .data-card h3 { font-size: 15px; padding: 12px 15px; }
    table.data-table th, table.data-table td { padding: 10px 8px; font-size: 12px; }
    
    .info-cell { font-size: 12px; }
    .mod-tag { font-size: 11px; }
    .desktop-only { display: none; }
}
