/* ######################################## Variables ########################################*/


:root {
    /* Colors */
    --main-bg-color: rgb(229, 226, 226);
    --color1: #115740;
    --color2: #B9975B;

    /* Text Formatting */
    --font-family: "Century Gothic", sans-serif;
    --txt-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);

    /* Text Sizes, Line Height, Margin */
    --hello-font-size: 7vmax;
    --sub-hello-font-size: 2vmax;
    --about-me-font-size: 2vmax;
    --about-me-line-height: 7vh;
    --about-me-margin-top: 5vh;

    /* Translations */
    --center-x: translateX(-50%);
    --center-y: translateY(-50%);
    --center-both: translate(-50%, -50%);
}


/* ######################################## General ########################################*/


.layout {
    display: flex;
    min-height: 100svh;
}

.stage {
    position: relative;           /* important: so prediction-panel is relative to stage */
    top: calc(10vh + 5px);
    left: calc(10vw + 10px);
    width: calc(90vw - 10px);
    height: calc(80svh - 5px);
}

#drawing_canvas {
    width: 100%;
    height: 100%;
    display: block;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.topbar {
    position: fixed;
    top: 0;
    left: calc(10vw + 10px);
    width: calc(90vw - 10px);
    height: 10vh;
    background-color: var(--main-bg-color);
    display: block;
    align-items: center;
    justify-content: center;
    box-shadow: var(--txt-shadow);
    border-bottom: var(--color1) solid 5px;
}

.bottombar {
    position: fixed;
    top: 90vh;
    left: calc(10vw + 10px);
    width: calc(90vw - 10px);
    height: 10vh;
    background-color: var(--main-bg-color);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--txt-shadow);
    border-top: var(--color1) solid 5px;
    padding: 0 1.5rem;
    text-align: center;
    font-family: var(--font-family);
    font-size: 1.6rem;
}

/* keep prediction on its own line, a bit larger + bold */
.prediction-output {
    display: block;
    font-weight: bold;
    font-size: 2rem;      /* just bigger than 1.6rem */
    margin-bottom: 0.4rem;
}

/* optional: simple "key" look for Ctrl/Z */
.kbd {
    padding: 0.1em 0.35em;
    border-radius: 4px;
    border: 1px solid #999;
    background-color: #eee;
    font-size: 0.9em;
}


.logits-readout {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    height: 100%;
    padding: 0 1.5rem;
    font-family: var(--font-family);
    font-size: 2vmax;
    gap: 1.5rem;
    white-space: nowrap;
    overflow-x: auto;
}

.logit-item {
    color: red;          /* default = red */
}

.logit-item.max-logit {
    color: green;        /* highest logit = green */
    font-weight: bold;
}

/* ######################################## Desktop ########################################*/


/* Initially hide desktop-specific elements */


/* ######################################## Mobile ########################################*/


/* Initially hide mobile-specific elements */


/* ######################################## Utility ########################################*/


@media (max-height: 768px) {
    /* Mobile Landscape */

    .topbar, .bottombar {
        height: 20vh;
    }
    .bottombar {
        top: 80vh;
    }

    .stage {
        top: calc(20vh + 5px);
        height: calc(60svh - 5px);
    }

}


/* Undo/Redo overlayed ~10% above bottom of canvas/stage */
.prediction-panel {
    position: absolute;
    left: 50%;
    bottom: 10%;                  /* 10% of stage/canvas height */
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-family);
    text-align: center;
    z-index: 5;
}

.prediction-panel-buttons {
    display: flex;
    gap: 0.5rem;
}

.prediction-panel button {
    padding: 0.3rem 0.9rem;
    border-radius: 999px;
    border: 2px solid var(--color1);
    background-color: var(--color1);
    color: #fff;
    font-weight: bold;
    cursor: pointer;
}

.prediction-output {
    display: block;
    font-weight: bold;
    font-size: 2rem;
    margin-bottom: 0.4rem;
}

@media (max-width: 768px) {

    .layout {
        display: flex;
        flex-direction: column;
        min-height: 100svh;
    }

    /* topbar fixed at top */
    .topbar {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        min-height: 12vh;
        height: auto;
        padding-top: calc(env(safe-area-inset-top, 0px) + 1.5rem);
        padding-bottom: 0.5rem;
        box-sizing: border-box;
        display: flex;
    }

    /* canvas section below the top bar, scrolls with the page */
    .stage {
        position: relative;
        top: auto;
        left: 0;
        width: 100vw;
        margin-top: calc(12vh + 0.5rem);  /* space for topbar */
        padding: 0 0 1rem 0;
        height: auto;                     /* let it size to content */
    }

    #drawing_canvas {
        display: block;
        width: 100%;
        max-width: 512px;
        margin: 0 auto;
        height: auto;                     /* shrink when necessary */
        aspect-ratio: 1 / 1;              /* keep it square */
    }

    /* Undo/Redo still sit ~10% above bottom of the canvas area */
    .prediction-panel {
        bottom: 10%;                      /* relative to stage/canvas height */
    }

    /* instructions bar sits BELOW the canvas and scrolls with it */
    .bottombar {
        position: relative;
        top: auto;
        left: 0;
        width: 100%;
        margin-top: 0.75rem;

        background-color: var(--main-bg-color);
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: var(--txt-shadow);
        border-top: var(--color1) solid 5px;

        padding: 0.75rem;
        box-sizing: border-box;

        font-family: var(--font-family);
        font-size: 1.2rem;
        text-align: center;
        overflow-x: hidden;
    }

    .bottom-instructions {
        margin: 0;
        max-width: 100%;
        text-align: center;
    }

    /* prediction line still slightly larger + bold on mobile */
    .prediction-output {
        display: block;
        font-weight: bold;
        font-size: 1.4rem;
        margin-bottom: 0.3rem;
    }

    .logits-readout {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        align-content: space-evenly;
        padding: 0.8rem 0.8rem;
        font-family: var(--font-family);
        font-size: 1.2rem;
        column-gap: 0.6rem;
        row-gap: 0.5rem;
        text-align: center;
        overflow-x: hidden;
        white-space: nowrap;
    }
}
