/* --- Variables and Base Styles --- */
:root {
    --primary-bg: #f0f8ff; /* Alice Blue */
    --secondary-bg: #ffffff;
    --accent-color: #00bfff; /* Deep Sky Blue */
    --text-color: #333;
    --button-start-bg: #32cd32; /* Lime Green */
    --button-pause-bg: #ffa500; /* Orange */
    --button-reset-bg: #ff6347; /* Tomato */
    --button-text: #ffffff;
    --timer-font: 'Baloo 2', cursive;
    --body-font: 'Baloo 2', sans-serif;
    --border-radius: 15px;
    --shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    --char-color: var(--accent-color);
    --char-eye-color: #fff;
    --char-pupil-color: #333;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--body-font);
    background-color: var(--primary-bg);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 15px;
    line-height: 1.6;
}

/* --- App Container --- */
.app-container {
    background-color: var(--secondary-bg);
    padding: 25px 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    text-align: center;
    max-width: 400px;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 20px; /* Spacing between elements */
}

header h1 {
    color: var(--accent-color);
    font-family: var(--timer-font);
    font-size: 2.5em;
    margin-bottom: 5px;
}

header p {
    color: #555;
    font-size: 0.95em;
}

/* --- Character --- */
.character-container {
    height: 100px; /* Fixed height for stability */
    display: flex;
    justify-content: center;
    align-items: center;
}

.character {
    width: 80px;
    height: 80px;
    background-color: var(--char-color);
    border-radius: 50% 50% 35% 35% / 60% 60% 40% 40%; /* Water drop shape */
    position: relative;
    transition: transform 0.3s ease, background-color 0.3s ease;
    animation: idle-bob 2s ease-in-out infinite;
}

.character .eyes {
    position: absolute;
    top: 30%;
    width: 100%;
    display: flex;
    justify-content: space-around;
}

.character .eye {
    width: 15px;
    height: 15px;
    background-color: var(--char-eye-color);
    border-radius: 50%;
    position: relative;
    overflow: hidden; /* Hide pupil when closed */
}

.character .eye::after { /* Pupil */
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 6px;
    height: 6px;
    background-color: var(--char-pupil-color);
    border-radius: 50%;
    transition: transform 0.2s ease;
}

.character .mouth {
    position: absolute;
    bottom: 20%;
    left: 50%;
    transform: translateX(-50%);
    width: 25px;
    height: 8px;
    background-color: var(--char-eye-color);
    border-radius: 0 0 15px 15px; /* Simple smile */
    transition: height 0.2s ease, border-radius 0.2s ease;
}

/* Character States */
.character.running {
    animation: running-bounce 0.5s ease-in-out infinite;
}
.character.paused .eye {
     height: 2px; /* Squint eyes */
     top: 8px;
}
.character.paused .mouth {
    height: 2px; /* Flat mouth */
    border-radius: 2px;
}

.character.finished {
    animation: finished-spin 1s ease-in-out;
    background-color: var(--button-start-bg); /* Happy color */
}
.character.finished .mouth {
    height: 15px; /* Big smile */
    width: 35px;
    border-radius: 0 0 20px 20px;
}


/* Character Animations */
@keyframes idle-bob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

@keyframes running-bounce {
    0%, 100% { transform: scale(1) translateY(0); }
    50% { transform: scale(1.05) translateY(-5px); }
}

@keyframes finished-spin {
    0% { transform: rotate(0deg) scale(1); }
    100% { transform: rotate(360deg) scale(1.1); }
}


/* --- Timer Display --- */
.timer {
    margin: 15px 0;
}

.timer-display {
    font-family: var(--timer-font);
    font-size: 4.5em; /* Large timer */
    color: var(--accent-color);
    line-height: 1;
    font-weight: 700;
    margin-bottom: 5px;
}

.status-message {
    font-size: 1em;
    color: #666;
    min-height: 1.2em; /* Prevent layout shift */
}

/* --- Controls --- */
.controls {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.button {
    font-family: var(--body-font);
    padding: 12px 25px;
    font-size: 1.1em;
    font-weight: 600;
    border: none;
    border-radius: var(--border-radius);
    color: var(--button-text);
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.1s ease, box-shadow 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
}

.button:active {
    transform: translateY(2px);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.button .icon {
    font-size: 1.2em;
}

.button.start { background-color: var(--button-start-bg); }
.button.pause { background-color: var(--button-pause-bg); }
.button.reset { background-color: var(--button-reset-bg); }

/* --- Footer --- */
footer {
    margin-top: 15px;
    font-size: 0.8em;
    color: #888;
}

/* --- Responsiveness --- */
@media (max-width: 350px) {
     header h1 {
        font-size: 2em;
     }
    .timer-display {
        font-size: 3.5em;
    }
    .button {
        padding: 10px 18px;
        font-size: 1em;
    }
    .character {
        width: 60px;
        height: 60px;
    }
    .character-container {
        height: 80px;
    }
}

@media (min-width: 600px) {
    .app-container {
        padding: 40px 30px;
    }
     header h1 {
        font-size: 3em;
     }
    .timer-display {
        font-size: 5.5em;
    }
}