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

body {
    font-family: "Microsoft YaHei", "SimHei", Arial, sans-serif;
    font-size: 14px;
    background: #f5f5f5;
    color: #333;
    line-height: 1.5;
}

.container {
    padding: 10px;
    max-width: 800px;
    margin: 0 auto;
}

.header {
    background: linear-gradient(135deg, #e53935, #c62828);
    color: #fff;
    padding: 15px;
    position: relative;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header h1 {
    font-size: 18px;
    font-weight: bold;
    text-align: center;
}

.back-btn {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #fff;
    text-decoration: none;
    font-size: 18px;
}

.btn-group {
    display: flex;
    gap: 10px;
    padding: 10px;
}

.btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: linear-gradient(135deg, #e53935, #c62828);
    color: #fff;
}

.btn-secondary {
    background: #fff;
    color: #e53935;
    border: 1px solid #e53935;
}

.blue-section {
    background: #e3f2fd;
}

.page-wrapper {
    max-width: 800px;
    margin: 0 auto;
    background: #fff;
    min-height: 100vh;
}

.header {
    background: linear-gradient(135deg, #e53935, #c62828);
    color: #fff;
    padding: 15px;
    position: relative;
}

.back-btn {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #fff;
    text-decoration: none;
    font-size: 14px;
    opacity: 0.9;
}

.site-title {
    font-size: 20px;
    font-weight: bold;
    text-align: center;
    margin-bottom: 3px;
}

.sub-title {
    font-size: 12px;
    text-align: center;
    opacity: 0.9;
}

.main-content {
    padding: 15px;
}

.section {
    background: #fff;
    border-radius: 8px;
    margin-bottom: 15px;
    border: 1px solid #eee;
}

.section-header {
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.section-title {
    font-size: 15px;
    font-weight: bold;
    color: #333;
}

.section-body {
    padding: 15px;
}

.form-row {
    margin-bottom: 12px;
}

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

.form-label {
    display: block;
    font-size: 13px;
    color: #666;
    margin-bottom: 6px;
}

.form-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    background: #fff;
}

.form-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

.form-input:focus, .form-select:focus {
    outline: none;
    border-color: #e53935;
}

.btn-primary {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #e53935, #c62828);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(229, 57, 53, 0.3);
}

.btn-secondary {
    padding: 8px 16px;
    background: #fff;
    color: #e53935;
    border: 1px solid #e53935;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: #ffebee;
}

.ball-grid {
    display: grid;
    grid-template-columns: repeat(11, 1fr);
    gap: 5px;
    margin-bottom: 10px;
}

.ball-grid.blue-grid {
    grid-template-columns: repeat(8, 1fr);
}

.ball-area {
    padding: 10px;
    background: #fff;
}

.ball-row {
    display: grid;
    grid-template-columns: repeat(11, 1fr);
    gap: 5px;
}

.ball-row .select-ball {
    width: 100%;
    aspect-ratio: 1;
    max-width: 32px;
    min-width: 24px;
}

.select-ball {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid #ddd;
    background: #fff;
    color: #333;
    user-select: none;
}

.select-ball:hover {
    border-color: #e53935;
    transform: scale(1.05);
}

.select-ball.selected {
    background: #e53935;
    color: #fff;
    border-color: #e53935;
}

.select-ball.blue-ball {
    border-color: #90caf9;
}

.select-ball.blue-ball:hover {
    border-color: #1e88e5;
}

.select-ball.blue-ball.selected {
    background: #1e88e5;
    border-color: #1e88e5;
}

.result-list {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #eee;
    border-radius: 6px;
}

.result-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid #eee;
}

.result-item:last-child {
    border-bottom: none;
}

.result-item:nth-child(even) {
    background: #fafafa;
}

.result-index {
    width: 40px;
    color: #999;
    font-size: 12px;
}

.result-balls {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.result-ball {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    color: #fff;
}

.result-ball.red {
    background: #e53935;
}

.result-ball.blue {
    background: #1e88e5;
}

.stats-summary {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    padding: 12px;
    background: #fafafa;
    border-radius: 6px;
}

.summary-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.summary-label {
    font-size: 12px;
    color: #999;
}

.summary-value {
    font-size: 16px;
    font-weight: bold;
    color: #e53935;
}

.footer {
    text-align: center;
    padding: 15px;
    color: #999;
    font-size: 12px;
    border-top: 1px solid #eee;
    margin-top: 20px;
}

.position-group {
    margin-bottom: 15px;
}

.position-label {
    font-size: 13px;
    font-weight: bold;
    color: #e53935;
    margin-bottom: 8px;
}

.position-label.blue-label {
    color: #1e88e5;
}

.result-count {
    font-size: 13px;
    color: #e53935;
}

@media screen and (max-width: 480px) {
    .header {
        padding: 12px 10px;
    }

    .header h1 {
        font-size: 16px;
    }

    .container {
        padding: 5px;
    }

    .ball-grid {
        grid-template-columns: repeat(7, 1fr);
    }

    .ball-grid.blue-grid {
        grid-template-columns: repeat(8, 1fr);
    }
    
    .ball-row {
        grid-template-columns: repeat(7, 1fr);
        gap: 3px;
    }
    
    .ball-row .select-ball {
        max-width: none;
        min-width: 0;
        font-size: 11px;
    }

    .stats-summary {
        flex-wrap: wrap;
        gap: 10px;
    }

    .summary-item {
        flex: 1;
        min-width: 80px;
    }
    
    .btn-group {
        flex-direction: column;
    }
}
