/* links.pixtopia.net: Pixtopia's title screen as a page of links (server/shape/links.mjs). The world is the app's own
   pictures, laid out as src/components/title/world.tsx lays them out, a picture pixel `--px` of the page's; `--b` is where
   the town's lowest point stands, in picture pixels from the top. The links are choices in the game's dialogue box
   (src/components/title/dialogue.tsx: an ink edge with notched corners, a lighter top row and a hard shadow), named in
   the game's own type. Night or day follows the reader's light or dark setting. */

@font-face { font-family: Pixel; src: url(/pixel.woff2?v=5cd8db0bd6) format('woff2'); font-display: block; }
@font-face { font-family: Geist; src: url(/fonts/Geist_400Regular.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: Geist; src: url(/fonts/Geist_500Medium.woff2) format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: Geist; src: url(/fonts/Geist_600SemiBold.woff2) format('woff2'); font-weight: 600; font-display: swap; }

:root {
  color-scheme: dark;
  /* The world by night (src/components/title/world-assets.web.ts). */
  --sky-top: #090b14;
  --far-base: #0a34a0;
  --near-base: #3e6aed;
  --star: #ffffff;
  /* The dialogue box and what's written in it: the app's tokens. */
  --surface: #151515;
  --raised: #1c1c1c;
  --hover: #232323;
  --border: #262626;
  --border-strong: #363636;
  --ink: #f5f5f5;
  --ink-2: #a3a3a3;
  --ink-3: #737373;
  --primary: #f5f5f5;
  --on-primary: #0b0b0c;
  --danger: #ff6b6b;
  --scrim: rgba(4, 12, 48, 0.55);
  --veil: rgba(0, 0, 0, 0.6);
  /* What's written on the clouds themselves. */
  --sea-ink: #ffffff;
  --sea-ink-2: rgba(255, 255, 255, 0.86);
  --sea-shadow: rgba(4, 12, 48, 0.45);
  --focus: rgba(255, 181, 71, 0.9);
  --sans: Geist, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --pixel: Pixel, ui-monospace, Menlo, monospace;
  --px: 1px;
  --b: 305;
  --edge: 2px;
}
@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --sky-top: #f5fafe;
    --far-base: #c2e7fd;
    --near-base: #d8effd;
    --surface: #ffffff;
    --raised: #f4f4f5;
    --hover: #f4f4f5;
    --border: #e7e7e9;
    --border-strong: #d4d4d8;
    --ink: #0b0b0c;
    --ink-2: #52525b;
    --ink-3: #71717a;
    --primary: #0b0b0c;
    --on-primary: #fafafa;
    --danger: #c92a2a;
    --scrim: rgba(30, 80, 140, 0.22);
    --veil: rgba(11, 11, 12, 0.35);
    --sea-ink: #0b0b0c;
    --sea-ink-2: #3f3f46;
    --sea-shadow: rgba(255, 255, 255, 0.7);
    --focus: rgba(255, 79, 139, 0.85);
  }
}
/* Bigger screens see the world at two of their pixels to one of its. The logo then stands 48 picture pixels tall. */
@media (min-width: 880px) {
  :root { --px: 2px; --b: 285; --edge: 3px; }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--near-base); }
body { margin: 0; min-height: 100vh; background: var(--near-base); color: var(--ink); font: 15px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

/* ── The world ───────────────────────────────────────────────────────────────────────────────────────────────────── */

.scene { position: relative; overflow: hidden; height: calc((var(--b) + 164) * var(--px)); background: var(--sky-top); }
/* The sea of clouds fades into the colour the links stand on. */
.scene::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: calc(70 * var(--px)); background: linear-gradient(to bottom, transparent, var(--near-base) 85%); }
.scene > * { position: absolute; }
.scene img, .scene .fall, .scene .lamps, .sky, .far, .near, .orb, .puff { image-rendering: pixelated; }
.sky {
  left: 0; right: 0;
  top: calc((var(--b) - 390) * var(--px));
  height: calc(340 * var(--px));
  background: url(/art/sky-night.webp?v=98fdd47104) center top / calc(480 * var(--px)) 100% repeat-x;
}
/* Below the sky, the colour its bottom row ends in, as far as the clouds in front. */
.sky::after { content: ''; position: absolute; left: 0; right: 0; top: 100%; height: calc(200 * var(--px)); background: var(--far-base); }
.stars { inset: 0; }
.stars span { position: absolute; left: 0; top: 0; width: var(--px); height: var(--px); }
.twinkle-a { box-shadow:
    91.6vw calc(78 * var(--px)) var(--star),
    88.5vw calc(25 * var(--px)) var(--star),
    2.7vw calc(82 * var(--px)) var(--star),
    42.5vw calc(139 * var(--px)) var(--star),
    36.1vw calc(53 * var(--px)) var(--star),
    27.2vw calc(7 * var(--px)) var(--star),
    22.7vw calc(120 * var(--px)) var(--star),
    89.4vw calc(31 * var(--px)) var(--star),
    9.4vw calc(131 * var(--px)) var(--star),
    42.3vw calc(135 * var(--px)) var(--star),
    62.5vw calc(114 * var(--px)) var(--star),
    36.2vw calc(18 * var(--px)) var(--star),
    21.2vw calc(13 * var(--px)) var(--star),
    58.7vw calc(48 * var(--px)) var(--star),
    61.9vw calc(96 * var(--px)) var(--star),
    56.4vw calc(98 * var(--px)) var(--star),
    95.9vw calc(76 * var(--px)) var(--star),
    65.7vw calc(84 * var(--px)) var(--star),
    57.2vw calc(125 * var(--px)) var(--star),
    18.4vw calc(127 * var(--px)) var(--star),
    58.9vw calc(118 * var(--px)) var(--star),
    67.2vw calc(45 * var(--px)) var(--star),
    18.8vw calc(49 * var(--px)) var(--star),
    53.3vw calc(137 * var(--px)) var(--star),
    20.2vw calc(33 * var(--px)) var(--star),
    9.1vw calc(113 * var(--px)) var(--star); }
.twinkle-b { box-shadow:
    4.8vw calc(74 * var(--px)) var(--star),
    93.1vw calc(75 * var(--px)) var(--star),
    81.4vw calc(88 * var(--px)) var(--star),
    11.7vw calc(77 * var(--px)) var(--star),
    54.1vw calc(120 * var(--px)) var(--star),
    54.8vw calc(70 * var(--px)) var(--star),
    15.7vw calc(34 * var(--px)) var(--star),
    70.3vw calc(130 * var(--px)) var(--star),
    24.3vw calc(143 * var(--px)) var(--star),
    15.0vw calc(29 * var(--px)) var(--star),
    93.7vw calc(46 * var(--px)) var(--star),
    45.0vw calc(12 * var(--px)) var(--star),
    6.5vw calc(110 * var(--px)) var(--star),
    39.6vw calc(45 * var(--px)) var(--star); animation: twinkle 3.2s steps(1) infinite; }
@keyframes twinkle { 50% { opacity: 0.25; } }
.orb {
  left: calc(50% + 150 * var(--px));
  top: calc((var(--b) - 189 - 26) * var(--px));
  width: calc(34 * var(--px)); height: calc(34 * var(--px));
  background: url(/art/orb-night.webp?v=afa3247c44) 0 0 / 100% 100% no-repeat;
}
.puff { background-size: 100% 100%; background-repeat: no-repeat; animation: wander 46s ease-in-out infinite alternate; }
.puff-a { left: 8%; top: calc((var(--b) - 189 - 46) * var(--px)); width: calc(92 * var(--px)); height: calc(34 * var(--px)); background-image: url(/art/puff-a-night.webp?v=ae9ffbf088); }
.puff-b { left: 78%; top: calc((var(--b) - 189 - 8) * var(--px)); width: calc(60 * var(--px)); height: calc(26 * var(--px)); background-image: url(/art/puff-b-night.webp?v=d50bc6acea); animation-duration: 38s; animation-direction: alternate-reverse; }
@keyframes wander { to { transform: translateX(calc(40 * var(--px))); } }
.far, .near { left: 0; width: calc(100% + 480 * var(--px)); background-size: calc(480 * var(--px)) 100%; background-repeat: repeat-x; animation: drift linear infinite; }
.far { top: calc((var(--b) - 90) * var(--px)); height: calc(84 * var(--px)); background-image: url(/art/clouds-far-night.webp?v=c7612acf43); animation-duration: 240s; }
.near { height: calc(72 * var(--px)); background-image: url(/art/clouds-near-night.webp?v=a24f73559c); }
.near-a { top: calc((var(--b) - 34) * var(--px)); animation-duration: 120s; }
.near-b { top: calc((var(--b) + 8) * var(--px)); animation-duration: 80s; animation-direction: reverse; }
.near-c { top: calc((var(--b) + 50) * var(--px)); animation-duration: 150s; }
.near-d { top: calc((var(--b) + 92) * var(--px)); animation-duration: 100s; animation-direction: reverse; }
/* Under the first strip of clouds in front, the colour they end in. */
.near-a::after { content: ''; position: absolute; left: 0; right: 0; top: 100%; height: calc(100 * var(--px)); background: var(--near-base); }
@keyframes drift { to { transform: translateX(calc(-480 * var(--px))); } }

.logo {
  left: 0; right: 0; margin: 0;
  top: calc(24 * var(--px));
  display: flex; justify-content: center;
  color: #f5f5f5;
}
.logo svg { display: block; width: 312px; height: 72px; overflow: visible; }
@media (min-width: 880px) { .logo svg { width: 416px; height: 96px; } }
.hop { animation: hop 2.4s steps(1) infinite; }
.hop-b { animation-delay: 0.15s; }
.hop-c { animation-delay: 0.3s; }
.hop-d { animation-delay: 0.45s; }
@keyframes hop { 0%, 12% { transform: translateY(-1px); } 6% { transform: translateY(0); } 14%, 100% { transform: none; } }

.town { left: 0; right: 0; margin: 0 auto; top: calc((var(--b) - 189) * var(--px)); width: calc(419 * var(--px)); height: calc(189 * var(--px)); animation: bob 5s steps(1) infinite; }
.town.day { width: calc(428 * var(--px)); display: none; }
.town img { display: block; width: 100%; height: 100%; }
@keyframes bob { 50% { transform: translateY(calc(-1 * var(--px))); } }
.fall { position: absolute; width: calc(var(--fw) * var(--px)); background-repeat: no-repeat; background-size: calc(var(--fw) * 8 * var(--px)) 100%; animation: fall 0.8s steps(8) infinite; }
@keyframes fall { to { background-position-x: calc(var(--fw) * -8 * var(--px)); } }
.town.night .fall-0 { --fw: 22; left: calc(109 * var(--px)); top: calc(122 * var(--px)); height: calc(67 * var(--px)); background-image: url(/art/fall-0-night.webp?v=00208d55f0); animation-delay: -0ms; }
.town.night .fall-1 { --fw: 34; left: calc(239 * var(--px)); top: calc(114 * var(--px)); height: calc(82 * var(--px)); background-image: url(/art/fall-1-night.webp?v=3887a1ea08); animation-delay: -300ms; }
.town.night .fall-2 { --fw: 12; left: calc(321 * var(--px)); top: calc(123 * var(--px)); height: calc(64 * var(--px)); background-image: url(/art/fall-2-night.webp?v=d52ade4cbd); animation-delay: -600ms; }
.town.night .fall-3 { --fw: 5; left: calc(16 * var(--px)); top: calc(67 * var(--px)); height: calc(39 * var(--px)); background-image: url(/art/fall-3-night.webp?v=822070ebf8); animation-delay: -900ms; }
.town.night .fall-4 { --fw: 4; left: calc(42 * var(--px)); top: calc(88 * var(--px)); height: calc(54 * var(--px)); background-image: url(/art/fall-4-night.webp?v=43f6c8a912); animation-delay: -1200ms; }
.town.night .fall-5 { --fw: 6; left: calc(400 * var(--px)); top: calc(71 * var(--px)); height: calc(42 * var(--px)); background-image: url(/art/fall-5-night.webp?v=2f3aa0b395); animation-delay: -1500ms; }
.town.day .fall-0 { --fw: 22; left: calc(118 * var(--px)); top: calc(122 * var(--px)); height: calc(68 * var(--px)); background-image: url(/art/fall-0-day.webp?v=ce8bc95bfa); animation-delay: -0ms; }
.town.day .fall-1 { --fw: 37; left: calc(244 * var(--px)); top: calc(114 * var(--px)); height: calc(82 * var(--px)); background-image: url(/art/fall-1-day.webp?v=2083f48e65); animation-delay: -300ms; }
.town.day .fall-2 { --fw: 12; left: calc(330 * var(--px)); top: calc(123 * var(--px)); height: calc(59 * var(--px)); background-image: url(/art/fall-2-day.webp?v=07730aa477); animation-delay: -600ms; }
.town.day .fall-3 { --fw: 5; left: calc(25 * var(--px)); top: calc(68 * var(--px)); height: calc(38 * var(--px)); background-image: url(/art/fall-3-day.webp?v=dfa8c70f47); animation-delay: -900ms; }
.town.day .fall-4 { --fw: 4; left: calc(51 * var(--px)); top: calc(75 * var(--px)); height: calc(67 * var(--px)); background-image: url(/art/fall-4-day.webp?v=3bb65f0abc); animation-delay: -1200ms; }
.town.day .fall-5 { --fw: 6; left: calc(409 * var(--px)); top: calc(71 * var(--px)); height: calc(42 * var(--px)); background-image: url(/art/fall-5-day.webp?v=fca1928ce3); animation-delay: -1500ms; }
.lamps { position: absolute; inset: 0; background-size: 100% 100%; }
.lamps-a { background-image: url(/art/lamps-a-night.webp?v=cd3ccb4c1e); }
.lamps-b { background-image: url(/art/lamps-b-night.webp?v=2db5e2a482); animation: flicker 1.3s steps(1) infinite; }
@keyframes flicker { 50% { opacity: 0; } }

@media (prefers-color-scheme: light) {
  .sky { background-image: url(/art/sky-day.webp?v=aa954896fc); }
  .stars { display: none; }
  .orb { width: calc(44 * var(--px)); height: calc(44 * var(--px)); background-image: url(/art/orb-day.webp?v=7df48e7420); }
  .puff-a { background-image: url(/art/puff-a-day.webp?v=06c91a2341); }
  .puff-b { background-image: url(/art/puff-b-day.webp?v=aa07d126aa); }
  .far { background-image: url(/art/clouds-far-day.webp?v=8453912d6a); }
  .near { background-image: url(/art/clouds-near-day.webp?v=e194cd3e91); }
  .logo { color: #0b0b0c; }
  .town.night { display: none; }
  .town.day { display: block; }
}

/* ── The links ───────────────────────────────────────────────────────────────────────────────────────────────────── */

.menu {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  /* Up over the sea of clouds, as the title screen's dialogue box stands on it. */
  position: relative;
  margin-top: calc(-110 * var(--px));
  padding: 8px max(28px, calc(env(safe-area-inset-right, 0px) + 16px)) max(40px, env(safe-area-inset-bottom, 0px)) max(28px, calc(env(safe-area-inset-left, 0px) + 16px));
}
.line { margin: 0 0 20px; text-align: center; color: var(--sea-ink); text-wrap: balance; text-shadow: 0 1px 0 var(--sea-shadow); }
.links { display: grid; }
.group { margin: 22px 0 10px; font: 400 22px/1 var(--pixel); color: var(--sea-ink); -webkit-font-smoothing: none; text-align: center; text-shadow: 0 2px 0 var(--sea-shadow); }
.group:first-child { margin-top: 0; }

/* A choice: the dialogue box's ink edge with its corners left out, a lighter top row, and the hard shadow under it. */
.choice {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 64px;
  margin: var(--edge) var(--edge) calc(var(--edge) * 5);
  padding: 10px 16px;
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  box-shadow:
    0 calc(var(--edge) * -1) 0 0 var(--ink),
    0 var(--edge) 0 0 var(--ink),
    calc(var(--edge) * -1) 0 0 0 var(--ink),
    var(--edge) 0 0 0 var(--ink),
    inset 0 var(--edge) 0 0 var(--raised),
    0 calc(var(--edge) * 4) 0 0 var(--scrim);
}
.choice:hover { background: var(--hover); }
.choice:active { transform: translateY(calc(var(--edge) * 2)); box-shadow:
    0 calc(var(--edge) * -1) 0 0 var(--ink),
    0 var(--edge) 0 0 var(--ink),
    calc(var(--edge) * -1) 0 0 0 var(--ink),
    var(--edge) 0 0 0 var(--ink),
    inset 0 var(--edge) 0 0 var(--raised),
    0 calc(var(--edge) * 2) 0 0 var(--scrim); }
.choice:focus-visible { outline: none; background: var(--hover); }
/* The game's cursor, beside the choice pointed at or reached by keyboard. */
.choice::before {
  content: '';
  position: absolute;
  left: -22px;
  top: 50%;
  width: 10px;
  height: 14px;
  margin-top: -7px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 5 7' shape-rendering='crispEdges'%3E%3Cpath fill='%23fff' d='M0 0h1v7H0zM1 1h1v5H1zM2 2h1v3H2zM3 3h1v1H3z'/%3E%3C/svg%3E") 0 0 / 100% 100% no-repeat;
  opacity: 0;
}
.choice:hover::before, .choice:focus-visible::before { opacity: 1; animation: blink 0.8s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-color-scheme: light) {
  .choice::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 5 7' shape-rendering='crispEdges'%3E%3Cpath fill='%230b0b0c' d='M0 0h1v7H0zM1 1h1v5H1zM2 2h1v3H2zM3 3h1v1H3z'/%3E%3C/svg%3E"); }
}
.mark { flex: none; width: 28px; display: grid; place-items: center; color: var(--ink); }
.mark svg { display: block; width: 24px; height: 24px; }
.text { min-width: 0; display: grid; gap: 3px; }
.title { font: 400 22px/1 var(--pixel); -webkit-font-smoothing: none; overflow-wrap: anywhere; }
.where { font-size: 12.5px; line-height: 1.3; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.foot { display: flex; justify-content: center; align-items: center; gap: 16px; margin-top: 28px; font-size: 13px; color: var(--sea-ink-2); }
.foot a { color: var(--sea-ink-2); text-decoration: none; }
.foot a:hover { color: var(--sea-ink); text-decoration: underline; }

@media (prefers-reduced-motion: reduce) {
  *, *::before { animation: none !important; }
  .choice:active { transform: none; }
}

/* ── Signing in and editing, for the page's editors ──────────────────────────────────────────────────────────────── */

button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; opacity: 0.45; }
.quiet { border: 0; background: none; padding: 6px 8px; color: var(--sea-ink-2); font-size: 13px; }
.quiet:hover { color: var(--sea-ink); text-decoration: underline; }
.primary, .ghost { min-height: 40px; padding: 0 16px; border-radius: 10px; font-weight: 500; font-size: 14px; }
.primary { border: 1px solid var(--primary); background: var(--primary); color: var(--on-primary); }
.ghost { border: 1px solid var(--border-strong); background: var(--raised); }
.ghost:hover { background: var(--hover); }
.row { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
label { display: block; font-size: 13px; font-weight: 500; color: var(--ink-2); margin: 0 0 6px; }
input, textarea { width: 100%; min-height: 40px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink); font: inherit; }
textarea { resize: vertical; min-height: 64px; }
.field { display: flex; align-items: center; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); padding-left: 12px; }
.field input { border: 0; background: none; padding-left: 2px; min-width: 0; }
.field:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.field input:focus-visible { outline: none; }
.at { color: var(--ink-3); }
.muted { color: var(--ink-2); margin: 0; }
.small { font-size: 13px; color: var(--ink-3); }
.said { min-height: 1.5em; margin: 0; font-size: 13px; color: var(--ink-2); }

.veil { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 16px; background: var(--veil); }
/* The sign-in and the editor are dialogue boxes too. */
.sheet, .editor {
  background: var(--surface);
  box-shadow:
    0 calc(var(--edge) * -1) 0 0 var(--ink),
    0 var(--edge) 0 0 var(--ink),
    calc(var(--edge) * -1) 0 0 0 var(--ink),
    var(--edge) 0 0 0 var(--ink),
    0 calc(var(--edge) * 4) 0 0 var(--scrim);
}
.sheet { width: 100%; max-width: 400px; display: grid; gap: 12px; padding: 24px; }
.sheet h2 { margin: 0; font: 400 22px/1.1 var(--pixel); -webkit-font-smoothing: none; }
.sheet label { margin: 4px 0 0; }

.editor { display: grid; gap: 16px; padding: 0 16px 20px; margin: var(--edge); }
.bar { position: sticky; top: 0; z-index: 2; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; padding: 12px 0; background: var(--surface); border-bottom: 1px solid var(--border); }
.state { min-width: 0; }
.who { margin: 0; font-weight: 500; }
.state .said { min-height: 0; }
.block { display: grid; gap: 6px; padding: 16px; border-radius: 12px; border: 1px solid var(--border); background: var(--raised); }
.block label + * { margin-bottom: 8px; }
.block h3 { margin: 0 0 4px; font-size: 15px; font-weight: 600; }
.rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.row-item { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 8px 12px; padding: 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--raised); }
.row-item.heading { background: transparent; }
.row-item.hidden-item { opacity: 0.6; }
.kind { font-size: 12px; font-weight: 600; color: var(--ink-3); padding-top: 11px; }
.inputs { display: grid; gap: 6px; min-width: 0; }
.tools { grid-column: 2; display: flex; flex-wrap: wrap; gap: 6px; }
.tool { min-width: 36px; height: 32px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); font-size: 13px; }
.tool:hover:not(:disabled) { background: var(--hover); }
.tool.danger { color: var(--danger); }
.adds { justify-content: flex-start; }
.people { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.people li { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 32px; }
.add-editor { justify-content: flex-start; flex-wrap: nowrap; }
.add-editor .field { flex: 1; }
@media (max-width: 420px) {
  .row-item { grid-template-columns: minmax(0, 1fr); }
  .kind { padding-top: 0; }
  .tools { grid-column: 1; }
}
