/* Everything is sized in em off the root font-size, which follows the
   viewport (one value landscape, one upright), so the whole desktop scales
   as one piece from a phone to a 4K monitor. */
html {
    font-size: clamp(10px, min(1.25vw, 2.05vh), 24px);
}

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

body {
    background: #121940;
    color: #1F2328;
    font-family: "Segoe UI Variable Text", "Segoe UI", "Selawik", system-ui, -apple-system, BlinkMacSystemFont, Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
    cursor: default;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}


/* --- Desktop -------------------------------------------------------------- */

#pg-desktop {
    position: fixed;
    inset: 0;
    overflow: hidden;
}

.pg-wall {
    position: absolute;
    inset: 0;
    overflow: hidden;
    background: linear-gradient(160deg, #1F3F94 0%, #2B2E7C 48%, #121940 100%);
}

.pg-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(5.5vmax);
}

.pg-b1 { left: 49%; top: 28%; width: 62%; height: 73%; background: #4C86FF; opacity: 0.75; }
.pg-b2 { left: 64%; top: 50%; width: 41%; height: 50%; background: #CF6FD9; opacity: 0.7; }
.pg-b3 { left: -16%; top: -28%; width: 55%; height: 67%; background: #37C3E6; opacity: 0.4; }
.pg-b4 { left: 12%; top: 63%; width: 37%; height: 43%; background: #6D4FD8; opacity: 0.45; }

.pg-swoosh {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
}

.pg-icons {
    position: absolute;
    left: 0.7em;
    top: 0.8em;
    width: 6.2em;
}

.pg-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3em;
    margin-bottom: 1.3em;
    color: #FFFFFF;
    font-size: 0.92em;
    text-align: center;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.pg-icon svg {
    width: 3.4em;
    height: 3.4em;
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.3));
}


/* --- Taskbar -------------------------------------------------------------- */

.pg-taskbar {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3.4em;
    background: rgba(20, 24, 38, 0.9);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    color: #FFFFFF;
}

.pg-apps {
    position: absolute;
    left: 50%;
    top: 0;
    height: 100%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 0.3em;
}

.pg-app {
    position: relative;
    width: 3.1em;
    height: 2.9em;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.45em;
}

.pg-app svg {
    width: 1.85em;
    height: 1.85em;
}

.pg-app-on {
    background: rgba(255, 255, 255, 0.09);
}

.pg-app-on::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 0.1em;
    width: 0.8em;
    height: 0.22em;
    margin-left: -0.4em;
    border-radius: 0.11em;
    background: #8FB2FF;
}

.pg-tray {
    position: absolute;
    right: 0.8em;
    top: 0;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 0.9em;
    font-size: 0.9em;
}

.pg-tray svg {
    width: 1.25em;
    height: 1.25em;
}

.pg-clock {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.35;
    white-space: nowrap;
}


/* --- The PrankGuard window ------------------------------------------------ */

#pg-window {
    position: absolute;
    left: 50%;
    top: calc(50% - 1.7em);
    width: 62em;
    height: 35.5em;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    background: #FFFFFF;
    border-radius: 0.75em;
    overflow: hidden;
    box-shadow: 0 1.4em 3.6em rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(0, 0, 0, 0.35);
}

.pg-titlebar {
    flex: none;
    height: 2.7em;
    display: flex;
    align-items: center;
    gap: 0.7em;
    padding-left: 0.95em;
    background: #0F1B2D;
    color: #FFFFFF;
    font-weight: 600;
}

.pg-tb-shield {
    width: 1.15em;
    height: 1.3em;
}

.pg-ctrls {
    margin-left: auto;
    display: flex;
    align-self: stretch;
}

.pg-ctrls span {
    width: 3.4em;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #AAB4C4;
    font-weight: 400;
}

.pg-ctrls .pg-close:hover {
    background: #C42B1C;
    color: #FFFFFF;
}

.pg-body {
    flex: 1;
    min-height: 0;
    display: flex;
}

.pg-nav {
    flex: none;
    width: 12.5em;
    display: flex;
    flex-direction: column;
    gap: 0.15em;
    padding: 1em 0.7em;
    box-sizing: border-box;
    background: #16233A;
    color: #B9C4D6;
}

.pg-nav span {
    padding: 0.6em 0.9em;
    border-radius: 0.45em;
    white-space: nowrap;
}

.pg-nav .pg-on {
    background: #23365A;
    color: #FFFFFF;
    font-weight: 600;
}

.pg-nav .pg-on::after {
    content: " \25CF";
    color: #FF4D4D;
}

.pg-nav .pg-lic {
    margin-top: auto;
    padding: 0 0.9em;
    font-size: 0.8em;
    color: #7F8BA0;
    white-space: normal;
}

.pg-main {
    flex: 1;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 1.3em 1.7em 1.2em;
    box-sizing: border-box;
}

.pg-alert {
    flex: none;
    display: flex;
    align-items: center;
    gap: 1.1em;
}

.pg-big-shield {
    flex: none;
    width: 4.1em;
    height: 4.6em;
}

.pg-kicker {
    font-size: 0.88em;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #C62828;
}

.pg-count {
    font-size: 2.45em;
    font-weight: 700;
    line-height: 1.12;
    color: #C62828;
    font-variant-numeric: tabular-nums;
}

/* Upright the number and the words may part, but "threats found" stays whole. */
.pg-count span + span {
    white-space: nowrap;
}

.pg-prog {
    flex: none;
    display: flex;
    justify-content: space-between;
    margin-top: 1.1em;
    color: #4A525C;
}

.pg-prog b {
    font-variant-numeric: tabular-nums;
}

.pg-bar {
    flex: none;
    height: 0.75em;
    margin-top: 0.35em;
    background: #F0E3E3;
    border-radius: 0.4em;
    overflow: hidden;
}

.pg-bar i {
    display: block;
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, #EF6C00, #D32F2F);
    transition: width 0.4s ease;
}

.pg-path {
    flex: none;
    margin-top: 0.45em;
    font-family: Consolas, "Cascadia Mono", "DejaVu Sans Mono", "Liberation Mono", Menlo, monospace;
    font-size: 0.82em;
    color: #7A828C;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Takes whatever height is left; the JS drops rows that would not fit
   whole, so the table never shows half a row. */
.pg-table {
    flex: 1;
    min-height: 0;
    margin-top: 0.8em;
    overflow: hidden;
}

.pg-table table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 0.95em;
}

.pg-table th {
    padding: 0.45em 0.6em;
    border-bottom: 1px solid #E3E7EE;
    text-align: left;
    font-size: 0.8em;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #7A828C;
}

.pg-table td {
    padding: 0.42em 0.6em;
    border-bottom: 1px solid #F0F2F5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pg-col-sev { width: 7.6em; }
.pg-col-where { width: 12.5em; }

.pg-name {
    font-family: Consolas, "Cascadia Mono", "DejaVu Sans Mono", "Liberation Mono", Menlo, monospace;
    font-weight: 600;
}

/* "Found in" under the name: only upright, where its own column is dropped. */
.pg-in {
    display: none;
    font-size: 0.82em;
    color: #7A828C;
}

.pg-sev {
    display: inline-block;
    padding: 0.12em 0.65em;
    border-radius: 1em;
    font-size: 0.8em;
    font-weight: 700;
    color: #FFFFFF;
}

.pg-crit { background: #C62828; }
.pg-high { background: #EF6C00; }
.pg-med { background: #E59A00; }
.pg-low { background: #6F7C8C; }

.pg-table tr.pg-new td {
    animation: pg-flash 1.8s ease-out;
}

@keyframes pg-flash {
    from { background: #FFD9D2; }
    to   { background: transparent; }
}

.pg-buttons {
    flex: none;
    display: flex;
    justify-content: flex-end;
    gap: 0.7em;
    margin-top: 0.9em;
    font-weight: 600;
}

.pg-buttons span {
    padding: 0.6em 1.35em;
    border-radius: 0.55em;
}

.pg-ignore {
    border: 1px solid #C9CED6;
    color: #4A525C;
}

.pg-quarantine {
    background: #C62828;
    color: #FFFFFF;
}


/* --- Held upright: the window is maximised ------------------------------- */

@media (orientation: portrait) {
    html {
        font-size: clamp(11px, 3.5vw, 22px);
    }

    .pg-icons,
    .pg-nav .pg-lic,
    .pg-nav .pg-nav-wide,
    .pg-app-wide,
    .pg-tray-wide,
    .pg-col-where {
        display: none;
    }

    #pg-window {
        left: 0;
        top: 0;
        right: 0;
        bottom: 3.4em;
        width: auto;
        height: auto;
        transform: none;
        border-radius: 0;
    }

    .pg-body {
        flex-direction: column;
    }

    .pg-nav {
        width: auto;
        flex-direction: row;
        padding: 0.45em 0.6em;
        overflow: hidden;
    }

    .pg-nav span {
        padding: 0.5em 0.8em;
    }

    .pg-main {
        padding: 1.1em 1.1em 1em;
    }

    .pg-alert {
        gap: 0.9em;
    }

    .pg-big-shield {
        width: 3.3em;
        height: 3.7em;
    }

    .pg-count {
        font-size: 1.95em;
    }

    .pg-in {
        display: block;
    }

    .pg-table td {
        padding-top: 0.5em;
        padding-bottom: 0.5em;
    }

    .pg-buttons span {
        flex: 1;
        text-align: center;
    }
}


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

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

body.pg-crashed #pg-desktop {
    display: none;
}

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

.pg-bsod-inner {
    box-sizing: border-box;
    width: 100%;
    padding: 0 10vw;
    /* Capped by height as well as width: this screen carries one paragraph
       more than win-update's, and a short wide window would cut it off. */
    font-size: clamp(15px, min(1.75vw, 3.2vh), 36px);
    line-height: 1.35;
}

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

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

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

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

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

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

/* Held upright, the QR goes above the small print rather than beside it,
   and grows until a phone across a desk can still scan it. */
@media (orientation: portrait) {
    #pg-qr {
        width: 8.5em;
        height: 8.5em;
    }

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

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

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


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

#pg-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;
}

#pg-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. */
#pg-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: pg-hint-countdown var(--hint-ms, 8s) linear forwards;
}

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

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