html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

body {
    background: #14162B;
    color: #FFFFFF;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}


/* --- Backdrop: a desktop behind frosted glass ---------------------------- */

#tl-backdrop {
    position: fixed;
    inset: 0;
    overflow: hidden;
    background: linear-gradient(160deg, #1D2552 0%, #241D4A 50%, #0E1126 100%);
}

#tl-backdrop i {
    position: absolute;
    display: block;
}

.tl-blob {
    border-radius: 50%;
    filter: blur(7vmin);
}

.tl-b1 { left: 48%; top: 24%; width: 62vw; height: 64vh; background: #4C86FF; opacity: 0.55; }
.tl-b2 { left: 64%; top: 52%; width: 44vw; height: 46vh; background: #C76BD6; opacity: 0.5; }
.tl-b3 { left: -16%; top: -22%; width: 56vw; height: 52vh; background: #34BFE0; opacity: 0.35; }
.tl-b4 { left: 6%; top: 62%; width: 40vw; height: 40vh; background: #6D4FD8; opacity: 0.4; }

/* Blurred window shapes and a taskbar: just enough to read as "my desktop,
   behind glass" without anything legible. */
.tl-ghost {
    border-radius: 2vmin;
    filter: blur(3.5vmin);
}

.tl-w1 { left: 9%; top: 6%; width: 52%; height: 76%; background: #E8ECF3; opacity: 0.2; }
.tl-w2 { left: 66%; top: 12%; width: 29%; height: 64%; background: #C9CDF5; opacity: 0.16; }
.tl-bar { left: -5%; right: -5%; bottom: -2vh; height: 9vh; background: #000000; opacity: 0.45; border-radius: 0; }

#tl-backdrop::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(10, 11, 24, 0.5);
}


/* --- The block ------------------------------------------------------------ */

#tl-block {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 4vh 6vw 9vh;
    box-sizing: border-box;
    font-size: clamp(15px, 2.1vmin, 30px);
    line-height: 1.4;
}

.tl-icon {
    width: 4.6em;
    height: 4.6em;
    margin-bottom: 1.1em;
    border-radius: 1.2em;
    background: linear-gradient(160deg, #7B6DFF, #3A2EC4);
    box-shadow: 0 0.6em 1.6em rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.tl-icon svg {
    width: 58%;
    height: 58%;
}

.tl-title {
    margin: 0;
    font-size: 2.3em;
    font-weight: 600;
    line-height: 1.15;
    letter-spacing: -0.01em;
}

.tl-lead {
    margin: 0.55em 0 0.3em;
    font-size: 1.15em;
    color: #E6E6F0;
}

.tl-reset {
    margin: 0;
    color: #A9A9C0;
}

#tl-countdown {
    color: #D8D8EA;
    font-variant-numeric: tabular-nums;
}

.tl-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.65em;
    width: 21em;
    max-width: 100%;
    margin-top: 1.8em;
}

.tl-btn,
.tl-link {
    font: inherit;
    color: #FFFFFF;
    border: 0;
    outline: none;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.tl-btn {
    font-size: 1.05em;
    font-weight: 600;
    padding: 0.75em 1em;
    border-radius: 0.8em;
    background: rgba(255, 255, 255, 0.14);
}

.tl-btn-primary {
    background: #6A5CFF;
}

/* After the ask: the button stays put but goes quiet while it "waits". */
.tl-btn-primary.tl-asked {
    background: rgba(106, 92, 255, 0.35);
    color: #D9D6FF;
    cursor: default;
}

/* Hidden by visibility rather than display, so showing it moves nothing. */
.tl-status {
    margin: 0.9em 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6em;
    color: #C8C8DC;
    visibility: hidden;
}

.tl-status.tl-on {
    visibility: visible;
}

.tl-spinner {
    width: 1em;
    height: 1em;
    box-sizing: border-box;
    border-radius: 50%;
    border: 0.16em solid rgba(255, 255, 255, 0.25);
    border-top-color: #FFFFFF;
    animation: tl-spin 0.9s linear infinite;
}

@keyframes tl-spin {
    to { transform: rotate(360deg); }
}

.tl-link {
    margin-top: 0.4em;
    padding: 0.3em 0.6em;
    background: none;
    color: #A399FF;
}

.tl-nowrap {
    white-space: nowrap;
}

.tl-foot {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 3.5vh;
    margin: 0;
    padding: 0 6vw;
    font-size: 0.75em;
    color: #8D8DA3;
}

/* Upright on a phone the column is the whole width, so the type can grow. */
@media (orientation: portrait) {
    #tl-block {
        font-size: clamp(15px, 4.3vw, 28px);
        padding: 6vh 7vw 10vh;
    }

    .tl-title {
        font-size: 1.85em;
    }

    .tl-buttons {
        width: 100%;
        max-width: 22em;
    }
}


/* --- The blue screen ---------------------------------------------------- */

#tl-bsod {
    display: none;
    position: fixed;
    inset: 0;
    background: #0078D7;
    overflow: hidden;
    font-family: "Segoe UI Light", "Segoe UI", "Selawik", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
    font-weight: 300;
}

body.tl-crashed {
    cursor: none;
}

body.tl-crashed #tl-backdrop,
body.tl-crashed #tl-block {
    display: none;
}

body.tl-crashed #tl-bsod {
    display: flex;
    align-items: center;
}

.tl-bsod-inner {
    box-sizing: border-box;
    width: 100%;
    padding: 0 10vw;
    font-size: clamp(15px, 1.75vw, 36px);
    line-height: 1.35;
}

.tl-bsod-inner p {
    margin: 0 0 0.9em;
    max-width: 34em;
}

.tl-sad {
    font-size: 6.5em;
    line-height: 1;
    margin: 0 0 0.25em;
}

.tl-bsod-row {
    display: flex;
    align-items: flex-start;
    gap: 1.1em;
    margin-top: 1.4em;
}

#tl-qr {
    flex: 0 0 auto;
    width: 5.2em;
    height: 5.2em;
}

.tl-bsod-small {
    font-size: 0.62em;
    line-height: 1.45;
}

.tl-bsod-small p {
    margin-bottom: 0.8em;
}

/* Held upright, the QR goes above the small print rather than beside it. */
@media (orientation: portrait) {
    /* Big enough to scan off a phone: at 5.2em it came out near 90px wide
       on a 390px screen, too small for a camera across a desk. */
    #tl-qr {
        width: 8.5em;
        height: 8.5em;
    }

    .tl-bsod-inner {
        padding: 0 8vw;
        font-size: clamp(15px, 4.6vw, 30px);
    }

    .tl-bsod-row {
        flex-direction: column;
    }

    .tl-bsod-small {
        font-size: 0.8em;
    }
}


/* --- Hint ---------------------------------------------------------------- */

#tl-hint {
    position: fixed;
    left: 50%;
    top: 34px;
    transform: translateX(-50%);
    z-index: 4;

    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-weight: 400;
    font-size: clamp(15px, 4vw, 20px);
    line-height: 1.5;
    text-align: center;
    color: #FFFFFF;
    background: rgba(0, 0, 0, 0.72);
    border-radius: 14px;
    padding: 18px 28px 22px;
    box-sizing: border-box;
    width: max-content;
    max-width: min(92vw, 30em);
    overflow: hidden;

    transition: opacity 0.6s ease;
}

#tl-hint kbd {
    font-family: inherit;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.18);
    border-radius: 4px;
    padding: 1px 6px;
    white-space: nowrap;
}

/* Countdown to the hint going away: drains over HINT_TIMEOUT_MS, which the
   JS hands over as --hint-ms. */
#tl-hint::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    box-sizing: content-box;
    height: 5px;
    background: #FFFFFF;
    border-top: 1px solid #000000;
    border-bottom: 1px solid #000000;
    transform-origin: left center;
    animation: tl-hint-countdown var(--hint-ms, 8s) linear forwards;
}

@keyframes tl-hint-countdown {
    from { transform: scaleX(1); }
    to   { transform: scaleX(0); }
}

#tl-hint.tl-hint-gone {
    opacity: 0;
    pointer-events: none;
}
