/* Seed Finder panel.
 *
 * css/tool-theme.css loads AFTER this file and re-skins widgets by class-name fragments, so the
 * names here avoid the fragments it claims for something else: no "result" / "output" / "-out"
 * (monospace boxes), no "tab" (tab chips), no "copy" on a button (primary green). Rules that must
 * beat its generic button rule — (1,2,1) — are written `#tool-root #sfd …`, two ids, which wins
 * on specificity whatever the load order; a single-id rule here would tie and lose. See CLAUDE.md,
 * "The generic button rule has claimed three widgets now".
 */

#sfd { display: block; }
#sfd [hidden] { display: none !important; }   /* a display rule beats [hidden]; see CLAUDE.md */

#sfd .sfd-label {
  display: block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-bottom: 5px;
}
#sfd .sfd-field { display: block; min-width: 0; }
#sfd input[type="text"],
#sfd input[type="number"],
#sfd input[type="search"],
#sfd select { width: 100%; min-width: 0; }

/* ---- top row ---------------------------------------------------------------------------- */
#sfd .sfd-top {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  align-items: end;
}
#sfd .sfd-xz { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
#sfd .sfd-vnote { margin: 10px 0 0; font-size: 13px; line-height: 1.5; color: var(--fg-muted); }

/* ---- conditions ------------------------------------------------------------------------- */
#sfd .sfd-conds { margin-top: 18px; display: flex; flex-direction: column; gap: 10px; }
#sfd .sfd-cond {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
#sfd .sfd-condhead { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
#sfd .sfd-kind { font-weight: 800; font-size: 14px; color: var(--fg); flex: 1 1 auto; min-width: 0; }
#sfd .sfd-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  align-items: end;
}
#sfd .sfd-wide { grid-column: 1 / -1; }
#sfd .sfd-cost { margin: 8px 0 0; font-size: 12.5px; color: var(--fg-muted); }

/* The biome chooser: a native <details>, so it opens with the keyboard and needs no positioning.
 * It sits in the flow — a floating popover inside a card is how panels end up clipped. */
#sfd .sfd-pick { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); }
#sfd .sfd-pick > summary {
  cursor: pointer;
  padding: 8px 10px;
  font-size: 14px;
  color: var(--fg);
  overflow-wrap: anywhere;
}
#sfd .sfd-pick[open] > summary { border-bottom: 1px solid var(--line); }
#sfd .sfd-pickbody { padding: 10px; }
#sfd .sfd-picklist {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 2px 12px;
  max-height: 240px;
  overflow-y: auto;
  margin-top: 8px;
}
#sfd .sfd-picklist label { display: flex; align-items: center; gap: 7px; font-size: 13.5px; padding: 3px 0; min-width: 0; }
#sfd .sfd-picklist label span { overflow-wrap: anywhere; }

/* ---- add / run -------------------------------------------------------------------------- */
#sfd .sfd-add { margin-top: 14px; }
#sfd .sfd-addrow { display: flex; flex-wrap: wrap; gap: 6px; }
#sfd .sfd-run { margin-top: 18px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
#sfd .sfd-inline { display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; color: var(--fg-muted); }
#sfd .sfd-inline select { width: auto; }
#sfd .sfd-status { margin: 10px 0 0; min-height: 1.4em; font-size: 13.5px; line-height: 1.5; color: var(--fg-muted); }
#sfd .sfd-say { margin: 10px 0 0; min-height: 1.2em; font-size: 13px; color: var(--fg-muted); }

#tool-root #sfd button {
  padding: 7px 12px;
  font-size: 13.5px;
  line-height: 1.2;
}
#tool-root #sfd button.sfd-go {
  padding: 9px 22px;
  font-size: 15px;
  font-weight: 800;
  background: var(--grass-deep);
  border-color: var(--line-strong);
  color: var(--grass-bright);
}
#tool-root #sfd button.sfd-halt { padding: 9px 22px; font-size: 15px; font-weight: 800; }
#tool-root #sfd button.sfd-x {
  padding: 3px 9px;
  font-size: 13px;
  font-weight: 700;
  color: var(--fg-muted);
  flex: 0 0 auto;
}

/* ---- matches ---------------------------------------------------------------------------- */
#sfd .sfd-found { margin-top: 20px; padding: 14px; }
#sfd .sfd-foundbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; justify-content: space-between; }
#sfd .sfd-foundacts { display: flex; flex-wrap: wrap; gap: 6px; }
#sfd .sfd-h2 { margin: 0; font-size: 17px; font-weight: 800; color: var(--fg); }
#sfd .sfd-list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
#sfd .sfd-hit { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; background: var(--surface-2); min-width: 0; }
#sfd .sfd-hithead { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
#sfd .sfd-num { font-size: 12px; font-weight: 800; color: var(--fg-muted); min-width: 1.6em; }
#tool-root #sfd .sfd-seed {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 700;
  padding: 2px 7px;
  overflow-wrap: anywhere;
  color: var(--fg);
}
#sfd .sfd-maplink {
  margin-left: auto;
  font-size: 13.5px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
#sfd .sfd-maplink:hover { text-decoration: underline; }
#sfd .sfd-facts { list-style: none; margin: 8px 0 0; padding: 0; font-size: 14px; line-height: 1.55; }
#sfd .sfd-facts li { padding: 2px 0; overflow-wrap: anywhere; }
#sfd .sfd-facts b { font-weight: 700; color: var(--fg); }
#sfd .sfd-facts a { text-decoration: none; border-bottom: 1px dotted currentColor; }

/* Coordinates, seeds and distances are signed numbers inside what may be a right-to-left page.
 * Each sits in its own dir="ltr" element, which the UA isolates, so "-280" can never paint as
 * "280-" (CLAUDE.md, "Right-to-left is where this project keeps being wrong"). */
#sfd [dir="ltr"] { unicode-bidi: isolate; direction: ltr; }

/* ---- help ------------------------------------------------------------------------------- */
#sfd .sfd-help { margin-top: 28px; max-width: 76ch; font-size: 14.5px; line-height: 1.65; }
#sfd .sfd-help p { margin: 10px 0 0; }

@media (max-width: 560px) {
  #sfd .sfd-maplink { margin-left: 0; }
}
