/* Backstage Baxter — MagicQ practice animations
   Shares the course site's tokens (backstagebaxter.com /assets/css/site.css).
   MagicQ's own interface colours are used only where the drawings imitate its screen. */

:root {
  --ground: #0f0c09;
  --panel: #1b1510;
  --panel-2: #241c15;
  --rule: #3a2e22;
  --text: #f5eee4;
  --muted: #b3a593;
  --amber: #ffb13b;
  --amber-deep: #c96f12;
  --red: #ff4d3a;
  --ok: #7fd17f;

  /* MagicQ screen, sampled from Baxter's MagicQ PC 1.9.8.3 screenshots */
  --mq-screen: #101010;
  --mq-win: #141414;
  --mq-box: #363636;
  --mq-box-empty: #181818;
  --mq-key: #3b3b3b;
  --mq-key-edge: #555;
  --mq-soft: #383838;
  --mq-blue: #1f1aff;
  --mq-title-off: #40405c;
  --mq-cursor: #e8d23c;
  --mq-sel: #790002;
  --cc-key: #0c0d18;
  --cc-edge: #3a49c9;

  --display: "League Gothic", Impact, "Arial Narrow", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--panel); color: var(--text); font: 400 15.5px/1.5 var(--sans); overflow-x: hidden; }
body:not([data-embed]) { background: var(--ground); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- page shell ---------- */
.sim { max-width: 1040px; margin: 0 auto; padding: 0; }
body:not([data-embed]) .sim { padding: 24px 16px 40px; }
body:not([data-embed]) .sim__card { background: var(--panel); border: 1px solid var(--rule); border-radius: 14px; padding: 22px; }
body[data-embed] .sim__card { padding: 2px; }
.sim__head { display: none; margin-bottom: 18px; }
body:not([data-embed]) .sim__head { display: block; }
.sim__kicker { font: 500 12px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--amber); margin: 0 0 10px; }
.sim__title { font: 30px/1 var(--display); text-transform: uppercase; letter-spacing: .01em; margin: 0 0 8px; font-weight: 400; }
.sim__lede { color: var(--muted); margin: 0 0 14px; max-width: 70ch; }
.setupswitch { display: inline-flex; border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; }
.setupswitch button { background: transparent; border: 0; padding: 9px 12px; font: 500 13px/1 var(--mono); color: var(--muted); cursor: pointer; }
.setupswitch button[aria-pressed="true"] { background: rgba(255,177,59,.12); color: var(--amber); }
.sim__foot { margin: 14px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--muted); }
.sim__foot a { color: var(--amber); }

/* ---------- controls and caption ---------- */
.ctl { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }
.btn { display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding: 10px 14px; border-radius: 8px; border: 1.5px solid var(--rule); background: transparent; color: var(--text); font: 600 14px/1 var(--sans); cursor: pointer; }
.btn:hover { border-color: var(--muted); }
.btn--amber { background: var(--amber); border-color: var(--amber); color: var(--ground); }
.btn--amber:hover { background: #ffc35f; border-color: #ffc35f; }
.btn[hidden] { display: none; }
.btn svg { width: 14px; height: 14px; }
.ctl__hint { font: 500 12.5px/1.3 var(--mono); color: var(--muted); margin-left: auto; }
.say { margin: 12px 0 0; min-height: 3.2em; padding: 12px 14px; border-left: 3px solid var(--amber); background: var(--panel-2); border-radius: 0 8px 8px 0; font-size: 15.5px; line-height: 1.5; }
.say b { color: var(--amber); font-weight: 600; }
.say.is-warn { border-left-color: var(--red); }
.say .step { font: 600 11.5px/1 var(--mono); letter-spacing: .08em; color: var(--muted); margin-right: 8px; text-transform: uppercase; }

/* ---------- key chips (keys you press) ---------- */
.keys { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-top: 12px; }
.keys__label { font: 500 11.5px/1.2 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.k { position: relative; min-width: 48px; min-height: 42px; padding: 0 11px; border-radius: 4px; border: 1px solid var(--mq-key-edge); border-bottom-width: 3px; background: var(--mq-key); color: #fff; font: 600 13.5px/1 var(--mono); letter-spacing: .02em; cursor: pointer; white-space: nowrap; }
.k:hover { background: #474747; }
.k:active, .k.is-down { transform: translateY(1px); border-bottom-width: 2px; background: var(--mq-blue); }
.k--cc { background: var(--cc-key); border-color: var(--cc-edge); box-shadow: inset 0 0 0 1px rgba(80,110,255,.25); }
.k--cc:hover { background: #151832; }
.k small { display: block; font: 500 9.5px/1 var(--mono); color: #aab1ff; margin-top: 3px; letter-spacing: .04em; }
.k.is-latched { background: var(--mq-blue); }
.k-inline { display: inline-block; font: 600 12px/1 var(--mono); color: #fff; background: var(--mq-key); border: 1px solid var(--mq-key-edge); border-bottom-width: 2px; border-radius: 3px; padding: 3px 6px 2px; white-space: nowrap; vertical-align: 1px; }
.k-inline--cc { background: var(--cc-key); border-color: var(--cc-edge); }
.where { font: 500 10.5px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }

/* the hint ring: what the watch-through is about to press */
.is-hint { outline: 3px solid var(--amber) !important; outline-offset: 3px; animation: hint 1s ease-in-out infinite; }
@keyframes hint { 50% { outline-color: rgba(255,177,59,.35); } }
.is-flash { animation: flash .5s ease-out 1; }
@keyframes flash { from { box-shadow: 0 0 0 3px var(--amber); } to { box-shadow: 0 0 0 3px transparent; } }

@media (prefers-reduced-motion: reduce) {
  .is-hint { animation: none; }
  .is-flash { animation: none; }
  * { transition: none !important; }
}

/* ---------- a MagicQ screen, drawn ---------- */
.mq { background: var(--mq-screen); border: 1px solid #2a2a2a; border-radius: 8px; padding: 6px; color: #fff; font-family: var(--sans); container-type: inline-size; }
.mq__note { font: 500 11px/1.3 var(--mono); color: #8d8478; margin: 6px 2px 0; }

/* soft-button row */
.softrow { display: grid; grid-template-columns: repeat(16, minmax(0, 1fr)); gap: 2px; }
.soft { min-height: 34px; background: var(--mq-soft); border: 0; border-radius: 2px 2px 6px 2px; color: #fff; font: 600 9px/1.12 var(--sans); text-transform: uppercase; display: flex; align-items: center; justify-content: center; text-align: center; padding: 2px 1px; overflow: hidden; word-break: break-word; cursor: default; }
.soft.is-lit { background: var(--mq-blue); }
.soft:empty { background: #262626; }
button.soft { cursor: pointer; }
@container (max-width: 560px) {
  .softrow { grid-template-columns: repeat(8, minmax(0, 1fr)); }
  .soft { min-height: 32px; font-size: 8.5px; }
}

/* body: encoders left, windows middle, encoders right */
.mq__body { display: grid; grid-template-columns: 76px minmax(0, 1fr) 76px; gap: 4px; margin-top: 4px; }
.enccol { display: grid; grid-template-rows: repeat(4, minmax(0, 1fr)); gap: 4px; }
.enc { position: relative; background: var(--mq-box); border-radius: 2px; padding: 15px 3px 4px; text-align: center; font: 500 10.5px/1.25 var(--sans); color: #eee; min-height: 58px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 2px; border: 0; width: 100%; min-width: 0; }
button.enc { cursor: pointer; }
.enc__l { position: absolute; top: 3px; left: 4px; font: 700 10px/1 var(--mono); color: #9a9a9a; }
.enc__n { max-width: 100%; overflow-wrap: anywhere; }
.enc__v { color: #cfcfcf; font-size: 10px; }
/* the encoder's soft-button legend: its own chip under the value, never on top of it */
.enc__s { display: block; max-width: 100%; margin-top: 2px; padding: 2px 4px; background: #262626; border-radius: 2px 2px 5px 2px; font: 600 8.5px/1.15 var(--sans); color: #ddd; overflow-wrap: anywhere; }
.enc__n:empty, .enc__v:empty, .enc__s:empty { display: none; }
.enc.is-changed { animation: encflash .6s ease-out 1; }
@keyframes encflash { from { background: #4a4a7a; } to { background: var(--mq-box); } }
@media (prefers-reduced-motion: reduce) { .enc.is-changed { animation: none; } }

.wins { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(2, auto); gap: 4px; }
.win { background: var(--mq-win); border: 1px solid #2c2c2c; min-width: 0; }
.win__bar { display: flex; align-items: center; gap: 6px; background: var(--mq-title-off); color: #fff; font: 500 10.5px/1 var(--sans); padding: 4px 5px; white-space: nowrap; overflow: hidden; transition: background .25s; }
.win.is-active .win__bar { background: var(--mq-blue); }
.win__name { overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.win__icons { display: flex; gap: 5px; flex: none; }
.win__icons i { width: 10px; height: 10px; display: block; border: 1px solid #fff; position: relative; }
.win__icons i.x { border: 0; }
.win__icons i.x::before, .win__icons i.x::after { content: ""; position: absolute; left: 4px; top: -1px; width: 1.4px; height: 12px; background: #fff; transform: rotate(45deg); }
.win__icons i.x::after { transform: rotate(-45deg); }
.win__icons i.o::after { content: ""; position: absolute; left: 1px; right: 1px; top: 3px; height: 1px; background: #fff; }
.win__grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 2px; padding: 3px; container-type: inline-size; }
.it { position: relative; background: var(--mq-box); min-height: 34px; border: 0; padding: 12px 2px 5px; color: #fff; font: 400 9.5px/1.15 var(--sans); text-align: center; cursor: pointer; overflow: hidden; outline-offset: -2px; }
.it.is-empty { background: var(--mq-box-empty); cursor: default; }
.it__n { position: absolute; top: 2px; left: 3px; font-size: 8.5px; color: #d8d8d8; }
.it__t { position: absolute; top: 2px; right: 3px; font-size: 8px; color: #d8d8d8; }
.it__name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.it__bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; }
.it__dot { display: block; width: 8px; height: 8px; border-radius: 50%; margin: 0 auto 2px; }
.it__icon { display: block; width: 8px; height: 8px; border-radius: 50%; border: 1px solid #ddd; margin: 0 auto 2px; }
.it.is-sel { background: var(--mq-sel); }
.it.is-cursor { box-shadow: inset 0 0 0 2px var(--mq-cursor); }
.win.is-active .it.is-cursor { box-shadow: inset 0 0 0 2px var(--mq-cursor), 0 0 0 1px var(--mq-cursor); }
@container (max-width: 300px) {
  .it { min-height: 26px; padding: 10px 1px 3px; }
  .it__name, .it__t, .it__dot, .it__icon { display: none; }
  .it__n { position: static; font-size: 8px; }
}

/* status display and command line */
.mq__status { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 3px; margin-top: 4px; background: #000; padding: 2px; font: 400 11px/1.45 var(--sans); color: #e8e8e8; }
.mq__status > div { background: #1f201d; padding: 3px 7px; min-height: 36px; min-width: 0; }
.mq__status > div + div { background: var(--mq-box); }
.mq__status span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmd__reply { min-height: 1.45em; }
.cmd__reply.is-new { animation: replyin .5s ease-out 1; }
@keyframes replyin { from { background: #4a4a7a; } to { background: transparent; } }
@media (prefers-reduced-motion: reduce) { .cmd__reply.is-new { animation: none; } }

@container (max-width: 560px) {
  .mq__body { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .mq__body .wins { grid-column: 1 / -1; grid-row: 1; }
  .enccol { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: none; }
  .enc { min-height: 50px; }
  .mq__status { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- playback legends and controls, drawn ---------- */
.legends { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 3px; background: #000; padding: 3px; }
.lg { position: relative; background: var(--mq-box); min-height: 66px; padding: 2px 5px 4px; font: 400 10.5px/1.25 var(--sans); color: #fff; min-width: 0; border: 0; text-align: left; display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto 1fr; align-content: start; }
.lg__pb { font-size: 10px; }
.lg__count { text-align: right; font-size: 10px; }
.lg__name { grid-column: 1 / -1; text-align: center; font-size: 11px; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 1.25em; }
.lg__sub { grid-column: 1 / -1; font-size: 10px; padding-left: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lg.is-sel { background: linear-gradient(var(--mq-blue) 0 15px, var(--mq-box) 15px); }
.lg.is-empty .lg__pb { color: #777; }
.pbbtns { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 3px; margin-top: 6px; }
.pbbtns > div { display: flex; justify-content: center; }

/* ---------- MagicQ dialogs, drawn ---------- */
.mqdlg { background: #000; border: 1px solid #555; border-radius: 4px; overflow: hidden; }
.mqdlg__title { background: var(--mq-blue); color: #fff; font: 500 12.5px/1.2 var(--sans); padding: 6px 9px; }
.mqdlg__body { padding: 10px; }
.mqdlg input[type=text] { width: 100%; background: #333; color: #fff; border: 0; padding: 8px 10px; font: 500 15px/1.2 var(--mono); border-radius: 0; }
.mqdlg input[type=text]:focus { outline: 2px solid var(--mq-cursor); outline-offset: 0; }
.mqdlg__row { display: flex; gap: 6px; margin-top: 8px; justify-content: flex-end; }
.mqbtn { min-height: 40px; min-width: 70px; padding: 0 12px; background: var(--mq-key); border: 0; border-radius: 3px; color: #fff; font: 600 13px/1 var(--sans); cursor: pointer; }
.mqbtn:hover { background: #4b4b4b; }
.mqbtn--go { background: var(--mq-blue); }
.mqbtn[disabled] { opacity: .45; cursor: not-allowed; }

/* ---------- standalone index ---------- */
.list { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 10px; }
.list a { display: block; padding: 14px 16px; border: 1px solid var(--rule); border-radius: 10px; color: var(--text); text-decoration: none; background: var(--panel); }
.list a:hover { border-color: var(--amber); }
.list b { display: block; font: 24px/1 var(--display); text-transform: uppercase; font-weight: 400; margin-bottom: 4px; }
.list span { color: var(--muted); font-size: 14.5px; }
.list code { font: 500 12px/1 var(--mono); color: var(--amber); }
