:root {
    --primary-blue: #4A90E2;
    --primary-green: #50E3C2;
    --primary-yellow: #F8E71C;
    --dark-text: #4A4A4A;
    --light-bg: #F9F9F9;
}

body {
    font-family: 'Kanit', sans-serif;
    background-color: #f4f7f6;
}

.game-container {
    padding: 20px;
    background: linear-gradient(145deg, var(--primary-blue), var(--primary-green));
}

.game-screen {
    display: none;
    background-color: var(--light-bg);
    padding: 30px;
    border-radius: 24px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
    width: 100%;
    max-width: 800px;
    margin: 20px auto;
    text-align: center;
    animation: fadeIn 0.5s ease-in-out;
}
.game-screen.active-screen { display: block; }
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

h1 { color: var(--primary-blue); }
.subtitle { font-size: 1.2em; color: #777; margin-top: -15px; }

/* Goal Selection */
.goal-selection-area { margin-top: 30px; }
.goal-selection-area h4 { color: var(--dark-text); font-size: 1.1em; }
.goal-options { display: flex; justify-content: center; gap: 20px; margin-top: 15px; }
.goal-select-btn {
    background-color: #fff;
    border: 3px solid transparent;
    padding: 15px;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}
.goal-select-btn:hover { transform: translateY(-5px); box-shadow: 0 6px 20px rgba(0,0,0,0.12); }
.goal-select-btn.selected { border-color: var(--primary-yellow); transform: scale(1.05); }
.goal-select-btn img { width: 100px; height: 100px; display: block; margin-bottom: 10px; }
.goal-select-btn span { font-weight: 500; color: var(--dark-text); }
.game-btn { /* Shared button style */
    padding: 12px 30px; border-radius: 50px; border: none;
    color: white; background: linear-gradient(45deg, var(--primary-blue), #357ABD);
    font-size: 1.1em; font-weight: 500; cursor: pointer;
    margin-top: 30px; box-shadow: 0 4px 15px rgba(74, 144, 226, 0.4);
    transition: all 0.2s ease;
}
.game-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(74, 144, 226, 0.5); }
.game-btn:disabled { background: #BDBDBD; box-shadow: none; cursor: not-allowed; }
.game-btn.secondary-btn { background: #9E9E9E; box-shadow: 0 4px 15px rgba(158, 158, 158, 0.4); }

/* --- Game Play Screen --- */
.game-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.game-header h2 { color: var(--dark-text); margin: 0; }
.happiness-status { display: flex; align-items: center; gap: 8px; }
.happiness-status img { width: 30px; }
.happiness-bar { width: 120px; height: 20px; background-color: #F8BBD0; border-radius: 10px; overflow: hidden; }
#happinessFill { height: 100%; background: linear-gradient(90deg, #F48FB1, #EC407A); transition: width 0.5s ease; }

.savings-tracker { margin-bottom: 20px; }
.savings-tracker h3 { color: var(--dark-text); font-weight: 500; }
.savings-progress-bar { width: 100%; height: 35px; background-color: #E0E0E0; border-radius: 17px; position: relative; }
.savings-fill { height: 100%; background: linear-gradient(90deg, #FFF176, #FFD54F); border-radius: 17px; transition: width 0.5s ease; }
.progress-text { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); color: var(--dark-text); font-weight: bold; }

.planning-board { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: center; padding: 20px; background: #fff; border-radius: 16px; box-shadow: 0 4px 15px rgba(0,0,0,0.05); margin-bottom: 20px;}
.income-area h4, .allocation-area h4 { color: #555; text-align: center; margin-bottom: 15px; }
.money-container { min-height: 150px; display: flex; flex-wrap: wrap; gap: 8px; background: #f0f0f0; padding: 10px; border-radius: 10px; justify-content: center; align-content: flex-start;}
.coin-icon { width: 40px; height: 40px; cursor: grab; transition: transform 0.2s; }
.coin-icon:active { cursor: grabbing; transform: scale(1.1); }

.allocation-area { display: flex; justify-content: space-around; align-items: center; }
.dropzone { text-align: center; padding: 10px; border: 3px dashed #ccc; border-radius: 16px; transition: background-color 0.2s; min-height: 150px; display: flex; flex-direction: column; justify-content: space-between;}
.dropzone.drag-over { background-color: #C8E6C9; }
.dropzone img { width: 100px; }
.jar-total { font-weight: bold; font-size: 1.2em; color: var(--primary-blue); background: #fff; padding: 2px 8px; border-radius: 10px; box-shadow: 0 2px 5px rgba(0,0,0,0.1); margin-top: 5px;}

/* --- Win Screen & Modal --- */
.win-mascot { width: 150px; margin-bottom: -20px; }
.win-message { font-size: 1.3em; margin: 15px 0; max-width: 80%; margin-left: auto; margin-right: auto;}
.final-summary { padding: 20px; background-color: #FFF9C4; border-radius: 16px; font-size: 1.1em; color: #F57F17; margin-top: 20px;}
.game-end-buttons { display: flex; justify-content: center; gap: 15px; margin-top: 20px; }

.modal { display: none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.6); justify-content: center; align-items: center; }
.modal.active { display: flex; }
.modal-content { background: white; padding: 30px; border-radius: 20px; text-align: center; max-width: 450px; animation: popIn 0.3s ease; }
@keyframes popIn { from { transform: scale(0.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-content img { width: 100px; margin-bottom: 10px; }
.modal-content h3 { color: var(--primary-blue); }
.event-options { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }
.event-options .game-btn { margin-top: 0; }