/* /walkman/ term.css: every style of the page and its terminal. Colours from walkman.c (walkman.readable.c lines 257-463):
   ground black; mountains 341a5c and 8246be; tape label f6ecd4; stars a0dcff; shells ffce40 and 40cee6; sun ffec78 > ff9646 > ff3c96;
   floor neon ff3cc8 (8c216e at rest, shade .55); the message box ffb46e frame and fff082 text; the battery bar 64f082 / ff5050. */
@font-face { font-family: term; src: url("term.woff2?v=838f3223") format("woff2"); font-display: block; }

:root { color-scheme: dark; --bg: #000; --panel: #341a5c; --deep: #000; --ink: #f6ecd4; --muted: #a0dcff; --line: #8246be;
  --gold: #ffce40; --sun: #ff9646; --neon: #ff3cc8; --neon-rest: #8c216e; --box: #ffb46e; --box-text: #fff082; --off: #726b3a;
  --full: #64f082; --low: #ff5050; --term: term, "DejaVu Sans Mono", ui-monospace, monospace; }

/* SKIN_SPEC r6 values (hook v1.4): one tier, the terminal's. Sheet 48 x 6 cells of 12 x 24 px, drawn at 3x from DejaVu Sans Mono
   in the game's colours: rest fff082, hover ffb46e, press ff9646, selected ff3cc8, off 726b3a (fff082 dimmed as the stopped
   tape dims the screen); row 6: marks empty, fold markers + and - in the battery's green. The frame is the game's text box. */
:root[data-skin=walkman] { --skin-sheet: url("skin.png?v=84e6fd83"); --skin-cw: 12px; --skin-ch: 24px; --skin-space: 12px;
  --skin-frame: url("skin-frame.png?v=e837f667"); --skin-frame-slice: 36; --skin-frame-w: 12px; --skin-frame-side: 12px;
  --skin-focus: url("skin-focus.png?v=b43e5756"); --skin-focus-slice: 6; --skin-focus-w: 2px; --skin-round: 12px;
  --skin-pad: 16px 24px 20px; --skin-bg: #000; --skin-text: #f6ecd4; --skin-font: 16px/24px system-ui, sans-serif;
  --skin-sel-bg: #ff3cc8; --skin-sel-fg: #000; --skin-hover-bg: #341a5c; --skin-press-bg: #501e6e; --skin-mark-empty: 1; }
@media (pointer: coarse) and (orientation: portrait) { :root[data-skin=walkman] { --skin-frame-side: 0; --skin-round: 1px; } }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; padding: 32px 16px 64px; background: var(--bg); color: var(--ink); font: 16px/1.65 system-ui, sans-serif; }
main { max-width: 960px; margin: auto; }
a { color: var(--gold); text-underline-offset: .2em; }
a:hover { color: var(--box-text); }
::selection { background: var(--neon); color: #000; }
:focus-visible { outline: 2px solid var(--neon); outline-offset: 2px; }
p { max-width: 72ch; }

/* the game's text box  .------.  |      |  '------'  as a frame (skin-frame.png), with its letters in the terminal font */
.wk-back a, h2, .toolbar button, #pad button, #licences summary, .wk-by {
  border: var(--skin-frame-w) solid transparent; border-image-source: var(--skin-frame); border-image-slice: var(--skin-frame-slice);
  border-image-width: var(--skin-frame-w); border-image-repeat: round; font-family: var(--term); color: var(--box-text);
  text-transform: uppercase; }

/* header */
.wk-head { margin: 0 0 32px; }
.wk-back { margin: 0 0 16px; }
.wk-back a { display: inline-flex; align-items: center; min-height: 48px; padding: 0 8px; font-size: 17px; line-height: 24px;
  text-decoration: none; -webkit-tap-highlight-color: transparent; }
.wk-back a::before { content: "<"; margin-right: 10px; color: var(--box); }
.wk-back a:hover { background: var(--panel); color: #fff; }
.wk-back a:active { background: #501e6e; transform: translate(1px, 1px); }
.wk-h1 { margin: 0; line-height: 0; }
#wk-title { display: block; width: min(100%, 688px); height: auto; aspect-ratio: 172 / 50; }
.wk-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wk-sub p { margin: 12px 0 0; }
.wk-line { font-size: 18px; }
.beta { color: var(--gold); }

/* the credit, right under the title: the game's text box again, the author's name in the sun's colours (ffec78 > ff9646 >
   ff3c96), the author's profile and source as the game's prompts. The terminal font is ASCII only: so are its words here. */
.wk-by { margin: 24px 0 0; padding: 12px 20px 14px; background: #000; }
.wk-by p { max-width: none; margin: 0; }
.wk-by .wk-by-name { font-size: 40px; line-height: 48px; color: var(--sun); }
.wk-by-name span { display: block; font-size: 15px; line-height: 24px; letter-spacing: .3em; color: var(--muted); }
.wk-by-name b { font-weight: 400; }
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .wk-by-name b { background: linear-gradient(#ffec78 15%, #ff9646 55%, #ff3c96 92%); -webkit-background-clip: text;
    background-clip: text; -webkit-text-fill-color: transparent; }
}
.wk-by .wk-by-what { margin-top: 6px; font: 16px/1.5 system-ui, sans-serif; color: var(--ink); text-transform: none; }
.wk-by .wk-by-links { display: flex; flex-wrap: wrap; column-gap: 28px; margin-top: 6px; }
.wk-by-links a { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; font-size: 17px; line-height: 24px;
  color: var(--gold); text-decoration: none; text-transform: none; -webkit-tap-highlight-color: transparent; }
.wk-by-links a::before { content: ">"; color: var(--box); }
.wk-by-links span:first-child { color: var(--muted); text-transform: uppercase; }
.wk-by-links span + span { text-decoration: underline; text-underline-offset: .2em; }
.wk-by-links a:hover { color: var(--box-text); }
.wk-by-links a:hover span:first-child { color: #fff; }

@media (min-width: 1000px) {
  .wk-head { display: grid; grid-template-columns: minmax(0, 560px) minmax(368px, 1fr); column-gap: 32px; align-items: center; }
  .wk-back { grid-column: 1 / -1; }
  .wk-h1 { grid-column: 1; grid-row: 2; }
  .wk-sub { grid-column: 2; grid-row: 2; }
  .wk-sub p:first-child { margin-top: 0; }
  .wk-by { grid-column: 1 / -1; grid-row: 3; display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 32px; align-items: center; }
  .wk-by .wk-by-name { grid-column: 1; grid-row: 1; }
  .wk-by .wk-by-what { grid-column: 1; grid-row: 2; }
  .wk-by .wk-by-links { grid-column: 2; grid-row: 1 / 3; flex-direction: column; margin: 0; }
  /* the fold at 1366 x 768: the block 34 px shorter and 28 px less space around it, so the game's PRESS SPACE box shows at rest.
     The label stands on the name's line, the prompts are 40 px tall (a mouse, not a thumb). */
  .wk-head { margin-bottom: 16px; }
  .wk-by { margin-top: 12px; padding: 6px 20px 8px; }
  .wk-by .wk-by-name { white-space: nowrap; }
  .wk-by-name span { display: inline; margin-right: 6px; }
  .wk-by .wk-by-what { margin-top: 2px; }
  .wk-by-links a { min-height: 40px; }
  /* after a tape starts, term.js scrolls .game into view (block nearest): 16 px of scroll margin under it lifts it to the top
     row, so the credit's lower border no longer peeks above the neon frame. Nothing moves at rest. */
  .game { scroll-margin-bottom: 16px; }
}
/* short desktop windows (a 1366 x 768 laptop less its browser bars and taskbar leaves about 620-660 px): a compact top, so the
   game's PRESS SPACE box shows at rest. The credit keeps its box and its 40px name on one row with the two prompts; its note
   line stays for screen readers only, as in the phone held sideways. */
@media (min-width: 1000px) and (max-height: 750px) {
  body { padding-top: 12px; }
  .wk-back { margin-bottom: 6px; }
  .wk-back a { min-height: 40px; line-height: 16px; }
  .wk-head { margin-bottom: 10px; }
  .wk-by { margin-top: 8px; padding: 4px 20px; }
  .wk-by .wk-by-what { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0);
    white-space: nowrap; }
  .wk-by .wk-by-links { grid-row: 1; }
  .wk-by-links a { min-height: 24px; }
  /* under 692 px tall the box narrows with the game column (845 px wide at 620): a tighter row so it stays one row */
  .wk-by { padding: 4px 12px; column-gap: 16px; }
  .wk-by-name span { letter-spacing: .15em; }
  .wk-by-links a { gap: 8px; font-size: 15px; }
}
/* tall desktop windows (1920 x 1080): 16 px less above the page, so the toolbar's two boxes clear the fold whole at rest */
@media (min-width: 1000px) and (min-height: 1000px) {
  body { padding-top: 16px; }
}

/* the game box: one canvas of terminal cells, framed in the floor's neon (bright on the beat, dim at rest). Its CSS box never
   depends on the canvas's own size (term.js sets that to device pixels): a ratio without auto, or a width and a height. */
.game { margin: 0 auto; max-width: 960px; background: var(--deep); }
#status { padding: 0; height: 0; overflow: hidden; color: var(--muted); font-family: var(--term); }
#status.status-line { padding: 0 0 16px; height: auto; overflow: visible; }
.wk-screen { position: relative; min-width: 0; margin: 8px 0; background: #000; }
.wk-screen::before, .wk-screen::after { content: ""; position: absolute; pointer-events: none; }
.wk-screen::before { inset: -4px; border: 2px solid var(--neon); }
.wk-screen::after { inset: -8px; border: 2px solid var(--neon-rest); }
/* focus: no browser ring on the canvas; the outer rail lights up from its resting shade to the full neon instead */
#term:focus, #term:focus-visible { outline: none; }
.wk-screen:focus-within::after { border-color: var(--neon); }
#term { display: block; width: 100%; height: auto; aspect-ratio: 16 / 10; background: #000; touch-action: manipulation;
  -webkit-tap-highlight-color: transparent; -webkit-user-select: none; user-select: none; }

/* desktop (any pointer but coarse: fine, or none as in a headless browser): the game column is as wide as the 16:10 screen that fits the viewport's height, so once scrolled to
   (term.js scrolls it into view when a tape starts) the whole screen, its neon frame and the toolbar show: frame 8 + screen
   + frame 8 + toolbar 68, and 8 to spare = 92 px besides the screen. Never under 512 x 320; never over 960 x 600. */
@media not all and (pointer: coarse) {
  .game, .wk-head, .wk-by { max-width: min(960px, max(512px, calc((100vh - 92px) * 16 / 10)));
    max-width: min(960px, max(512px, calc((100svh - 92px) * 16 / 10))); }
  /* the header and the credit box follow the game column: as wide as it, centred over it, so their sides line up at every
     height (under 692 px tall the title narrows; the sub line keeps its 368 px) */
  .wk-head, .wk-by { width: 100%; margin-left: auto; margin-right: auto; }
}

/* toolbar and keys line in the game's letters */
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; padding: 20px 0 0; }
.toolbar button { min-height: 48px; padding: 0 8px; font-size: 16px; line-height: 24px; background: transparent; cursor: pointer;
  -webkit-tap-highlight-color: transparent; }
.toolbar button:hover { background: var(--panel); color: #fff; }
.toolbar button:active { background: #501e6e; transform: translate(1px, 1px); }
#sound::after { content: " on"; color: var(--full); }
#sound[aria-pressed=false] { color: var(--off); }
#sound[aria-pressed=false]::after { content: " off"; color: var(--low); }
#fullscreen[aria-pressed=true] { color: var(--neon); }
.keys { margin: 12px 0 0; color: var(--muted); font-size: 15px; }
kbd { font: 14px/1 var(--term); color: var(--box-text); padding: 1px 4px; border: 1px solid var(--line); border-radius: 0; background: #000; }

/* the SPACE key (coarse pointers): the game's 3-line box, pressed down like the Walkman's PLAY key while held */
#pad { display: none; touch-action: none; }
@media (pointer: coarse) {
  #pad { display: block; padding: 20px 0 0; touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
  #pad button { --skin-frame-w: 16px; display: block; width: 100%; min-height: 88px; padding: 0; background: #000; font-size: 28px;
    line-height: 40px; letter-spacing: .3em; text-indent: .3em; cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: none; }
  #pad button.down { background: var(--panel); color: #fff; transform: translateY(3px); }
}

/* full screen (the .game element): the box as large as it fits, the keys under it */
.game:fullscreen { display: flex; flex-direction: column; justify-content: center; align-items: center; max-width: none; margin: 0;
  padding: 16px; background: #000; overflow: hidden; }
.game:fullscreen > * { width: min(100%, calc((100vh - 120px) * 16 / 10)); }
.game:fullscreen .keys, .game:fullscreen #status { display: none; }
.game:fullscreen .toolbar { justify-content: center; }
.game::backdrop { background: #000; }
@media (pointer: coarse) and (orientation: portrait) {
  .game:fullscreen > * { width: 100%; }
  .game:fullscreen #term { width: 100%; height: calc(100vh - 200px); }
}

/* the home pages' frames (?embed=1): only the box, 16:10, fitted to the frame */
html.embed, html.embed body { height: 100%; margin: 0; padding: 0; overflow: hidden; background: #000; }
html.embed main > :not(.game), html.embed .game > :not(.wk-screen) { display: none !important; }
html.embed main, html.embed .game { max-width: none; margin: 0; }
html.embed .wk-screen { margin: 0; }
html.embed .wk-screen::before, html.embed .wk-screen::after { content: none; }
html.embed #term { position: fixed; inset: 0; margin: auto; width: min(100vw, calc(100vh * 16 / 10)); height: min(100vh, calc(100vw * 10 / 16)); }

/* section rules: a skyline of the game's own cassettes (TAPE, SHELL, ACCENT, NAMES: walkman.readable.c 322-355), as text */
.wk-rule { display: flex; justify-content: center; overflow: hidden; margin: 56px 0 28px; }
.wk-rule pre { flex: none; margin: 0; font: 10px/12px var(--term); color: var(--ink); }
.wk-rule i { font-style: normal; }
.wk-rule .L { color: #f6ecd4; }
.wk-rule .a0 { color: #ff5a82; }
.wk-rule .a1 { color: #5aa0ff; }
.wk-rule .a2 { color: #ff9628; }
.wk-rule .a3 { color: #46c878; }
.wk-rule .b { color: #be7850; }
.wk-rule .d0 { color: #8c3335; }
.wk-rule .d1 { color: #8c7123; }
.wk-rule .d2 { color: #23717e; }
.wk-rule .d3 { color: #60408c; }
.wk-rule .d4 { color: #347c52; }
.wk-rule .d5 { color: #8c5223; }
.wk-rule .d6 { color: #818187; }
.wk-rule .s0 { color: #ff5e62; }
.wk-rule .s1 { color: #ffce40; }
.wk-rule .s2 { color: #40cee6; }
.wk-rule .s3 { color: #b076ff; }
.wk-rule .s4 { color: #60e296; }
.wk-rule .s5 { color: #ff9640; }
.wk-rule .s6 { color: #ececf6; }
.wk-rule .w { color: #ffffff; }

/* sections */
section, footer { padding: 0 0 8px; }
h2 { display: inline-block; margin: 0 0 20px; padding: 0 10px; font-size: 22px; line-height: 32px; font-weight: 400; }
.decisions { margin-top: 48px; }
.about p:first-of-type { font-size: 18px; color: var(--ink); }
figure { margin: 28px 0; }
figcaption { margin-top: 10px; color: var(--muted); font-size: 14px; line-height: 1.5; }
figcaption strong, figcaption span { display: block; }
figcaption strong { color: var(--ink); font-size: 15px; }
.wk-shape img { display: block; width: 100%; max-width: 960px; height: auto; background: #000; }
.wk-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin: 28px 0 0; }
.wk-pair figure { margin: 0; }
.wk-pair img { display: block; width: 100%; height: auto; background: #000; outline: 1px solid var(--line); }
.wk-score { margin: 20px 0 0; color: var(--muted); }
@media (max-width: 799px) { .wk-pair { grid-template-columns: 1fr; } }
.milestones, .decisions ol { list-style: none; margin: 0; padding: 0; max-width: 82ch; }
.milestones li, .decisions li { padding: 16px 0 0 20px; border-left: 2px solid var(--line); }
.milestones li strong, .decisions li strong { color: var(--ink); }
.milestones p, .decisions p { margin: 4px 0 0; color: var(--muted); }

/* credits */
.wk-credit { margin: 0 0 8px; font: 26px/34px var(--term); color: var(--sun); }
#licences { margin: 28px 0 0; }
#licences summary { display: inline-flex; align-items: center; min-height: 48px; padding: 0 10px; font-size: 17px; line-height: 24px;
  list-style: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
#licences summary::-webkit-details-marker { display: none; }
#licences summary::before { content: "+"; margin-right: 12px; color: #78ff96; }
#licences[open] summary::before { content: "-"; }
#licences summary:hover { background: var(--panel); color: #fff; }
@media (max-width: 699px) {
  #licences pre.wk-mit { white-space: normal; }
  #licences pre.wk-mit > span { display: block; margin: 0 0 1.55em; }
  #licences pre.wk-mit > span:last-child { margin-bottom: 0; }
}
#licences pre { max-width: 82ch; margin: 20px 0; padding: 4px 0 4px 20px; border-left: 2px solid var(--line); font: 13px/1.55 var(--term);
  color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; }
#licences p { color: var(--muted); }

/* phones are told by pointer and orientation, never by width alone (a phone held sideways is 915 px wide); a narrow
   desktop window keeps the desktop layout, scaled. */
/* phone portrait (412 x 915): the box spans the width at 4:3 (64 x 24 cells), the SPACE key and the toolbar under it, all on screen */
@media (pointer: coarse) and (orientation: portrait) {
  body { padding: 16px 0 48px; }
  .wk-head, section, footer, .toolbar, .keys, #pad, #status, .wk-rule { padding-left: 16px; padding-right: 16px; }
  .wk-head { margin-bottom: 20px; }
  .wk-back { margin-bottom: 8px; }
  .wk-back a { min-height: 44px; font-size: 15px; }
  .wk-sub p { margin-top: 8px; font-size: 15px; line-height: 1.5; }
  .wk-screen { margin: 8px 0; }
  .wk-screen::before { inset: -4px 0; border-width: 2px 0; }
  .wk-screen::after { inset: -8px 0; border-width: 2px 0; }
  #term { aspect-ratio: 4 / 3; }
  #pad { padding-top: 16px; }
  .toolbar { padding-top: 12px; gap: 8px; }
  .toolbar button { min-height: 44px; font-size: 15px; }
  .keys { font-size: 14px; }
  .wk-credit { font-size: 20px; line-height: 28px; }
  h2 { font-size: 19px; }
  .wk-by { margin-top: 16px; padding: 8px 12px 6px; }
  .wk-by .wk-by-name { font-size: 25px; line-height: 34px; }
  .wk-by-name span { font-size: 13px; line-height: 20px; }
  .wk-by .wk-by-what { font-size: 15px; }
  .wk-by .wk-by-links { column-gap: 20px; margin-top: 2px; }
  .wk-by-links a { font-size: 15px; }
}
/* phone held sideways (915 x 412): the back link and a small title on one line, then the box on the left at the height
   that is left, the SPACE key and the toolbar beside it on the right, all on screen at rest; more columns show more of
   the world. The one line and the alpha line follow the game; the title there is the h1 text in the sun colour (the
   drawn title needs more height than the box can spare). */
@media (pointer: coarse) and (orientation: landscape) and (max-height: 500px) {
  body { padding: 8px 12px 40px; }
  main { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; column-gap: 16px; align-items: center; max-width: none; }
  main > * { grid-column: 1 / -1; }
  .wk-head { display: contents; }
  .wk-back { grid-column: 1; grid-row: 1; margin: 0; }
  .wk-back a { min-height: 44px; font-size: 15px; }
  .wk-h1 { grid-column: 3; grid-row: 1; }
  .wk-by { grid-column: 2; grid-row: 1; justify-self: center; display: flex; align-items: center; gap: 20px; min-width: 0; margin: 0;
    padding: 0 14px; }
  .wk-by .wk-by-name { font-size: 16px; line-height: 20px; white-space: nowrap; }
  .wk-by-name span { display: inline; font-size: inherit; line-height: inherit; letter-spacing: 0; }
  .wk-by .wk-by-what, .wk-by-links span + span { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap; }
  .wk-by .wk-by-links { flex-wrap: nowrap; column-gap: 16px; margin: 0; }
  .wk-by-links a { min-height: 20px; gap: 8px; font-size: 15px; line-height: 20px; }
  #wk-title { display: none; }
  .wk-h1 .wk-sr { position: static; width: auto; height: auto; margin: 0; overflow: visible; clip: auto; white-space: nowrap;
    font: 22px/44px var(--term); color: var(--sun); letter-spacing: .3em; text-transform: uppercase; }
  .game { grid-row: 2; display: grid; grid-template-columns: minmax(0, 1fr) 200px; grid-template-rows: auto 1fr auto auto;
    column-gap: 20px; max-width: none; margin: 8px 0 0; }
  .wk-sub { grid-column: 1 / -1; grid-row: 3; margin: 8px 0 0; }
  #status { grid-column: 1 / -1; grid-row: 1; }
  .wk-screen { grid-column: 1; grid-row: 2 / 4; margin: 8px; }
  #term { width: 100%; height: calc(100vh - 80px); height: calc(100dvh - 80px); }
  #pad { grid-column: 2; grid-row: 2; display: flex; padding: 0; }
  #pad button { --skin-frame-w: 14px; flex: 1; min-height: 0; height: auto; font-size: 26px; line-height: 36px; }
  .toolbar { grid-column: 2; grid-row: 3; flex-direction: column; align-items: stretch; gap: 8px; padding: 8px 0 0; }
  .toolbar button { min-height: 48px; font-size: 15px; }
  .keys { grid-column: 1 / -1; grid-row: 4; margin-top: 16px; font-size: 14px; }
  .game:fullscreen { display: grid; padding: 8px; align-items: stretch; justify-content: normal; align-content: center; }
  .game:fullscreen > * { width: auto; }
  .game:fullscreen .wk-screen { margin: 8px; }
  .game:fullscreen #term { height: calc(100vh - 32px); }
}
