/* Built for a phone first: one column, the navigation as a bar at the lower
   edge within reach of the thumb. From 960px on the navigation moves into
   the header.

   Colours: light by default, dark when the system says so, and either one
   when the user chose it (data-theme on <html>, set by app.js). */

:root {
  color-scheme: light;
  --paper: #f6f3ec;
  --surface: #fffdf8;
  --ink: #1b2430;
  --muted: #5b6573;
  --line: #d9d3c5;
  --accent: #c2410c;
  --accent-ink: #ffffff;
  --good: #166534;
  --good-soft: #dcf5e3;
  --bar: rgba(255, 253, 248, 0.94);
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --bar-height: 3.75rem;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #12161c;
    --surface: #1a2029;
    --ink: #ece7db;
    --muted: #9aa3b0;
    --line: #2d3644;
    --accent: #fb923c;
    --accent-ink: #1a1206;
  --good: #86efac;
  --good-soft: #173a26;
    --bar: rgba(22, 27, 35, 0.94);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #12161c;
  --surface: #1a2029;
  --ink: #ece7db;
  --muted: #9aa3b0;
  --line: #2d3644;
  --accent: #fb923c;
  --accent-ink: #1a1206;
  --good: #86efac;
  --good-soft: #173a26;
  --bar: rgba(22, 27, 35, 0.94);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* On a phone the page itself never scrolls, only its content (main).
   Browsers move their own bars in and out while a page scrolls, and the
   navigation at the lower edge wandered and shook along with them. A page
   that does not scroll leaves those bars, and with them the navigation,
   where they are. */
body {
  margin: 0;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font: 1.0625rem/1.55 var(--sans);
  /* Room for the navigation bar at the lower edge. */
  padding-bottom: calc(var(--bar-height) + env(safe-area-inset-bottom));
}

a {
  color: inherit;
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.icon {
  width: 1.5rem;
  height: 1.5rem;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.skip {
  position: absolute;
  left: 0.5rem;
  top: -4rem;
  z-index: 30;
  padding: 0.5rem 0.75rem;
  background: var(--ink);
  color: var(--paper);
  border-radius: 0.25rem;
}

.skip:focus {
  top: 0.5rem;
}

/* Header */

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  padding-top: calc(0.75rem + env(safe-area-inset-top));
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  text-decoration: none;
  font: 700 1.0625rem/1 var(--mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.logo {
  width: 1.75rem;
  height: 1.75rem;
  fill: currentColor;
}

.brand-number {
  color: var(--accent);
}

/* The way to the profile: a round button that opens a small menu. */

.profile-menu {
  position: relative;
  flex: none;
}

.profile-menu summary,
.name-edit summary {
  list-style: none;
  cursor: pointer;
}

.profile-menu summary::-webkit-details-marker,
.name-edit summary::-webkit-details-marker {
  display: none;
}

.menu {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  /* Above the map and the navigation. */
  z-index: 30;
  display: grid;
  min-width: 11rem;
  padding: 0.375rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0.625rem;
  box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.18);
}

.menu form {
  margin: 0;
}

.menu a,
.menu button {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 2.75rem;
  padding: 0 0.875rem;
  border: 0;
  border-radius: 0.4375rem;
  background: none;
  color: var(--ink);
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

/* The choice of the colour scheme: three pictures side by side. */
.menu .theme {
  margin-top: 0.375rem;
  padding: 0.1875rem;
  background: none;
}

.menu .theme[hidden] {
  display: none;
}

.menu .theme button {
  justify-content: center;
  min-height: 2.5rem;
  padding: 0;
  color: var(--muted);
}

.menu .theme button[aria-pressed="true"] {
  background: var(--accent);
  color: var(--accent-ink);
}

.menu a[aria-current="page"] {
  color: var(--accent);
  font-weight: 600;
}

.profile-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
}

.profile-button.current,
.profile-menu[open] .profile-button {
  background: var(--surface);
  border-color: var(--accent);
  color: var(--accent);
}

/* Navigation: a bar at the lower edge */

.nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: flex;
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--bar);
  border-top: 1px solid var(--line);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.nav-link {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1875rem;
  height: var(--bar-height);
  color: var(--muted);
  text-decoration: none;
  font-size: 0.75rem;
  line-height: 1;
}

.nav-link[aria-current="page"] {
  color: var(--accent);
  font-weight: 600;
}

/* Content */

/* The content is a column of 38rem at most. Its room to the sides is
   padding, so that it scrolls wherever it is touched. */
main {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  width: 100%;
  /* Below: more room while the keyboard of a phone is up (app.js). */
  padding: 1.75rem max(1rem, calc((100% - 38rem) / 2)) calc(2rem + var(--keyboard, 0px));
}

.kicker {
  margin: 0 0 0.5rem;
  color: var(--accent);
  font: 600 0.8125rem/1.2 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 0 0 0.75rem;
  font-size: clamp(1.875rem, 8vw, 2.75rem);
  line-height: 1.1;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

h2 {
  margin: 0 0 0.25rem;
  font-size: 1.0625rem;
}

.lead {
  margin: 0;
  color: var(--muted);
  font-size: 1.125rem;
}

/* The profile: the name once, and a pencil at its right that opens the
   field to change it below. */

.name-row {
  position: relative;
  padding-right: 3.25rem;
}

.name-row h1 {
  overflow-wrap: anywhere;
}

.name-edit summary {
  position: absolute;
  top: 0;
  right: 0;
}

.name-edit[open] {
  margin-bottom: 1rem;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
}

.name-edit[open] .icon-button {
  background: var(--surface);
  border-color: var(--accent);
  color: var(--accent);
}

.icon-button .icon {
  width: 1.25rem;
  height: 1.25rem;
}

/* Quiet ways on from a page, one per line. */

.links {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

.links a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 3rem;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
}

.links a::after {
  content: "›";
  color: var(--muted);
  font-size: 1.25rem;
}

/* Start page: the address of the site as a sentence, "3150.ist" and below
   it "/word". The word is swapped by app.js. */

.hero {
  position: relative;
  padding: 1.25rem 0 0.5rem;
}

/* Squared paper behind it, fading out: the grid of the magazine puzzle. */
.hero::before {
  content: "";
  position: absolute;
  inset: -1.75rem -1rem 0;
  z-index: -1;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 1.5rem 1.5rem;
  background-position: center top;
  opacity: 0.55;
  -webkit-mask-image: radial-gradient(120% 90% at 85% 0%, #000 0%, transparent 70%);
  mask-image: radial-gradient(120% 90% at 85% 0%, #000 0%, transparent 70%);
}

.hero-title {
  margin: 0.75rem 0 1.25rem;
  font: 700 clamp(2rem, 10.4vw, 4.75rem) / 1.12 var(--mono);
  letter-spacing: -0.02em;
  text-wrap: nowrap;
}

.hero-domain,
.hero-path {
  display: block;
}

.hero-dot,
.hero-slash {
  color: var(--muted);
}

.hero-path {
  color: var(--accent);
}

/* Both words of a swap lie in the same cell, and what moves out of it is
   cut off. Room below the line for g, j and ß. */
.rotor {
  display: inline-grid;
  vertical-align: top;
  overflow: hidden;
  overflow: clip;
  padding-bottom: 0.14em;
}

.rotor-word {
  grid-area: 1 / 1;
  justify-self: start;
  will-change: transform, opacity;
}

.hero-path::after {
  content: "";
  display: inline-block;
  width: 0.5em;
  height: 0.09em;
  margin-left: 0.08em;
  background: currentColor;
}

@media (prefers-reduced-motion: no-preference) {
  .hero-path::after {
    animation: blink 1.1s steps(1) infinite;
  }
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

.steps ol {
  margin: 1.75rem 0 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
  border-top: 1px solid var(--line);
}

.steps li {
  counter-increment: step;
  position: relative;
  padding: 0.875rem 0 0.875rem 2.25rem;
  border-bottom: 1px solid var(--line);
}

.steps li::before {
  content: counter(step, decimal-leading-zero);
  position: absolute;
  left: 0;
  color: var(--accent);
  font: 600 0.875rem/1.9 var(--mono);
}

.note {
  margin-top: 1.75rem;
  padding: 1rem 1.125rem;
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: 0.5rem;
}

.note p {
  margin: 0;
  color: var(--muted);
}

.actions {
  margin: 1.75rem 0 0;
}

/* A part of a page with its own heading, e.g. one setting. */

.part {
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}

.part h2 {
  margin-bottom: 0.75rem;
}

.part > .hint:first-of-type {
  margin-top: 0;
}

/* A hint that opens a part, with a form below it. */
.part > h2 + .hint {
  margin-bottom: 0.75rem;
}

.hint {
  margin: 0.625rem 0 0;
  color: var(--muted);
  font-size: 0.9375rem;
}

/* An input with its button beside it. */

.field {
  display: flex;
  gap: 0.5rem;
}

.field input {
  flex: 1;
  min-width: 0;
}

.field input,
.labelled input,
.labelled select,
.labelled textarea {
  min-height: 3rem;
  padding: 0 0.875rem;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  /* Not below 16px: an iPhone would zoom in on focus. */
  font: 1.0625rem/1.2 var(--sans);
}

.field input::placeholder {
  color: var(--muted);
  opacity: 0.8;
}

button.button {
  border: 0;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

/* Missions: one card each. */

.missions {
  margin-top: 1.75rem;
  display: grid;
  gap: 0.875rem;
}

.mission {
  padding: 1rem 1.125rem 1.125rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
}

.mission p {
  margin: 0 0 0.875rem;
}

.mission .kicker {
  margin-bottom: 0.375rem;
}

.mission .mission-result,
.mission .mission-wait {
  margin: 0.625rem 0 0;
  color: var(--muted);
  font-size: 0.9375rem;
}

/* How long the player has to wait: not to be overlooked. */
.mission .mission-wait {
  color: var(--ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.mission .mission-result:empty,
.mission .mission-state:empty,
.mission:not([data-done]) [data-mission-again] {
  display: none;
}

/* Solved: a soft green badge, here and in the lists (the frame in the
   accent colour was too loud for the user). */
.mission .mission-state,
.entry-state {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  width: fit-content;
  padding: 0.1875rem 0.625rem;
  background: var(--good-soft);
  border-radius: 999px;
  color: var(--good);
  font-size: 0.875rem;
  font-weight: 600;
}

.mission .mission-state::before,
.entry-state::before {
  content: "✓";
}

/* A right answer is not to be overlooked: a green box with a tick in a
   filled circle and "Richtig!" beside it. What else there is to say starts
   on the next line, below the tick (the user's wish on 2026-12-03).
   game.js marks the box, and anew for every right answer, so that it comes
   in again. */
.mission .mission-result[data-verdict="right"] {
  margin-top: 0.875rem;
  padding: 0.75rem 0.875rem;
  background: var(--good-soft);
  border-radius: 0.5rem;
  color: var(--ink);
  font-size: 1rem;
}

.mission .mission-result strong {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  color: var(--good);
}

.mission .mission-result strong::before {
  content: "✓";
  flex: none;
  display: grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  background: var(--good);
  border-radius: 50%;
  color: var(--good-soft);
  font-size: 0.875rem;
  font-weight: 700;
}

.mission .mission-result .more {
  display: block;
  margin-top: 0.5rem;
}

@media (prefers-reduced-motion: no-preference) {
  .mission .mission-result[data-verdict="right"] {
    animation: solved 0.35s ease-out;
  }

  .mission .mission-result[data-verdict="right"] strong::before {
    animation: tick 0.45s 0.15s cubic-bezier(0.3, 1.6, 0.5, 1) backwards;
  }
}

@keyframes solved {
  from {
    opacity: 0;
    transform: translateY(0.25rem) scale(0.98);
  }
}

@keyframes tick {
  from {
    transform: scale(0);
  }
}

.mission [data-mission-again] {
  margin: 0 0 0.625rem;
}

.field :disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* What a mission takes: small labels. */

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.intro + .tags {
  margin-top: 0.875rem;
}

.mission h2 {
  margin: 0 0 0.875rem;
}

/* The list of missions: a square picture on the left, the name beside it. */

.entries {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.625rem;
}

.entry {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.5rem;
  padding-right: 0.875rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  text-decoration: none;
}

.entry-picture {
  flex: none;
  width: 5.5rem;
  height: 5.5rem;
  border-radius: 0.3125rem;
  object-fit: cover;
  background: var(--paper);
}

/* A mission without a picture: a few cells of a grid in a dashed frame. */
.entry-picture.empty {
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
}

.entry-picture.empty svg {
  width: 2.75rem;
  height: 2.75rem;
  fill: var(--line);
}

.entry-text {
  display: grid;
  gap: 0.25rem;
  min-width: 0;
  overflow-wrap: anywhere;
}

.entry-title {
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.3;
}


.entry-state:empty {
  display: none;
}


/* The logbook is the list of missions with only the solved ones seen, and
   its note about an empty logbook goes once there is one. */

[data-logbook] li:has(> .entry:not([data-done])),
[data-logbook]:has([data-done]) ~ [data-logbook-empty] {
  display: none;
}

/* The list itself shows only what is still to do: there will be many
   missions. A line below says where the solved ones are, and a note
   stands in for the list when nothing is left. */

[data-missions]:not([data-logbook]) li:has(> .entry[data-done]),
[data-missions]:not(:has(.entry[data-done])) [data-solved-note],
[data-missions]:has(.entry:not([data-done])) [data-all-solved] {
  display: none;
}

.missions .note,
.missions > .hint {
  margin-top: 0;
}

/* A form with its inputs below each other, each under its label. */

.form {
  display: grid;
  gap: 0.875rem;
  justify-items: start;
}

.form .hint {
  margin: -0.375rem 0 0;
}

.labelled {
  display: grid;
  gap: 0.3125rem;
  width: 100%;
}

.labelled span {
  color: var(--muted);
  font-size: 0.9375rem;
}

.labelled input,
.labelled select,
.labelled textarea {
  width: 100%;
}

.labelled textarea {
  padding: 0.75rem 0.875rem;
  line-height: 1.45;
  resize: vertical;
}

/* Fields of a form that belong together, under a line that says how. */

.group {
  display: grid;
  gap: 0.875rem;
  min-width: 0;
  margin: 0;
  padding: 0.5rem 1rem 1rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
}

.group legend {
  padding: 0 0.375rem;
  color: var(--muted);
  font-size: 0.9375rem;
}

.group .pair {
  flex-wrap: nowrap;
}

/* A box to tick, with what it means beside it. */

.tick {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 2.75rem;
}

.tick input {
  flex: none;
  width: 1.375rem;
  height: 1.375rem;
  accent-color: var(--accent);
}

/* What cannot be taken back, behind one more tap. */

.danger {
  margin-top: 2rem;
  color: var(--muted);
}

.danger summary {
  min-height: 2.75rem;
  cursor: pointer;
}

.danger form {
  margin-top: 0.75rem;
}

.card .danger {
  margin-top: 0.25rem;
}

/* The text of a mission, written as Markdown in the administration. */

.prose {
  margin-top: 1.25rem;
  overflow-wrap: break-word;
}

.prose > :first-child {
  margin-top: 0;
}

.prose p,
.prose ul,
.prose ol,
.prose blockquote,
.prose pre,
.prose table {
  margin: 0 0 0.875rem;
}

.prose h1,
.prose h2,
.prose h3 {
  margin: 1.5rem 0 0.5rem;
  font-size: 1.125rem;
  line-height: 1.3;
}

.prose ul,
.prose ol {
  padding-left: 1.375rem;
}

.prose li + li {
  margin-top: 0.25rem;
}

.prose blockquote {
  padding-left: 0.875rem;
  border-left: 3px solid var(--line);
  color: var(--muted);
}

.prose code {
  font: 0.9375em var(--mono);
}

.prose pre,
.prose table {
  display: block;
  overflow-x: auto;
}

.prose th,
.prose td {
  padding: 0.25rem 0.625rem 0.25rem 0;
  text-align: left;
  vertical-align: top;
}

.prose hr {
  margin: 1.25rem 0;
  border: 0;
  border-top: 1px solid var(--line);
}

h3 {
  margin: 1.5rem 0 0.75rem;
  font-size: 1rem;
}

/* Two buttons side by side. */

.pair {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.button.small {
  min-height: 2.5rem;
  padding: 0 0.875rem;
  font-size: 0.9375rem;
}

/* Lists of the administration: one card per entry. */

.cards {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.75rem;
}

.card {
  padding: 0.875rem 1rem 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  overflow-wrap: anywhere;
}

.card p,
.card .actions {
  margin: 0 0 0.625rem;
}

.card > :last-child {
  margin-bottom: 0;
}

.card .field {
  margin-bottom: 0.625rem;
}

.badge {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 400;
  white-space: nowrap;
}

.badge.loud {
  border-color: var(--accent);
  color: var(--accent);
}

/* The accounts of the administration: one line each. On a phone the table
   is wider than the page and scrolls sideways inside its frame. */

.table-scroll {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.table th,
.table td {
  max-width: 18rem;
  padding: 0.5rem 0.875rem;
  border-top: 1px solid var(--line);
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  vertical-align: baseline;
  white-space: nowrap;
}

.table thead th {
  border-top: 0;
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 600;
}

.table tbody th {
  font-weight: 600;
}

/* A one-time password, shown once: large, and one tap selects all. */

.secret {
  margin: 1.75rem 0 0;
  padding: 1rem;
  background: var(--surface);
  border: 2px solid var(--accent);
  border-radius: 0.5rem;
  font: 700 1.25rem/1.3 var(--mono);
  text-align: center;
  -webkit-user-select: all;
  user-select: all;
  overflow-wrap: anywhere;
}

/* What happened to a request of the visitor. */

.message {
  margin: 1.25rem 0 0;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border-left: 3px solid var(--accent);
  border-radius: 0.25rem;
}

.message + .form,
.actions + .form {
  margin-top: 1.25rem;
}

.note .actions {
  margin-top: 0.875rem;
}

/* The picture of a mission, in the form of the administration. */
.picture-shown {
  display: block;
  width: 10rem;
  height: 10rem;
  margin-bottom: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  object-fit: cover;
}

/* A choice of a few: the buttons side by side, the chosen one filled. */

.segments {
  display: flex;
  gap: 0.25rem;
  padding: 0.25rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0.625rem;
}

.segments button {
  flex: 1;
  min-height: 2.75rem;
  padding: 0 0.25rem;
  border: 0;
  border-radius: 0.4375rem;
  background: none;
  color: var(--muted);
  font: 0.9375rem/1 var(--sans);
  cursor: pointer;
}

.segments button[aria-pressed="true"] {
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  padding: 0 1.25rem;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 0.5rem;
  font-weight: 600;
  text-decoration: none;
}

.button.quiet {
  background: none;
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* The map page: the map takes all the room between header and navigation. */

main.full {
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.map {
  flex: 1;
  min-height: 20rem;
  /* The map stacks its parts; keep them below the navigation. */
  isolation: isolate;
  background: var(--paper);
  font: inherit;
}

/* Who has scripts would only see this note flash by. */
[data-js] .map-fallback {
  display: none;
}

.map-fallback {
  margin: 0;
  padding: 1.75rem 1rem;
  color: var(--muted);
}

/* MapLibre draws the map into a canvas (see map.js); what it puts around
   it takes the colours of the page. */
.map.maplibregl-map {
  font: inherit;
}

.map.maplibregl-map .maplibregl-ctrl-attrib {
  background: var(--bar);
  color: var(--muted);
  font-size: 0.6875rem;
}

.map.maplibregl-map .maplibregl-ctrl-attrib a {
  color: inherit;
}

.map.maplibregl-map .maplibregl-ctrl-group {
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--line);
}

.map.maplibregl-map .maplibregl-ctrl-group button {
  width: 2.75rem;
  height: 2.75rem;
}

.map.maplibregl-map .maplibregl-ctrl-group button + button {
  border-top-color: var(--line);
}

/* Its plus and minus are dark pictures. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .map .maplibregl-ctrl-icon {
    filter: invert(1);
  }
}

:root[data-theme="dark"] .map .maplibregl-ctrl-icon {
  filter: invert(1);
}

/* The button that moves the map to where the device is (map.js). */
.map.maplibregl-map .map-locate {
  display: grid;
  place-items: center;
  color: var(--ink);
}

.map.maplibregl-map .map-locate[aria-busy="true"] svg {
  animation: map-locating 1.2s ease-in-out infinite;
}

@keyframes map-locating {
  50% {
    opacity: 0.3;
  }
}

/* Until the map is drawn: a note over it, in the colour of the page, that
   fades once the map is there. */
.map {
  position: relative;
}

.map-loading {
  position: absolute;
  inset: 0;
  z-index: 1001;
  margin: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 0.75rem;
  background: var(--paper);
  color: var(--muted);
  font-size: 0.875rem;
  transition: opacity 0.3s ease;
}

.map-loading::before {
  content: "";
  width: 1.75rem;
  height: 1.75rem;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
}

.map-loading[data-done] {
  opacity: 0;
  pointer-events: none;
}

@media (prefers-reduced-motion: no-preference) {
  .map-loading::before {
    animation: map-loading 0.9s linear infinite;
  }
}

@keyframes map-loading {
  to {
    transform: rotate(360deg);
  }
}

/* The browser refuses the location: a way to the profile, on the map; or
   the device is not in the town. */
.map-note {
  margin: 0;
  position: absolute;
  /* Beside plus and minus, not over them. */
  left: 4.25rem;
  right: 0.75rem;
  top: 0.75rem;
  z-index: 1000;
  padding: 0.625rem 0.875rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  font-size: 0.875rem;
}

/* A permission the browser refused: what to do about it. */

.refused {
  margin-top: 0.75rem;
  padding: 0.75rem 1rem 1rem;
  background: var(--surface);
  border-left: 3px solid var(--accent);
  border-radius: 0.25rem;
}

.refused p {
  margin: 0 0 0.625rem;
}

/* What a scanned code holds: written by a stranger, shown as it is. */

.code {
  font: 0.875rem/1.4 var(--mono);
  overflow-wrap: anywhere;
}

.form > .code {
  margin: 0;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
}

.button:disabled {
  opacity: 0.5;
  cursor: default;
}

/* The scanner: the picture of the camera over the whole screen, always
   dark, with its buttons on it. */

.scanner {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: #000;
  color: #fff;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

.scanner-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scanner-none {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 4.5rem 1.5rem 1.5rem;
  background: #000;
  color: #d4d4d8;
  text-align: center;
}

.scanner-none p {
  margin: 0;
  max-width: 26rem;
}

.scanner-none strong {
  color: #fff;
}

.scanner-top {
  position: absolute;
  top: max(0.75rem, env(safe-area-inset-top));
  left: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.625rem;
  max-width: calc(100% - 5.25rem);
}

.scanner-name,
.scanner-hint {
  background: rgba(0, 0, 0, 0.55);
  font-size: 0.875rem;
}

.scanner-name {
  padding: 0.25rem 0.5rem;
  border-radius: 0.625rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.scanner-name:empty,
.scanner-hint:empty {
  display: none;
}

.scanner-round {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 3rem;
  height: 3rem;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  cursor: pointer;
}

.scanner-round:disabled {
  opacity: 0.5;
}

.scanner-close {
  position: absolute;
  top: max(0.75rem, env(safe-area-inset-top));
  right: 0.75rem;
}

.scanner-hint {
  position: absolute;
  left: 50%;
  bottom: max(1.5rem, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 2rem);
  margin: 0;
  padding: 0.375rem 0.75rem;
  border-radius: 0.75rem;
  text-align: center;
}

/* Messages of the script */

.toasts {
  position: fixed;
  left: 0.75rem;
  right: 0.75rem;
  bottom: calc(var(--bar-height) + env(safe-area-inset-bottom) + 0.75rem);
  z-index: 40;
  display: grid;
  gap: 0.5rem;
  justify-items: center;
  pointer-events: none;
}

.toast {
  max-width: 28rem;
  padding: 0.625rem 0.875rem;
  background: var(--ink);
  color: var(--paper);
  border-radius: 0.5rem;
  font-size: 0.875rem;
  pointer-events: auto;
}

/* Wide screens: the navigation sits in the header */

@media (min-width: 60rem) {
  /* No bar at the lower edge here: the page scrolls as pages do. */
  body {
    height: auto;
    min-height: 100vh;
    overflow: visible;
    padding-bottom: 0;
  }

  main {
    overflow: visible;
  }

  .top {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }

  .nav {
    position: static;
    margin-left: auto;
    gap: 0.25rem;
    padding: 0;
    background: none;
    border: 0;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  .nav-link {
    flex: none;
    flex-direction: row;
    gap: 0.5rem;
    height: 2.75rem;
    padding: 0 0.875rem;
    border-radius: 999px;
    font-size: 0.9375rem;
  }

  .nav-link .icon {
    width: 1.25rem;
    height: 1.25rem;
  }

  .nav-link[aria-current="page"] {
    background: var(--surface);
    box-shadow: inset 0 0 0 1px var(--line);
  }

  main:not(.full) {
    padding-top: 3rem;
  }

  .toasts {
    bottom: 1rem;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .nav-link,
  .button,
  .profile-button,
  .segments button {
    transition: color 0.15s, background-color 0.15s;
  }
}
