* {
    box-sizing: border-box;
}

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

    cursor: default;
}

body.dd-revealed {
    cursor: none;
}


/* One 80-column DOS text screen. Everything below is sized off a single
   font-size that the JS fits to the viewport, so the whole thing scales from a
   phone to a 4K monitor without a media query. The two cyan bars run the full
   width of the display, the way a real text mode does, which is what keeps the
   letterboxing invisible at any aspect ratio. */
#dd-screen {
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    z-index: 1;

    display: flex;
    flex-direction: column;

    font-family: "DejaVu Sans Mono", "Liberation Mono", Consolas, "Lucida Console", "Courier New", monospace;
    font-size: 16px;
    line-height: 1.2;
    color: #AAAAAA;

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

.dd-bar {
    flex: 0 0 auto;
    background: #00AAAA;
    color: #000000;
    overflow: hidden;
}

.dd-bar pre {
    margin: 0 auto;
    width: 80ch;
    font: inherit;
}

/* The menu's accelerator letters, in the dark red a CUA application drew them
   in. They are honest: O, C and H do something — the same thing every other
   key does. The whole menu word is a data-reveal hot spot besides. */
.dd-key {
    color: #AA0000;
}

#dd-field {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

#dd-board {
    width: 80ch;
}


/* The cluster map is a grid of upright blocks rather than block characters:
   --p wide by --ph tall, half again as tall as wide, the shape of a text-mode
   character cell. The gap is what makes each cluster read as a separate block
   of data rather than a smear of colour. The frame is a CSS border standing in
   for the single-line box characters of the original. */
#dd-map {
    display: grid;
    grid-template-columns: repeat(78, var(--p, 8px));
    grid-auto-rows: var(--ph, 12px);
    gap: var(--g, 1px);
    justify-content: center;

    width: -webkit-fit-content;
    width: fit-content;
    margin: 0 auto 1.2em;
    padding: var(--pad, 4px);

    background: #0000AA;
    border: var(--b, 2px) solid #AAAAAA;
}

#dd-map i,
#dd-bar i {
    display: block;
}

/* Free space is CP437 0xB1, the medium shade — the 50% checkerboard the
   original drew its unused clusters with (rows 0x55, 0xAA, repeating), as an
   SVG tile rather than a glyph, because a character would not fill a square
   cell. --dither is an even number of pixels set by the JS, so the two squares
   of the tile are always a whole pixel each and the pattern stays crisp at
   every cluster size. */
i.dd-c0 {
    background-color: transparent;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 2 2' shape-rendering='crispEdges'%3E%3Cpath fill='%23AAAAAA' d='M0 0h1v1H0zM1 1h1v1H1z'/%3E%3C/svg%3E");
    background-size: var(--dither, 4px) var(--dither, 4px);
}

i.dd-c1 {
    background: #AAAAAA;
}

i.dd-c2 {
    background: #FFFF55;
}

i.dd-c3 {
    background: #FF5555;
}

i.dd-c4 {
    background: #FFFFFF;
}


#dd-panels-wrap {
    position: relative;
}

/* The Status box's progress bar: the same clusters as the map, laid over the
   blank line under "n% Complete". Sized in ch so it starts and ends exactly on
   the box's own text padding — three columns in from the box edge, thirty
   columns wide — and it inherits --p/--ph/--g, so its blocks are the same
   upright rectangles with the same 2px spacing. */
#dd-bar {
    position: absolute;
    left: 3ch;
    top: 2.4em;
    width: 30ch;
    height: 1.2em;

    display: grid;
    grid-template-columns: repeat(30, var(--p, 8px));
    grid-auto-rows: var(--ph, 12px);
    gap: var(--g, 2px);
    align-content: center;
}

#dd-panels,
#dd-outro {
    margin: 0;
    font: inherit;
}

#dd-panels .dd-title {
    color: #FFFFFF;
}

#dd-panels .dd-value {
    color: #FFFFFF;
}

#dd-panels .dd-sw0 {
    color: #AAAAAA;
}

#dd-panels .dd-sw1 {
    color: #AAAAAA;
}

#dd-panels .dd-sw2 {
    color: #FFFF55;
}

#dd-panels .dd-sw3 {
    color: #FF5555;
}

#dd-outro {
    display: none;
    color: #FFFFFF;
}

body.dd-revealed #dd-panels-wrap {
    display: none;
}

body.dd-revealed #dd-outro {
    display: block;
}

#dd-cursor {
    animation: dd-blink 1s steps(1, end) infinite;
}

@keyframes dd-blink {
    50% {
        opacity: 0;
    }
}


/* The hint sits over the top of the cluster map rather than at the foot of the
   screen as it does on the other prank screens: this layout has no slack under
   the panels on a squat landscape phone, and covering a few rows of decorative
   map noise for eight seconds costs nothing, where covering the Status and
   Legend boxes would. */
#dd-hint {
    position: fixed;
    left: 50%;
    top: 2.4em;
    transform: translateX(-50%);
    z-index: 4;

    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.4;
    color: #FFFFFF;
    background: rgba(0, 0, 0, 0.72);
    border-radius: 20px;
    padding: 9px 18px;
    white-space: nowrap;
    max-width: 92vw;
    overflow: hidden;
    text-overflow: ellipsis;

    transition: opacity 0.6s ease;
}

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

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