/* --- GLOBAL SETTINGS & BACKGROUND --- */
body {
    font-family: 'comic sans ms', 'arial rounded mt bold', sans-serif;
    height: 100vh;
    margin: 0;
    overflow: hidden; /* No scrollbars on the main page */
    display: flex;
    justify-content: center;
    align-items: center;

    /* DEFAULT BACKGROUND */
    background-image: url('https://img.freepik.com/free-vector/hand-drawn-fantasy-landscape-concept_23-2149163776.jpg?w=1380');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: background-image 0.5s ease-in-out;
}

/* --- THE MAIN BOX (Visible for Form & Selection) --- */
.main-container {
    background: rgba(255, 255, 255, 0.95);
    padding: 35px;
    border-radius: 30px; 
    border: 6px solid #FFD700; 
    box-shadow: 0 15px 30px rgba(0,0,0,0.3);
    width: 90%;
    max-width: 550px;
    text-align: center;
    transition: all 0.5s ease;
}

/* --- STORY MODE (Invisible Container) --- */
.main-container.fullscreen-mode {
    background: transparent; 
    border: none;            
    box-shadow: none;        
    width: 100%;
    height: 100vh;
    max-width: none;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* --- TYPOGRAPHY --- */
h1, h2 {
    color: #ff6f00;
    margin-top: 0;
}

/* --- STORY TEXT BUBBLE --- */
.story-content {
    background: rgba(255, 255, 255, 0.85); 
    border-radius: 20px;
    padding: 20px 30px; /* Reduced top/bottom padding slightly */
    width: 80%;
    max-width: 900px;
    
    /* CHANGE: Reduced margin-bottom from 20px to 5px to pull buttons up */
    margin: 10px auto 5px auto;
    
    text-align: left;
    height: auto;
    max-height: 60vh;
    overflow-y: auto;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

#dynamic-story-text {
    font-family: 'Iskoola Pota', 'Nirmala UI', sans-serif;
    font-size: 28px; 
    line-height: 2.2;
    color: #000;
    font-weight: bold;
    white-space: pre-line;
}

/* --- TIMER --- */
.timer-box {
    font-size: 48px;
    font-weight: bold;
    color: #d32f2f;
    background: #fff;
    padding: 5px 30px;
    border-radius: 50px;
    display: inline-block;
    box-shadow: 0 5px 10px rgba(0,0,0,0.2);
    
    /* CHANGE: Reduced margin-bottom from 20px to 10px */
    margin-bottom: 10px;
}

/* --- BUTTONS --- */
.big-btn {
    width: 100%;
    padding: 18px;
    margin: 15px 0;
    font-size: 20px;
    cursor: pointer;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 10px;
}
.big-btn.warning { background-color: #ff9800; }

.action-btn {
    padding: 10px 25px; /* Slightly smaller padding */
    background-color: #008CBA;
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-size: 20px;
    font-weight: bold;
    
    /* CHANGE: Reduced margin to bring them closer together */
    margin: 5px 10px;
    
    box-shadow: 0 4px rgba(0,0,0,0.2);
}
.action-btn.stop { background-color: #f44336; }

.back-btn { 
    background-color: #9e9e9e; 
    color: white; 
    border:none; 
    padding: 10px 20px; 
    border-radius: 10px; 
    margin-top: 10px; /* Reduced from 15px */
    cursor: pointer; 
}
button:disabled { background-color: #ccc; cursor: not-allowed; box-shadow: none; }

/* --- FORM INPUTS --- */
input {
    width: 100%;
    padding: 12px;
    margin: 5px 0 20px 0;
    box-sizing: border-box;
    border: 2px solid #81d4fa;
    border-radius: 10px;
    font-size: 16px;
    background-color: #f0f8ff;
}
input:focus { outline: none; border-color: #ff9800; }
label { display: block; text-align: left; font-weight: bold; color: #555; }

/* --- ANIMATION --- */
.screen { display: none; }
.active { display: block; animation: popIn 0.5s ease; }
@keyframes popIn {
    0% { transform: scale(0.9); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}
