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

:root {
    --primary-color: #ff9a3d;
    --secondary-color: #ffd93d;
    --accent-color: #ff6b6b;
    --background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --card-bg: rgba(255, 255, 255, 0.95);
    --text-dark: #2d3748;
    --text-light: #718096;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    --egg-white: #f8f8f8;
    --yolk-very-soft: #ffeb3b;
    --yolk-soft: #ffd54f;
    --yolk-medium: #ffb74d;
    --yolk-hard: #ff9800;
    --yolk-firmly: #f57c00;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--background);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    color: var(--text-dark);
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

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

header h1 {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

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

.egg-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.egg-card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 25px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.egg-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
}

.egg-card:active {
    transform: translateY(-2px);
}

.egg-image {
    margin-bottom: 15px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.egg-visual {
    width: 90px;
    height: 120px;
    background: var(--egg-white);
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    position: relative;
    box-shadow: inset 0 -20px 30px rgba(0, 0, 0, 0.1),
                0 5px 15px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.egg-visual::before {
    content: '';
    width: 45px;
    height: 45px;
    border-radius: 50%;
    position: absolute;
}

.very-soft-visual::before {
    background: radial-gradient(circle, var(--yolk-very-soft) 0%, var(--yolk-very-soft) 70%, transparent 70%);
    animation: yolkWobble 2s ease-in-out infinite;
}

.soft-visual::before {
    background: radial-gradient(circle, var(--yolk-soft) 0%, var(--yolk-soft) 80%, transparent 80%);
}

.medium-visual::before {
    background: radial-gradient(circle, var(--yolk-medium) 0%, var(--yolk-medium) 90%, transparent 90%);
}

.hard-visual::before {
    background: var(--yolk-hard);
}

.firmly-hard-visual::before {
    background: var(--yolk-firmly);
}

@keyframes yolkWobble {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.egg-card h3 {
    font-size: 1.3rem;
    margin-bottom: 8px;
    color: var(--text-dark);
}

.time-label {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.description {
    font-size: 0.9rem;
    color: var(--text-light);
}

.timer-view, .complete-view {
    background: var(--card-bg);
    border-radius: 30px;
    padding: 40px;
    box-shadow: var(--shadow);
    animation: slideIn 0.5s ease;
    overflow: visible;
    min-height: 600px;
}

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

.hidden {
    display: none !important;
}

.timer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 30px;
}

.back-button {
    background: transparent;
    border: 2px solid var(--text-light);
    color: var(--text-dark);
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.back-button:hover {
    background: var(--text-dark);
    color: white;
    border-color: var(--text-dark);
}

#timerTitle {
    font-size: 2rem;
    color: var(--text-dark);
    flex-grow: 1;
    text-align: center;
}

.timer-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 30px;
    width: 100%;
    max-width: 100%;
    overflow: visible;
    padding: 10px 0;
    position: relative;
}

.egg-animation {
    width: 100%;
    max-width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
}

.boiling-pot {
    width: 150px;
    height: 150px;
    background: linear-gradient(to bottom, #4fc3f7 0%, #29b6f6 100%);
    border-radius: 20px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.egg-in-pot {
    width: 60px;
    height: 80px;
    background: white;
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    animation: bobbing 2s ease-in-out infinite;
    z-index: 2;
}

@keyframes bobbing {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.steam {
    position: absolute;
    width: 20px;
    height: 20px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    animation: steam-rise 2s ease-in-out infinite;
}

.steam-1 {
    left: 30px;
    bottom: 100px;
    animation-delay: 0s;
}

.steam-2 {
    left: 65px;
    bottom: 100px;
    animation-delay: 0.7s;
}

.steam-3 {
    left: 100px;
    bottom: 100px;
    animation-delay: 1.4s;
}

@keyframes steam-rise {
    0% {
        bottom: 100px;
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
    100% {
        bottom: 180px;
        opacity: 0;
    }
}

.time-circle {
    position: relative;
    width: 280px;
    height: 280px;
    margin: 0 auto;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.progress-ring {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
    overflow: visible;
    display: block;
}

.progress-ring-bg {
    fill: none;
    stroke: #e2e8f0;
    stroke-width: 12;
}

.progress-ring-circle {
    fill: none;
    stroke: var(--primary-color);
    stroke-width: 12;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s linear;
}

.time-text {
    position: relative;
    z-index: 10;
    font-size: 4rem;
    font-weight: bold;
    color: var(--text-dark);
    text-align: center;
    line-height: 1;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.time-text span {
    display: inline-block;
}

.timer-controls {
    display: flex;
    gap: 20px;
    margin-top: 20px;
}

.control-button {
    padding: 15px 30px;
    border: none;
    border-radius: 25px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.pause {
    background: var(--primary-color);
    color: white;
    min-width: 120px;
}

.pause:hover {
    background: #ff8a2b;
    transform: scale(1.05);
}

.reset {
    background: #e2e8f0;
    color: var(--text-dark);
}

.reset:hover {
    background: #cbd5e0;
    transform: scale(1.05);
}

.pause-icon, .play-icon {
    font-size: 1.2rem;
}

.progress-text {
    text-align: center;
    margin-top: 20px;
}

#progressMessage {
    font-size: 1.2rem;
    color: var(--text-light);
    font-weight: 500;
}

.celebration {
    text-align: center;
    padding: 40px 20px;
}

.confetti {
    font-size: 5rem;
    animation: confetti 1s ease-in-out infinite;
}

@keyframes confetti {
    0%, 100% { transform: scale(1) rotate(0deg); }
    25% { transform: scale(1.2) rotate(-10deg); }
    75% { transform: scale(1.2) rotate(10deg); }
}

.egg-done {
    font-size: 6rem;
    margin: 20px 0;
    animation: bounce 1s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

.celebration h2 {
    font-size: 2.5rem;
    color: var(--text-dark);
    margin-bottom: 15px;
}

.complete-message {
    font-size: 1.3rem;
    color: var(--text-light);
    margin-bottom: 30px;
}

.done-button {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 25px;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.done-button:hover {
    background: #ff8a2b;
    transform: scale(1.05);
}

footer {
    text-align: center;
    margin-top: 30px;
    color: white;
}

.tip {
    font-size: 1rem;
    opacity: 0.9;
    background: rgba(255, 255, 255, 0.2);
    padding: 15px 25px;
    border-radius: 25px;
    display: inline-block;
    margin-bottom: 20px;
}

.footer-nav {
    margin: 20px 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
}

.footer-nav a {
    color: white;
    text-decoration: none;
    font-size: 0.95rem;
    padding: 8px 16px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.15);
    transition: all 0.3s ease;
}

.footer-nav a:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
}

.copyright {
    font-size: 0.85rem;
    opacity: 0.7;
    margin-top: 15px;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    header h1 {
        font-size: 2.2rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .egg-options {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 15px;
    }

    .egg-card {
        padding: 20px;
    }

    .egg-image {
        height: 100px;
    }

    .egg-visual {
        width: 70px;
        height: 100px;
    }

    .egg-visual::before {
        width: 35px;
        height: 35px;
    }

    .egg-card h3 {
        font-size: 1.1rem;
    }

    .time-label {
        font-size: 1.3rem;
    }

    .description {
        font-size: 0.85rem;
    }

    .timer-view, .complete-view {
        padding: 15px 10px;
        border-radius: 20px;
        min-height: auto;
        overflow: visible;
    }

    #timerTitle {
        font-size: 1.2rem;
        padding: 0 10px;
    }

    .timer-display {
        gap: 20px;
        padding: 20px 15px;
        max-width: 100%;
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        box-sizing: border-box;
    }

    .egg-animation {
        order: 1;
        margin: 0 auto 15px auto;
        display: flex;
        justify-content: center;
        align-items: center;
        width: 100%;
    }

    .time-circle {
        order: 2;
        width: 160px;
        height: 160px;
        margin: 0 auto;
        padding: 0;
        flex-shrink: 0;
        display: block;
        position: relative;
    }

    .progress-ring {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 160px;
        height: 160px;
        display: block;
        margin: 0;
    }

    .progress-ring-bg,
    .progress-ring-circle {
        cx: 80;
        cy: 80;
        r: 68;
    }

    .time-text {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        font-size: 1.8rem;
        font-weight: bold;
        color: var(--text-dark);
        text-align: center;
        width: auto;
        white-space: nowrap;
        z-index: 10;
        margin: 0;
        padding: 0;
    }

    .timer-controls {
        margin-top: 15px;
    }

    .progress-text {
        margin-top: 10px;
    }

    #progressMessage {
        font-size: 1rem;
    }

    .boiling-pot {
        width: 100px;
        height: 100px;
    }

    .egg-in-pot {
        width: 45px;
        height: 58px;
    }

    .steam {
        width: 15px;
        height: 15px;
    }

    .steam-1 {
        left: 15px;
        bottom: 70px;
    }

    .steam-2 {
        left: 42px;
        bottom: 70px;
    }

    .steam-3 {
        left: 70px;
        bottom: 70px;
    }

    .timer-controls {
        flex-direction: column;
        width: 100%;
    }

    .control-button {
        width: 100%;
    }

    .celebration h2 {
        font-size: 2rem;
    }

    .complete-message {
        font-size: 1.1rem;
    }

    .footer-nav {
        gap: 10px;
        flex-wrap: wrap;
        padding: 0 15px;
    }

    .footer-nav a {
        font-size: 0.85rem;
        padding: 8px 14px;
        white-space: nowrap;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    header h1 {
        font-size: 1.8rem;
    }

    .egg-options {
        grid-template-columns: 1fr;
    }

    .timer-view, .complete-view {
        padding: 10px 8px;
        min-height: auto;
    }

    .timer-header {
        flex-direction: column;
        gap: 8px;
        margin-bottom: 10px;
    }

    .back-button {
        width: 100%;
        font-size: 0.85rem;
        padding: 8px 16px;
    }

    #timerTitle {
        font-size: 1rem;
        padding: 0 5px;
    }

    .timer-display {
        gap: 15px;
        padding: 15px 10px;
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        box-sizing: border-box;
    }

    .egg-animation {
        order: 1;
        transform: scale(0.8);
        margin: 0 auto 10px auto;
        display: flex;
        justify-content: center;
        align-items: center;
        width: 100%;
    }

    .time-circle {
        order: 2;
        width: 140px;
        height: 140px;
        margin: 0 auto;
        padding: 0;
        flex-shrink: 0;
        display: block;
        position: relative;
    }

    .progress-ring {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 140px;
        height: 140px;
        display: block;
        margin: 0;
    }

    .progress-ring-bg,
    .progress-ring-circle {
        cx: 70;
        cy: 70;
        r: 58;
    }

    .time-text {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        font-size: 1.5rem;
        font-weight: bold;
        color: var(--text-dark);
        text-align: center;
        width: auto;
        white-space: nowrap;
        z-index: 10;
        margin: 0;
        padding: 0;
    }

    .timer-controls {
        gap: 8px;
        margin-top: 8px;
        flex-direction: column;
        width: 100%;
        max-width: 280px;
        margin-left: auto;
        margin-right: auto;
    }

    .control-button {
        padding: 10px 16px;
        font-size: 0.95rem;
        width: 100%;
    }

    .progress-text {
        margin-top: 8px;
    }

    #progressMessage {
        font-size: 0.9rem;
    }

    .boiling-pot {
        width: 80px;
        height: 80px;
    }

    .egg-in-pot {
        width: 35px;
        height: 45px;
    }

    .steam {
        width: 12px;
        height: 12px;
    }

    .steam-1 {
        left: 12px;
        bottom: 60px;
    }

    .steam-2 {
        left: 34px;
        bottom: 60px;
    }

    .steam-3 {
        left: 56px;
        bottom: 60px;
    }

    @keyframes steam-rise {
        0% {
            bottom: 70px;
            opacity: 0;
        }
        50% {
            opacity: 1;
        }
        100% {
            bottom: 140px;
            opacity: 0;
        }
    }

    .footer-nav {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
        justify-content: center;
        padding: 0 10px;
    }

    .footer-nav a {
        font-size: 0.75rem;
        padding: 8px 12px;
        white-space: nowrap;
        flex: 0 0 auto;
    }

    .tip {
        font-size: 0.9rem;
        padding: 12px 20px;
    }

    .copyright {
        font-size: 0.75rem;
    }
}

/* iOS Safari specific fixes */
@supports (-webkit-touch-callout: none) {
    .timer-view {
        min-height: auto;
        padding-bottom: 20px;
    }
    
    .timer-display {
        width: 100% !important;
        max-width: 100% !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        box-sizing: border-box !important;
    }
    
    .time-circle {
        display: block !important;
        margin-left: auto !important;
        margin-right: auto !important;
        position: relative !important;
        left: 0 !important;
        right: 0 !important;
        transform: none !important;
    }
    
    .progress-ring {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        margin: auto !important;
        -webkit-transform: rotate(-90deg) !important;
        transform: rotate(-90deg) !important;
    }
    
    .time-text {
        position: absolute !important;
        top: 50% !important;
        left: 50% !important;
        -webkit-transform: translate(-50%, -50%) !important;
        transform: translate(-50%, -50%) !important;
    }
    
    .time-text {
        position: relative;
        z-index: 10;
    }
    
    .timer-display {
        min-height: auto;
        padding: 15px 5px;
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    
    @media (max-width: 768px) {
        .time-circle {
            width: 200px;
            height: 200px;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        
        .progress-ring {
            width: 200px;
            height: 200px;
        }
        
        .timer-display {
            padding: 10px 5px;
        }
    }
    
    @media (max-width: 480px) {
        .timer-view {
            padding: 10px 5px;
        }
        
        .timer-display {
            padding: 8px 3px;
        }
        
        .time-circle {
            width: 180px;
            height: 180px;
            margin: 10px auto;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        
        .progress-ring {
            width: 180px;
            height: 180px;
        }
    }
}
