/* What every page of ours shares (plugin/src/Html.php), after FlatUI's stylesheets (flatui/page.css): the kit's tokens
   only, so the pages follow its theme. FlatUI itself is never edited here (tools/flatui-copy.mjs replaces it
   wholesale). A page's own styles come after this file (home.css, login.css). */

/* ---- The column: as wide as the page needs. The footer's rule lines up with it. ---- */
.fui.fui-page {
  --gs-column: 60em;
}
.fui.fui-page.gs-medium {
  --gs-column: 48em;
}
.fui.fui-page.gs-narrow {
  --gs-column: 32em;
}
.fui .fui-page-main {
  max-width: var(--gs-column);
  padding-top: clamp(2em, 7vh, 4.5em);
}
.fui .fui-page-foot {
  width: calc(100% - 2 * var(--fui-page-gutter));
  max-width: calc(var(--gs-column) - 2 * var(--fui-page-gutter));
  padding-left: 0;
  padding-right: 0;
  font-size: 1em; /* the kit's .87em moves to the words, so the widths above are the column's */
}
.fui .fui-page-foot > * {
  font-size: .87em;
}
.fui .gs-foot-links {
  display: flex;
  flex-wrap: wrap;
  gap: .4em 1.4em;
}
.fui.fui-page .gs-foot-links a {
  color: var(--game-muted);
  text-underline-offset: .18em;
}
.fui.fui-page .gs-foot-links a:hover {
  color: var(--game-text);
}

/* ---- Words: a status line, a lead line, links in running text ---- */
.fui .gs-status {
  color: var(--game-muted);
  font-size: .95em;
}
.fui .gs-status strong,
.fui .gs-text strong {
  color: var(--game-text);
  font-weight: 600;
}
.fui .gs-lead {
  font-size: 1.08em;
  line-height: 1.5;
}
.fui .gs-text {
  color: var(--game-muted);
  line-height: 1.55;
}
.fui.fui-page .gs-window a:not([class]) {
  color: var(--fui-accent-ink); /* on the window's panel, the ink keeps 4.5:1 in every theme */
}

/* ---- A window's body: its parts spaced evenly; rows and groups keep their own rhythm ---- */
/* (a form that is the whole body is a .gs-stack too; its hidden fields go last, where their margin shows nothing) */
.fui .gs-window > .fui-panel-body > * + *,
.fui .gs-stack > * + * {
  margin-top: 1em;
}
.fui .gs-window > .fui-panel-body > :is(.fui-row, .fui-group) + *,
.fui .gs-window > .fui-panel-body > * + :is(.fui-row, .fui-group) {
  margin-top: 0;
}
.fui .gs-window > .fui-panel-body > .fui-group + * {
  margin-top: 1em;
}
/* A row's control is its form (one button); a row of a list of things (connected games) */
.fui .fui-row > form {
  flex: none;
}
.fui .fui-row-label strong {
  font-weight: 700;
}

/* ---- Forms: FlatUI's fields, one under another, at a readable width ---- */
.fui .gs-fields {
  display: flex;
  flex-direction: column;
  gap: 1em;
  max-width: 24em;
}
.fui .gs-fields + .fui-button-row {
  margin-top: 1.2em;
}

/* ---- A message over the content: done, or a problem. An icon and words carry it, never the colour alone. ---- */
.fui .gs-flash {
  display: flex;
  align-items: flex-start;
  gap: .7em;
  padding: .8em 1em;
  border-radius: var(--fui-radius-sm);
  border: 1px solid color-mix(in srgb, var(--gs-flash) 45%, var(--game-line));
  background: color-mix(in srgb, var(--gs-flash) 12%, var(--game-panel));
  color: var(--game-text);
  line-height: 1.5;
}
.fui .gs-flash > .fui-icon {
  flex: none;
  margin-top: .1em;
  color: var(--gs-flash);
}
.fui .gs-flash.gs-good {
  --gs-flash: var(--game-good);
}
.fui .gs-flash.gs-bad {
  --gs-flash: var(--game-bad);
}
.fui .gs-flash + .gs-flash {
  margin-top: .6em;
}

/* ---- The consent: what the game may do, each with the accent's check ---- */
.fui .gs-checks {
  display: flex;
  flex-direction: column;
  gap: .5em;
  margin: .6em 0 0;
  padding: 0;
  list-style: none;
}
.fui .gs-checks > li {
  display: flex;
  align-items: flex-start;
  gap: .6em;
}
.fui .gs-checks .fui-icon {
  flex: none;
  margin-top: .1em;
  color: var(--fui-accent-ink);
}

/* ---- The account page: the player's name, then a window per job ---- */
.fui .gs-account-head > .fui-button-row {
  margin-top: .4em;
}

/* The avatar grid: radio buttons drawn as portraits (the tile after each); the chosen one on the accent's tint with
   its edge in the accent. */
.fui .gs-avatars {
  margin-inline: 0; /* the stack's margin above it stays */
  padding: 0;
  border: 0;
  min-width: 0;
}
.fui .gs-avatars > legend {
  margin-bottom: .5em;
  padding: 0;
  font-weight: 600;
}
.fui .gs-avatar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(5.6em, 1fr));
  gap: .6em;
}
.fui .gs-avatar {
  position: relative;
  display: block;
  min-width: 0;
  cursor: pointer;
}
.fui .gs-avatar > input {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.fui .gs-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .35em;
  padding: .4em .4em .5em;
  border: 1px solid var(--game-line);
  border-radius: var(--fui-radius-sm);
  background: var(--game-soft);
  transition: background-color var(--fui-fast), border-color var(--fui-fast), box-shadow var(--fui-fast);
}
.fui .gs-tile > :is(img, .gs-pic) {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  border-radius: calc(var(--fui-radius-sm) - .2em);
  background: var(--game-band);
  color: var(--game-muted);
  font-size: 1.6em;
  font-weight: 700;
  text-transform: uppercase;
  object-fit: cover;
}
.fui .gs-tile > .gs-name {
  max-width: 100%;
  overflow: hidden;
  color: var(--game-muted);
  font-size: .8em;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fui .gs-avatar > input:checked + .gs-tile {
  border-color: var(--game-accent);
  background: var(--fui-tint);
}
.fui .gs-avatar > input:checked + .gs-tile > .gs-name {
  color: var(--fui-accent-ink);
  font-weight: 600;
}
.fui .gs-avatar > input:focus-visible + .gs-tile {
  box-shadow: var(--fui-ring);
}
.fui .gs-avatar > input:disabled + .gs-tile {
  opacity: .5;
}
@media (hover: hover) {
  .fui .gs-avatar:hover > input:not(:checked) + .gs-tile {
    border-color: var(--fui-strong-line);
  }
}

/* ---- The sign-up: "I am 13 or older" (a native checkbox in the accent; the whole line is its 44px target) ---- */
.fui .gs-check {
  display: flex;
  align-items: center;
  gap: .7em;
  min-height: 44px;
  cursor: pointer;
}
.fui .gs-check > input {
  flex: none;
  width: 1.25em;
  height: 1.25em;
  margin: 0;
  accent-color: var(--game-accent-fill);
}
/* The bot trap: out of sight and out of the tab order; people never fill it, many programs do */
.fui .gs-trap {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ---- The privacy note: FlatUI's prose, its headings as the window's sections ---- */
.fui .gs-prose h2 {
  margin: 1.4em 0 .4em;
  font-size: 1.05em;
}
.fui .gs-prose h2:first-of-type {
  margin-top: 1.2em;
}
.fui .gs-prose li + li {
  margin-top: .45em;
}
