/* 加法／減法／乘法練習共用樣式。
   每個遊戲頁面各自的 <style> 只保留該遊戲特有的差異（h1 邊距、subtitle、
   question-area 對齊方式、operator 上邊距、RWD 專屬字級）。 */

:root {
    --bg-color: #F3F1E9;
    --card-bg: #FFFFFF;
    --text-main: #595959;
    --accent-blue: #7C909C;
    --accent-pink: #D4A5A5;
    --accent-green: #8E9E82;
    --accent-green-hover: #7A8B6E;
    --input-border: #E0E0E0;
    --shadow: 0 10px 30px rgba(100, 100, 100, 0.08);
}

body {
    font-family: 'Varela Round', 'Noto Sans TC', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    margin: 0;
    padding: 20px;
    box-sizing: border-box;
}

.nav-header {
    width: 100%;
    max-width: 600px;
    margin-bottom: 20px;
}

.back-btn {
    text-decoration: none;
    color: var(--accent-blue);
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 16px;
    transition: opacity 0.3s;
}
.back-btn:hover { opacity: 0.7; }

.game-card {
    background: var(--card-bg);
    padding: 40px;
    border-radius: 30px;
    box-shadow: var(--shadow);
    text-align: center;
    max-width: 600px;
    width: 100%;
}

h1 {
    color: var(--text-main);
    font-size: 24px;
    letter-spacing: 1px;
    font-weight: 700;
}

.subtitle {
    color: #999;
    margin: 0 0 16px 0;
    font-size: 15px;
}

/* 計分板 */
.scoreboard {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 20px;
    font-size: 15px;
    color: var(--text-main);
}

.score-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.score-label {
    font-size: 12px;
    color: #AAAAAA;
    letter-spacing: 0.5px;
}

.score-value {
    font-size: 22px;
    font-weight: bold;
    color: var(--accent-blue);
    transition: transform 0.2s;
}

.score-value.pop {
    animation: pop 0.3s ease-out;
}

.streak-value { color: #E07A5F; }

/* 難度選擇器 */
.mode-toggle {
    background: #F5F5F5;
    border-radius: 50px;
    padding: 5px;
    display: inline-flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 5px;
    margin-bottom: 30px;
}

.mode-btn {
    border: none;
    background: transparent;
    padding: 8px 16px;
    border-radius: 50px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    color: #999;
    transition: all 0.3s;
    font-family: inherit;
}

.mode-btn.active {
    background: white;
    color: var(--accent-blue);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* 題目區域共用元件 */
.number-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 60px;
}

.digit {
    font-size: 72px;
    font-weight: bold;
    color: var(--accent-blue);
    line-height: 1;
    font-family: 'Varela Round', sans-serif;
    transition: font-size 0.3s;
}

.digit.large-number { font-size: 56px; }

.operator {
    font-size: 50px;
    color: #B0B0B0;
    font-family: 'Varela Round', sans-serif;
}

/* 點點設計 */
.dots-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    margin-top: 15px;
    width: 64px;
    min-height: 20px;
}

.dot {
    width: 10px;
    height: 10px;
    background-color: var(--accent-pink);
    border-radius: 50%;
    display: inline-block;
    transition: transform 0.3s ease;
}

.number-group:hover .dot { transform: scale(1.2); }

/* 輸入區域 */
.input-wrapper {
    position: relative;
    display: flex;
    justify-content: center;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

input[type="number"] {
    font-size: 32px;
    width: 120px;
    text-align: center;
    padding: 12px;
    border: 2px solid var(--input-border);
    border-radius: 15px;
    outline: none;
    color: var(--text-main);
    background: #FAFAFA;
    font-family: 'Varela Round', sans-serif;
    transition: border-color 0.3s;
}

input[type="number"]:focus {
    border-color: var(--accent-blue);
    background: #FFF;
}

input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

button {
    font-size: 20px;
    padding: 12px 30px;
    background-color: var(--accent-green);
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-weight: bold;
    letter-spacing: 1px;
    box-shadow: 0 4px 10px rgba(142, 158, 130, 0.4);
    transition: all 0.3s ease;
}

button:hover {
    background-color: var(--accent-green-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(142, 158, 130, 0.5);
}

button:active { transform: translateY(0); }

/* 數字鍵盤 */
.keypad {
    display: grid;
    grid-template-columns: repeat(3, 64px);
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

.key-btn {
    font-size: 26px;
    width: 64px;
    height: 56px;
    padding: 0;
    background-color: #FFFFFF;
    color: var(--text-main);
    border: 2px solid var(--input-border);
    border-radius: 15px;
    cursor: pointer;
    font-weight: bold;
    font-family: 'Varela Round', sans-serif;
    box-shadow: none;
    transition: all 0.2s ease;
}

.key-btn:hover {
    background-color: #FAFAFA;
    border-color: var(--accent-blue);
    transform: none;
    box-shadow: none;
}

.key-btn:active {
    background-color: #F0F0F0;
    transform: scale(0.95);
}

.key-btn.key-clear {
    font-size: 15px;
    color: var(--accent-pink);
}

.key-btn.key-backspace {
    font-size: 22px;
    color: var(--accent-blue);
}

/* 連勝里程碑慶祝動畫（彩紙屑 + 徽章）與答對/答錯卡片動畫，
   共用樣式見 /games/css/game-feedback.css（該檔需與本檔一起載入）。 */

/* 訊息與動畫 */
.message-area {
    height: 30px;
    margin-top: 25px;
    font-size: 18px;
    color: var(--accent-green);
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.3s;
}

.message-area.show { opacity: 1; }
.message-area.error { color: var(--accent-pink); }

@keyframes pop {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.35); }
    100% { transform: scale(1); }
}

/* RWD（三個遊戲共通的部分；digit/operator 專屬字級留在各頁自己的 <style>） */
@media (max-width: 600px) {
    .digit { font-size: 56px; }
    .digit.large-number { font-size: 42px; }
    .operator { font-size: 40px; }
    .game-card { padding: 30px 20px; }
    .scoreboard { gap: 16px; }
    .keypad { grid-template-columns: repeat(3, 56px); gap: 8px; }
    .key-btn { width: 56px; height: 50px; font-size: 22px; }
}
