/* Choosing a practice field.
 *
 * A full page rather than a dropdown, because there are thirty-five fields
 * and a dropdown of thirty-five names tells a learner nothing about any of
 * them. What decides which one you want is what it LOOKS like — and every
 * one of these can draw itself, so every one of them shows itself.
 *
 * Its own stylesheet: the page is self-contained, it is shown over the
 * whole application, and nothing else uses any of these classes.
 */

.field-setup {
  --fs-ink: var(--ink, #231f20);
  --fs-muted: var(--muted, #7a736d);
  --fs-line: var(--line, #e6e1da);
  --fs-surface: var(--surface, #ffffff);
  /* --bg and --accent are real tokens now (styles.css); the fallbacks are
   * only for a page mounted without the app's stylesheet. */
  --fs-page: var(--bg, #faf8f5);
  --fs-accent: var(--accent, #e2571f);
  --fs-accent-soft: #fdefe7;

  position: fixed;
  /* BELOW THE APPLICATION'S OWN HEADER, not over it. The logo, the connection
   * state and the sign-in button stay where they are — a full-screen page
   * that hides the chrome makes the learner feel they have left the
   * application rather than opened a page of it, and there is nowhere to
   * put a way back that is as good as the one already up there.
   *
   * The height is the same variable the workspace measures itself against,
   * written from script off the header's real height rather than guessed. */
  top: var(--xp-chrome-height, 64px);
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  overflow: auto;
  padding: 0 clamp(16px, 4vw, 56px) 40px;
  background: var(--fs-page);
  color: var(--fs-ink);
}
.field-setup[hidden] { display: none; }

/* --------------------------------------------------------------- the top */

.fs-top {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 64px;
  padding-top: 18px;
}

.fs-back {
  position: absolute;
  left: 0;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 4px;
  border: 0;
  background: none;
  color: var(--fs-ink);
  font: inherit;
  font-size: 15px;
  cursor: pointer;
}
.fs-back:hover { color: var(--fs-accent); }
.fs-back svg { width: 18px; height: 18px; }

.fs-pill {
  padding: 7px 18px;
  border: 1px solid var(--fs-accent);
  border-radius: 999px;
  color: var(--fs-accent);
  font-size: 13.5px;
  font-weight: 600;
  background: var(--fs-surface);
}

.fs-head { text-align: center; margin: 14px 0 26px; }
.fs-head h1 {
  margin: 0;
  font-size: clamp(30px, 4vw, 44px);
  font-weight: 800;
  letter-spacing: -0.02em;
}
.fs-head p { margin: 8px 0 0; color: var(--fs-muted); font-size: 16px; }

/* ------------------------------------------------------------- the layout
 *
 * The list and the panel. The panel is a fixed column because it holds one
 * thing at a fixed size, and the list takes what is left — the opposite
 * would make the cards jump about as the panel's contents changed. */

.fs-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 348px;
  gap: 26px;
  align-items: start;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
}

/* ------------------------------------------------------------ the search */

.fs-search {
  position: relative;
  margin-bottom: 16px;
}
.fs-search svg {
  position: absolute;
  left: 16px;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  color: var(--fs-muted);
  pointer-events: none;
}
.fs-search input {
  width: 100%;
  padding: 14px 16px 14px 46px;
  border: 1px solid var(--fs-line);
  border-radius: 12px;
  background: var(--fs-surface);
  color: inherit;
  font: inherit;
  font-size: 15px;
}
.fs-search input:focus {
  outline: none;
  border-color: var(--fs-accent);
  box-shadow: 0 0 0 3px var(--fs-accent-soft);
}

/* ------------------------------------------------------------- the chips */

.fs-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}
.fs-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border: 1px solid var(--fs-line);
  border-radius: 999px;
  background: var(--fs-surface);
  color: var(--fs-ink);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}
.fs-chip:hover { border-color: #cfc8bf; }
.fs-chip[aria-pressed="true"] {
  border-color: var(--fs-accent);
  background: var(--fs-accent-soft);
  color: var(--fs-accent);
  font-weight: 600;
}
.fs-chip-count { color: var(--fs-muted); font-variant-numeric: tabular-nums; }
.fs-chip[aria-pressed="true"] .fs-chip-count { color: var(--fs-accent); }

/* ------------------------------------------------------------- the cards */

.fs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(232px, 1fr));
  gap: 18px;
}

.fs-card {
  display: flex;
  flex-direction: column;
  padding: 14px;
  border: 1px solid var(--fs-line);
  border-radius: 16px;
  background: var(--fs-surface);
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
  transition: border-color 0.14s ease, box-shadow 0.14s ease,
              transform 0.14s ease;
}
.fs-card:hover {
  border-color: #cfc8bf;
  box-shadow: 0 6px 18px rgba(35, 31, 32, 0.07);
  transform: translateY(-1px);
}
.fs-card[aria-pressed="true"] {
  border-color: var(--fs-accent);
  box-shadow: 0 0 0 2px var(--fs-accent-soft);
}
.fs-card:focus-visible {
  outline: 2px solid var(--fs-accent);
  outline-offset: 2px;
}

.fs-thumb {
  border-radius: 10px;
  background: #f4f1ec;
  overflow: hidden;
}
.fs-thumb svg { display: block; width: 100%; height: auto; }

.fs-tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 12px 0 0;
  font-size: 12.5px;
  font-weight: 600;
}
.fs-tag-dot {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 10px;
}
.fs-tag[data-colour="violet"] { color: #7b52c9; }
.fs-tag[data-colour="violet"] .fs-tag-dot { background: #efe7fb; }
.fs-tag[data-colour="green"]  { color: #2f9e57; }
.fs-tag[data-colour="green"] .fs-tag-dot  { background: #e4f5ea; }
.fs-tag[data-colour="blue"]   { color: #2f74c9; }
.fs-tag[data-colour="blue"] .fs-tag-dot   { background: #e6f0fb; }
.fs-tag[data-colour="orange"] { color: #d0561d; }
.fs-tag[data-colour="orange"] .fs-tag-dot { background: var(--fs-accent-soft); }

.fs-card h3 {
  margin: 8px 0 0;
  font-size: 17px;
  font-weight: 700;
}
.fs-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
}
.fs-kit { color: var(--fs-muted); font-size: 13.5px; }

.fs-level {
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}
.fs-level[data-level="Beginner"]     { background: #e4f5ea; color: #1f7a43; }
.fs-level[data-level="Intermediate"] { background: #fdf0dc; color: #a76a12; }
.fs-level[data-level="Advanced"]     { background: #fbe4e2; color: #b3352a; }

/* ------------------------------------------------------------- the footer */

.fs-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 20px;
  color: var(--fs-muted);
  font-size: 14px;
}
.fs-more {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: none;
  color: var(--fs-ink);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.fs-more:hover { color: var(--fs-accent); }
.fs-more[hidden] { display: none; }

.fs-empty {
  grid-column: 1 / -1;
  padding: 40px 20px;
  border: 1px dashed var(--fs-line);
  border-radius: 16px;
  color: var(--fs-muted);
  text-align: center;
}

/* ------------------------------------------------------- the chosen field */

.fs-panel {
  position: sticky;
  top: 18px;
  padding: 20px;
  border: 1px solid var(--fs-line);
  border-radius: 18px;
  background: var(--fs-surface);
  box-shadow: 0 8px 26px rgba(35, 31, 32, 0.05);
}

.fs-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.fs-panel-head h2 { margin: 0; font-size: 17px; font-weight: 700; }
.fs-check {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--fs-accent);
  color: #fff;
}
.fs-check svg { width: 15px; height: 15px; }

.fs-panel-thumb {
  border: 1px solid var(--fs-line);
  border-radius: 12px;
  background: #f4f1ec;
  overflow: hidden;
}
.fs-panel-thumb svg { display: block; width: 100%; height: auto; }

.fs-panel h3 { margin: 14px 0 0; font-size: 20px; font-weight: 750; }

.fs-facts { margin: 14px 0 0; border-top: 1px solid var(--fs-line); }
.fs-fact {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid var(--fs-line);
  font-size: 14px;
}
.fs-fact svg {
  width: 16px; height: 16px;
  align-self: center;
  color: var(--fs-muted);
  flex: none;
}
.fs-fact-name { color: var(--fs-ink); }
.fs-fact-value { margin-left: auto; text-align: right; font-weight: 600; }
.fs-fact-note {
  display: block;
  color: var(--fs-muted);
  font-size: 12.5px;
  font-weight: 400;
  font-style: italic;
}

.fs-panel h4 {
  margin: 16px 0 10px;
  font-size: 15px;
  font-weight: 700;
}

.fs-kit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.fs-kit-box {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 12px;
  border: 1px solid var(--fs-line);
  border-radius: 11px;
  font-size: 13.5px;
  cursor: pointer;
}
.fs-kit-box:hover { border-color: #cfc8bf; }
.fs-kit-box:has(input:checked) {
  border-color: var(--fs-accent);
  background: var(--fs-accent-soft);
  font-weight: 600;
}
.fs-kit-box input {
  width: 17px; height: 17px;
  accent-color: var(--fs-accent);
  flex: none;
  margin: 0;
}
/* The wheels are radios rather than checkboxes — one of them, not any of
   them — and `:has(input:checked)` above already tints whichever is on. */
.fs-panel h4 + .fs-kit-grid { margin-bottom: 4px; }

.fs-note { margin: 10px 0 0; color: var(--fs-muted); font-size: 12.5px; }

.fs-actions { display: grid; gap: 10px; margin-top: 16px; }
.fs-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 13px 16px;
  border-radius: 11px;
  font: inherit;
  font-size: 15px;
  font-weight: 650;
  cursor: pointer;
}
.fs-button svg { width: 17px; height: 17px; }
.fs-button-ghost {
  border: 1px solid var(--fs-accent);
  background: var(--fs-surface);
  color: var(--fs-accent);
}
.fs-button-ghost:hover { background: var(--fs-accent-soft); }
.fs-button-solid {
  border: 1px solid var(--fs-accent);
  background: var(--fs-accent);
  color: #fff;
}
.fs-button-solid:hover { filter: brightness(1.06); }
.fs-button:focus-visible {
  outline: 2px solid var(--fs-accent);
  outline-offset: 2px;
}

/* ------------------------------------------------------------- narrower */

@media (max-width: 1020px) {
  .fs-body { grid-template-columns: minmax(0, 1fr); }
  .fs-panel { position: static; order: -1; }
}

/* The dark theme the rest of the application already has. Written as the
 * same variables, so a page that is themed once is themed here too — and
 * the few colours this page invents are given their own dark values rather
 * than being left to glow. */
:root[data-theme="dark"] .field-setup,
.field-setup[data-theme="dark"] {
  --fs-accent-soft: #3a2317;
}
:root[data-theme="dark"] .fs-thumb,
:root[data-theme="dark"] .fs-panel-thumb { background: #2a2724; }
:root[data-theme="dark"] .fs-chip:hover,
:root[data-theme="dark"] .fs-card:hover,
:root[data-theme="dark"] .fs-kit-box:hover { border-color: var(--fs-accent); }
:root[data-theme="dark"] .fs-card:hover { box-shadow: 0 8px 24px rgba(0, 0, 0, .35); }
:root[data-theme="dark"] .fs-tag[data-colour="purple"] { color: #c9b3f5; background: #2a2145; }
:root[data-theme="dark"] .fs-tag[data-colour="green"]  { color: #8fdcab; background: #17331f; }
:root[data-theme="dark"] .fs-tag[data-colour="blue"]   { color: #9cc4f5; background: #172a45; }
:root[data-theme="dark"] .fs-level[data-level="Beginner"]     { background: #17331f; color: #7fd6a1; }
:root[data-theme="dark"] .fs-level[data-level="Intermediate"] { background: #3a2c12; color: #e8bd6a; }
:root[data-theme="dark"] .fs-level[data-level="Advanced"]     { background: #3a1d1a; color: #f0958c; }


/* ------------------------------------------- the setup that used to be here
 *
 * The simulator panel carried the whole of the setup: the challenge, the
 * table, the wheels, the attachment and two checkboxes, in a strip above a
 * 3D view that had no room for them. Every one of those is on the field
 * page now, next to a picture of the field it applies to — which is where
 * a decision about a field belongs.
 *
 * HIDDEN, NOT DELETED, and that is deliberate. Those controls are what the
 * field page WRITES: "Open simulator" sets them and fires their change
 * events, and everything the application does when a challenge changes
 * hangs off exactly that. Removing them would mean a second path into the
 * simulator and a second copy of what a scenario means. They stay in the
 * page as the wiring between the two, and stop being furniture.
 */
/* OUT-RANKING THE SHELL, which places this strip with
 * `#workspace-view.xp-shell .sim-setup` — an id and two classes, which
 * beats a bare id however much later it is loaded. Specificity is not
 * settled by file order and it caught me: the rule was written, the strip
 * still showed, and the DOM said `display: flex`.
 *
 * The `hidden` attribute is not enough on its own either. Something in the
 * shell clears it, and a stylesheet that only works while an attribute
 * happens to be set is a stylesheet waiting to stop working. */
#workspace-view.xp-shell #sim-setup,
#sim-setup { display: none; }
