* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.container {
    width: 100%;
    max-width: 600px;
    padding: 20px;
}

.title {
    font-size: 48px;
    font-weight: bold;
    color: white;
    text-align: center;
    margin-bottom: 30px;
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.config-section {
    background: rgba(255, 255, 255, 0.95);
    padding: 15px 20px;
    border-radius: 15px;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    display: none;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.config-section label {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

#timer-config {
    font-size: 18px;
    padding: 10px 15px;
    border: 2px solid #2a5298;
    border-radius: 8px;
    width: 100px;
    text-align: center;
    font-weight: bold;
}

.settings-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    font-size: 24px;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.95);
    color: #1e3c72;
    border: 2px solid #2a5298;
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: transform 0.1s ease, box-shadow 0.1s ease;
    touch-action: manipulation;
    z-index: 100;
}

.settings-btn:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.settings-btn:active {
    transform: scale(0.95);
}

.timer-display {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 60px 40px;
    margin-bottom: 20px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    transition: transform 0.1s ease, background-color 0.3s ease;
}

.timer-display:active {
    transform: scale(0.98);
}

.time {
    font-size: 120px;
    font-weight: bold;
    text-align: center;
    color: #1e3c72;
    line-height: 1;
}

/* Warning state when timer is at 5 seconds or less */
.timer-display.warning {
    background: linear-gradient(135deg, #ff4444 0%, #cc0000 100%);
    animation: pulse 0.5s ease-in-out infinite alternate;
}

.timer-display.warning .time {
    color: white;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
}

@keyframes pulse {
    from {
        box-shadow: 0 8px 30px rgba(255, 0, 0, 0.5);
    }
    to {
        box-shadow: 0 8px 40px rgba(255, 0, 0, 0.8);
    }
}

.controls {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.time-bank-btn {
    flex: 1;
    max-width: 300px;
    font-size: 24px;
    font-weight: bold;
    padding: 25px 40px;
    background: linear-gradient(135deg, #27ae60 0%, #229954 100%);
    color: white;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: transform 0.1s ease, box-shadow 0.1s ease;
    touch-action: manipulation;
}

.time-bank-btn:active {
    transform: scale(0.95);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.time-bank-btn:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 20px;
    padding: 30px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content h2 {
    font-size: 28px;
    color: #1e3c72;
    margin-bottom: 20px;
    text-align: center;
}

.settings-form {
    margin-bottom: 20px;
}

.settings-form label {
    display: block;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
}

.settings-form input {
    width: 100%;
    font-size: 18px;
    padding: 12px 15px;
    border: 2px solid #2a5298;
    border-radius: 8px;
    text-align: center;
    font-weight: bold;
}

.close-btn {
    width: 100%;
    font-size: 18px;
    font-weight: bold;
    padding: 15px;
    background: linear-gradient(135deg, #2a5298 0%, #1e3c72 100%);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: transform 0.1s ease, box-shadow 0.1s ease;
    touch-action: manipulation;
}

.close-btn:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.close-btn:active {
    transform: scale(0.98);
}

/* Responsive design for smaller screens */
@media (max-width: 480px) {
    .container {
        padding: 15px;
    }
    
    .title {
        font-size: 28px;
        margin-bottom: 20px;
    }
    
    .time {
        font-size: 80px;
    }
    
    .timer-display {
        padding: 40px 20px;
        margin-bottom: 15px;
    }
    
    .time-bank-btn {
        font-size: 18px;
        padding: 18px 25px;
        max-width: 100%;
    }
    
    .settings-btn {
        top: 10px;
        right: 10px;
        font-size: 16px;
        padding: 8px 12px;
    }
    
    .config-section label {
        font-size: 14px;
    }
    
    #timer-config {
        font-size: 16px;
        width: 80px;
    }
    
    .modal-content {
        padding: 20px;
        width: 85%;
        max-height: 80vh;
    }
    
    .modal-content h2 {
        font-size: 22px;
        margin-bottom: 15px;
    }
}

/* Landscape orientation optimization */
@media (max-height: 500px) and (orientation: landscape) {
    .container {
        max-width: 90vw;
    }
    
    .title {
        font-size: 32px;
        margin-bottom: 10px;
    }
    
    .time {
        font-size: 80px;
    }
    
    .timer-display {
        padding: 30px 20px;
        margin-bottom: 15px;
    }
    
    .config-section {
        padding: 10px 15px;
        margin-bottom: 15px;
    }
    
    .time-bank-btn {
        padding: 15px 30px;
        font-size: 20px;
    }
    
    .settings-btn {
        top: 10px;
        right: 10px;
        font-size: 18px;
        padding: 8px 14px;
    }
}