/* Allele Basics Bakery: the order ticket + answer chips, and the bakery scene inside the practice shell's stage.
 * Scene overlays are placed in % of the 720 × 620 scene (art.js draws the backdrop in the same units). */
.ab { position: absolute; inset: 0; display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 10px; padding: 8px 12px; color: var(--tlg-text, #1d2430); }
.ab-panel { display: flex; flex-direction: column; gap: 10px; min-height: 0; overflow-y: auto; padding: 2px; }
.ab-ticket { padding: 8px 12px 10px; border-radius: var(--tlg-radius-lg, 14px); border: 2px dashed #c99a6b; background: #fffaf0; color: #2b2018; }
.ab-ticket-k { margin: 0 0 4px; font-size: 16px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: #9b2f55; }
.ab-given { margin: 0; padding-left: 18px; display: grid; gap: 4px; font-size: 16px; line-height: 1.35; }
html[data-theme="dark"] .ab-ticket { background: #2c2219; color: #f4e8d6; border-color: #8a6a48; }
html[data-theme="dark"] .ab-ticket-k { color: #f39ab9; }

.ab-field-k { margin: 0 0 6px; font-size: 16px; font-weight: 700; }
.ab-chips { display: grid; grid-template-columns: 1fr; gap: 8px; }
.ab-chips--trait.ab-chips--n2 { grid-template-columns: 1fr 1fr; }
.ab-chips--n3 { grid-template-columns: repeat(3, 1fr); }
.ab-chips--chance { grid-template-columns: 1fr 1fr; }
.ab-chips--chance.ab-chips--n5 { grid-template-columns: repeat(5, 1fr); gap: 6px; }
.ab-chips--chance.ab-chips--n5 .ab-chip { padding: 6px 2px; }
.ab-chips--chance.ab-chips--n5 .ab-dots { display: grid; grid-template-columns: repeat(2, 14px); gap: 3px; }
.ab-chips--words.ab-chips--n4 { grid-template-columns: 1fr 1fr; }
.ab-chip-g { font-family: Georgia, "Times New Roman", serif; font-size: 22px; }
.ab-chip sup, .ab-given sup, .ab-card-rule sup, .ab-stamp sup, .ab-corner sup, .ab-cup-g sup, .ab-spot sup, .ab-tile sup { font-size: max(16px, .7em); line-height: 0; }
.ab-chip { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 48px; padding: 6px 8px; font-size: 16px; line-height: 1.2; border-radius: var(--tlg-radius-sm, 10px); white-space: normal; text-align: center; }
.ab-chip-t { font-weight: 800; font-size: 17px; }
.ab-chip-s { font-size: 16px; font-weight: 400; opacity: .9; }
.ab-chip-bun { display: block; width: 72px; height: 54px; }
.ab-chip-bun svg { width: 100%; height: 100%; display: block; }
.ab-chip[aria-checked="true"] { outline: 3px solid #9b2f55; outline-offset: 1px; }
.ab-chip[aria-checked="true"] .ab-chip-t::before { content: '✓ '; }
.ab-chip:disabled { cursor: default; }
.ab-dots { display: inline-flex; gap: 4px; }
.ab-dots i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; display: inline-block; }
.ab-dots i.on { background: currentColor; }
.ab-msg { margin: 0; min-height: 1.2em; font-size: 16px; font-weight: 700; color: var(--tlg-danger, #b42318); }
html[data-theme="dark"] .ab-msg { color: #ffb4a8; }

/* ── the bakery ── */
.ab-view { position: relative; min-width: 0; min-height: 0; display: flex; align-items: flex-start; justify-content: center; }
.ab-scene { position: relative; width: 100%; aspect-ratio: 720 / 620; border-radius: var(--tlg-radius-lg, 14px); overflow: hidden; border: var(--tlg-border-width, 1px) solid var(--tlg-border, #c9b9a0); user-select: none; -webkit-user-select: none; background: #c98f6b; }
.ab-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.ab-svgtext { font-family: system-ui, sans-serif; }
html[data-theme="dark"] .ab-wall { fill: url(#ab-brick-dark); }
html[data-theme="dark"] .ab-scene { background: #3a2a24; }

.ab-board { position: absolute; left: 2.5%; top: 2.3%; width: 39%; padding: 8px 12px 10px; border-radius: 10px; background: #2f3a33; color: #f3efe2; border: 6px solid #8a5a31; box-shadow: 0 4px 10px rgba(0, 0, 0, .3); font-size: 16px; line-height: 1.3; }
.ab-board p { margin: 0 0 4px; }
.ab-board p:last-child { margin-bottom: 0; }
.ab-board-k { font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: #ffe08a; }

.ab-card { position: absolute; left: 2.5%; top: 37%; width: 39%; padding: 8px 12px 10px; border-radius: 12px; background: #fffaf0; color: #2b2018; border: 3px solid #7a4d2a; box-shadow: 0 5px 12px rgba(0, 0, 0, .28); font-size: 16px; line-height: 1.3; transform: rotate(-1.2deg); }
.ab-card-k { margin: 0; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: #9b2f55; }
.ab-card-rule { margin: 2px 0 8px; }
.ab-pair { display: flex; align-items: center; justify-content: center; gap: 10px; }
.ab-tile { display: inline-flex; align-items: center; justify-content: center; width: 58px; height: 58px; border-radius: 10px; font-size: 36px; font-weight: 900; font-family: Georgia, 'Times New Roman', serif; box-shadow: 0 3px 0 rgba(0, 0, 0, .25); }
.ab-tile.is-up { background: #5b3220; color: #ffffff; border: 3px solid #2e170d; }
.ab-tile.is-low { background: #fffaf0; color: #5b3220; border: 3px dashed #5b3220; }
/* incomplete dominance: Cᴿ and Cᵂ share one tile style (solid border, same weight); only their own colour differs */
.ab-tile.is-co { border: 3px solid #3b2418; font-size: 30px; }
.ab-tile.is-co sup { font-size: max(16px, .55em); line-height: 0; margin-left: 1px; }
.ab-tile.is-co-R { background: #c62828; color: #ffffff; }
.ab-tile.is-co-W { background: #fdf9f2; color: #3b2418; }
.ab-tile.is-unk { background: #e9dfcf; color: #7a4d2a; border: 3px dotted #7a4d2a; }
.ab-tile.is-flip { animation: ab-pop .35s ease-out; }
.ab-card--test .ab-pair { gap: 6px; }
.ab-card--test .ab-tile { width: 44px; height: 44px; font-size: 27px; }
.ab-mini { display: inline-flex; align-items: center; gap: 4px; position: relative; padding-top: 18px; }
.ab-mini-k { position: absolute; top: -2px; left: 0; right: 0; text-align: center; font-size: 16px; font-weight: 700; line-height: 1; }
.ab-x { font-size: 26px; font-weight: 900; color: #9b2f55; padding-top: 18px; }
.ab-batch { position: absolute; left: 2.5%; right: 2.5%; top: 75%; bottom: 2.5%; margin: 0; padding: 6px 10px; border-radius: 12px; border: 3px solid #5e3a1d; background: linear-gradient(#fbf1df, #e7d3b0); color: #2b2018; box-shadow: 0 3px 6px rgba(0, 0, 0, .25); display: flex; flex-direction: column; gap: 2px; }
.ab-batch-k { margin: 0; font-size: 16px; font-weight: 800; text-align: center; }
.ab-batch-row { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(12, 1fr); gap: 2px; align-items: center; }
.ab-batch-row--n6 { grid-template-columns: repeat(6, 1fr); padding: 0 18%; }
.ab-batch-row--n8 { grid-template-columns: repeat(8, 1fr); padding: 0 12%; }
.ab-batch-row--n10 { grid-template-columns: repeat(10, 1fr); padding: 0 6%; }
.ab-batch-bun { display: block; min-width: 0; }
.ab-batch-bun svg { width: 100%; height: auto; max-height: 64px; display: block; }
.ab-sign { min-width: 30px; text-align: center; font-size: 34px; font-weight: 900; color: #9b2f55; opacity: 0; transform: scale(.4); transition: opacity .3s, transform .3s; }
.ab-stamp.is-geno { text-transform: none; font-family: Georgia, 'Times New Roman', serif; font-size: 20px; }
.ab-sign.is-on { opacity: 1; transform: none; }
.ab-stamp { margin: 8px 0 0; padding: 3px 8px; border: 3px solid #9b2f55; border-radius: 8px; color: #9b2f55; font-weight: 900; text-transform: uppercase; letter-spacing: .04em; text-align: center; transform: rotate(-2deg); animation: ab-pop .35s ease-out; }

.ab-bunbox { position: absolute; z-index: 3; width: 20%; left: 44.5%; top: 52%; transition: left .55s ease-in-out, top .55s ease-in-out, transform .55s ease-in-out, opacity .4s; text-align: center; pointer-events: none; }
.ab-bunbox svg { width: 100%; height: auto; display: block; }
.ab-bunlabel { margin: -4px auto 0; display: inline-block; white-space: nowrap; transition: opacity .3s; padding: 1px 10px; border-radius: 999px; background: rgba(255, 250, 240, .95); color: #2b2018; border: 2px solid #7a4d2a; font-size: 16px; font-weight: 800; }
.ab-bunbox.is-oven { left: 69.5%; top: 37%; transform: scale(.75); }
.ab-bunbox.is-oven .ab-bunlabel { opacity: 0; }
.ab-bunbox.is-rack0, .ab-bunbox.is-rack1 { top: 68%; transform: scale(.7); }
.ab-bunbox.is-rack0 { left: 14.5%; }
.ab-bunbox.is-rack1 { left: 63.5%; }
.ab-bunbox.is-rack0 .ab-bunlabel, .ab-bunbox.is-rack1 .ab-bunlabel { opacity: 0; }
.ab-bunbox.is-baked svg { animation: ab-pop .4s ease-out; }
.ab-bunbox.is-given { top: 47%; }

.ab-spots { position: absolute; left: 2.5%; right: 2.5%; top: 76%; bottom: 2.5%; display: grid; gap: 12px; grid-template-columns: repeat(2, 1fr); }
.ab-spots--n3 { grid-template-columns: repeat(3, 1fr); }
.ab-spots--n4 { grid-template-columns: repeat(4, 1fr); }
.ab-spots--words .ab-spot-t { font-size: 22px; }
.ab-spots--words.ab-spots--n4 .ab-spot-t { font-size: 17px; }
.ab-spot { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; padding: 4px 8px; border-radius: 12px; border: 3px solid #5e3a1d; background: linear-gradient(#fbf1df, #e7d3b0); color: #2b2018; font: inherit; font-size: 16px; line-height: 1.2; cursor: pointer; box-shadow: inset 0 -6px 0 rgba(94, 58, 29, .25), 0 3px 6px rgba(0, 0, 0, .25); }
.ab-spots--racks .ab-spot { justify-content: flex-end; padding-bottom: 8px; background: repeating-linear-gradient(90deg, #d7dde3 0 10px, #b6c0ca 10px 12px); }
.ab-spot-t { font-weight: 800; }
.ab-spot-s { font-size: 16px; }
.ab-spot-bun { display: block; width: 64px; height: 44px; }
.ab-spot-bun svg { width: 100%; height: 100%; display: block; }
.ab-spots--n3 .ab-spot { flex-direction: row; gap: 6px; }
.ab-spot.is-picked { outline: 4px solid #9b2f55; outline-offset: 2px; }
.ab-spot.is-right { border-color: #1f7a3a; box-shadow: 0 0 0 4px #ffffff, 0 0 0 7px #1f7a3a; }
.ab-spot:disabled { cursor: default; }

/* the cross tray: a 2×2 Punnett-style tray with the parents' alleles as row and column headers */
.ab-tray { position: absolute; left: 2.5%; top: 36%; width: 56%; bottom: 2.5%; display: grid; grid-template-columns: 17% 1fr 1fr; grid-template-rows: 17% 1fr 1fr; gap: 6px; padding: 8px; border-radius: 14px; background: linear-gradient(#e2e7ec, #9eabb8); border: 3px solid #56616d; box-shadow: 0 6px 14px rgba(0, 0, 0, .3); }
.ab-corner { display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 16px; font-weight: 800; color: #1d2430; line-height: 1.1; }
.ab-head { display: flex; align-items: center; justify-content: center; }
.ab-head .ab-tile { width: 46px; height: 46px; font-size: 28px; }
.ab-cup { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; padding: 4px; border-radius: 50% / 40%; border: 3px solid #56616d; background: radial-gradient(ellipse at 50% 40%, #6b7684, #3f4955); color: #ffffff; font: inherit; cursor: pointer; min-height: 44px; }
.ab-cup-bun { display: block; width: 72%; max-width: 110px; }
.ab-cup-bun svg { width: 100%; height: auto; display: block; }
.ab-cup-g { font-size: 22px; font-weight: 900; font-family: Georgia, 'Times New Roman', serif; line-height: 1; }
.ab-cup-mark { font-size: 16px; font-weight: 700; padding: 0 8px; border-radius: 999px; background: rgba(255, 255, 255, .15); border: 2px dashed rgba(255, 255, 255, .55); margin-top: 2px; }
.ab-cup[aria-pressed="true"] .ab-cup-mark { background: #fff6dd; color: #2b2018; border-style: solid; border-color: #fff6dd; }
.ab-cup[aria-pressed="true"] .ab-cup-mark::before { content: '✓ '; }
.ab-cup.is-baked .ab-cup-mark { background: #ffffff; color: #2b2018; border-style: solid; border-color: #ffffff; }
.ab-cup.is-baked .ab-cup-mark::before { content: ''; }
.ab-cup.is-plain, .ab-cup.is-target { box-shadow: 0 0 0 4px #ffe08a; }
.ab-cup.is-baked .ab-cup-bun svg { animation: ab-pop .4s ease-out; }
.ab-cup:disabled { cursor: default; }
.ab-tally { position: absolute; left: 61%; right: 2.5%; top: 76%; margin: 0; padding: 6px 10px; border-radius: 10px; background: #fffaf0; color: #2b2018; border: 2px solid #7a4d2a; font-size: 16px; font-weight: 700; line-height: 1.3; }

.ab-badge { position: absolute; left: 43.5%; right: 2.5%; top: 2.3%; padding: 6px 12px; border-radius: 10px; font-size: 16px; font-weight: 700; line-height: 1.3; pointer-events: none; background: rgba(255, 255, 255, .96); color: #1d2430; border: 3px solid #9b2f55; box-shadow: 0 3px 8px rgba(0, 0, 0, .25); animation: ab-pop .3s ease-out; }

/* oven fire: brighter while baking; a puff of steam after */
.ab-oven .ab-fire { transition: opacity .4s; opacity: .55; }
.ab-oven .ab-flames { transform-box: fill-box; transform-origin: 50% 100%; animation: ab-flicker 1.4s ease-in-out infinite; }
.ab-oven.is-baking .ab-fire { opacity: 1; }
.ab-oven.is-baking .ab-flames { animation-duration: .5s; }
.ab-oven.is-steam .ab-steam { animation: ab-steam 1.6s ease-out 1 forwards; }

.ab-example-svg { display: block; width: 100%; height: auto; max-height: 460px; }
.ab-start-svg { display: block; width: 100%; height: auto; }

@keyframes ab-pop { from { transform: scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes ab-flicker { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(1.12) scaleX(.96); } }
@keyframes ab-steam { 0% { opacity: 0; transform: translateY(10px); } 30% { opacity: .9; } 100% { opacity: 0; transform: translateY(-40px); } }
@media (prefers-reduced-motion: reduce) {
  .ab-bunbox, .ab-sign { transition: none; }
  .ab-oven .ab-flames, .ab-oven.is-steam .ab-steam, .ab-badge, .ab-stamp, .ab-bunbox.is-baked svg, .ab-cup.is-baked .ab-cup-bun svg { animation: none; }
}

@media (max-width: 1100px) { .ab { grid-template-columns: 290px minmax(0, 1fr); } }
@media (max-width: 900px) {
  .ab { position: static; grid-template-columns: 1fr; }
  .ab-view { display: block; }
  .ab-scene { aspect-ratio: auto; display: flex; flex-direction: column; gap: 10px; padding: 10px; width: 100% !important; height: auto !important; }
  .ab-board, .ab-card, .ab-tray, .ab-tally, .ab-badge, .ab-spots, .ab-batch, .ab-bunbox { position: relative; left: auto; right: auto; top: auto; bottom: auto; width: auto; transform: none; }
  .ab-bunbox, .ab-bunbox.is-home, .ab-bunbox.is-oven, .ab-bunbox.is-rack0, .ab-bunbox.is-rack1 { left: auto; top: auto; width: 160px; margin: 0 auto; transform: none; }
  .ab-bunbox .ab-bunlabel { opacity: 1 !important; }
  .ab-tray { aspect-ratio: 1 / 1; max-width: 420px; width: 100%; margin: 0 auto; }
  .ab-spots { min-height: 90px; }
}
