* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #e2e8f0;
    background: radial-gradient(ellipse at top, #1e293b 0%, #0f172a 100%);
    min-height: 100vh;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="stars" x="0" y="0" width="20" height="20" patternUnits="userSpaceOnUse"><circle cx="10" cy="10" r="0.5" fill="%23ffffff" opacity="0.1"/></pattern></defs><rect width="100" height="100" fill="url(%23stars)"/></svg>');
    pointer-events: none;
    z-index: -1;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

header h1 {
    font-size: 2.8rem;
    margin-bottom: 10px;
    font-weight: 800;
    background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 50%, #f472b6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 30px rgba(96, 165, 250, 0.3);
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

.calculator-section {
    background: rgba(45, 55, 72, 0.9);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(74, 85, 104, 0.5);
    border-radius: 24px;
    padding: 30px;
    box-shadow: 
        0 25px 50px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.05);
    margin-bottom: 40px;
    position: relative;
    overflow: hidden;
}

.calculator-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
}

.info-box {
    background: #f8f9ff;
    border: 2px solid #e3e8ff;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
    text-align: center;
}

.info-box p {
    margin: 5px 0;
    font-weight: 500;
    color: #5a67d8;
}


.calculation-modes {
    position: relative;
}

.mode-card {
    display: block;
    text-align: center;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.mode-card h2 {
    font-size: 1.5rem;
    margin-bottom: 8px;
    color: #f7fafc;
}

.mode-card p {
    color: #cbd5e0;
    margin-bottom: 15px;
    font-size: 1rem;
}

.input-group {
    margin-bottom: 15px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #e2e8f0;
}

.time-input-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 0 auto;
    max-width: 280px;
}

.time-select {
    padding: 14px 16px;
    border: 2px solid rgba(74, 85, 104, 0.6);
    border-radius: 12px;
    font-size: 1.1rem;
    width: 80px;
    text-align: center;
    transition: all 0.3s ease;
    background: rgba(26, 32, 44, 0.8);
    backdrop-filter: blur(10px);
    color: #f7fafc;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
    cursor: pointer;
}

.time-select:focus {
    outline: none;
    border-color: #60a5fa;
    box-shadow: 
        0 0 0 3px rgba(96, 165, 250, 0.2),
        inset 0 2px 4px rgba(0, 0, 0, 0.3),
        0 0 20px rgba(96, 165, 250, 0.1);
    transform: translateY(-2px);
}

.time-select option {
    background: #1a202c;
    color: #f7fafc;
    padding: 8px;
}

.time-separator {
    font-size: 1.5rem;
    font-weight: bold;
    color: #cbd5e0;
    margin: 0 5px;
}

.ampm-select {
    padding: 14px 12px;
    border: 2px solid rgba(74, 85, 104, 0.6);
    border-radius: 12px;
    font-size: 1.1rem;
    width: 80px;
    text-align: center;
    transition: all 0.3s ease;
    background: rgba(26, 32, 44, 0.8);
    backdrop-filter: blur(10px);
    color: #f7fafc;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
    cursor: pointer;
}

.ampm-select:focus {
    outline: none;
    border-color: #60a5fa;
    box-shadow: 
        0 0 0 3px rgba(96, 165, 250, 0.2),
        inset 0 2px 4px rgba(0, 0, 0, 0.3),
        0 0 20px rgba(96, 165, 250, 0.1);
    transform: translateY(-2px);
}

.ampm-select option {
    background: #1a202c;
    color: #f7fafc;
}

.input-group input {
    padding: 14px 20px;
    border: 2px solid rgba(74, 85, 104, 0.6);
    border-radius: 12px;
    font-size: 1.1rem;
    width: 220px;
    text-align: center;
    transition: all 0.3s ease;
    background: rgba(26, 32, 44, 0.8);
    backdrop-filter: blur(10px);
    color: #f7fafc;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.input-group input:focus {
    outline: none;
    border-color: #60a5fa;
    box-shadow: 
        0 0 0 3px rgba(96, 165, 250, 0.2),
        inset 0 2px 4px rgba(0, 0, 0, 0.3),
        0 0 20px rgba(96, 165, 250, 0.1);
    transform: translateY(-2px);
}

.calculate-btn {
    background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 50%, #f472b6 100%);
    color: white;
    border: none;
    padding: 16px 32px;
    border-radius: 16px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 30px;
    position: relative;
    overflow: hidden;
    box-shadow: 
        0 10px 25px rgba(96, 165, 250, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.1);
}

.calculate-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.calculate-btn:hover {
    transform: translateY(-3px);
    box-shadow: 
        0 15px 35px rgba(96, 165, 250, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.2);
}

.calculate-btn:hover::before {
    left: 100%;
}

.calculate-btn:active {
    transform: translateY(-1px);
}

.results {
    min-height: 100px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.result-item {
    background: rgba(26, 32, 44, 0.8);
    backdrop-filter: blur(15px);
    border: 2px solid rgba(74, 85, 104, 0.5);
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    transition: all 0.4s ease;
    position: relative;
    overflow: hidden;
}

.result-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(96, 165, 250, 0.3), transparent);
}

.result-item:hover {
    border-color: #60a5fa;
    transform: translateY(-5px) scale(1.02);
    box-shadow: 
        0 20px 40px rgba(96, 165, 250, 0.2),
        0 0 0 1px rgba(96, 165, 250, 0.1);
}

.result-time {
    font-size: 2.2rem;
    font-weight: 800;
    background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
    text-shadow: 0 0 20px rgba(96, 165, 250, 0.3);
}

.result-label {
    color: #cbd5e0;
    font-weight: 500;
}

.result-cycles {
    color: #a0aec0;
    font-size: 0.9rem;
    margin-top: 5px;
}

.info-section,
.tips-section {
    background: rgba(45, 55, 72, 0.8);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(74, 85, 104, 0.4);
    border-radius: 24px;
    padding: 40px;
    box-shadow: 
        0 25px 50px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.05);
    margin-bottom: 40px;
    position: relative;
    overflow: hidden;
}

.info-section::before,
.tips-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
}

.info-section h3,
.tips-section h3 {
    text-align: center;
    font-size: 1.8rem;
    margin-bottom: 30px;
    color: #f7fafc;
}

.info-grid,
.tips-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
}

.info-item,
.tip-item {
    text-align: center;
    padding: 20px;
}

.tip-item {
    background: rgba(26, 32, 44, 0.7);
    backdrop-filter: blur(15px);
    border-radius: 20px;
    border: 2px solid rgba(74, 85, 104, 0.4);
    transition: all 0.4s ease;
    position: relative;
    overflow: hidden;
}

.tip-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(96, 165, 250, 0.2), transparent);
}

.tip-item:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 
        0 15px 30px rgba(96, 165, 250, 0.2),
        0 0 0 1px rgba(96, 165, 250, 0.1);
    border-color: #60a5fa;
}

.info-item h4,
.tip-item h4 {
    font-size: 1.2rem;
    margin-bottom: 10px;
    color: #f7fafc;
}

.info-item p,
.tip-item p {
    color: #cbd5e0;
    line-height: 1.6;
    text-align: left;
}

.info-item p {
    text-align: center;
}

footer {
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
    opacity: 0.8;
    padding: 30px 0;
    font-size: 0.9rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 40px;
}

.footer-links {
    margin-top: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.footer-link {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 0.85rem;
    transition: color 0.3s ease;
}

.footer-link:hover {
    color: #60a5fa;
    text-decoration: underline;
}

.separator {
    color: rgba(255, 255, 255, 0.4);
}

/* Modal Styles */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: rgba(45, 55, 72, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(74, 85, 104, 0.5);
    border-radius: 24px;
    max-width: 600px;
    max-height: 80vh;
    width: 90%;
    box-shadow: 
        0 25px 50px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { 
        opacity: 0; 
        transform: translateY(-50px) scale(0.9); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0) scale(1); 
    }
}

.modal-header {
    padding: 25px 30px 15px;
    border-bottom: 1px solid rgba(74, 85, 104, 0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, rgba(96, 165, 250, 0.1) 0%, rgba(167, 139, 250, 0.1) 100%);
}

.modal-header h2 {
    margin: 0;
    font-size: 1.4rem;
    background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #f472b6;
    transform: rotate(90deg);
}

.modal-body {
    padding: 25px 30px 30px;
    overflow-y: auto;
    max-height: calc(80vh - 100px);
    color: #e2e8f0;
    line-height: 1.6;
}

.modal-body h3 {
    margin: 0 0 20px 0;
    color: #f7fafc;
    font-size: 1.3rem;
    font-weight: 600;
}

.modal-body h4 {
    margin: 20px 0 10px 0;
    color: #cbd5e0;
    font-size: 1.1rem;
    font-weight: 600;
}

.modal-body p {
    margin: 0 0 15px 0;
    color: #a0aec0;
    line-height: 1.7;
}

.modal-body p:last-child {
    margin-bottom: 0;
}

/* Ad Zone Styles */
.ad-zone-top {
    margin: 20px auto 30px;
    display: flex;
    justify-content: center;
    max-width: 320px;
}

.ad-zone-bottom {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 999;
    display: flex;
    justify-content: center;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(74, 85, 104, 0.3);
    padding: 8px;
}

.ad-placeholder {
    width: 320px;
    height: 50px;
    background: rgba(45, 55, 72, 0.9);
    border: 1px solid rgba(74, 85, 104, 0.5);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.3s ease;
}

.ad-placeholder span {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 2px;
}

.ad-content {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 500;
}

.ad-placeholder:hover {
    border-color: #60a5fa;
    box-shadow: 0 0 15px rgba(96, 165, 250, 0.2);
}

/* Result explanation styles */
.result-explanation {
    background: rgba(96, 165, 250, 0.1);
    border: 1px solid rgba(96, 165, 250, 0.3);
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 20px;
    backdrop-filter: blur(10px);
}

.explanation-content {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    text-align: center;
}

.explanation-icon {
    font-size: 1.1rem;
}

.explanation-text {
    color: #e2e8f0;
    font-size: 0.9rem;
    font-weight: 500;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
        padding-bottom: 70px; /* Space for sticky bottom ad */
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .calculator-section,
    .info-section {
        padding: 25px;
    }
    
    .time-input-container {
        flex-wrap: wrap;
        gap: 10px;
        justify-content: center;
    }
    
    .calculate-btn {
        width: 100%;
        max-width: 280px;
        margin: 20px auto;
    }
    
    .mode-switcher {
        flex-direction: column;
        align-items: center;
    }
    
    .mode-btn {
        width: 200px;
    }
    
    .info-grid,
    .tips-grid {
        grid-template-columns: 1fr;
    }
    
    .info-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
    
    .result-time {
        font-size: 1.5rem;
    }
    
    .modal-content {
        width: 95%;
        max-height: 85vh;
    }
    
    .modal-header {
        padding: 20px 20px 15px;
    }
    
    .modal-body {
        padding: 20px;
        max-height: calc(85vh - 80px);
    }
    
    .footer-links {
        flex-direction: column;
        gap: 5px;
    }
    
    .separator {
        display: none;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.7rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .calculator-section,
    .info-section,
    .tips-section {
        padding: 20px;
    }
    
    .time-input-container {
        gap: 8px;
        max-width: 280px;
        flex-wrap: nowrap;
    }
    
    .time-select {
        width: 75px;
        padding: 16px 12px;
        font-size: 1.1rem;
        min-height: 48px;
    }
    
    .ampm-select {
        width: 75px;
        padding: 16px 10px;
        font-size: 1.1rem;
        min-height: 48px;
    }
    
    .time-separator {
        font-size: 1.4rem;
        margin: 0 4px;
    }
    
    .calculate-btn {
        width: 100%;
        max-width: 280px;
        margin: 25px auto;
        padding: 18px 32px;
        font-size: 1.2rem;
        min-height: 54px;
    }
    
    .input-group input {
        width: 150px;
    }
    
    /* Ad zones responsive */
    .ad-placeholder {
        width: 100%;
        max-width: 320px;
    }
    
    .ad-zone-bottom {
        padding: 6px;
    }
}

@media (max-width: 360px) {
    .ad-placeholder {
        width: 300px;
        height: 50px;
    }
    
    .ad-zone-top {
        margin: 15px auto 25px;
    }
}