@import url("https://fonts.googleapis.com/css2?family=Jersey+10&family=Jersey+15&family=Jersey+20&display=swap");
#badge-vid, canvas{
    aspect-ratio: 296 / 152;
    height: 70vh;
    width: auto;
    background-color: #000;
}


:root {
    --w: 500px;
    --h: 500px;
}

html {
    background-color: #fff;
}

body {
    margin: 0;
    max-width: 100vw;
    max-height: 100vh;
    overflow: hidden;
}

img.owo {
    position: absolute;
    z-index: 99999;
    top: 0px;
    left: 0px;
    mix-blend-mode: difference;
    width: 500px;
    height: 500px;
}

body {
    display: flex;
    flex-direction: column;
    align-items: center;
    /* padding: 20px; */
    gap: 10px;
    background: #002b59;
}

div.initial,
div.analysing,
div.app {
    margin-top: -10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    /* min-height: calc(var(--h)); */
    min-height: calc(100vh - 20px);
}

.title {
    font-family: "Jersey 20";
    font-style: normal;
    font-weight: 400;
    font-size: 96px;
    line-height: 96px;
    color: #00b9be;
    flex: none;
    order: 0;
    flex-grow: 0;
}

.subtitle {

    font-family: "Jersey 10";
    font-style: normal;
    font-weight: 400;
    font-size: 32px;
    line-height: 34px;

    color: #005f8c;
}

div.app .c {
    /* Inside auto layout */
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 0px;
    gap: 10px;
    width: 100%;
    /* ADD THESE TO FIX THE HEIGHT */
    height: 100%;
    /* Take up the remaining height of .app */
    flex-grow: 1;
    /* Force it to fill available vertical space */
    overflow: hidden;
    /* Keep everything contained */
}

button.main{
    flex: none;
    flex-grow: 0;
    background: #00b9be;
    box-shadow: 0px 4px 0px #00b9be,
        0px -4px 0px #00b9be,
        4px 0px 0px #00b9be,
        -4px 0px 0px #00b9be;
    flex: none;
    order: 0;
    flex-grow: 0;
    padding: 5px;
    padding-left: 30px;
    padding-right: 30px;
    font-family: "Jersey 15";
    font-style: normal;
    font-weight: 400;
    font-size: 39px;
    line-height: 39px;
    border: 0px;
    color: #9ff4e5;
    transition: background ease-in-out 0.1s;

    &:active {
        background: #9ff4e500;
    }
}

button.reload,
button.openfile {
    display: inline-block;
    width: fit-content;
    font-size: 30px;
    line-height: 32px;
}

/* ── Relay Mode UI ────────────────────────────────────────────────── */
.relay-section {
    width: 100%;
    max-width: 500px;
    padding: 0 10px;
}

.relay-toggle {
    display: flex;
    justify-content: center;
    margin-bottom: 8px;
}

.relay-label {
    font-family: 'Jersey 10';
    font-size: 22px;
    color: #9FF4E5;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

.relay-label input[type="checkbox"] {
    display: none;
}

.relay-switch {
    width: 44px;
    height: 24px;
    background: #003d6d;
    border: 2px solid #9FF4E5;
    border-radius: 0;
    position: relative;
    transition: background 0.2s;
}

.relay-switch::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    background: #9FF4E5;
    top: 2px;
    left: 2px;
    transition: transform 0.2s;
}

.relay-label input:checked + .relay-switch {
    background: #00b9be;
}

.relay-label input:checked + .relay-switch::after {
    transform: translateX(20px);
    background: #002b59;
}

#relayPanel {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border: 2px solid #9FF4E5;
    background: #003d6d;
    margin-top: 5px;
}

#hostPanel, #joinPanel {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.relay-code {
    font-family: 'Jersey 20';
    font-size: 48px;
    color: #00b9be;
    letter-spacing: 8px;
    text-shadow: 0 0 10px #00b9be;
    background: #002b59;
    padding: 8px 20px;
    border: 2px solid #9FF4E5;
}

.relay-status {
    font-family: 'Jersey 10';
    font-size: 18px;
    color: #9FF4E5;
    text-align: center;
}

.code-input {
    font-family: 'Jersey 20';
    font-size: 28px;
    text-transform: uppercase;
    letter-spacing: 4px;
    text-align: center;
    background: #002b59;
    color: #00b9be;
    border: 2px solid #9FF4E5;
    padding: 6px 12px;
    width: 180px;
}

.code-input::placeholder {
    color: #005f8c;
    font-size: 20px;
}

.code-input:focus {
    outline: none;
    border-color: #00b9be;
}
.buttonrow{
    display: flex;
    gap: 15px;
}

.controls {
    display: flex;
    gap: 20px;
    align-items: center;
}

.controls label {
    font-family: 'Jersey 10';
    font-size: 24px;
    color: #9FF4E5;
    display: flex;
    align-items: center;
    gap: 8px;
}

.controls select,
.controls input[type="number"] {
    font-family: 'Jersey 10';
    font-size: 20px;
    background: #003d6d;
    color: #9FF4E5;
    border: 2px solid #9FF4E5;
    padding: 4px 8px;
    border-radius: 0;
    -webkit-appearance: none;
    appearance: none;
}

.controls input[type="number"] {
    width: 60px;
    text-align: center;
}

/* Firmware detection badge */
.firmware-badge {
    font-family: 'Jersey 10';
    font-size: 20px;
    padding: 4px 12px;
    border: 2px solid;
    display: inline-block;
}

.firmware-badge.improved {
    color: #00ff88;
    border-color: #00ff88;
    background: rgba(0, 255, 136, 0.1);
}

.firmware-badge.stock {
    color: #ffaa00;
    border-color: #ffaa00;
    background: rgba(255, 170, 0, 0.1);
}

button.secondary {
    padding: 5px 30px;
    border: 0px;
    /* width: 208px;
    height: 42px; */
    background: #9ff4e5;
    /* opacity: 0; */
    box-shadow: 0px 4px 0px #9ff4e5,
        0px -4px 0px #9ff4e5,
        4px 0px 0px #9ff4e5,
        -4px 0px 0px #9ff4e5;
    font-family: "Jersey 10";
    font-style: normal;
    font-weight: 400;
    font-size: 30px;
    line-height: 32px;
    transition: background ease-in-out 0.1s;
    color: #00b9be;

    &:active {
        background: #00b8be00;
    }
}

.initial.not-picked .c button.continue {
    opacity: 0;
}

.textanim {
    filter: url(#pixelate);
    color: #fff;
    font-size: 2em;
    text-align: center;
    overflow-y: auto;
    scrollbar-width: 0px;

}

.textanim::-webkit-scrollbar {
    display: none;
}

.textanim,
.c {
    max-height: calc(100% - 100px);

}

.initial,
.analysing {
    padding: 20px;
}

/* Style the interactive invisible bars for easy clicking */
.click-target {
    fill: transparent;
    cursor: pointer;
}

.click-target:hover {
    fill: rgba(255, 255, 255, 0.05);
    /* Slight highlight on hover */
}


.app {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 10px 0px;
    gap: 15px;
    width: 100vw;
    background: #002B59;

    & .topbar {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        padding: 0px 10px;
        /* width: calc(var(--w) - 20px); */
        width: calc(100vw - 20px);
        flex: none;
        order: 0;
        flex-grow: 0;

        & .title {
            font-family: 'Jersey 20';
            font-style: normal;
            font-weight: 400;
            font-size: 47.56px;
            line-height: 48px;
            /* identical to box height */

            color: #00B9BE;


            /* Inside auto layout */
            flex: none;
            order: 0;
            flex-grow: 0;
        }

        & .subtitle {

            font-family: 'Jersey 20';
            font-style: normal;
            font-weight: 400;
            font-size: 25.56px;
            line-height: 26px;
            /* identical to box height */

            color: #9FF4E5;


            /* Inside auto layout */
            flex: none;
            order: 1;
            flex-grow: 0;
        }
    }
}


.area-title {
    font-family: 'Jersey 20';
    font-style: normal;
    font-weight: 400;
    color: #9FF4E5;
    font-size: 47.56px;
    line-height: 48px;
}

.area-subtitle {
    font-family: 'Jersey 20';
    font-style: normal;
    font-weight: 400;
    color: #9FF4E5;
    font-size: 20px;
    line-height: 20px;
}

.stat {
    font-family: 'Jersey 20';
    font-style: normal;
    font-weight: 400;
    color: #9FF4E5;
    font-size: 30px;
    line-height: 30px;
}

.app .c {
    display: flex;
    flex-direction: row !important;
    gap: 10px;
    padding-left: 10px;
    padding-right: 10px;
    max-width: calc(100% - 20px);
}

.area {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    flex-grow: 1;
    max-height: 100%;
    overflow: hidden;
}

.story {
    flex-grow: 1;
    border: 2px solid #9FF4E5;
    /* filter: drop-shadow(0px 2px 0px #9FF4E5) drop-shadow(2px 0px 0px #9FF4E5) drop-shadow(0px -2px 0px #9FF4E5) drop-shadow(-2px 0px 0px #9FF4E5); */
    box-shadow: 0px 2px 0px #9FF4E5, 2px 0px 0px #9FF4E5, 0px -2px 0px #9FF4E5, -2px 0px 0px #9FF4E5;
    background-color: transparent !important;
    resize: none;
    height: 0;
    /* Flexbox will scale it up from 0 to fill space */
    min-height: 0;
    /* Prevents content from stretching the box */
    max-height: 100%;
    width: calc(100% - 4px);
    margin-bottom: 2px;
    margin-left: 2px;
    color: #9FF4E5;
    padding: 5px;
    box-sizing: border-box;
    overflow-y: auto;
    font-family: 'Jersey 20';
    font-size: 15pt;
}

.story .para {
    display: block;

    &:hover,
    &.active {
        background-color: rgba(255, 255, 255, 0.285);
    }
}