/* ---------- 全局样式 ---------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

body {
    background: #f5f7fb;
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    padding: 16px 12px 32px 12px;
    min-height: 100vh;
}

.container {
    max-width: 500px;
    margin: 0 auto;
    background: white;
    border-radius: 36px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    padding: 20px 16px 24px;
}

.section-title {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 12px;
    margin-top: 8px;
}

.section-title h3 {
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: 1px;
}

.red-title {
    color: #dc2626;
    background: #fee2e2;
    padding: 2px 12px;
    border-radius: 30px;
    font-size: 0.8rem;
}

.blue-title {
    color: #2563eb;
    background: #e0f2fe;
    padding: 2px 12px;
    border-radius: 30px;
    font-size: 0.8rem;
}

.note {
    font-size: 0.7rem;
    color: #6c757d;
    margin-left: auto;
}

.numbers-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 8px;
    background: #ffffff;
    border-radius: 28px;
    padding: 6px 0;
    margin-bottom: 12px;
}

.red-ball {
    aspect-ratio: 1 / 1;
    background: #fff0f0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1rem;
    color: #b91c1c;
    transition: all 0.08s linear;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    border: 1px solid #ffcdcd;
}

.blue-ball {
    aspect-ratio: 1 / 1;
    background: #eef4ff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1rem;
    color: #1e40af;
    transition: all 0.08s linear;
    border: 1px solid #bdd3ff;
}

.red-ball.highlight {
    background: #dc2626;
    color: white;
    box-shadow: 0 4px 8px rgba(220,38,38,0.3);
    transform: scale(1.02);
    border-color: #dc2626;
}

.blue-ball.highlight {
    background: #2563eb;
    color: white;
    box-shadow: 0 4px 8px rgba(37,99,235,0.3);
    transform: scale(1.02);
    border-color: #2563eb;
}

.button-group {
    display: flex;
    gap: 16px;
    margin: 20px 0 24px;
}

.btn {
    flex: 1;
    text-align: center;
    padding: 14px 0;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 60px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    background: #f1f3f7;
    color: #2c3e66;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.btn-primary {
    background: #dc2626;
    color: white;
    box-shadow: 0 4px 8px rgba(220,38,38,0.2);
}

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

.btn-secondary {
    background: #2563eb;
    color: white;
    box-shadow: 0 4px 8px rgba(37,99,235,0.2);
}

.btn-secondary:active {
    transform: scale(0.97);
    background: #1d4ed8;
}

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

.btn-disabled, .btn:disabled {
    opacity: 0.5;
    transform: none;
    filter: grayscale(0.05);
    cursor: not-allowed;
}

.history-section {
    margin-top: 16px;
    border-top: 1px solid #eef2f6;
    padding-top: 16px;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 14px;
    flex-wrap: wrap;
    gap: 8px;
}

.history-header h4 {
    font-size: 1rem;
    font-weight: 600;
    color: #1f2937;
    background: #f3f4f6;
    padding: 4px 12px;
    border-radius: 40px;
}

.clear-btn {
    background: #eef2ff;
    border: none;
    padding: 6px 14px;
    border-radius: 40px;
    font-size: 0.75rem;
    font-weight: 500;
    color: #4b5563;
    cursor: pointer;
    transition: 0.1s;
}

.clear-btn:active {
    background: #e2e8f0;
}

.history-list {
    max-height: 320px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-right: 4px;
}

.history-item {
    background: #f9fafb;
    border-radius: 28px;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    border-left: 5px solid #dc2626;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.history-numbers {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 500;
}

.history-reds {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.history-red {
    background: #fee2e2;
    color: #b91c1c;
    width: 28px;
    height: 28px;
    border-radius: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.75rem;
}

.history-blue {
    background: #dbeafe;
    color: #1e40af;
    width: 28px;
    height: 28px;
    border-radius: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.75rem;
    margin-left: 6px;
}

.del-icon {
    background: #fff;
    border-radius: 30px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: #9ca3af;
    cursor: pointer;
    transition: 0.1s;
}

.del-icon:active {
    background: #fee2e2;
    color: #ef4444;
}

.empty-history {
    text-align: center;
    color: #9ca3af;
    padding: 28px 0;
    font-size: 0.85rem;
    background: #fafcff;
    border-radius: 32px;
}

footer {
    font-size: 0.65rem;
    text-align: center;
    color: #b9c2d0;
    margin-top: 20px;
}

@media (max-width: 450px) {
    .numbers-grid {
        gap: 6px;
    }

    .red-ball, .blue-ball {
        font-size: 0.9rem;
    }

    .container {
        padding: 16px 12px 20px;
    }

    .history-red, .history-blue {
        width: 26px;
        height: 26px;
        font-size: 0.7rem;
    }
}