/* The MARN Engine's design system (engine/src/design/tokens.css and kit.css), copied by scripts/build.mjs. Don't edit here. */
/* The MARN design system's tokens: every colour, type size, space, radius and height the engine's own pages use (the
   home, MARN Studio, engine settings). From the brand (engine/brand/README.md): amber #EBA53F on charcoal #16171B, warm
   white #F2ECE2. A game's theme (games/<game>/game/theme.css: --ink, --amber, --line…) is for the game and its stage
   only; engine UI uses these. The components that use them are in kit.css. */
:root {
  /* surfaces, from the back to the front */
  --m-bg: #111215;          /* the page */
  --m-surface: #16171B;     /* panels, the top bar, cards (the brand's charcoal) */
  --m-raised: #1D1F24;      /* buttons, menus, a card on a panel */
  --m-sunk: #0D0E10;        /* fields and wells */
  --m-hover: #24262D;
  --m-line: #2A2C33;        /* borders and dividers */
  --m-line-strong: #3A3D46;
  /* text */
  --m-ink: #F2ECE2;         /* the brand's warm white */
  --m-ink-2: #BDB6AA;       /* labels, secondary text */
  --m-ink-3: #847E75;       /* hints, section labels, metadata */
  /* the one accent, and what it says */
  --m-amber: #EBA53F;
  --m-amber-hover: #F2B65A;
  --m-amber-ink: #1B1306;   /* text on amber */
  --m-amber-soft: rgba(235, 165, 63, .13);
  --m-amber-line: rgba(235, 165, 63, .45);
  --m-ok: #6CC3A6; --m-ok-soft: rgba(108, 195, 166, .13);
  --m-bad: #F06B5B; --m-bad-ink: #1A0B09; --m-bad-soft: rgba(240, 107, 91, .12); --m-bad-text: #FFB1A6;
  --m-info: #8DB8F2; --m-info-soft: rgba(141, 184, 242, .13);
  /* type: one family for everything, Arabic included; mono for ids */
  --m-font: 'IBM Plex Sans Arabic', 'Segoe UI', system-ui, sans-serif;
  --m-mono: ui-monospace, 'Cascadia Mono', Consolas, monospace;
  --m-t-xs: 11px; --m-t-s: 12.5px; --m-t-m: 13.5px; --m-t-l: 16px; --m-t-xl: 20px; --m-t-2xl: 26px;
  /* space on a 4 px scale; radius; control height */
  --m-1: 4px; --m-2: 8px; --m-3: 12px; --m-4: 16px; --m-5: 24px; --m-6: 32px;
  --m-r-s: 6px; --m-r-m: 9px; --m-r-l: 13px; --m-r-pill: 99px;
  --m-h: 30px; --m-h-l: 36px;
  --m-shadow: 0 10px 30px rgba(0, 0, 0, .45);
  --m-focus: 0 0 0 3px var(--m-amber-soft);
  --m-dots: #22242B;        /* the canvas's dot grid */
  /* form fields: a darker well and a clear border, so what is typed reads (R13) */
  --m-field-bg: #0F1013; --m-field-line: #3A3D46; --m-field-line-hover: #4E525E; --m-t-field: 14px; --m-h-field: 34px;
  color-scheme: dark;
}
/* Wide screens: text a step larger, so it doesn't shrink to nothing on a big monitor. */
@media (min-width: 1800px) {
  :root { --m-t-xs: 11.5px; --m-t-s: 13px; --m-t-m: 14.5px; --m-t-l: 17px; --m-t-xl: 21px; --m-t-2xl: 28px; --m-h: 32px; }
}
/* The light look (engine settings: studio.theme), warm paper with charcoal text; the darker amber reads on it. */
:root[data-theme="light"] {
  --m-bg: #EFEBE3; --m-surface: #F8F5EF; --m-raised: #FFFFFF; --m-sunk: #F2EEE7; --m-hover: #E9E3D8;
  --m-line: #DCD4C6; --m-line-strong: #C6BCAB;
  --m-ink: #16171B; --m-ink-2: #4A463F; --m-ink-3: #7A746A;
  --m-amber: #C8831F; --m-amber-hover: #B8791F; --m-amber-ink: #FFFFFF; --m-amber-soft: rgba(200, 131, 31, .13); --m-amber-line: rgba(200, 131, 31, .5);
  --m-ok: #2E8C6E; --m-ok-soft: rgba(46, 140, 110, .12); --m-bad: #C9412F; --m-bad-ink: #FFFFFF; --m-bad-soft: rgba(201, 65, 47, .1); --m-bad-text: #A8331F;
  --m-info: #3A6FB5; --m-info-soft: rgba(58, 111, 181, .12);
  --m-shadow: 0 10px 28px rgba(40, 30, 10, .16);
  --m-dots: #D6CEBF;
  --m-field-bg: #FFFFFF; --m-field-line: #C6BCAB; --m-field-line-hover: #A99F8E;
  color-scheme: light;
}

/* The MARN design system's components, on the tokens in tokens.css. The studio's own class names (st-btn, st-in,
   st-seg, st-tabs…) and the home's (mh-btn…) are styled here too, so every view that already uses them follows. New code
   can use either; the m- names are for pages outside the studio. */
/* buttons: raised by default; primary is amber; quiet is an icon or a link-like button; danger is tinted red */
.m-btn, .st-btn, .mh-btn {
  height: var(--m-h); display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 11px; box-sizing: border-box;
  border-radius: var(--m-r-s); border: 1px solid var(--m-line); background: var(--m-raised); color: var(--m-ink);
  font: 500 var(--m-t-s) var(--m-font); text-decoration: none; white-space: nowrap; cursor: pointer; transition: background .12s, border-color .12s;
}
.m-btn:hover:not(:disabled), .st-btn:hover:not(:disabled), .mh-btn:hover:not(:disabled) { background: var(--m-hover); border-color: var(--m-line-strong); }
.m-btn:disabled, .st-btn:disabled, .mh-btn:disabled { opacity: .4; cursor: default; }
/* a file picker's own button looks like the kit's, and the file's name beside it is quiet */
input[type="file"] { font: var(--m-t-s) var(--m-font); color: var(--m-ink-3); max-width: 100%; }
input[type="file"]::file-selector-button {
  height: var(--m-h); padding: 0 11px; margin-inline-end: 10px; border-radius: var(--m-r-s); border: 1px solid var(--m-line); background: var(--m-raised);
  color: var(--m-ink); font: 500 var(--m-t-s) var(--m-font); cursor: pointer; transition: background .12s, border-color .12s;
}
input[type="file"]:hover::file-selector-button { background: var(--m-hover); border-color: var(--m-line-strong); }
.m-btn.primary, .st-btn.primary, .mh-btn.primary { background: var(--m-amber); border-color: var(--m-amber); color: var(--m-amber-ink); font-weight: 650; }
.m-btn.primary:hover:not(:disabled), .st-btn.primary:hover:not(:disabled), .mh-btn.primary:hover:not(:disabled) { background: var(--m-amber-hover); border-color: var(--m-amber-hover); }
.m-btn.danger, .st-btn.danger { color: var(--m-bad-text); border-color: rgba(240, 107, 91, .4); background: var(--m-bad-soft); }
.m-btn.quiet { background: transparent; border-color: transparent; color: var(--m-ink-2); }
.m-btn:focus-visible, .st-btn:focus-visible, .mh-btn:focus-visible, .m-icon:focus-visible, .st-icon:focus-visible { outline: none; box-shadow: var(--m-focus); border-color: var(--m-amber); }
.m-icon, .st-icon {
  width: var(--m-h); height: var(--m-h); display: inline-flex; align-items: center; justify-content: center; padding: 0; box-sizing: border-box;
  border-radius: var(--m-r-s); border: 1px solid transparent; background: transparent; color: var(--m-ink-2); font-size: 15px; cursor: pointer;
}
.m-icon:hover:not(:disabled), .st-icon:hover:not(:disabled) { background: var(--m-hover); color: var(--m-ink); }
.m-icon:disabled, .st-icon:disabled { opacity: .3; cursor: default; }
.m-icon.danger, .st-icon.danger { color: var(--m-bad-text); }

/* fields (R13): 14 px on a darker well with a clear border; amber focus ring, red for a problem; labels above in 12 px */
.m-in, .st-in {
  width: 100%; box-sizing: border-box; padding: 7px 10px; border-radius: 7px; border: 1px solid var(--m-field-line);
  background: var(--m-field-bg); color: var(--m-ink); font: var(--m-t-field)/1.5 var(--m-font);
}
input.m-in, select.m-in, input.st-in, select.st-in { min-height: var(--m-h-field); }
.m-in:hover, .st-in:hover { border-color: var(--m-field-line-hover); }
.m-in:focus, .st-in:focus { outline: none; border-color: var(--m-amber); box-shadow: var(--m-focus); }
.m-in:disabled, .st-in:disabled { opacity: .5; }
.m-in.bad, .st-in.bad, .st-bad-field { border-color: var(--m-bad) !important; box-shadow: 0 0 0 3px var(--m-bad-soft); }
select.m-in, select.st-in { appearance: none; padding-inline-end: 28px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--m-ink-2) 50%), linear-gradient(135deg, var(--m-ink-2) 50%, transparent 50%);
  background-position: calc(100% - 15px) 52%, calc(100% - 10px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
select.m-in[dir="rtl"], select.st-in[dir="rtl"] { background-position: 10px 52%, 15px 52%; }
.m-field, .st-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.m-field > span, .st-field > span { font: 600 12px var(--m-font); color: var(--m-ink-2); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.m-field em, .st-field em { font-style: normal; font-weight: 400; color: var(--m-ink-3); }
.m-field small, .m-help { color: var(--m-ink-3); font-size: 12px; }
.m-error { color: var(--m-bad-text); font-size: 12px; }
.m-lang { font: 600 var(--m-t-xs) var(--m-font); letter-spacing: .06em; padding: 1px 5px; border-radius: 4px; background: var(--m-raised); color: var(--m-ink-3); border: 1px solid var(--m-line); }
/* a number with − and + (and its unit) */
.m-num { display: inline-flex; align-items: stretch; height: var(--m-h-field); border: 1px solid var(--m-field-line); border-radius: 7px; background: var(--m-field-bg); overflow: hidden; align-self: flex-start; }
.m-num:focus-within { border-color: var(--m-amber); box-shadow: var(--m-focus); }
.m-num button { width: 30px; border: 0; background: var(--m-raised); color: var(--m-ink-2); font-size: 16px; cursor: pointer; }
.m-num button:hover { background: var(--m-hover); color: var(--m-ink); }
.m-num input { width: 64px; border: 0; background: none; color: var(--m-ink); font: 600 var(--m-t-field) var(--m-font); text-align: center; outline: none; -moz-appearance: textfield; }
.m-num input::-webkit-inner-spin-button, .m-num input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.m-num .m-unit { align-self: center; padding-inline-end: 8px; color: var(--m-ink-3); font-size: 12px; }
/* chips: several values, each with its ✕, and + add */
.m-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: var(--m-h-field); box-sizing: border-box; padding: 4px 6px; border: 1px solid var(--m-field-line); border-radius: 7px; background: var(--m-field-bg); }
.m-chip { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 3px 0 9px; border-radius: 99px; background: var(--m-raised); border: 1px solid var(--m-line-strong); font: 500 12.5px var(--m-font); color: var(--m-ink); white-space: nowrap; }
.m-chip.good { background: var(--m-ok-soft); border-color: rgba(108, 195, 166, .4); }
.m-chip.bad { background: var(--m-bad-soft); border-color: rgba(240, 107, 91, .4); }
.m-chip.flag { background: var(--m-info-soft); border-color: rgba(141, 184, 242, .35); }
.m-chip button { width: 18px; height: 18px; display: grid; place-items: center; border: 0; border-radius: 50%; background: none; color: var(--m-ink-3); cursor: pointer; padding: 0; font-size: 12.5px; }
.m-chip button:hover { background: var(--m-hover); color: var(--m-ink); }
.m-add { height: 24px; padding: 0 9px; border-radius: 99px; border: 1px dashed var(--m-line-strong); background: none; color: var(--m-ink-2); font: 500 12.5px var(--m-font); cursor: pointer; }
.m-add:hover { border-color: var(--m-amber); color: var(--m-ink); }
.m-none { color: var(--m-ink-3); font-size: 13px; padding: 0 4px; }
/* checkbox, radio and switch: the real inputs, drawn */
.m-check, .m-radio, .m-switch, .st-check { display: inline-flex; align-items: center; gap: 9px; font: var(--m-t-field) var(--m-font); color: var(--m-ink); cursor: pointer; }
.m-check input, .m-radio input, .st-check input[type=checkbox] { appearance: none; margin: 0; width: 18px; height: 18px; flex: none; border-radius: 5px; border: 1.5px solid var(--m-field-line-hover); background: var(--m-field-bg); display: grid; place-items: center; cursor: pointer; }
.m-radio input { border-radius: 50%; }
.m-check input:checked, .st-check input[type=checkbox]:checked, .m-check input:indeterminate { background: var(--m-amber); border-color: var(--m-amber); }
.m-check input:checked::after, .st-check input[type=checkbox]:checked::after { content: ""; width: 9px; height: 5px; border: 2.5px solid var(--m-amber-ink); border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
.m-check input:indeterminate::after { content: ""; width: 9px; height: 2.5px; border-radius: 2px; background: var(--m-amber-ink); }
.m-radio input:checked { border-color: var(--m-amber); }
.m-radio input:checked::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--m-amber); }
.m-check input:focus-visible, .m-radio input:focus-visible, .st-check input:focus-visible, .m-switch input:focus-visible { outline: none; box-shadow: var(--m-focus); }
.m-check:has(input:disabled), .m-radio:has(input:disabled), .m-switch:has(input:disabled) { opacity: .45; cursor: default; }
.m-switch input, .st-flags .st-check input[type=checkbox] { appearance: none; margin: 0; width: 34px; height: 20px; flex: none; border-radius: 99px; background: #2E3038; border: 1px solid var(--m-field-line); position: relative; cursor: pointer; display: block; }
.m-switch input::after, .st-flags .st-check input[type=checkbox]::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border: 0; border-radius: 50%; background: var(--m-ink-2); transform: none; transition: left .15s; }
.m-switch input:checked, .st-flags .st-check input[type=checkbox]:checked { background: var(--m-amber); border-color: var(--m-amber); }
.m-switch input:checked::after, .st-flags .st-check input[type=checkbox]:checked::after { left: 16px; background: var(--m-amber-ink); width: 14px; height: 14px; border: 0; transform: none; }
/* a colour: the picker beside its code */
.m-colour { display: inline-flex; gap: 8px; align-items: center; }
.m-colour input[type=color] { width: 36px; height: var(--m-h-field); padding: 3px; border-radius: 7px; border: 1px solid var(--m-field-line); background: var(--m-field-bg); cursor: pointer; }
.m-colour input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
.m-colour input[type=color]::-webkit-color-swatch { border: 0; border-radius: 4px; }
.m-colour .m-in { width: 110px; font-family: var(--m-mono); }


/* segmented control: one of a few (language, views, filters) */
.m-seg, .st-seg { display: inline-flex; gap: 2px; padding: 2px; border: 1px solid var(--m-line); border-radius: var(--m-r-s); background: var(--m-sunk); overflow: hidden; }
.m-seg button, .st-seg button {
  height: calc(var(--m-h) - 6px); display: inline-flex; align-items: center; gap: 5px; padding: 0 10px; border: 0; border-radius: 4px;
  background: transparent; color: var(--m-ink-2); font: 500 var(--m-t-s) var(--m-font); cursor: pointer;
}
.m-seg button:hover, .st-seg button:hover { color: var(--m-ink); background: var(--m-hover); }
.m-seg button.on, .st-seg button.on { background: var(--m-raised); color: var(--m-ink); box-shadow: inset 0 0 0 1px var(--m-line-strong); font-weight: 600; }

/* tabs: an amber underline on the open one */
.m-tabs, .st-tabs { display: flex; gap: 4px; padding: 0 var(--m-3); border-bottom: 1px solid var(--m-line); background: var(--m-surface); }
.m-tabs button, .st-tabs button { padding: 10px 10px 9px; border: 0; border-radius: 0; background: none; color: var(--m-ink-3); font: 550 var(--m-t-s) var(--m-font); cursor: pointer; }
.m-tabs button:hover, .st-tabs button:hover { color: var(--m-ink); }
.m-tabs button.on, .st-tabs button.on { color: var(--m-ink); box-shadow: inset 0 -2px 0 var(--m-amber); background: none; }

/* badges and counts */
.m-badge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: var(--m-r-pill); font: 650 var(--m-t-xs) var(--m-font); background: var(--m-raised); color: var(--m-ink-2); }
.m-badge.amber { background: var(--m-amber-soft); color: var(--m-amber); }
.m-badge.ok { background: var(--m-ok-soft); color: var(--m-ok); }
.m-badge.bad { background: var(--m-bad); color: var(--m-bad-ink); }
.m-badge.info { background: var(--m-info-soft); color: var(--m-info); }
.m-kbd, .st-tip kbd, .st-palette kbd, .st-keybtn kbd { font: 600 var(--m-t-xs) var(--m-font); padding: 0 6px; border-radius: 5px; border: 1px solid var(--m-line-strong); background: var(--m-sunk); color: var(--m-ink-2); white-space: nowrap; }

/* list rows: hover, and amber when selected */
.m-row { display: flex; flex-direction: column; gap: 1px; padding: 7px 10px; border-radius: var(--m-r-s); border: 1px solid transparent; color: var(--m-ink); text-align: start; background: none; cursor: pointer; }
.m-row b { font: 550 var(--m-t-m) var(--m-font); }
.m-row small { color: var(--m-ink-3); font-size: var(--m-t-xs); }
.m-row:hover { background: var(--m-hover); }
.m-row.on { background: var(--m-amber-soft); border-color: var(--m-amber-line); }

/* panels, section labels, dialogs, menus, empty states */
.m-panel { background: var(--m-surface); border: 1px solid var(--m-line); border-radius: var(--m-r-l); padding: var(--m-4); }
.m-label { font: 600 var(--m-t-xs) var(--m-font); letter-spacing: .08em; text-transform: uppercase; color: var(--m-ink-3); }
.m-dialog { background: var(--m-surface); border: 1px solid var(--m-line-strong); border-radius: var(--m-r-l); padding: var(--m-4) 18px; box-shadow: var(--m-shadow); }
.m-menu { background: var(--m-raised); border: 1px solid var(--m-line-strong); border-radius: var(--m-r-m); box-shadow: var(--m-shadow); padding: var(--m-2); }
.m-empty, .st-emptystate { margin: 18px auto; max-width: 340px; padding: 20px; border: 1px dashed var(--m-line-strong); border-radius: var(--m-r-l); text-align: center; color: var(--m-ink-2); font-size: var(--m-t-m); display: flex; flex-direction: column; align-items: center; gap: 6px; }
.m-empty b, .st-emptystate b { color: var(--m-ink); font: 600 15px var(--m-font); }
.m-empty p, .st-emptystate p { margin: 0; }

/* dialogs (design/dialog.ts): the studio's and the home's */
.st-modal { position: fixed; inset: 0; z-index: 30; background: rgba(0, 0, 0, .7); display: grid; place-items: center; padding: 16px; box-sizing: border-box; }
.st-modal[hidden] { display: none; }
/* A dialog is one width whatever is in it, and scrolls when taller than the window; what's inside fills its width. */
.st-dialog { box-sizing: border-box; width: min(620px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--m-surface); border: 1px solid var(--m-line-strong); border-radius: var(--m-r-l); box-shadow: var(--m-shadow); padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.st-dialog > * { min-width: 0; max-width: 100%; }
.st-dialog p { margin: 0; }
.st-dialog h3 { margin: 0; font: 600 var(--m-t-l) var(--m-font); }
.st-dlg-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.st-check-what { color: var(--m-ink-2); font-size: var(--m-t-s); }
.st-form { overflow-y: auto; min-height: 0; }
.st-form p { margin: 4px 0 8px; color: var(--m-ink-2); font-size: var(--m-t-m); }
.st-refs { margin: 0; padding-inline-start: 18px; display: flex; flex-direction: column; gap: 3px; font-size: var(--m-t-s); }
