  :root {
    --bg: #070818;
    --text: #c3ecff;
    --white: #f0fbff;
    --pink: #ff5cc0;
    --ink: #140a35;
    --gold: #e8b84a;
    --screen: #2348c4;
    --px: "Silkscreen", "Courier New", monospace;
    --vt: "VT323", "Courier New", monospace;
  }
  * { box-sizing: border-box; }
  html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--vt); }
  body.is-room { overflow: hidden; height: 100vh; }
  a { color: inherit; }


  /* One WebGL canvas holds the room. */
  canvas#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; object-fit: contain; object-position: center; } /* until the next resize is handled the picture keeps its shape: never stretched, never drawn bigger than the window */

  /* The pink title bar, used on the opened screen. */
  .bar { display: flex; justify-content: space-between; align-items: baseline; gap: .5em; background: var(--pink); color: var(--ink);
    font-family: var(--px); font-weight: 700; font-size: .95em; line-height: 1.15; padding: .2em .45em; white-space: nowrap; }
  .bar .ch { font-weight: 400; font-size: .72em; }

  /* The real, hidden list of screens: text and links for screen readers, search engines and the keyboard. */
  .sr { position: fixed; left: 0; top: 0; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .sr .switch { border: 0; padding: 0; background: none; }

  /* The hover video: a real <video>, laid over the thumbnail with a perspective transform that follows the camera. */
  #vlayer { position: fixed; inset: 0; z-index: 5; pointer-events: none; overflow: hidden; }
  .gv { position: absolute; left: 0; top: 0; transform-origin: 0 0; opacity: 0; transition: opacity .2s ease; background: #0b1440; }
  .gv.is-on { opacity: 1; }
  .gv video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top; }
  .gv::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(to bottom, transparent 0 var(--t), rgba(4,6,30,.22) var(--t) calc(var(--t) * 2)); }

  #dbg { position: fixed; left: 8px; bottom: 8px; z-index: 40; margin: 0; padding: 6px 8px; font: 12px/1.35 ui-monospace, monospace; color: #9f9; background: rgba(0,0,0,.7); pointer-events: none; }

  /* Corner bits: the Au mark and the quiet contact line. */
  .corner { position: fixed; z-index: 10; font-family: var(--vt); font-size: 1.2rem; color: #8fa6d8; }
  .corner a { color: #c3ecff; text-decoration: none; }
  .corner a:hover { text-decoration: underline; }
  .corner--tl { left: 16px; top: 14px; }
  .corner--tr { right: 18px; top: 18px; }
  .au { display: inline-grid; place-items: center; width: 45px; height: 45px; background: #1c1b18; color: var(--gold);
    font-family: var(--px); font-weight: 700; font-size: 1.1rem; box-shadow: 0 0 0 3px #3a2c10; text-decoration: none; }
  .au canvas { width: 100%; height: 100%; image-rendering: pixelated; }

  /* An opened screen: after the camera flies in, the page continues on the screen. */
  /* An opened screen: after the camera flies in, the page continues on the screen. */
  .detail { position: fixed; inset: 0; z-index: 20; overflow: auto; background: var(--screen); color: var(--text);
    opacity: 0; pointer-events: none; transition: opacity .25s ease; padding: clamp(16px, 3vw, 40px); }
  .detail.is-on { opacity: 1; pointer-events: auto; }
  .detail::after { content: ""; position: fixed; inset: 0; pointer-events: none;
    background: repeating-linear-gradient(to bottom, transparent 0 3px, rgba(4,6,30,.18) 3px 6px); }
  .detail .bar { font-size: clamp(1.2rem, 2.4vw, 2rem); padding: .3em .6em; }
  .detail-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: clamp(16px, 3vw, 40px); margin-top: 24px; max-width: 1300px; }
  .detail-media { background: #0b1440; box-shadow: 0 0 0 4px #8fd0ff; aspect-ratio: 16 / 10; }
  .detail-media img, .detail-media video { width: 100%; height: 100%; object-fit: contain; display: block; }
  .detail-text p { font-size: 1.55rem; line-height: 1.15; margin: 0 0 1em; max-width: 36ch; }
  .btn { display: inline-block; font-family: var(--px); font-size: 1rem; padding: .7em 1em; text-decoration: none; margin: 0 .6em .6em 0; cursor: pointer; border: 0; }
  .btn--go { background: var(--pink); color: var(--ink); }
  .btn--back { background: transparent; color: var(--white); box-shadow: inset 0 0 0 3px #8fd0ff; }

  /* The room lights flickering on before the simple view opens. */
  .lights { position: fixed; inset: 0; z-index: 30; pointer-events: none; background: #f3efe6; opacity: 0; }
  body.lights-on .lights { animation: flicker .9s steps(1) forwards; }
  @keyframes flicker { 0% { opacity: 0; } 15% { opacity: .75; } 25% { opacity: .05; } 40% { opacity: .9; } 50% { opacity: .25; } 65%, 100% { opacity: 1; } }

  /* Portrait: one TV at a time, and under it a remote with that screen's words at reading size. */
  .panel { position: fixed; left: 0; right: 0; bottom: 0; z-index: 12; padding: 10px 12px max(10px, env(safe-area-inset-bottom));
    background: #0b0e24; border-top: 3px solid #2e3a8c; box-shadow: 0 -3px 0 #05060f; transition: opacity .3s ease; }
  .panel[hidden] { display: none; }
  body.is-opening .panel { opacity: 0; pointer-events: none; }
  .panel-in { max-width: 620px; margin: 0 auto; }
  .cap-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-family: var(--px); font-size: 14px; color: var(--white); font-weight: 700; }
  #cap-ch { font-weight: 400; font-size: 12px; color: #8fd0ff; white-space: nowrap; }
  #cap-text { min-height: 6.9em; margin-top: 6px; font: 400 17px/1.38 "Atkinson Hyperlegible", system-ui, sans-serif; color: #e8f6ff; }
  #cap-text a { display: block; color: #fff; padding: 2px 0; }
  .ticks { display: flex; gap: 4px; margin: 6px 0 8px; }
  .ticks i { flex: 1; height: 4px; background: #232c70; }
  .ticks i.on { background: var(--pink); }
  .keys { display: grid; grid-template-columns: 56px 1fr 1fr 56px; gap: 8px; }
  .keys button, .keys a { min-height: 46px; display: grid; place-items: center; border: 0; padding: 0; font-family: var(--px); font-size: 13px; font-weight: 700; text-decoration: none; cursor: pointer;
    background: #1c2148; color: #c3ecff; box-shadow: inset 0 2px 0 #3a4390, inset 0 -2px 0 #0a0c22; -webkit-tap-highlight-color: transparent; }
  .keys .k-open { background: var(--pink); color: var(--ink); box-shadow: inset 0 2px 0 #ffa6de, inset 0 -2px 0 #a8307d; }
  .keys .k-open[aria-disabled="true"] { background: #1c2148; color: #5a6498; box-shadow: none; pointer-events: none; }
  .keys button:focus-visible, .keys a:focus-visible, #cap-text a:focus-visible { outline: 3px solid var(--pink); outline-offset: 2px; }

  /* The hovered screen, in plain type at reading size, at the bottom of the room (the side screens are angled and small). */
  .hovercap { position: fixed; left: 50%; bottom: 18px; z-index: 11; transform: translateX(-50%); width: min(540px, calc(100vw - 340px)); pointer-events: none;
    background: #0b0e24; box-shadow: 0 0 0 3px #2e3a8c, 0 0 0 6px #05060f; padding: 10px 14px 12px; opacity: 0; transition: opacity .2s ease; }
  .hovercap.is-on { opacity: 1; }
  body.is-opening .hovercap { opacity: 0; }
  .hc-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-family: var(--px); font-size: 14px; font-weight: 700; color: var(--white); }
  #hc-ch { font-weight: 400; font-size: 12px; color: #8fd0ff; white-space: nowrap; }
  #hc-text { margin: 6px 0 0; font: 400 17px/1.38 "Atkinson Hyperlegible", system-ui, sans-serif; color: #e8f6ff; }
  @media (prefers-reduced-motion: reduce) { .hovercap { transition: none; } }

  /* Ask Baby Piaa: her chat panel, beside her corner. Reading text in the plain sans, like the hover caption. */
  .pchat { position: fixed; left: 150px; bottom: calc(var(--panel-h, 0px) + 18px); z-index: 18; width: min(400px, calc(100vw - 170px)); max-height: min(560px, calc(100vh - 100px));
    display: flex; flex-direction: column; background: #0b0e24; box-shadow: 0 0 0 3px #5fe4ff, 0 0 0 6px #05060f; color: #e8f6ff; font: 400 16px/1.42 "Atkinson Hyperlegible", system-ui, sans-serif; }
  .pchat[hidden] { display: none; }
  .pchat__head { display: flex; justify-content: space-between; align-items: center; padding: 8px 8px 8px 12px; background: #141a44; border-bottom: 2px solid #05060f; }
  .pchat__title { display: flex; align-items: center; gap: 8px; margin: 0; font-family: var(--px); font-size: 13px; font-weight: 700; letter-spacing: .04em; color: #5fe4ff; text-transform: uppercase; }
  .pchat__title img { image-rendering: pixelated; }
  .pchat__close { width: 32px; height: 32px; border: 0; background: transparent; color: #c3ecff; font: 700 22px/1 var(--vt); cursor: pointer; }
  .pchat__close:hover { color: #fff; }
  .pchat__log { flex: 1 1 auto; overflow: auto; margin: 0; padding: 4px 12px 0; list-style: none; }
  .pchat__log:empty { display: none; }
  .pchat__turn { padding: 10px 0; border-bottom: 1px dashed #26306a; }
  .pchat__q { margin: 0 0 6px; color: #ffe3f6; font-weight: 700; }
  .pchat__a p, .pchat__a ul { margin: 0 0 6px; }
  .pchat__a ul { padding-left: 1.2em; }
  .pchat__wait { color: #8fa6d8; font-style: italic; }
  .pchat__src { font-size: 14px; color: #8fa6d8; }
  .pchat__src a, .pchat__rest a { color: #5fe4ff; }
  .pchat__unsent { color: #ffb85c; }
  .pchat__intro { margin: 12px 12px 4px; }
  .pchat__chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 12px 2px; }
  .pchat__chips[hidden], .pchat__intro[hidden], .pchat__form[hidden], .pchat__note[hidden] { display: none; }
  .pchat__chip { border: 0; padding: 6px 10px; background: #1c2148; color: #c3ecff; font: inherit; font-size: 14px; cursor: pointer; box-shadow: inset 0 2px 0 #3a4390, inset 0 -2px 0 #0a0c22; text-align: left; }
  .pchat__chip:hover:not(:disabled) { color: #fff; background: #262d63; }
  .pchat__chip:disabled { opacity: .55; cursor: default; }
  .pchat__bot:not(:empty) { padding: 8px 12px 0; }
  .pchat__form { display: flex; gap: 6px; padding: 10px 12px 4px; }
  .pchat__input { flex: 1; min-width: 0; padding: 8px 10px; border: 0; background: #05060f; color: #fff; font: inherit; box-shadow: inset 0 0 0 2px #2e3a8c; }
  .pchat__input:focus { outline: none; box-shadow: inset 0 0 0 2px #5fe4ff; }
  .pchat__send { border: 0; padding: 0 14px; background: var(--pink); color: var(--ink); font: 700 13px var(--px); cursor: pointer; box-shadow: inset 0 2px 0 #ffa6de, inset 0 -2px 0 #a8307d; }
  .pchat__send:disabled { background: #1c2148; color: #5a6498; box-shadow: none; cursor: default; }
  .pchat__status { min-height: 0; margin: 0 12px; font-size: 14px; color: #8fd0ff; }
  .pchat__status:empty { display: none; }
  .pchat__note { margin: 4px 12px 10px; font-size: 12.5px; line-height: 1.35; color: #8fa6d8; }
  .pchat__rest { padding: 12px; }
  .pchat__rest p { margin: 0 0 8px; }
  .pchat__rest-title { font-family: var(--px); font-size: 14px; color: #5fe4ff; }
  .pchat :focus-visible { outline: 3px solid var(--pink); outline-offset: 2px; }
  .pchat .pchat__input:focus-visible { outline: none; } /* it has its own cyan edge */
  body.chat-open .hovercap { opacity: 0; }
  @media (max-width: 760px) { /* a phone: a sheet over the remote */
    .pchat { left: 8px; right: 8px; bottom: 8px; width: auto; max-height: calc(100vh - 90px); }
  }

  /* Baby Piaa's speech bubble: plain words, so a readable size. */
  /* Dark, in the room's colours, so it never outshines the name screen. */
  .piaa-bubble { position: fixed; left: 0; top: 0; z-index: 16; pointer-events: none; font-family: var(--vt); font-size: 1.3rem; line-height: 1.05; color: #e8f6ff;
    background: #0b0e24; padding: .35em .6em .4em; box-shadow: 0 0 0 3px #5fe4ff, 0 0 0 6px #05060f; opacity: 0; transition: opacity .3s ease; width: max-content; max-width: min(250px, 72vw); }
  .piaa-bubble.is-on { opacity: 1; }
  .piaa-bubble .rest { visibility: hidden; } /* the words she has not typed yet keep their room */

  @media (max-width: 760px) {
    .detail-grid { grid-template-columns: 1fr; }
    .detail-text p { font-size: 1.4rem; }
    .corner--tr { font-size: 1.05rem; top: 24px; }
  }
  @media (prefers-reduced-motion: reduce) {
    .detail { transition: none; }
  }
