/* ==========================================================================
   SAMRAJYA - KALCHAKRA

   One page, one paper, one ink. The whole design is the welcome composition
   and the panels that replace it, so everything here is measured against the
   same thing: the width of the wordmark.

        --mark   the width of the SAMRAJYA wordmark

   Every other dimension in the composition is a ratio of it. That is the
   whole trick behind the reference staying right from a 320px phone to a
   4K display: the mark is set to the width, and the air, the type, the
   ornament and the buttons follow from it rather than from viewport guesses.

   Warm off-white, near-black, no gradients, no shadows, no clutter.
   ========================================================================== */

/* ------------------------------------------------------------------ fonts */

@font-face {
  font-family: "Jost";
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url("../fonts/jost-300.4755701d1a.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
    U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
    U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Jost";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/jost-400.f94cffda16.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
    U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
    U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Jost";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/jost-500.98dce4f076.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
    U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
    U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ------------------------------------------------------------------ theme */

:root {
  --paper: #f7f4ef;
  --ink: #121110;
  --ink-soft: #6c6862;
  --line: #d8d2c8;

  /* The grey the board's ordinary tiles are marked with. Mid-grey, not ink:
     twenty-four of these are on screen at once and twenty-four near-black
     marks would make the board look written on rather than ruled. */
  --star-grey: #8d8d8d;

  /* The composition's unit of measure. */
  --mark: min(88vw, 44rem);

  /* Every distance below is a fraction of the wordmark, taken from the
     approved artwork. Change --mark and the composition holds. */
  --gap-mark-to-sub: 0.042;   /* SAMRAJYA to KALCHAKRA   */
  --gap-sub-to-orn: 0.068;    /* KALCHAKRA to ornament  */
  --gap-orn-to-line: 0.122;   /* ornament to tagline    */
  --gap-line-to-actions: 0.114; /* tagline to buttons   */

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ------------------------------------------------------------------ reset */

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Jost", ui-sans-serif, system-ui, -apple-system, "Segoe UI",
    Roboto, sans-serif;
  font-weight: 400;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-wrap: break-word;
}

button,
input {
  font: inherit;
  color: inherit;
}

/* Keyboard only. A mouse user never sees it; a keyboard user always does. */
:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
  border-radius: 2px;
}

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

.skip-link {
  position: absolute;
  left: 0.5rem;
  top: -4rem;
  z-index: 10;
  padding: 0.6rem 0.9rem;
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
  transition: top 140ms var(--ease);
}
.skip-link:focus-visible {
  top: 0.5rem;
}

/* ------------------------------------------------------------------- stage

   One full-height stage that every screen sits in. `svh` rather than `vh` so
   a phone that hides its address bar on scroll does not clip the composition,
   and the safe-area insets keep it clear of notches and home bars. */

.stage {
  min-height: 100svh;
  display: grid;
  grid-template-rows: 1fr auto;
  padding: max(1.25rem, env(safe-area-inset-top)) max(1.25rem, env(safe-area-inset-right))
    max(1.25rem, env(safe-area-inset-bottom)) max(1.25rem, env(safe-area-inset-left));
}

.stage__body {
  display: grid;
  place-items: center;
  width: 100%;
  /* Panels can be taller than a phone; let the page scroll rather than clip. */
  align-content: safe center;
  padding-block: 1.5rem;
}

.stage__foot {
  display: grid;
  place-items: center;
  padding-top: 0.75rem;
}

/* The footer when it holds two buttons side by side (Test mode). */
.stage__foot:has(.board-foot) {
  display: block;
}

.board-foot {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

/* ------------------------------------------------------------------- mark */

.composition {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: 100%;
}

/* The gap between a refresh and the game. The wordmark is there, so the page
   does not change shape under the player, and one line says what is being
   waited for. */
.restoring__note {
  margin: calc(var(--mark) * 0.06) 0 0;
  font-size: calc(var(--mark) * 0.028);
  font-weight: 300;
  letter-spacing: 0.17em;
  text-indent: 0.17em;
  color: color-mix(in srgb, var(--ink) 58%, transparent);
  animation: restoring-pulse 1800ms ease-in-out infinite;
}

@keyframes restoring-pulse {
  0%, 100% { opacity: 0.55; }
  50%      { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .restoring__note {
    animation: none;
  }
}

.wordmark {
  display: block;
  height: auto;
  overflow: visible;
}

.wordmark--samrajya {
  width: var(--mark);
  max-width: 100%;
}

.wordmark--kalchakra {
  width: calc(var(--mark) * 0.517);
  max-width: 100%;
  margin-top: calc(var(--mark) * var(--gap-mark-to-sub));
}

.ornament {
  display: block;
  width: calc(var(--mark) * 0.505);
  max-width: 100%;
  height: auto;
  margin-top: calc(var(--mark) * var(--gap-sub-to-orn));
  color: var(--ink);
}

.tagline {
  margin: calc(var(--mark) * var(--gap-orn-to-line)) 0 0;
  font-size: calc(var(--mark) * 0.0365);
  font-weight: 300;
  line-height: 1.62;
  letter-spacing: 0.17em;
  text-indent: 0.17em; /* the tracking's trailing space, put back */
  color: var(--ink);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: calc(var(--mark) * 0.021);
  margin-top: calc(var(--mark) * var(--gap-line-to-actions));
  width: calc(var(--mark) * 1.02);
  max-width: 100%;
}

/* ---------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  min-height: calc(var(--mark) * 0.147);
  padding: 0 1.05em;
  border: 1px solid var(--ink);
  border-radius: calc(var(--mark) * 0.035);
  background: var(--paper);
  color: var(--ink);
  font-size: calc(var(--mark) * 0.0455);
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: 0.012em;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: background-color 160ms var(--ease), color 160ms var(--ease),
    opacity 160ms var(--ease);
}

.actions .btn {
  flex: 1 1 calc(var(--mark) * 0.48);
}

.btn--primary {
  background: var(--ink);
  color: var(--paper);
}

.btn--primary:hover:not(:disabled) {
  background: #000;
}

.btn--ghost:hover:not(:disabled) {
  background: var(--ink);
  color: var(--paper);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn__arrow {
  display: inline-block;
  font-weight: 300;
  transform: translateY(-0.02em);
}

.btn--quiet {
  min-height: 0;
  padding: 0.4em 0;
  border: 0;
  background: none;
  color: var(--ink-soft);
  font-size: 0.95rem;
  text-decoration: underline;
  text-underline-offset: 0.35em;
  text-decoration-thickness: 1px;
}
.btn--quiet:hover:not(:disabled) {
  background: none;
  color: var(--ink);
}

/* A touch target has to be a touch target, whatever the type size says. */
.btn--quiet {
  min-height: 44px;
}

/* --------------------------------------------------- the panel's own CTA

   A panel has ONE button, and one button in a flex column with `flex-grow`
   is a block the width of the column - which is what these CTAs had become:
   a wide rectangle sitting slightly left of centre, because the container's
   width is the wordmark's and the container itself was never centred in the
   column.

   Both halves are fixed here, at the layout rather than by offsetting the
   button: the container centres itself, and the button takes its width from
   its own label with the padding a pill is given. Every screen that uses the
   panel - Create, both Join steps, the Lobby - gets the same CTA, and the
   welcome screen, which has no panel, is left exactly as it was. */

.panel .actions {
  align-self: center;
}

.panel .actions .btn {
  flex: none;
  padding: 0 1.6em;
  border-radius: 999px;
}

/* ----------------------------------------------------------------- panels */

.panel {
  width: 100%;
  max-width: 30rem;
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

/* A panel that is only reporting, focused so its heading is announced. The
   browser does not draw a focus ring for a programmatic focus on a container,
   and this says so explicitly rather than relying on that. */
.panel:focus,
.panel:focus-visible {
  outline: none;
}

.panel__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.85rem;
}

.panel__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 400;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.panel__step {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 300;
  letter-spacing: 0.16em;
  color: var(--ink-soft);
  white-space: nowrap;
}

.panel__lede {
  margin: 0;
  font-weight: 300;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
  font-size: 0.98rem;
}

/* ------------------------------------------------------------------ forms */

.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.field__label {
  font-size: 0.78rem;
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.field__input {
  width: 100%;
  min-height: 3rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: transparent;
  font-size: 1.05rem;
  font-weight: 300;
  letter-spacing: 0.02em;
  transition: border-color 140ms var(--ease);
}

.field__input::placeholder {
  color: #a8a29a;
  font-weight: 300;
}

.field__input:hover {
  border-color: #b9b2a6;
}

.field__input:focus {
  outline: none;
  border-color: var(--ink);
}

/* The ring is the focus indicator; the border turning dark at the same moment
   draws a second box inside it, which reads as a mistake rather than as
   emphasis. */
.field__input:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
  border-color: var(--line);
}

.field__input--code {
  font-weight: 400;
  font-size: 1.35rem;
  letter-spacing: 0.5em;
  font-variant-numeric: tabular-nums;
  text-indent: 0.5em;
  text-align: center;
}

.field__error {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 300;
  letter-spacing: 0.02em;
  color: #8c2f2f;
}

.field__error:empty {
  display: none;
}

.field__hint {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 300;
  color: var(--ink-soft);
}

/* ------------------------------------------------------- civilizations

   FOUR BLOCKS, STACKED, LEFT-ALIGNED, EACH IN ITS OWN COLOUR - and all four
   on one screen, with no scrolling anywhere on any phone.

   The screen is exactly the viewport tall (`stage--pick`), the panel takes
   what is left after the heading, the name and the instruction, and the four
   blocks share the remainder equally. There is no introduction to read and no
   coin to draw here: what the blocks have instead is the height, so the name,
   the title, the subtitle and the power can sit at a size that is comfortable
   to read rather than a size that merely fits.

   Each block is outlined in its own civilization's colour - the same value
   its coin is drawn in on the board - which is how four entries in one list
   tell each other apart without a picture between them. */

/* THE TWO SIZES THIS SCREEN IS BUILT FROM. The label and the instruction
   sizes are the screen's own, and the four blocks are made from those two
   and no third - so what a player reads in the form and what they read in
   the blocks are the same voice at the same two steps. */
.stage--pick {
  --pick-label: clamp(9px, 1.25svh, 11.5px);
  --pick-hint: clamp(9.5px, 1.3svh, 12.5px);
  height: 100svh;
  min-height: 0;
  overflow: hidden;
  /* The welcome screen's padding is generous because there is nothing else
     on it. Here the four blocks are the screen, so the frame gives them what
     it can - the same inset the board itself uses. */
  padding: max(0.5rem, env(safe-area-inset-top)) max(0.6rem, env(safe-area-inset-right))
    max(0.5rem, env(safe-area-inset-bottom)) max(0.6rem, env(safe-area-inset-left));
}

.stage--pick .stage__body {
  padding-block: 0.1875rem;
  align-content: stretch;
}

/* A SCREEN WHOSE ONLY JOB IS ONE SHORT FORM sits in the middle of the page
   rather than at the top of it. The four-block screens need the whole height
   and fill it; the Join Game code step has no blocks and is a group of five
   things that belongs where the eye lands. `:has` is what tells the two
   apart, and where it is not understood the blocks keep the height they
   have - which is the safe direction to fail in. */
.stage--pick:not(:has(.field--civs)) .stage__body {
  align-content: center;
}

.stage--pick:not(:has(.field--civs)) .composition,
.stage--pick:not(:has(.field--civs)) .panel {
  height: auto;
}

.stage--pick .composition {
  height: 100%;
}

.stage--pick .panel {
  height: 100%;
  min-height: 0;
  gap: clamp(0.25rem, 0.55svh, 1rem);
}

/* The form's own furniture, sized against the same height the blocks are, so
   neither of them has to guess what the other one left behind. */
.stage--pick .panel__head {
  padding-bottom: clamp(0.3rem, 0.6svh, 0.85rem);
}

.stage--pick .panel__lede {
  font-size: clamp(11px, 1.5svh, 14px);
  line-height: 1.35;
}

.stage--pick .field__label {
  font-size: var(--pick-label);
}

.stage--pick .field__hint {
  font-size: var(--pick-hint);
  line-height: 1.3;
}

.stage--pick .field__input {
  min-height: clamp(32px, 5svh, 44px);
  padding: clamp(0.3rem, 0.9svh, 0.7rem) 0.9rem;
  font-size: clamp(14px, 2svh, 1.05rem);
}

/* The form's own gaps, on this screen: every pixel they keep is a pixel the
   four blocks do not get. */
.stage--pick .field {
  gap: clamp(2px, 0.35svh, 5px);
}

.stage--pick .actions {
  margin-top: clamp(2px, 0.4svh, 12px);
}

.stage--pick .stage__foot {
  padding-top: clamp(4px, 0.6svh, 12px);
}

/* The field that holds the four cards takes every pixel the form does not
   need; the cards share it between them. */
.stage--pick .field--civs {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.stage--pick .field--civs .field__label,
.stage--pick .field--civs .field__hint {
  flex: none;
}

/* One per row, always: four of these side by side would be four scraps of
   text, and this is the one choice a player makes before they play anything.
   They are a column that fills the field, so all four are on the screen at
   once and none of them can push the others off it. */
.civs {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: clamp(2px, 0.3svh, 5px);
}

.civ {
  position: relative;
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: clamp(5px, 0.9svh, 14px);
  padding: clamp(8px, 1.5svh, 20px) clamp(12px, 3.6vw, 22px);
  border: 1.5px solid var(--coin);
  border-radius: 3px;
  background: transparent;
  text-align: left;
  overflow: hidden;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: border-color 140ms var(--ease), background-color 140ms var(--ease),
    color 140ms var(--ease);
}

/* THE NAME IS THE BIGGEST THING ON THE BLOCK: this screen's larger of its
   two sizes, in capitals and in the ink, so four of them line up as four
   entries in one list. The trailing word is quieter, so the civilization's
   own name is what is read. */
.civ__name {
  font-size: var(--pick-hint);
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  line-height: 1.3;
  color: var(--ink);
}

.civ__word {
  font-weight: 300;
  color: var(--ink-soft);
}

/* Its title, immediately underneath: the screen's smaller size, in capitals
   and tracked wide, so it reads as the name's own second line rather than as
   body copy - the hierarchy comes from spacing, tracking and case, not from
   a third size or a heavier weight. */
.civ__title {
  font-size: var(--pick-label);
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  line-height: 1.4;
  color: var(--ink-soft);
}

/* What the power does: the same size as the title, in the sentence it was
   written in, with the line height a paragraph needs to be read in. */
.civ__ability {
  font-size: var(--pick-label);
  font-weight: 400;
  line-height: 1.55;
  color: var(--ink-soft);
}

.civ__tick {
  position: absolute;
  top: clamp(4px, 1svh, 12px);
  right: clamp(8px, 2vw, 16px);
  font-size: clamp(11px, 1.6svh, 15px);
  line-height: 1;
  color: var(--coin);
}

.civ:hover:not(:disabled) {
  background: color-mix(in srgb, var(--coin) 6%, transparent);
}

/* THE SELECTED STATE KEEPS THE COLOUR. The block takes the ink the form
   already uses for a chosen option, and its outline is lifted towards white
   so the civilization's own colour still reads against the dark - the two
   things a player needs to see, which one this is and that it is chosen,
   in the same border. */
.civ[aria-pressed="true"] {
  border-color: color-mix(in srgb, var(--coin) 74%, white);
  background: var(--ink);
}

.civ[aria-pressed="true"] .civ__name,
.civ[aria-pressed="true"] .civ__title {
  color: var(--paper);
}

.civ[aria-pressed="true"] .civ__word {
  color: color-mix(in srgb, var(--paper) 72%, transparent);
}

.civ[aria-pressed="true"] .civ__ability {
  color: color-mix(in srgb, var(--paper) 84%, transparent);
}

.civ[aria-pressed="true"] .civ__tick {
  color: color-mix(in srgb, var(--coin) 74%, white);
}

.civ:disabled {
  opacity: 0.32;
  cursor: not-allowed;
}

/* ------------------------------------------------------- the board screen */

/* The board is the first thing that has to fit on a phone, so its screen takes
   the whole viewport and nothing else is allowed to compete for the height.
   The safe areas are read through the same custom properties the rest of the
   mobile layout uses (falling back to env() on a device that only has those). */
.stage--board {
  padding: max(0.6rem, var(--safe-top, env(safe-area-inset-top)))
    max(0.6rem, env(safe-area-inset-right))
    max(0.6rem, var(--safe-bottom, env(safe-area-inset-bottom)))
    max(0.6rem, env(safe-area-inset-left));
}

.stage--board .stage__body {
  padding-block: 0.4rem;
  align-content: center;
}

/* ------------------------------------------------------------------ lobby

   One screen, three facts, in the order they matter: the number to share, the
   two people at the table, and what is being waited for. Everything is built
   on the same 4px rhythm as the rest of the site, and nothing here is a card
   inside a card. */

.lobby__share {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.lobby__code-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

/* Four digits, four tiles. A single string with tracking is read as a word;
   separate tiles are read as a number to type, which is what it is. */
.lobby__code {
  display: flex;
  gap: 0.5rem;
}

.lobby__digit {
  display: grid;
  place-items: center;
  width: clamp(2.75rem, 15vw, 3.5rem);
  height: clamp(3.25rem, 18vw, 4rem);
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--paper);
  font-size: clamp(1.6rem, 8vw, 2rem);
  font-weight: 300;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  color: var(--ink);
}

.lobby__digit--empty {
  color: var(--ink-soft);
}

.lobby__copy {
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 2px;
  padding-inline: 0.9rem;
}

.lobby__players {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.seats {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* A seat is a row, not a card: a rule above each one and the colour at the
   left, the way a scoreboard lists two players. */
.seat {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 2px;
  transition: background-color 160ms var(--ease), border-color 160ms var(--ease);
}

.seat--mine {
  border-color: var(--ink);
}

.seat--open {
  border-style: dashed;
}

.seat__coin {
  flex: none;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  border: 1px solid rgb(0 0 0 / 0.12);
  background: var(--coin, var(--line));
}

.seat__coin--empty {
  background: transparent;
  border: 1px dashed var(--line);
}

.seat__who {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.seat__name {
  font-size: 1.02rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.seat__you {
  margin-left: 0.45rem;
  font-size: 0.68rem;
  font-weight: 300;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.seat__civ {
  font-size: 0.78rem;
  font-weight: 300;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.seat__state {
  margin-left: auto;
  flex: none;
  font-size: 0.68rem;
  font-weight: 400;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.seat__state--ready {
  color: var(--ink);
}

/* The word READY gets a dot of its own, so a glance down the list answers the
   question without reading either row. */
.seat__state--ready::before {
  content: "";
  display: inline-block;
  width: 0.4rem;
  height: 0.4rem;
  margin-right: 0.4rem;
  border-radius: 50%;
  background: currentColor;
  vertical-align: 0.08em;
}

.linkbox {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

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

.linkbox .btn {
  flex: 0 0 auto;
}

/* An invite URL is long by nature and the field shows its tail, not its head.
   On a phone the only useful move is to copy it, so the button gets its own
   line and full width rather than leaving a stub of URL and a cramped label. */
@media (max-width: 30rem) {
  .linkbox {
    flex-direction: column;
    align-items: stretch;
  }
  .linkbox input {
    width: 100%;
  }
  .linkbox .btn {
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 2px;
    text-decoration: none;
  }
}

.statusline {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.95rem;
  font-weight: 300;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
}

.pulse {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--ink);
  flex: none;
}

.pulse--wait {
  animation: breathe 1.9s var(--ease) infinite;
}

@keyframes breathe {
  0%, 100% { opacity: 0.25; }
  50% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ------------------------------------------------------------- foot / note */

.foot {
  font-size: 0.75rem;
  font-weight: 300;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-align: center;
}

/* ------------------------------------------------------------- responsive

   The reference is a phone screen, so the phone is the base case. Two things
   change and nothing else: the type floor (so controls never get illegibly
   small on a very narrow handset) and the action row, which stacks only when
   two buttons genuinely will not fit without cramping their labels. */

@media (max-width: 22rem) {
  :root {
    --mark: 86vw;
  }
  .btn {
    font-size: max(calc(var(--mark) * 0.0455), 0.95rem);
  }
  .tagline {
    font-size: max(calc(var(--mark) * 0.0365), 0.8rem);
  }
}

/* Below this the two buttons side by side start crushing their own labels. */
@media (max-width: 19.5rem) {
  .actions {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }
  .actions .btn {
    flex: 1 1 auto;
  }
}

@media (min-width: 48rem) {
  :root {
    --mark: min(52vw, 40rem);
  }
  .panel {
    max-width: 34rem;
  }
}
