* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #5E5EA8;

    cursor: default;
}


/* The whole screen is drawn in "Mac pixels": --m is one pixel of a 1998
   display, as a (possibly fractional) number of real pixels, picked by the
   script so the installer window fits the viewport. --l is a line width, the
   same thing rounded to a whole pixel so borders stay crisp. The type is
   12 Mac pixels, the system font size of the day. There are no media
   queries: a phone held upright gets a narrower window (--ww) and a bigger
   --m, and everything else follows. */
#mac-desktop {
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    z-index: 1;

    --m: 1px;
    --l: 1px;

    font-family: Charcoal, Chicago, "Helvetica Neue", Helvetica, Arial, Roboto, "Segoe UI", sans-serif;
    font-size: calc(12 * var(--m));
    line-height: 1.3;
    color: #000000;

    /* The Mac OS 8 default desktop: a dusky blue-violet with a fine woven
       texture, drawn as two offset dot lattices four Mac pixels apart. */
    background-color: #5E5EA8;
    background-image:
        radial-gradient(circle, #6B6BB8 30%, transparent 32%),
        radial-gradient(circle, #5252A0 30%, transparent 32%);
    background-size: calc(4 * var(--m)) calc(4 * var(--m));
    background-position: 0 0, calc(2 * var(--m)) calc(2 * var(--m));

    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
}


/* Platinum menu bar: light grey, one black rule under it. */
#mac-menubar {
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
    height: calc(20 * var(--m));
    padding: 0 calc(10 * var(--m)) 0 calc(18 * var(--m));

    display: flex;
    align-items: center;
    gap: calc(18 * var(--m));

    background: linear-gradient(#EEEEEE, #DDDDDD);
    border-bottom: var(--l) solid #000000;
    font-weight: bold;
    white-space: nowrap;
}

#mac-clock {
    margin-left: auto;
}


/* Desktop icons down the right-hand edge, labels on white the way the
   Finder drew them over a pattern. */
.mac-icon {
    position: absolute;
    right: calc(10 * var(--m));
    width: calc(76 * var(--m));

    display: flex;
    flex-direction: column;
    align-items: center;

    font-size: calc(10 * var(--m));
    text-align: center;
}

.mac-icon svg {
    width: calc(32 * var(--m));
    height: calc(32 * var(--m));
}

.mac-icon span {
    margin-top: calc(2 * var(--m));
    padding: 0 calc(2 * var(--m));
    background: #FFFFFF;
    white-space: nowrap;
}

#mac-icon-hd {
    top: calc(30 * var(--m));
}

#mac-icon-cd {
    top: calc(84 * var(--m));
}

#mac-icon-trash {
    bottom: calc(12 * var(--m));
}


/* A Platinum window: black outline, a white-and-grey bevel inside it, and
   the one-pixel drop shadow. */
.mac-win {
    position: absolute;
    left: 50%;
    top: 46%;
    transform: translate(-50%, -50%);
    z-index: 2;

    width: calc(var(--ww, 400) * var(--m));
    padding: calc(2 * var(--m));

    background: #DDDDDD;
    border: var(--l) solid #000000;
    box-shadow:
        inset var(--l) var(--l) 0 #FFFFFF,
        inset calc(-1 * var(--l)) calc(-1 * var(--l)) 0 #999999,
        var(--l) var(--l) 0 #000000;
}

/* Title bar: the Platinum pinstripes — a light and a dark line every two
   Mac pixels — with the title knocked out of them on the window's grey. */
.mac-title {
    position: relative;
    height: calc(18 * var(--m));
    margin: 0 0 calc(2 * var(--m));

    display: flex;
    align-items: center;
    justify-content: center;

    background:
        repeating-linear-gradient(#FFFFFF 0, #FFFFFF var(--m), #999999 var(--m), #999999 calc(2 * var(--m)))
        center / calc(100% - 8 * var(--m)) calc(12 * var(--m)) no-repeat,
        #DDDDDD;
    font-weight: bold;
    white-space: nowrap;
}

.mac-title span {
    padding: 0 calc(8 * var(--m));
    background: #DDDDDD;
}

.mac-body {
    padding: calc(12 * var(--m)) calc(14 * var(--m)) calc(10 * var(--m));
}

.mac-body p {
    margin: 0 0 calc(4 * var(--m));
}

.mac-strong {
    font-weight: bold;
    margin-bottom: calc(10 * var(--m)) !important;
}

/* File paths can be long and fonts differ from one device to the next, so
   the line truncates rather than wrapping and moving the bar. */
.mac-file {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #333333;
}


/* Progress bar: sunken trough, lavender fill with a highlight along its top
   third, the way the Appearance Manager drew it. */
.mac-progress {
    position: relative;
    height: calc(12 * var(--m));
    margin: calc(10 * var(--m)) 0 calc(8 * var(--m));

    background: #EEEEEE;
    border: var(--l) solid #555555;
    box-shadow: inset var(--l) var(--l) 0 #AAAAAA;
    overflow: hidden;
}

#mac-fill {
    height: 100%;
    width: 0;
    background: linear-gradient(#D6D6FF 0%, #A0A0F0 30%, #6666CC 60%, #7A7AD8 100%);
    border-right: var(--l) solid #333366;
}

.mac-foot {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: calc(12 * var(--m));
}

.mac-foot p {
    margin: 0;
}

/* Upright the window is too narrow for the estimate and the button on one
   line ("About 47 minutes" would wrap), so the button drops below it. */
.mac-upright .mac-foot {
    flex-direction: column;
    align-items: flex-end;
    gap: calc(8 * var(--m));
}

.mac-upright .mac-foot p {
    align-self: stretch;
}


/* Platinum push button: rounded, black-edged, bevelled. */
.mac-btn {
    min-width: calc(64 * var(--m));
    height: calc(20 * var(--m));
    padding: 0 calc(12 * var(--m));

    font: inherit;
    color: #000000;
    background: linear-gradient(#F4F4F4, #D4D4D4);
    border: var(--l) solid #000000;
    border-radius: calc(4 * var(--m));
    box-shadow:
        inset var(--l) var(--l) 0 #FFFFFF,
        inset calc(-1 * var(--l)) calc(-1 * var(--l)) 0 #999999;
    cursor: default;
    flex: 0 0 auto;
}

.mac-btn:disabled {
    color: #999999;
    border-color: #999999;
}

/* The default button's ring. */
.mac-default {
    display: inline-block;
    padding: calc(3 * var(--m));
    border: calc(3 * var(--m)) solid #555555;
    border-radius: calc(8 * var(--m));
    line-height: 0;
}


/* The bomb alert: hidden until the reveal, then frozen over the installer.
   It carries the punchline, the way the w9x screens' blue screens do. */
#mac-bomb {
    display: none;
    z-index: 3;
    width: calc(var(--bw, 420) * var(--m));
    padding: calc(4 * var(--m));
    box-shadow:
        inset var(--l) var(--l) 0 #FFFFFF,
        inset calc(-1 * var(--l)) calc(-1 * var(--l)) 0 #999999,
        inset 0 0 0 calc(3 * var(--m)) #DDDDDD,
        var(--l) var(--l) 0 #000000;
}

body.mac-crashed #mac-bomb {
    display: block;
}

.mac-alert {
    display: flex;
    gap: calc(14 * var(--m));
}

.mac-bomb-icon {
    flex: 0 0 auto;
    width: calc(32 * var(--m));
    height: calc(32 * var(--m));
}

.mac-alert-text {
    flex: 1 1 auto;
    min-width: 0;
}

.mac-alert-text p {
    margin: 0 0 calc(8 * var(--m));
}

.mac-prank {
    font-weight: bold;
}

.mac-alert-buttons {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: calc(12 * var(--m));
    margin-top: calc(6 * var(--m));
}


/* Same pill as the other screens, at the foot of the display. */
#mac-hint {
    position: fixed;
    left: 50%;
    bottom: 1.5em;
    transform: translateX(-50%);
    z-index: 4;

    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    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;
}

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

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

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

body.mac-crashed #mac-hint {
    display: none;
}
