/* ==================== 基础重置 ==================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --gold: #f5c518;
    --gold-dark: #d4a017;
    --gold-light: #fde68a;
    --red: #e53e3e;
    --red-dark: #c53030;
    --blue: #3182ce;
    --blue-dark: #2b6cb0;
    --bg: #1a0a00;
    --bg2: #2d1200;
    --bg3: #3d1a00;
    --card-bg: rgba(255,255,255,0.04);
    --card-border: rgba(245,197,24,0.2);
    --text: #f5e6c8;
    --text-muted: #a08060;
    --radius: 16px;
    --shadow: 0 8px 32px rgba(0,0,0,0.4);
}

html { font-size: 16px; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    background-image:
        radial-gradient(ellipse at 20% 20%, rgba(213,160,23,0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(229,62,62,0.06) 0%, transparent 50%);
}

/* ==================== 顶部 Header ==================== */
.header {
    background: linear-gradient(135deg, #2d1200 0%, #1a0a00 50%, #2d0a0a 100%);
    border-bottom: 2px solid var(--gold-dark);
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

.header-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
}

.logo { display: flex; align-items: center; gap: 14px; }

.logo-icon {
    font-size: 2.2rem;
    filter: drop-shadow(0 0 8px rgba(245,197,24,0.6));
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

.logo-text h1 {
    font-size: 1.4rem;
    font-weight: 800;
    background: linear-gradient(90deg, var(--gold), #fff8e1, var(--gold));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 1px;
}

.logo-text p {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.header-badge {
    background: linear-gradient(135deg, var(--red), var(--red-dark));
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 20px;
    letter-spacing: 2px;
    box-shadow: 0 2px 8px rgba(229,62,62,0.4);
}

/* ==================== 主容器 ==================== */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px 16px 40px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ==================== 卡片 ==================== */
.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 24px;
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow);
    transition: border-color 0.3s;
}

.card:hover { border-color: rgba(245,197,24,0.4); }

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(245,197,24,0.15);
}

.card-header h2 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--gold);
}

.card-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* ==================== 预测区域 ==================== */
.predict-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.count-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.count-selector label {
    font-size: 0.9rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.count-btns { display: flex; gap: 6px; flex-wrap: wrap; }

.count-btn {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(245,197,24,0.25);
    color: var(--text);
    padding: 6px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.count-btn:hover { background: rgba(245,197,24,0.15); border-color: var(--gold); }

.count-btn.active {
    background: linear-gradient(135deg, var(--gold-dark), var(--gold));
    border-color: var(--gold);
    color: #1a0a00;
    font-weight: 700;
}

.custom-count {
    width: 80px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(245,197,24,0.3);
    color: var(--text);
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 0.85rem;
    text-align: center;
}

.custom-count:focus { outline: none; border-color: var(--gold); }

.btn-predict {
    background: linear-gradient(135deg, var(--red), #c53030);
    color: #fff;
    border: none;
    padding: 12px 28px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    box-shadow: 0 4px 16px rgba(229,62,62,0.4);
    letter-spacing: 1px;
}

.btn-predict:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(229,62,62,0.5);
}

.btn-predict:active { transform: translateY(0); }
.btn-predict:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.btn-icon { font-size: 1.1rem; }
.btn-icon.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ==================== 预测结果 ==================== */
.predict-result {
    border-top: 1px solid rgba(245,197,24,0.15);
    padding-top: 20px;
    animation: fadeIn 0.4s ease;
}

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

.result-meta {
    display: flex;
    gap: 20px;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 14px;
}

.result-list { display: flex; flex-direction: column; gap: 12px; }

.result-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(245,197,24,0.1);
    border-radius: 12px;
    transition: border-color 0.2s;
}

.result-row:hover { border-color: rgba(245,197,24,0.3); }

.row-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
    min-width: 50px;
}

/* ==================== 号码球 ==================== */
.balls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex: 1;
    align-items: center;
}

.balls-sm { gap: 6px; }

/* 红球 - 前区 1-35 */
.ball.red {
    background: radial-gradient(circle at 35% 35%, #fc8181, var(--red-dark));
    color: #fff;
    box-shadow: 0 3px 10px rgba(229,62,62,0.5), inset 0 1px 2px rgba(255,255,255,0.3);
}

/* 蓝球 - 后区 1-12 */
.ball.blue {
    background: radial-gradient(circle at 35% 35%, #63b3ed, var(--blue-dark));
    color: #fff;
    box-shadow: 0 3px 10px rgba(49,130,206,0.5), inset 0 1px 2px rgba(255,255,255,0.3);
}

.ball {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 800;
    cursor: default;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.ball:hover { transform: scale(1.1); }

.balls-sm .ball {
    width: 34px;
    height: 34px;
    font-size: 0.78rem;
}

/* 热冷号 */
.ball-hot {
    background: radial-gradient(circle at 35% 35%, #fc8181, var(--red-dark));
    color: #fff;
    box-shadow: 0 2px 8px rgba(229,62,62,0.5);
}

.ball-cold {
    background: radial-gradient(circle at 35% 35%, #90cdf4, var(--blue-dark));
    color: #fff;
    box-shadow: 0 2px 8px rgba(49,130,206,0.4);
}

.btn-copy {
    background: none;
    border: 1px solid rgba(245,197,24,0.2);
    color: var(--text-muted);
    padding: 6px 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
    flex-shrink: 0;
}

.btn-copy:hover { border-color: var(--gold); color: var(--gold); }

/* ==================== 两列布局 ==================== */
.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* ==================== 历史记录 ==================== */
.btn-sm {
    background: linear-gradient(135deg, var(--gold-dark), var(--gold));
    color: #1a0a00;
    border: none;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-sm:hover { transform: translateY(-1px); box-shadow: 0 3px 10px rgba(245,197,24,0.4); }

.add-form {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(245,197,24,0.15);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    animation: fadeIn 0.3s ease;
}

.form-row { margin-bottom: 10px; }
.form-row:last-child { margin-bottom: 0; }

.form-input {
    width: 100%;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(245,197,24,0.2);
    color: var(--text);
    padding: 9px 12px;
    border-radius: 8px;
    font-size: 0.88rem;
}

.form-input:focus { outline: none; border-color: var(--gold); }
.form-input::placeholder { color: var(--text-muted); }

.form-actions { display: flex; gap: 10px; }

.btn-primary {
    background: linear-gradient(135deg, var(--red), var(--red-dark));
    color: #fff;
    border: none;
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 3px 10px rgba(229,62,62,0.4); }

.btn-ghost {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.15);
    color: var(--text-muted);
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 0.88rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-ghost:hover { border-color: rgba(255,255,255,0.3); color: var(--text); }

.history-list {
    max-height: 420px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.history-list::-webkit-scrollbar { width: 4px; }
.history-list::-webkit-scrollbar-track { background: transparent; }
.history-list::-webkit-scrollbar-thumb { background: rgba(245,197,24,0.3); border-radius: 2px; }

.history-item {
    padding: 12px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(245,197,24,0.1);
    border-radius: 10px;
    transition: border-color 0.2s;
}

.history-item:hover { border-color: rgba(245,197,24,0.25); }

.history-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.history-period {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--gold);
}

.history-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    flex: 1;
}

.btn-del {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.2s;
}

.btn-del:hover { color: var(--red); }

.empty-tip {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 30px 0;
    line-height: 1.8;
}

/* ==================== 统计分析 ==================== */
.stat-summary {
    display: flex;
    gap: 16px;
    margin-bottom: 18px;
}

.stat-item {
    flex: 1;
    text-align: center;
    padding: 14px;
    background: rgba(245,197,24,0.06);
    border: 1px solid rgba(245,197,24,0.15);
    border-radius: 10px;
}

.stat-val {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--gold);
    line-height: 1;
}

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

.stat-section { margin-bottom: 14px; }

.stat-title {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-weight: 600;
}

.ratio-bar {
    height: 10px;
    border-radius: 5px;
    overflow: hidden;
    display: flex;
    margin-bottom: 6px;
    background: rgba(255,255,255,0.05);
}

.ratio-fill { height: 100%; transition: width 0.5s ease; }
.ratio-odd { background: linear-gradient(90deg, #f6ad55, #ed8936); }
.ratio-even { background: linear-gradient(90deg, #68d391, #38a169); }
.ratio-big { background: linear-gradient(90deg, #fc8181, #e53e3e); }
.ratio-small { background: linear-gradient(90deg, #76e4f7, #0bc5ea); }

.ratio-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.zone-bars {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    height: 80px;
}

.zone-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    height: 100%;
}

.zone-bar-wrap {
    flex: 1;
    width: 100%;
    background: rgba(255,255,255,0.05);
    border-radius: 4px;
    display: flex;
    align-items: flex-end;
    overflow: hidden;
}

.zone-bar {
    width: 100%;
    border-radius: 4px;
    min-height: 4px;
    transition: height 0.5s ease;
}

.zone-bar.zone-red {
    background: linear-gradient(180deg, var(--red), var(--red-dark));
}

.zone-bar.zone-blue {
    background: linear-gradient(180deg, var(--blue), var(--blue-dark));
}

.zone-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.4;
}

/* ==================== 热力图 ==================== */
.heatmap-grid {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 6px;
    margin-bottom: 14px;
}

/* 前区 1-35 红球热力图 */
.heatmap-cell.heatmap-red {
    background: rgba(
        calc(229 + (245 - 229) * var(--intensity)),
        calc(62 + (197 - 62) * var(--intensity)),
        calc(62 + (24 - 62) * var(--intensity)),
        calc(0.15 + 0.7 * var(--intensity))
    );
    border: 1px solid rgba(229,62,62, calc(0.1 + 0.4 * var(--intensity)));
}

/* 后区 1-12 蓝球热力图 */
.heatmap-cell.heatmap-blue {
    background: rgba(
        calc(49 + (99 - 49) * var(--intensity)),
        calc(130 + (220 - 130) * var(--intensity)),
        calc(206 + (255 - 206) * var(--intensity)),
        calc(0.15 + 0.7 * var(--intensity))
    );
    border: 1px solid rgba(49,130,206, calc(0.1 + 0.4 * var(--intensity)));
}

.heatmap-cell {
    aspect-ratio: 1;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: default;
    transition: transform 0.2s;
}

.heatmap-cell:hover { transform: scale(1.1); z-index: 1; }

.hm-num {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1;
}

.hm-cnt {
    font-size: 0.62rem;
    color: var(--text-muted);
    line-height: 1;
    margin-top: 2px;
}

.heatmap-legend {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.legend-bar {
    flex: 1;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(90deg,
        rgba(66,153,225,0.3),
        rgba(229,62,62,0.8)
    );
}

/* ==================== Toast ==================== */
.toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(30,15,0,0.95);
    border: 1px solid rgba(245,197,24,0.3);
    color: var(--text);
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 0.88rem;
    opacity: 0;
    transition: all 0.3s;
    z-index: 9999;
    white-space: nowrap;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast-error { border-color: rgba(229,62,62,0.5); }

/* ==================== Footer ==================== */
.footer {
    background: rgba(0,0,0,0.3);
    border-top: 1px solid rgba(245,197,24,0.1);
    padding: 20px;
    text-align: center;
}

.footer-inner { max-width: 1100px; margin: 0 auto; }

.disclaimer {
    font-size: 0.88rem;
    color: var(--gold);
    font-weight: 600;
    margin-bottom: 6px;
}

.footer-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ==================== 响应式 ==================== */
@media (max-width: 768px) {
    .header-inner { height: 60px; }
    .logo-text h1 { font-size: 1.1rem; }
    .logo-icon { font-size: 1.8rem; }

    .two-col { grid-template-columns: 1fr; }

    .predict-controls { flex-direction: column; align-items: flex-start; }

    .ball { width: 36px; height: 36px; font-size: 0.8rem; }
    .balls-sm .ball { width: 30px; height: 30px; font-size: 0.7rem; }

    .heatmap-grid { grid-template-columns: repeat(6, 1fr); }

    .result-row { flex-wrap: wrap; }
    .row-label { min-width: auto; }
}

@media (max-width: 480px) {
    .container { padding: 16px 12px 30px; }
    .card { padding: 16px; }
    .ball { width: 32px; height: 32px; font-size: 0.72rem; }
    .balls-sm .ball { width: 28px; height: 28px; font-size: 0.65rem; }
    .heatmap-grid { grid-template-columns: repeat(6, 1fr); gap: 4px; }
    .btn-predict { width: 100%; justify-content: center; }
}
