@property --gradient-num {
    syntax: "<number>";
    inherits: false;
    initial-value: -0.3;
}

*, ::after, ::before, ::backdrop, ::file-selector-button {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    border: 0 solid;
}

body {
    background-color:#0B0F14;
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100vh;
    height: 100dvh;
    margin: 0;
    overflow: hidden;
}
a {
    text-decoration: none;
}
#background {
    position: fixed;
    width: 100%;
    height: 100%;
    z-index: -1;
    opacity: 0.03;
}
#logo {
    position: fixed;
    width: 10vw;
    height: auto;
    top: 2%;
    left: 2%;
}
#input-phase {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5vh;
    gap: 5dvh;
    width: 100%;
    height: 100%;
}

#title {
    margin-top: 10vh;
    margin-top: 10dvh;
    font-size: clamp(1rem, 4vw, 2.5rem);
    color: rgba(186, 210, 255, 0.75);
    text-align: center;
}
#main {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10vw;
    overflow: hidden;
    width: 100%;
    height: 100%;
}
.guide-step {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(37, 99, 235, 0.06);
    border: 1px solid rgba(59, 130, 246, 0.18);
    border-radius: 10px;
    padding: 10px 14px;
}

.guide-title {
    color: rgba(148, 163, 184, 0.6);
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    text-align: center;
    margin: 0;
    font-family: system-ui, sans-serif;
}

.guide-step-desc {
    color: rgba(186, 210, 255, 0.75);
    font-size: 13px;
    font-family: system-ui, sans-serif;
    line-height: 1.4;
}

.guide-icon {
    width: 5vw;
}

#image-upload {
    width: clamp(200px, 40vw, 450px);
    aspect-ratio: 1 / 1;
    background: rgba(37, 99, 235, 0.08);
    border: 2px solid rgba(59, 130, 246, 0.55);
    border-radius: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s, border-color 0.15s;
}
#image-upload:hover, #image-upload.file-hover {
    background-color: rgba(37, 99, 235, 0.25);
    border-color: rgba(96, 165, 250, 0.8);
    cursor: pointer;
}

#camera-input {
    display: none;
}

#guide-container {
    width: 25vw; 
    display: flex; 
    flex-direction: column; 
    gap: 1vw;
}

footer {
    display: flex;
    align-items: center;
    display: flex;
    padding: 20px 0;
    width: 100%;
    justify-content: center;
    gap: 10vw;  
    background-color: rgba(0, 0, 0, 0.8);
    color: rgba(255, 255, 255, 0.75);
}

footer p a {
    color: white;
    position: relative;
    transition: color 0.15s;
}

footer p a:hover {
    color: rgba(96, 165, 250, 0.8);
}

footer p a::after {
    content: "";
    display: inline-block;
    width: 50px;
    height: 2px;
    background-color: rgba(255, 255, 255, 0.75);
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    transition: width 0.15s, background-color 0.15s;
}

footer p a:hover::after{
    background-color: rgba(96, 165, 250, 0.8);
    width: 60px;
}

.dot {
    max-width: 10px;
    max-height: 10px;
}

#processing-phase, #output-phase {
    display: none;
}

#processing-phase {
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

#processing-image {
    position: relative;
    width: 50vw;
    max-height: 50vh;
    max-height: 50dvh;
    height: auto;
    filter: blur(5px);
}
#processing-image-container {
    overflow: hidden;
    position: relative;
    width: 50vw;
    max-height: 50vh;
    max-height: 50dvh;
    height: auto;
}
#file-name {
    text-align: center;
}

#processing-image-container::before {
    z-index: 1;
    content: "";
    position: absolute;
    height: 100%;
    width: 100%;
    left: 0;
    right: 0;
    background: linear-gradient(
        45deg, 
        rgba(255, 255, 255, 0) calc((var(--gradient-num) * 100%) - 20%), 
        rgba(96, 165, 250, 1) calc(var(--gradient-num) * 100%), 
        rgba(255, 255, 255, 0) calc((var(--gradient-num) * 100%) + 20%)
    );
    animation: 2.5s ease-in-out 0.2s infinite gradientAnimation;
}

#output-phase {
    position: fixed;
    z-index: 2;
    top: 5%;
    left: 5%;
    right: 5%;
    bottom: 5%;
    padding: 0 10px;
    border: 10px solid rgba(186, 210, 255, 1);
    border-radius: 20px;
    /* display: flex; */
    flex-direction: row;
    justify-content: center;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.8);
}

#output-image {
    flex-basis: 0;
    flex-grow: 1;
    min-width: 0;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    border: 2px solid rgba(186, 210, 255, 0.75);
}

#divider {
    background-color: rgba(186, 210, 255, 0.75);
    height: 90%;
    min-width: 2px;
    margin: 0 10px;
}

#output-text {
    display: flex;
    flex-direction: column;
    height: 90%;
    flex-basis: 0;
    flex-grow: 1;
    color: rgba(186, 210, 255, 0.75);
    font-size: 1rem;
    min-width: 0;
}
#gap {
    flex-grow: 1;
}
#gap2 {
    flex-grow: 1;
}
#prediction {
    font-size: 3rem;
    font-weight: bold;
    margin-bottom: 10px;
    color: red;
}
#score {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: red;
}
#close-icon {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 50px;
    height: 50px;
    cursor: pointer;
}
#info {
    font-size: 1rem;
}

#time-notice {
    opacity: 0;
    font-size: 0.8rem;
    color: rgba(186, 210, 255, 0.5);
    text-align: center;
    margin-top: 10px;
    transition: opacity 1s linear;
}
#time-notice.show {
    opacity: 1;
}

@keyframes gradientAnimation {
    0% {
        --gradient-num: -0.3; /* Pushes the blue core entirely off the bottom-left corner */
    }
    100% {
        --gradient-num: 1.3;  /* Pulls the blue core entirely past the top-right corner */
    }
}

@media (max-width: 700px) {
    a {
        text-decoration: none;
    }
    #logo {
        width: 10vh;
        width: 10dvh;
        left: 50%;
        top: 4vh;
        top: 4dvh;
        transform: translateX(-50%);
    }
    #input-phase {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 5vh;
        gap: 5dvh;
        width: 100%;
        height: 100%;
    }

    #title {
        font-size: clamp(1rem, 2.75vh, 2.5rem);
        font-size: clamp(1rem, 2.75dvh, 2.5rem);
    }
    #main {
        flex-direction: column;
        gap: 3vh;
        gap: 3dvh;
    }

    #image-upload {
        width: clamp(150px, 80vw, 450px);
        height: clamp(150px, 30vh, 450px);
        height: clamp(150px, 30dvh, 450px);
    }

    #guide-container {
        width: 75vw; 
        gap: 1vh;
        gap: 1dvh;
    }

    footer {
        gap: 3.5vw;  
        font-size: clamp(0.5rem, 5vw, 1rem);
    }

    footer p a::after {
        width: clamp(20px, 15vw, 50px);
    }

    footer p a:hover::after{
        background-color: rgba(96, 165, 250, 0.8);
        width: clamp(25px, 20vw, 60px);
    }

    .dot {
        max-width: clamp(5px, 2vw, 10px);
    }

    .guide-title {
        font-size: clamp(7px, 5vw, 11px);
    }

    .guide-step-desc {
        font-size: clamp(9px, 5vw, 13px);
        line-height: 1.05;
    }

    #processing-image {
        width: 70vw;
    }
    #processing-image-container {
        width: 70vw;
    }

    #output-phase {
        padding: 0 5px;
        border: 8px solid rgba(186, 210, 255, 1);
        border-radius: 15px;
        flex-direction: column;
    }

    #divider {
        width: 90%;
        height: auto;
        min-height: 2px;
        min-width: auto;
        margin: 10px 0;
    }
    #prediction {
        margin-bottom: 5px;
    }
    #score {
        margin-bottom: 5px;
    }
    #close-icon {
        top: 5px;
        right: 5px;
        width: 40px;
        height: 40px;
    }
    #info {
        font-size: 0.7rem;
        line-height: 1;
        padding-bottom: 5px;
    }

    #time-notice {
        font-size: clamp(0.6rem, 3.5vw, 0.8rem);
        margin-top: 5px;
    }

    #file-name {
        font-size: clamp(0.8rem, 3.5vw, 1rem);
    }
}