/* 1to50 遊戲專屬樣式表 - 經典原版風格完美還原 - 繁體中文註解 */

:root {
    --bg-page: #ffffff;
    --text-dark: #333333;
    --border-color: #dddddd;
    
    /* 原版經典配色 */
    --color-stage1: #4466aa; /* 1-25 階段的經典藍色 */
    --color-stage2: #335599; /* 26-50 階段的經典深藍色 */
}

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

body {
    background-color: var(--bg-page);
    color: var(--text-dark);
    font-family: Arial, AppleGothic, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: hidden;
}

/* 遊戲容器 */
.game-container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding-top: 10px;
    text-align: center;
    position: relative;
    z-index: 2;
}

/* 狀態面板 */
.topInfo {
    float: left;
    height: 50px;
    width: 100%;
    position: relative;
    background-color: #eaeaea;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 15px;
    box-sizing: border-box;
}

/* 計時器 */
#time {
    font-size: 30px;
    font-weight: 700;
    font-family: Arial, AppleGothic, sans-serif;
    line-height: 50px;
    color: #5555ff;
}

/* 關卡/下一個數字目標 */
.level {
    font-size: 25px;
    font-family: Arial, AppleGothic, sans-serif;
    line-height: 50px;
    color: #cccccc;
    font-weight: normal;
}

#score {
    color: #333333;
    font-weight: 700;
}

/* 說明與控制區 */
.lineWrapB {
    margin: 20px auto 30px;
    width: 95%;
    max-width: 370px;
    border-bottom: 1px solid #eeeeee;
    padding-bottom: 20px;
    text-align: left;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.description-text h5 {
    color: #4466aa;
    font-weight: 700;
    font-size: 25px;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.description-text h5 img {
    height: 20px;
}

.description-text p {
    color: #999999;
    font-size: 12px;
    line-height: 22px;
}

/* 重新開始按鈕 */
.resetBtn {
    line-height: 20px;
    font-size: 13px;
    display: inline-block;
    text-decoration: none;
    color: #444444;
    background-color: #ffffff;
    padding: 5px 12px;
    border: 1px solid #aaaaaa;
    border-radius: 5px;
    cursor: pointer;
    font-family: Arial, sans-serif;
    transition: background-color 0.2s ease;
}

.resetBtn:hover {
    background-color: #f5f5f5;
}

/* 5x5 遊戲網格 */
.grid {
    margin: auto;
    width: 95%;
    max-width: 370px;
    height: 370px;
    overflow: hidden;
    display: block;
}

/* 網格格子 */
.grid-cell {
    float: left;
    margin: 0.5%;
    width: 19%;
    height: 19%;
    background-color: var(--color-stage1);
    padding: 0;
    text-align: center;
    color: #ffffff;
    font-weight: 700;
    line-height: 70px;
    font-size: 30px;
    font-family: Arial, sans-serif;
    position: relative;
    overflow: visible;
    cursor: pointer;
    user-select: none;
    box-sizing: border-box;
    transition: opacity 0.1s ease;
}

/* 格子點擊縮小效果 */
.grid-cell:not(.empty):active {
    opacity: 0.8;
}

/* 26-50 階段的顏色 */
.grid-cell.second {
    background-color: var(--color-stage2);
}

/* 點擊錯誤紅光與抖動 */
.grid-cell.click-error {
    animation: shake 0.3s ease-in-out;
    background-color: #ff3333 !important;
}

/* 空白格 */
.grid-cell.empty {
    opacity: 0;
    pointer-events: none;
    cursor: default;
    background-color: transparent !important;
}

/* 開始提示覆蓋層 */
.start-overlay {
    position: absolute;
    left: 50%;
    top: 150px;
    transform: translateX(-50%);
    width: 95%;
    max-width: 370px;
    height: 370px;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border: 1px solid #eeeeee;
    box-sizing: border-box;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.start-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.start-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.start-btn {
    background: #4466aa;
    border: none;
    color: #ffffff;
    padding: 12px 28px;
    border-radius: 5px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: background-color 0.2s ease;
}

.start-btn:hover {
    background: #335599;
}

/* 遊戲結束模組 (經典原版風格彈窗) */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10060;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-card {
    background: #fafafa;
    border-radius: 5px;
    padding: 30px 24px;
    width: min(100%, 380px);
    text-align: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    border: 1px solid #cccccc;
}

.modal-card h2 {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 15px;
    color: #4466aa;
}

.modal-card p {
    color: #555555;
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 15px;
}

.modal-card input[type="text"] {
    width: 90%;
    padding: 10px;
    background: #ffffff;
    border: 1px solid #cccccc;
    border-radius: 4px;
    color: #333333;
    font-size: 1rem;
    text-align: center;
    margin-bottom: 18px;
    outline: none;
}

.modal-card input[type="text"]:focus {
    border-color: #4466aa;
}

.modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.modal-btn {
    padding: 8px 18px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.15s ease;
    border: 1px solid #ccc;
}

.modal-btn.primary {
    background: #4466aa;
    color: #ffffff;
    border-color: #4466aa;
}

.modal-btn.primary:hover {
    background: #335599;
}

.modal-btn.secondary {
    background: #f0f0f0;
    color: #555555;
}

.modal-btn.secondary:hover {
    background: #e0e0e0;
}

/* SEO 與說明區塊 */
.seo-description {
    width: min(95%, 800px);
    margin: 20px auto 60px;
    padding: 20px;
    color: #777777;
    font-size: 0.85rem;
    line-height: 1.6;
    border-top: 1px solid #eeeeee;
}

.seo-description h2 {
    color: #333333;
    font-size: 1.1rem;
    margin-bottom: 10px;
    font-weight: 700;
}

.seo-description p {
    margin-bottom: 8px;
}

/* 動畫定義 */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-4px); }
    40%, 80% { transform: translateX(4px); }
}

/* 響應式優化 */
@media (max-width: 400px) {
    .grid {
        height: calc(95vw * 1);
    }
    .grid-cell {
        line-height: calc(95vw * 0.19);
        font-size: 24px;
    }
}
