body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f5f5f5;
    overflow-x: hidden;
}
.container {
    width: 100%;
    max-width: 100vw;
    margin: 0 auto;
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    text-align: center;
    box-sizing: border-box;
    overflow-x: hidden;
}
h1, h2, h3 {
    color: #333;
    text-align: center;
}
.error {
    color: red;
    text-align: center;
    font-weight: bold;
}
.predict-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    width: 100%;
    max-width: 100%;
}
.hot-numbers-row {
    display: flex;
    justify-content: space-between;
    width: 100%;
    gap: 10px;
}
.prediction-block {
    flex: 1;
    min-width: 0;
    margin: 0;
}
.predict-table {
    width: 100%;
    max-width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background-color: white;
    border: 1px solid #000;
    border-spacing: 0;
    table-layout: fixed;
}
.predict-th, .predict-td {
    padding: 10px;
    text-align: center;
    border: 1px solid #000;
    box-sizing: border-box;
    overflow: hidden;
    white-space: nowrap;
}
.predict-container .predict-table {
    table-layout: fixed;
}
.predict-container .predict-table th,
.predict-container .predict-table td {
    width: 16.67%;
    min-width: 50px;
}
#auto-match .predict-table, #history .predict-table {
    table-layout: fixed;
    width: 100%;
    max-width: 100%;
}
#auto-match .predict-th, #auto-match .predict-td,
#history .predict-th, #history .predict-td {
    width: 50%;
    min-width: 100px;
    padding: 8px;
}
#auto-match .predict-th:first-child,
#auto-match .predict-th:nth-child(2),
#history .predict-th:first-child,
#history .predict-th:nth-child(2) {
    background-color: #ff4d4d;
    color: #333;
    font-weight: bold;
}
.ball {
    display: inline-block;
    width: 30px;
    height: 30px;
    line-height: 30px;
    border-radius: 50%;
    font-size: 15px;
    font-weight: bold;
    margin: 0 2px;
}
.hot-ball { background-color: #ff4d4d; color: white; }
.duplicate-ball { background-color: #87ceeb; color: #333; }
.consecutive-ball { background-color: #ffd700; color: #333; }
.best-match-ball { background-color: #000000; color: white; }
.match { background-color: #4CAF50; color: white; }
.no-match { background-color: #e0e0e0; color: #333; }
.draw-ball {
    display: inline-block;
    width: 90px;
    height: 90px;
    line-height: 90px;
    border-radius: 50%;
    background-color: #4CAF50;
    color: white;
    text-align: center;
    margin: 6px;
    font-size: 42px;
    font-weight: bold;
}
.red-ball { background-color: red; color: white; }
.blue-ball { background-color: blue; color: white; }
.latest-draw {
    width: 100%;
    max-width: 100%;
    text-align: center;
    margin: 10px 0;
}
.draw-info, .draw-numbers { margin: 5px 0; font-size: 16px; }
.pagination { text-align: center; margin: 20px 0; }
.pagination a {
    display: inline-block;
    padding: 8px 12px;
    margin: 0 4px;
    border: 1px solid #000;
    border-radius: 4px;
    text-decoration: none;
    color: #333;
}
.pagination a.current {
    background-color: #4CAF50;
    color: white;
    border-color: #4CAF50;
}
.pagination a:hover:not(.current) { background-color: #f0f0f0; }
.pagination-options { text-align: center; margin: 10px 0; }
.pagination-options label { margin-right: 10px; font-weight: bold; }
.pagination-options select {
    padding: 5px;
    border: 1px solid #000;
    border-radius: 4px;
    font-size: 14px;
    background-color: black;
    color: white;
}
.pagination-options select option {
    background-color: black;
    color: white;
}
.row-yellow { background-color: #FFFFE0; }
.row-white { background-color: #FFFFFF; }
.group-separator { margin: 0 8px; color: #333; font-weight: bold; }
@media (max-width: 600px) {
    .predict-container { flex-direction: column; align-items: stretch; }
    .hot-numbers-row { flex-direction: column; }
    .prediction-block { width: 100%; }
    .predict-table, .results-table { font-size: 16px; }
    .ball {
        width: 24px;
        height: 24px;
        line-height: 24px;
        font-size: 12px;
        margin: 0 0.5px;
    }
    .draw-ball {
        width: 15vw;
        height: 15vw;
        line-height: 15vw;
        font-size: 8vw;
        min-width: 40px;
        max-width: 60px;
        margin: 4px;
    }
    .draw-numbers { display: flex; flex-wrap: wrap; justify-content: center; }
    .draw-info { white-space: normal; overflow: visible; font-size: 14px; }
    .predict-th, .predict-td,
    .results-table th, .results-table td {
        padding: 6px;
        min-width: 0;
        white-space: normal;
    }
    #auto-match .predict-table, #history .predict-table { table-layout: auto; }
    #auto-match .predict-th:first-child, #auto-match .predict-td:first-child,
    #history .predict-th:first-child, #history .predict-td:first-child {
        width: 40%;
        min-width: 80px;
    }
    #auto-match .predict-th:nth-child(2), #auto-match .predict-td:nth-child(2),
    #history .predict-th:nth-child(2), #history .predict-td:nth-child(2) {
        width: 60%;
        min-width: 130px;
    }
    .pagination-options select { width: 100%; box-sizing: border-box; }
    .group-separator { margin: 0 4px; }
    /* 廣告控制按鈕樣式 */
    .toggle-ad-button {
        height: 30px;
        font-size: 24px;
    }
    .toggle-ad-button.up {
        bottom: 45%; /* 調整為避免蓋住格子 */
        transition: bottom 0.15s ease; /* 縮短轉場時間 */
    }
    /* 廣告面板樣式 */
    .ad-panel {
        height: 50%; /* 手機版增加高度以適配2x2布局 */
        padding: 4px;
    }
    .ad-panel.active {
        bottom: 0; /* 確保與底部貼齊 */
        transition: bottom 0.15s ease; /* 縮短轉場時間 */
    }
    .ad-grid {
        grid-template-columns: 1fr 1fr; /* 手機版保持2列 */
        grid-template-rows: 1fr 1fr; /* 2行 */
    }
    .ad-item {
        width: 100%; /* 手機版適配窄螢幕 */
        height: auto; /* 自動調整高度 */
    }
    .ad-item img {
        width: 100%;
        height: 100%;
        object-fit: contain; /* 確保正方形圖片不變形 */
    }
}
/* 廣告控制按鈕樣式 */
.toggle-ad-button {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 30px;
    background-color: #FFD700;
    border: none;
    cursor: pointer;
    font-size: 24px;
    color: #001F3F;
    z-index: 1001;
    text-align: center;
    padding: 0;
    margin: 0;
}
.toggle-ad-button.up {
    bottom: 25%;
    transition: bottom 0.15s ease; /* 縮短轉場時間 */
}
/* 廣告面板樣式 */
.ad-panel {
    display: none;
    position: fixed;
    bottom: -25%;
    left: 0;
    width: 100%;
    height: 25%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    padding: 10px;
    box-sizing: border-box;
}
.ad-panel.active {
    display: block;
    bottom: 0;
    transition: bottom 0.15s ease; /* 縮短轉場時間 */
}
.ad-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* 電腦版2x2布局 */
    grid-template-rows: 1fr 1fr; /* 2行 */
    gap: 10px;
    height: 100%;
}
.ad-item {
    background-color: #32CD32; /* 綠色框 */
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}
.ad-item img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* 確保正方形圖片不變形 */
    onerror: "this.src='https://picsum.photos/200/200'; console.log('圖片載入失敗，使用備用圖片');"
}
/* 新增登入遮罩與框框樣式 */
.login-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('../images/overlay-bg.png') no-repeat center center;
    background-size: cover;
    z-index: 999; /* 低於廣告(1000)與LINE客服 */
    justify-content: center;
    align-items: center;
}
.login-modal {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
    text-align: center;
    width: 300px;
}
.login-modal input {
    display: block;
    margin: 10px auto;
    padding: 10px;
    width: 80%;
}
.login-modal button {
    padding: 10px 20px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}
.login-modal button:hover {
    background-color: #45a049;
}
.login-error {
    color: red;
    margin-top: 10px;
}
