/* Base styles */
body {
    margin: 0;
    font-family: 'Comic Neue', cursive;
    min-height: 100vh;
    background: url('../assets/images/comic-bg.png') center center no-repeat;
    background-size: cover;
    overflow-x: hidden;
}

.container {
    display: flex;
    height: 100vh;
}

/* Main Clock*/
.funky-timeClock {
    flex: 1;
    background: rgba(255, 255, 220, 0.85);
    padding: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: -10px 0 0 #000;
    font-family: 'Comic Neue', cursive;
}

/* Speech Bubble */
.speech-bubble {
    background: #fff;
    border: 4px solid #000;
    padding: 15px 25px;
    border-radius: 20px;
    font-size: 1.2rem;
    margin-bottom: 20px;
    position: relative;
    max-width: 300px;
    text-align: center;
    box-shadow: 3px 3px 0 #000;
}

.speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -20px;
    left: 20px;
    width: 0;
    height: 0;
    border: 10px solid transparent;
    border-top: 15px solid #000;
    border-bottom: 0;
}

/* Clock Style */
.clock-box {
    background: #ffe600;
    border: 6px solid #000;
    padding: 40px 70px;
    border-radius: 30px 10px 40px 15px;
    box-shadow: 8px 8px 0 #000;
    font-family: 'Orbitron', monospace;
    display: inline-block;
    position: relative;
    margin-bottom: 25px;
    transform: rotate(-2deg);

}

.clock-box.running {
    animation-name: pulse-pop;
    animation-duration: 2s;
    animation-iteration-count: infinite;
}

@keyframes pulse-pop {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

.clock-box:hover {
    animation: vibrate-scale 0.3s linear 1;
}

@keyframes vibrate-scale {
    0% {
        transform: rotate(-2deg) translateX(0) scale(1);
    }

    20% {
        transform: rotate(-1deg) translateX(-3px) scale(1.05);
    }

    40% {
        transform: rotate(-3deg) translateX(3px) scale(1.05);
    }

    60% {
        transform: rotate(-1.5deg) translateX(-2px) scale(1.05);
    }

    80% {
        transform: rotate(-2.5deg) translateX(2px) scale(1.05);
    }

    100% {
        transform: rotate(-2deg) translateX(0) scale(1);
    }
}


.clock-box.pulse-warning {
    animation-name: pulse-pop, pulseRed;
    animation-duration: 2s, 1s;
    animation-iteration-count: infinite, infinite;
}

@keyframes pulseRed {
    0% {
        background-color: #ff4d4d;
        box-shadow: 8px 8px 0 #000, 0 0 10px #ff4d4d;
    }

    50% {
        background-color: #ffe600;
        box-shadow: 8px 8px 0 #000, 0 0 0px transparent;
    }

    100% {
        background-color: #ff4d4d;
        box-shadow: 8px 8px 0 #000, 0 0 10px #ff4d4d;
    }
}

#timer {
    font-size: 4rem;
    font-weight: 900;
    color: #222;
    text-align: center;
    letter-spacing: 4px;
    cursor: pointer;
    user-select: none;
    text-shadow:
        -2px -2px 0 #000,
        2px -2px 0 #000,
        -2px 2px 0 #000,
        2px 2px 0 #000,
        0 0 10px #fff400;
    position: relative;
    display: inline-block;
    height: 4.5rem;
    line-height: 4.5rem;
    overflow: hidden;
}

#timer:focus {
    outline: none;
    background: #fff8dc;
    border: 2px dashed #000;
    border-radius: 5px;
    padding: 4px 8px;
}

/* Time Setter */
.time-setter {
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
}

#custom-time {
    width: 120px;
    padding: 8px;
    font-size: 1rem;
    border: 3px solid #000;
    border-radius: 8px;
    box-shadow: 2px 2px 0 #000;
    outline: none;
}

#set-time {
    background: #fff;
    color: #000;
    border: 3px solid #000;
    padding: 8px 14px;
    font-size: 1rem;
    cursor: pointer;
    border-radius: 8px;
    box-shadow: 2px 2px 0 #000;
}

#set-time:hover {
    background: #fffd75;
}

/* Control Buttons */
.controls button {
    background: #fff;
    color: #000;
    border: 3px solid #000;
    padding: 10px 20px;
    margin: 0 8px;
    font-size: 1.1rem;
    cursor: pointer;
    border-radius: 8px;
    box-shadow: 3px 3px 0 #000;
    transition: 0.2s;
}

.controls button:hover {
    background-color: #fffd75;
    animation: pop-out 0.2s forwards;
    box-shadow: 5px 5px 0 #000;
}

@keyframes pop-out {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.15);
    }

    100% {
        transform: scale(1.1);
    }
}

.shake {
    animation: shake 0.3s;
}

@keyframes shake {
    0% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    50% {
        transform: translateX(5px);
    }

    75% {
        transform: translateX(-5px);
    }

    100% {
        transform: translateX(0);
    }
}

/* Quotes */
.quote-popup {
    position: fixed;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%) translateY(20px) scale(0.97);
    background: #fff;
    color: #222;
    padding: 1.2rem 2rem;
    border: 6px solid #000;
    border-radius: 30px 10px 40px 15px;
    font-size: clamp(1.1rem, 2vw, 1.3rem);
    font-family: 'Comic Neue', cursive;
    box-shadow: 6px 6px 0 #000;
    transition: opacity 0.4s ease, transform 0.4s ease;
    z-index: 1000;
    opacity: 1;
    text-align: center;
    max-width: 80%;
    white-space: pre-wrap;
    line-height: 1.6;
    transform-origin: center bottom;
}

.quote-popup.animate {
    animation: popupFadeIn 1s ease-out;
}

@keyframes popupFadeIn {
    0% {
        opacity: 0;
        transform: translateX(-50%) translateY(20px) scale(0.95);
    }

    100% {
        opacity: 1;
        transform: translateX(-50%) translateY(0) scale(1);
        visibility: hidden;
    }
}

.quote-popup::after {
    content: '';
    position: absolute;
    bottom: -20px;
    left: 40px;
    width: 0;
    height: 0;
    border: 10px solid transparent;
    border-top: 15px solid #000;
    border-bottom: 0;
}

.quote-popup.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%) translateY(20px) scale(0.97);
}

/*fullscreen */
.fullscreen-icon {
    position: fixed;
    bottom: 20px;
    right: 20px;
    font-size: 28px;
    color: #000;
    border: 3px solid #000;
    border-radius: 50%;
    padding: 10px;
    cursor: pointer;
    box-shadow: 4px 4px 0 #000;
    z-index: 1001;
    transition: transform 0.2s, background-color 0.3s;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fullscreen-icon:hover {
    background-color: #ffe600;
    transform: scale(1.1);
}

/* Pomodoro counts */
#pomodoro-count {
    position: fixed;
    top: 15px;
    left: 15px;
    font-family: 'Comic Neue', cursive;
    font-size: 1.1rem;

    color: #000;
    padding: 10px 18px;
    border: 4px solid #000;
    border-radius: 25px 8px 30px 10px;
    box-shadow: 4px 4px 0 #000;
    text-shadow:
        -1px -1px 0 #fff,
        1px -1px 0 #fff,
        -1px 1px 0 #fff,
        1px 1px 0 #fff;
    z-index: 1000;
    transform: rotate(-1.5deg);
    transition: transform 0.2s ease;
}

#pomodoro-count:hover {
    transform: scale(1.05) rotate(1deg);
}

/* info button */
.info-wrapper {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 100;
}

.info-btn {
    cursor: pointer;
    font-size: 18px;
    font-weight: 700;
    color: #000;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 50%;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.info-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.info-container {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 10px;
    background: #fff;
    color: #222;
    padding: 1.25rem 1.75rem;
    border: 5px solid #000;
    border-radius: 30px 15px 35px 20px;
    font-size: 1.1rem;
    box-shadow: 6px 6px 0 #000;
    transition: opacity 0.4s ease, transform 0.4s ease;
    transform-origin: top right;
    z-index: 999;
    opacity: 0;
    visibility: visible;
    transform: translateY(-8px) scale(0.95);
    text-align: left;
    max-width: 400px;
    width: max-content;
    min-width: 280px;
    line-height: 1.6;
    white-space: normal;
    pointer-events: none;
    max-height: 60vh;
}

.info-container::after {
    content: '';
    position: absolute;
    top: -15px;
    right: 15px;
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-bottom: 15px solid #000;
}

.info-container.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.confetti {
    position: fixed;
    top: 0;
    left: 0;
    width: auto;
    height: auto;
    font-size: 20px;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    border-radius: 50%;
    will-change: transform;
    animation-duration: 2s;
    animation-fill-mode: forwards;
    animation-timing-function: ease-out;
}


@keyframes fall1 {
    0% {
        transform: translate(0, 0) rotate(0deg);
        opacity: 1;
    }

    100% {
        transform: translate(var(--x), var(--y)) rotate(var(--rot));
        opacity: 0;
    }
}

@keyframes fall2 {
    0% {
        transform: translate(0, 0) rotate(0deg) scale(1);
        opacity: 1;
    }

    100% {
        transform: translate(calc(var(--x) * 0.7), var(--y)) rotate(calc(var(--rot) + 90deg)) scale(0.7);
        opacity: 0;
    }
}

@keyframes fall3 {
    0% {
        transform: translate(0, 0) rotate(0deg);
        opacity: 1;
    }

    50% {
        transform: translate(calc(var(--x) * 0.5), calc(var(--y) * 0.5)) rotate(calc(var(--rot) / 2));
        opacity: 0.8;
    }

    100% {
        transform: translate(var(--x), var(--y)) rotate(var(--rot));
        opacity: 0;
    }
}

@keyframes fall4 {
    0% {
        transform: translate(0, 0) rotate(0deg) scale(1);
        opacity: 1;
    }

    100% {
        transform: translate(calc(var(--x) * 1.2), var(--y)) rotate(calc(var(--rot) - 360deg)) scale(1.1);
        opacity: 0;
    }
}

@keyframes fall5 {
    0% {
        transform: translate(0, 0) rotate(0deg);
        opacity: 1;
    }

    100% {
        transform: translate(var(--x), var(--y)) rotate(calc(var(--rot) + 180deg)) scale(1);
        opacity: 0;
    }
}

/* goals */
#goal-setting {
    position: fixed;
    top: 75px;
    left: 15px;
    z-index: 1000;
    font-family: 'Comic Neue', cursive;
    font-size: 1.1rem;
    color: #000;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    border: 4px solid #000;
    border-radius: 25px 8px 30px 10px;
    background-color: transparent;
    box-shadow: 4px 4px 0 #000;
    text-shadow:
        -1px -1px 0 #fff,
        1px -1px 0 #fff,
        -1px 1px 0 #fff,
        1px 1px 0 #fff;
    transform: rotate(-1deg);
    transition: transform 0.2s ease;
}

#goal-setting:hover {
    transform: scale(1.05) rotate(1deg);
}

#goal-input {
    all: unset;
    font-family: 'Comic Neue', cursive;
    font-size: 1.1rem;
    text-align: center;
    color: #000;
    width: 32px;
    background: transparent;
    text-shadow:
        -1px -1px 0 #fff,
        1px -1px 0 #fff,
        -1px 1px 0 #fff,
        1px 1px 0 #fff;

    transform: rotate(-1.5deg);
    transition: transform 0.2s ease;
    cursor: pointer;
}

#goal-input:hover {
    transform: scale(1.05) rotate(1deg);
}

#goal-input:focus {
    cursor: text;
    transform: scale(1.05) rotate(0.5deg);
    box-shadow: 2px 2px 0 #43aa8b;
    padding: 2px 4px;
    background-color: #fffde7;
    border-radius: 4px;
}


/* Media Queries */

@media (max-width: 480px) {
    #timer {
        font-size: 2.8rem;
        height: 3.2rem;
        line-height: 3.2rem;
    }

    .quote-popup,
    .speech-bubble {
        font-size: 1rem;
    }
}