/* Gamete Factory: the meiosis line, the shipping crate and their panels inside the practice shell's stage. */
.gf { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 8px; padding: 8px 12px 10px; }
.gf-line { flex: none; display: flex; flex-direction: column; gap: 6px; }
.gf-scenebox { position: relative; width: 100%; aspect-ratio: 1040 / 300; border-radius: var(--tlg-radius-lg); overflow: hidden; border: var(--tlg-border-width) solid var(--tlg-border); background: #fff6e6; user-select: none; -webkit-user-select: none; }
.gf-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.gf-scene text { font-family: var(--tlg-font-body, Arial, sans-serif); }
.gf-scene .gf-board { font-size: 17px; font-weight: 800; fill: #ffffff; }
.gf-scene .gf-board-n { font-size: 17px; font-weight: 900; fill: #3a1d00; }
.gf-scene .gf-allele { font-size: 17px; font-weight: 800; fill: #1d1424; }
.gf-scene .gf-tag { font-size: 17px; font-weight: 800; fill: #1d1424; }
.gf-scene .gf-tag.is-mom { fill: #ffffff; }
.gf-scene .gf-stamp { font-size: 20px; font-weight: 900; fill: #b3261e; letter-spacing: .5px; }
.gf-scene .gf-xo-label { font-size: 17px; font-weight: 800; fill: #6a3a00; paint-order: stroke; stroke: #fff8de; stroke-width: 4px; }
.gf-scene .gf-hit { cursor: pointer; }
.gf-scene .gf-hit:hover { fill: rgba(154, 52, 18, .08); }

.gf-bar { display: flex; align-items: center; gap: 10px; min-height: 48px; }
.gf-run { flex: none; min-height: 46px; min-width: 156px; padding: 4px 14px; font: inherit; font-size: 17px; font-weight: var(--tlg-weight-bold); border-radius: var(--tlg-radius-sm);
  border: var(--tlg-border-width-strong) solid var(--ps-accent); background: var(--ps-accent); color: var(--ps-accent-ink, #fff); cursor: pointer; }
.gf-run:disabled { cursor: default; opacity: .6; }
.gf-flips { display: flex; gap: 6px; flex: none; }
.gf-flip, .gf-mini, .gf-step, .gf-chip, .gf-box-name, .gf-box-x { font: inherit; font-size: 16px; font-weight: var(--tlg-weight-bold); color: var(--tlg-text); cursor: pointer;
  border-radius: var(--tlg-radius-sm); border: var(--tlg-border-width-strong) solid var(--tlg-border-strong); background: var(--tlg-surface); }
.gf-flip { min-height: 46px; min-width: 62px; padding: 2px 8px; white-space: nowrap; }
.gf-flip span { font-size: 18px; color: var(--ps-accent); }
html[data-theme="dark"] .gf-flip span { color: inherit; }
.gf-flip:disabled, .gf-mini:disabled, .gf-step:disabled { cursor: default; opacity: .55; }
.gf-xo { display: flex; align-items: center; flex: none; }
.gf-xo-k { font-size: 16px; font-weight: 700; margin-right: 6px; }
.gf-chip { min-height: 44px; padding: 2px 10px; margin-left: -2px; }
.gf-xo .gf-chip:nth-child(2) { border-radius: var(--tlg-radius-sm) 0 0 var(--tlg-radius-sm); margin-left: 0; }
.gf-xo .gf-chip:last-child { border-radius: 0 var(--tlg-radius-sm) var(--tlg-radius-sm) 0; }
.gf-chip[aria-checked="true"] { background: var(--ps-accent); border-color: var(--ps-accent); color: var(--ps-accent-ink, #fff); position: relative; z-index: 1; }
.gf-chip[aria-checked="true"]::before { content: "✓ "; }
.gf-status { flex: 1 1 auto; min-width: 0; margin: 0; font-size: 16px; line-height: 1.25; }
.gf-seen { flex: 0 1 auto; margin: 0; font-size: 16px; line-height: 1.25; text-align: right; max-width: 40%; }
.gf-seen-k { color: var(--tlg-text-muted); }
.gf-seen-chip { display: inline-block; padding: 0 6px; border-radius: 6px; background: #fff1ec; color: #7a1e12; border: 1.5px solid #c75a3c; font-weight: 800; line-height: 1.3; }
html[data-theme="dark"] .gf-seen-chip { background: #3a1f19; color: #ffd8cc; border-color: #d98b73; }

/* the crate */
.gf-crate { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: 188px minmax(0, 1fr) 222px; gap: 10px; }
.gf-crate > * { min-height: 0; border-radius: var(--tlg-radius-lg); border: var(--tlg-border-width) solid var(--tlg-border); background: var(--tlg-surface); padding: 8px 10px; }
.gf-k { margin: 0; font-size: 16px; font-weight: var(--tlg-weight-bold); text-transform: uppercase; letter-spacing: var(--tlg-tracking-caps); color: var(--ps-accent); line-height: 1.2; }
.gf-k--field { display: block; text-transform: none; letter-spacing: 0; color: var(--tlg-text); font-size: 17px; }
html[data-theme="dark"] .gf-k:not(.gf-k--field) { color: var(--tlg-text-muted); }
.gf-tray { display: flex; flex-direction: column; gap: 6px; }
.gf-tiles { display: grid; gap: 6px; }
.gf-tilerow { display: flex; gap: 6px; }
.gf-tile, .gf-chipa { all: unset; box-sizing: border-box; display: inline-grid; place-items: center; font-size: 22px; font-weight: 900; line-height: 1; border-radius: 9px;
  border: 2.5px solid var(--gf-ink); background: var(--gf-bg); color: #1d1424; cursor: grab; box-shadow: 0 2px 0 var(--gf-ink); }
.gf-tile { width: 50px; height: 46px; touch-action: none; }
.gf-tile sup, .gf-chipa sup { font-size: 16px; margin-left: 1px; transform: translateY(-1px); }
.gf-tile:focus-visible, .gf-chipa:focus-visible, .gf-box-name:focus-visible, .gf-box-x:focus-visible, .gf-flip:focus-visible, .gf-mini:focus-visible, .gf-step:focus-visible, .gf-run:focus-visible, .gf-chip:focus-visible, .gf-num:focus-visible { outline: var(--tlg-focus-width) solid var(--tlg-focus); outline-offset: 2px; }
.gf-tile:hover:not(.is-disabled) { filter: brightness(1.05); transform: translateY(-1px); }
.gf-tile.is-picked { outline: 3px dashed var(--ps-accent); outline-offset: 2px; }
.gf-hue0 { --gf-bg: #fde3df; --gf-ink: #8a2a22; }
.gf-hue1 { --gf-bg: #dde9f9; --gf-ink: #1f4f8a; }
.gf-hue2 { --gf-bg: #dff2e1; --gf-ink: #236a30; }
.gf-tile.is-up, .gf-chipa.is-up { font-weight: 900; }
html .pdz-ghost.gf-tile { display: grid; place-items: center; }
.gf-tip { margin: 0; font-size: 16px; line-height: 1.3; }
.gf-tip span { color: var(--tlg-text-muted); }

.gf-boxwrap { display: flex; flex-direction: column; gap: 6px; overflow-y: auto; }
.gf-boxhead { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.gf-boxhead .gf-k { margin-right: auto; }
.gf-mini { min-height: 40px; padding: 2px 10px; }
.gf-mini--ghost { background: transparent; }
.gf-boxes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; align-content: start; }
.gf-box { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 5px 6px 6px; min-height: 96px; border-radius: 12px; border: 2.5px solid #d7b48f; background: #fffaf3; color: #1d1424; cursor: pointer; }
html[data-theme="dark"] .gf-box { background: #2b2420; border-color: #8a6b4c; color: var(--tlg-text); }
.gf-box.is-active { border-color: var(--ps-accent); box-shadow: 0 0 0 2px var(--ps-accent); }
.gf-box.is-over, html.pdz-armed .gf-box.is-over { background: #ffe9db; border-style: solid; }
html.pdz-armed .gf-box { border-style: dashed; }
.gf-box::before { content: ""; position: absolute; right: 7px; bottom: 7px; width: 26px; height: 18px; opacity: .5; background-repeat: no-repeat; background-size: contain; pointer-events: none; }
.gf-box--sperm::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 26 18'%3E%3Cellipse cx='19' cy='9' rx='6' ry='4.5' fill='%23b9d4ef' stroke='%235f86ad' stroke-width='1.5'/%3E%3Cpath d='M13 9q-3 3-6 0t-6 0' fill='none' stroke='%235f86ad' stroke-width='1.5'/%3E%3C/svg%3E"); }
.gf-box--egg::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 26 18'%3E%3Ccircle cx='17' cy='9' r='7' fill='%23fbe7b0' stroke='%23c4972f' stroke-width='1.5'/%3E%3C/svg%3E"); }
.gf-box--pollen::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 26 18'%3E%3Ccircle cx='17' cy='9' r='6' fill='%23f7dc6a' stroke='%23a7801a' stroke-width='1.5' stroke-dasharray='2 1.5'/%3E%3C/svg%3E"); }
.gf-box--ovule::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 26 18'%3E%3Cellipse cx='16' cy='9' rx='8' ry='6' fill='%23e3f0c6' stroke='%235f8a34' stroke-width='1.5'/%3E%3C/svg%3E"); }
.gf-box-top { display: flex; align-items: center; gap: 4px; }
.gf-box-name { flex: 1; min-height: 34px; padding: 0 6px; border: 0; background: transparent; text-align: left; font-size: 16px; }
.gf-box.is-active .gf-box-name { color: var(--ps-accent); }
html[data-theme="dark"] .gf-box.is-active .gf-box-name { color: #ffb38f; }
.gf-box-x { width: 34px; height: 34px; padding: 0; display: grid; place-items: center; font-size: 22px; line-height: 1; }
.gf-chips { display: flex; flex-wrap: wrap; gap: 4px; min-height: 42px; align-items: center; }
.gf-chipa { width: 40px; height: 40px; font-size: 20px; cursor: pointer; }
.gf-empty { font-size: 16px; color: var(--tlg-text-muted); font-style: italic; }
.gf-sink { display: none; }
.gf-boxes.is-many .gf-box { min-height: 88px; }
.gf-box.is-ok { border-color: #2e8b57; box-shadow: 0 0 0 2px #2e8b57; }
.gf-box.is-bad { border-color: #b42318; box-shadow: 0 0 0 2px #b42318; }
.gf-boxmark { position: absolute; right: 6px; top: 4px; font-size: 20px; font-weight: 900; }
.gf-box.is-ok .gf-boxmark { color: #2e8b57; } .gf-box.is-bad .gf-boxmark { color: #b42318; }
html[data-theme="dark"] .gf-box.is-ok .gf-boxmark { color: #7fdca4; } html[data-theme="dark"] .gf-box.is-bad .gf-boxmark { color: #ffb4a8; }
.gf-box--ghost { border-style: dashed; border-color: #b42318; background: transparent; cursor: default; opacity: .9; }
.gf-box--ghost .gf-box-name { color: #b42318; cursor: default; }
html[data-theme="dark"] .gf-box--ghost .gf-box-name { color: #ffb4a8; }
.gf-right { font-size: 16px; font-weight: 800; color: #b42318; }
html[data-theme="dark"] .gf-right { color: #ffb4a8; }

.gf-side { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; }
.gf-geno { margin: 0; font-size: 26px; font-weight: 900; letter-spacing: .5px; line-height: 1.2; }
.gf-geno span { display: block; font-size: 16px; font-weight: 700; letter-spacing: 0; color: var(--tlg-text-muted); }
.gf-stepper, .gf-pctrow { display: flex; align-items: center; gap: 6px; }
.gf-step { width: 46px; height: 46px; padding: 0; font-size: 24px; line-height: 1; }
.gf-num { width: 100%; min-width: 0; height: 46px; box-sizing: border-box; padding: 2px 8px; font: inherit; font-size: 24px; font-weight: 800; text-align: center; font-variant-numeric: tabular-nums;
  border-radius: var(--tlg-radius-sm); border: var(--tlg-border-width-strong) solid var(--tlg-border-strong); background: var(--tlg-surface); color: var(--tlg-text); }
.gf-stepper .gf-num { flex: 1; }
.gf-pctrow .gf-num { flex: 1; max-width: 120px; }
.gf-pctrow--box { margin-top: auto; }
.gf-pctrow--box .gf-num { height: 38px; font-size: 18px; max-width: none; }
.gf-pctsign { font-size: 18px; font-weight: 800; }
.gf-mark { margin: 0; font-size: 16px; font-weight: 800; }
.gf-mark.is-ok { color: #2e8b57; } .gf-mark.is-bad { color: #b42318; }
html[data-theme="dark"] .gf-mark.is-ok { color: #7fdca4; } html[data-theme="dark"] .gf-mark.is-bad { color: #ffb4a8; }
.gf-msg { margin: 0; min-height: 1.2em; font-size: 16px; font-weight: 700; color: var(--tlg-danger, #b42318); }
html[data-theme="dark"] .gf-msg { color: #ffb4a8; }

/* count orders: no tiles or boxes */
.gf--count .gf-crate { grid-template-columns: minmax(0, 420px); justify-content: center; }
/* no meiosis line (params.showMeiosis false): a taller crate */
.gf--noline .gf-boxes { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.gf--noline .gf-box { min-height: 120px; }
.gf.is-locked .gf-tile { cursor: default; opacity: .7; }
.gf.is-locked .gf-box { cursor: default; }

/* Briefing example */
.gf-ex { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.gf-ex-fig { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.gf-ex-svg { width: 100%; height: auto; aspect-ratio: 328 / 230; border-radius: 12px; background: #fff6e6; border: 1px solid var(--tlg-border); }
.gf-ex-fig figcaption { font-size: 16px; text-align: center; }
.ps-brief--drawer .gf-ex { grid-template-columns: 1fr; }
.gf-start-art { width: 100%; height: 100%; }

@media (prefers-reduced-motion: reduce) { html .pdz-ghost.is-back { transition: none; } .gf-tile:hover { transform: none; } }
@media (max-width: 1100px) { .gf-crate { grid-template-columns: 170px minmax(0, 1fr) 200px; } .gf-seen { max-width: 34%; } }
@media (max-width: 900px) {
  .gf { position: relative; inset: auto; }
  .gf-bar { flex-wrap: wrap; }
  .gf-seen { max-width: none; text-align: left; }
  .gf-crate { grid-template-columns: 1fr; }
  .gf-boxes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gf-ex { grid-template-columns: 1fr; }
}
/* The assignment card (bottom-right during play) would cover the count / percent fields: move it to the foot of
   the customer column instead. */
@media (min-width: 901px) {
  html.ps-locked:has(.gf) .lga-card { right: auto; left: 12px; }
  html.ps-locked:has(.gf):has(.lga-card) .ps-side { padding-bottom: 84px; }
}
/* superscripts (X-linked alleles) never drop below 16 px */
.gf sup { font-size: 16px; line-height: 0; }
.gf-tray.is-three .gf-tiles { grid-template-columns: repeat(3, auto); justify-content: start; gap: 5px; }
.gf-tray.is-three .gf-tilerow { flex-direction: column; gap: 5px; }
