/* Functional Group Garage: the service bay inside the practice shell's stage (about 1066 × 628 at 1366 × 768). */
/* colours live on html so the Start art and the Briefing example (outside .fg) use them too */
html {  --fg-ink: #18222e; --fg-soft: #475668; --fg-card: #fffdf7; --fg-card2: #f3ecdc; --fg-line: #cdbf9f; --fg-bay: #e7e2d6; --fg-stripe: #d8d0bd;
  --fg-accent: #8a4b0f; --fg-accent-bg: #fbe9d2; --fg-gold: #f2b630; --fg-ok: #17683a; --fg-ok-bg: #e2f5e8; --fg-ok-fill: #3fae5a;
  --fg-bad: #b42318; --fg-bad-bg: #fde8e5; --fg-sel: #1f5fbf;
  --fg-bond: #26313d; --fg-C: #1d2733; --fg-H: #4d5866; --fg-O: #c62f24; --fg-N: #2453c7; --fg-S: #8f6400; --fg-P: #b55500; }
html[data-theme="dark"] { --fg-ink: #eef2f7; --fg-soft: #c3cedb; --fg-card: #1d2632; --fg-card2: #17202b; --fg-line: #4f5f73; --fg-bay: #111821; --fg-stripe: #0c1219;
  --fg-accent: #f2b46a; --fg-accent-bg: #3a2812; --fg-gold: #f2b630; --fg-ok: #86e0a6; --fg-ok-bg: #153a25; --fg-ok-fill: #3fae5a;
  --fg-bad: #ffb4a8; --fg-bad-bg: #4a1e1a; --fg-sel: #8ab8ff;
  --fg-bond: #d7dee8; --fg-C: #eef2f7; --fg-H: #b8c3d0; --fg-O: #ff8b7e; --fg-N: #93b4ff; --fg-S: #f2cf5b; --fg-P: #ffb066; }
.fg { position: absolute; inset: 0; overflow: auto; display: flex; flex-direction: column; gap: 10px; padding: 10px 12px; font-size: 17px; line-height: 1.3;
  color: var(--fg-ink);
  background: repeating-linear-gradient(135deg, transparent 0 22px, rgba(0,0,0,.025) 22px 44px), linear-gradient(180deg, var(--fg-bay), var(--fg-stripe)); }
.fg *, .fg *::before, .fg *::after { box-sizing: border-box; }
.fg p { margin: 0; }

/* top strip */
.fg-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; flex: none; }
.fg-plaque { display: inline-flex; align-items: baseline; gap: 8px; padding: 5px 14px; border-radius: 8px; background: linear-gradient(180deg, #3a434e, #232a33); color: #fff5d6; border: 2px solid #f2c14e; box-shadow: 0 2px 4px rgba(0,0,0,.25); }
.fg-plaque-k { font-size: 16px; text-transform: uppercase; letter-spacing: .08em; color: #f2c14e; }
.fg-plaque-t { font-size: 18px; font-weight: 800; }
.fg-level { font-size: 16px; font-weight: 700; padding: 3px 12px; border-radius: 999px; background: var(--fg-accent-bg); color: var(--fg-accent); border: 1px solid var(--fg-accent); }
.fg-about { margin-left: auto; position: relative; }
.fg-about summary { cursor: pointer; font-size: 16px; font-weight: 700; color: var(--fg-ink); min-height: 44px; display: flex; align-items: center; padding: 0 10px; border-radius: 8px; list-style: none; }
.fg-about summary::-webkit-details-marker { display: none; }
.fg-about summary::before { content: 'ⓘ'; margin-right: 6px; }
.fg-about[open] { flex: 1 1 100%; margin-left: 0; order: 5; }
.fg-about[open] summary { margin-left: auto; width: max-content; }
.fg-about[open] p { padding: 10px 14px; background: var(--fg-card); border: 1px solid var(--fg-line); border-radius: 10px; font-size: 16px; }

/* bench */
.fg-bench { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr); gap: 12px; }
.fg--compare .fg-bench { display: flex; flex-direction: column; gap: 8px; }
.fg-card { position: relative; display: flex; flex-direction: column; min-height: 0; min-width: 0; padding: 10px 14px; border-radius: 14px; color: var(--fg-ink); font: inherit; text-align: left;
  background: linear-gradient(180deg, var(--fg-card), var(--fg-card2)); border: 2px solid var(--fg-line); box-shadow: 0 6px 14px rgba(40, 30, 10, .18), inset 0 1px 0 rgba(255,255,255,.6); }
html[data-theme="dark"] .fg-card { box-shadow: 0 6px 14px rgba(0,0,0,.5); }
.fg-card-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; flex: none; }
.fg-card-name { font-size: 20px; font-weight: 800; }
.fg-card-formula { font-size: 18px; color: var(--fg-soft); font-variant-numeric: tabular-nums; }
.fg-card-note { display: block; font-size: 16px; color: var(--fg-soft); flex: none; }
.fg-svg { flex: 1 1 auto; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 4px 0; }
.fg-svg > svg { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; overflow: visible; }

/* the drawing */
.fg-mol .fg-bonds { stroke: var(--fg-bond); stroke-width: 3.2; }
.fg-mol .fg-at { font-family: var(--tlg-font-body, system-ui, sans-serif); font-weight: 700; }
.fg-at-C { fill: var(--fg-C); } .fg-at-H { fill: var(--fg-H); } .fg-at-O { fill: var(--fg-O); } .fg-at-N { fill: var(--fg-N); } .fg-at-S { fill: var(--fg-S); } .fg-at-P { fill: var(--fg-P); }
.fg-region { opacity: 0; }
.fg-region:not(.is-bad) { fill: var(--fg-sel); stroke: var(--fg-sel); }
.fg-region.is-hl { opacity: .55; fill: var(--fg-gold); stroke: var(--fg-gold); }
.fg-region.is-tint { opacity: .38; fill: var(--fg-gold); stroke: var(--fg-gold); }
.fg-region.is-sel { opacity: .42; fill: var(--fg-sel); stroke: var(--fg-sel); }
.fg-region.is-ok, .fg-region.is-answer { opacity: .5; fill: var(--fg-ok-fill); stroke: var(--fg-ok-fill); }
.fg-region.is-bad { opacity: .75; }
.fg-mol--tap .fg-region { cursor: pointer; pointer-events: all; outline: none; }
.fg-mol--tap .fg-region:hover { opacity: .2; }
.fg-mol--tap .fg-region.is-sel:hover { opacity: .5; }
.fg-mol--tap .fg-region:focus-visible { opacity: .35; fill: var(--tlg-focus, #b84c00); stroke: var(--tlg-focus, #b84c00); }
.fg-mol--tap .fg-region.is-sel:focus-visible { opacity: .55; }
.fg-hatch-bg { fill: var(--fg-bad-bg); } .fg-hatch-fg { fill: var(--fg-bad); }
.fg-ex-card { fill: var(--tlg-surface, #fff); stroke: var(--tlg-border-strong, #8095a7); stroke-width: 2; }
.fg-example .fg-bonds { stroke: var(--tlg-text, #18222e); }
.fg-example .fg-callout text { fill: var(--tlg-text, #18222e); }
.fg-example .fg-at-C { fill: var(--tlg-text, #18222e); }
html[data-theme="dark"] .fg-example .fg-at-O { fill: #ff8b7e; } html[data-theme="dark"] .fg-example .fg-at-N { fill: #93b4ff; } html[data-theme="dark"] .fg-example .fg-at-H { fill: #b8c3d0; }
.fg-start { display: block; width: 100%; height: auto; }

.fg-hl-key { display: flex; align-items: center; gap: 8px; font-size: 16px; color: var(--fg-soft); flex: none; }
.fg-hl-swatch { width: 26px; height: 16px; border-radius: 8px; background: var(--fg-gold); opacity: .8; }
.fg-hl-key.is-ok { color: var(--fg-ok); font-weight: 700; } .fg-hl-key.is-ok .fg-hl-swatch { background: var(--fg-ok-fill); }

/* side panel */
.fg-side { display: flex; flex-direction: column; gap: 10px; min-height: 0; min-width: 0; overflow: auto; padding: 12px 14px; border-radius: 14px; background: var(--fg-card); border: 2px solid var(--fg-line); }
.fg-side-k { font-size: 16px; text-transform: uppercase; letter-spacing: .08em; color: var(--fg-soft); font-weight: 700; }
.fg-want { font-size: 28px; font-weight: 800; color: var(--fg-accent); line-height: 1.1; }
.fg-side-help { font-size: 16px; color: var(--fg-soft); }
.fg-pick { font-size: 17px; font-weight: 700; padding: 8px 10px; border-radius: 10px; border: 2px dashed var(--fg-line); }
.fg-pick.is-set { border-style: solid; border-color: var(--fg-sel); }
.fg-reveal { display: flex; flex-direction: column; gap: 6px; font-size: 16px; }
.fg-reveal-all { color: var(--fg-soft); }
.fg-mk { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 6px; color: #fff; font-weight: 800; }
.fg-mk--ok { background: #17683a; } .fg-mk--bad { background: repeating-linear-gradient(45deg, #b42318 0 4px, #e46a5e 4px 8px); }

/* chips */
.fg-chips { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.fg-chips-k { font-size: 17px; font-weight: 800; color: var(--fg-ink); }
.fg-chips-row { display: flex; flex-direction: column; gap: 6px; }
.fg-chips--grid .fg-chips-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
html .fg-chip { display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 6px 12px; border-radius: 10px; border: 2px solid var(--fg-line); background: var(--fg-card); color: var(--fg-ink); font: inherit; font-size: 17px; text-align: left; cursor: pointer; }
.fg-chip:hover:not(:disabled) { border-color: var(--fg-accent); }
.fg-chip:focus-visible, .fg-card--pick:focus-visible { outline: 3px solid var(--tlg-focus, #b84c00); outline-offset: 2px; }
.fg-chip-dot { flex: none; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--fg-soft); }
.fg-chip-t { min-width: 0; }
.fg-chip.is-on { border-color: var(--fg-sel); background: color-mix(in srgb, var(--fg-sel) 12%, var(--fg-card)); font-weight: 700; }
.fg-chip.is-on .fg-chip-dot { border-color: var(--fg-sel); background: radial-gradient(circle, var(--fg-sel) 0 45%, transparent 50%); }
.fg-chip:disabled { cursor: default; opacity: 1; }
.fg-chip.is-right { border-color: var(--fg-ok); background: var(--fg-ok-bg); }
.fg-chip.is-right .fg-chip-dot { border: none; background: none; width: auto; height: auto; color: var(--fg-ok); font-weight: 800; }
.fg-chip.is-right .fg-chip-dot::before { content: '✓'; }
.fg-chip.is-wrong { border-color: var(--fg-bad); background: var(--fg-bad-bg); text-decoration: line-through; }
.fg-chip.is-wrong .fg-chip-dot { border: none; background: none; width: auto; height: auto; color: var(--fg-bad); font-weight: 800; }
.fg-chip.is-wrong .fg-chip-dot::before { content: '✗'; }

/* compare */
.fg-step { font-size: 17px; font-weight: 800; flex: none; }
.fg-pair { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.fg-card--pick { cursor: pointer; align-items: stretch; }
.fg-card--pick:hover:not(:disabled) { border-color: var(--fg-accent); }
.fg-card--pick.is-on { border: 3px solid var(--fg-sel); box-shadow: 0 0 0 3px color-mix(in srgb, var(--fg-sel) 25%, transparent), 0 6px 14px rgba(40,30,10,.18); }
.fg-card--pick.is-on .fg-card-head::after { content: '● Your pick'; margin-left: auto; font-size: 16px; font-weight: 800; color: var(--fg-sel); }
.fg-card--pick:disabled { cursor: default; color: var(--fg-ink); }
.fg-card--pick.is-right { border-color: var(--fg-ok); }
.fg-card--pick.is-right .fg-card-head::after { content: '✓ Higher'; color: var(--fg-ok); margin-left: auto; font-size: 16px; font-weight: 800; }
.fg-card--pick.is-wrong { border-color: var(--fg-bad); }
.fg-card--pick.is-wrong .fg-card-head::after { content: '✗ Your pick'; color: var(--fg-bad); margin-left: auto; font-size: 16px; font-weight: 800; }
.fg-value { display: block; flex: none; font-size: 17px; padding: 4px 8px; border-radius: 8px; background: var(--fg-accent-bg); }
.fg-value-g { color: var(--fg-soft); }
.fg-chips--reasons { flex: none; }
.fg-chips--reasons .fg-chips-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.fg-chips--reasons .fg-chip { align-items: flex-start; }
.fg-chips--reasons .fg-chip-dot { margin-top: 2px; }

@media (max-width: 900px) {
  .fg { position: static; overflow: visible; }
  .fg-bench { grid-template-columns: 1fr; }
  .fg-card { min-height: 260px; }
  .fg-svg > svg { max-height: 60vh; }
  .fg-pair { grid-template-columns: 1fr; }
  .fg-chips--reasons .fg-chips-row { grid-template-columns: 1fr; }
  .fg-about { margin-left: 0; }
}
@media (prefers-reduced-motion: no-preference) {
  .fg-region { transition: opacity .15s; }
  .fg-chip, .fg-card--pick { transition: border-color .12s, background .12s; }
}
