/* The home page (home.mjs): the front door's room with the games beside the cube, Play under it and links to
   Super64 elsewhere. Loaded after frontdoor.css. */
#fd.home .fd-cube { filter: none; cursor: default; pointer-events: none; }
#fd.home .home-feed { position: absolute; left: 0; top: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
/* The sections, centered on the page in one quiet container: Games and Mods choose the shelf beside the cube; Music and TV
   are their own pages (music/, tv/) that link out to Suno and YouTube. The language menu keeps the top right. */
#fd.home .home-nav { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: flex; gap: 4px; padding: 4px; border-radius: 999px; background: rgba(255,255,255,.08); }
#fd.home .home-nav :is(button, a) { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 clamp(16px, 1.4vw, 24px); border: 0; border-radius: 999px; background: none; color: rgba(255,255,255,.72); font: 500 clamp(15px, 1.05vw, 18px) var(--body); text-decoration: none; white-space: nowrap; cursor: pointer; transition: background-color .15s ease, color .15s ease; }
@media (hover: hover) and (pointer: fine) { #fd.home .home-nav :is(button, a):hover { color: #fff; background: rgba(255,255,255,.14); } }
#fd.home .home-nav :is(button[aria-pressed="true"], a[aria-current="page"]) { background: #fff; color: #0b0b10; }
/* On the Music and TV pages the wordmark leads home. */
#fd.home a.fd-word { color: inherit; text-decoration: none; }
#fd.home a.fd-word:focus-visible { outline: 2px solid #fff; outline-offset: 4px; border-radius: 4px; }
#fd.home .home-nav :is(button, a):focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
/* What Super64 is and the games: beside the cube on wider screens, under the wordmark on phones. */
#fd.home .home-side { position: absolute; z-index: 3; left: max(4vw, env(safe-area-inset-left) + 16px); top: 50%; transform: translateY(-50%); width: clamp(240px, 23vw, 360px); display: grid; gap: 24px; }
#fd.home .home-about { margin: 0; color: var(--s64-soft); font: 400 clamp(15px, 1.15vw, 19px)/1.55 var(--s64-body); text-wrap: pretty; }
#fd.home .home-intro { display: grid; gap: 10px; }
#fd.home .home-intro h2 { margin: 0; color: var(--s64-ink); font: 700 clamp(26px, 2.4vw, 40px)/1.08 var(--s64-body); letter-spacing: 0; text-wrap: balance; }
#fd.home .home-intro p { margin: 0; color: var(--s64-soft); font: 400 clamp(15px, 1.1vw, 18px)/1.45 var(--s64-body); text-wrap: pretty; }
#fd.home .home-new { justify-self: start; color: var(--s64-soft); font: 500 14px/1.4 var(--s64-body); text-decoration: underline; text-underline-offset: 3px; }
#fd.home .home-new:focus-visible { outline: 2px solid #fff; outline-offset: 3px; border-radius: 2px; }
#fd.home .home-games { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
#fd.home .home-games button { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; align-items: center; justify-items: start; width: 100%; height: auto; min-height: 56px; gap: 12px; padding: 10px 12px 10px 10px; border: 0; border-radius: 14px; cursor: pointer; text-align: left; color: inherit; font: inherit;
  background: var(--s64-panel); box-shadow: inset 0 0 0 1px var(--s64-line); transition: background-color .2s ease, transform .2s ease, box-shadow .2s ease; }
#fd.home .home-games svg { width: 32px; height: 32px; justify-self: center; }
#fd.home .home-tile-text { display: grid; gap: 2px; min-width: 0; }
#fd.home .home-tile-name { color: var(--s64-ink); font: 600 15px/1.2 var(--s64-body); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#fd.home .home-tile-text small { color: var(--s64-muted); font: 400 12.5px/1.25 var(--s64-body); }
#fd.home .home-tile-status { justify-self: end; padding: 3px 9px; border: 1px solid var(--s64-line); border-radius: 999px; color: var(--s64-soft); font: 500 11.5px/1.4 var(--s64-body); white-space: nowrap; }
#fd.home .home-games button[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--s64-ink); }
#fd.home .home-games button:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
@media (hover: hover) and (pointer: fine) { #fd.home .home-games button:hover { background-color: rgba(255,255,255,.16); } }
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) { #fd.home .home-games button:hover { transform: translateY(-2px); } }
#fd.home .home-games button:active { transform: scale(.96); }
/* The Music and TV pages: the section's name, a line about it and its one white action, where the games sit at home. */
#fd.home .home-page-title { margin: 0; font: 700 clamp(28px, 2.4vw, 44px)/1.1 var(--s64-body); }
#fd.home .home-page-link { justify-self: start; display: inline-flex; align-items: center; justify-content: center; min-height: 52px; padding: 0 32px; border-radius: 999px; background: var(--s64-pill); color: var(--s64-pill-ink); text-decoration: none; white-space: nowrap; font: 700 clamp(17px, 1.2vw, 20px) var(--s64-body); box-shadow: 0 18px 40px rgba(0,0,0,.5); transition: transform .15s ease; }
#fd.home .home-updates { display: grid; margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--s64-line); }
#fd.home .home-updates li { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 2px 14px; padding: 12px 0; border-bottom: 1px solid var(--s64-line); }
#fd.home .home-update-date { grid-row: span 2; color: var(--s64-muted); font: 500 12.5px/1.5 var(--s64-body); }
#fd.home .home-update-title { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; color: var(--s64-ink); font: 600 15px/1.3 var(--s64-body); }
#fd.home .home-update-body { color: var(--s64-soft); font: 400 13.5px/1.4 var(--s64-body); }
#fd.home .home-badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border: 1px solid var(--s64-line); border-radius: 999px; color: var(--s64-soft); font: 500 11px/1.4 var(--s64-body); white-space: nowrap; }
#fd.home .home-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--dot, var(--s64-ink)); }
#fd.home .home-channels { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
#fd.home .home-channels li { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 2px 10px; align-items: center; padding: 10px 12px; border-radius: 14px; background: var(--s64-panel); box-shadow: inset 0 0 0 1px var(--s64-line); }
#fd.home .home-hash { grid-row: span 2; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: rgba(255,255,255,.08); color: var(--s64-soft); font: 700 15px/1 var(--s64-body); }
#fd.home .home-channels b { color: var(--s64-ink); font: 600 14.5px/1.25 var(--s64-body); }
#fd.home .home-channels li span:last-child { color: var(--s64-soft); font: 400 13px/1.35 var(--s64-body); }
#fd.home .home-facts { display: flex; flex-wrap: wrap; gap: 8px; }
#fd.home .home-facts .home-badge::before { content: none; }
#fd.home .home-legal { position: absolute; z-index: 3; left: 50%; bottom: max(12px, env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(920px, calc(100vw - 32px)); margin: 0; text-align: center; color: var(--s64-muted); font: 400 12px/1.4 var(--s64-body); pointer-events: none; }
#fd.home .home-page-link:focus-visible { outline: 2px solid #fff; outline-offset: 4px; }
#fd.home .home-page-link:active { transform: scale(.97); }
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) { #fd.home .home-page-link:hover { transform: translateY(-2px); } }
/* The chosen game's name under the cube, the page's one white action; it opens the game. */
#fd.home .home-play { position: absolute; z-index: 3; left: 50%; top: calc(9.9vh + min(36vw, 53.5vh) + 8px); transform: translateX(-50%); display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box; min-width: 160px; min-height: 52px; padding: 0 36px; border-radius: 999px; background: #fff; color: #0b0b10; text-decoration: none; white-space: nowrap; font: 700 clamp(18px, 1.3vw, 22px) var(--body); box-shadow: 0 18px 40px rgba(0,0,0,.5); transition: transform .15s ease; }
#fd.home .home-play[hidden] { display: none; }
#fd.home .home-play:focus-visible { outline: 2px solid #fff; outline-offset: 4px; }
#fd.home .home-play:active { transform: translateX(-50%) scale(.97); }
@media (prefers-reduced-motion: no-preference) { #fd.home .home-play-in { animation: home-play-in .32s cubic-bezier(.2,.9,.3,1.2) both; } }
@keyframes home-play-in { from { opacity: 0; transform: translateX(-50%) translateY(8px) scale(.94); } }
#fd.home .home-links { position: absolute; z-index: 3; left: 50%; bottom: max(8vh, env(safe-area-inset-bottom) + 24px); transform: translateX(-50%); display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; width: max-content; max-width: calc(100vw - 32px); }
#fd.home .home-links a { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; color: #fff;
  background: rgba(28,28,36,.42); -webkit-backdrop-filter: blur(18px) saturate(1.4); backdrop-filter: blur(18px) saturate(1.4); box-shadow: inset 0 1px 0 rgba(255,255,255,.14), inset 0 0 0 1px rgba(255,255,255,.07), 0 18px 40px rgba(0,0,0,.45); transition: background-color .2s ease, transform .2s ease; }
#fd.home .home-links a[hidden] { display: none; }
#fd.home .home-links svg { width: 24px; height: 24px; fill: currentColor; }
#fd.home .home-links a:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
@media (hover: hover) and (pointer: fine) { #fd.home .home-links a:hover { background-color: rgba(255,255,255,.16); } }
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) { #fd.home .home-links a:hover { transform: translateY(-2px); } }
/* Phones: one column. The words and games under the wordmark, the cube taking the room that is left, Play under it
   and the links at the bottom. */
@media (max-aspect-ratio: 1/1), (pointer: coarse) and (max-width: 720px) {
  #fd.home { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 0 max(16px, env(safe-area-inset-right) + 16px) max(24px, env(safe-area-inset-bottom) + 16px) max(16px, env(safe-area-inset-left) + 16px); }
  #fd.home :is(.home-side, .fd-stage, .home-play, .home-links, .home-legal) { position: relative; inset: auto; left: auto; top: auto; bottom: auto; transform: none; }
  #fd.home .home-side { align-self: stretch; width: auto; gap: 16px; }
  /* In the column's flow, so the words start under the header whatever the wordmark's size. */
  #fd.home .fd-top { position: relative; inset: auto; align-self: stretch; margin-top: max(calc(18 * var(--v)), env(safe-area-inset-top) + 6px); flex-wrap: wrap; row-gap: 14px; }
  #fd.home .fd-word { font-size: min(calc(28 * var(--u)), 44px); }
  /* Its own row under the wordmark, at its natural width and centered; it fills the row only at phone widths. */
  #fd.home .home-nav { position: static; order: 3; margin: 0 auto; transform: none; }
  #fd.home .fd-top::after { content: ""; order: 2; flex-basis: 100%; }
  #fd.home .home-nav :is(button, a) { font-size: 16px; }
  #fd.home .home-about { max-width: 36ch; font-size: 15px; line-height: 1.5; }
  #fd.home .home-intro { gap: 6px; }
  #fd.home .home-intro h2 { font-size: 26px; }
  #fd.home .home-intro p { font-size: 14px; line-height: 1.3; }
  #fd.home .home-new { font-size: 14px; }
  #fd.home .home-page-title { font-size: 28px; }
  #fd.home .home-page-link { min-height: 48px; font-size: 17px; }
  #fd.home .home-games button { min-height: 50px; padding: 7px 10px 7px 8px; }
  #fd.home .home-games svg { width: 28px; height: 28px; }
  #fd.home .home-legal { width: auto; padding: 0 8px; font-size: 12px; }
  #fd.home .home-updates li { grid-template-columns: 54px minmax(0, 1fr); padding: 9px 0; }
  #fd.home .home-update-body { font-size: 13px; }
  #fd.home .fd-stage { flex: 1 1 0; min-height: 96px; align-self: stretch; width: auto; aspect-ratio: auto; container-type: size; }
  #fd.home .fd-cube { display: block; position: absolute; inset: 0; margin: auto; width: min(100cqw, 100cqh); height: min(100cqw, 100cqh); }
  #fd.home .home-play { flex: none; min-height: 48px; font-size: 18px; }
  /* Its room is kept before a game is chosen, so the cube does not move when it appears. */
  #fd.home .home-play[hidden] { display: inline-flex; visibility: hidden; }
  #fd.home .home-play:active { transform: scale(.97); }
  @keyframes home-play-in { from { opacity: 0; transform: translateY(8px) scale(.94); } }
  #fd.home .home-links { flex: none; max-width: 100%; }
  #fd.home .home-links a { width: 52px; height: 52px; }
}
/* Short landscape screens: Play and the links share the bottom edge's room. */
@media (min-aspect-ratio: 1/1) and (max-height: 520px) {
  #fd.home .home-play { min-height: 44px; top: calc(9.9vh + min(36vw, 53.5vh)); }
  #fd.home .home-links { bottom: max(12px, env(safe-area-inset-bottom) + 8px); }
  #fd.home .home-links a { width: 44px; height: 44px; }
  #fd.home .home-side { gap: 14px; }
}
/* Small touch screens held sideways: the wide arrangement, scaled down; the phone column has no height here. */
@media (pointer: coarse) and (max-width: 720px) and (min-aspect-ratio: 1/1) {
  #fd.home { display: block; padding: 0; }
  #fd.home .fd-top { position: absolute; left: max(4vw, env(safe-area-inset-left) + 16px); right: max(4vw, env(safe-area-inset-right) + 16px); top: max(12px, env(safe-area-inset-top) + 8px); margin: 0; flex-wrap: nowrap; }
  #fd.home .fd-top::after { content: none; }
  #fd.home .home-nav { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); margin: 0; order: 0; }
  #fd.home .home-nav :is(button, a) { padding: 0 12px; font-size: 15px; }
  #fd.home .fd-word { font-size: 26px; }
  #fd.home :is(.home-side, .fd-stage, .home-play, .home-links, .home-legal) { position: absolute; }
  #fd.home .home-side { left: max(4vw, env(safe-area-inset-left) + 16px); top: 50%; transform: translateY(-50%); width: clamp(200px, 32vw, 260px); }
  #fd.home .home-about { font-size: 13px; }
  #fd.home .fd-stage { left: 50%; top: 9.9vh; width: min(36vw, 53.5vh); aspect-ratio: 1; transform: translateX(-50%); container-type: normal; flex: none; min-height: 0; }
  #fd.home .fd-cube { position: relative; inset: auto; width: 100%; height: 100%; }
  #fd.home .home-play { left: 50%; top: calc(9.9vh + min(36vw, 53.5vh)); transform: translateX(-50%); min-width: 0; min-height: 44px; padding: 0 28px; }
  #fd.home .home-play[hidden] { display: none; }
  #fd.home .home-play:active { transform: translateX(-50%) scale(.97); }
  @keyframes home-play-in { from { opacity: 0; transform: translateX(-50%) translateY(8px) scale(.94); } }
  #fd.home .home-links { left: 50%; bottom: max(12px, env(safe-area-inset-bottom) + 8px); transform: translateX(-50%); }
  #fd.home .home-links a { width: 44px; height: 44px; }
}
/* The narrowest phones: the five links stay on one row. */
@media (max-width: 359px) {
  #fd.home .fd-top { column-gap: 8px; }
  #fd.home .home-tv { margin-right: 0; }
  #fd.home .home-links { gap: 8px; flex-wrap: nowrap; }
  #fd.home .home-links a { width: 44px; height: 44px; }
}
/* Phone widths: the sections share the row evenly so all four stay one tap wide. */
@media (max-width: 480px) {
  #fd.home .home-nav { flex: 1 1 100%; }
  #fd.home .home-nav :is(button, a) { flex: 1; padding: 0 4px; font-size: 13px; }
}
/* The 480p picture. Landscape screens compose the page like a game made for a 4:3 television: a 640 x 480 picture,
   scaled whole to the screen's height (--p is one of its pixels), with everything inside its title-safe edge. On a
   widescreen the room carries on past the 4:3 edges, the way a 16:9 set shows a widescreen game's world. */
@media (min-aspect-ratio: 1/1) {
  #fd.home { --p: min(100vw / 640, 100svh / 480); --sx: calc((100vw - 640 * var(--p)) / 2); --sy: calc((100svh - 480 * var(--p)) / 2); --edge: calc(var(--sx) + 32 * var(--p)); }
  #fd.home .fd-top { left: max(var(--edge), env(safe-area-inset-left) + 12px); right: max(var(--edge), env(safe-area-inset-right) + 12px); top: max(calc(var(--sy) + 22 * var(--p)), env(safe-area-inset-top) + 8px); }
  #fd.home .fd-word { font-size: calc(28 * var(--p)); }
  #fd.home .home-nav { gap: calc(2 * var(--p)); padding: calc(3 * var(--p)); }
  #fd.home .home-nav :is(button, a) { min-height: max(44px, calc(26 * var(--p))); padding: 0 calc(8 * var(--p)); font-size: max(13px, calc(10 * var(--p))); }
  #fd.home .home-tv { font-size: max(14px, calc(11 * var(--p))); }
  #fd.home .home-tv > button { width: max(44px, calc(26 * var(--p))); height: max(44px, calc(26 * var(--p))); }
  #fd.home .home-tv > button svg { width: max(20px, calc(14 * var(--p))); height: max(20px, calc(14 * var(--p))); }
  #fd.home #s64-language.s64-menu { font-size: max(14px, calc(11 * var(--p))); }
  #fd.home #s64-language.s64-menu .s64-toggle { min-height: max(44px, calc(26 * var(--p))); padding: 0 calc(9 * var(--p)) 0 calc(12 * var(--p)); }
  #fd.home { --cube-nudge: calc(40 * var(--p)); }
  #fd.home .home-side { left: max(var(--edge), env(safe-area-inset-left) + 12px); width: min(400px, calc(210 * var(--p))); gap: calc(14 * var(--p)); }
  #fd.home .home-about, #fd.home .home-intro p { font-size: max(13px, calc(9 * var(--p))); line-height: 1.45; }
  #fd.home .home-intro { gap: calc(6 * var(--p)); }
  #fd.home .home-intro h2 { font-size: max(20px, calc(16 * var(--p))); }
  #fd.home .home-new { font-size: max(13px, calc(9 * var(--p))); }
  #fd.home .home-page-title { font-size: max(22px, calc(18 * var(--p))); }
  #fd.home .home-page-link { min-height: max(44px, calc(30 * var(--p))); padding: 0 calc(20 * var(--p)); font-size: max(15px, calc(11 * var(--p))); }
  #fd.home .home-games { gap: calc(6 * var(--p)); }
  #fd.home .home-games button { min-height: max(44px, calc(34 * var(--p))); gap: calc(8 * var(--p)); padding: calc(6 * var(--p)) calc(8 * var(--p)); border-radius: calc(10 * var(--p)); }
  #fd.home .home-games svg { width: calc(20 * var(--p)); height: calc(20 * var(--p)); }
  #fd.home .home-tile-name { font-size: max(13px, calc(9 * var(--p))); }
  #fd.home .home-tile-text small, #fd.home .home-tile-status { font-size: max(11px, calc(7.5 * var(--p))); }
  #fd.home .fd-stage { left: calc(50% + var(--cube-nudge)); top: calc(var(--sy) + 78 * var(--p)); width: calc(224 * var(--p)); }
  #fd.home .home-legal { bottom: max(calc(var(--sy) + 8 * var(--p)), env(safe-area-inset-bottom)); width: min(calc(520 * var(--p)), calc(100vw - 32px)); font-size: max(11px, calc(7.5 * var(--p))); }
  #fd.home .home-play { left: calc(50% + var(--cube-nudge)); top: calc(var(--sy) + 308 * var(--p)); min-width: calc(108 * var(--p)); min-height: max(44px, calc(30 * var(--p))); padding: 0 calc(22 * var(--p)); font-size: max(16px, calc(12 * var(--p))); }
  #fd.home .home-links { bottom: max(calc(var(--sy) + 36 * var(--p)), env(safe-area-inset-bottom) + 28px); gap: calc(8 * var(--p)); }
  #fd.home .home-links a { width: max(44px, calc(32 * var(--p))); height: max(44px, calc(32 * var(--p))); }
  #fd.home .home-links svg { width: max(18px, calc(14 * var(--p))); height: max(18px, calc(14 * var(--p))); }
}
/* Short screens: the picture is too small for the bar and the games to keep its title-safe edge, so they use the
   screen's full width. */
@media (min-aspect-ratio: 1/1) and (max-height: 520px) {
  #fd.home .fd-top { left: max(16px, env(safe-area-inset-left) + 8px); right: max(16px, env(safe-area-inset-right) + 8px); }
  #fd.home .home-side { left: max(16px, env(safe-area-inset-left) + 8px); top: max(64px, calc(var(--sy) + 52 * var(--p))); transform: none; width: min(400px, calc(210 * var(--p))); gap: 8px; }
  #fd.home .home-intro h2 { font-size: 16px; }
  #fd.home .home-intro p { font-size: 12px; }
  #fd.home .home-games button { min-height: 40px; }
  #fd.home .home-tile-text small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}
@media (max-aspect-ratio: 1/1) and (max-height: 700px) {
  #fd.home { gap: 4px; padding-bottom: 6px; }
  #fd.home .fd-top { row-gap: 8px; column-gap: 8px; }
  #fd.home .fd-word { font-size: 22px; }
  #fd.home .home-side { gap: 8px; }
  #fd.home .home-intro { gap: 2px; }
  #fd.home .home-intro h2 { font-size: 22px; }
  #fd.home .home-intro p { font-size: 13px; line-height: 1.35; }
  #fd.home .home-games { gap: 6px; }
  #fd.home .home-games button { min-height: 0; padding: 6px 8px; }
  #fd.home .home-tile-text small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #fd.home .fd-stage { min-height: 28px; }
  #fd.home .home-play { min-height: 40px; }
  #fd.home .home-links a { width: 40px; height: 40px; }
  #fd.home .home-legal { font-size: 11px; line-height: 1.3; }
}
