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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

header {
    background: linear-gradient(135deg, #e20e18, #c50d15);
    color: white;
    padding: 20px 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

header h1 {
    font-size: 28px;
    text-align: center;
}

header .subtitle {
    text-align: center;
    opacity: 0.9;
    margin-top: 5px;
}

nav {
    background: white;
    padding: 15px 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

nav ul {
    display: flex;
    justify-content: center;
    list-style: none;
    gap: 30px;
}

nav a {
    color: #333;
    text-decoration: none;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 5px;
    transition: all 0.3s;
}

nav a:hover, nav a.active {
    background: #e20e18;
    color: white;
}

main {
    padding: 30px 0;
}

.lottery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

.lottery-card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}

.lottery-card h2 {
    text-align: center;
    margin-bottom: 20px;
    font-size: 22px;
}

.lottery-card.ssq h2 {
    color: #e20e18;
}

.lottery-card.dlt h2 {
    color: #1c89c9;
}

.balls {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.ball-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ball-row .label {
    font-weight: 600;
    min-width: 50px;
    color: #666;
}

.balls-container {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.ball {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 16px;
}

.ball.red {
    background: linear-gradient(135deg, #e20e18, #c50d15);
}

.ball.blue {
    background: linear-gradient(135deg, #1c89c9, #156a9f);
}

.issue-info {
    margin-top: 20px;
    text-align: center;
    color: #666;
    font-size: 14px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.news-section {
    background: white;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}

.news-section h2 {
    margin-bottom: 20px;
    color: #333;
}

.news-list {
    display: grid;
    gap: 15px;
}

.news-item {
    padding: 15px;
    border: 1px solid #eee;
    border-radius: 8px;
    transition: all 0.3s;
    cursor: pointer;
}

.news-item:hover {
    border-color: #e20e18;
    background: #fafafa;
}

.news-item h3 {
    font-size: 16px;
    color: #333;
    margin-bottom: 8px;
}

.news-item .meta {
    font-size: 12px;
    color: #999;
}

.tools-section {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}

.tools-section h2 {
    text-align: center;
    margin-bottom: 20px;
}

.tools-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: #e20e18;
    color: white;
}

.btn-primary:hover {
    background: #c50d15;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(226, 14, 24, 0.3);
}

.btn-secondary {
    background: #1c89c9;
    color: white;
}

.btn-secondary:hover {
    background: #156a9f;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(28, 137, 201, 0.3);
}

.result-display {
    margin-top: 20px;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 10px;
    text-align: center;
    display: none;
}

.result-display.show {
    display: block;
}

.result-display .numbers {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.history-section {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}

.history-section h2 {
    margin-bottom: 20px;
}

.history-list {
    display: grid;
    gap: 15px;
}

.history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    border: 1px solid #eee;
    border-radius: 10px;
}

.history-item .issue {
    font-weight: 600;
    color: #333;
}

.history-item .balls {
    flex-direction: row;
    gap: 5px;
}

.history-item .ball {
    width: 32px;
    height: 32px;
    font-size: 14px;
}

.history-item .btn-detail {
    padding: 6px 15px;
    background: #e20e18;
    color: white;
    border: none;
    border-radius: 5px;
    text-decoration: none;
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
}

.history-item .btn-detail:hover {
    background: #c50d15;
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}

.pagination button {
    padding: 8px 15px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
}

.pagination button:hover, .pagination button.active {
    background: #e20e18;
    color: white;
    border-color: #e20e18;
}

.pagination select {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

footer {
    background: #333;
    color: white;
    text-align: center;
    padding: 20px 0;
    margin-top: 40px;
}

.news-detail {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}

.news-detail h1 {
    color: #333;
    margin-bottom: 15px;
}

.news-detail .meta {
    color: #999;
    font-size: 14px;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.news-detail .content {
    line-height: 1.8;
    color: #555;
}

.news-detail .content h1,
.news-detail .content h2,
.news-detail .content h3,
.news-detail .content h4,
.news-detail .content h5,
.news-detail .content h6 {
    margin: 20px 0 10px;
    color: #333;
}

.news-detail .content p {
    margin: 10px 0;
}

.news-detail .content ul,
.news-detail .content ol {
    margin: 10px 0 10px 20px;
}

.news-detail .content li {
    margin: 5px 0;
}

.news-detail .content pre {
    background: #f5f5f5;
    padding: 15px;
    border-radius: 5px;
    overflow-x: auto;
    margin: 15px 0;
}

.news-detail .content code {
    background: #f5f5f5;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: monospace;
}

.news-detail .content pre code {
    background: none;
    padding: 0;
}

.news-detail .content blockquote {
    border-left: 4px solid #e20e18;
    margin: 15px 0;
    padding: 10px 15px;
    background: #fafafa;
}

.news-detail .content a {
    color: #e20e18;
    text-decoration: underline;
}

.news-detail .content img {
    max-width: 100%;
    border-radius: 5px;
    margin: 10px 0;
}

.back-link {
    display: inline-block;
    margin-bottom: 20px;
    color: #e20e18;
    text-decoration: none;
}

.back-link:hover {
    text-decoration: underline;
}

@media (max-width: 768px) {
    .lottery-grid {
        grid-template-columns: 1fr;
    }
    
    nav ul {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }
    
    .history-item {
        flex-direction: column;
        gap: 10px;
    }
}