/*
 * Longhouse, for the web.
 *
 * A direct port of ui/theme/Color.kt, Sticker.kt, Type.kt, Theme.kt and
 * ui/common/FrenControls.kt. Every number here came from one of those files —
 * when the app changes a radius or a stroke, this changes with it.
 *
 * The one substitution that carries the whole look: Material elevation is 0
 * everywhere and replaced by a PLATE, a solid zero-blur copy of a surface drawn
 * down and to the right. In Compose that is Modifier.plate(); here it is a
 * box-shadow whose blur radius is 0. If a blur ever creeps into one of these
 * shadows the app stops reading as printed stickers and starts reading as
 * Material with brand colours dropped in.
 *
 * 1dp = 1px and 1sp = 1px. Android's mdpi baseline and the CSS reference pixel
 * are the same size, so the scale transfers without a conversion factor.
 */

/* ------------------------------------------------------------------ type -- */

@font-face {
  font-family: "Baloo 2";
  src: url("fonts/baloo2_bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "Baloo 2";
  src: url("fonts/baloo2_extrabold.woff2") format("woff2");
  font-weight: 800;
  font-display: swap;
}
@font-face {
  font-family: "Nunito";
  src: url("fonts/nunito_regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Nunito";
  src: url("fonts/nunito_bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "Nunito";
  src: url("fonts/nunito_extrabold.woff2") format("woff2");
  font-weight: 800;
  font-display: swap;
}

/* --------------------------------------------------------------- palette -- */

:root {
  /* Parchment: the warm ground. */
  --parchment: #f6f2ea;
  --parchment-low: #fbf8f2;
  --parchment-high: #ede7db;
  --parchment-deep: #e3e1da;

  /* Straight from the mark. */
  --iron: #2e3940;
  --gold: #e8b84b;
  --gold-ink: #6b531b;
  --horn-cream: #f7edd6;
  --cream-pale: #fff6df;
  --steel: #b7c1c9;

  /* Norse blue. */
  --blue: #2e5c8a;
  --blue-dark: #1e3f61;
  --blue-light: #9cc2e8;
  --blue-container: #d4e3f2;

  --green: #3f7a6b;
  --brick: #b5442f;

  /* Material roles, all set explicitly — see Theme.kt on why none may default. */
  --primary: var(--blue);
  --on-primary: #ffffff;
  --primary-container: var(--blue-container);
  --on-primary-container: #14304c;

  /* Gold is a FILL under iron ink, never ink on a light surface: 1.84:1. */
  --secondary: var(--gold);
  --on-secondary: var(--iron);
  --secondary-container: #fbebc4;
  --on-secondary-container: #4a3a0b;

  --tertiary: var(--green);
  --on-tertiary: #ffffff;
  --tertiary-container: #cfe8df;
  --on-tertiary-container: #16352d;

  --error: var(--brick);
  --on-error: #ffffff;
  --error-container: #f9dcd4;
  --on-error-container: #5a1a0e;

  --background: var(--parchment);
  --on-background: #22282c;
  --surface: var(--parchment);
  --on-surface: #22282c;

  /* Cards sit on white so the parchment page reads as the ground beneath. */
  --surface-lowest: #ffffff;
  --surface-low: var(--parchment-low);
  --surface-container: #f1ece2;
  --surface-high: var(--parchment-high);
  --surface-highest: var(--parchment-deep);
  --surface-variant: var(--parchment-deep);
  --on-surface-variant: #4c4f52;
  --surface-dim: #e6e0d4;

  --outline: var(--iron);
  --outline-variant: #948b76;

  --inverse-surface: var(--iron);
  --inverse-on-surface: var(--parchment);
  --scrim: rgba(46, 57, 64, 0.55);

  /* Field fills, from FrenField's own recipe rather than a surface role. */
  --field-fill: #ffffff;
  --field-fill-on-card: #fbf8f2;
  --hint: #6e7276;

  /* The plate: translucent iron by day, solid black by night. */
  --plate: rgba(46, 57, 64, 0.22);

  /* Nav band inks (BandSlot). */
  --band-icon: #5a646c;
  --band-label: #5a646c;
  --band-label-selected: #22282c;

  /* Feed card fills. The hosting card and the invited card each name their own
     because they are told apart by fill as well as by band, rivets and badge —
     role is never carried by one signal alone. */
  --hosting-fill: #ffffff;
  --invited-fill: var(--cream-pale);
  --invited-band: var(--horn-cream);
  /* Night's "highest" step is too bright behind muted ink; this is the well
     colour the 4.99:1 pair was measured on. */
  --quiet-tile: var(--parchment-deep);

  /* Shapes. Generous throughout — the helmet has no sharp corners. */
  --r-xs: 8px;
  --r-sm: 14px;
  --r-md: 20px;
  --r-lg: 28px;
  --r-xl: 36px;

  /* Plate offsets (Sticker.kt). */
  --plate-surface: 0px 4px;
  --plate-control-x: 2px;
  --plate-control-y: 4px;

  --band-height: 68px;
  --band-margin: 12px;

  color-scheme: light;
}

/* Night surfaces. Applied by preference, and again by explicit choice so the
   profile's Light/Dark/System setting wins in both directions. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --primary: #9cc2e8;
    --on-primary: #0a2136;
    --primary-container: #2a5480;
    --on-primary-container: #cfe1f5;

    --secondary: #f0c86a;
    --on-secondary: var(--iron);
    --secondary-container: #5c4610;
    --on-secondary-container: #fbe3ae;

    --tertiary: #7fcfb8;
    --on-tertiary: #06382c;
    --tertiary-container: #1a4237;
    --on-tertiary-container: #b6eddd;

    --error: #ff9b87;
    --on-error: #4a1207;
    --error-container: #7a2a1b;
    --on-error-container: #ffd9cf;

    --background: #1e2a35;
    --on-background: #e8e3d8;
    --surface: #1e2a35;
    --on-surface: #e8e3d8;

    --surface-lowest: #182430;
    --surface-low: #24313c;
    --surface-container: #2b3946;
    --surface-high: #354553;
    --surface-highest: #3d4e5d;
    --surface-variant: #354553;
    --on-surface-variant: #aebac4;
    --surface-dim: #161f28;

    /* Lighter than the light theme's iron: a near-black stroke on a dark card
       is invisible, and #6e7d88 measures only 2.79:1 here. */
    --outline: #7a8994;
    --outline-variant: #5e6d7a;

    --inverse-surface: #e8e3d8;
    --inverse-on-surface: #22282c;
    --scrim: rgba(0, 0, 0, 0.6);

    --field-fill: #22303c;
    --field-fill-on-card: #22303c;
    --hint: #9daab5;

    --plate: #000000;

    --band-icon: #9daab5;
    --band-label: #9daab5;
    --band-label-selected: #e8e3d8;

    --hosting-fill: #2b3946;
    /* NightInvited: the invited card is cream by day and brown by night. */
    --invited-fill: #382f1e;
    --invited-band: #4a3f28;
    --quiet-tile: #354553;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --primary: #9cc2e8;
  --on-primary: #0a2136;
  --primary-container: #2a5480;
  --on-primary-container: #cfe1f5;

  --secondary: #f0c86a;
  --on-secondary: var(--iron);
  --secondary-container: #5c4610;
  --on-secondary-container: #fbe3ae;

  --tertiary: #7fcfb8;
  --on-tertiary: #06382c;
  --tertiary-container: #1a4237;
  --on-tertiary-container: #b6eddd;

  --error: #ff9b87;
  --on-error: #4a1207;
  --error-container: #7a2a1b;
  --on-error-container: #ffd9cf;

  --background: #1e2a35;
  --on-background: #e8e3d8;
  --surface: #1e2a35;
  --on-surface: #e8e3d8;

  --surface-lowest: #182430;
  --surface-low: #24313c;
  --surface-container: #2b3946;
  --surface-high: #354553;
  --surface-highest: #3d4e5d;
  --surface-variant: #354553;
  --on-surface-variant: #aebac4;
  --surface-dim: #161f28;

  --outline: #7a8994;
  --outline-variant: #5e6d7a;

  --inverse-surface: #e8e3d8;
  --inverse-on-surface: #22282c;
  --scrim: rgba(0, 0, 0, 0.6);

  --field-fill: #22303c;
  --field-fill-on-card: #22303c;
  --hint: #9daab5;

  --plate: #000000;

  --band-icon: #9daab5;
  --band-label: #9daab5;
  --band-label-selected: #e8e3d8;

  --hosting-fill: #2b3946;
  /* NightInvited: the invited card is cream by day and brown by night. */
  --invited-fill: #382f1e;
  --invited-band: #4a3f28;
  --quiet-tile: #354553;
}

/* ------------------------------------------------------------------ base -- */

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

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--background);
  color: var(--on-surface);
  font-family: "Nunito", system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 24px;
  letter-spacing: 0.15px;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
}

button {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

/* Weight lives in the scale, not at call sites: neither family ships a 600, so
   an inline semibold synthesises a smeared fake. */
.t-display {
  font-family: "Baloo 2", cursive;
  font-weight: 800;
  font-size: 34px;
  line-height: 40px;
  letter-spacing: -0.5px;
}
.t-headline {
  font-family: "Baloo 2", cursive;
  font-weight: 800;
  font-size: 28px;
  line-height: 34px;
  letter-spacing: -0.25px;
}
.t-headline-sm {
  font-family: "Baloo 2", cursive;
  font-weight: 800;
  font-size: 22px;
  line-height: 28px;
  letter-spacing: -0.25px;
}
.t-title-lg {
  font-family: "Baloo 2", cursive;
  font-weight: 800;
  font-size: 22px;
  line-height: 28px;
}
.t-title-md {
  font-family: "Baloo 2", cursive;
  font-weight: 700;
  font-size: 18px;
  line-height: 24px;
}
.t-title-sm {
  font-weight: 800;
  font-size: 15px;
  line-height: 20px;
  letter-spacing: 0.1px;
}
.t-body-lg {
  font-size: 16px;
  line-height: 24px;
  letter-spacing: 0.15px;
}
.t-body {
  font-size: 15px;
  line-height: 22px;
  letter-spacing: 0.15px;
}
.t-body-sm {
  font-size: 14px;
  line-height: 20px;
  letter-spacing: 0.2px;
}
.t-label-lg {
  font-weight: 800;
  font-size: 15px;
  line-height: 20px;
  letter-spacing: 0.4px;
}
.t-label {
  font-weight: 700;
  font-size: 14px;
  line-height: 18px;
  letter-spacing: 0.4px;
}
.t-label-sm {
  font-weight: 800;
  font-size: 13px;
  line-height: 16px;
  letter-spacing: 0.6px;
}

.muted {
  color: var(--on-surface-variant);
}
.danger {
  color: var(--error);
}
.center {
  text-align: center;
}
.hidden {
  display: none !important;
}

/* ----------------------------------------------------------- the plate ---- */

/* Shadow only, never fill or border: drawing both here and on the component was
   the single easiest way to get two mismatched borders. */
.plate {
  box-shadow: 0 4px 0 0 var(--plate);
}
.plate-control {
  box-shadow: 2px 4px 0 0 var(--plate);
}

/* Press physics: the control shrinks and its plate collapses underneath, so it
   looks pushed into the page. */
.pressable {
  transition:
    transform 70ms linear,
    box-shadow 70ms linear;
}
.pressable:active {
  transform: scale(0.955);
  box-shadow: 0 1px 0 0 var(--plate);
}
.pressable-card {
  cursor: pointer;
}
.pressable-card:active {
  transform: scale(0.98);
  box-shadow: 0 1px 0 0 var(--plate);
}

@media (prefers-reduced-motion: reduce) {
  .pressable,
  .pressable-card {
    transition: none;
  }
  .pressable:active,
  .pressable-card:active {
    transform: none;
  }
}

/* Focus is a ring the kit owns, since every control here draws its own border. */
:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

/* --------------------------------------------------------------- header --- */

/* Deliberately not a top app bar: an M3 bar tints its container on scroll,
   which breaks the flat-paper illusion. */
.fren-header {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 14px 12px 10px 20px;
  padding-top: calc(14px + env(safe-area-inset-top));
}
.fren-header > h1 {
  flex: 1;
  min-width: 0;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.fren-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 14px 24px;
  border-radius: 999px;
  border: 2px solid var(--outline);
  background: var(--primary);
  color: var(--on-primary);
  text-align: center;
  box-shadow: 2px 4px 0 0 var(--plate);
  font-weight: 800;
  font-size: 15px;
  line-height: 20px;
  letter-spacing: 0.4px;
}
.fren-btn:disabled {
  opacity: 0.45;
  box-shadow: none;
  cursor: default;
}

/* Secondary actions sit ON the page rather than stuck to it, so no plate. */
.fren-btn-outlined {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 14px 24px;
  border-radius: 999px;
  border: 2px solid var(--outline);
  background: transparent;
  color: var(--on-surface);
  box-shadow: none;
  font-weight: 800;
  font-size: 15px;
  line-height: 20px;
  letter-spacing: 0.4px;
}
.fren-btn-outlined:disabled {
  opacity: 0.5;
  cursor: default;
}
.fren-btn-danger {
  border-color: var(--error);
  color: var(--error);
}

.fren-btn-text {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px;
  border-radius: 999px;
  color: var(--primary);
  font-weight: 800;
  font-size: 15px;
  line-height: 20px;
  letter-spacing: 0.4px;
}
.fren-btn-text:disabled {
  opacity: 0.5;
  cursor: default;
}

.fren-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  border-radius: 999px;
  color: var(--on-surface);
}
.fren-icon-btn svg {
  width: 24px;
  height: 24px;
}
.fren-icon-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.btn-row > * {
  flex: 1 1 auto;
}
.btn-block {
  display: flex;
  width: 100%;
}

/* ----------------------------------------------------------------- chip --- */

/* Selection is carried by inversion, not a checkmark: the selected chip fills
   with blue and its plate collapses, so it presses INTO the paper. */
.fren-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 2px solid var(--outline-variant);
  background: var(--surface-lowest);
  color: var(--on-surface);
  box-shadow: 2px 4px 0 0 var(--plate);
  font-weight: 700;
  font-size: 14px;
  line-height: 18px;
  letter-spacing: 0.4px;
  white-space: nowrap;
}
.fren-chip[aria-selected="true"],
.fren-chip[aria-checked="true"] {
  background: var(--primary);
  border-color: var(--outline);
  color: var(--on-primary);
  box-shadow: none;
  transform: none;
}
.fren-chip svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
}
.fren-chip .chip-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: var(--secondary);
  color: var(--on-secondary);
  font-size: 12px;
}

.chip-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 16px 8px;
  margin: 0 -16px;
  scrollbar-width: none;
}
.chip-row::-webkit-scrollbar {
  display: none;
}
.chip-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ---------------------------------------------------------------- field --- */

/* The label sits ABOVE the field rather than floating into a notch in the
   border. The notch is the loudest Material tell there is. */
.fren-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.fren-field > label {
  color: var(--on-surface-variant);
  font-weight: 700;
  font-size: 14px;
  line-height: 18px;
  letter-spacing: 0.4px;
}
.fren-field input,
.fren-field textarea {
  width: 100%;
  min-height: 56px;
  padding: 14px 16px;
  border-radius: var(--r-md);
  border: 2px solid var(--outline-variant);
  background: var(--field-fill);
  font-size: 16px;
  line-height: 24px;
  letter-spacing: 0.15px;
  resize: vertical;
}
.fren-field textarea {
  min-height: 92px;
}
.fren-field input::placeholder,
.fren-field textarea::placeholder {
  color: var(--hint);
}
.fren-field input:focus,
.fren-field textarea:focus {
  outline: none;
  border-width: 2.5px;
  border-color: var(--primary);
}
.fren-field.on-card input,
.fren-field.on-card textarea {
  background: var(--field-fill-on-card);
}
.fren-field.invalid input,
.fren-field.invalid textarea {
  border-color: var(--error);
}
.fren-field .support {
  color: var(--on-surface-variant);
  font-size: 14px;
  line-height: 20px;
  letter-spacing: 0.2px;
}
.fren-field .support.err {
  color: var(--error);
}

/* A search well: the field recipe minus the label — a search bar explains
   itself with its glyph and placeholder. */
.fren-search {
  display: flex;
  align-items: center;
  min-height: 56px;
  padding-left: 16px;
  padding-right: 4px;
  border-radius: var(--r-md);
  border: 2px solid var(--outline-variant);
  background: var(--field-fill);
}
.fren-search:focus-within {
  border-width: 2.5px;
  border-color: var(--primary);
}
.fren-search > svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  color: var(--hint);
}
.fren-search input {
  flex: 1;
  min-width: 0;
  border: none;
  background: none;
  outline: none;
  padding: 14px 0 14px 10px;
  font-size: 16px;
  line-height: 24px;
}

/* --------------------------------------------------------------- switch --- */

/* Hand-rolled: an M3 switch thumb is the most recognisable Material object
   there is. */
.fren-switch {
  position: relative;
  width: 56px;
  height: 32px;
  flex: 0 0 auto;
  border-radius: 999px;
  border: 2px solid var(--outline);
  background: var(--surface-highest);
  transition: background 140ms ease;
}
.fren-switch[aria-checked="true"] {
  background: var(--secondary);
}
.fren-switch::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 2px;
  width: 24px;
  height: 24px;
  margin-top: -12px;
  border-radius: 999px;
  border: 2px solid var(--outline);
  background: #ffffff;
  transition: transform 180ms cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.fren-switch[aria-checked="true"]::after {
  transform: translateX(24px);
}
@media (prefers-reduced-motion: reduce) {
  .fren-switch::after {
    transition: none;
  }
}

/* ------------------------------------------------------------ segmented --- */

.fren-segmented {
  display: flex;
  gap: 4px;
}
.fren-segmented > button {
  flex: 1;
  min-height: 48px;
  padding: 12px 6px;
  border-radius: var(--r-sm);
  border: 2px solid var(--outline);
  background: transparent;
  color: var(--on-surface);
  font-weight: 700;
  font-size: 14px;
  line-height: 18px;
  letter-spacing: 0.4px;
}
.fren-segmented > button[aria-checked="true"] {
  background: var(--secondary);
  color: var(--on-secondary);
  box-shadow: 2px 3px 0 0 var(--plate);
}

/* ----------------------------------------------------------------- rule --- */

.fren-rule {
  height: 2px;
  border: none;
  margin: 0;
  border-radius: 1px;
  background: var(--outline-variant);
}

/* ----------------------------------------------------------------- card --- */

/* A sticker surface. Never nest one inside something that clips — a clipping
   parent eats the plate silently, which is the web twin of wrapping a plated
   surface in Compose's Card. */
.sticker {
  position: relative;
  border-radius: var(--r-lg);
  border: 2.5px solid var(--outline);
  background: var(--surface-lowest);
  box-shadow: 0 4px 0 0 var(--plate);
  /* Clips the card band to the rounded corner. Safe for the plate: an
     element's own box-shadow is painted outside its border box and is not
     affected by its own overflow — only descendants are. Putting a *parent*
     around a plated surface that clips is what eats the plate. */
  overflow: hidden;
}
.sticker-body {
  padding: 16px;
}
button.sticker {
  display: block;
  width: 100%;
  text-align: left;
  color: inherit;
}

.stack {
  display: flex;
  flex-direction: column;
  /* Wider than the plate's 4px, or the next card's edge would sit on it. */
  gap: 14px;
}
.row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.row-top {
  align-items: flex-start;
}
.grow {
  flex: 1;
  min-width: 0;
}
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --------------------------------------------------------------- dialog --- */

.fren-scrim {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--scrim);
  animation: fade-in 140ms ease;
}
.fren-dialog {
  width: 100%;
  max-width: 380px;
  max-height: calc(100vh - 60px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 24px;
  border-radius: 32px;
  border: 2.5px solid var(--outline);
  background: var(--surface-lowest);
  box-shadow: 0 4px 0 0 var(--plate);
}
.fren-dialog .dialog-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
}
@keyframes fade-in {
  from {
    opacity: 0;
  }
}

/* ------------------------------------------------------------- snackbar --- */

.fren-snack {
  position: fixed;
  left: 50%;
  bottom: calc(var(--band-height) + var(--band-margin) * 2 + 12px + env(safe-area-inset-bottom));
  z-index: 70;
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  padding: 14px 18px;
  border-radius: var(--r-md);
  border: 2.5px solid var(--outline);
  background: var(--inverse-surface);
  color: var(--inverse-on-surface);
  box-shadow: 0 4px 0 0 var(--plate);
  animation: snack-in 200ms cubic-bezier(0.2, 0.9, 0.3, 1.1);
}
@keyframes snack-in {
  from {
    opacity: 0;
    transform: translate(-50%, 12px);
  }
}

/* --------------------------------------------------------------- mascot --- */

.helmet-spin {
  height: 40px;
  transform-origin: 50% 90%;
  animation: rock 1080ms ease-in-out infinite alternate;
}
@keyframes rock {
  from {
    transform: rotate(-9deg);
  }
  to {
    transform: rotate(9deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  .helmet-spin {
    animation: none;
  }
}

.mascot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 24px 32px;
  text-align: center;
}
.mascot > svg:first-child {
  height: 96px;
  width: 96px;
}

/* --------------------------------------------------------------- avatar --- */

.avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 2px solid var(--outline);
  overflow: hidden;
  font-family: "Baloo 2", cursive;
  font-weight: 800;
  font-size: 17px;
  line-height: 1;
  user-select: none;
}
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.avatar-lg {
  width: 96px;
  height: 96px;
  font-size: 36px;
  border-width: 2.5px;
}
.avatar-sm {
  width: 34px;
  height: 34px;
  font-size: 14px;
}

/* ----------------------------------------------------------------- band --- */

/* The floating navigation band — the helmet's gold rivet-band, shrunk to 32px.
   It floats OVER content: screens reserve clearance with .band-inset, and there
   is no bottom-bar layout slot anywhere. */
.helmet-band {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 40;
  width: 100%;
  max-width: var(--app-width);
  transform: translateX(-50%);
  padding: 12px 16px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
  pointer-events: none;
}
.helmet-band > .band-bar {
  position: relative;
  display: flex;
  min-height: var(--band-height);
  border-radius: 999px;
  border: 2.5px solid var(--outline);
  background: var(--surface-lowest);
  box-shadow: 0 4px 0 0 var(--plate);
  pointer-events: auto;
}
/* One gold pill TRAVELS between slots rather than each tab owning an indicator:
   a travelling pill of fixed size can never overflow the bar. */
.band-pill {
  position: absolute;
  top: 0;
  left: 0;
  width: 44px;
  height: 32px;
  border-radius: 16px;
  border: 2px solid var(--iron);
  /* Identical in light and dark. One element that refuses to invert is what
     makes the bar read as a physical object rather than a widget. */
  background: var(--gold);
  box-shadow: 2px 4px 0 0 var(--plate);
  transition: transform 380ms cubic-bezier(0.2, 0.9, 0.3, 1.15);
}
.band-slot {
  position: relative;
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: var(--band-height);
  color: var(--band-label);
  font-weight: 800;
  font-size: 13px;
  line-height: 16px;
  letter-spacing: 0.6px;
}
.band-slot svg {
  width: 24px;
  height: 24px;
  color: var(--band-icon);
  transition: transform 260ms cubic-bezier(0.2, 0.9, 0.3, 1.3);
}
.band-slot[aria-selected="true"] {
  color: var(--band-label-selected);
}
.band-slot[aria-selected="true"] svg {
  color: var(--iron);
  transform: scale(1.12);
}
@media (prefers-reduced-motion: reduce) {
  .band-pill,
  .band-slot svg {
    transition: none;
  }
}

/* Clearance so a scrolling screen's last row is not hidden behind the band. */
.band-inset {
  height: calc(var(--band-height) + var(--band-margin) + 16px + env(safe-area-inset-bottom));
}

/* ------------------------------------------------------------------ fab --- */

.fren-fab {
  position: fixed;
  right: 50%;
  bottom: calc(var(--band-height) + var(--band-margin) * 2 + 8px + env(safe-area-inset-bottom));
  z-index: 45;
  /* Pinned to the right edge of the app column, not the viewport. */
  margin-right: calc(var(--app-width) / -2 + 20px);
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 16px 22px;
  border-radius: 999px;
  border: 2.5px solid var(--outline);
  background: var(--secondary);
  color: var(--on-secondary);
  box-shadow: 2px 4px 0 0 var(--plate);
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.4px;
}
.fren-fab svg {
  width: 22px;
  height: 22px;
}

/* ----------------------------------------------------------------- app ---- */

:root {
  /* The app is a phone design. On a desktop it renders as one centred column
     on the parchment ground rather than a second, invented layout. */
  --app-width: 460px;
}

#app {
  position: relative;
  width: 100%;
  max-width: var(--app-width);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--background);
}

@media (min-width: 560px) {
  body {
    background: var(--surface-dim);
  }
  #app {
    border-left: 2px solid var(--outline-variant);
    border-right: 2px solid var(--outline-variant);
  }
}

.screen {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}
.screen-body {
  flex: 1;
  padding: 4px 16px 0;
}

.section-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 18px 2px 8px;
}
.section-head > span {
  flex: 1;
}

/* Rows inside a card, separated by rules rather than by shadow. */
.list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  min-height: 60px;
  text-align: left;
  color: inherit;
  background: none;
  border: none;
}
.list-row + .list-row {
  border-top: 2px solid var(--outline-variant);
}
.list-row svg {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
}

/* A single-line banner used for counts and explanations under a filter row. */
.showing-line {
  padding: 2px 2px 10px;
  color: var(--on-surface-variant);
  font-size: 14px;
  line-height: 20px;
  letter-spacing: 0.2px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 2px solid var(--outline);
  background: var(--surface-high);
  font-weight: 700;
  font-size: 13px;
  line-height: 18px;
  letter-spacing: 0.3px;
  white-space: nowrap;
}
.pill svg {
  width: 13px;
  height: 13px;
}
.pill-gold {
  background: var(--secondary);
  color: var(--on-secondary);
}
.pill-blue {
  background: var(--primary-container);
  color: var(--on-primary-container);
}
.pill-green {
  background: var(--tertiary-container);
  color: var(--on-tertiary-container);
}
.pill-error {
  background: var(--error-container);
  color: var(--on-error-container);
}
