/*
 * Farm to Table page, HUD and dialog styles. Brand colors come from the
 * shared FarmFinder summer palette (assets/brand/summer-palette.css).
 *
 * The HUD is printed matter, drawn the way the cards are: sheets of paper
 * held on clipboards, ink outlines, and buttons you can press.
 */
:root {
  --ftt-ink: #161616;
  --ftt-olive: var(--brand-olive, #4c602c);
  --ftt-lime: var(--brand-lime, #c5d733);
  --ftt-cream: var(--brand-cream, #faf7e9);
  --ftt-paper: #fdf8e7;
  --ftt-paper-warm: #f3e8cc;
  --ftt-board: linear-gradient(180deg, #d3b077, #bd9457);
  --ftt-panel: #fdf8e7;
  --ftt-panel-strong: #fffdf3;
  --ftt-line: #161616;
  --ftt-rule: rgba(22, 22, 22, 0.22);
  --ftt-text: #1d1b16;
  --ftt-muted: #5f5947;
  --ftt-debt: #a3381f;
  --ftt-profit: #3d6b25;
  --ftt-good: #2f6b1f;
  --ftt-bad: #9a3a26;
  --ftt-shadow: 0 0.7rem 1.6rem rgba(38, 27, 12, 0.38);
  --ftt-radius: 14px;
  --ftt-font: "Source Sans 3", "Helvetica Neue", Arial, sans-serif;
  --ftt-serif: Domine, Georgia, serif;
  --ftt-side: min(20rem, 26vw);
}

* {
  box-sizing: border-box;
}

html,
body.ftt-body {
  height: 100%;
  margin: 0;
}

body.ftt-body {
  overflow: hidden;
  background: radial-gradient(circle at 50% 30%, #3b5130, #1d2717 70%);
  color: var(--ftt-text);
  font-family: var(--ftt-font);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

/* The deck gallery scrolls as a printed catalog on paper. */
body.ftt-body--scroll {
  overflow: auto;
  background: var(--ftt-paper-warm);
  color: var(--ftt-text);
}

button,
input,
select {
  font: inherit;
}

.ftt-app {
  position: fixed;
  inset: 0;
  overflow: hidden;
  /* A game, not a page: pressing and dragging never selects its words. */
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.ftt-app img {
  -webkit-user-drag: none;
}

.ftt-app[hidden] {
  display: none;
}

/* FarmFinder copy never leaves one word alone on its last line. */
.ftt-app,
.ftt-gallery {
  text-wrap: pretty;
}

:is(.ftt-app, .ftt-gallery) :is(h1, h2, h3) {
  text-wrap: balance;
}

.ftt-stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  outline: none;
  cursor: grab;
}

.ftt-stage[hidden] {
  display: none;
}

/* Splash */
.ftt-splash {
  position: absolute;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #2d3824;
  transition: opacity 0.8s ease, visibility 0.8s ease;
}

.ftt-app.is-live .ftt-splash {
  background: transparent;
}

/* The game's own bar and dock wait until the loading screen has gone. */
.ftt-app:not([data-state="ready"]) .ftt-hud {
  visibility: hidden;
}

.ftt-app.is-live .ftt-splash__shot {
  opacity: 0;
  transition: opacity 0.7s ease;
}

.ftt-app[data-state="ready"] .ftt-splash {
  opacity: 0;
  visibility: hidden;
  /* Long enough to see the bar reach the end. */
  transition-delay: 0.45s;
}

/*
 * The loading screen: the farm itself, a still frame rendered by the game,
 * under the game's name, a loading bar with a bean riding it, and a tip.
 * When the engine is ready the screen fades to the live island behind it.
 */
.ftt-splash__shot {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.04);
  animation: ftt-splash-drift 26s ease-in-out infinite alternate;
}

@keyframes ftt-splash-drift {
  to { transform: scale(1.12) translate(-1.5%, -1%); }
}

.ftt-splash::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    radial-gradient(ellipse at 50% 45%, rgba(12, 18, 9, 0.12), rgba(12, 18, 9, 0.6) 80%),
    linear-gradient(180deg, rgba(12, 18, 9, 0.35), transparent 30%, transparent 62%, rgba(12, 18, 9, 0.55));
}

.ftt-splash__inner {
  position: relative;
  z-index: 2;
  display: grid;
  justify-items: center;
  gap: 0.55rem;
  margin-bottom: 16vh;
  padding: 1rem;
  text-align: center;
}

.ftt-splash-logo {
  width: 112px;
  height: auto;
  filter: drop-shadow(0 3px 0 var(--ftt-ink));
}

.ftt-splash-lede {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 800;
  color: #fffdf3;
  -webkit-text-stroke: 0.1em var(--ftt-ink);
  paint-order: stroke fill;
  text-shadow: 0 2px 0 var(--ftt-ink);
}

.ftt-loadbar {
  --progress: 0.06;
  position: relative;
  width: min(24rem, 78vw);
  height: 1.4rem;
  margin: 1.1rem 0 0.2rem;
  border: 3px solid var(--ftt-ink);
  border-radius: 6px;
  background: #fffdf3;
  box-shadow: 0 3px 0 var(--ftt-ink);
}

.ftt-loadbar__fill {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: calc(var(--progress) * 100%);
  border-radius: 3px 0 0 3px;
  background: repeating-linear-gradient(-45deg, #c5d733 0 10px, #aebf28 10px 20px);
  background-size: 28px 28px;
  animation: ftt-stripes 0.9s linear infinite;
  transition: width 0.8s cubic-bezier(0.3, 1, 0.4, 1);
}

@keyframes ftt-stripes {
  to { background-position: 28px 0; }
}

.ftt-loadbar__bean {
  position: absolute;
  top: 50%;
  left: calc(var(--progress) * 100%);
  width: 2.3rem;
  height: 2.3rem;
  transform: translate(-50%, -58%);
  transition: left 0.8s cubic-bezier(0.3, 1, 0.4, 1);
  animation: ftt-bean-hop 0.55s ease-in-out infinite alternate;
}

@keyframes ftt-bean-hop {
  to { transform: translate(-50%, -78%) rotate(-12deg); }
}

.ftt-splash-status {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  color: #fffdf3;
  -webkit-text-stroke: 0.1em var(--ftt-ink);
  paint-order: stroke fill;
  text-shadow: 0 2px 0 var(--ftt-ink);
}

.ftt-splash-tip {
  max-width: min(30rem, 88vw);
  margin: 0.4rem 0 0;
  padding: 0.4rem 0.75rem;
  border: 2px solid var(--ftt-ink);
  border-radius: 8px;
  background: rgba(255, 253, 243, 0.88);
  color: var(--ftt-ink);
  font-size: 0.95rem;
  font-weight: 700;
}

.ftt-splash-tip[hidden] {
  display: none;
}

.ftt-splash__engine {
  position: absolute;
  z-index: 2;
  left: 0;
  right: 0;
  bottom: max(1rem, env(safe-area-inset-bottom));
  margin: 0;
  color: #fffdf3;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-align: center;
  text-transform: uppercase;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
}

/* HUD frame */
.ftt-hud {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}

.ftt-hud > * {
  pointer-events: auto;
}

.ftt-hud .ftt-popups {
  pointer-events: none;
}

/* Icons (icons.js) size with the text around them unless told otherwise. */
.ftt-icon {
  display: inline-block;
  flex: none;
  width: var(--icon-size, 1.5em);
  height: var(--icon-size, 1.5em);
  line-height: 0;
  vertical-align: middle;
}

.ftt-icon svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* An icon beside its number: how prices and costs are shown. */
.ftt-amount {
  display: inline-flex;
  align-items: center;
  gap: 0.2em;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/*
 * Figures set straight over the farm, with no plate behind them, are drawn
 * the way a game draws them: cream with an ink outline and a drop.
 */
.ftt-tag__cost,
.ftt-popup,
.ftt-ticker {
  color: #fffdf3;
  -webkit-text-stroke: 0.22em var(--ftt-ink);
  paint-order: stroke fill;
  text-shadow: 0 0.12em 0 var(--ftt-ink);
}

.ftt-top {
  position: absolute;
  top: max(0.6rem, env(safe-area-inset-top));
  left: 0.75rem;
  right: 0.75rem;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: start;
  pointer-events: none;
}

.ftt-top > * {
  pointer-events: auto;
}

.ftt-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

/* The logo is the menu button: the barn sits right on the paper. */
.ftt-brand__menu {
  flex: none;
  display: grid;
  place-items: center;
  padding: 0.4rem 0.6rem;
  border: 3px solid var(--ftt-line);
  border-radius: 12px;
  background: var(--ftt-paper);
  color: var(--ftt-text);
  cursor: pointer;
  box-shadow: 0 3px 0 var(--ftt-ink), var(--ftt-shadow);
}

.ftt-brand__logo {
  display: block;
  width: 54px;
  height: auto;
}

.ftt-counter {
  container-type: inline-size;
  justify-self: center;
  width: min(100%, 38rem);
  padding: 0.5rem 1rem 0.6rem;
  border: 3px solid var(--ftt-line);
  border-radius: var(--ftt-radius);
  background: var(--ftt-paper);
  box-shadow: var(--ftt-shadow);
}

.ftt-counter__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}

.ftt-counter__title {
  margin: 0;
  font-family: var(--ftt-serif);
  font-size: 0.95rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--ftt-ink);
}

.ftt-counter__end {
  display: inline-flex;
  gap: 0.25rem;
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
}

/* A narrow counter keeps its numbers and drops the words beside them. */
@container (max-width: 24rem) {
  .ftt-counter__word {
    display: none;
  }
}

.ftt-counter__end--debt {
  color: var(--ftt-debt);
}

.ftt-counter__end--profit {
  color: var(--ftt-profit);
}

.ftt-counter__track {
  position: relative;
  height: 22px;
  margin: 0.5rem 0.45rem 0.3rem;
  border: 3px solid var(--ftt-line);
  border-radius: 5px;
  background: linear-gradient(90deg, rgba(163, 56, 31, 0.3), rgba(163, 56, 31, 0.05) 46%, rgba(61, 107, 37, 0.05) 54%, rgba(61, 107, 37, 0.32));
}

.ftt-counter__zero {
  position: absolute;
  left: 50%;
  top: -3px;
  bottom: -3px;
  width: 2px;
  background: var(--ftt-ink);
  opacity: 0.5;
}

.ftt-counter__token {
  --token-color: var(--ftt-lime);
  position: absolute;
  top: 50%;
  width: 20px;
  height: 14px;
  border: 2px solid var(--ftt-ink);
  border-radius: 50%;
  background: var(--token-color);
  transform: translate(-50%, calc(-50% + (var(--token-lane) - 1) * 3px)) rotate(-18deg);
  transition: left 0.7s cubic-bezier(0.3, 1.2, 0.4, 1);
}

.ftt-counter__token.is-me {
  width: 22px;
  height: 17px;
  z-index: 2;
  box-shadow: 0 0 0 3px rgba(76, 96, 44, 0.4);
}

.ftt-counter__token.is-out {
  opacity: 0.3;
}

.ftt-counter__token-name {
  position: absolute;
  left: 50%;
  bottom: 100%;
  margin-bottom: 2px;
  transform: translateX(-50%);
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
  color: var(--ftt-ink);
}

/* Your own marker carries your beans in a readable size. */
.ftt-counter__token.is-me .ftt-counter__token-name {
  margin-bottom: 3px;
  font-size: 0.95rem;
}

.ftt-counter__goal {
  margin: 0.25rem 0 0;
  font-size: 0.82rem;
  color: var(--ftt-muted);
  text-align: center;
}

/* The season's icon, the turn and the Almanac, beside the logo. */
.ftt-turn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  min-height: 3.35rem;
  margin: 0;
  padding: 0.25rem 0.85rem 0.25rem 0.5rem;
}

.ftt-turn > .ftt-icon {
  --icon-size: 2.1rem;
}

.ftt-turn__words {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: baseline;
  min-width: 0;
  line-height: 1.15;
}

.ftt-turn__season {
  font-family: var(--ftt-serif);
  font-size: 1rem;
  font-weight: 700;
  white-space: nowrap;
}

.ftt-turn__season::before {
  content: ", ";
}

.ftt-turn__number {
  font-family: var(--ftt-serif);
  font-size: 1rem;
  font-weight: 700;
  color: var(--ftt-ink);
}

.ftt-turn__almanac {
  grid-column: 1 / -1;
  overflow: hidden;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ftt-muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ftt-turn:empty {
  display: none;
}

.ftt-turn__short {
  display: none;
}

/* The engine credit steps aside for sheets that reach the dock. */
.ftt-hud:has(.ftt-details:not([hidden]), .ftt-peek.is-placed:not([hidden]), .ftt-panel--farm:not(.is-collapsed)) .ftt-engine {
  opacity: 0;
}

/* Beans and the barn, top right, each with its name underneath. */
.ftt-resources {
  display: flex;
  align-items: center;
  justify-self: end;
  min-height: 3.35rem;
  padding: 0.2rem 0.4rem;
}

.ftt-stat {
  display: grid;
  grid-template-columns: auto auto;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 0.35rem;
  padding: 0 0.55rem;
}

.ftt-stat + .ftt-stat {
  border-left: 2px solid var(--ftt-rule);
}

.ftt-stat .ftt-icon {
  --icon-size: 2rem;
  grid-row: span 2;
}

.ftt-stat__value {
  font-size: 1.2rem;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--ftt-ink);
}

.ftt-stat__label {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  line-height: 1.1;
  text-transform: uppercase;
  color: var(--ftt-muted);
}

.ftt-stat.is-debt .ftt-stat__value {
  color: var(--ftt-debt);
}

.ftt-brand__menu:hover {
  background: var(--ftt-panel-strong);
}

.ftt-brand__menu:active {
  transform: translateY(2px);
  box-shadow: 0 0 0 var(--ftt-ink);
}

:is(.ftt-brand__menu, .ftt-button, .ftt-panel__toggle, .ftt-plotrow, .ftt-goods__button, .ftt-forecast):focus-visible {
  outline: 3px solid var(--ftt-olive);
  outline-offset: 2px;
}

/* Side panels */
/*
 * The HUD publishes --ftt-top-edge and --ftt-dock-edge (ui.js trackEdges)
 * so everything between the top bar and the dock fits at any size.
 */
.ftt-panel {
  position: absolute;
  top: calc(var(--ftt-top-edge, 6.8rem) + 0.6rem);
  bottom: calc(var(--ftt-dock-edge, 5.6rem) + 0.6rem);
  width: var(--ftt-side);
  display: flex;
  flex-direction: column;
  padding: 1.9rem 0.5rem 0.5rem;
  border: 3px solid var(--ftt-line);
  border-radius: var(--ftt-radius);
  background: var(--ftt-board);
  box-shadow: var(--ftt-shadow);
  overflow: hidden;
  transition: transform 0.3s ease;
}

/* The clip that holds the sheet to the board. */
.ftt-panel::before {
  content: "";
  position: absolute;
  top: 0.3rem;
  left: 50%;
  width: 4.4rem;
  height: 1.25rem;
  transform: translateX(-50%);
  border: 3px solid var(--ftt-line);
  border-radius: 7px 7px 4px 4px;
  background: linear-gradient(180deg, #eef1f3, #a8b0b6 62%, #d2d8dc);
  box-shadow: inset 0 -3px 0 rgba(22, 22, 22, 0.16);
  z-index: 2;
}

.ftt-panel--farm {
  left: 0.75rem;
}

.ftt-panel--market {
  right: 0.75rem;
}

.ftt-panel__toggle {
  display: none;
  border: 0;
  background: transparent;
  color: var(--ftt-text);
  font-weight: 800;
  padding: 0.6rem 0.9rem;
  text-align: left;
  cursor: pointer;
}

/* The sheet on the board: ruled paper that scrolls with its own lines. */
.ftt-panel__body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0.8rem 0.85rem 1rem;
  border: 2px solid var(--ftt-rule);
  border-radius: 8px;
  background:
    repeating-linear-gradient(180deg, transparent 0 25px, rgba(22, 22, 22, 0.06) 25px 26px),
    var(--ftt-paper);
  background-attachment: local;
  scrollbar-width: thin;
}

.ftt-panel__title {
  margin: 0 0 0.2rem;
  padding-bottom: 0.3rem;
  border-bottom: 2px solid var(--ftt-rule);
  font-family: var(--ftt-serif);
  font-size: 1.2rem;
  color: var(--ftt-olive);
}

.ftt-subtitle {
  margin: 1rem 0 0.4rem;
  font-family: var(--ftt-serif);
  font-size: 0.98rem;
  color: var(--ftt-olive);
}

/*
 * The farm drawer and the flat board's market panel share one rhythm:
 * sections stacked with even gaps, each a small serif heading over its
 * content, and nothing bringing margins of its own.
 */
.ftt-drawer {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.ftt-drawer > *,
.ftt-section > * {
  margin: 0;
}

.ftt-drawer__head {
  display: grid;
  gap: 0.15rem;
}

.ftt-drawer__head .ftt-panel__title {
  margin: 0;
}

.ftt-drawer__role {
  margin: 0;
  font-weight: 700;
  color: var(--ftt-muted);
}

.ftt-stattiles.ftt-drawer__figures {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
}

.ftt-drawer__figures .ftt-stattile {
  grid-template-columns: minmax(0, 1fr);
  justify-items: start;
  row-gap: 0.2rem;
  padding: 0.55rem 0.6rem;
}

.ftt-drawer__figures .ftt-stattile .ftt-icon {
  --icon-size: 1.6rem;
  grid-row: auto;
}

.ftt-drawer__figures .ftt-stattile__value {
  font-size: 1.25rem;
}

.ftt-drawer__figures .ftt-stattile__label {
  font-size: 0.72rem;
  line-height: 1.2;
}

.ftt-drawer__goal {
  font-size: 0.88rem;
  line-height: 1.4;
  color: var(--ftt-muted);
}

.ftt-section {
  display: grid;
  gap: 0.55rem;
  padding-top: 0.85rem;
  border-top: 2px solid var(--ftt-rule);
}

.ftt-section__title {
  font-family: var(--ftt-serif);
  font-size: 1.02rem;
  line-height: 1.2;
  color: var(--ftt-olive);
}

.ftt-section__note {
  font-size: 0.86rem;
  line-height: 1.4;
  color: var(--ftt-muted);
}

.ftt-farm__cards {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.ftt-mini {
  display: grid;
  justify-items: center;
  gap: 0.25rem;
}

.ftt-mini__label {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--ftt-muted);
}

/* A plot as a row you can press to see it on the farm. */
.ftt-plots {
  display: grid;
  gap: 0.45rem;
}

.ftt-plotrow {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 2px solid var(--ftt-rule);
  border-radius: 10px;
  background: #fffdf6;
  color: var(--ftt-text);
  text-align: left;
  cursor: pointer;
}

.ftt-plotrow:hover {
  border-color: var(--ftt-ink);
}

.ftt-plotrow .ftt-icon {
  --icon-size: 1.8rem;
}

.ftt-plotrow__words {
  display: grid;
  gap: 0.1rem;
  min-width: 0;
}

.ftt-plotrow__name {
  font-weight: 800;
  line-height: 1.2;
}

.ftt-plotrow__units {
  font-size: 0.84rem;
  line-height: 1.3;
  color: var(--ftt-muted);
}

.ftt-plotrow__count {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

/* Tonight's bills: what each costs, in a ruled list. */
.ftt-bills {
  display: grid;
  margin: 0;
  border: 2px solid var(--ftt-rule);
  border-radius: 10px;
  background: #fffdf6;
}

.ftt-bills__row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.7rem;
}

.ftt-bills__row + .ftt-bills__row {
  border-top: 2px solid var(--ftt-rule);
}

.ftt-bills__row .ftt-icon {
  --icon-size: 1.4rem;
}

.ftt-bills__row dt {
  font-size: 0.9rem;
  font-weight: 700;
}

.ftt-bills__row dd {
  margin: 0;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--ftt-debt);
}

.ftt-goods {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.35rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ftt-goods__button {
  display: grid;
  grid-template-columns: auto auto 1fr;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 0.4rem;
  width: 100%;
  padding: 0.25rem 0.2rem;
  border: 0;
  background: none;
  color: var(--ftt-text);
  text-align: left;
  cursor: pointer;
}

.ftt-goods__button > .ftt-icon {
  --icon-size: 2rem;
  grid-row: span 2;
  transition: transform 0.12s ease;
}

.ftt-goods__button:hover > .ftt-icon {
  transform: translateY(-2px);
}

.ftt-goods__qty {
  grid-row: span 2;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--ftt-ink);
}

.ftt-goods__name {
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.1;
}

.ftt-goods__price {
  font-size: 0.8rem;
  color: var(--ftt-muted);
}

.ftt-goods__price .ftt-icon {
  --icon-size: 1rem;
}

.ftt-goods__item.is-blocked .ftt-goods__qty {
  color: var(--ftt-debt);
}

.ftt-rivals {
  display: grid;
  gap: 0.4rem;
}

.ftt-rival {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.6rem;
  margin: 0;
  padding: 0.45rem 0.7rem;
  border: 2px solid var(--ftt-rule);
  border-radius: 10px;
  background: #fffdf6;
  font-size: 0.86rem;
}

.ftt-rival__words {
  display: grid;
  min-width: 0;
  color: var(--ftt-muted);
}

.ftt-rival__words strong {
  color: var(--ftt-ink);
}

.ftt-rival .ftt-amount {
  font-size: 1rem;
}

.ftt-rival .ftt-amount .ftt-icon {
  --icon-size: 1.2rem;
}

.ftt-rival.is-active {
  border-color: var(--ftt-olive);
  background: rgba(197, 215, 51, 0.2);
}

.ftt-rival.is-out {
  opacity: 0.5;
}

.ftt-rival__dot {
  width: 14px;
  height: 11px;
  border: 2px solid #161616;
  border-radius: 50%;
  background: var(--token-color);
}

/* Market panel */
.ftt-market {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem 0.6rem;
}

.ftt-offer {
  display: grid;
  justify-items: center;
  gap: 0.4rem;
}

.ftt-almanac {
  display: grid;
  justify-items: start;
  gap: 0.35rem;
  padding: 0.7rem 0.8rem;
  border: 2px solid rgba(176, 137, 26, 0.45);
  border-radius: 10px;
  background: #fbf1cd;
}

.ftt-almanac > * {
  margin: 0;
}

.ftt-almanac__name {
  font-size: 1rem;
}

.ftt-almanac__text {
  font-size: 0.88rem;
  line-height: 1.4;
}

.ftt-almanac .ftt-button {
  margin-top: 0.25rem;
}

/* Today's prices: each good's icon and its price, with an arrow when it moved. */
.ftt-prices__list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(4.1rem, 1fr));
  gap: 0.35rem 0.25rem;
  margin: 0.2rem 0 0;
  padding: 0;
  list-style: none;
}

.ftt-prices__item {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  font-size: 1rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.ftt-prices__item > .ftt-icon:first-child {
  --icon-size: 1.7rem;
}

.ftt-prices__trend {
  --icon-size: 0.8rem;
}

.ftt-prices__item.is-up .ftt-prices__price {
  color: var(--ftt-profit);
}

.ftt-prices__item.is-down .ftt-prices__price {
  color: var(--ftt-debt);
}

/* Buttons */
.ftt-button {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.05rem;
  min-height: 2.7rem;
  padding: 0.45rem 1.05rem;
  border: 3px solid var(--ftt-ink);
  border-radius: 12px;
  background: var(--ftt-panel-strong);
  color: var(--ftt-ink);
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 4px 0 var(--ftt-ink);
  transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.15s ease;
}

.ftt-button:hover {
  background: #f3f6dd;
  transform: translateY(-1px);
  box-shadow: 0 5px 0 var(--ftt-ink);
}

.ftt-button:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--ftt-ink);
}

.ftt-button--primary {
  background: var(--ftt-lime);
  color: var(--ftt-ink);
}

.ftt-button--small {
  flex-direction: row;
  gap: 0.4rem;
  min-height: 2.2rem;
  padding: 0.25rem 0.8rem;
  border-width: 2px;
  border-radius: 9px;
  box-shadow: 0 3px 0 var(--ftt-ink);
  font-size: 0.88rem;
}

.ftt-button--small .ftt-icon {
  --icon-size: 1.25rem;
}

.ftt-dialog .ftt-button--quiet {
  border-color: var(--ftt-rule);
  background: transparent;
  box-shadow: none;
  color: var(--ftt-muted);
}

.ftt-dialog .ftt-button--quiet:hover {
  border-color: var(--ftt-ink);
  background: #fffdf6;
  box-shadow: none;
  transform: none;
}

.ftt-button--primary:hover {
  background: #d6e75c;
}

.ftt-button--buy {
  flex-direction: row;
  gap: 0.35rem;
  min-height: 2.1rem;
  padding: 0.2rem 0.7rem;
  border-width: 2px;
  border-radius: 9px;
  box-shadow: 0 3px 0 var(--ftt-ink);
  font-size: 0.9rem;
}

.ftt-button--buy .ftt-icon {
  --icon-size: 1.25rem;
}

.ftt-button[aria-disabled="true"] {
  border-color: #9c9a8c;
  background: #ece7d7;
  color: #6a6557;
  box-shadow: 0 2px 0 #9c9a8c;
  transform: none;
  cursor: not-allowed;
}

/*
 * The action bar is a command card: square tiles, each a picture with its
 * name underneath, and a quick fact, such as the beans a haul will fetch,
 * riding on the top right corner.
 */
.ftt-action {
  position: relative;
  gap: 0.15rem;
  width: 4.9rem;
  min-height: 4.4rem;
  padding: 0.4rem 0.25rem 0.3rem;
  white-space: nowrap;
}

.ftt-action__icon {
  --icon-size: 2rem;
}

.ftt-action__short {
  font-size: 0.8rem;
  line-height: 1.05;
}

.ftt-button[aria-disabled="true"] .ftt-icon {
  filter: grayscale(1);
  opacity: 0.55;
}

/* A small white chip on the tile's top edge, readable on any tile colour. */
.ftt-badge {
  position: absolute;
  top: -0.8rem;
  right: 0.2rem;
  display: inline-flex;
  align-items: center;
  gap: 0.1rem;
  padding: 0.1rem 0.35rem 0.1rem 0.15rem;
  border: 2px solid var(--ftt-ink);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 2px 0 var(--ftt-ink);
  font-size: 0.85rem;
  font-weight: 800;
  line-height: 1;
  pointer-events: none;
}

.ftt-badge .ftt-icon {
  --icon-size: 1.05rem;
}

.ftt-badge__value {
  color: var(--ftt-ink);
}

/* A plain count sits in a round token. */
.ftt-badge:not(:has(.ftt-icon)) {
  display: grid;
  place-items: center;
  min-width: 1.45rem;
  height: 1.45rem;
  padding: 0;
  border-radius: 50%;
  background: var(--ftt-lime);
  font-size: 0.8rem;
}

.ftt-badge--cost .ftt-badge__value {
  color: var(--ftt-debt);
}

/* Action bar */
.ftt-actions {
  position: absolute;
  left: 50%;
  bottom: max(0.8rem, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.45rem;
  width: max-content;
  max-width: calc(100vw - 1.5rem);
  padding: 0.55rem 0.7rem;
  border: 3px solid var(--ftt-line);
  border-radius: 18px;
  background: linear-gradient(180deg, var(--ftt-paper), var(--ftt-paper-warm));
  box-shadow: var(--ftt-shadow);
}

.ftt-pips {
  display: flex;
  gap: 0.3rem;
  margin: 0 0.3rem 0 0.2rem;
}

/* Actions left this turn: a sprout each, faded once it is spent. */
.ftt-pips {
  display: grid;
  justify-items: center;
  gap: 0.1rem;
}

.ftt-pips__row {
  display: flex;
  gap: 0.1rem;
}

.ftt-pip {
  --icon-size: 1.45rem;
  opacity: 0.28;
  filter: grayscale(1);
}

.ftt-pip.is-full {
  opacity: 1;
  filter: none;
}

.ftt-pips__label {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ftt-muted);
}

.ftt-actions__wait {
  margin: 0 0.6rem;
  font-weight: 700;
  white-space: nowrap;
}

.ftt-actions .ftt-button {
  flex: none;
}

.ftt-actions__choose {
  flex: none;
  font-size: 0.82rem;
}

.ftt-hud.is-busy .ftt-actions .ftt-button {
  opacity: 0.55;
}

/* Messages */
.ftt-ticker {
  position: absolute;
  left: 50%;
  bottom: calc(var(--ftt-dock-edge, 4.8rem) + 0.7rem);
  transform: translateX(-50%);
  max-width: calc(100% - 1rem);
  margin: 0;
  text-align: center;
  font-size: 1.05rem;
  font-weight: 800;
}

.ftt-ticker[hidden] {
  display: none;
}

.ftt-toasts {
  position: absolute;
  top: calc(var(--ftt-top-edge, 6.8rem) + 0.8rem);
  left: 50%;
  transform: translateX(-50%);
  display: grid;
  justify-items: center;
  gap: 0.4rem;
  width: min(92vw, 30rem);
  pointer-events: none;
}

/* A notice sized to what it says, with an icon for its kind. */
.ftt-toast {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  width: fit-content;
  max-width: 100%;
  margin: 0;
  padding: 0.35rem 0.85rem 0.35rem 0.45rem;
  border: 3px solid var(--ftt-line);
  border-radius: 10px;
  background: var(--ftt-paper);
  box-shadow: 0 3px 0 var(--ftt-ink), var(--ftt-shadow);
  color: var(--ftt-text);
  font-weight: 800;
  text-align: left;
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.ftt-toast .ftt-icon {
  --icon-size: 1.7rem;
}

.ftt-toast--bad {
  color: var(--ftt-bad);
}

.ftt-toast--good {
  color: var(--ftt-good);
}

.ftt-toast.is-leaving {
  opacity: 0;
  transform: translateY(-6px);
}

.ftt-popups {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.ftt-popup {
  position: absolute;
  left: 0;
  top: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.15em;
  color: #e3f59a;
  font-weight: 800;
  font-size: 1.25rem;
  white-space: nowrap;
  will-change: transform, opacity;
}

.ftt-popup .ftt-icon {
  --icon-size: 1.5em;
}

.ftt-popup--bad {
  color: #ff9d85;
}

/*
 * Tags pinned to the world (ui.js placeWorldTags): buy prices in front of
 * the market cards, your beans over your token, the barn's contents at its
 * door. They follow the camera, so the farm itself is the interface.
 */
.ftt-worldtags {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

/* A cost gem: the price printed on a bean, in front of each card for sale. */
.ftt-tag {
  position: absolute;
  left: 0;
  top: 0;
  display: grid;
  place-items: center;
  width: 2.2rem;
  height: 2.2rem;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font: 800 1.1rem/1 var(--ftt-font);
  pointer-events: auto;
  cursor: pointer;
  will-change: transform;
  transition: opacity 0.25s ease;
}

.ftt-tag > * {
  grid-area: 1 / 1;
}

.ftt-tag .ftt-icon {
  --icon-size: 2.2rem;
  filter: drop-shadow(0 2px 0 var(--ftt-ink));
  transition: transform 0.15s ease;
}

/* The price paints over the bean (the icon's drop shadow gives it a layer). */
.ftt-tag__cost {
  position: relative;
  z-index: 1;
  font-size: 0.95rem;
}

.ftt-tag:hover .ftt-icon {
  transform: scale(1.12) rotate(-6deg);
}

.ftt-tag.is-offscreen {
  visibility: hidden;
}

.ftt-tag:focus-visible {
  outline: 3px solid var(--ftt-lime);
  outline-offset: 2px;
  border-radius: 50%;
}

.ftt-tag[aria-disabled="true"] .ftt-icon {
  filter: grayscale(1) brightness(1.15) drop-shadow(0 2px 0 var(--ftt-ink));
}

.ftt-tag[aria-disabled="true"] .ftt-tag__cost {
  color: #ff9d85;
}

/* While the farm plays out a turn, or a rival works, the prices step aside. */
.ftt-hud.is-busy .ftt-tag,
.ftt-tag.is-idle {
  opacity: 0;
  pointer-events: none;
}

.ftt-app.is-flat .ftt-worldtags {
  display: none;
}

.ftt-popup--warn {
  color: #ffd166;
}

/* The Almanac's reading: a printed notice with the Almanac's badge on top. */
.ftt-banner {
  position: absolute;
  top: 34%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(88vw, 23rem);
  padding: 1.7rem 1.2rem 1rem;
  border: 4px solid var(--ftt-ink);
  border-radius: 16px;
  background: var(--ftt-paper);
  color: var(--ftt-ink);
  text-align: center;
  box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.35);
  animation: ftt-banner-in 0.5s cubic-bezier(0.2, 1.3, 0.4, 1);
  transition: opacity 0.6s ease, transform 0.6s ease;
  pointer-events: none;
}

.ftt-banner.is-leaving {
  opacity: 0;
  transform: translate(-50%, -60%);
}

.ftt-banner__glyph {
  position: absolute;
  top: 0;
  left: 50%;
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  padding: 0.4rem;
  border: 4px solid var(--ftt-ink);
  border-radius: 50%;
  background: var(--ftt-lime);
  transform: translate(-50%, -55%);
}

.ftt-banner__glyph svg {
  width: 100%;
  height: 100%;
}

.ftt-banner__title {
  margin: 0;
  font-family: var(--ftt-serif);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--ftt-olive);
}

.ftt-banner__text {
  margin: 0.35rem 0 0;
}

@keyframes ftt-banner-in {
  from { opacity: 0; transform: translate(-50%, -40%) scale(0.9); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* Hover preview of a card on the 3D board */
.ftt-preview {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 30;
  pointer-events: none;
  filter: drop-shadow(0 14px 26px rgba(0, 0, 0, 0.45));
}

.ftt-preview[hidden] {
  display: none;
}

.ftt-preview .ffc-card {
  pointer-events: none;
}

/*
 * On the 3D farm the Bean Counter and the market are in the world, so the
 * top of the screen is one printed bar, the way a strategy game frames its
 * resources: the logo that opens the menu, the turn, your beans and barn,
 * and the button for your farm, divided by ruled lines rather than boxed.
 */
.ftt-app:not(.is-flat) .ftt-panel--market {
  display: none;
}

/*
 * The Bean Counter sits in the middle of the bar: 200 in debt at the left,
 * 200 in profit at the right, your marker with your beans over it.
 */
.ftt-app:not(.is-flat) .ftt-counter {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 0.7rem;
  flex: 1 1 28rem;
  align-self: stretch;
  width: auto;
  max-width: 42rem;
  margin: 0 auto;
  padding: 1.3rem 1.1rem 0.25rem;
  border: 0;
  border-inline: 2px solid var(--ftt-rule);
  border-radius: 0;
  background: none;
  box-shadow: none;
}

.ftt-app:not(.is-flat) .ftt-counter__head {
  display: contents;
}

.ftt-app:not(.is-flat) .ftt-counter__end--debt {
  grid-column: 1;
  grid-row: 1;
}

.ftt-app:not(.is-flat) .ftt-counter__track {
  grid-column: 2;
  grid-row: 1;
  margin: 0;
}

.ftt-app:not(.is-flat) .ftt-counter__end--profit {
  grid-column: 3;
  grid-row: 1;
}

.ftt-app:not(.is-flat) .ftt-counter__title {
  grid-column: 1 / -1;
  grid-row: 2;
  margin-top: 0.1rem;
  font-family: var(--ftt-font);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-align: center;
  color: var(--ftt-muted);
}

.ftt-app:not(.is-flat) .ftt-counter__goal {
  display: none;
}


.ftt-counter__token-name {
  display: inline-flex;
  align-items: center;
  gap: 0.1rem;
}

.ftt-counter__token-name .ftt-icon {
  --icon-size: 1.05rem;
}

.ftt-app:not(.is-flat) .ftt-top {
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: stretch;
  gap: 0;
  min-height: 3.7rem;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
  border-bottom: 3px solid var(--ftt-ink);
  background: linear-gradient(180deg, #fffcf3, var(--ftt-paper) 55%, var(--ftt-paper-warm));
  box-shadow: 0 3px 0 rgba(22, 22, 22, 0.16), 0 0.8rem 1.6rem rgba(38, 27, 12, 0.2);
  pointer-events: auto;
}

.ftt-app:not(.is-flat) .ftt-brand {
  flex: 0 1 auto;
  gap: 0;
  min-width: 0;
  overflow: hidden;
}

.ftt-app:not(.is-flat) .ftt-brand__menu {
  align-self: stretch;
  padding: 0.3rem 0.9rem;
  border: 0;
  border-right: 2px solid var(--ftt-rule);
  border-radius: 0;
  background: none;
  box-shadow: none;
}

.ftt-app:not(.is-flat) .ftt-brand__menu:hover,
.ftt-app:not(.is-flat) .ftt-top .ftt-panel__toggle:hover {
  background: rgba(197, 215, 51, 0.22);
}

.ftt-app:not(.is-flat) .ftt-brand__menu:active {
  transform: none;
}

.ftt-app:not(.is-flat) .ftt-turn {
  flex: 1 1 auto;
  padding: 0 0.9rem;
}

.ftt-turn__number {
  white-space: nowrap;
}

.ftt-app:not(.is-flat) .ftt-resources {
  flex: none;
  align-self: stretch;
  padding: 0 0.35rem;
  border-left: 2px solid var(--ftt-rule);
}

.ftt-top .ftt-panel__toggle {
  display: none;
}

.ftt-app:not(.is-flat) .ftt-top .ftt-panel__toggle {
  display: flex;
  flex: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.05rem;
  width: auto;
  min-width: 4.4rem;
  min-height: 0;
  padding: 0.2rem 0.8rem;
  border: 0;
  border-left: 2px solid var(--ftt-rule);
  border-radius: 0;
  font-size: 0.76rem;
  font-weight: 800;
  text-align: center;
}

.ftt-app:not(.is-flat) .ftt-top .ftt-panel__toggle[aria-expanded="true"] {
  background: rgba(197, 215, 51, 0.4);
}

.ftt-app:not(.is-flat) .ftt-top .ftt-panel__toggle::after {
  display: none;
}

.ftt-panel__toggle .ftt-icon {
  --icon-size: 1.9rem;
}

/* The farm drawer drops from its button, below the bar. */
.ftt-app:not(.is-flat) .ftt-panel--farm {
  top: calc(var(--ftt-top-edge, 3.7rem) + 0.5rem);
  right: 0.6rem;
  bottom: auto;
  left: auto;
  max-height: calc(100% - var(--ftt-top-edge, 3.7rem) - var(--ftt-dock-edge, 5.6rem) - 1.2rem);
  padding: 0;
  border-radius: 12px;
  background: var(--ftt-paper);
}

.ftt-app:not(.is-flat) .ftt-panel--farm.is-collapsed {
  display: none;
}

.ftt-app:not(.is-flat) .ftt-panel--farm::before {
  display: none;
}

.ftt-app:not(.is-flat) .ftt-panel--farm .ftt-panel__body {
  border: 0;
  border-radius: 0;
}

/*
 * A card's details, pinned beside the card on the board (ui.js placeDetails).
 * It is a sheet on the table, not a dialog: the farm stays live, and a click
 * anywhere else puts it away.
 */
.ftt-details {
  position: absolute;
  top: 0;
  left: 0;
  width: min(23rem, calc(100vw - 1rem));
  max-height: calc(100% - var(--ftt-top-edge, 3.7rem) - var(--ftt-dock-edge, 5.6rem) - 1.4rem);
  overflow-y: auto;
  padding: 0.8rem 0.9rem 1rem;
  border: 3px solid var(--ftt-ink);
  border-radius: 14px;
  background: var(--ftt-paper);
  box-shadow: 0 4px 0 var(--ftt-ink), var(--ftt-shadow);
  visibility: hidden;
  will-change: transform;
}

.ftt-details.is-placed {
  visibility: visible;
  animation: ftt-details-in 0.28s ease;
}

.ftt-details[hidden] {
  display: none;
}

.ftt-details.is-world:not(:focus-within) {
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  border: 0;
  clip-path: inset(50%);
  white-space: nowrap;
}

@keyframes ftt-details-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.ftt-details__head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.6rem;
}

.ftt-details__glyph {
  display: grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  padding: 0.3rem;
  border: 3px solid var(--ftt-ink);
  border-radius: 50%;
  background: #fff;
}

.ftt-details__glyph svg {
  width: 100%;
  height: 100%;
}

.ftt-details__titles {
  min-width: 0;
}

.ftt-details__title {
  margin: 0;
  font-family: var(--ftt-serif);
  font-size: 1.3rem;
  line-height: 1.1;
  color: var(--ftt-olive);
}

.ftt-details__type {
  margin: 0.1rem 0 0;
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--ftt-muted);
}

.ftt-details__close {
  position: relative;
  width: 2.2rem;
  height: 2.2rem;
  border: 3px solid var(--ftt-ink);
  border-radius: 50%;
  background: var(--ftt-lime);
  cursor: pointer;
  box-shadow: 0 2px 0 var(--ftt-ink);
}

.ftt-details__close::before,
.ftt-details__close::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0.95rem;
  height: 3px;
  border-radius: 2px;
  background: var(--ftt-ink);
  transform: translate(-50%, -50%) rotate(45deg);
}

.ftt-details__close::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

/* The card's lines as tiles: two across, a long one takes the row. */
.ftt-details__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
  margin: 0.75rem 0 0;
}

.ftt-detail {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 0.45rem;
  padding: 0.45rem 0.55rem;
  border: 2px solid var(--ftt-rule);
  border-radius: 10px;
  background: #fffdf6;
}

.ftt-detail--wide {
  grid-column: 1 / -1;
}

.ftt-detail__icon {
  --icon-size: 1.9rem;
  grid-row: span 2;
}

.ftt-detail__label {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  line-height: 1.15;
  text-transform: uppercase;
  color: var(--ftt-muted);
}

.ftt-detail__value {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.25;
}

.ftt-detail__value:has(.ftt-detail__meter) {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
}

.ftt-detail__meter {
  display: inline-flex;
  gap: 3px;
  margin-right: 0.35rem;
  vertical-align: -1px;
}

.ftt-detail__pip {
  width: 10px;
  height: 12px;
  border: 2px solid var(--ftt-ink);
  border-radius: 3px 3px 6px 6px;
  background: #fff;
}

.ftt-detail__pip.is-on {
  background: #5fa3f0;
}

.ftt-detail__small {
  font-size: 0.78rem;
  color: var(--ftt-muted);
}

.ftt-detail__seasons {
  display: inline-flex;
  gap: 0.25rem;
}

.ftt-detail__seasons .ftt-icon {
  --icon-size: 1.5rem;
}

.ftt-details__note {
  margin: 0.6rem 0 0;
  font-style: italic;
  color: var(--ftt-muted);
}

.ftt-details__buy {
  flex-direction: row;
  gap: 0.5rem;
  width: 100%;
  min-height: 3rem;
  margin-top: 0.9rem;
  font-size: 1.15rem;
}

.ftt-details__buy .ftt-icon {
  --icon-size: 1.5rem;
}

/* The engine credit: quiet type in the bottom right corner of the farm. */
.ftt-engine {
  position: absolute;
  right: 1rem;
  bottom: max(0.9rem, env(safe-area-inset-bottom));
  margin: 0;
  color: var(--ftt-cream);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
  white-space: nowrap;
  opacity: 0.82;
  pointer-events: none;
}

.ftt-app.is-flat .ftt-engine {
  display: none;
}

/*
 * Dialogs look like a FarmFinder game card: an ink frame, a black type band
 * that carries the title the way the client's cards carry the farm type, a
 * cream card face, ink outlined panels, and chunky buttons that press down.
 */
.ftt-dialog {
  --ftt-card-ink: #161616;
  width: min(94vw, 34rem);
  max-height: min(90vh, 48rem);
  max-height: min(90dvh, 48rem);
  padding: 0;
  border: 5px solid var(--ftt-card-ink);
  border-radius: 26px;
  background:
    radial-gradient(circle at 10% 0%, rgba(197, 215, 51, 0.2), transparent 40%),
    linear-gradient(180deg, #fffbf1, #f5eed8);
  color: var(--ftt-card-ink);
  box-shadow: 0 0 0 4px rgba(197, 215, 51, 0.9), 0 1.8rem 4.5rem rgba(0, 0, 0, 0.55);
  overflow: hidden;
}

.ftt-dialog[open] {
  display: flex;
  flex-direction: column;
  animation: ftt-dialog-in 0.34s cubic-bezier(0.2, 1.3, 0.4, 1);
}

@keyframes ftt-dialog-in {
  from { opacity: 0; transform: translateY(16px) scale(0.94); }
  to { opacity: 1; transform: none; }
}

.ftt-dialog--wide {
  width: min(96vw, 58rem);
}

.ftt-dialog::backdrop {
  background: radial-gradient(circle at 50% 42%, rgba(20, 28, 14, 0.4), rgba(8, 12, 6, 0.8));
  backdrop-filter: blur(4px);
}

.ftt-dialog__band {
  flex: none;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.8rem 0.85rem 0.8rem 1.25rem;
  border-bottom: 4px solid var(--ftt-lime);
  background: var(--ftt-card-ink);
  color: #fff;
}

.ftt-dialog--win .ftt-dialog__band {
  background: linear-gradient(90deg, #3d5a1e, #6f8f24);
}

.ftt-dialog--lose .ftt-dialog__band {
  border-bottom-color: var(--ftt-debt);
  background: linear-gradient(90deg, #3a1f17, #6b3322);
}

.ftt-dialog__title {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-family: var(--ftt-font);
  font-size: clamp(1.1rem, 3.2vw, 1.4rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff;
}

.ftt-dialog__close {
  position: relative;
  flex: none;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--ftt-lime);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.5);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.ftt-dialog__close::before,
.ftt-dialog__close::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 1.05rem;
  height: 3px;
  border-radius: 2px;
  background: var(--ftt-card-ink);
  transform: translate(-50%, -50%) rotate(45deg);
}

.ftt-dialog__close::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.ftt-dialog__close:hover {
  transform: rotate(90deg);
}

.ftt-dialog__close:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.5);
}

.ftt-dialog__close:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 2px;
}

/*
 * Dialog bodies are a column with even spacing: a lede, rows of choices,
 * figures, and a footer of buttons on the right. No element brings its own
 * outer margins, so nothing crowds or drifts.
 */
.ftt-dialog__body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.3rem clamp(1rem, 4vw, 1.6rem) 1.3rem;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.ftt-dialog__body > * {
  margin: 0;
}

.ftt-dialog__lede {
  font-size: 1.02rem;
  line-height: 1.45;
  color: #3a4130;
}

.ftt-dialog__note {
  font-size: 0.86rem;
  color: var(--ftt-muted);
}

.ftt-dialog__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.6rem;
  padding-top: 1rem;
  border-top: 2px solid var(--ftt-rule);
}

.ftt-dialog .ftt-button {
  flex-direction: row;
  gap: 0.45rem;
  min-height: 2.9rem;
  padding: 0.5rem 1.15rem;
  border: 3px solid var(--ftt-card-ink);
  border-radius: 12px;
  background: #fff;
  color: var(--ftt-card-ink);
  box-shadow: 0 4px 0 var(--ftt-card-ink);
  white-space: nowrap;
  transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.15s ease;
}

.ftt-dialog__actions .ftt-button {
  min-width: 8.5rem;
}

.ftt-dialog .ftt-button .ftt-icon {
  --icon-size: 1.45rem;
}

.ftt-dialog .ftt-button:hover {
  background: #f3f6dd;
  transform: translateY(-1px);
  box-shadow: 0 5px 0 var(--ftt-card-ink);
}

.ftt-dialog .ftt-button:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--ftt-card-ink);
}

.ftt-dialog .ftt-button--primary {
  background: var(--ftt-lime);
}

.ftt-dialog .ftt-button--primary:hover {
  background: #d6e75c;
}

.ftt-dialog .ftt-button[aria-disabled="true"] {
  border-color: #9c9a8c;
  background: #ebe7d8;
  color: #6a695e;
  box-shadow: 0 2px 0 #9c9a8c;
  opacity: 1;
  transform: none;
}

.ftt-dialog .ftt-button:focus-visible {
  outline-color: var(--ftt-olive);
}

/* A card beside its lines, for the flat board's card dialog. */
.ftt-inspect {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 1rem 1.5rem;
  align-items: start;
}

.ftt-inspect__card {
  display: grid;
  place-items: center;
}

.ftt-inspect__info {
  display: grid;
  gap: 0.7rem;
  align-content: start;
}

.ftt-inspect__info > * {
  margin: 0;
}

.ftt-inspect > .ftt-dialog__actions {
  grid-column: 1 / -1;
}

.ftt-foil-note {
  margin: 0.8rem 0 0;
  font-weight: 700;
  background: linear-gradient(90deg, #d9432f, #d8b04a, #5f913a, #3f7fa8, #9b7bd1);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.ftt-reason {
  margin: 0.2rem 0 0;
  font-size: 0.88rem;
  font-weight: 700;
  color: #9a3a26;
}

/* Rows: one choice each, its picture, what it is, and its button on the right. */
.ftt-rows {
  display: grid;
  gap: 0.6rem;
}

.ftt-rows__title {
  margin: 0;
  font-family: var(--ftt-serif);
  font-size: 1.05rem;
  color: var(--ftt-olive);
}

.ftt-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.9rem;
  padding: 0.8rem 0.95rem;
  border: 3px solid var(--ftt-ink);
  border-radius: 14px;
  background: #fffdf6;
  box-shadow: 0 3px 0 rgba(22, 22, 22, 0.18);
}

.ftt-row__icon {
  --icon-size: 2.4rem;
}

.ftt-row__words {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}

.ftt-row__words > * {
  margin: 0;
}

.ftt-row__title {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 1.02rem;
  font-weight: 800;
  line-height: 1.2;
}

.ftt-row__text {
  font-size: 0.9rem;
  line-height: 1.35;
  color: var(--ftt-muted);
}

.ftt-row--feature {
  background: #f1f7c9;
}

.ftt-row--stack {
  grid-template-columns: minmax(0, 1fr);
}

/* A choice with a list to pick from: the list under the heading, the button at its foot. */
.ftt-row--picks {
  grid-template-columns: auto minmax(0, 1fr);
}

.ftt-row--picks > .ftt-picks {
  grid-column: 1 / -1;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: 0.5rem 1rem;
  margin-top: 0 !important;
}

.ftt-row--picks > .ftt-button {
  grid-column: 1 / -1;
  justify-self: end;
}

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

.ftt-row--load {
  padding: 0.6rem 0.85rem;
}

.ftt-row.is-blocked {
  opacity: 0.72;
}

/* Big figures: an icon, a number, and what it counts. */
.ftt-stattiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(6.8rem, 1fr));
  gap: 0.6rem;
}

.ftt-stattile {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 0.6rem;
  padding: 0.7rem 0.85rem;
  border: 2px solid var(--ftt-rule);
  border-radius: 12px;
  background: #fffdf6;
}

.ftt-stattile .ftt-icon {
  --icon-size: 2.2rem;
  grid-row: span 2;
}

.ftt-stattile__value {
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.ftt-stattile__label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ftt-muted);
}

.ftt-stattile.is-debt .ftt-stattile__value {
  color: var(--ftt-debt);
}

/* A printed stepper: minus, the count, plus. */
.ftt-stepper {
  display: inline-flex;
  align-items: stretch;
  border: 3px solid var(--ftt-ink);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 3px 0 var(--ftt-ink);
  overflow: hidden;
}

.ftt-stepper__button {
  width: 2.5rem;
  min-height: 2.4rem;
  padding: 0;
  border: 0;
  background: var(--ftt-lime);
  color: var(--ftt-ink);
  font: 800 1.3rem/1 var(--ftt-font);
  cursor: pointer;
}

.ftt-stepper__button:hover:not(:disabled) {
  background: #d6e75c;
}

.ftt-stepper__button:disabled {
  background: #ebe7d8;
  color: #aaa594;
  cursor: default;
}

.ftt-stepper__value {
  display: grid;
  place-items: center;
  min-width: 2.6rem;
  border-inline: 3px solid var(--ftt-ink);
  font-size: 1.1rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

/* Checkboxes drawn like the rest of the game. */
.ftt-pick {
  cursor: pointer;
}

.ftt-picks {
  display: grid;
  gap: 0.4rem;
  margin-top: 0.4rem !important;
}

.ftt-picks .ftt-pick {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  font-weight: 700;
}

.ftt-picks .ftt-pick .ftt-icon {
  --icon-size: 1.5rem;
}

.ftt-row.ftt-pick {
  grid-template-columns: auto auto minmax(0, 1fr);
}

.ftt-pick__input {
  -webkit-appearance: none;
  appearance: none;
  display: grid;
  place-items: center;
  width: 1.65rem;
  height: 1.65rem;
  margin: 0;
  border: 3px solid var(--ftt-ink);
  border-radius: 7px;
  background: #fff;
  cursor: pointer;
}

.ftt-pick__input:checked {
  background: var(--ftt-lime);
}

.ftt-pick__input:checked::after {
  content: "";
  width: 0.38rem;
  height: 0.72rem;
  border-right: 3px solid var(--ftt-ink);
  border-bottom: 3px solid var(--ftt-ink);
  transform: translateY(-2px) rotate(45deg);
}

.ftt-pick__input:disabled {
  opacity: 0.4;
  cursor: default;
}

.ftt-pick__input:focus-visible {
  outline: 3px solid var(--ftt-olive);
  outline-offset: 2px;
}

/* The load summary: spaces used, kinds toward a combo, and what it sells for. */
.ftt-loadsum {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem 1rem;
  padding: 0.8rem 1rem;
  border-radius: 14px;
  background: var(--ftt-ink);
  color: #fffdf3;
}

.ftt-loadsum > div {
  display: grid;
  align-content: start;
  gap: 0.25rem;
}

.ftt-loadsum__label {
  font-size: 0.78rem;
  font-weight: 700;
  color: #cfc9b2;
}

.ftt-loadsum strong {
  font-size: 1.02rem;
}

.ftt-loadsum__slots {
  display: flex;
  gap: 0.3rem;
}

.ftt-loadsum__slot {
  width: 0.95rem;
  height: 0.95rem;
  border: 2px solid #fffdf3;
  border-radius: 50%;
}

.ftt-loadsum__slot.is-on {
  background: var(--ftt-lime);
}

.ftt-loadsum .ftt-amount {
  font-size: 1.35rem;
  color: var(--ftt-lime);
}

.ftt-loadsum .ftt-amount .ftt-icon {
  --icon-size: 1.7rem;
}

/* The end of a game. */
.ftt-dialog--over {
  width: min(94vw, 42rem);
}

.ftt-over__link {
  padding: 0.55rem 0.75rem;
  border: 2px dashed var(--ftt-ink);
  border-radius: 10px;
  background: #fff;
  font-weight: 700;
  overflow-wrap: anywhere;
  -webkit-user-select: all;
  user-select: all;
}

.ftt-dialog--over .ftt-dialog__actions > :first-child {
  margin-right: auto;
}

.ftt-over__hero {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  padding: 0.3rem 0;
}

.ftt-over__hero .ftt-icon {
  --icon-size: 3.4rem;
}

.ftt-over__beans {
  font-family: var(--ftt-serif);
  font-size: 3.6rem;
  line-height: 1;
}

.ftt-over__label {
  max-width: 12rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--ftt-muted);
}

.ftt-over__daily {
  text-align: center;
  font-weight: 700;
}

.ftt-over__made {
  display: grid;
  gap: 0.5rem;
}

.ftt-over__goods {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.1rem;
  font-size: 1.2rem;
}

.ftt-over__goods .ftt-icon {
  --icon-size: 1.9rem;
}

/*
 * The title screen: the game's name set like a game logo over the living
 * farm, the farmers dealt out like a hand, and two tiles for how to play.
 */
.ftt-dialog--title {
  width: 100vw;
  max-width: none;
  height: 100vh;
  height: 100dvh;
  max-height: none;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: linear-gradient(180deg, rgba(12, 18, 9, 0.55) 0%, rgba(12, 18, 9, 0.12) 28%, rgba(12, 18, 9, 0.3) 55%, rgba(12, 18, 9, 0.85) 100%);
  box-shadow: none;
  color: #fffdf3;
}

.ftt-dialog--title[open] {
  animation: ftt-title-in 0.6s ease;
}

@keyframes ftt-title-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.ftt-dialog--title::backdrop {
  background: transparent;
  backdrop-filter: none;
}

.ftt-dialog--title .ftt-dialog__body {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: clamp(0.9rem, 2.6vh, 1.7rem);
  min-height: 100%;
  padding: max(1.2rem, env(safe-area-inset-top)) 1rem max(1.5rem, env(safe-area-inset-bottom));
}

.ftt-setup__head {
  display: grid;
  justify-items: center;
  gap: 0.35rem;
  text-align: center;
}

.ftt-setup__logo {
  width: 104px;
  height: auto;
  filter: drop-shadow(0 3px 0 var(--ftt-ink));
}

/* The flat board has no top bar behind the turn and resources, so they get paper. */
.ftt-app.is-flat :is(.ftt-turn, .ftt-resources) {
  border: 3px solid var(--ftt-line);
  border-radius: 12px;
  background: var(--ftt-paper);
  box-shadow: 0 3px 0 var(--ftt-ink), var(--ftt-shadow);
}

.ftt-app.is-flat .ftt-turn {
  padding: 0.25rem 0.85rem 0.25rem 0.5rem;
}

/* The HUD steps away while the title screen is up. */
.ftt-hud.is-titled > :not(dialog, .ftt-popups, .ftt-worldtags) {
  visibility: hidden;
}

.ftt-hud.is-titled .ftt-worldtags {
  display: none;
}

/* The name, set the way a game sets its logo. */
.ftt-setup__title,
.ftt-splash__title {
  margin: 0;
  text-transform: none;
  letter-spacing: 0;
  font-family: var(--ftt-serif);
  font-size: clamp(2.7rem, 7.5vw, 5rem);
  font-weight: 700;
  line-height: 1;
  color: #fffdf3;
  -webkit-text-stroke: 0.1em var(--ftt-ink);
  paint-order: stroke fill;
  text-shadow: 0 0.07em 0 var(--ftt-ink), 0 0.4rem 1.6rem rgba(0, 0, 0, 0.35);
}

.ftt-setup__lede {
  margin: 0;
  max-width: 34rem;
  font-size: 1.1rem;
  font-weight: 800;
  text-shadow: 0 2px 0 var(--ftt-ink), 0 0 14px rgba(0, 0, 0, 0.7);
}

.ftt-setup__step {
  display: grid;
  justify-items: center;
  width: 100%;
}

.ftt-setup__heading {
  float: none;
  width: 100%;
  margin: 0 0 0.6rem;
  padding: 0;
  font-family: var(--ftt-serif);
  font-size: 1.25rem;
  font-weight: 700;
  text-align: center;
  color: #fffdf3;
  -webkit-text-stroke: 0.16em var(--ftt-ink);
  paint-order: stroke fill;
}

/*
 * The farmers as a hand of cards (ui.js setupDialog): the chosen card in
 * front, the others fanned behind it, sliding into place when one is picked.
 */
.ftt-hand {
  --hand-card: 184px;
  position: relative;
  width: 100%;
  height: calc(var(--hand-card) * 1.4 + 3rem);
  overflow-x: clip;
  touch-action: pan-y;
}

.ftt-hand__slot {
  position: absolute;
  top: 0.9rem;
  left: 50%;
  transform-origin: 50% 85%;
  transition: transform 0.5s cubic-bezier(0.2, 1.15, 0.3, 1), opacity 0.3s ease, filter 0.3s ease;
  will-change: transform;
}

.ftt-hand__slot .ffc-card {
  display: block;
  filter: drop-shadow(0 0.35rem 0.45rem rgba(0, 0, 0, 0.35)) brightness(0.8);
  transition: filter 0.3s ease;
}

.ftt-hand__slot.is-chosen .ffc-card {
  outline: 4px solid var(--ftt-lime);
  outline-offset: 5px;
  filter: drop-shadow(0 0.5rem 0.6rem rgba(0, 0, 0, 0.4));
}

.ftt-hand__slot:not(.is-chosen) .ffc-card:hover {
  filter: drop-shadow(0 0.35rem 0.45rem rgba(0, 0, 0, 0.35)) brightness(0.95);
}

.ftt-hand__slot.is-far {
  opacity: 0.8;
}

.ftt-hand__slot.is-locked {
  opacity: 0.4;
  filter: grayscale(0.6);
}

.ftt-hand__slot.is-locked .ffc-card {
  cursor: default;
}

.ftt-setup__perk {
  max-width: 24rem;
  min-height: 2.7em;
  margin: 0.2rem 0 0;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.35;
  text-align: center;
  text-shadow: 0 2px 0 var(--ftt-ink), 0 0 10px rgba(0, 0, 0, 0.8);
}

.ftt-setup__perk.is-new {
  animation: ftt-perk-in 0.4s ease;
}

@keyframes ftt-perk-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.ftt-setup__modes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 17.5rem));
  justify-content: center;
  gap: 0.8rem;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
}

.ftt-mode {
  position: relative;
  /* The rival count's z-index stays inside its tile, under the start bar. */
  isolation: isolate;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 0.7rem;
  padding: 0.7rem 0.9rem;
  border: 3px solid var(--ftt-ink);
  border-radius: 14px;
  background: var(--ftt-paper);
  color: var(--ftt-ink);
  box-shadow: 0 4px 0 var(--ftt-ink);
  cursor: pointer;
  transition: transform 0.12s ease;
}

.ftt-mode:hover {
  transform: translateY(-2px);
}

.ftt-mode:has(input:checked) {
  background: #f1f7c9;
  outline: 4px solid var(--ftt-lime);
  outline-offset: 2px;
}

.ftt-mode:has(input:focus-visible) {
  outline: 4px solid var(--ftt-olive);
  outline-offset: 2px;
}

.ftt-dialog .ftt-mode__input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.ftt-mode .ftt-icon {
  --icon-size: 2.7rem;
}

.ftt-mode__words {
  display: grid;
  gap: 0.1rem;
  text-align: left;
}

.ftt-mode__title {
  font-size: 1.1rem;
}

.ftt-mode__text {
  font-size: 0.86rem;
  color: var(--ftt-muted);
}

.ftt-mode__count {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.4rem 0 0.1rem;
}

.ftt-mode__count .ftt-segment {
  flex-wrap: nowrap;
}

.ftt-mode__count .ftt-segment__option {
  min-width: 2.4rem;
}

.ftt-mode__count-label {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--ftt-muted);
}

.ftt-mode__challenge {
  font-size: 0.86rem;
  font-weight: 800;
  color: #8a6410;
}

.ftt-setup__actions {
  position: relative;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.8rem 1.2rem;
}

.ftt-dialog .ftt-setup__start {
  min-width: 16rem;
  min-height: 3.6rem;
  font-size: 1.35rem;
}

.ftt-dialog .ftt-setup__help {
  min-height: 3.6rem;
  padding: 0.5rem 1.3rem;
  font-size: 1.1rem;
}

/*
 * The game menu (menu.js): a paper panel over the paused farm. The main
 * screen is a list; each settings section is a screen of rows with printed
 * switches, segmented choices and sliders, and a footer to Accept or go Back.
 */
.ftt-dialog--menu {
  width: 100vw;
  max-width: none;
  height: 100vh;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: radial-gradient(circle at 50% 40%, rgba(20, 28, 14, 0.3), rgba(8, 12, 6, 0.75));
  box-shadow: none;
}

.ftt-dialog--menu[open] {
  animation: ftt-title-in 0.25s ease;
}

.ftt-dialog--menu::backdrop {
  background: transparent;
  backdrop-filter: blur(3px);
}

.ftt-dialog--menu .ftt-dialog__body {
  flex: none;
  width: min(calc(100% - 1.5rem), 34rem);
  max-height: calc(100dvh - 2rem);
  margin: auto;
  padding: 0;
  gap: 0;
  border: 4px solid var(--ftt-ink);
  border-radius: 20px;
  background: var(--ftt-paper);
  box-shadow: 0 6px 0 var(--ftt-ink), 0 1.8rem 4rem rgba(0, 0, 0, 0.5);
  animation: ftt-dialog-in 0.3s cubic-bezier(0.2, 1.3, 0.4, 1);
}

.ftt-dialog--menu .ftt-dialog__body:has(.ftt-menu__screen--help, .ftt-menu__screen--settings) {
  width: min(calc(100% - 1.5rem), 46rem);
}

.ftt-menu__screen {
  display: flex;
  flex-direction: column;
}

.ftt-menu__brand {
  display: grid;
  justify-items: center;
  gap: 0.25rem;
  padding: 1.3rem 1rem 1rem;
  border-bottom: 3px solid var(--ftt-ink);
  border-radius: 16px 16px 0 0;
  background: linear-gradient(180deg, #fffcf3, var(--ftt-paper-warm));
}

.ftt-menu__logo {
  width: 72px;
  height: auto;
}

.ftt-dialog .ftt-menu__name {
  flex: none;
  font-family: var(--ftt-serif);
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ftt-ink);
}

.ftt-menu__where {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--ftt-muted);
}

.ftt-menu__list {
  display: grid;
  gap: 0.15rem;
  padding: 0.7rem;
}

.ftt-menu__item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.85rem;
  width: 100%;
  padding: 0.55rem 0.8rem;
  border: 3px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--ftt-ink);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.ftt-menu__item .ftt-icon {
  --icon-size: 2.1rem;
}

.ftt-menu__item:hover,
.ftt-menu__item:focus-visible {
  background: rgba(197, 215, 51, 0.32);
  outline: none;
}

.ftt-menu__item:focus-visible {
  border-color: var(--ftt-olive);
}

.ftt-menu__item.is-primary {
  margin-bottom: 0.15rem;
  border-color: var(--ftt-ink);
  background: var(--ftt-lime);
  box-shadow: 0 3px 0 var(--ftt-ink);
}

.ftt-menu__item.is-primary:hover {
  background: #d6e75c;
}

.ftt-menu__words {
  display: grid;
  gap: 0.05rem;
  min-width: 0;
}

.ftt-menu__label {
  font-family: var(--ftt-serif);
  font-size: 1.15rem;
  font-weight: 700;
}

.ftt-menu__hint {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ftt-muted);
}

.ftt-menu__chevron {
  width: 0.6rem;
  height: 0.6rem;
  margin-right: 0.35rem;
  border-top: 3px solid var(--ftt-ink);
  border-right: 3px solid var(--ftt-ink);
  transform: rotate(45deg);
}

.ftt-menu__rule {
  margin: 0.3rem 0.7rem;
  border: 0;
  border-top: 2px solid var(--ftt-rule);
}

.ftt-menu__item--quiet .ftt-menu__label {
  font-size: 1rem;
  color: var(--ftt-muted);
}

.ftt-menu__credit {
  margin: 0;
  padding: 0 1.2rem 1.1rem;
  font-size: 0.78rem;
  text-align: center;
  color: var(--ftt-muted);
}

.ftt-menu__head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.75rem 1rem;
  border-bottom: 3px solid var(--ftt-ink);
  border-radius: 16px 16px 0 0;
  background: var(--ftt-ink);
  color: #fffdf3;
}

.ftt-menu__back {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.8rem 0.35rem 0.7rem;
  border: 3px solid #fffdf3;
  border-radius: 10px;
  background: transparent;
  color: #fffdf3;
  font-weight: 800;
  cursor: pointer;
}

.ftt-menu__back:hover,
.ftt-menu__back:focus-visible {
  background: rgba(255, 253, 243, 0.14);
  outline: none;
}

.ftt-menu__back-arrow {
  width: 0.55rem;
  height: 0.55rem;
  border-bottom: 3px solid currentColor;
  border-left: 3px solid currentColor;
  transform: rotate(45deg);
}

.ftt-menu__titles {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}

.ftt-menu__titles .ftt-icon {
  --icon-size: 2.2rem;
  padding: 3px;
  border-radius: 50%;
  background: #fffdf3;
}

.ftt-dialog .ftt-menu__title {
  font-family: var(--ftt-serif);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  color: #fffdf3;
}

.ftt-menu__foot {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.85rem 1rem;
  border-top: 3px solid var(--ftt-ink);
  border-radius: 0 0 16px 16px;
  background: var(--ftt-paper-warm);
}

.ftt-menu__buttons {
  display: flex;
  gap: 0.55rem;
  margin-left: auto;
}

.ftt-menu__foot .ftt-button {
  min-width: 7.5rem;
}

.ftt-menu__foot.is-dirty .ftt-button--primary {
  animation: ftt-nudge 0.45s ease;
}

@keyframes ftt-nudge {
  40% { transform: translateY(-3px); }
}

/* A settings row: what it is on the left, its control on the right. */
.ftt-settings {
  display: grid;
  padding: 0.3rem 1.1rem;
}

.ftt-setting {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.5rem 1.4rem;
  padding: 0.9rem 0.1rem;
  border-bottom: 2px solid var(--ftt-rule);
}

.ftt-setting:last-child {
  border-bottom: 0;
}

.ftt-setting__words {
  display: grid;
  gap: 0.1rem;
}

.ftt-setting__label {
  font-size: 1.02rem;
  font-weight: 800;
}

.ftt-setting__help {
  font-size: 0.85rem;
  color: var(--ftt-muted);
}

.ftt-setting--range {
  grid-template-columns: minmax(0, 1fr) minmax(12rem, 17rem);
}

.ftt-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ftt-ink);
  font-weight: 800;
  cursor: pointer;
}

.ftt-switch__track {
  position: relative;
  width: 3.5rem;
  height: 2rem;
  border: 3px solid var(--ftt-ink);
  border-radius: 9px;
  background: #e3dcc6;
  box-shadow: inset 0 2px 0 rgba(0, 0, 0, 0.12);
  transition: background 0.15s ease;
}

.ftt-switch__track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 1.3rem;
  height: 1.3rem;
  border: 3px solid var(--ftt-ink);
  border-radius: 6px;
  background: #fffdf3;
  transition: transform 0.18s cubic-bezier(0.3, 1.4, 0.5, 1);
}

.ftt-switch[aria-checked="true"] .ftt-switch__track {
  background: var(--ftt-lime);
}

.ftt-switch[aria-checked="true"] .ftt-switch__track::after {
  transform: translateX(1.2rem);
}

.ftt-switch__text {
  min-width: 1.8rem;
  text-align: left;
}

.ftt-switch:focus-visible {
  outline: 3px solid var(--ftt-olive);
  outline-offset: 3px;
  border-radius: 8px;
}

.ftt-segment {
  display: inline-flex;
  flex-wrap: wrap;
  border: 3px solid var(--ftt-ink);
  border-radius: 10px;
  background: #fffdf6;
  box-shadow: 0 3px 0 var(--ftt-ink);
  overflow: hidden;
}

.ftt-segment__option {
  flex: 1 0 auto;
  padding: 0.45rem 0.9rem;
  border: 0;
  border-left: 2px solid var(--ftt-ink);
  background: transparent;
  color: var(--ftt-ink);
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
}

.ftt-segment__option:first-child {
  border-left: 0;
}

.ftt-segment__option:hover {
  background: rgba(197, 215, 51, 0.3);
}

.ftt-segment__option[aria-checked="true"] {
  background: var(--ftt-lime);
}

.ftt-segment__option:focus-visible {
  outline: 3px solid var(--ftt-olive);
  outline-offset: -5px;
}

.ftt-segment--small .ftt-segment__option {
  padding: 0.3rem 0.65rem;
  font-size: 0.86rem;
}

.ftt-range {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 3.4rem;
  align-items: center;
  gap: 0.75rem;
}

.ftt-range__input {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 1rem;
  margin: 0;
  border: 3px solid var(--ftt-ink);
  border-radius: 6px;
  background: linear-gradient(90deg, var(--ftt-lime) var(--fill, 50%), #e3dcc6 var(--fill, 50%));
  cursor: pointer;
}

.ftt-range__input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 1.5rem;
  height: 1.5rem;
  border: 3px solid var(--ftt-ink);
  border-radius: 6px;
  background: #fffdf3;
  box-shadow: 0 2px 0 var(--ftt-ink);
}

.ftt-range__input::-moz-range-thumb {
  width: 1.1rem;
  height: 1.1rem;
  border: 3px solid var(--ftt-ink);
  border-radius: 6px;
  background: #fffdf3;
  box-shadow: 0 2px 0 var(--ftt-ink);
}

.ftt-range__input:focus-visible {
  outline: 3px solid var(--ftt-olive);
  outline-offset: 4px;
}

.ftt-range__value {
  font-weight: 800;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.ftt-keys {
  margin: 0.2rem 1.1rem 1.1rem;
  padding: 0.9rem 1rem;
  border: 2px solid var(--ftt-rule);
  border-radius: 12px;
  background: #fffdf6;
}

.ftt-keys__title {
  margin: 0 0 0.65rem;
  font-family: var(--ftt-serif);
  font-size: 1.05rem;
}

.ftt-keys__list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem 1rem;
  margin: 0;
}

.ftt-keys__pair {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.ftt-keys__pair dd {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
}

.ftt-kbd {
  display: inline-block;
  min-width: 2.1rem;
  padding: 0.15rem 0.45rem;
  border: 2px solid var(--ftt-ink);
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 2px 0 var(--ftt-ink);
  font: 800 0.8rem/1.3 var(--ftt-font);
  text-align: center;
  white-space: nowrap;
}

.ftt-keys__note {
  margin: 0.75rem 0 0;
  font-size: 0.85rem;
  color: var(--ftt-muted);
}

.ftt-menu__help {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
  padding: 1rem 1.1rem;
}

.ftt-helptile {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-content: start;
  gap: 0.25rem 0.75rem;
  margin: 0;
  padding: 0.85rem 0.95rem;
  border: 2px solid var(--ftt-rule);
  border-radius: 12px;
  background: #fffdf6;
}

.ftt-helptile .ftt-icon {
  --icon-size: 2.3rem;
  grid-row: span 2;
}

.ftt-helptile__title {
  margin: 0;
  font-family: var(--ftt-serif);
  font-size: 1.05rem;
}

.ftt-helptile__text {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.42;
}

/* The flat board */
.ftt-board2d {
  position: absolute;
  inset: calc(var(--ftt-top-edge, 6.8rem) + 0.6rem) calc(var(--ftt-side) + 1.5rem) calc(var(--ftt-dock-edge, 5.6rem) + 0.6rem);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  overflow: hidden;
}

.ftt-board2d[hidden] {
  display: none;
}

/* Drawn at one design width, then scaled to fit by board2d.js. */
.ftt-flat {
  flex: none;
  display: grid;
  gap: 1rem;
  width: 920px;
  transform-origin: top center;
  padding: 1.2rem;
  border: 6px solid #4c602c;
  border-radius: 20px;
  background: radial-gradient(circle at 50% 50%, #fdfbf3, #efe8d2);
  color: #2b2b2b;
}

.ftt-flat__row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.8rem;
}

.ftt-flat__row--farms {
  justify-content: space-around;
}

.ftt-flat__slot {
  display: grid;
  justify-items: center;
  gap: 0.3rem;
  min-width: 118px;
}

.ftt-flat__empty {
  width: 112px;
  aspect-ratio: 5 / 7;
  border: 3px solid #2b2b2b;
  border-radius: 10px;
  background: #e6e6e3;
}

.ftt-flat__label {
  margin: 0;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.ftt-flat__counter {
  flex: 1;
  display: grid;
  gap: 0.3rem;
  align-self: center;
}

.ftt-flat__counter-title,
.ftt-flat__labels {
  display: flex;
  justify-content: space-between;
  margin: 0;
  font-weight: 800;
}

.ftt-flat__track {
  position: relative;
  height: 6px;
  margin: 1.2rem 1rem 0.6rem;
  background: #2b2b2b;
}

.ftt-flat__track-end {
  position: absolute;
  bottom: 10px;
  left: -0.8rem;
  font-weight: 800;
}

.ftt-flat__track-end--right {
  left: auto;
  right: -0.8rem;
}

.ftt-flat__token {
  position: absolute;
  top: 50%;
  width: 18px;
  height: 14px;
  border: 2px solid #161616;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.ftt-flat__market {
  display: grid;
  justify-items: center;
  gap: 0.3rem;
}

.ftt-flat__market-row {
  display: flex;
  gap: 0.5rem;
}

.ftt-flat__units,
.ftt-flat__homestead {
  margin: 0;
  max-width: 12rem;
  font-size: 0.86rem;
  text-align: center;
}

/* The link preview poster (?poster), captured at 1200 by 630. */
.ftt-app.is-poster .ftt-hud,
.ftt-app.is-poster .ftt-splash {
  display: none;
}

.ftt-poster {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  padding: 0 3.4rem;
  background: linear-gradient(90deg, rgba(16, 24, 11, 0.86) 0%, rgba(16, 24, 11, 0.6) 34%, rgba(16, 24, 11, 0) 60%);
  pointer-events: none;
}

.ftt-poster__logo {
  display: block;
  width: 150px;
  height: auto;
  padding: 8px 12px;
  border-radius: 16px;
  background: #fff;
}

.ftt-poster__title {
  margin: 1.2rem 0 0;
  font-family: var(--ftt-serif);
  font-size: 5.2rem;
  line-height: 0.95;
  color: #fff;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
}

.ftt-poster__lede {
  max-width: 27rem;
  margin: 1.1rem 0 1.6rem;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--ftt-cream);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.ftt-poster .ftt-engine {
  position: static;
  transform: none;
  font-size: 0.8rem;
}

.ftt-poster__cards {
  position: relative;
  height: 100%;
  transform: translateX(-4.5rem);
}

.ftt-poster__card {
  position: absolute;
  top: 50%;
  left: 50%;
  filter: drop-shadow(0 18px 30px rgba(0, 0, 0, 0.5));
}

.ftt-poster__card:nth-child(1) {
  transform: translate(-100%, -46%) rotate(-12deg);
}

.ftt-poster__card:nth-child(2) {
  z-index: 2;
  transform: translate(-50%, -55%) rotate(-2deg);
}

.ftt-poster__card:nth-child(3) {
  transform: translate(0%, -46%) rotate(11deg);
}

/* Deck gallery */
.ftt-gallery {
  max-width: 1380px;
  margin: 0 auto;
  padding: 2rem clamp(1rem, 4vw, 3rem) 4rem;
  color: var(--ftt-text);
}

.ftt-gallery__title {
  margin: 0;
  font-family: var(--ftt-serif);
  font-size: clamp(2rem, 5vw, 3rem);
}

.ftt-gallery__intro {
  max-width: 48rem;
  margin: 0.6rem 0 1.5rem;
  color: var(--ftt-muted);
  font-size: 1.05rem;
}

.ftt-gallery__group h3 {
  margin: 2rem 0 0.8rem;
  font-family: var(--ftt-serif);
  font-size: 1.35rem;
}

.ftt-gallery__row {
  display: flex;
  flex-wrap: wrap;
  gap: 1.1rem;
}

/* A card's price previewed from its gem: what it does, and what buying it leaves. */
.ftt-peek {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 5;
  width: min(18.5rem, calc(100vw - 1rem));
  padding: 0.7rem 0.85rem;
  border: 3px solid var(--ftt-ink);
  border-radius: 12px;
  background: var(--ftt-paper);
  box-shadow: 0 4px 0 var(--ftt-ink), var(--ftt-shadow);
  pointer-events: none;
  visibility: hidden;
}

.ftt-peek.is-placed {
  visibility: visible;
}

.ftt-peek[hidden] {
  display: none;
}

.ftt-peek__head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 0.55rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--ftt-rule);
}

.ftt-peek__glyph,
.ftt-forecast__glyph {
  display: grid;
  place-items: center;
  width: 2.2rem;
  height: 2.2rem;
  padding: 0.25rem;
  border: 2px solid var(--ftt-ink);
  border-radius: 50%;
  background: #fff;
}

.ftt-peek__glyph svg,
.ftt-forecast__glyph svg {
  width: 100%;
  height: 100%;
}

.ftt-peek__titles {
  display: grid;
  min-width: 0;
}

.ftt-peek__name {
  font-family: var(--ftt-serif);
  font-size: 1.02rem;
  line-height: 1.15;
}

.ftt-peek__type {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ftt-muted);
}

.ftt-peek__lines {
  display: grid;
  gap: 0.35rem;
  margin: 0.55rem 0;
  padding: 0;
  list-style: none;
}

.ftt-peek__line {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 0.45rem;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.3;
}

.ftt-peek__line .ftt-icon {
  --icon-size: 1.35rem;
}

.ftt-peek__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.2rem 0.4rem;
  padding-top: 0.45rem;
  border-top: 2px solid var(--ftt-rule);
  font-size: 0.85rem;
  font-weight: 700;
}

.ftt-peek__after .ftt-icon {
  --icon-size: 1.15rem;
}

.ftt-peek__after-label {
  color: var(--ftt-muted);
}

.ftt-peek__sale {
  width: 100%;
  color: #8a6410;
}

.ftt-peek__reason {
  color: var(--ftt-debt);
}

.ftt-peek__tap {
  width: 100%;
  color: var(--ftt-olive);
}

/* Market day's gem is a gold star that pulses gently. */
.ftt-tag.is-sale,
.ftt-tag.is-sale .ftt-icon {
  --icon-size: 2.8rem;
  width: 2.8rem;
  height: 2.8rem;
}

.ftt-tag.is-sale .ftt-tag__cost {
  transform: translateY(0.12rem);
}

.ftt-tag.is-sale:not(.is-idle) .ftt-icon {
  animation: ftt-sale 1.6s ease-in-out infinite;
}

@keyframes ftt-sale {
  50% { transform: scale(1.1) rotate(8deg); }
}

/* An animal's speech bubble, with its tail pointing at the animal. */
.ftt-bubble {
  position: absolute;
  top: 0;
  left: 0;
  width: max-content;
  max-width: 13rem;
  margin-top: -14px;
  padding: 0.4rem 0.7rem;
  border: 3px solid var(--ftt-ink);
  border-radius: 12px;
  background: #fffdf3;
  color: var(--ftt-ink);
  box-shadow: 0 3px 0 var(--ftt-ink);
  font: 800 0.9rem/1.25 var(--ftt-font);
  text-align: center;
  will-change: transform, opacity;
}

.ftt-bubble::after {
  content: "";
  position: absolute;
  bottom: -10px;
  left: 50%;
  width: 14px;
  height: 14px;
  border-right: 3px solid var(--ftt-ink);
  border-bottom: 3px solid var(--ftt-ink);
  background: #fffdf3;
  transform: translateX(-50%) rotate(45deg);
}

/* A rubber stamp in red ink, slammed onto the boat. */
.ftt-stamp {
  position: absolute;
  top: 0;
  left: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.95rem 0.35rem 0.6rem;
  border: 4px solid #c63b2a;
  border-radius: 10px;
  background: rgba(255, 253, 243, 0.92);
  box-shadow: inset 0 0 0 3px rgba(255, 253, 243, 0.92), inset 0 0 0 5px #c63b2a, 0 6px 16px rgba(0, 0, 0, 0.3);
  color: #c63b2a;
  font: 800 1.55rem/1 var(--ftt-serif);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
  rotate: -9deg;
  will-change: transform, opacity;
}

.ftt-stamp .ftt-icon {
  --icon-size: 1.8rem;
  order: -1;
}

/* Another turn in the black. */
.ftt-ribbon {
  position: absolute;
  top: calc(var(--ftt-top-edge, 4rem) + 0.9rem);
  left: 50%;
  z-index: 12;
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 1.15rem 0.5rem 0.6rem;
  border: 3px solid var(--ftt-ink);
  border-radius: 12px;
  background: var(--ftt-paper);
  box-shadow: 0 4px 0 var(--ftt-ink), var(--ftt-shadow);
  transform: translateX(-50%);
  animation: ftt-ribbon-in 0.45s cubic-bezier(0.2, 1.4, 0.4, 1);
  transition: opacity 0.5s ease, transform 0.5s ease;
  pointer-events: none;
}

.ftt-ribbon .ftt-icon {
  --icon-size: 2.7rem;
}

.ftt-ribbon__count {
  font-family: var(--ftt-serif);
  font-size: 2.3rem;
  line-height: 1;
  animation: ftt-count 0.6s ease;
}

.ftt-ribbon__words {
  display: grid;
}

.ftt-ribbon__title {
  font-size: 1.05rem;
  font-weight: 800;
}

.ftt-ribbon__sub {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ftt-muted);
}

.ftt-ribbon.is-big {
  background: var(--ftt-lime);
}

.ftt-ribbon.is-big .ftt-ribbon__sub {
  color: var(--ftt-ink);
}

.ftt-ribbon.is-leaving {
  opacity: 0;
  transform: translate(-50%, -8px);
}

@keyframes ftt-ribbon-in {
  from { opacity: 0; transform: translate(-50%, -14px) scale(0.9); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

@keyframes ftt-count {
  0% { opacity: 0; transform: translateY(8px) scale(0.6); }
  60% { opacity: 1; transform: translateY(-3px) scale(1.2); }
  100% { transform: none; }
}

.ftt-stat.is-ticking {
  animation: ftt-tick 0.6s cubic-bezier(0.2, 1.5, 0.4, 1);
}

@keyframes ftt-tick {
  40% { transform: scale(1.22) rotate(-4deg); }
}

.ftt-stat.is-quiet .ftt-icon {
  opacity: 0.6;
  filter: grayscale(0.7);
}

.ftt-stat.is-full .ftt-stat__value {
  color: #8a6410;
}

.ftt-confetti {
  position: fixed;
  inset: 0;
  z-index: 90;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
}

/* Tomorrow's Almanac card, at the top of the farm drawer. */
.ftt-forecast {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  margin: 0;
  padding: 0.55rem 0.75rem;
  border: 2px solid rgba(176, 137, 26, 0.45);
  border-radius: 10px;
  background: #fbf1cd;
  color: var(--ftt-ink);
  text-align: left;
  cursor: pointer;
}

.ftt-forecast__glyph {
  background: var(--ftt-lime);
}

.ftt-forecast__words {
  display: grid;
}

.ftt-forecast__label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ftt-muted);
}

.ftt-forecast__name {
  font-size: 0.98rem;
}

.ftt-marketday {
  display: grid;
  justify-items: center;
  gap: 0.45rem;
  margin-top: 0.7rem;
  padding: 0.65rem;
  border: 3px solid var(--ftt-ink);
  border-radius: 12px;
  background: #fff3c4;
}

.ftt-marketday__head {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  font-size: 0.9rem;
}

.ftt-marketday__head .ftt-icon {
  --icon-size: 1.5rem;
}

.ftt-offer__was {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ftt-muted);
}

.ftt-almanac__next {
  margin: 0.35rem 0 0;
  font-size: 0.86rem;
  font-weight: 700;
}

.ftt-banner__foot {
  margin: 0.6rem 0 0;
  padding-top: 0.5rem;
  border-top: 2px solid var(--ftt-rule);
  font-size: 0.9rem;
  color: var(--ftt-muted);
}

.ftt-banner__foot strong {
  color: var(--ftt-ink);
}

.ftt-banner--sale {
  background: #fff3c4;
}

.ftt-banner__glyph .ftt-icon {
  --icon-size: 100%;
}

.ftt-flat__sale {
  display: grid;
  justify-items: center;
  padding: 0.3rem;
  border: 3px dashed #8a6410;
  border-radius: 12px;
  background: #fff3c4;
}

/* Small screens: panels become drawers, the bar scrolls. */
@media (max-width: 1100px) {
  :root {
    --ftt-side: min(18rem, 34vw);
  }

  /* The season's icon says the season; the words make room for the Bean Counter. */
  .ftt-turn__season {
    display: none;
  }

  .ftt-counter__goal {
    display: none;
  }

  /* The side panels reach the bottom here, so the credit sits above the dock. */
  .ftt-engine {
    left: 50%;
    right: auto;
    bottom: calc(var(--ftt-dock-edge, 4.8rem) + 0.45rem);
    transform: translateX(-50%);
  }

  .ftt-ticker {
    bottom: calc(var(--ftt-dock-edge, 4.8rem) + 2.3rem);
  }
}

/*
 * Phones: one slim top bar (the logo opens the menu that holds Deck, view,
 * sound and help), two drawer tabs that open one shared sheet, and a single
 * row dock with short labels.
 */
@media (max-width: 760px) {
  .ftt-top {
    top: max(0.5rem, env(safe-area-inset-top));
    left: 0.5rem;
    right: 0.5rem;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.45rem;
    align-items: stretch;
  }

  .ftt-panel__title {
    display: none;
  }

  .ftt-brand__menu {
    padding: 0.3rem 0.45rem;
    border-width: 2px;
    border-radius: 10px;
    box-shadow: 0 2px 0 var(--ftt-ink);
  }

  .ftt-brand__logo {
    width: 42px;
  }

  /* A phone's bar takes two rows: logo, turn, barn, streak and the farm button, then the Bean Counter across the width. */
  .ftt-app:not(.is-flat) .ftt-top {
    flex-wrap: wrap;
  }

  .ftt-app:not(.is-flat) .ftt-brand {
    flex: 1 1 auto;
  }

  .ftt-app:not(.is-flat) .ftt-counter {
    order: 5;
    flex: 1 0 100%;
    max-width: none;
    padding: 1.25rem 0.75rem 0.2rem;
    border-inline: 0;
    border-top: 2px solid var(--ftt-rule);
  }

  .ftt-app:not(.is-flat) .ftt-counter__end {
    font-size: 0.72rem;
  }

  /* One bar on a phone too: logo, turn, beans, barn and the farm button. */
  .ftt-app:not(.is-flat) .ftt-top {
    min-height: 3.3rem;
  }

  .ftt-app:not(.is-flat) .ftt-brand__menu {
    padding: 0.2rem 0.55rem;
  }

  .ftt-app:not(.is-flat) .ftt-turn {
    gap: 0.25rem;
    padding: 0 0.5rem;
  }

  .ftt-turn > .ftt-icon {
    --icon-size: 1.6rem;
  }

  .ftt-turn__number {
    font-size: 0.85rem;
    white-space: nowrap;
  }

  /* A phone keeps the turn to its number beside the season's icon. */
  .ftt-turn__words {
    display: none;
  }

  .ftt-turn__short {
    display: block;
    font-family: var(--ftt-serif);
    font-size: 1.15rem;
  }

  .ftt-app:not(.is-flat) .ftt-resources {
    padding: 0;
  }

  .ftt-stat {
    column-gap: 0.2rem;
    padding: 0 0.4rem;
  }

  .ftt-stat .ftt-icon {
    --icon-size: 1.45rem;
  }

  .ftt-stat__value {
    font-size: 0.95rem;
  }

  .ftt-stat__label {
    font-size: 0.56rem;
  }

  .ftt-app.is-flat .ftt-resources {
    display: none;
  }

  .ftt-app:not(.is-flat) .ftt-top .ftt-panel__toggle {
    min-width: 3.3rem;
    padding: 0.15rem 0.45rem;
    font-size: 0.64rem;
  }

  .ftt-panel__toggle .ftt-icon {
    --icon-size: 1.5rem;
  }

  /* Open, the farm drawer is a full width sheet under the bar. */
  .ftt-app:not(.is-flat) .ftt-panel--farm:not(.is-collapsed) {
    top: calc(var(--ftt-top-edge, 3.3rem) + 0.4rem);
    left: 0.5rem;
    right: 0.5rem;
    width: auto;
    max-height: calc(100% - var(--ftt-top-edge, 3.3rem) - var(--ftt-dock-edge, 4.6rem) - 1rem);
    border-width: 2px;
  }

  .ftt-app:not(.is-flat) .ftt-panel--farm .ftt-panel__title {
    display: block;
  }

  .ftt-details {
    padding: 0.6rem 0.7rem 0.8rem;
    border-width: 2px;
  }

  .ftt-detail {
    padding: 0.35rem 0.45rem;
  }

  .ftt-detail__icon {
    --icon-size: 1.5rem;
  }

  .ftt-detail__value {
    font-size: 0.85rem;
  }

  .ftt-tag,
  .ftt-tag .ftt-icon {
    width: 1.9rem;
    height: 1.9rem;
    --icon-size: 1.9rem;
  }

  .ftt-tag__cost {
    font-size: 0.82rem;
  }

  /* The title screen deals the farmers into a hand you can swipe. */
  .ftt-dialog--title .ftt-dialog__body {
    grid-template-columns: minmax(0, 1fr);
    align-content: start;
    gap: 0.7rem;
    padding-bottom: 0;
  }

  .ftt-setup__logo {
    width: 64px;
  }

  .ftt-setup__title {
    font-size: 2.5rem;
  }

  .ftt-setup__lede {
    font-size: 0.9rem;
  }

  .ftt-setup__heading {
    margin-bottom: 0.2rem;
    font-size: 1.05rem;
  }

  .ftt-mode {
    padding: 0.5rem 0.7rem;
  }

  .ftt-mode .ftt-icon {
    --icon-size: 2.1rem;
  }

  .ftt-mode__text {
    font-size: 0.8rem;
  }

  /* Start stays in reach at the foot of the screen, over everything that scrolls under it. */
  .ftt-setup__actions {
    position: sticky;
    bottom: 0;
    z-index: 3;
    flex-wrap: nowrap;
    gap: 0.6rem;
    width: calc(100% + 2rem);
    padding: 1.6rem 1rem max(0.9rem, env(safe-area-inset-bottom));
    background: linear-gradient(180deg, rgba(12, 18, 9, 0), rgba(12, 18, 9, 0.95) 1.4rem);
  }

  .ftt-dialog .ftt-setup__start {
    flex: 1 1 auto;
    min-width: 0;
  }

  .ftt-dialog .ftt-setup__help {
    flex: none;
    padding: 0.5rem 0.9rem;
    font-size: 1rem;
  }

  .ftt-setup__perk {
    max-width: 19rem;
    font-size: 0.9rem;
  }

  /* The hand runs to the screen edges so the side cards slide off the glass. */
  .ftt-hand {
    width: calc(100% + 2rem);
    max-width: 100vw;
    height: calc(var(--hand-card) * 1.4 + 2.2rem);
    margin-inline: -1rem;
  }

  .ftt-setup__modes {
    grid-template-columns: minmax(0, 1fr);
  }


  .ftt-counter {
    width: 100%;
    padding: 0.35rem 0.75rem 0.45rem;
  }

  .ftt-counter__track {
    height: 20px;
    margin: 0.3rem 0.25rem 0.15rem;
  }

  /* Phones get the sheet without the board behind it. */
  .ftt-panel {
    top: calc(var(--ftt-top-edge, 5.2rem) + 0.45rem);
    bottom: auto;
    width: calc(50% - 0.725rem);
    max-height: calc(100% - var(--ftt-top-edge, 5.2rem) - var(--ftt-dock-edge, 4.6rem) - 1.4rem);
    padding: 0;
    border-radius: 12px;
    background: var(--ftt-paper);
  }

  .ftt-panel::before {
    display: none;
  }

  .ftt-panel__body {
    border: 0;
    border-radius: 0;
  }

  .ftt-panel--farm {
    left: 0.5rem;
  }

  .ftt-panel--market {
    right: 0.5rem;
  }

  .ftt-panel:not(.is-collapsed) {
    left: 0.5rem;
    right: 0.5rem;
    z-index: 2;
    width: auto;
  }

  .ftt-panel.is-collapsed .ftt-panel__body {
    display: none;
  }

  .ftt-panel__toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    width: 100%;
    min-height: 2.6rem;
  }

  .ftt-panel__toggle::after {
    content: "";
    flex: none;
    width: 0.5rem;
    height: 0.5rem;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: translateY(-0.15rem) rotate(45deg);
    transition: transform 0.2s ease;
  }

  .ftt-panel__toggle[aria-expanded="true"]::after {
    transform: translateY(0.1rem) rotate(-135deg);
  }

  .ftt-panel__body {
    padding-top: 0.2rem;
  }

  .ftt-market {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ftt-actions {
    left: 0.5rem;
    right: 0.5rem;
    bottom: max(0.5rem, env(safe-area-inset-bottom));
    transform: none;
    width: auto;
    max-width: none;
    gap: 0.3rem;
    padding: 0.5rem;
    border-radius: 22px;
  }

  .ftt-actions .ftt-action {
    flex: 1 1 0;
    width: auto;
    min-width: 0;
    min-height: 3.8rem;
    padding: 0.35rem 0.15rem 0.25rem;
  }

  .ftt-action__icon {
    --icon-size: 1.7rem;
  }

  .ftt-action__short {
    font-size: 0.72rem;
  }

  .ftt-pip {
    --icon-size: 1.1rem;
  }

  .ftt-dialog:not(.ftt-dialog--title, .ftt-dialog--menu) {
    width: calc(100vw - 1rem);
    max-height: calc(100dvh - 1rem);
    border-radius: 22px;
  }

  /* Rows put their button underneath; footers share the width. */
  .ftt-row {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.6rem 0.75rem;
    padding: 0.7rem 0.8rem;
  }

  .ftt-row > .ftt-button {
    grid-column: 1 / -1;
    width: 100%;
  }

  .ftt-row--load {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .ftt-row__icon {
    --icon-size: 2rem;
  }

  .ftt-dialog__actions .ftt-button {
    flex: 1 1 auto;
    min-width: 0;
  }

  .ftt-loadsum {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ftt-loadsum__total {
    grid-column: 1 / -1;
  }

  .ftt-over__beans {
    font-size: 2.8rem;
  }

  .ftt-dialog--menu .ftt-dialog__body,
  .ftt-dialog--menu .ftt-dialog__body:has(.ftt-menu__screen--help, .ftt-menu__screen--settings) {
    width: calc(100% - 1rem);
    max-height: calc(100dvh - 1rem);
    border-width: 3px;
  }

  .ftt-menu__brand {
    padding: 0.9rem 1rem 0.7rem;
  }

  .ftt-menu__logo {
    width: 56px;
  }

  .ftt-dialog .ftt-menu__name {
    font-size: 1.5rem;
  }

  .ftt-menu__item {
    padding: 0.45rem 0.6rem;
  }

  .ftt-menu__item .ftt-icon {
    --icon-size: 1.8rem;
  }

  .ftt-menu__label {
    font-size: 1.05rem;
  }

  .ftt-menu__head {
    gap: 0.6rem;
    padding: 0.6rem 0.75rem;
  }

  .ftt-menu__titles .ftt-icon {
    --icon-size: 1.8rem;
  }

  .ftt-settings {
    padding: 0.2rem 0.85rem;
  }

  .ftt-setting,
  .ftt-setting--range {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.55rem;
  }

  .ftt-setting--toggle {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .ftt-segment {
    justify-self: start;
  }

  .ftt-menu__help,
  .ftt-keys__list {
    grid-template-columns: minmax(0, 1fr);
  }

  .ftt-menu__help {
    padding: 0.8rem;
  }

  .ftt-keys {
    margin: 0.2rem 0.85rem 0.9rem;
  }

  .ftt-menu__foot {
    padding: 0.7rem 0.75rem;
  }

  .ftt-menu__buttons {
    flex: 1;
  }

  .ftt-menu__buttons .ftt-button {
    flex: 1;
    min-width: 0;
  }

  .ftt-ribbon {
    width: max-content;
    max-width: calc(100vw - 1rem);
  }

  .ftt-pips {
    margin: 0 0.05rem;
  }

  .ftt-pips__row {
    flex-direction: column;
    gap: 0;
  }

  .ftt-pips__label {
    display: none;
  }

  .ftt-actions__wait {
    white-space: normal;
  }

  .ftt-toasts {
    top: auto;
    bottom: calc(var(--ftt-dock-edge, 4.6rem) + 4.2rem);
  }

  .ftt-inspect {
    grid-template-columns: 1fr;
  }

  .ftt-board2d {
    inset: calc(var(--ftt-top-edge, 5.2rem) + 3.6rem) 0.5rem calc(var(--ftt-dock-edge, 4.6rem) + 0.5rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ftt-splash__shot,
  .ftt-loadbar__fill,
  .ftt-loadbar__bean {
    animation: none;
  }

  .ftt-counter__token,
  .ftt-toast,
  .ftt-banner,
  .ftt-splash,
  .ftt-dialog[open],
  .ftt-dialog__close {
    transition: none;
    animation: none;
  }
}

/* Preserve the two word phrase at the end of the game title. */
.ftt-title-pair { white-space: nowrap; }
