/* the editor: one window, a tab per language */
.ide { border: 1px solid var(--line); border-radius: 16px; background: var(--well); overflow: hidden; box-shadow: 0 40px 70px -48px #000; }
.ide-top { display: flex; justify-content: space-between; gap: 16px; padding: 10px 18px; border-bottom: 1px solid var(--line); background: var(--panel); font: 12.5px var(--mono); color: var(--ink); }
.ide-top small { color: var(--mute); font-size: 11.5px; }
.ide-body { display: grid; grid-template-columns: 172px minmax(0, 1fr); }
.ide-tree { border-right: 1px solid var(--line); padding: 14px 8px; display: grid; align-content: start; gap: 1px; font: 12.5px var(--mono); background: color-mix(in srgb, var(--panel) 45%, var(--well)); }
.ide-tree > b { font-weight: 500; color: var(--mute); padding: 0 10px 8px; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; }
.ide-tree > div { display: grid; gap: 1px; }
.ide-tree button { display: flex; justify-content: space-between; gap: 8px; width: 100%; text-align: left; padding: 5px 10px; border-radius: 6px; color: var(--mute); transition: background 160ms var(--ease), color 160ms var(--ease); }
.ide-tree button small { font-size: 10.5px; opacity: 0.7; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ide-tree button:hover { color: var(--ink); }
.ide-tree button[aria-current] { color: var(--ink); background: var(--raise); }
.ide-main { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr auto; }
.ide-tabs { display: flex; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--panel) 55%, var(--well)); }
.ide-tabs::-webkit-scrollbar { display: none; }
.ide-tabs button { flex: none; padding: 9px 16px 8px; font: 12.5px var(--mono); color: var(--mute); border-right: 1px solid var(--line); border-top: 2px solid transparent; transition: color 160ms var(--ease); }
.ide-tabs button:hover { color: var(--ink); }
.ide-tabs button[aria-selected="true"] { color: var(--ink); background: var(--well); border-top-color: var(--acc); }
.ide-code { margin: 0; padding: 18px 0 22px; min-height: calc(25 * 1.75em + 40px); font: 13px/1.75 var(--mono); color: var(--ink); overflow-x: auto; counter-reset: ln; tab-size: 4; }
.ide-code:focus-visible { outline-offset: -2px; }
.ide-code .l { display: block; white-space: pre; padding-right: 24px; }
.ide-code .l::before { counter-increment: ln; content: counter(ln); display: inline-block; width: 3em; margin-right: 1.4em; text-align: right; color: color-mix(in srgb, var(--mute) 45%, transparent); }
.ide-code .t { display: inline-block; }
.ide-code .com { color: color-mix(in srgb, var(--mute) 80%, transparent); }
.ide-code .str { color: color-mix(in srgb, var(--ok) 62%, var(--ink)); }
.ide-code .kw { color: color-mix(in srgb, var(--bad) 55%, var(--ink)); }
.ide-code .num { color: var(--warn); }
.ide-code .api { color: var(--acc); }
.ide-status { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; padding: 7px 18px; border-top: 1px solid var(--line); font: 11.5px var(--mono); color: var(--mute); background: var(--panel); }
.ide-status span:first-child { color: var(--ink); }

/* one card per language; opening one leaves the others their height */
.libcards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; }
.libcards .card-body { gap: 10px; }
.libcards .lab { font: 12px var(--mono); color: var(--mute); margin-top: 4px; }
.libcards .cmd code { min-height: 44px; font-size: 13px; padding: 10px 14px; }
.libcards .cmd .copy { align-self: center; }
.libcards .cmd.file code::before { content: none; }
.libcards .prompt pre { padding: 14px 16px; padding-right: 96px; font-size: 13px; }
.libcards .prompt .copy { top: 10px; right: 10px; height: auto; }
.libcards .card-body > p:not(.lab) { font-size: 14.5px; overflow-wrap: anywhere; }
.gh { justify-self: start; font: 13px var(--mono); color: var(--acc); text-underline-offset: 3px; }
.gh::after { content: " →"; }

@media (max-width: 900px) {
  .ide-body { grid-template-columns: minmax(0, 1fr); }
  .ide-tree { display: none; }
  .libcards { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .ide { margin: 0 calc(var(--gut) * -0.5); border-radius: 12px; }
  .ide-top small { display: none; }
  .ide-code { font-size: 12px; min-height: calc(25 * 1.75em + 40px); }
  .ide-code .l::before { width: 2em; margin-right: 1em; }
}
