/* Margarit demo: chat frame (bubbles like LM Studio), web-search switch, Turnstile (next to Start, then under the box) and its hint, warm-up progress bar, opening text, notice line and box, corpus table.
   Loaded only by /ai/margarit/, /ai/margarit/how-it-was-made/ and /ai/margarit/about-this-demo/, after style.css (overrides its .mg-log/.mg-q/.mg-a). */
.mg-lupa{display:inline-flex;align-items:center;gap:8px;font-family:var(--mono);font-size:11.5px;color:var(--muted);cursor:pointer;}
.mg-lupa input{accent-color:var(--brass);width:15px;height:15px;margin:0;}
.mg-lupa:has(input:disabled){opacity:.55;cursor:not-allowed;}
.mg-row{flex-wrap:wrap;}
.mg-row .mg-right{display:flex;align-items:center;gap:16px;margin-inline-start:auto;}
.mg-tswrap{display:flex;flex-direction:column;gap:6px;max-width:100%;}
.mg-form .mg-tswrap{margin-top:14px;}
.mg-ts{min-height:0;max-width:100%;overflow:hidden;}
.mg-ts:empty{display:none;}
.mg-tsmsg{margin:0;font-family:var(--mono);font-size:11.5px;color:var(--brass);}
.mg-tswrap:has(.mg-ts:empty):has(.mg-tsmsg[hidden]){display:none;}
.mg-src a{color:var(--brass);overflow-wrap:anywhere;}
/* warm-up progress bar under the status line (gold on ink; width % fills from the inline start, so right to left in Arabic) */
.mg-prog{height:3px;background:var(--ink-3);overflow:hidden;}
.mg-prog[hidden]{display:none;}
.mg-prog-fill{display:block;height:100%;width:0;background:var(--brass);transition:width .5s linear;}
.mg-prog[data-state="error"] .mg-prog-fill{background:var(--down);}
@media(prefers-reduced-motion:reduce){.mg-prog-fill{transition:none;}}

/* conversation: scrolls inside the frame; the visitor on the inline end (right; left in Arabic), Margarit on the inline start */
.mg-log{height:min(62vh,560px);max-height:none;overflow-y:auto;padding:18px 18px 12px;gap:16px;overscroll-behavior:contain;}
.mg-turn{gap:8px;}
.mg-q,.mg-a{max-width:min(85%,640px);padding:10px 14px 12px;border-radius:12px;white-space:pre-wrap;overflow-wrap:anywhere;}
.mg-q{align-self:flex-end;background:var(--ink-3);border:1px solid var(--line-strong);color:var(--ivory);font-size:15px;}
.mg-a{align-self:flex-start;background:var(--ink);border:1px solid rgba(199,163,91,.38);padding-inline-start:14px;font-size:16.5px;}
.mg-q p,.mg-a p{margin:0;}
.mg-q .mg-who,.mg-a .mg-who{font-size:10.5px;margin-bottom:3px;}
.mg-q .mg-who{color:var(--muted);}
.mg-wait p{color:var(--muted);animation:mg-pulse 1.2s ease-in-out infinite;}
.mg-turn .mg-notes,.mg-turn .mg-nonotes{align-self:flex-start;max-width:min(85%,640px);padding-inline-start:4px;}
.mg-form{padding:12px 18px 16px;}
.mg-form>label.kicker{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;}
.mg-form textarea{margin-top:0;min-height:64px;}

/* opening text, summary, and the one-line notice above the frame (the full notice box lives on about-this-demo) */
.mg-lead{max-width:64ch;display:flex;flex-direction:column;gap:16px;margin-top:26px;}
.mg-lead p{font-size:clamp(17px,1.9vw,20.5px);line-height:1.6;color:#CFCBBE;}
.mg-aviso{margin-top:32px;font-family:var(--mono);font-size:12.5px;color:var(--muted);}
.mg-aviso a{color:var(--brass);white-space:nowrap;}
.mg-aviso a:hover{text-decoration:underline;}
.mg-aviso+.mg-frame{margin-top:12px;}
/* «Idioma / Language» selector (between the notice line and the frame) */
.mg-idioma{display:flex;align-items:center;flex-wrap:wrap;gap:10px;margin-top:14px;}
.mg-idioma label{font-family:var(--mono);font-size:12.5px;letter-spacing:.04em;color:var(--brass);}
.mg-idioma select{appearance:none;-webkit-appearance:none;min-width:170px;padding:8px 34px 8px 12px;border:1px solid var(--brass-deep);border-radius:3px;
  background:var(--ink-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23C7A35B' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 12px center;
  color:var(--ivory);font:15px var(--sans);cursor:pointer;}
.mg-idioma select:focus-visible{outline:2px solid var(--brass);outline-offset:2px;}
.mg-idioma+.mg-frame{margin-top:12px;}
/* translated answer: discreet line «Translated from… · Show original»; the translation note above the conversation (✕ closes it for good) */
.mg-trad{margin-top:6px;font-family:var(--sans);font-size:12px;color:var(--muted);white-space:normal;}
.mg-trad.err{color:var(--down);}
.mg-verorig{padding:0;border:0;background:none;color:var(--brass);font:inherit;text-decoration:underline;cursor:pointer;}
.mg-avisotrad{position:relative;margin:12px 18px 0;padding:12px 44px 12px 14px;border:1px solid rgba(199,163,91,.30);border-radius:3px;
  background:rgba(199,163,91,.07);color:#CFCBBE;font-size:14px;line-height:1.5;}
.mg-avisotrad strong{display:block;margin-bottom:3px;color:var(--brass);font-weight:600;}
.mg-avisotrad p{margin:0;}
.mg-cerrar{position:absolute;top:6px;right:6px;width:32px;height:32px;padding:0;border:0;border-radius:50%;background:none;color:var(--muted);
  font-size:15px;line-height:32px;cursor:pointer;}
.mg-cerrar:hover,.mg-cerrar:focus-visible{color:var(--ivory);background:rgba(236,231,218,.08);}
.mg-intro{max-width:72ch;display:flex;flex-direction:column;gap:14px;}
.mg-intro p{color:#C4C1B6;font-size:16.5px;}
.mg-warn{border:1px solid var(--brass-deep);border-inline-start-width:3px;background:rgba(199,163,91,.06);border-radius:3px;padding:22px 26px;margin-top:32px;max-width:80ch;}
.mg-warn h2{font-family:var(--mono);font-size:12px;letter-spacing:.18em;text-transform:uppercase;color:var(--brass);font-weight:600;}
.mg-warn ul{margin:14px 0 0;padding-inline-start:18px;display:flex;flex-direction:column;gap:8px;color:#C4C1B6;font-size:15px;}
.mg-warn strong{color:var(--ivory);}

/* how it was made: corpus table */
.mg-table-wrap{margin-top:40px;overflow-x:auto;border:1px solid var(--line);border-radius:3px;}
.mg-table{width:100%;border-collapse:collapse;font-size:14.5px;}
.mg-table th,.mg-table td{padding:10px 16px;text-align:start;border-bottom:1px solid var(--line);}
.mg-table thead th{font-family:var(--mono);font-size:11px;letter-spacing:.14em;text-transform:uppercase;color:var(--muted);font-weight:500;}
.mg-table td{color:#C4C1B6;}
.mg-table td+td,.mg-table th+th{text-align:end;font-family:var(--mono);font-variant-numeric:tabular-nums;white-space:nowrap;}
.mg-table tr.grp th{text-align:start;font-family:var(--mono);font-size:11.5px;letter-spacing:.06em;color:var(--brass);background:var(--ink-2);font-weight:500;white-space:normal;}
.mg-table tfoot th{color:var(--ivory);border-bottom:0;}
.mg-note{font-family:var(--mono);font-size:14px;color:var(--brass);border:1px dashed var(--brass-deep);padding:14px 18px;border-radius:3px;}

@media(max-width:520px){
  .mg-avisotrad{margin-left:12px;margin-right:12px;}
  .mg-log{height:62vh;padding-left:12px;padding-right:12px;}
  .mg-q,.mg-a,.mg-turn .mg-notes,.mg-turn .mg-nonotes{max-width:92%;}
  .mg-form{padding-left:14px;padding-right:14px;}
  .mg-warn{padding:18px 18px;}
  .mg-table{font-size:13px;}
  .mg-table th,.mg-table td{padding:8px 10px;}
  .step{padding:24px 18px;grid-template-columns:44px 1fr;gap:14px;}
}
[lang="ar"] .mg-lupa,[lang="ar"] .mg-tsmsg,[lang="ar"] .mg-aviso,[lang="ar"] .mg-warn h2,[lang="ar"] .mg-table thead th,[lang="ar"] .mg-table tr.grp th,[lang="ar"] .mg-note{
  text-transform:none;letter-spacing:normal;font-family:"Segoe UI","Noto Sans Arabic",Tahoma,Arial,sans-serif;}
