/* =========================================================================
   Flowchart Lab — styles
   Colours, fonts and corner radius live in css/theme.css — edit that file
   to match your website, not this one.
   ========================================================================= */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--fc-font); color: var(--fc-text); background: var(--fc-bg); font-size: 15px; line-height: 1.45; }
.fc-app { display: flex; flex-direction: column; min-height: 100vh; }
[hidden] { display: none !important; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0; }
code { font-family: var(--fc-mono); background: var(--fc-surface-2); padding: 0 .3em; border-radius: 4px; }
.fc-muted { color: var(--fc-muted); }
.small { font-size: .85em; }

/* ---------- buttons ---------- */
.fc-btn {
  font: inherit; font-weight: 600; border: 1px solid var(--fc-border); background: var(--fc-surface); color: var(--fc-text);
  border-radius: 8px; padding: .5em .9em; min-height: 40px; cursor: pointer; display: inline-flex; align-items: center; gap: .35em;
  touch-action: manipulation; user-select: none;
}
.fc-btn:hover { background: var(--fc-surface-2); }
.fc-btn:focus-visible, .fc-tabs button:focus-visible, select:focus-visible, input:focus-visible { outline: 3px solid color-mix(in srgb, var(--fc-accent) 45%, transparent); outline-offset: 1px; }
.fc-btn:disabled { opacity: .45; cursor: not-allowed; }
.fc-btn.ghost { background: transparent; border-color: transparent; }
.fc-btn.ghost:hover { background: var(--fc-surface-2); }
.fc-btn.run { background: var(--fc-run); border-color: var(--fc-run); color: #fff; }
.fc-btn.run:hover { filter: brightness(1.07); }
.fc-btn.primary { background: var(--fc-accent); border-color: var(--fc-accent); color: var(--fc-accent-text); }
.fc-btn.icon { width: 40px; justify-content: center; padding: 0; font-size: 1.1em; }
.fc-btn.small { min-height: 32px; padding: .25em .7em; font-size: .9em; }
.fc-seg { display: inline-flex; border: 1px solid var(--fc-border); border-radius: 8px; overflow: hidden; }
.fc-seg button { font: inherit; font-weight: 600; border: 0; background: var(--fc-surface); padding: .45em .9em; min-height: 38px; cursor: pointer; }
.fc-seg button + button { border-left: 1px solid var(--fc-border); }
.fc-seg button[aria-pressed="true"] { background: var(--fc-accent); color: var(--fc-accent-text); }

/* ---------- header ---------- */
.fc-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .5rem 1rem; background: var(--fc-surface); border-bottom: 1px solid var(--fc-border); }
.fc-brand { display: flex; align-items: center; gap: .6rem; color: inherit; text-decoration: none; font-weight: 800; font-size: 1.1rem; }
.fc-brand svg { width: 30px; height: 30px; fill: none; stroke: var(--fc-accent); stroke-width: 2; }
.fc-brand small { display: block; font-weight: 500; font-size: .75rem; color: var(--fc-muted); }
.fc-nav { display: flex; gap: .25rem; flex-wrap: wrap; }

/* ---------- home ---------- */
.fc-home { max-width: 1100px; width: 100%; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
.fc-hero h1 { font-size: clamp(1.6rem, 3vw, 2.2rem); margin-bottom: .4rem; }
.fc-hero p { color: var(--fc-muted); max-width: 60ch; margin: 0 0 1rem; }
.fc-primm-unused { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem; padding: 0; margin: 0 0 2rem; counter-reset: p; }
.fc-primm li { background: var(--fc-surface); border: 1px solid var(--fc-border); border-radius: 999px; padding: .3rem .8rem .3rem .4rem; font-size: .9rem; counter-increment: p; display: flex; align-items: center; gap: .4rem; }
.fc-primm li::before { content: counter(p); width: 1.5rem; height: 1.5rem; border-radius: 50%; background: var(--fc-accent); color: var(--fc-accent-text); display: grid; place-items: center; font-size: .8rem; font-weight: 700; }
.fc-level { margin-bottom: 1.75rem; }
.fc-level-head { display: flex; align-items: baseline; gap: .75rem; margin-bottom: .6rem; flex-wrap: wrap; }
.fc-level-head .num { font-size: .8rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--fc-accent); }
.fc-level-head h2 { font-size: 1.2rem; }
.fc-level-head p { margin: 0; color: var(--fc-muted); font-size: .9rem; }
.fc-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .75rem; }
.fc-card { text-align: left; font: inherit; color: inherit; background: var(--fc-surface); border: 1px solid var(--fc-border); border-radius: var(--fc-radius); padding: .9rem 1rem; cursor: pointer; box-shadow: var(--fc-shadow); display: flex; flex-direction: column; gap: .35rem; min-height: 120px; }
.fc-card:hover { border-color: var(--fc-accent); }
.fc-card h3 { font-size: 1.05rem; }
.fc-card p { margin: 0; color: var(--fc-muted); font-size: .88rem; flex: 1; }
.fc-card .meta { display: flex; justify-content: space-between; align-items: center; }
.fc-card.soon { cursor: default; opacity: .6; box-shadow: none; border-style: dashed; }
.fc-mode { font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; padding: .15rem .5rem; border-radius: 999px; background: var(--fc-surface-2); color: var(--fc-muted); }
.fc-mode.make { background: #e0f2fe; color: #075985; }
.fc-mode.predict { background: #fef3c7; color: #92400e; }
.fc-mode.debug { background: #fee2e2; color: #991b1b; }
.fc-stars { letter-spacing: .1em; color: #d1d5db; font-size: 1.05rem; white-space: nowrap; }
.fc-stars .on { color: #f59e0b; }
.fc-done { font-size: .78rem; color: var(--fc-good); font-weight: 700; }

/* ---------- workspace ---------- */
.fc-work { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.fc-toolbar { display: flex; align-items: center; gap: .5rem 1rem; flex-wrap: wrap; padding: .4rem .75rem; background: var(--fc-surface); border-bottom: 1px solid var(--fc-border); }
.fc-toolbar h2 { font-size: 1.05rem; margin-right: auto; }
.fc-tb-group { display: flex; align-items: center; gap: .3rem; }
.fc-speed { display: flex; align-items: center; gap: .3rem; font-size: .85rem; color: var(--fc-muted); }
.fc-speed select { font: inherit; min-height: 38px; border-radius: 8px; border: 1px solid var(--fc-border); padding: 0 .3rem; }
.fc-save { font-size: .8rem; color: var(--fc-muted); min-width: 4.5em; }

.fc-grid { flex: 1; display: grid; grid-template-columns: 250px minmax(0, 1fr) 360px; min-height: 0; height: calc(100vh - 112px); }
.fc-left, .fc-side { background: var(--fc-surface); overflow-y: auto; }
.fc-left { border-right: 1px solid var(--fc-border); padding: .75rem; display: flex; flex-direction: column; gap: 1rem; }
.fc-side { border-left: 1px solid var(--fc-border); display: flex; flex-direction: column; }
.fc-left h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--fc-muted); margin-bottom: .5rem; }
.fc-left h3 small { text-transform: none; letter-spacing: 0; font-weight: 400; }

#palette { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; }
.fc-pal { display: flex; flex-direction: column; align-items: center; gap: .15rem; padding: .4rem .2rem; border: 1px solid var(--fc-border); border-radius: 8px; background: var(--fc-surface); cursor: grab; font: inherit; font-size: .82rem; font-weight: 600; touch-action: none; user-select: none; }
.fc-pal:hover { border-color: var(--fc-accent); }
.fc-pal svg { width: 64px; height: 30px; }
.fc-pal:disabled { opacity: .4; cursor: not-allowed; }
.fc-ghost { position: fixed; pointer-events: none; z-index: 50; opacity: .85; transform: translate(-50%, -50%); }

.fc-field { display: flex; flex-direction: column; gap: .25rem; margin-bottom: .6rem; font-size: .88rem; font-weight: 600; }
.fc-field select, .fc-field input, .fc-row select, .fc-row input { font: inherit; font-weight: 400; min-height: 38px; border: 1px solid var(--fc-border); border-radius: 8px; padding: 0 .5rem; background: var(--fc-surface); width: 100%; }
.fc-row { display: flex; gap: .35rem; align-items: center; }
.fc-row > * { flex: 1; min-width: 0; }
.fc-row .eq { flex: 0 0 auto; font-weight: 700; }
.fc-props .fc-preview { background: var(--fc-surface-2); border-radius: 8px; padding: .4rem .6rem; font-weight: 700; margin-bottom: .6rem; font-size: .9rem; }
.fc-explain { font-size: .82rem; color: var(--fc-muted); margin: .2rem 0 .6rem; }

.fc-varlist { list-style: none; margin: 0 0 .5rem; padding: 0; display: flex; flex-direction: column; gap: .3rem; }
.fc-varlist li { display: grid; grid-template-columns: 1fr 70px 34px; gap: .3rem; align-items: center; }
.fc-varlist .name { font-family: var(--fc-mono); font-weight: 700; overflow: hidden; text-overflow: ellipsis; }
.fc-varlist input { font: inherit; min-height: 34px; border: 1px solid var(--fc-border); border-radius: 6px; padding: 0 .4rem; width: 100%; }
.fc-varlist button { min-height: 34px; border: 1px solid var(--fc-border); border-radius: 6px; background: var(--fc-surface); cursor: pointer; }
.fc-addvar { display: flex; gap: .3rem; }
.fc-addvar input { flex: 1; min-width: 0; font: inherit; min-height: 38px; border: 1px solid var(--fc-border); border-radius: 8px; padding: 0 .5rem; }
.fc-err { color: var(--fc-bad); font-size: .82rem; margin: .3rem 0 0; }

/* ---------- canvas ---------- */
.fc-canvas-wrap { position: relative; overflow: auto; background: var(--fc-canvas); touch-action: none; }
#canvas { display: block; user-select: none; -webkit-user-select: none; }
.fc-bg { fill: var(--fc-canvas); }
.fc-griddot { fill: var(--fc-grid-dot); }
.fc-shape { stroke-width: 2.2; }
.fc-start .fc-shape, .fc-stop .fc-shape { fill: var(--fc-start); stroke: var(--fc-start-line); }
.fc-input .fc-shape, .fc-output .fc-shape { fill: var(--fc-io); stroke: var(--fc-io-line); }
.fc-process .fc-shape { fill: var(--fc-process); stroke: var(--fc-process-line); }
.fc-decision .fc-shape { fill: var(--fc-decision); stroke: var(--fc-decision-line); }
.fc-block { cursor: grab; }
.readonly .fc-block { cursor: pointer; }
.fc-block.unset .fc-shape { stroke-dasharray: 6 4; }
.fc-block.sel .fc-shape { stroke: var(--fc-accent); stroke-width: 3.5; }
.fc-block.running .fc-shape { stroke: var(--fc-running); stroke-width: 5; filter: drop-shadow(0 0 6px var(--fc-running)); }
.fc-block.error .fc-shape { stroke: var(--fc-bad); stroke-width: 5; }
.fc-text { font: 600 13px var(--fc-font); fill: var(--fc-text); text-anchor: middle; pointer-events: none; }
.fc-block.unset .fc-text { fill: var(--fc-muted); font-style: italic; }
.fc-tag { font: 700 9px var(--fc-font); letter-spacing: .08em; fill: var(--fc-muted); text-anchor: middle; pointer-events: none; }
.fc-issue circle { fill: var(--fc-bad); }
.fc-issue text { fill: #fff; font: 800 14px var(--fc-font); text-anchor: middle; }
.fc-port { cursor: crosshair; }
.fc-port-hit { fill: transparent; }
.fc-port-dot { fill: #fff; stroke: var(--fc-link); stroke-width: 2; }
.fc-port.yes .fc-port-dot { stroke: var(--fc-yes); }
.fc-port.no .fc-port-dot { stroke: var(--fc-no); }
.fc-port:not(.linked) .fc-port-dot { fill: #fffbe6; stroke-width: 3; }
.fc-port:hover .fc-port-dot, .fc-port.active .fc-port-dot { fill: var(--fc-accent); stroke: var(--fc-accent); }
.fc-link-line { fill: none; stroke: var(--fc-link); stroke-width: 2.2; stroke-linejoin: round; }
.fc-link-hit { fill: none; stroke: transparent; stroke-width: 16; cursor: pointer; }
.fc-link.sel .fc-link-line { stroke: var(--fc-accent); stroke-width: 3.5; }
.fc-arrowhead { fill: var(--fc-link); }
.fc-arrowhead.sel { fill: var(--fc-accent); }
.fc-port-label { font: 800 12px var(--fc-font); }
.fc-port-label.yes { fill: var(--fc-yes); }
.fc-port-label.no { fill: var(--fc-no); }
.fc-drag-line { stroke: var(--fc-accent); stroke-width: 2.5; stroke-dasharray: 6 4; }
.fc-drop-target { fill: none; stroke: var(--fc-accent); stroke-width: 2.5; stroke-dasharray: 5 4; }
.fc-banner { position: sticky; left: .75rem; bottom: .75rem; margin: -3.2rem .75rem 0; width: max-content; max-width: calc(100% - 1.5rem); background: var(--fc-text); color: #fff; padding: .5rem .8rem; border-radius: 8px; font-size: .9rem; box-shadow: var(--fc-shadow); z-index: 5; }
.fc-banner button { font: inherit; margin-left: .5rem; background: #fff; color: var(--fc-text); border: 0; border-radius: 6px; padding: .2rem .6rem; cursor: pointer; }
.fc-banner.lock { background: #fef3c7; color: #78350f; }

/* ---------- side panel ---------- */
.fc-tabs { display: flex; border-bottom: 1px solid var(--fc-border); position: sticky; top: 0; background: var(--fc-surface); z-index: 2; }
.fc-tabs button { flex: 1; font: inherit; font-weight: 700; font-size: .88rem; padding: .7rem .2rem; border: 0; background: none; border-bottom: 3px solid transparent; cursor: pointer; color: var(--fc-muted); min-height: 44px; }
.fc-tabs button[aria-selected="true"] { color: var(--fc-accent); border-bottom-color: var(--fc-accent); }
.fc-tab { padding: .9rem; display: flex; flex-direction: column; gap: .6rem; }
.fc-tab h4 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--fc-muted); margin-top: .4rem; }
.fc-tab h4 small { text-transform: none; letter-spacing: 0; font-weight: 400; }
.fc-tab ul.crit { margin: 0; padding-left: 1.2rem; }
.fc-tab ul.crit li { margin-bottom: .25rem; }
.fc-story { margin: 0; }
.fc-iolist { font-size: .88rem; margin: 0; padding-left: 1.1rem; }
.fc-iolist .note { color: var(--fc-muted); }
.fc-card-box { border: 1px solid var(--fc-border); border-radius: var(--fc-radius); padding: .8rem; background: var(--fc-surface-2); }
.fc-card-box.predict { background: #fffbeb; border-color: #fcd34d; }
.fc-card-box.challenge { background: #f5f3ff; border-color: #c4b5fd; }
.fc-options { display: flex; flex-direction: column; gap: .4rem; margin: .5rem 0; }
.fc-options button { text-align: left; font: inherit; padding: .55rem .7rem; border: 1px solid var(--fc-border); border-radius: 8px; background: var(--fc-surface); cursor: pointer; min-height: 44px; }
.fc-options button.correct { border-color: var(--fc-good); background: #dcfce7; }
.fc-options button.wrong { border-color: var(--fc-bad); background: #fee2e2; }
.fc-options button:disabled { cursor: default; color: inherit; }

.fc-mimic svg { width: 100%; height: auto; border-radius: var(--fc-radius); border: 1px solid var(--fc-border); display: block; }
.mimic-hot { cursor: pointer; }
.fc-status { font-size: .9rem; padding: .45rem .6rem; border-radius: 8px; background: var(--fc-surface-2); }
.fc-status.error { background: #fee2e2; color: var(--fc-bad); }
.fc-status.running { background: #fef3c7; }
.fc-status.stopped { background: #dcfce7; }
.fc-io { display: flex; flex-direction: column; gap: .35rem; }
.fc-io-row { display: flex; align-items: center; justify-content: space-between; gap: .5rem; font-size: .9rem; }
.fc-io-row .nm { font-weight: 600; }
.fc-io-row .nt { display: block; font-size: .78rem; color: var(--fc-muted); font-weight: 400; }
.fc-switch { font: inherit; font-weight: 700; min-width: 74px; min-height: 38px; border-radius: 999px; border: 2px solid var(--fc-border); background: var(--fc-surface-2); cursor: pointer; touch-action: manipulation; }
.fc-switch[aria-pressed="true"] { background: var(--fc-run); border-color: var(--fc-run); color: #fff; }
.fc-push { font: inherit; font-weight: 700; min-width: 74px; min-height: 38px; border-radius: 8px; border: 2px solid var(--fc-border); background: var(--fc-surface); cursor: pointer; touch-action: none; user-select: none; }
.fc-push[aria-pressed="true"] { background: var(--fc-run); color: #fff; border-color: var(--fc-run); }
.fc-slider { display: flex; align-items: center; gap: .4rem; flex: 1; max-width: 190px; }
.fc-slider input { flex: 1; min-width: 0; accent-color: var(--fc-accent); height: 32px; }
.fc-slider output { font-weight: 700; min-width: 4.2em; text-align: right; font-variant-numeric: tabular-nums; }
.fc-lamp { display: inline-flex; align-items: center; gap: .35rem; font-weight: 700; }
.fc-lamp::before { content: ""; width: 14px; height: 14px; border-radius: 50%; background: #9ca3af; }
.fc-lamp.on::before { background: #f59e0b; box-shadow: 0 0 8px #f59e0b; }
.fc-lcd { font-family: var(--fc-mono); background: #0f2416; color: #7cff8a; padding: .1rem .5rem; border-radius: 4px; min-width: 6em; text-align: center; }
.fc-varval { font-family: var(--fc-mono); font-weight: 700; }

/* ---------- check ---------- */
.fc-results { display: flex; flex-direction: column; gap: .6rem; }
.fc-scen h5 { margin: 0 0 .3rem; font-size: .88rem; }
.fc-check { display: grid; grid-template-columns: 1.4rem 1fr; gap: .15rem .4rem; font-size: .9rem; margin-bottom: .35rem; }
.fc-check .ic { font-weight: 800; }
.fc-check.pass .ic { color: var(--fc-good); }
.fc-check.fail .ic { color: var(--fc-bad); }
.fc-check .msg { grid-column: 2; color: var(--fc-muted); font-size: .84rem; }
.fc-check .nudge { grid-column: 2; font-size: .84rem; }
.fc-check .nudge summary { cursor: pointer; color: var(--fc-accent); font-weight: 600; }
.fc-issues { margin: 0; padding-left: 1.1rem; font-size: .88rem; }
.fc-issues li.error { color: var(--fc-bad); }
.fc-issues li.warn { color: var(--fc-warn); }
.fc-issues li { cursor: pointer; }
.fc-bigstars { font-size: 2rem; letter-spacing: .15em; color: #d1d5db; text-align: center; }
.fc-bigstars .on { color: #f59e0b; }
.fc-starkey { font-size: .8rem; color: var(--fc-muted); text-align: center; margin: 0; }
.fc-success { background: #dcfce7; border: 1px solid #86efac; border-radius: var(--fc-radius); padding: .7rem .8rem; font-weight: 600; }
.fc-hint { background: #eff6ff; border-left: 4px solid var(--fc-accent); padding: .5rem .7rem; border-radius: 0 8px 8px 0; font-size: .9rem; }
.fc-hint b { display: block; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--fc-accent); }
.fc-teacher { border: 1px dashed var(--fc-warn); border-radius: 8px; padding: .6rem; }

/* ---------- pseudocode ---------- */
.fc-code-head { display: flex; justify-content: space-between; align-items: center; }
.fc-code { font-family: var(--fc-mono); font-size: .84rem; background: #0f172a; color: #e2e8f0; padding: .8rem; border-radius: 8px; overflow: auto; white-space: pre; margin: 0; tab-size: 4; width: 100%; border: 0; }
textarea.fc-code { resize: vertical; min-height: 10rem; background: #fff; color: var(--fc-text); border: 1px solid var(--fc-border); }

/* ---------- dialog ---------- */
.fc-dialog { border: 0; border-radius: 14px; padding: 1.4rem; width: min(440px, calc(100vw - 2rem)); box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.fc-dialog::backdrop { background: rgba(15, 23, 42, .45); }
.fc-dialog h2 { margin-bottom: .5rem; }
.fc-dialog label:not(.fc-btn) { display: flex; flex-direction: column; gap: .25rem; font-weight: 600; margin: .7rem 0; }
.fc-dialog input { font: inherit; min-height: 42px; border: 1px solid var(--fc-border); border-radius: 8px; padding: 0 .6rem; }
.fc-dlg-actions { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-top: 1rem; }
.fc-dlg-actions .spacer { flex: 1; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .fc-grid { grid-template-columns: 220px minmax(0, 1fr) 320px; }
}
@media (max-width: 960px) {
  .fc-grid { grid-template-columns: 1fr; height: auto; }
  .fc-left { border-right: 0; border-bottom: 1px solid var(--fc-border); flex-direction: row; flex-wrap: wrap; }
  .fc-left > section { flex: 1 1 260px; }
  #palette { grid-template-columns: repeat(3, 1fr); }
  .fc-canvas-wrap { height: 65vh; }
  .fc-side { border-left: 0; border-top: 1px solid var(--fc-border); }
  .fc-toolbar h2 { flex-basis: 100%; order: -1; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- subroutines ---------- */
.fc-scopes { position: sticky; top: 0; left: 0; z-index: 6; display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; padding: .45rem .6rem; background: color-mix(in srgb, var(--fc-surface) 92%, transparent); border-bottom: 1px solid var(--fc-border); width: 100%; box-sizing: border-box; }
.fc-scope { font: inherit; font-weight: 700; font-size: .88rem; min-height: 36px; padding: .3rem .8rem; border-radius: 999px; border: 1px solid var(--fc-border); background: var(--fc-surface); color: var(--fc-text); cursor: pointer; touch-action: manipulation; }
.fc-scope.on { background: var(--fc-accent); border-color: var(--fc-accent); color: var(--fc-accent-text); }
.fc-scope.add { border-style: dashed; color: var(--fc-accent); }
.fc-scope.running { box-shadow: 0 0 0 3px var(--fc-running); }
.fc-scope-tools { display: inline-flex; gap: .2rem; margin-left: auto; }
.fc-call .fc-shape { fill: var(--fc-process); stroke: var(--fc-process-line); }
.fc-pal.fc-call svg { stroke: var(--fc-process-line); }
.fc-card-box.learn { background: #ecfeff; border-color: #67e8f9; }
.fc-card-box.learn h4 { margin-top: 0; }
.fc-card-box.learn p, .fc-card-box.learn ul { margin: .4rem 0; font-size: .92rem; }
.fc-card-box.learn pre { font-family: var(--fc-mono); font-size: .8rem; background: #0f172a; color: #e2e8f0; padding: .5rem .6rem; border-radius: 6px; overflow: auto; margin: .4rem 0; }
.fc-project { align-self: flex-start; font-size: .74rem; font-weight: 700; color: #7c2d12; background: #ffedd5; border-radius: 999px; padding: .1rem .5rem; }
.fc-readout { font-family: var(--fc-mono); font-weight: 700; background: var(--fc-surface-2); border-radius: 6px; padding: .2rem .5rem; min-width: 6.5em; text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- canvas wrapper, passed badge, picture export ---------- */
.fc-canvas-outer { position: relative; min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.fc-canvas-outer > .fc-canvas-wrap { flex: 1; min-height: 0; }
.fc-pass { position: absolute; right: 14px; bottom: 14px; z-index: 7; display: flex; align-items: center; gap: .5rem; background: #dcfce7; border: 2px solid #16a34a; border-radius: 999px; padding: .3rem .4rem .3rem .9rem; box-shadow: var(--fc-shadow); font-weight: 700; }
.fc-pass .ok { color: #15803d; }
.fc-pass .stars { color: #f59e0b; letter-spacing: .08em; }
.fc-pass .fc-btn { min-height: 32px; border-radius: 999px; }
.fc-shot { position: absolute; left: -20000px; top: 0; width: 10px; height: 10px; overflow: hidden; }
.fc-toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; background: #1c2430; color: #fff; padding: .7rem 1.1rem; border-radius: 10px; z-index: 100; box-shadow: 0 8px 24px rgba(0,0,0,.25); font-weight: 600; max-width: calc(100vw - 32px); }
.fc-toast.show { opacity: 1; transform: translate(-50%, 0); }
.fc-success { display: flex; flex-direction: column; gap: .5rem; align-items: flex-start; }
@media (max-width: 960px) { .fc-canvas-outer > .fc-canvas-wrap { height: 65vh; flex: none; } }

.fc-grid { grid-template-rows: minmax(0, 1fr); flex: 0 0 auto; min-height: 0; }
@media (max-width: 960px) { .fc-grid { grid-template-rows: none; } }

/* ---------- teacher-PIN help ---------- */
.fc-helpchip { display: inline-flex; align-items: center; gap: .35rem; margin-left: .5rem; }
.fc-helpchip.on { background: #fef3c7; border: 1px solid #f59e0b; border-radius: 999px; padding: .15rem .25rem .15rem .75rem; font-weight: 700; color: #92400e; }
.fc-card-box.helpbox { background: #fffbeb; border-color: #fcd34d; }
.fc-done.helped { color: #b45309; }
.fc-pin { font-family: var(--fc-mono); font-size: 1.25em; letter-spacing: .12em; }
.fc-teacher-home { margin-bottom: 1.25rem; background: var(--fc-surface); }
#help-pin { font-family: var(--fc-mono); font-size: 1.5rem; letter-spacing: .4em; text-align: center; max-width: 9rem; }

/* ---------- side panel sections (Task + Try it together) ---------- */
.fc-tab.fc-stack { padding: 0; gap: 0; }
.fc-sec { border-bottom: 1px solid var(--fc-border); }
.fc-sechead { width: 100%; display: flex; align-items: center; justify-content: space-between; font: inherit; font-weight: 800; font-size: .95rem; color: var(--fc-text); background: var(--fc-surface-2); border: 0; padding: .6rem .9rem; min-height: 44px; cursor: pointer; text-align: left; }
.fc-sechead:hover { filter: brightness(.97); }
.fc-sechead .chev { transition: transform .15s; }
.fc-sec.collapsed .chev { transform: rotate(-90deg); }
.fc-sec.collapsed .fc-secbody { display: none; }
.fc-secbody { padding: .9rem; display: flex; flex-direction: column; gap: .6rem; }
.fc-grid.noside { grid-template-columns: 250px minmax(0, 1fr) 0; }
.fc-grid.noside .fc-side { display: none; }
@media (max-width: 1180px) { .fc-grid.noside { grid-template-columns: 220px minmax(0, 1fr) 0; } }
@media (max-width: 960px) { .fc-grid.noside { grid-template-columns: 1fr; } }
#tb-panel[aria-pressed="false"] { background: var(--fc-accent); color: var(--fc-accent-text); border-color: var(--fc-accent); }

/* ---------- the one button that marks the work ---------- */
.fc-btn.check { background: var(--fc-accent); border-color: var(--fc-accent); color: var(--fc-accent-text); font-weight: 800; }
.fc-btn.check:hover { filter: brightness(1.08); }

/* ---------- zoom / tidy controls floating over the canvas ---------- */
.fc-canvas-tools { position: absolute; top: 10px; right: 14px; z-index: 7; display: flex; gap: .25rem; padding: .25rem; border-radius: 12px; background: color-mix(in srgb, var(--fc-surface) 92%, transparent); box-shadow: var(--fc-shadow); }
.fc-canvas-tools .fc-btn { min-height: 36px; }
.fc-canvas-tools .fc-btn.icon { width: 36px; }
/* when Task and Try it are both open, keep the picture on screen: the task text scrolls */
.fc-sec[data-sec="task"]:not(.collapsed) + .fc-sec[data-sec="sim"]:not(.collapsed) { }
.fc-stack:has(.fc-sec[data-sec="sim"]:not(.collapsed)) .fc-sec[data-sec="task"] .fc-secbody { max-height: 36vh; overflow-y: auto; }
@media (max-width: 960px) { .fc-stack .fc-sec[data-sec="task"] .fc-secbody { max-height: none !important; } }

/* ---------- home: collapsible levels ---------- */
details.fc-level > summary { list-style: none; cursor: pointer; }
details.fc-level > summary::-webkit-details-marker { display: none; }
details.fc-level > summary .fc-level-head::before { content: "▸"; color: var(--fc-muted); font-size: .9rem; transition: transform .15s; display: inline-block; }
details.fc-level[open] > summary .fc-level-head::before { transform: rotate(90deg); }
.fc-level-prog { font-size: .8rem; font-weight: 700; color: var(--fc-muted); background: var(--fc-surface-2); border-radius: 999px; padding: .1rem .55rem; }
.fc-secure { font-size: .78rem; font-weight: 800; color: #166534; background: #dcfce7; border: 1px solid #86efac; border-radius: 999px; padding: .1rem .55rem; }
details.fc-level:not([open]) { margin-bottom: .6rem; }

.fc-lights { display: inline-flex; gap: 3px; }
.fc-lights span { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: .65rem; font-weight: 700; background: #cbd5e1; color: #334155; }
.fc-lights span.on { background: #fbbf24; box-shadow: 0 0 6px #f59e0b; color: #78350f; }
.fc-teacher-tag { align-self: center; font-weight: 800; color: #92400e; background: #fef3c7; border: 1px solid #f59e0b; border-radius: 999px; padding: .2rem .7rem; }

/* sequence strip shown in a task (e.g. traffic lights) */
.fc-seq { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; margin: .7rem 0 .2rem; }
.fc-seqstep { display: inline-flex; flex-direction: column; align-items: center; gap: .1rem; background: var(--fc-surface-2); border-radius: 8px; padding: .35rem .4rem; min-width: 64px; }
.fc-seqstep b { font-size: .72rem; text-align: center; line-height: 1.1; }
.fc-seqstep small { font-size: .72rem; color: var(--fc-muted); font-weight: 700; }
.fc-seqarrow { font-weight: 800; color: var(--fc-muted); }

/* "Watch how it should work" */
.fc-demo-btn { align-self: flex-start; background: #eef2ff; border-color: #c7d2fe; color: #3730a3; }
.fc-dialog.fc-demo { width: min(620px, calc(100vw - 2rem)); }
.fc-demo .fc-mimic svg { max-height: 46vh; }
.fc-demo-bar { display: flex; align-items: center; gap: .6rem; margin: .5rem 0; font-family: var(--fc-mono); font-weight: 700; }
.fc-demo-track { flex: 1; height: 8px; border-radius: 4px; background: var(--fc-surface-2); overflow: hidden; }
#demo-fill { height: 100%; width: 0; background: var(--fc-accent); }
.fc-demo-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 560px) { .fc-demo-cols { grid-template-columns: 1fr; } }
.fc-demo-cols h4 { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--fc-muted); margin: .2rem 0 .4rem; }
.fc-demo-events { list-style: none; margin: 0; padding: 0; font-size: .88rem; max-height: 9.5rem; overflow-y: auto; }
.fc-demo-events li { padding: .15rem .35rem; border-radius: 6px; color: var(--fc-muted); }
.fc-demo-events li .t { font-family: var(--fc-mono); font-size: .8rem; }
.fc-demo-events li.past { color: var(--fc-text); }
.fc-demo-events li.now { background: #fef3c7; font-weight: 700; }

/* =========================================================================
   Exam practice (past-paper flowchart questions)
   ========================================================================= */
/* boxes on the canvas */
.fc-inout .fc-shape { fill: var(--fc-io); stroke: var(--fc-io-line); }
.fc-pal.fc-inout svg .fc-shape { fill: var(--fc-io); stroke: var(--fc-io-line); }
.fc-block.given .fc-shape { stroke-width: 2.6; }
.fc-letter circle { fill: var(--fc-text); }
.fc-letter text { fill: #fff; font: 800 12px var(--fc-font); text-anchor: middle; pointer-events: none; }
.fc-port-letter { font: 800 10px var(--fc-font); text-anchor: middle; pointer-events: none; fill: var(--fc-link); }
.fc-port.yes .fc-port-letter { fill: var(--fc-yes); }
.fc-port.no .fc-port-letter { fill: var(--fc-no); }
.fc-port:hover .fc-port-letter, .fc-port.active .fc-port-letter { fill: #fff; }
.fc-good { color: var(--fc-good); font-weight: 700; }

/* list of questions */
.fc-xfilters { display: flex; flex-wrap: wrap; gap: .5rem .9rem; align-items: center; margin: .25rem 0 .9rem; }
.fc-course button small { font-weight: 500; opacity: .8; }
.fc-xsel { display: inline-flex; align-items: center; gap: .35rem; font-size: .88rem; font-weight: 600; color: var(--fc-muted); }
.fc-xsel select, .fc-xsearch { font: inherit; min-height: 40px; border: 1px solid var(--fc-border); border-radius: 8px; padding: 0 .5rem; background: var(--fc-surface); color: var(--fc-text); }
.fc-xsearch { flex: 1 1 200px; min-width: 0; max-width: 320px; }
.fc-xsummary { margin: 0 0 1.25rem; color: var(--fc-muted); }
.fc-xsummary b { color: var(--fc-text); }
.fc-xgroup { margin-bottom: 1.75rem; }
.fc-xgroup h2 { font-size: 1.2rem; margin-bottom: .6rem; display: flex; align-items: center; gap: .5rem; }
a.fc-card { text-decoration: none; }
.fc-xcard { min-height: 150px; }
.fc-xcard h3 { font-size: 1rem; }
.fc-pastpaper { display: inline-block; font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; padding: .12rem .5rem; border-radius: 999px; background: #ede9fe; color: #5b21b6; border: 1px solid #c4b5fd; vertical-align: middle; }
.fc-pastpaper.big { font-size: .78rem; }
.fc-marks { font-size: .8rem; font-weight: 700; color: var(--fc-muted); }
.fc-ref { font-family: var(--fc-mono); font-size: .78rem; color: var(--fc-muted); }
.fc-done.part { color: var(--fc-warn); }
.fc-copyright { font-size: .78rem; color: var(--fc-muted); margin: 1.5rem 0 0; }

/* question workspace */
.fc-xq .fc-toolbar h2 { display: flex; align-items: center; gap: .5rem; min-width: 0; flex: 1 1 8rem; overflow: hidden; }
.fc-xq .fc-toolbar h2 .fc-pastpaper { flex: none; }
#xq-title-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.fc-xq .fc-toolbar { flex-wrap: nowrap; gap: .4rem .6rem; }
.fc-app:has(#view-xq:not([hidden])) { height: 100vh; min-height: 0; }
.fc-xq { min-height: 0; }
.fc-xq .fc-grid { flex: 1 1 0; height: auto; min-height: 0; }
@media (max-width: 1100px) { .fc-xq .fc-toolbar { flex-wrap: wrap; } }
.fc-xparts { display: flex; gap: .25rem; flex-wrap: wrap; }
.fc-xpart { font: inherit; font-weight: 800; font-size: .88rem; min-height: 38px; min-width: 44px; padding: .25rem .65rem; border-radius: 8px; border: 1px solid var(--fc-border); background: var(--fc-surface); color: var(--fc-text); cursor: pointer; touch-action: manipulation; }
.fc-xpart[aria-selected="true"] { background: var(--fc-accent); color: var(--fc-accent-text); border-color: var(--fc-accent); }
.fc-xpart.full:not([aria-selected="true"]) { border-color: #86efac; background: #dcfce7; color: #166534; }
.fc-xpart.some:not([aria-selected="true"]) { border-color: #fcd34d; background: #fef9c3; }
.fc-xpart.practice { border-style: dashed; font-weight: 600; }
.fc-timer { display: inline-flex; align-items: center; gap: .1rem; font-variant-numeric: tabular-nums; }
.fc-timer .tm { font-weight: 700; font-size: .9rem; padding: .2rem .5rem; border-radius: 999px; background: var(--fc-surface-2); white-space: nowrap; }
.fc-timer.soon .tm { background: #fef3c7; color: #92400e; }
.fc-timer.over .tm { background: #ffedd5; color: #9a3412; }
.fc-timer.paused .tm { opacity: .6; }
.fc-timer .fc-btn.icon { width: 34px; min-height: 34px; font-size: .9rem; }

.fc-xcenter { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.fc-xcenter > .fc-canvas-outer { flex: 1 1 auto; min-height: 0; }
.fc-xcenter.docked > .fc-canvas-outer { flex: 1 1 52%; }
.fc-xcenter.dock-big > .fc-canvas-outer { flex: 1 1 48%; }
.fc-dock { flex: 0 1 48%; min-height: 0; overflow: auto; background: var(--fc-surface); border-top: 2px solid var(--fc-border); padding: .6rem .8rem .9rem; display: flex; flex-direction: column; gap: .5rem; }
.fc-dockhead { display: flex; flex-wrap: wrap; gap: .25rem .6rem; align-items: baseline; font-size: .92rem; }
.fc-docktask { color: var(--fc-muted); }
.fc-canvas-label { position: absolute; left: 12px; top: 10px; z-index: 7; font-size: .82rem; font-weight: 700; background: color-mix(in srgb, var(--fc-surface) 92%, transparent); border: 1px solid var(--fc-border); border-radius: 999px; padding: .2rem .7rem; box-shadow: var(--fc-shadow); }
.fc-answer { width: 100%; font: inherit; border: 1px solid var(--fc-border); border-radius: 8px; padding: .6rem; resize: vertical; min-height: 7rem; background: #fff; color: var(--fc-text); }
.fc-answer.mono { font-family: var(--fc-mono); font-size: .88rem; min-height: 12rem; white-space: pre; tab-size: 4; }
.fc-xpal { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; }
.fc-xgrid.viewonly { grid-template-columns: minmax(0, 1fr) 360px; }
.fc-xgrid.viewonly > .fc-left { display: none; }
.fc-xgrid.viewonly.noside { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 1180px) { .fc-xgrid.viewonly { grid-template-columns: minmax(0, 1fr) 320px; } }
#xq-props .fc-seg { display: flex; flex-wrap: wrap; width: 100%; }
#xq-props .fc-seg button { flex: 1 1 auto; padding: .35em .5em; font-size: .84rem; min-height: 36px; }
#xq-speed { width: auto; }
@media (max-width: 960px) { .fc-xgrid.viewonly, .fc-xgrid.viewonly.noside { grid-template-columns: 1fr; } }

/* typing in a box */
.fc-boxtext { font-family: var(--fc-mono); font-size: .95rem; width: 100%; border: 1px solid var(--fc-border); border-radius: 8px; padding: .45rem .55rem; resize: vertical; min-height: 4.2rem; background: #fff; color: var(--fc-text); }
.fc-boxtext[readonly] { background: var(--fc-surface-2); }
.fc-symkeys { display: flex; flex-wrap: wrap; gap: .25rem; margin: -.1rem 0 .4rem; }
.fc-sym { font: 700 .85rem var(--fc-mono); min-width: 36px; min-height: 34px; padding: 0 .45rem; border: 1px solid var(--fc-border); border-radius: 6px; background: var(--fc-surface); color: var(--fc-text); cursor: pointer; touch-action: manipulation; }
.fc-sym:hover { border-color: var(--fc-accent); }
.fc-feedback { font-size: .84rem; margin: 0 0 .6rem; padding: .35rem .5rem; border-radius: 6px; }
.fc-feedback:empty { display: none; }
.fc-feedback.ok { background: #dcfce7; color: #166534; }
.fc-feedback.warn { background: #fef3c7; color: #92400e; }
.fc-feedback.bad { background: #fee2e2; color: var(--fc-bad); }
.fc-examples summary { cursor: pointer; font-weight: 600; font-size: .88rem; color: var(--fc-accent); }
.fc-examples ul { padding-left: 1.1rem; margin: .4rem 0 0; font-size: .86rem; }
.fc-label-note { font-size: .88rem; margin: 0 0 .5rem; display: flex; align-items: center; gap: .4rem; }
.fc-letterchip { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--fc-text); color: #fff; font-weight: 800; font-size: .8rem; }

/* question panel */
.fc-xbadge { display: flex; flex-direction: column; gap: .15rem; padding: .7rem .8rem; border-radius: var(--fc-radius); background: #f5f3ff; border: 1px solid #ddd6fe; font-size: .88rem; }
.fc-xbadge .fc-pastpaper { align-self: flex-start; margin-bottom: .2rem; }
.fc-note { font-size: .86rem; background: #eff6ff; border-left: 4px solid var(--fc-accent); padding: .45rem .65rem; border-radius: 0 8px 8px 0; margin: 0; }
.fc-md { font-size: .93rem; }
.fc-md p { margin: 0 0 .55rem; }
.fc-md ul, .fc-md ol { margin: 0 0 .55rem; padding-left: 1.2rem; }
.fc-md li.sub { margin-left: 1rem; list-style: circle; }
.fc-md p:last-child { margin-bottom: 0; }
.fc-pseudo { font-family: var(--fc-mono); font-size: .8rem; background: #f8fafc; color: #0f172a; border: 1px solid var(--fc-border); padding: .6rem .7rem; border-radius: 8px; overflow: auto; white-space: pre; margin: 0 0 .5rem; tab-size: 4; }
.fc-tablewrap { overflow-x: auto; max-width: 100%; }
.fc-mdtable { border-collapse: collapse; font-size: .84rem; margin: 0 0 .5rem; }
.fc-mdtable th, .fc-mdtable td { border: 1px solid var(--fc-border); padding: .2rem .45rem; text-align: left; white-space: nowrap; }
.fc-mdtable th { background: var(--fc-surface-2); }
.fc-xpartcard { border: 1px solid var(--fc-border); border-radius: var(--fc-radius); padding: .65rem .75rem; display: flex; flex-direction: column; gap: .4rem; cursor: pointer; }
.fc-xpartcard.on { border: 2px solid var(--fc-accent); background: color-mix(in srgb, var(--fc-accent) 5%, var(--fc-surface)); cursor: default; }
.fc-xpartcard.practice { border-style: dashed; }
.fc-xpartcard .head { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.fc-xpartcard .mk { margin-left: auto; font-size: .82rem; font-weight: 700; color: var(--fc-muted); white-space: nowrap; }
.fc-xpartcard .fc-btn { align-self: flex-start; }
.fc-tag2 { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--fc-muted); background: var(--fc-surface-2); border-radius: 999px; padding: .05rem .45rem; }
.fc-xfoot { display: flex; flex-direction: column; gap: .3rem; align-items: flex-start; margin-top: .5rem; }
.fc-xfoot .fc-copyright { margin: 0; }

/* trace tables */
.fc-tracewrap h4 { margin: .2rem 0 .3rem; font-size: .85rem; }
.fc-trace { border-collapse: collapse; font-size: .88rem; }
.fc-trace th { background: var(--fc-surface-2); border: 1px solid var(--fc-border); padding: .3rem .4rem; font-family: var(--fc-mono); font-size: .8rem; white-space: nowrap; position: sticky; top: 0; z-index: 1; }
.fc-trace td { border: 1px solid var(--fc-border); padding: 0; }
.fc-trace input { font: inherit; font-family: var(--fc-mono); font-size: .86rem; width: 6.2em; min-height: 34px; border: 0; padding: 0 .35rem; background: transparent; color: var(--fc-text); }
.fc-trace td.out input { width: 15em; }
.fc-trace input:focus { outline: 2px solid var(--fc-accent); outline-offset: -2px; background: #eff6ff; }
.fc-trace input.pre { background: var(--fc-surface-2); color: var(--fc-muted); }
.fc-traceres { display: flex; flex-wrap: wrap; gap: .3rem; margin: .4rem 0; }
.fc-traceres span { font-size: .8rem; font-weight: 700; padding: .1rem .5rem; border-radius: 999px; border: 1px solid; }
.fc-traceres .ok { color: #166534; background: #dcfce7; border-color: #86efac; }
.fc-traceres .part { color: #92400e; background: #fef3c7; border-color: #fcd34d; }
.fc-traceres .bad { color: var(--fc-bad); background: #fee2e2; border-color: #fca5a5; }

/* Try it */
.fc-queue { font-family: var(--fc-mono); font-size: .88rem; width: 100%; border: 1px solid var(--fc-border); border-radius: 8px; padding: .4rem .5rem; resize: vertical; background: #fff; color: var(--fc-text); }
.fc-console { font-family: var(--fc-mono); font-size: .84rem; background: #0f172a; color: #e2e8f0; border-radius: 8px; padding: .5rem .6rem; max-height: 32vh; min-height: 4.5rem; overflow: auto; white-space: pre-wrap; word-break: break-word; }
.fc-console .in { color: #7dd3fc; }
.fc-console .call { color: #c4b5fd; }
.fc-console .more { color: #94a3b8; font-style: italic; }
.fc-console .ask { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; margin-top: .35rem; color: #fde68a; }
.fc-askin { font: inherit; min-height: 34px; border-radius: 6px; border: 2px solid #fde68a; padding: 0 .4rem; background: #fff; color: #0f172a; flex: 1 1 8em; min-width: 0; }
.fc-xvars { display: flex; flex-direction: column; gap: .35rem; }
.fc-vartable { border-collapse: collapse; font-size: .84rem; width: 100%; }
.fc-vartable th { text-align: left; font-family: var(--fc-mono); font-weight: 700; padding: .15rem .4rem; border-bottom: 1px solid var(--fc-border); white-space: nowrap; }
.fc-vartable td { font-family: var(--fc-mono); padding: .15rem .4rem; border-bottom: 1px solid var(--fc-border); word-break: break-all; }
.fc-arr summary { cursor: pointer; font-family: var(--fc-mono); font-weight: 700; font-size: .86rem; }
.fc-arr .fc-vartable { margin-top: .2rem; }

/* Marks tab */
.fc-xmh { font-size: 1rem; }
.fc-points { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .3rem; font-size: .88rem; }
.fc-points label { display: flex; gap: .45rem; align-items: flex-start; cursor: pointer; }
.fc-points input { width: 20px; height: 20px; margin-top: .1rem; flex: none; accent-color: var(--fc-accent); }
.fc-points li.ok { color: #166534; } .fc-points li.part { color: #92400e; } .fc-points li.bad { color: var(--fc-bad); }
.fc-xtotal { margin-top: .4rem; padding: .55rem .7rem; border-radius: 8px; background: var(--fc-surface-2); font-size: .92rem; }
.fc-row-btns { display: flex; flex-wrap: wrap; gap: .35rem; }
.fc-row-btns:empty { display: none; }
.fc-modeltrace summary { cursor: pointer; font-weight: 700; color: var(--fc-accent); }
.fc-scheme { background: var(--fc-surface-2); border-radius: 8px; padding: .55rem .7rem; }

/* model answer */
.fc-dialog.fc-modeldlg { width: min(900px, calc(100vw - 1.5rem)); max-height: calc(100vh - 2rem); }
.fc-modelhead { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.fc-mdlcanvas { height: min(58vh, 560px); overflow: auto; border: 1px solid var(--fc-border); border-radius: 10px; background: var(--fc-canvas); margin: .5rem 0; touch-action: pan-x pan-y; }
.fc-mdlcanvas svg { display: block; }

@media (max-width: 960px) {
  .fc-xcenter.docked > .fc-canvas-outer > .fc-canvas-wrap { height: 50vh; }
  .fc-dock { flex: none; max-height: none; }
  .fc-xq .fc-toolbar h2 { flex-basis: 100%; }
}
@media (max-width: 560px) {
  .fc-xpal { grid-template-columns: repeat(3, 1fr); }
  .fc-xsearch { max-width: none; }
}
@media (max-width: 960px) {
  .fc-app:has(#view-xq:not([hidden])) { height: auto; min-height: 100vh; }
  .fc-xq .fc-grid { flex: none; }
}
