* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-image: url('bg.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* Background overlay for readability */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.5), rgba(20, 20, 40, 0.7));
    backdrop-filter: blur(3px);
    z-index: -1;
}

/* Page Management */
.page {
    display: none;
    min-height: 100vh;
    padding: 40px 20px;
}

.page.active {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.container {
    max-width: 800px;
    width: 100%;
    position: relative;
}

/* Typography */
.main-title {
    font-size: 4rem;
    font-weight: 700;
    text-align: center;
    color: #fff;
    margin-bottom: 10px;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    letter-spacing: 2px;
}

.subtitle {
    font-size: 1.3rem;
    text-align: center;
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 60px;
    font-weight: 300;
}

.page-title {
    font-size: 3rem;
    font-weight: 700;
    text-align: center;
    color: #fff;
    margin-bottom: 40px;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

/* 3D Card Buttons */
.card-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 40px;
    padding: 20px;
}

.card-3d {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.05));
    backdrop-filter: blur(10px);
    border-radius: 24px;
    padding: 50px 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.3),
        0 1px 8px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

.card-3d::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s;
}

.card-3d:hover::before {
    left: 100%;
}

.card-3d:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 
        0 20px 50px rgba(0, 0, 0, 0.4),
        0 5px 15px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.card-3d:active {
    transform: translateY(-5px) scale(0.98);
    box-shadow: 
        0 10px 25px rgba(0, 0, 0, 0.3),
        0 2px 10px rgba(0, 0, 0, 0.2);
}

.card-icon {
    font-size: 5rem;
    margin-bottom: 20px;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.3));
}

.card-3d h2 {
    font-size: 2rem;
    color: #fff;
    margin-bottom: 10px;
    font-weight: 600;
}

.card-3d p {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 300;
}

/* 3D Buttons */
.btn-3d {
    padding: 16px 40px;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        0 6px 20px rgba(0, 0, 0, 0.3),
        0 2px 4px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
}

.btn-3d:hover {
    transform: translateY(-3px);
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.4),
        0 4px 8px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.btn-3d:active {
    transform: translateY(1px);
    box-shadow: 
        0 3px 10px rgba(0, 0, 0, 0.3),
        0 1px 2px rgba(0, 0, 0, 0.2),
        inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.btn-3d:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: linear-gradient(145deg, #667eea, #764ba2);
    color: white;
}

.btn-secondary {
    background: linear-gradient(145deg, #f093fb, #f5576c);
    color: white;
}

.btn-danger {
    background: linear-gradient(145deg, #fa709a, #fee140);
    color: white;
}

.btn-large {
    padding: 20px 60px;
    font-size: 1.3rem;
    margin-top: 30px;
}

.button-group {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 40px;
}

/* Back Button */
.back-btn {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(-5px);
}

/* Timer Display */
.timer-display {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    backdrop-filter: blur(15px);
    border-radius: 30px;
    padding: 60px 40px;
    text-align: center;
    margin: 40px 0;
    box-shadow: 
        0 15px 40px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.timer-label {
    font-size: 1.5rem;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 20px;
    font-weight: 300;
    letter-spacing: 2px;
    text-transform: uppercase;
}

#stopwatchDisplay,
#timerDisplay {
    font-size: 5rem;
    font-weight: 700;
    color: #fff;
    font-family: 'Courier New', monospace;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    letter-spacing: 5px;
}

/* Timer Setup */
.timer-setup {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    backdrop-filter: blur(15px);
    border-radius: 24px;
    padding: 50px 40px;
    box-shadow: 
        0 15px 40px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.input-group {
    margin-bottom: 30px;
}

.input-group label {
    display: block;
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 12px;
    font-weight: 500;
}

.select-3d {
    width: 100%;
    padding: 16px 20px;
    font-size: 1.1rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    color: white;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.select-3d:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.select-3d:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
}

.select-3d option {
    background: #2a2a3e;
    color: white;
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
    margin: 30px 0;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 10px;
    transition: width 0.3s ease;
    box-shadow: 0 0 10px rgba(102, 126, 234, 0.5);
}

/* Meme Overlay */
.meme-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.5s ease;
}

.meme-overlay.active {
    display: flex;
}

.meme-overlay img {
    max-width: 90%;
    max-height: 90%;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    animation: zoomIn 0.5s ease;
}

@keyframes zoomIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .main-title {
        font-size: 2.5rem;
    }
    
    .page-title {
        font-size: 2rem;
    }
    
    .card-container {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    #stopwatchDisplay,
    #timerDisplay {
        font-size: 3rem;
    }
    
    .timer-display {
        padding: 40px 20px;
    }
    
    .timer-setup {
        padding: 30px 20px;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .btn-3d {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .main-title {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .card-icon {
        font-size: 3.5rem;
    }
    
    .card-3d h2 {
        font-size: 1.5rem;
    }
    
    #stopwatchDisplay,
    #timerDisplay {
        font-size: 2.5rem;
        letter-spacing: 2px;
    }
}
