* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    background: #ffffff;
    color: #3d4b5e;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 14px;
}

a {
    color: inherit;
    text-decoration: none;
}

.site-container {
    width: calc(100% - 40px);
    max-width: 1180px;
    margin: 0 auto;
}

.top-header {
    background: #ffffff;
    padding: 20px 0 24px;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 80px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 13px;
}

.brand-icon {
    width: 65px;
    height: 65px;
    border: 5px solid #dc2828;
    border-right-color: #ff8b20;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 38px;
    font-weight: 700;
    color: #dc2828;
}

.brand-text h1 {
    margin: 0;
    color: #d62a2a;
    font-size: 30px;
    font-weight: 900;
    font-style: italic;
}

.brand-text h1 span {
    color: #ff8a1d;
}

.brand-text p {
    margin: 3px 0 0;
    color: #222;
    font-size: 15px;
    font-style: italic;
    font-weight: 700;
}

.top-links {
    display: flex;
    gap: 22px;
    font-weight: 600;
    color: #555;
}

.main-nav {
    background: #f60000;
}

.nav-inner {
    min-height: 46px;
    display: flex;
    align-items: center;
    gap: 22px;
}

.nav-inner a {
    color: #ffffff;
    font-size: 14px;
    font-weight: 700;
}

.main-layout {
    display: grid;
    grid-template-columns: 320px 150px minmax(0, 1fr);
    gap: 18px;
    align-items: start;
    padding-top: 30px;
    padding-bottom: 180px;
}

.sidebar-box {
    background: #ffffff;
    margin-bottom: 20px;
    border-radius: 2px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
    overflow: hidden;
}

.sidebar-box h3 {
    margin: 0;
    padding: 12px 10px;
    background: #80aa34;
    color: #ffffff;
    font-size: 17px;
    text-align: center;
}

.arrow-list,
.simple-list {
    list-style: none;
    padding: 10px 13px;
    margin: 0;
}

.arrow-list li {
    color: #1834c3;
    margin: 9px 0;
    line-height: 1.25;
    position: relative;
    padding-left: 16px;
}

.arrow-list li::before {
    content: "›";
    color: red;
    font-weight: 900;
    position: absolute;
    left: 0;
}

.simple-list li {
    color: #1737c9;
    margin: 10px 0;
}

.dream-item {
    display: grid;
    grid-template-columns: 105px 1fr;
    gap: 10px;
    padding: 10px;
    align-items: center;
}

.dream-image {
    min-height: 60px;
    background: linear-gradient(135deg, #ffb624, #fff2a4);
    color: #d62b22;
    font-weight: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #eee;
}

.dream-item p {
    color: #1737c9;
    margin: 0;
    line-height: 1.35;
    font-size: 12px;
}

.lottery-card {
    background: #fff;
    border: 1px solid #ddd;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.12);
}

.result-header {
    min-height: 44px;
    padding: 13px 10px;
    text-align: center;
    font-weight: 700;
    font-size: 16px;
    border-bottom: 1px solid #d7d7d7;
}

.lottery-statistics {
    width: 100%;
}

.lottery-statistics table {
    width: 100%;
    background: #ffffff;
    border-collapse: collapse;
    table-layout: fixed;
}

.lottery-statistics th,
.lottery-statistics td {
    border: 1px solid #d8d8d8;
    padding: 11px 8px;
    text-align: center;
    vertical-align: middle;
    font-weight: 700;
}

.lottery-statistics th {
    background: #f0f0f0;
    color: #333;
}

.lottery-statistics th:first-child,
.lottery-statistics td:first-child {
    width: 37%;
}

#resultG1,
#resultG7_1,
#resultG7_2,
#resultG7_3,
#resultG7_4,
#resultG1History,
#resultG7_1History,
#resultG7_2History,
#resultG7_3History,
#resultG7_4History {
    color: #ff4138;
}

#resultDB,
#resultDBHistory {
    color: #333;
}

.loading {
    display: inline-block;
    width: 19px;
    height: 19px;
    border: 3px solid #d8d8d8;
    border-top-color: #3498db;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.article-card {
    margin-top: 22px;
    padding: 0;
    border-radius: 9px;
    background: #fff;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.13);
    overflow: hidden;
}

.article-card h3 {
    font-size: 14px;
    margin: 0;
    padding: 17px 12px;
    color: #164478;
}

.article-content {
    padding: 12px 20px 20px;
    display: flex;
    align-items: center;
    gap: 18px;
}

.article-image {
    width: 170px;
    min-width: 170px;
    height: 90px;
    background: #c60000;
    color: #ffdc23;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 16px;
    font-weight: 900;
}

.article-content p {
    margin: 0;
    color: #777;
    line-height: 1.4;
    font-size: 15px;
}

.reference-box {
    margin-top: 18px;
    padding: 14px 10px;
    border-radius: 8px;
    background: #f4fbfc;
    border: 1px solid #d8e6e8;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.07);
}

.reference-box p {
    margin: 6px 0;
    color: #777;
}

.history-section {
    margin-top: 18px;
}

.history-toolbar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.history-toolbar span {
    color: #666;
    font-size: 13px;
}

#datePickerHistory {
    width: 230px;
    max-width: 100%;
    padding: 10px 12px;
    font-size: 15px;
    border: 1px solid #bdc9d5;
    border-radius: 5px;
    background: #eef4fa;
    color: #59697c;
    outline: none;
}

.calendar-box {
    margin-top: 45px;
    padding: 9px;
    background: #ffffff;
    border: 1px solid #e1e1e1;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
}

.calendar-header {
    display: grid;
    grid-template-columns: 30px 1fr 30px;
    align-items: center;
    text-align: center;
    margin-bottom: 10px;
}

.calendar-header button {
    border: 0;
    background: transparent;
    color: #555;
    font-weight: 700;
    cursor: pointer;
}

.calendar-header strong {
    font-size: 13px;
}

.calendar-week,
.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.calendar-week span {
    text-align: center;
    font-size: 9px;
    font-weight: 700;
    color: #666;
    padding: 4px 0;
}

.calendar-day {
    text-align: center;
    padding: 5px 1px;
    background: #f6f6f6;
    font-size: 10px;
    cursor: pointer;
    border-radius: 2px;
}

.calendar-day:hover {
    background: #e0e9f4;
}

.calendar-day.sunday {
    color: #ff4b45;
}

.calendar-day.selected {
    background: #337fc2;
    color: #ffffff;
    font-weight: 700;
}

.calendar-day.future {
    opacity: 0.35;
    cursor: default;
}

.footer {
    background: #f40000;
    color: #ffffff;
    text-align: center;
    padding: 18px 15px;
    line-height: 1.4;
}

.footer p {
    margin: 7px 0;
}

@media (max-width: 1000px) {
    .main-layout {
        grid-template-columns: 220px minmax(0, 1fr);
    }

    .middle-sidebar {
        display: none;
    }

    .top-links {
        display: none;
    }

    .nav-inner {
        overflow-x: auto;
        white-space: nowrap;
    }
}

@media (max-width: 700px) {
    .site-container {
        width: 100%;
        padding-left: 10px;
        padding-right: 10px;
    }

    .top-header {
        padding: 10px 0;
    }

    .header-inner {
        justify-content: center;
        min-height: auto;
    }

    .brand-icon {
        width: 50px;
        height: 50px;
        font-size: 28px;
    }

    .brand-text h1 {
        font-size: 21px;
    }

    .brand-text p {
        font-size: 11px;
    }

    .main-layout {
        display: block;
        padding-top: 15px;
        padding-bottom: 80px;
    }

    .left-sidebar,
    .middle-sidebar {
        display: none;
    }

    .content {
        width: 100%;
    }

    .lottery-statistics th,
    .lottery-statistics td {
        padding: 8px 3px;
        font-size: 12px;
    }

    .lottery-statistics th:first-child,
    .lottery-statistics td:first-child {
        width: 34%;
    }

    .result-header {
        font-size: 13px;
    }

    .article-content {
        padding: 10px;
    }

    .article-image {
        width: 120px;
        min-width: 120px;
        height: 75px;
        font-size: 12px;
    }

    .article-content p {
        font-size: 12px;
    }

    .history-toolbar {
        justify-content: stretch;
    }

    .history-toolbar span {
        display: none;
    }

    #datePickerHistory {
        width: 100%;
    }
}
