/* 80s living room: wood-cabinet colour TV and a rubber-key ZX Spectrum 48K */
:root {
  /* the height you can actually see: on phones 100vh also counts the area behind the browser's bars, svh does not */
  --vh100: 100vh;
  --vhreal: 100vh; /* the real visible height, never multiplied (the manual) */
  --vw100: 100vw; /* both are multiplied when the desk is drawn larger (textfix.js) */
  --wall: #5a4434;
  --text: #e9e2d6;
  --muted: #a99f92;
  --accent: #f0b23c;
  --error: #ff8a78;
  /* everything is sized from --W so the TV, keyboard and tape deck fit the window height */
  /* TV height = .65W, keyboard height = .58W * .625; the rest is margins and the control strip */
  --W: min(1100px, calc(var(--vw100) - 32px), calc((var(--vh100) - 116px) / 1.0125));
  --tvw: var(--W);
}
* { box-sizing: border-box; }
html { background: var(--wall); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; } /* no "font boosting" in phone and in-app browsers: our labels are sized to fit their keys */
body {
  margin: 0; color: var(--text); font: 14px Tahoma, Verdana, sans-serif;
  background:
    radial-gradient(ellipse 70% 50% at 50% 20%, rgba(255, 200, 120, .12), transparent 70%),
    repeating-linear-gradient(90deg, rgba(255,255,255,.025) 0 2px, transparent 2px 46px),
    var(--wall);
  min-height: 100vh;
}
body.drag::after {
  content: 'Drop ROM, TAP, TZX, SNA or Z80 files'; position: fixed; inset: 0; display: grid; place-items: center;
  background: rgba(0,0,0,.75); font: 28px Georgia, serif; color: var(--accent); border: 4px dashed var(--accent); z-index: 10;
}
.room { width: var(--W); margin: 0 auto; padding: 12px 0 16px; }
button { font-family: Tahoma, sans-serif; cursor: pointer; }

@supports (height: 100svh) { :root { --vh100: 100svh; --vhreal: 100svh; } }

/* ================= TV ================= */
.tv { position: relative; width: var(--tvw); margin: 0 auto; }
.cabinet {
  display: flex; gap: 2.2%; padding: 3.2%;
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.18), transparent 6%, transparent 94%, rgba(0,0,0,.35)),
    repeating-linear-gradient(91deg, rgba(0,0,0,.10) 0 3px, transparent 3px 9px, rgba(255,255,255,.04) 9px 11px, transparent 11px 19px),
    repeating-linear-gradient(89deg, rgba(60,25,5,.25) 0 1px, transparent 1px 27px),
    linear-gradient(90deg, #6e3f1d, #82502a 30%, #6a3b1b 55%, #7d4a25 80%, #643718);
  box-shadow: 0 30px 50px rgba(0,0,0,.55), inset 0 0 0 2px rgba(0,0,0,.35), inset 0 2px 0 rgba(255,255,255,.15);
}
.bezel {
  flex: 1 1 auto; padding: 3.5%; border-radius: 18px;
  background: linear-gradient(160deg, #3b3836, #1d1b1a 60%, #121110);
  box-shadow: inset 0 0 0 3px #8d8a86, inset 0 0 0 5px #2b2927, inset 0 6px 14px rgba(0,0,0,.8), 0 1px 0 rgba(255,255,255,.2);
}
.crt {
  position: relative; aspect-ratio: 4 / 3; overflow: hidden; background: #050505;
  border-radius: 9% / 12%;
  box-shadow: 0 0 0 3px #0b0b0b, 0 0 22px rgba(120,170,255,.08);
}
.crt:fullscreen { border-radius: 0; background: #000; }
/* full screen: the picture keeps its 4:3 shape, centred with black around it (no stretching, above all on a phone held upright) */
.crt:fullscreen .picture, .crt:fullscreen .scanlines, .crt:fullscreen .glass {
  inset: auto; left: 50%; top: 50%; width: min(100vw, 133.333vh); height: min(75vw, 100vh); translate: -50% -50%;
}
.picture { position: absolute; inset: -1.5%; transform-origin: center; }
.picture canvas {
  position: absolute; inset: 0; width: 100%; height: 100%; display: block;
  image-rendering: pixelated; image-rendering: crisp-edges; cursor: pointer;
}
#screen { filter: saturate(1.15) contrast(1.08) brightness(1.06); }
#noise { display: none; image-rendering: auto; filter: contrast(1.4); }
.tv.static #noise { display: block; }
.tv.static #screen { visibility: hidden; }
.scanlines, .glass { position: absolute; inset: 0; pointer-events: none; border-radius: inherit; }
.scanlines {
  background: linear-gradient(rgba(0,0,0,0) 55%, rgba(0,0,0,.30));
  background-size: 100% calc(100% / 240);
  mix-blend-mode: multiply;
}
.glass {
  background:
    radial-gradient(ellipse 60% 35% at 28% 12%, rgba(255,255,255,.13), transparent 70%),
    radial-gradient(ellipse at center, transparent 58%, rgba(0,0,0,.6) 100%);
  box-shadow: inset 0 0 40px rgba(0,0,0,.75);
}
/* power on / off */
.tv.off .picture { animation: tv-off .45s ease-in forwards; }
.tv.warming .picture { animation: tv-on .7s ease-out; }
.tv.off .crt::after {
  content: ''; position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px;
  border-radius: 50%; background: #fff; box-shadow: 0 0 12px 4px rgba(200,220,255,.8);
  animation: dot-fade 1.4s .4s ease-out forwards; opacity: 0;
}
@keyframes tv-off {
  0% { transform: scale(1, 1); filter: brightness(1); }
  55% { transform: scale(1, .006); filter: brightness(4); }
  100% { transform: scale(0, .006); filter: brightness(6); opacity: 0; }
}
@keyframes tv-on {
  0% { transform: scale(0, .006); filter: brightness(6); }
  35% { transform: scale(1, .006); filter: brightness(4); }
  100% { transform: scale(1, 1); filter: brightness(1); }
}
@keyframes dot-fade { 0% { opacity: 1; } 100% { opacity: 0; } }

/* control panel: sized in cqw (percent of the TV width) so the set keeps its shape at any size */
.tv { container-type: inline-size; }
.panel {
  flex: 0 0 19%; display: flex; flex-direction: column; align-items: center; gap: 1.6cqw;
  padding: 1.6cqw 1cqw; border-radius: 1.4cqw;
  background: linear-gradient(180deg, #2c2a28, #1a1918);
  box-shadow: inset 0 0 0 2px #0e0d0c, inset 0 2px 0 rgba(255,255,255,.08);
}
.brand { font: italic bold 2cqw Georgia, serif; color: #d9c9a8; text-align: center; letter-spacing: .5px; }
.brand small { display: block; font: 1.1cqw Tahoma, sans-serif; letter-spacing: .25cqw; color: #8e8576; text-transform: uppercase; }
.grille {
  width: 100%; flex: 1 1 0; min-height: 0; border-radius: .7cqw;
  background: radial-gradient(circle, #050505 .2cqw, transparent .27cqw) 0 0 / .9cqw .9cqw, #262422;
  box-shadow: inset 0 2px 6px rgba(0,0,0,.8);
}
.channels { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6cqw; width: 100%; }
.chan {
  height: 3cqw; padding: 0; border: 0; border-radius: .4cqw; color: #ccc; font-size: 1.4cqw;
  background: linear-gradient(#5b5853, #3a3835); box-shadow: 0 .35cqw 0 #111, inset 0 1px 0 rgba(255,255,255,.2);
}
.chan.on { transform: translateY(.25cqw); box-shadow: 0 1px 0 #111; color: #ffb648; text-shadow: 0 0 6px #ff9a1e; }
.knobs { display: flex; gap: 1.2cqw; justify-content: center; }
.knobwrap { display: flex; flex-direction: column; align-items: center; gap: .5cqw; font-size: 1cqw; color: #9b9387; letter-spacing: .1cqw; }
.knob {
  --angle: 0deg; width: 5.2cqw; aspect-ratio: 1; border-radius: 50%; position: relative; cursor: ns-resize; touch-action: none;
  background: conic-gradient(from 0deg, #8f8f8f, #e3e3e3, #7a7a7a, #d0d0d0, #888, #e6e6e6, #8f8f8f);
  box-shadow: 0 .35cqw .7cqw rgba(0,0,0,.6), inset 0 0 0 .35cqw #3b3b3b;
  transform: rotate(var(--angle));
}
.knob::after { content: ''; position: absolute; left: 50%; top: 10%; width: 7%; height: 32%; margin-left: -3.5%; border-radius: 2px; background: #c22; }
.knob:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.power { display: flex; align-items: center; gap: 1cqw; }
.led { width: 1cqw; height: 1cqw; border-radius: 50%; background: #3a0d0d; box-shadow: inset 0 1px 2px #000; }
.led.lit { background: #ff2a1a; box-shadow: 0 0 1cqw #ff2a1a; }
#btnPower {
  font-size: 1.1cqw; letter-spacing: .1cqw; color: #ccc; padding: .9cqw 1.25cqw; border: 0; border-radius: .5cqw;
  background: linear-gradient(#55524d, #33312e); box-shadow: 0 .35cqw 0 #111;
}
#btnPower:active { transform: translateY(.25cqw); box-shadow: 0 1px 0 #111; }
.feet { display: flex; justify-content: space-between; padding: 0 12%; }
.feet span { width: 8.5cqw; height: 1.6cqw; background: linear-gradient(#2a1a0e, #120b05); border-radius: 0 0 .7cqw .7cqw; }

/* ================= desk ================= */
.desk { --p: calc(var(--W) * .58 / 11.3); display: flex; gap: 14px; width: calc(var(--W) * .88); margin: 14px auto 0; align-items: stretch; justify-content: center; }

/* ----- ZX Spectrum 48K (proportions taken from the real machine; --p = one key pitch) ----- */
.spectrum {
  flex: 0 0 auto; position: relative; width: calc(var(--p) * 11.3);
  border-radius: calc(var(--p) * .1);
  background: #232323;
  box-shadow: 0 calc(var(--p) * .3) calc(var(--p) * .45) rgba(0,0,0,.6);
  font-family: Arial, Helvetica, sans-serif;
}
.heatsink {
  position: relative; height: calc(var(--p) * 2.1);
  border-radius: calc(var(--p) * .1) calc(var(--p) * .1) 0 0;
  background:
    repeating-linear-gradient(0deg, rgba(255,255,255,.022) 0 1px, transparent 1px 3px),
    linear-gradient(180deg, #4b4b4b 0%, #3a3a3a 30%, #2d2d2d 75%, #242424 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.28), inset 1px 0 0 rgba(255,255,255,.08), inset -1px 0 0 rgba(0,0,0,.4);
}
.logo { /* raised from the metal: lit top edge, shadow below */
  position: absolute; left: calc(var(--p) * .32); top: calc(var(--p) * .16);
  width: calc(var(--p) * 4.26); height: calc(var(--p) * .48); overflow: visible;
  filter: drop-shadow(0 -1px 0 rgba(255,255,255,.35)) drop-shadow(0 2px 1px rgba(0,0,0,.85)) drop-shadow(0 4px 4px rgba(0,0,0,.45));
}
.model {
  position: absolute; left: calc(var(--p) * .37); top: calc(var(--p) * .74);
  font: bold calc(var(--p) * .27) Arial, Helvetica, sans-serif; color: #fff; letter-spacing: .2px;
}
.kbd {
  position: relative; height: calc(var(--p) * 5); overflow: hidden;
  margin-top: calc(var(--p) * -.04);
  border-radius: calc(var(--p) * .32) calc(var(--p) * .32) calc(var(--p) * .08) calc(var(--p) * .08);
  background: linear-gradient(180deg, #1f1f1f, #161616 12%, #121212 85%, #0b0b0b);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.2), inset 0 calc(var(--p) * .1) calc(var(--p) * .15) rgba(0,0,0,.55),
    inset -3px 0 0 rgba(255,255,255,.07), inset 3px 0 0 rgba(0,0,0,.3);
}
.rainbow {
  position: absolute; left: calc(var(--p) * 10.7); top: 0; height: 100%;
  display: flex; transform: skewX(-22.7deg); pointer-events: none;
}
.rainbow i { width: calc(var(--p) * .23); }
.rainbow i:nth-child(1) { background: #d9281d; }
.rainbow i:nth-child(2) { background: #f5cf12; }
.rainbow i:nth-child(3) { background: #4dae3e; }
.rainbow i:nth-child(4) { background: #3c8ed5; }

.keys { position: absolute; inset: 0; z-index: 1; }
.kcell {
  position: absolute; left: calc(var(--x) * var(--p)); top: calc(var(--y) * var(--p));
  width: calc(var(--w) * var(--p)); height: calc(var(--p) * .55);
}
.above, .below {
  position: absolute; left: calc(var(--p) * .05); white-space: nowrap; pointer-events: none;
  font: calc(var(--p) * .135) Arial, Helvetica, sans-serif; line-height: 1.12;
}
.above { bottom: calc(100% + var(--p) * .045); color: #8db542; }
.above.fn { color: #f2f2f2; }
.above .black { background: #f2f2f2; color: #111; padding: 0 .35em; }
.below { top: calc(100% + var(--p) * .05); color: #e0452f; }
.key {
  position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0;
  border-radius: calc(var(--p) * .06);
  background: linear-gradient(180deg, #5b6e7a 0%, #485b67 16%, #405260 70%, #374854 100%);
  box-shadow: inset 0 0 0 1px #26333d, inset 0 2px 1px rgba(255,255,255,.22),
    0 calc(var(--p) * .04) 0 #0e1418, 0 calc(var(--p) * .07) calc(var(--p) * .09) rgba(0,0,0,.85);
  color: #f2f2f2; font-family: Arial, Helvetica, sans-serif; text-align: left;
  touch-action: none; user-select: none; -webkit-user-select: none;
  transition: transform .04s, box-shadow .04s;
}
.key span { position: absolute; line-height: 1; }
.key .legend { left: 9%; top: 13%; font-size: calc(var(--p) * .26); }
.key .sym { left: 50%; top: 13%; font-size: calc(var(--p) * .12); color: #c4493a; }
.key .sym.word { font-size: calc(var(--p) * .1); left: 46%; }
.key .kw { right: 9%; bottom: 13%; font-size: calc(var(--p) * .125); }
.key .gfx {
  right: 13%; top: 13%; width: calc(var(--p) * .15); height: calc(var(--p) * .15);
  display: grid; grid-template: 1fr 1fr / 1fr 1fr; box-shadow: 0 0 0 1px rgba(242,242,242,.85);
}
.key .gfx i.on { background: #f2f2f2; }
.key .numsym { left: auto; top: auto; right: 17%; bottom: 11%; }
.key .mid {
  inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  font-size: calc(var(--p) * .16); line-height: 1.1;
}
.key .mid.small { font-size: calc(var(--p) * .135); }
.key .mid.red { color: #c4493a; font-size: calc(var(--p) * .115); }
.key[aria-label="BREAK SPACE"] .mid { font-size: calc(var(--p) * .2); }
.key .mid small { font-size: .62em; }
.key.down, .key:active {
  transform: translateY(calc(var(--p) * .035));
  background: linear-gradient(180deg, #52646f, #3b4c58);
  box-shadow: inset 0 0 0 1px #26333d, inset 0 1px 1px rgba(255,255,255,.15),
    0 calc(var(--p) * .008) 0 #0e1418, 0 calc(var(--p) * .02) calc(var(--p) * .03) rgba(0,0,0,.85);
}
.key.latched { outline: 2px solid var(--accent); outline-offset: 2px; }
.key:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ================= controls ================= */
.note { margin-top: 14px; padding: 10px 14px; border-radius: 6px; background: rgba(0,0,0,.25); border: 1px solid #4a3d33; }
.note h2 { margin: 0 0 6px; font: bold 15px Georgia, serif; color: var(--accent); }
.note summary { cursor: pointer; font-family: Georgia, serif; color: var(--accent); }
.note table { border-collapse: collapse; font-size: 12px; margin-top: 8px; }
.note td { padding: 2px 8px 2px 0; vertical-align: top; }
.note td:first-child { white-space: nowrap; font-family: 'Courier New', monospace; color: var(--accent); }
code { font-family: 'Courier New', monospace; }

/* ================= phones in portrait: the TV's controls go under the picture ================= */
@media (max-width: 700px) {
  :root { --W: calc(var(--vw100) - 32px); --tvw: var(--W); }
  .room { padding-top: 16px; }
  /* sizes in parts of the TV's width (--W, about 360px on a phone), so they also scale when the desk is drawn larger */
  .cabinet { flex-direction: column; border-radius: calc(var(--W) * .039); }
  .panel { flex-direction: row; flex-wrap: wrap; justify-content: space-between; padding: calc(var(--W) * .022) calc(var(--W) * .028); gap: calc(var(--W) * .028); }
  .grille { display: none; }
  .brand { text-align: left; }
  .channels { width: auto; grid-template-columns: repeat(6, calc(var(--W) * .072)); gap: calc(var(--W) * .014); }
  .chan { height: calc(var(--W) * .067); font-size: calc(var(--W) * .031); }
  .brand { font-size: calc(var(--W) * .042); }
  .brand small { font-size: calc(var(--W) * .025); letter-spacing: calc(var(--W) * .0056); }
  .knobs { gap: calc(var(--W) * .028); }
  .knobwrap { font-size: calc(var(--W) * .022); gap: calc(var(--W) * .011); }
  .knob { width: calc(var(--W) * .089); }
  .power { gap: calc(var(--W) * .022); }
  .led { width: calc(var(--W) * .022); height: calc(var(--W) * .022); }
  #btnPower { font-size: calc(var(--W) * .025); padding: calc(var(--W) * .0195) calc(var(--W) * .028); }
}

/* ================= Spectrum+ and Spectrum 128: --q = one key pitch ================= */
/* Their keyboard is wider than the 48K's but less deep, so the desk may grow wider than the TV
   (up to the window width) to make the keys as big as the 48K's height allows. */
/* The 48K keeps its size; the Spectrum+/128 (7.3 pitches deep) are made as tall as it (7.06 pitches),
   unless the window is too narrow for that, when they get as big as the width allows. */
.spectrumplus {
  flex: 0 0 auto; position: relative; width: calc(var(--q) * 17); height: calc(var(--q) * 7.3);
  border-radius: calc(var(--q) * .2);
  background:
    repeating-linear-gradient(0deg, rgba(255,255,255,.012) 0 1px, transparent 1px 3px),
    linear-gradient(180deg, #353535 0%, #2a2a2a 18%, #232323 70%, #1c1c1c 100%);
  box-shadow: 0 calc(var(--q) * .3) calc(var(--q) * .45) rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.18),
    inset 0 calc(var(--q) * -.12) 0 rgba(0,0,0,.35);
  font-family: Arial, Helvetica, sans-serif;
}
.spectrumplus.is128 { width: calc(var(--q) * 18.25); }
.spectrumplus[hidden] { display: none; }
.vents { /* ventilation slots along the top edge */
  position: absolute; left: calc(var(--q) * 7.6); top: 0; width: calc(var(--q) * 7.6); height: calc(var(--q) * .2);
  background: repeating-linear-gradient(90deg, #070707 0 calc(var(--q) * .06), transparent calc(var(--q) * .06) calc(var(--q) * .17));
}
.is128 .vents { left: calc(var(--q) * 8.2); width: calc(var(--q) * 8.2); }
.logoplus {
  position: absolute; left: calc(var(--q) * .8); top: calc(var(--q) * .32); width: calc(var(--q) * 4.1); height: calc(var(--q) * .5);
  overflow: visible; color: #0d0d0d; /* black on black, picked out by its lit top edge */
  filter: drop-shadow(0 -1px 0 rgba(255,255,255,.22)) drop-shadow(0 1px 0 rgba(0,0,0,.8));
}
.is128 .logoplus { color: #c8231c; filter: drop-shadow(0 1px 0 rgba(0,0,0,.7)); }
.modelplus {
  position: absolute; left: calc(var(--q) * .85); top: calc(var(--q) * .9);
  font: calc(var(--q) * .22) Arial, Helvetica, sans-serif; color: #c8231c; letter-spacing: .3px;
}
.is128 .modelplus { font: italic calc(var(--q) * .2) Arial, Helvetica, sans-serif; }
.keybed {
  position: absolute; left: calc(var(--q) * .68); top: calc(var(--q) * 1.33); width: calc(var(--q) * 13.74); height: calc(var(--q) * 5.12);
  border-radius: calc(var(--q) * .14); background: #131313;
  box-shadow: inset 0 calc(var(--q) * .05) calc(var(--q) * .1) rgba(0,0,0,.9), 0 1px 0 rgba(255,255,255,.08);
}
.grooves { /* the case lines that run from the keyboard to the side */
  position: absolute; left: calc(var(--q) * 14.42); top: calc(var(--q) * 1.45); width: calc(var(--q) * 2.45); height: calc(var(--q) * 5);
  background: repeating-linear-gradient(180deg, transparent 0 calc(var(--q) - 2px), rgba(0,0,0,.65) calc(var(--q) - 2px) calc(var(--q) - 1px),
    rgba(255,255,255,.07) calc(var(--q) - 1px) var(--q));
}
.is128 .grooves { width: calc(var(--q) * 2.15); }
.ribs {
  display: none; position: absolute; right: 0; top: 0; width: calc(var(--q) * 1.7); height: 100%;
  border-radius: 0 calc(var(--q) * .2) calc(var(--q) * .2) 0;
  background: repeating-linear-gradient(180deg, #3b3b3b 0 calc(var(--q) * .07), #2a2a2a calc(var(--q) * .07) calc(var(--q) * .1),
    #070707 calc(var(--q) * .1) calc(var(--q) * .2));
  box-shadow: inset calc(var(--q) * .08) 0 calc(var(--q) * .08) rgba(0,0,0,.7);
}
.is128 .ribs { display: block; }
.stripes { display: flex; transform: skewX(-32deg); }
.stripes i:nth-child(1) { background: #d9281d; }
.stripes i:nth-child(2) { background: #f5cf12; }
.stripes i:nth-child(3) { background: #4dae3e; }
.stripes i:nth-child(4) { background: #3c8ed5; }
.badge128 {
  display: none; position: absolute; left: calc(var(--q) * 14.55); top: calc(var(--q) * 5.6); align-items: center; gap: calc(var(--q) * .12);
}
.is128 .badge128 { display: flex; }
.badge128 span {
  font: calc(var(--q) * .5) Arial, Helvetica, sans-serif; letter-spacing: -.02em; color: transparent;
  -webkit-text-stroke: max(1px, calc(var(--q) * .025)) #d8261c;
}
.badge128 .stripes { height: calc(var(--q) * .46); }
.badge128 .stripes i { width: calc(var(--q) * .11); }
.badgeplus { /* the rainbow flash in the bottom-right corner of the Spectrum+ */
  position: absolute; left: calc(var(--q) * 15.75); top: calc(var(--q) * 5.65); width: calc(var(--q) * .62); height: calc(var(--q) * .52);
  overflow: hidden; border-radius: 2px; background: #111;
}
.badgeplus .stripes { height: 100%; margin-left: calc(var(--q) * .12); }
.badgeplus .stripes i { width: calc(var(--q) * .1); }
.is128 .badgeplus { display: none; }

.keysplus { position: absolute; left: calc(var(--q) * .8); top: calc(var(--q) * 1.45); width: calc(var(--q) * 13.5); height: calc(var(--q) * 5); z-index: 1; }
.key128 {
  position: absolute; left: calc(var(--x) * var(--q) + var(--q) * .05); top: calc(var(--y) * var(--q) + var(--q) * .05);
  width: calc(var(--w) * var(--q) - var(--q) * .1); height: calc(var(--q) * .88); padding: 0; border: 0;
  border-radius: calc(var(--q) * .15);
  background: radial-gradient(ellipse 80% 55% at 50% 22%, rgba(255,255,255,.1), transparent 70%), linear-gradient(180deg, #333 0%, #1d1d1d 45%, #141414 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.22), inset 0 0 0 1px #0a0a0a,
    0 calc(var(--q) * .05) 0 #050505, 0 calc(var(--q) * .08) calc(var(--q) * .1) rgba(0,0,0,.85);
  color: #fff; font-family: Arial, Helvetica, sans-serif;
  touch-action: none; user-select: none; -webkit-user-select: none; transition: transform .04s, box-shadow .04s;
}
.key128 span { position: absolute; left: 0; right: 0; text-align: center; line-height: 1.04; }
.key128 .small { top: calc(var(--q) * .05); font-size: calc(var(--q) * .14); line-height: 1; white-space: nowrap; letter-spacing: -.03em; }
.key128 .main { bottom: calc(var(--q) * .04); font: bold calc(var(--q) * .28) Arial, Helvetica, sans-serif; }
.key128 .gfx {
  position: relative; display: inline-grid; grid-template: 1fr 1fr / 1fr 1fr; vertical-align: -.1em;
  width: calc(var(--q) * .13); height: calc(var(--q) * .13); margin-right: calc(var(--q) * .05); box-shadow: 0 0 0 1px rgba(255,255,255,.85);
}
.key128 .gfx i.on { background: #fff; }
.key128 .label {
  top: 0; bottom: 0; display: flex; align-items: center; justify-content: center;
  font: bold calc(var(--q) * .18) Arial, Helvetica, sans-serif; line-height: 1.05;
}
.key128 .label b { font-size: calc(var(--q) * .38); }
.key128.enter::before { /* the top of the L-shaped ENTER key, beside P */
  content: ''; position: absolute; left: calc(var(--q) * .75); bottom: calc(var(--q) * .6); width: calc(var(--q) * .9); height: calc(var(--q) * 1.3);
  border-radius: calc(var(--q) * .15) calc(var(--q) * .15) 0 0;
  background: linear-gradient(180deg, #333 0%, #262626 30%, #262626 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.22), inset 1px 0 0 #0a0a0a, inset -1px 0 0 #0a0a0a;
}
.key128.down, .key128:active {
  transform: translateY(calc(var(--q) * .04));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12), inset 0 0 0 1px #0a0a0a, 0 calc(var(--q) * .01) 0 #050505, 0 calc(var(--q) * .02) calc(var(--q) * .03) rgba(0,0,0,.85);
}
.key128.latched { outline: 2px solid var(--accent); outline-offset: 2px; }
.key128:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

