/*! CodersCado IDE styles */
:root {
  --cdo-accent: #22c55e;
  --cdo-accent-2: color-mix(in srgb, var(--cdo-accent) 82%, #000);
  --cdo-accent-soft: color-mix(in srgb, var(--cdo-accent) 16%, transparent);
  --bg: #0b1016;
  --bg-2: #0d1218;
  --panel: #10171f;
  --panel-2: #141d27;
  --line: #1e2a36;
  --line-2: #283646;
  --text: #dbe4ee;
  --text-2: #9aabbd;
  --muted: #6b7d90;
  --err: #f87171;
  --warn: #fbbf24;
  --ok: #4ade80;
  --info: #60a5fa;
  --shadow: 0 10px 40px rgba(0, 0, 0, .45);
  --radius: 10px;
  --mono: "JetBrains Mono", "Fira Code", ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --header-h: 54px;
  --status-h: 28px;
  color-scheme: dark;
}
html.cdo-light {
  --bg: #f3f5f8;
  --bg-2: #ffffff;
  --panel: #ffffff;
  --panel-2: #f6f8fa;
  --line: #e3e8ee;
  --line-2: #d3dae3;
  --text: #1b2733;
  --text-2: #4a5b6c;
  --muted: #7a8a9a;
  --err: #dc2626;
  --warn: #b45309;
  --ok: #15803d;
  --info: #2563eb;
  --shadow: 0 10px 40px rgba(15, 23, 42, .15);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 var(--sans);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
code, kbd, pre { font-family: var(--mono); }

.cdo-app {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom);
}
.cdo-app.is-dragging, .cdo-app.is-dragging * { user-select: none; cursor: col-resize !important; }
.cdo-app.is-dragging iframe { pointer-events: none; }
.cdo-app.is-dragging:has(.is-vertical), .cdo-app.is-dragging:has(.is-vertical) * { cursor: row-resize !important; }

/* ---------- Header ---------- */
.cdo-header {
  height: var(--header-h);
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 20;
}
.cdo-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -.01em;
  white-space: nowrap;
  padding-right: 4px;
}
.cdo-brand b { color: var(--cdo-accent); font-weight: 800; }
.cdo-brand-text { overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.cdo-logo { flex: 0 0 auto; filter: drop-shadow(0 2px 6px var(--cdo-accent-soft)); }

.cdo-lang-pick {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--panel-2);
  border: 1px solid var(--line-2);
  border-radius: 8px;
  height: 36px;
  padding-left: 12px;
  transition: border-color .15s;
}
.cdo-lang-pick:hover { border-color: var(--cdo-accent); }
.cdo-lang-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--cdo-accent); flex: 0 0 auto; box-shadow: 0 0 0 3px rgba(255,255,255,.05); }
.cdo-lang-pick select {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: 0;
  height: 100%;
  padding: 0 30px 0 8px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-2) 50%), linear-gradient(135deg, var(--text-2) 50%, transparent 50%);
  background-position: calc(100% - 15px) 15px, calc(100% - 10px) 15px;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}
.cdo-lang-pick select option { background: var(--panel); color: var(--text); }

.cdo-run-group { display: flex; gap: 6px; align-items: center; }
.cdo-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid var(--line-2);
  background: var(--panel-2);
  font-weight: 600;
  white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s, filter .15s;
}
.cdo-btn:hover { border-color: var(--muted); }
.cdo-btn:active { transform: translateY(1px); }
.cdo-btn:disabled { opacity: .5; cursor: not-allowed; }
.cdo-btn svg { width: 16px; height: 16px; }
.cdo-btn-run {
  background: var(--cdo-accent);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 14px var(--cdo-accent-soft);
}
.cdo-btn-run:hover { filter: brightness(1.08); border-color: transparent; }
.cdo-btn-run kbd {
  font-size: 11px;
  background: rgba(0, 0, 0, .18);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 500;
}
.cdo-btn-stop { background: #ef4444; border-color: transparent; color: #fff; }
.cdo-btn-stop:hover { filter: brightness(1.08); border-color: transparent; }
.cdo-btn-ghost { background: transparent; }
.cdo-btn-sm { height: 30px; padding: 0 12px; font-size: 13px; }
.is-running .cdo-btn-stop { animation: cdo-pulse 1.4s ease-in-out infinite; }
@keyframes cdo-pulse { 50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, .18); } }

.cdo-spacer { flex: 1 1 auto; }

.cdo-tools { display: flex; align-items: center; gap: 2px; }
.cdo-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 34px;
  min-width: 34px;
  padding: 0 8px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text-2);
  transition: background .15s, color .15s;
}
.cdo-icon:hover { background: var(--panel-2); color: var(--text); }
.cdo-icon span { display: none; }
.cdo-icon-sm { height: 28px; min-width: 28px; padding: 0 6px; font-size: 13px; }
.cdo-icon-sm svg { width: 15px; height: 15px; }
.cdo-more { display: none; }

.cdo-select {
  height: 34px;
  background: var(--panel-2);
  border: 1px solid var(--line-2);
  border-radius: 8px;
  padding: 0 10px;
  outline: none;
  max-width: 200px;
  margin-right: 6px;
}
.cdo-select:focus { border-color: var(--cdo-accent); }
.cdo-select option { background: var(--panel); }
.cdo-select-sm { height: 22px; font-size: 12px; padding: 0 6px; margin: 0; border-radius: 5px; max-width: 260px; }

/* ---------- Main layout ---------- */
.cdo-main {
  flex: 1 1 auto;
  display: flex;
  min-height: 0;
  position: relative;
}
.cdo-main.is-vertical { flex-direction: column; }
.cdo-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  flex: 1 1 50%;
  background: var(--bg-2);
}
.cdo-pane-out { background: var(--panel); }
.cdo-splitter {
  flex: 0 0 6px;
  background: var(--line);
  cursor: col-resize;
  position: relative;
  transition: background .15s;
  outline: none;
}
.cdo-splitter::after {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  width: 2px; height: 32px;
  transform: translate(-50%, -50%);
  border-radius: 2px;
  background: var(--line-2);
}
.cdo-splitter:hover, .cdo-splitter:focus, .is-dragging .cdo-splitter { background: var(--cdo-accent); }
.is-vertical > .cdo-splitter { cursor: row-resize; }
.is-vertical > .cdo-splitter::after { width: 32px; height: 2px; }
.cdo-main.is-max-out .cdo-pane-editor, .cdo-main.is-max-out .cdo-splitter { display: none; }
.cdo-main.is-max-out .cdo-pane-out { flex-basis: 100% !important; }

/* ---------- Tabs ---------- */
.cdo-tabbar {
  flex: 0 0 auto;
  display: flex;
  align-items: stretch;
  height: 38px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}
.cdo-tabbar::-webkit-scrollbar { display: none; }
.cdo-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 14px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  position: relative;
}
.cdo-tab:hover { color: var(--text); background: var(--panel-2); }
.cdo-tab.is-active { color: var(--text); background: var(--bg-2); }
.cdo-pane-out .cdo-tab.is-active { background: var(--panel-2); }
.cdo-tab.is-active::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 2px;
  background: var(--cdo-accent);
}
.cdo-file-ico {
  font: 700 9px/1 var(--mono);
  padding: 3px 4px;
  border-radius: 3px;
  background: var(--line-2);
  color: var(--text);
}
.cdo-ico-py { background: #3b82f6; color: #fff; }
.cdo-ico-html { background: #f97316; color: #fff; }
.cdo-ico-css { background: #0ea5e9; color: #fff; }
.cdo-ico-js { background: #eab308; color: #1c1917; }
.cdo-ico-c { background: #6366f1; color: #fff; }
.cdo-ico-cpp { background: #0284c7; color: #fff; }
.cdo-ico-cs { background: #a855f7; color: #fff; }
.cdo-ico-go { background: #06b6d4; color: #fff; }
.cdo-ico-rs { background: #c2410c; color: #fff; }
.cdo-ico-php { background: #7c3aed; color: #fff; }
.cdo-ico-rb { background: #dc2626; color: #fff; }

.cdo-badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--warn);
  color: #1c1917;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.cdo-badge.is-err { background: var(--err); color: #fff; }
.cdo-tabbar-tools { margin-left: auto; display: flex; align-items: center; gap: 2px; padding: 0 6px; }

/* ---------- Editor ---------- */
.cdo-editor { flex: 1 1 auto; min-height: 0; position: relative; }
.cdo-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-2);
  text-align: center;
  padding: 20px;
}
.cdo-spinner {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 3px solid var(--line-2);
  border-top-color: var(--cdo-accent);
  animation: cdo-spin .8s linear infinite;
}
@keyframes cdo-spin { to { transform: rotate(360deg); } }

/* Monaco decorations */
.cdo-bp { background: #ef4444; border-radius: 50%; width: 10px !important; height: 10px !important; margin: 5px 0 0 6px; box-shadow: 0 0 0 2px rgba(239, 68, 68, .25); }
.cdo-dbg-line { background: rgba(250, 204, 21, .16); border-left: 3px solid #facc15; }
.cdo-dbg-line.is-exc { background: rgba(248, 113, 113, .18); border-left-color: #f87171; }
.cdo-dbg-arrow::before { content: "➜"; color: #facc15; font-size: 14px; margin-left: 4px; }
.monaco-editor .margin-view-overlays .cgmr { cursor: pointer; }
.monaco-editor .glyph-margin { cursor: pointer; }

/* ---------- Output panels ---------- */
.cdo-panels { flex: 1 1 auto; position: relative; min-height: 0; }
.cdo-panel { position: absolute; inset: 0; display: none; flex-direction: column; }
.cdo-panel.is-active { display: flex; }
.cdo-panel[data-panel="preview"] { background: #fff; }
#cdo-preview { flex: 1 1 auto; width: 100%; border: 0; background: #fff; }

.cdo-term {
  flex: 1 1 auto;
  overflow: auto;
  padding: 12px 14px 20px;
  font: 13.5px/1.55 var(--mono);
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--panel-2);
  color: var(--text);
  tab-size: 4;
}
html:not(.cdo-light) .cdo-term { background: #0a0f14; }
.cdo-t-err { color: var(--err); }
.cdo-t-warn { color: var(--warn); }
.cdo-t-ok { color: var(--ok); }
.cdo-t-info { color: var(--info); }
.cdo-t-dim { color: var(--muted); }
.cdo-t-imgwrap { margin: 8px 0; }
.cdo-t-img { max-width: 100%; border-radius: 8px; background: #fff; display: block; }
.cdo-t-tablewrap { overflow-x: auto; margin: 6px 0; }
.cdo-t-table { border-collapse: collapse; font-size: 12.5px; white-space: nowrap; }
.cdo-t-table th, .cdo-t-table td { border: 1px solid var(--line-2); padding: 3px 10px; text-align: left; }
.cdo-t-table th { background: var(--panel); color: var(--text-2); }

.cdo-hint {
  white-space: normal;
  font-family: var(--sans);
  margin: 10px 0 6px;
  padding: 10px 14px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--warn) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent);
  border-left-width: 4px;
  max-width: 760px;
}
.cdo-hint-t { font-weight: 700; margin-bottom: 3px; color: var(--text); font-size: 13.5px; }
.cdo-hint-b { color: var(--text-2); font-size: 13.5px; }
.cdo-link {
  display: inline-block;
  background: none;
  border: 0;
  padding: 4px 0;
  color: var(--cdo-accent);
  font: 600 13px var(--sans);
  white-space: normal;
}
.cdo-link:hover { text-decoration: underline; }

.cdo-term-input {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-top: 1px solid var(--line);
  background: var(--panel);
  animation: cdo-glow 1.6s ease-in-out infinite;
}
@keyframes cdo-glow { 50% { box-shadow: inset 0 2px 0 var(--cdo-accent); } }
.cdo-term-caret { color: var(--cdo-accent); font: 700 16px var(--mono); }
.cdo-term-input input {
  flex: 1 1 auto;
  min-width: 0;
  height: 32px;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: 6px;
  padding: 0 10px;
  font-family: var(--mono);
  outline: none;
}
.cdo-term-input input:focus { border-color: var(--cdo-accent); }

.cdo-input-wrap { display: flex; flex-direction: column; flex: 1 1 auto; padding: 12px; gap: 8px; min-height: 0; }
.cdo-input-wrap textarea {
  flex: 1 1 auto;
  resize: none;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: 8px;
  padding: 10px 12px;
  font: 13.5px/1.55 var(--mono);
  outline: none;
}
.cdo-input-wrap textarea:focus { border-color: var(--cdo-accent); }
.cdo-muted { color: var(--muted); margin: 0; font-size: 13px; }
.cdo-muted code { background: var(--panel-2); padding: 1px 4px; border-radius: 4px; font-size: 12px; }

/* Problems */
.cdo-problems { flex: 1 1 auto; overflow: auto; padding: 6px 0; }
.cdo-prob {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 8px 14px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
}
.cdo-prob:hover { background: var(--panel-2); }
.cdo-prob-ico { flex: 0 0 18px; font-weight: 700; text-align: center; }
.cdo-prob.is-err .cdo-prob-ico { color: var(--err); }
.cdo-prob.is-warn .cdo-prob-ico { color: var(--warn); }
.cdo-prob.is-info .cdo-prob-ico { color: var(--info); }
.cdo-prob-main { flex: 1 1 auto; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cdo-prob-msg { font-size: 13px; word-break: break-word; }
.cdo-prob-hint { font-size: 12.5px; color: var(--text-2); }
.cdo-prob-loc { flex: 0 0 auto; font: 12px var(--mono); color: var(--muted); padding-top: 1px; }
.cdo-empty { text-align: center; padding: 40px 20px; color: var(--text-2); }
.cdo-empty p { margin: 6px 0; }
.cdo-empty-ico {
  width: 44px; height: 44px; margin: 0 auto 8px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 22px; font-weight: 700;
  color: var(--ok);
  background: color-mix(in srgb, var(--ok) 14%, transparent);
}

/* Debugger */
.cdo-dbg { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
.cdo-dbg-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.cdo-dbg-bar input[type="range"] { flex: 1 1 auto; min-width: 60px; accent-color: var(--cdo-accent); margin: 0 8px; }
.cdo-dbg-pos { font: 12px var(--mono); color: var(--text-2); white-space: nowrap; }
.cdo-dbg:not(.is-active) [data-dbg]:not([data-dbg="next"]) { opacity: .45; }
.cdo-dbg-empty { padding: 24px; color: var(--text-2); max-width: 520px; }
.cdo-dbg-empty p { margin: 0 0 10px; }
.cdo-bp-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #ef4444; vertical-align: middle; }
.cdo-dbg-body { flex: 1 1 auto; overflow: auto; padding: 6px 0 20px; }
.cdo-dbg-sec { padding: 8px 14px; }
.cdo-dbg-sec h4 { margin: 0 0 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.cdo-dbg-sec h4 small { text-transform: none; letter-spacing: 0; font-weight: 500; margin-left: 6px; }
#cdo-dbg-line { color: var(--text); font-size: 13px; }
.cdo-dbg-note { font: 13px var(--mono); padding: 6px 10px; border-radius: 6px; background: color-mix(in srgb, #facc15 12%, transparent); }
.cdo-dbg-note.is-ret { background: color-mix(in srgb, var(--info) 14%, transparent); }
.cdo-dbg-note.is-exc { background: color-mix(in srgb, var(--err) 14%, transparent); color: var(--err); }
.cdo-vars { width: 100%; border-collapse: collapse; font: 12.5px/1.5 var(--mono); }
.cdo-vars td { padding: 4px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.cdo-vars-h th { text-align: left; font: 600 11.5px var(--sans); color: var(--text-2); padding: 8px 8px 4px; }
.cdo-var-n { color: var(--info); white-space: nowrap; }
.cdo-var-t { color: var(--muted); white-space: nowrap; width: 1%; }
.cdo-var-v { word-break: break-all; }
.cdo-vars tr.is-changed td { background: color-mix(in srgb, var(--cdo-accent) 14%, transparent); }
.cdo-vars tr.is-changed .cdo-var-v { color: var(--ok); font-weight: 600; }
.cdo-stack { margin: 0; padding: 0; list-style: none; }
.cdo-stack li { display: flex; justify-content: space-between; padding: 5px 8px; border-radius: 6px; cursor: pointer; font: 12.5px var(--mono); }
.cdo-stack li:hover { background: var(--panel-2); }
.cdo-stack li.is-top { color: #facc15; }
.cdo-stack small { color: var(--muted); }
.cdo-dbg-out { margin: 0; padding: 10px; background: var(--panel-2); border-radius: 6px; font: 12.5px/1.5 var(--mono); max-height: 180px; overflow: auto; white-space: pre-wrap; min-height: 36px; }

/* ---------- Status bar ---------- */
.cdo-status {
  flex: 0 0 var(--status-h);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 12px;
  font-size: 12px;
  color: var(--text-2);
  background: var(--panel);
  border-top: 1px solid var(--line);
  white-space: nowrap;
  overflow: hidden;
}
.cdo-st-item { display: inline-flex; align-items: center; gap: 6px; }
.cdo-led { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.is-ok .cdo-led { background: var(--ok); }
.is-idle .cdo-led { background: var(--cdo-accent); }
.is-busy .cdo-led { background: var(--warn); animation: cdo-blink 1s infinite; }
.is-waiting .cdo-led { background: var(--info); animation: cdo-blink 1s infinite; }
.is-error .cdo-led { background: var(--err); }
@keyframes cdo-blink { 50% { opacity: .35; } }
#cdo-st-problems { gap: 10px; cursor: pointer; }
.cdo-st-err { color: var(--err); }
.cdo-st-warn { color: var(--warn); }
.cdo-strict { cursor: pointer; }
.cdo-strict input { accent-color: var(--cdo-accent); margin: 0; }

/* ---------- Mobile switch ---------- */
.cdo-mobile-switch { display: none; }

/* ---------- Modal ---------- */
.cdo-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(2, 6, 12, .6);
  backdrop-filter: blur(3px);
  display: grid;
  place-items: center;
  padding: 16px;
  animation: cdo-fade .15s ease-out;
}
@keyframes cdo-fade { from { opacity: 0; } }
.cdo-modal-box {
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 32px);
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: 14px;
  box-shadow: var(--shadow);
  animation: cdo-pop .18s ease-out;
}
@keyframes cdo-pop { from { transform: translateY(10px) scale(.98); opacity: 0; } }
.cdo-modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.cdo-modal-head h3 { margin: 0; font-size: 16px; }
.cdo-modal-body { padding: 16px 18px 20px; }
.cdo-input {
  flex: 1 1 auto;
  min-width: 0;
  height: 36px;
  padding: 0 10px;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: 8px;
  font: 12.5px var(--mono);
  outline: none;
}
.cdo-share-row { display: flex; gap: 8px; margin-top: 12px; }
.cdo-warn-text { color: var(--warn); font-size: 13px; margin: 10px 0 0; }
.cdo-settings { display: flex; flex-direction: column; }
.cdo-set-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.cdo-set-l { display: flex; flex-direction: column; }
.cdo-set-l b { font-weight: 600; }
.cdo-set-l small { color: var(--muted); font-size: 12px; }
.cdo-set-row input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--cdo-accent); }
.cdo-set-row .cdo-select { margin: 0; min-width: 140px; }
.cdo-set-keys { padding-top: 14px; }
.cdo-set-keys ul { list-style: none; padding: 0; margin: 8px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; }
.cdo-set-keys li { display: flex; gap: 8px; align-items: center; font-size: 12.5px; color: var(--text-2); }
.cdo-set-keys kbd { background: var(--panel-2); border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; font-size: 11.5px; color: var(--text); white-space: nowrap; }

/* ---------- Toasts ---------- */
.cdo-toasts { position: fixed; bottom: 40px; left: 50%; transform: translateX(-50%); z-index: 120; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.cdo-toast {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line-2);
  border-left: 4px solid var(--info);
  border-radius: 8px;
  padding: 9px 16px;
  box-shadow: var(--shadow);
  font-size: 13.5px;
  animation: cdo-pop .2s ease-out;
  transition: opacity .3s, transform .3s;
  max-width: 90vw;
}
.cdo-toast.is-ok { border-left-color: var(--ok); }
.cdo-toast.is-err { border-left-color: var(--err); }
.cdo-toast.is-out { opacity: 0; transform: translateY(6px); }


/* ---------- Custom logo ---------- */
.cdo-logo-img { height: var(--cdo-logo-h, 32px); width: auto; max-width: 200px; max-height: 44px; object-fit: contain; display: block; }

/* ---------- Leave warning / menus in modals ---------- */
.cdo-modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.cdo-leave { text-align: center; }
.cdo-leave-ico { font-size: 38px; line-height: 1; margin: 4px 0 10px; }
.cdo-leave-msg { color: var(--text-2); margin: 0; white-space: pre-line; }
.cdo-leave .cdo-modal-actions { justify-content: center; }
.cdo-menu-list { display: flex; flex-direction: column; gap: 6px; }
.cdo-menu-item { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--panel-2); transition: border-color .15s, background .15s; }
.cdo-menu-item:hover { border-color: var(--cdo-accent); background: var(--cdo-accent-soft); }
.cdo-menu-item b { display: block; font-weight: 600; }
.cdo-menu-item small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 1px; }
.cdo-menu-ico { font-size: 22px; width: 30px; text-align: center; flex: 0 0 auto; }

/* ---------- Drag & drop ---------- */
.cdo-drop { position: fixed; inset: 0; z-index: 150; display: grid; place-items: center; background: rgba(2, 6, 12, .55); backdrop-filter: blur(2px); pointer-events: none; }
.cdo-drop > div { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 34px 48px; border: 3px dashed var(--cdo-accent); border-radius: 18px; background: var(--panel); color: var(--text); text-align: center; }
.cdo-drop b { font-size: 20px; }
.cdo-drop span { color: var(--text-2); }

/* ---------- SQL results ---------- */
.cdo-sql-table td.is-null { color: var(--muted); font-style: italic; }
.cdo-sql-table td.is-num { text-align: right; font-variant-numeric: tabular-nums; }
.cdo-sql-table tr:nth-child(even) td { background: color-mix(in srgb, var(--text) 3%, transparent); }
.cdo-sql-meta { display: flex; gap: 14px; align-items: center; color: var(--muted); font: 12.5px var(--sans); margin: -2px 0 10px; }

/* ---------- Tests ---------- */
.cdo-tests { flex: 1 1 auto; overflow: auto; padding: 12px 14px 24px; }
.cdo-tests-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.cdo-tests-help { margin-bottom: 12px; }
.cdo-tests-summary { margin-left: auto; font-weight: 700; font-size: 13.5px; }
.cdo-tests-summary.is-pass { color: var(--ok); }
.cdo-tests-summary.is-fail { color: var(--err); }
.cdo-test { border: 1px solid var(--line-2); border-left: 4px solid var(--line-2); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; background: var(--panel-2); }
.cdo-test.is-pass { border-left-color: var(--ok); }
.cdo-test.is-fail, .cdo-test.is-error { border-left-color: var(--err); }
.cdo-test.is-running { border-left-color: var(--warn); }
.cdo-test-h { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.cdo-test-st { font-size: 12.5px; font-weight: 700; }
.is-pass .cdo-test-st { color: var(--ok); }
.is-fail .cdo-test-st, .is-error .cdo-test-st { color: var(--err); }
.is-running .cdo-test-st { color: var(--warn); }
.cdo-test-b { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cdo-test-b label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-2); font-weight: 600; }
.cdo-test-ta { resize: vertical; min-height: 64px; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 7px; padding: 7px 9px; font: 12.5px/1.5 var(--mono); outline: none; color: var(--text); }
.cdo-test-ta:focus { border-color: var(--cdo-accent); }
.cdo-test-r { margin-top: 8px; }
.cdo-test-r span { font-size: 12px; font-weight: 600; color: var(--err); }
.cdo-test-r pre { margin: 4px 0 0; padding: 8px 10px; border-radius: 7px; background: var(--bg-2); font: 12.5px/1.5 var(--mono); white-space: pre-wrap; max-height: 200px; overflow: auto; }

.cdo-ico-ts { background: #2563eb; color: #fff; }
.cdo-ico-sql { background: #0891b2; color: #fff; }
.cdo-ico-java { background: #ea580c; color: #fff; }
.cdo-ico-kt { background: #7c3aed; color: #fff; }
.cdo-ico-swift { background: #f97316; color: #fff; }
.cdo-ico-sh { background: #16a34a; color: #fff; }

/* ---------- Wide screens: show labels on tool buttons ---------- */
@media (min-width: 1440px) {
  .cdo-tools .cdo-icon[data-act="share"] span,
  .cdo-tools .cdo-icon[data-act="format"] span { display: inline; font-size: 13px; }
}

/* ---------- Tablet ---------- */
@media (max-width: 1100px) {
  .cdo-btn-run kbd { display: none; }
  .cdo-tools .cdo-icon[data-act="reset"],
  .cdo-tools .cdo-icon[data-act="layout"] { display: none; }
}

/* ---------- Phones / small tablets ---------- */
@media (max-width: 820px) {
  :root { --header-h: 52px; }
  .cdo-header { gap: 6px; padding: 0 8px; }
  .cdo-brand-text { display: none; }
  .cdo-lang-pick { flex: 1 1 auto; min-width: 0; max-width: 220px; }
  .cdo-lang-pick select { width: 100%; text-overflow: ellipsis; }
  .cdo-btn { padding: 0 12px; }
  .cdo-btn-ghost span { display: none; }
  .cdo-spacer { display: none; }
  .cdo-more { display: inline-flex; margin-left: auto; }
  .cdo-tools {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 8px;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 8px;
    min-width: 220px;
    background: var(--panel);
    border: 1px solid var(--line-2);
    border-radius: 12px;
    box-shadow: var(--shadow);
  }
  .cdo-tools.is-open { display: flex; animation: cdo-pop .15s ease-out; }
  .cdo-tools .cdo-icon { display: flex !important; justify-content: flex-start; height: 40px; padding: 0 10px; color: var(--text); }
  .cdo-tools .cdo-icon span { display: inline; }
  .cdo-tools .cdo-select { max-width: none; margin: 0 0 6px; height: 40px; }

  .cdo-main, .cdo-main.is-vertical { flex-direction: column; }
  .cdo-splitter { display: none; }
  .cdo-pane { flex-basis: 100% !important; }
  .cdo-main[data-view="editor"] .cdo-pane-out { display: none; }
  .cdo-main[data-view="output"] .cdo-pane-editor { display: none; }
  .cdo-tabbar-tools #cdo-maximize { display: none; }

  .cdo-mobile-switch {
    display: flex;
    flex: 0 0 auto;
    gap: 6px;
    padding: 6px 8px;
    background: var(--panel);
    border-top: 1px solid var(--line);
  }
  .cdo-mobile-switch button {
    flex: 1 1 50%;
    height: 38px;
    border-radius: 8px;
    border: 1px solid var(--line-2);
    background: var(--panel-2);
    font-weight: 600;
    color: var(--text-2);
  }
  .cdo-mobile-switch button.is-active { background: var(--cdo-accent-soft); color: var(--text); border-color: var(--cdo-accent); }
  .cdo-hide-sm, #cdo-st-pos, .cdo-strict { display: none !important; }
  .cdo-select-sm { max-width: 170px; }
  .cdo-status { gap: 10px; }
  .cdo-set-keys ul { grid-template-columns: 1fr; }
  .cdo-term { font-size: 13px; }
  .cdo-test-b { grid-template-columns: 1fr; }
  .cdo-logo-img { max-width: 120px; max-height: 32px; }
}
@media (max-width: 400px) {
  .cdo-btn-run span { display: none; }
  .cdo-btn-run { padding: 0 14px; }
  .cdo-logo { width: 24px; height: 24px; }
}

/* ---------- Embedded mode (inside an iframe on your site) ---------- */
.cdo-embed .cdo-brand-text { display: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
