/* The landing page on the park island (index.html, with js/home.js). Two states: the start
   (the name and Play on the left, the island on the right) and `body.menu` (the name up in the
   corner, the games down the right, the island moved left by the camera). */
:root {
  --ink: #1e2a6b;
  --ink-soft: #3a4687;
  --blue: #2f7dff;
  --cyan: #57d4ff;
  --gold: #f5b81f;
  --display: 'Fredoka', 'Rubik', system-ui, sans-serif;
  --body: 'Rubik', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --ease: cubic-bezier(0.22, 0.8, 0.2, 1);
  --move: 1400ms;                       /* as long as the camera takes, */
  --glide: cubic-bezier(0.2, 0.05, 0.2, 0.95);   /* and the way it goes: a soft start, a long landing (js/park/orbit.js's spring, within a hundredth) */
  --edge: clamp(16px, 3.4vw, 64px);
  --logo: clamp(240px, 27vw, 470px);  /* the logo's width: the name's block is as wide, so Play centres on the logo's axis */
  --violet: #8a55ff;                   /* Play's fill: the purple of the logo's backing and of its own little play tile */
  --violet-deep: #4a1fb0;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  overflow: hidden;
  background: #8ec7fb;
  color: var(--ink);
  font: 400 16px/1.5 var(--body);
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
.skip { position: absolute; left: 12px; top: -60px; background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 30; }
.skip:focus { top: 12px; }

/* ---------- the island ---------- */
.stage { position: fixed; inset: 0; }
#still { display: none; position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 60% 50%; }
body.plain #still { display: block; }                       /* no WebGL, or the island's files did not come: the picture of it, */
body.plain #island, body.plain #veil { display: none; }     /* and not the sky over it */
/* The canvas comes in once its sky has the painting on it (body.sky; before that the page's own blue); the island
   comes in later inside it, under the veil (js/home.js reveal: the sky's last frame, laid over the canvas and faded out). */
#island { position: absolute; inset: 0; width: 100%; height: 100%; display: block; opacity: 0; transition: opacity 500ms; touch-action: none; cursor: grab; }
#island:active { cursor: grabbing; }
body.sky #island, body.live #island { opacity: 1; }
#veil { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; }   /* opened from the island's middle by js/home.js reveal */
body.menu #island { pointer-events: none; }                 /* behind the games the island is a backdrop: it stays where the camera put it */

/* ---------- the name ---------- */
.brand {
  position: fixed;
  z-index: 3;
  left: var(--edge);
  top: 50%;
  width: var(--logo);
  transform: translateY(-54%);
  transform-origin: 0 0;
  transition: top var(--move) var(--glide), transform var(--move) var(--glide);
  pointer-events: none;                                      /* only Play takes clicks: the island is draggable through the words */
}
/* The logo: hompa! with its line under it, one picture (assets/img/hompa-logo.png; the game's name since 2026-11-18). */
.word { margin: 0; line-height: 0; }
.word .logo { display: block; width: var(--logo); height: auto; filter: drop-shadow(0 10px 18px rgba(30, 60, 140, 0.22)); }
/* Play: the page's one main action. Under the logo on its axis, close enough to read as one block with it, and
   filled with the logo's own purple as a candy button (gloss on top, a deep lip under it), so it holds against the
   blue sky and against the white cloud sea the painting puts behind it. */
.play {
  pointer-events: auto;
  display: grid;
  place-items: center;
  width: clamp(68px, 7.2vw, 124px);
  aspect-ratio: 1;
  margin: clamp(4px, 0.8vh, 14px) auto 0;
  padding: 0;
  border: 0.22rem solid #fff;
  border-radius: 50%;
  background: radial-gradient(120% 90% at 50% 8%, #b892ff 0, var(--violet) 42%, #6a33e8 78%, #5a26d6 100%);
  color: #fff;
  cursor: pointer;
  box-shadow: var(--gloss), 0 0.28em 0 var(--violet-deep), 0 14px 30px rgba(70, 35, 170, 0.42);
  --gloss: inset 0 -0.14em 0.26em rgba(50, 15, 140, 0.4), inset 0 0.12em 0.2em rgba(255, 255, 255, 0.4);
  transition: transform 160ms var(--ease), opacity 300ms, box-shadow 160ms;
  animation: beckon 2.6s ease-in-out infinite;
}
.play svg { width: 74%; fill: currentColor; filter: drop-shadow(0 2px 0 rgba(60, 20, 150, 0.45)); }      /* the triangle about 0.4 of the disc, its centroid a hair right of centre (optical centre) */
.play:hover { transform: scale(1.06); }
.play:active { transform: translateY(0.22em) scale(1.02); box-shadow: var(--gloss), 0 0.06em 0 var(--violet-deep), 0 8px 20px rgba(70, 35, 170, 0.4); }
@keyframes beckon { 0%, 100% { box-shadow: var(--gloss), 0 0.28em 0 var(--violet-deep), 0 14px 30px rgba(70, 35, 170, 0.42), 0 0 0 0 rgba(138, 85, 255, 0.5); } 55% { box-shadow: var(--gloss), 0 0.28em 0 var(--violet-deep), 0 14px 30px rgba(70, 35, 170, 0.42), 0 0 0 20px rgba(138, 85, 255, 0); } }
.phone-note { display: none; }

/* After Play the logo goes up into the corner, at less than half its size. */
body.menu .brand { top: clamp(8px, 2vh, 24px); transform: scale(0.45); }
body.menu .play { opacity: 0; pointer-events: none; animation: none; }

/* ---------- the games ---------- */
.lobby {
  position: fixed;
  z-index: 3;
  right: var(--edge);
  top: 50%;
  width: clamp(300px, 27vw, 470px);
  max-height: min(88vh, 860px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transform: translate(8%, -50%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 500ms, transform 900ms var(--ease);
}
body.menu .lobby { opacity: 1; transform: translate(0, -50%); pointer-events: auto; transition-delay: 220ms; }
.lobby-top { display: flex; align-items: center; gap: 8px; padding-left: 18px; }
.back, .filters, .login {
  border: 1.5px solid rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.72);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(40, 80, 160, 0.16);
  transition: background 140ms, color 140ms, transform 140ms;
}
.back { display: grid; place-items: center; flex: none; width: 40px; height: 40px; padding: 0; border-radius: 50%; }
.back svg { width: 22px; height: 22px; }
/* The filters as one segmented bar (the owner, 2026-11-21: neater than loose chips): one glass track, one row, the
   chosen one filled; on a narrow screen the bar scrolls sideways instead of wrapping. */
.filters { display: flex; flex-wrap: nowrap; gap: 2px; min-width: 0; padding: 3px; border-radius: 999px; overflow-x: auto; scrollbar-width: none; cursor: default; }
.filters::-webkit-scrollbar { display: none; }
.filters button { flex: none; padding: 7px 13px; border: 0; border-radius: 999px; background: transparent; color: var(--ink); cursor: pointer; font: 600 clamp(13px, 1vw, 15px)/1.2 var(--display); transition: background 140ms, color 140ms; }
.back:hover, .login:hover { background: #fff; transform: translateY(-1px); }
.filters button:hover { background: rgba(255, 255, 255, 0.85); }
.filters button[aria-pressed='true'] { background: var(--ink); color: #fff; }
/* The login placeholder, top right, on a local server only (js/home.js): no accounts exist yet. */
.login { position: fixed; z-index: 4; top: calc(14px + env(safe-area-inset-top)); right: calc(16px + env(safe-area-inset-right)); display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px 0 6px; border-radius: 999px; font: 600 15px/1 var(--display); }
.login svg { width: 32px; height: 32px; }
.login-note { position: fixed; z-index: 4; top: calc(66px + env(safe-area-inset-top)); right: calc(16px + env(safe-area-inset-right)); margin: 0; padding: 10px 14px; border-radius: 14px; background: #fff; color: var(--ink); font: 500 14px/1.4 var(--body); box-shadow: 0 8px 22px rgba(40, 80, 160, 0.2); }

.games { list-style: none; margin: 0; padding: 6px 12px 6px 26px; display: grid; gap: clamp(7px, 1.1vh, 11px); overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.8) transparent; }
.games li { transform: translateX(46px); opacity: 0; transition: transform 520ms var(--ease), opacity 380ms; }
body.menu .games li { transform: none; opacity: 1; transition-delay: calc(var(--i) * 45ms + 320ms); }   /* they come in one after another, behind the camera */
.game {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  gap: clamp(18px, 2vw, 34px);
  height: clamp(42px, 5.5vh, 58px);
  padding: 0 1.5em 0 1.9em;
  color: var(--ink);
  font: 600 clamp(17px, 1.42vw, 24px)/1 var(--display);
  text-decoration: none;
  outline: none;                        /* the plate shows where the pointer or the keyboard is (`.on`); the keyboard's ring is on the plate too */
}
.game:focus-visible { outline: none; }
.game:focus-visible::before { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(47, 125, 255, 0.75), 0 10px 28px rgba(40, 130, 230, 0.4); }
/* the plate: a leaning pane of frosted glass, as in the reference */
.game::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  transform: skewX(-14deg);
  border: 1.5px solid rgba(255, 255, 255, 0.9);
  border-radius: 9px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.84), rgba(255, 255, 255, 0.6));
  -webkit-backdrop-filter: blur(9px);
  backdrop-filter: blur(9px);
  box-shadow: 0 6px 18px rgba(40, 80, 160, 0.16);
  transition: background 140ms, box-shadow 140ms, border-color 140ms;
}
.game .no { font-weight: 700; font-size: 1.1em; min-width: 1.55em; font-variant-numeric: tabular-nums; }
.game.on::before { background: rgba(255, 255, 255, 0.97); border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(87, 212, 255, 0.6), 0 10px 28px rgba(40, 130, 230, 0.4); }
.game.on { transform: translateX(-8px); transition: transform 140ms var(--ease); }
.games.cut { -webkit-mask-image: linear-gradient(#000 calc(100% - 46px), transparent); mask-image: linear-gradient(#000 calc(100% - 46px), transparent); }
.more { align-self: center; display: grid; place-items: center; width: 54px; height: 34px; margin-top: -4px; padding: 0; border: 1.5px solid rgba(255, 255, 255, 0.9); border-radius: 14px; background: rgba(255, 255, 255, 0.78); color: var(--ink); cursor: pointer; box-shadow: 0 4px 14px rgba(40, 80, 160, 0.16); }
.more svg { width: 24px; height: 24px; }
.more:hover { background: #fff; }
.none { margin: 0; padding: 14px 20px; font: 500 15px/1.4 var(--body); color: var(--ink); }
.about { margin: 0; min-height: 2.8em; padding: 0 12px 0 34px; font: 500 clamp(13px, 1vw, 15px)/1.4 var(--body); color: var(--ink); text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7); }

/* ---------- a game's preview: its clip, its name, Play ---------- */
/* Over the games, centred, in the list's own look: white glass, the ink, Fredoka, and Play in the start's purple. */
.preview { position: fixed; inset: 0; z-index: 8; display: grid; place-items: center; padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); background: rgba(30, 42, 107, 0.32); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: preview-dim 200ms ease-out both; }
.preview-card { position: relative; width: min(760px, 100%); max-height: 100%; overflow: auto; display: grid; gap: 14px; padding: 14px 14px 18px; border-radius: 30px; background: rgba(255, 255, 255, 0.92); border: 1.5px solid rgba(255, 255, 255, 0.95); box-shadow: 0 24px 60px rgba(30, 42, 107, 0.35); animation: preview-up 280ms cubic-bezier(0.2, 0.9, 0.3, 1.12) both; }
@keyframes preview-dim { from { opacity: 0; } }
@keyframes preview-up { from { opacity: 0; transform: translateY(18px) scale(0.97); } }
.preview-media { aspect-ratio: 16 / 9; max-width: 100%; border-radius: 20px; overflow: hidden; background: #8ec7fb center / cover no-repeat var(--poster, none); }
.preview-media video { display: block; width: 100%; height: 100%; object-fit: cover; }
.preview-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 18px; padding: 0 8px; }
.preview-text { flex: 1 1 240px; min-width: 0; display: grid; gap: 2px; }
.preview-name { margin: 0; font: 700 clamp(26px, 3.2vw, 38px)/1.1 var(--display); color: var(--ink); }
.preview-line { margin: 0; font: 500 clamp(14px, 1.2vw, 17px)/1.4 var(--body); color: var(--ink-soft); }
.preview-play { margin-left: auto; flex: none; display: inline-flex; align-items: center; gap: 10px; min-height: 54px; padding: 0 26px 0 20px; border: 0.2rem solid #fff; border-radius: 999px; background: radial-gradient(120% 90% at 50% 8%, #b892ff 0, var(--violet) 42%, #6a33e8 78%, #5a26d6 100%); color: #fff; font: 700 21px/1 var(--display); text-decoration: none; box-shadow: inset 0 -0.14em 0.26em rgba(50, 15, 140, 0.4), inset 0 0.12em 0.2em rgba(255, 255, 255, 0.4), 0 0.22em 0 var(--violet-deep), 0 12px 26px rgba(70, 35, 170, 0.38); transition: transform 160ms var(--ease); }
.preview-play svg { width: 26px; height: 26px; fill: currentColor; }
.preview-play:hover { transform: scale(1.04); }
.preview-play:active { transform: translateY(0.18em); }
.preview-play:focus-visible { outline: 3px solid var(--blue); outline-offset: 4px; }
/* the card's close, a round button over the clip's top-right corner */
.preview-close { position: absolute; top: 24px; right: 24px; width: 48px; height: 48px; display: grid; place-items: center; padding: 0; border: 2px solid #fff; border-radius: 50%; background: rgba(255, 255, 255, 0.94); color: var(--ink); cursor: pointer; box-shadow: 0 6px 18px rgba(30, 42, 107, 0.28); transition: transform 160ms var(--ease); }
.preview-close svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; }
.preview-close:hover { transform: scale(1.06); background: #fff; }
.preview-close:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) { .preview, .preview-card { animation: none; } .preview-play, .preview-close { transition: none; } }

/* ---------- joining, watching ---------- */
.foot { position: fixed; z-index: 4; left: var(--edge); bottom: clamp(12px, 2.6vh, 28px); display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; max-width: min(92vw, 560px); }
.link {
  padding: 8px 14px;
  border: 1.5px solid rgba(255, 255, 255, 0.9);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.66);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: var(--ink);
  font: 600 14px/1.2 var(--display);
  text-decoration: none;
  cursor: pointer;
}
.link:hover { background: #fff; }
.join { display: none; align-items: center; gap: 6px; flex-wrap: wrap; }
.join.open { display: flex; }
.join input { width: 6.2em; padding: 8px 10px; border: 2px solid var(--ink); border-radius: 12px; background: #fff; color: var(--ink); font: 700 18px/1.2 var(--display); letter-spacing: 0.18em; text-align: center; text-transform: uppercase; }
.go { padding: 9px 18px; border: 0; border-radius: 12px; background: var(--ink); color: #fff; font: 600 16px/1.2 var(--display); cursor: pointer; }
.join-msg { flex-basis: 100%; margin: 0; min-height: 1.2em; font: 500 13px/1.3 var(--body); color: var(--ink); }

/* ---------- loading: the sky, the name and Play, and this ---------- */
/* While the island loads, the page is its sky with the name, Play and the links over it, as the start always had them
   (the owner, 2026-11-20: only the picture of the island under the loading scene had to go), and this bar where the
   island will come in. Opened on the games, the list is there at once: the host came back to pick the next one. */
.loading {
  position: fixed;
  z-index: 5;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(320px, calc(100vw - 48px));
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: 10px 12px;
  padding: 15px 20px 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 14px 34px rgba(30, 60, 140, 0.16);
  color: var(--ink);
  font: 600 16px/1.2 var(--display);
  animation: loading-in 400ms var(--ease) 250ms backwards;  /* (a load quick enough not to need it never shows it) */
  transition: opacity 400ms;
}
@keyframes loading-in { from { opacity: 0; transform: translate(-50%, calc(-50% + 10px)); } }
@media (min-aspect-ratio: 9/10) {
  body:not(.menu) .loading { left: 62%; }                  /* where the island comes in, right of the name */
  body.menu .loading { left: 36%; }                        /* left of the games, where the island stands then */
}
.loading-pc { font: 600 14px/1 var(--display); font-variant-numeric: tabular-nums; color: var(--ink-soft); }
.bar { grid-column: 1 / -1; height: 10px; border-radius: 99px; background: rgba(30, 42, 107, 0.12); overflow: hidden; }
.bar span { display: block; width: 2%; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #b892ff, var(--violet)); transition: width 300ms var(--ease); }
body.ready .loading, body.live .loading, body.plain .loading { opacity: 0; pointer-events: none; transition-duration: 200ms; }

/* ---------- a screen taller than wide: the games come up from the bottom ---------- */
@media (max-aspect-ratio: 9/10) {
  .brand { left: 50%; top: clamp(18px, 6vh, 70px); width: min(86vw, 520px); transform: translateX(-50%); text-align: center; }
  .word .logo { width: min(74vw, 380px); margin: 0 auto; }
  .play { margin-inline: auto; width: clamp(66px, 17vw, 100px); }
  body.menu .brand { top: clamp(6px, 1.5vh, 18px); transform: translateX(-50%) scale(0.45); transform-origin: 50% 0; }
  .lobby { left: 0; right: 0; top: auto; bottom: 0; width: auto; max-height: 54vh; padding: 12px 8px calc(64px + env(safe-area-inset-bottom)); transform: translateY(18%); background: linear-gradient(180deg, rgba(255, 255, 255, 0) 0, rgba(214, 233, 255, 0.82) 16%); }
  body.menu .lobby { transform: none; }
  body.menu .loading { top: 28%; }                         /* above the games, which come up from the bottom */
  .foot { left: 50%; transform: translateX(-50%); justify-content: center; width: max-content; max-width: 94vw; }
}

/* ---------- a phone: it joins, it does not host ---------- */
body.is-phone .host-only { display: none; }
body.is-phone .phone-note { display: block; margin: 0.9em auto 0; max-width: 17em; font: 500 15px/1.4 var(--body); color: var(--ink); text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7); }
body.is-phone .foot { bottom: calc(18px + env(safe-area-inset-bottom)); }
body.is-phone #codeLink { display: none; }
body.is-phone .join { display: flex; justify-content: center; padding: 12px 14px; border-radius: 18px; background: rgba(255, 255, 255, 0.86); }
body.is-phone .join::before { content: 'Room code'; flex-basis: 100%; text-align: center; font: 600 15px/1.2 var(--display); }
body.is-phone .join input { width: 7.4em; font-size: 22px; padding: 11px; }
body.is-phone .go { font-size: 18px; padding: 13px 22px; }

@media (prefers-reduced-motion: reduce) {
  .brand, .lobby, .games li, .play, .game, #still, #island, #veil, .loading { transition: none !important; }
  .loading { animation: none; }
  .play { animation: none; }
}
