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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a5a 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

header h1 {
    font-size: 28px;
    margin-bottom: 8px;
}

.subtitle {
    opacity: 0.9;
    font-size: 14px;
}

main {
    padding: 30px;
}

.balls-display {
    margin-bottom: 30px;
}

.red-balls, .blue-ball {
    margin-bottom: 25px;
}

.red-balls h3, .blue-ball h3 {
    font-size: 14px;
    color: #666;
    margin-bottom: 12px;
    font-weight: 500;
}

.balls-container {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.ball {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
    transition: all 0.3s ease;
    animation: bounceIn 0.5s ease;
}

@keyframes bounceIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.red-ball {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a5a 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(238, 90, 90, 0.4);
}

.blue-ball-single {
    background: linear-gradient(135deg, #4ecdc4 0%, #44a08d 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(78, 205, 196, 0.4);
}

.ball.placeholder {
    background: #f0f0f0;
    color: #999;
    box-shadow: none;
}

.controls {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
}

button {
    flex: 1;
    padding: 15px 20px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

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

.btn-secondary {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(245, 87, 108, 0.4);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 87, 108, 0.5);
}

.btn-text {
    background: transparent;
    color: #999;
    font-size: 14px;
    padding: 10px;
    margin-top: 10px;
}

.btn-text:hover {
    color: #666;
}

.history-section {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.history-section h3 {
    font-size: 16px;
    color: #333;
    margin-bottom: 15px;
}

.history-list {
    max-height: 200px;
    overflow-y: auto;
}

.empty-tip {
    color: #999;
    text-align: center;
    padding: 20px;
    font-size: 14px;
}

.history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: white;
    border-radius: 8px;
    margin-bottom: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.history-balls {
    display: flex;
    gap: 6px;
    align-items: center;
}

.history-ball {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

.history-ball.red {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a5a 100%);
    color: white;
}

.history-ball.blue {
    background: linear-gradient(135deg, #4ecdc4 0%, #44a08d 100%);
    color: white;
}

.history-time {
    font-size: 12px;
    color: #999;
}

.rules-section {
    background: #fff9e6;
    border-radius: 12px;
    padding: 20px;
    border-left: 4px solid #ffc107;
}

.rules-section h3 {
    font-size: 16px;
    color: #333;
    margin-bottom: 12px;
}

.rules-content p {
    font-size: 13px;
    color: #666;
    margin-bottom: 8px;
    line-height: 1.6;
}

.rules-content strong {
    color: #333;
}

footer {
    text-align: center;
    padding: 20px;
    background: #f8f9fa;
    color: #999;
    font-size: 12px;
}

/* 滚动条样式 */
.history-list::-webkit-scrollbar {
    width: 6px;
}

.history-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.history-list::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.history-list::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

/* 动画效果 */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.shaking {
    animation: shake 0.5s ease-in-out;
}

/* 响应式 */
@media (max-width: 480px) {
    .container {
        border-radius: 0;
    }
    
    body {
        padding: 0;
    }
    
    main {
        padding: 20px;
    }
    
    .ball {
        width: 42px;
        height: 42px;
        font-size: 16px;
    }
    
    .controls {
        flex-direction: column;
    }
}
