/* =========================================================================
   Cribe Studio - modern Scratch-inspired theme
   Light UI, colored category rail, solid colored blocks, dotted canvas
   ========================================================================= */

:root {
  --bg: #eef2f8;
  --panel: #ffffff;
  --border: #e3e8f0;
  --border-strong: #d3dae6;
  --text: #1e2430;
  --text-dim: #6b7486;
  --accent: #3f8f29;
  --accent-dark: #347521;
  --rail-w: 100px;
  --palette-w: 292px;
  --inspector-w: 410px;
  --topbar-h: 58px;
  --radius: 10px;
  --shadow-sm: 0 1px 3px rgba(20, 30, 50, .08);
  --shadow-md: 0 4px 16px rgba(20, 30, 50, .12);
  --shadow-lg: 0 12px 40px rgba(20, 30, 50, .22);
  --font: 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Roboto, sans-serif;
  --mono: 'Cascadia Code', 'Consolas', 'JetBrains Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  overflow: hidden;
}

/* ---- Topbar ---------------------------------------------------------------- */

.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 30;
}

.logo { display: flex; align-items: center; gap: 10px; user-select: none; }
.logo-mark {
  width: 36px; height: 36px;
  border-radius: 9px;
  background: linear-gradient(145deg, #4c9a2a, #35701c);
  color: #fff;
  font-weight: 800; font-size: 19px;
  display: grid; place-items: center;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.18), var(--shadow-sm);
}
.logo-text { display: flex; flex-direction: column; line-height: 1.15; }
.logo-text span { font-weight: 700; font-size: 15px; letter-spacing: .1px; }
.logo-text small { color: var(--text-dim); font-size: 11px; }

.script-name-wrap {
  display: flex; align-items: center;
  background: #f4f6fa;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 4px 0 10px;
  margin-left: 8px;
}
.script-name-wrap input {
  border: none; outline: none; background: transparent;
  font: 600 13px var(--mono);
  color: var(--text);
  width: 150px; padding: 7px 0;
}
.script-name-wrap .ext { color: var(--accent); font: 700 12px var(--mono); }

.spacer { flex: 1; }
.topbar-sep { width: 1px; height: 24px; background: var(--border); margin: 0 2px; }
.topbar-group { display: flex; gap: 4px; }

.status-pill {
  font-size: 12px; font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
  letter-spacing: .2px;
  white-space: nowrap;
}
.status-pill.good { background: #e2f3e2; color: #24701f; }
.status-pill.warn { background: #fdf2dc; color: #93610a; }
.status-pill.bad  { background: #fde3e3; color: #b32222; }

/* ---- Buttons ---------------------------------------------------------------- */

.btn {
  font: 600 12.5px var(--font);
  color: var(--text);
  background: #f4f6fa;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 7px 13px;
  cursor: pointer;
  transition: background .12s, border-color .12s, transform .06s;
  white-space: nowrap;
}
.btn:hover { background: #ecf0f6; border-color: #c3ccd9; }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: var(--accent); border-color: var(--accent-dark); color: #fff;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.15);
}
.btn.primary:hover { background: var(--accent-dark); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: #eef1f6; }
.btn.danger { background: #e5484d; border-color: #c93439; color: #fff; }
.btn.danger:hover { background: #c93439; }
.btn.danger-text { color: #c93439; }
.btn.icon { padding: 7px 11px; }
.btn.small { padding: 5px 10px; font-size: 11.5px; border-radius: 7px; }

/* ---- Main layout -------------------------------------------------------------- */

.main {
  display: flex;
  height: calc(100vh - var(--topbar-h));
}

/* Scratch-style category rail */
.cat-rail {
  width: var(--rail-w);
  background: var(--panel);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
}
.rail-btn {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 9px 2px 8px;
  border: none; background: transparent;
  border-radius: 9px;
  cursor: pointer;
  font: 600 10.5px var(--font);
  color: #444d5e;
  transition: background .1s;
}
.rail-btn:hover { background: #f0f3f9; }
.rail-btn.active { background: color-mix(in srgb, var(--c) 14%, white); color: var(--cd); }
.rail-dot {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--c);
  display: grid; place-items: center;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.16);
  flex-shrink: 0;
}
.rail-dot svg { width: 15px; height: 15px; stroke: #fff; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

/* ---- Palette ---------------------------------------------------------------- */

.palette {
  width: var(--palette-w);
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.palette-search-wrap { padding: 10px; border-bottom: 1px solid var(--border); }
.palette-search-wrap input {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 8px 11px;
  font: 13px var(--font);
  outline: none;
  background: #f7f9fc;
}
.palette-search-wrap input:focus { border-color: var(--accent); background: #fff; }

#palette-list { flex: 1; overflow-y: auto; padding: 8px; }

.pal-cat { margin-bottom: 4px; }
.pal-cat-head {
  display: flex; align-items: center; gap: 8px;
  font: 700 11px var(--font);
  text-transform: uppercase;
  letter-spacing: .7px;
  color: var(--text-dim);
  padding: 8px 4px 6px;
  position: sticky; top: 0;
  background: var(--panel);
  z-index: 2;
}
.pal-dot { width: 10px; height: 10px; border-radius: 3px; background: var(--c); flex-shrink: 0; }
.pal-list { display: flex; flex-direction: column; gap: 5px; }
.pal-item {
  background: var(--c);
  color: #fff;
  border-radius: 9px;
  padding: 8px 11px;
  font: 600 12.5px var(--font);
  line-height: 1.35;
  cursor: grab;
  box-shadow: inset 0 -2px 0 var(--cd), 0 1px 2px rgba(15,25,40,.12);
  user-select: none;
  transition: filter .1s;
}
.pal-item:hover { filter: brightness(1.06); }
.pal-item:active { cursor: grabbing; }
.pal-none { color: var(--text-dim); padding: 18px 10px; text-align: center; font-size: 12.5px; }

/* ---- Canvas ------------------------------------------------------------------- */

.canvas-wrap {
  flex: 1;
  position: relative;
  display: flex;
  min-width: 0;
}
#canvas {
  flex: 1;
  overflow: auto;
  position: relative;
  background-color: #f6f8fc;
  background-image: radial-gradient(circle, #c9d4e4 1.15px, transparent 1.3px);
  background-size: 26px 26px;
}
#canvas.panning { cursor: grabbing; }
#canvas.drop-ok { outline: 2px dashed var(--accent); outline-offset: -6px; }

.zoom-controls {
  position: absolute;
  bottom: 14px;
  left: 14px;
  display: inline-flex;
  gap: 1px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 9px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
  z-index: 10;
  width: max-content;
}
.zoom-controls button {
  border: none; background: transparent;
  font: 700 12.5px var(--font);
  color: var(--text);
  min-width: 40px; height: 34px;
  cursor: pointer;
}
.zoom-controls button:hover { background: #eef1f6; }

.ws-surface {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  padding: 24px;
  min-width: 100%;
  min-height: calc(100% - 48px);
  zoom: var(--zoom, 1);
}

.ws-empty { display: flex; justify-content: center; width: 100%; padding-top: 10vh; }
.ws-empty-card {
  background: var(--panel);
  border: 1.5px dashed var(--border-strong);
  border-radius: 16px;
  padding: 34px 44px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.ws-empty-title { font-size: 17px; font-weight: 800; margin-bottom: 8px; }
.ws-empty-text { color: var(--text-dim); font-size: 13px; line-height: 1.65; }
.ws-empty-text code, .help-page code {
  background: #f0f3f8; border: 1px solid var(--border);
  border-radius: 5px; padding: 1px 5px;
  font: 12px var(--mono); color: #30507a;
}

/* ---- Blocks -------------------------------------------------------------------- */

.blk {
  --c: #5c6bc0; --cd: #3949ab;
  background: var(--c);
  border-radius: 9px;
  color: #fff;
  min-width: 90px;
  width: max-content;
  max-width: 640px;
  box-shadow: inset 0 -2.5px 0 var(--cd), 0 1.5px 3px rgba(15,25,40,.22);
  position: relative;
  user-select: none;
}
.blk.kind-hat { border-radius: 9px 9px 9px 9px; }
.blk .blk-row {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 5px;
  padding: 7px 12px;
  font: 600 12.5px var(--font);
  min-height: 34px;
}
.blk.kind-hat > .blk-row { font-weight: 700; }

.blk.selected { outline: 3px solid #ffc93c; outline-offset: 1px; }
.blk.flash { animation: blkflash .9s; }
@keyframes blkflash { 0%, 60% { outline: 3px solid #59b3ff; outline-offset: 1px; } }
.blk.just-added { animation: blkin .35s ease-out; }
@keyframes blkin { from { transform: scale(.92); opacity: 0; } }

.pt-lit { opacity: .96; white-space: pre; }
.blk-ico { opacity: .9; font-size: 13px; display: inline-grid; place-items: center; }

/* category colors (blocks) */
.cat-basics  { --c: #43a047; --cd: #2e7d32; }
.cat-trigger { --c: #f2a900; --cd: #c08600; }
.cat-player  { --c: #26a69a; --cd: #00796b; }
.cat-world   { --c: #ff7043; --cd: #d84315; }
.cat-items   { --c: #ffa726; --cd: #ef6c00; }
.cat-gui     { --c: #26c6da; --cd: #00838f; }
.cat-vars    { --c: #ab47bc; --cd: #7b1fa2; }
.cat-control { --c: #ef5350; --cd: #b71c1c; }
.cat-logic   { --c: #ec407a; --cd: #ad1457; }
.cat-values  { --c: #5c6bc0; --cd: #283593; }

/* fields + inputs inside blocks */
.fld {
  border: none;
  border-radius: 999px;
  padding: 4px 10px;
  font: 600 12px var(--mono);
  color: #1e2430;
  background: #fff;
  min-width: 46px;
  outline: none;
  box-shadow: inset 0 1px 2px rgba(0,0,0,.14);
}
.fld:focus { box-shadow: 0 0 0 2.5px rgba(255,255,255,.55), inset 0 1px 2px rgba(0,0,0,.14); }
.fld.num { width: 64px; }
.fld.wide { min-width: 150px; }
.fld.cmdname { min-width: 90px; font-weight: 700; }
.fld.rawline { min-width: 280px; }
.fldwrap { display: inline-flex; align-items: center; gap: 1px; }
.curly { font: 700 14px var(--mono); text-shadow: 0 1px 1px rgba(0,0,0,.25); }

.fld.combo { display: inline-flex; align-items: center; padding: 0; background: #fff; box-shadow: inset 0 1px 2px rgba(0,0,0,.14); }
.fld.combo input { border: none; outline: none; background: transparent; font: 600 12px var(--mono); color: #1e2430; padding: 4px 2px 4px 10px; min-width: 54px; }
.fld.combo input[readonly] { cursor: default; }
.combo-dd {
  cursor: pointer;
  padding: 2px 7px 2px 3px;
  font-size: 10px;
  color: #67718a;
  line-height: 1;
}
.combo-dd:hover { color: #1e2430; }

select.fld.select { appearance: none; cursor: pointer; padding-right: 22px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='9' height='6'%3E%3Cpath d='M1 1l3.5 3.5L8 1' stroke='%2367718a' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center; }

/* dropdown menu (fixed layer, never clipped) */
.combo-menu {
  position: fixed;
  z-index: 1000;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  padding: 5px;
  max-height: 262px;
  overflow-y: auto;
  min-width: 150px;
}
.combo-item {
  padding: 7px 12px;
  border-radius: 7px;
  font: 500 12.5px var(--font);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}
.combo-item:hover { background: #eef4ff; color: #2456b3; }
.combo-item.selected { background: #e3f0e2; color: #24701f; font-weight: 700; }

/* sockets */
.slot {
  display: inline-flex; align-items: center;
  border-radius: 999px;
  min-height: 26px;
  box-shadow: inset 0 1.5px 3px rgba(0,0,0,.28);
}
.slot.expr { background: rgba(255,255,255,.24); min-width: 64px; padding: 2px; }
.slot.cond { background: rgba(0,0,0,.22); min-width: 110px; padding: 3px; border-radius: 8px; }
.slot.empty .inline-expr::placeholder { color: rgba(255,255,255,.75); }
.inline-expr {
  border: none; outline: none;
  background: transparent;
  font: 600 12px var(--mono);
  color: #fff;
  min-width: 54px;
  padding: 3px 8px;
}
.inline-expr::placeholder { color: rgba(255,255,255,.65); }
.slot .blk { box-shadow: 0 1px 2px rgba(15,25,40,.3); }
.slot-hint { color: rgba(255,255,255,.75); font: 500 11.5px var(--font); padding: 0 10px; font-style: italic; }

/* statement bodies */
.slot.stmts {
  display: flex; flex-direction: column; align-items: flex-start;
  gap: 7px;
  background: rgba(0,0,0,.16);
  border-radius: 0 0 9px 9px;
  padding: 8px;
  min-width: 220px;
  min-height: 34px;
}
.stmts-hint {
  color: rgba(255,255,255,.72);
  font: 500 12px var(--font);
  font-style: italic;
  padding: 3px 6px;
}
.slot.stmts.drop-hover { outline: 2px dashed rgba(255,255,255,.85); outline-offset: -3px; }
.slot.expr.drop-hover, .slot.cond.drop-hover, .slot.arg.drop-hover { outline: 2.5px solid #ffc93c; outline-offset: 1px; }

/* hat/command/function extras */
.else-head, .trig-head { padding: 2px 12px 6px; font: 700 12.5px var(--font); }
.else-btn {
  background: rgba(0,0,0,.2);
  border-radius: 6px;
  padding: 3px 9px;
  cursor: pointer;
  font-weight: 700;
}
.else-btn:hover { background: rgba(0,0,0,.3); }
.cmd-opts {
  display: flex; flex-direction: column; gap: 4px;
  padding: 6px 12px 8px;
  border-top: 1px solid rgba(255,255,255,.22);
}
.opt-row { display: flex; align-items: center; gap: 6px; font: 600 11.5px var(--font); }
.opt-row .fld { font-size: 11.5px; padding: 3px 9px; }
.blk.hat-command, .blk.hat-function { min-width: 380px; }

.call-args { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.arg-plus {
  background: rgba(255,255,255,.28);
  border-radius: 6px;
  padding: 1px 7px;
  cursor: pointer;
  font-weight: 800;
}
.arg-plus:hover { background: rgba(255,255,255,.42); }

/* drag visuals */
.drag-ghost {
  position: fixed; z-index: 2000;
  pointer-events: none;
  color: #fff;
  background: var(--c, #5c6bc0);
  border-radius: 9px;
  padding: 7px 13px;
  font: 600 12.5px var(--font);
  box-shadow: var(--shadow-lg);
  opacity: .92;
}
.drop-indicator {
  position: absolute;
  height: 4px;
  border-radius: 3px;
  background: #ffc93c;
  box-shadow: 0 0 0 1px rgba(0,0,0,.15);
  z-index: 5;
  pointer-events: none;
}
.dragging-src { opacity: .35; }

/* ---- Inspector ------------------------------------------------------------------- */

.inspector {
  width: var(--inspector-w);
  background: var(--panel);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.tabs {
  display: flex; gap: 2px;
  padding: 8px 10px 0;
  border-bottom: 1px solid var(--border);
}
.tab-btn {
  border: none; background: transparent;
  font: 700 12.5px var(--font);
  color: var(--text-dim);
  padding: 8px 13px;
  cursor: pointer;
  border-radius: 8px 8px 0 0;
  border-bottom: 2.5px solid transparent;
}
.tab-btn:hover { color: var(--text); background: #f4f6fa; }
.tab-btn.active { color: var(--accent-dark); border-bottom-color: var(--accent); }

.tab-page { flex: 1; overflow-y: auto; padding: 12px 14px; display: none; }
.tab-page.active { display: block; }

#code-panel {
  font: 12.5px/1.7 var(--mono);
  white-space: pre-wrap;
  word-break: break-word;
  color: #2c3547;
  background: #f7f9fc;
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 12px;
  margin: 0;
}

.problems-ok { color: #24701f; font-weight: 600; padding: 6px 2px; }
.problem {
  display: flex; align-items: baseline; gap: 8px;
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 6px;
  font-size: 12.5px;
  line-height: 1.5;
  cursor: default;
}
.problem.err { background: #fdecec; color: #8c1d1d; }
.problem.warn { background: #fdf4e0; color: #7d5207; }
.p-ico { font-weight: 800; flex-shrink: 0; }
.p-line { font: 700 10.5px var(--mono); background: rgba(0,0,0,.08); border-radius: 5px; padding: 2px 6px; flex-shrink: 0; }

.help-page { font-size: 13px; line-height: 1.7; color: #38414f; }
.help-page h4 { margin: 18px 0 6px; font-size: 13px; color: var(--text); }
.help-page h4:first-child { margin-top: 4px; }
.help-page b { color: var(--text); }

.stats {
  display: flex; gap: 14px;
  padding: 9px 16px;
  border-top: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 12px;
  background: #fbfcfe;
}
.stats b { color: var(--text); }

/* ---- AI panel ---------------------------------------------------------------- */

.ai-page { padding: 14px; }
.ai-head b { font-size: 14px; }
.ai-head p { color: var(--text-dim); font-size: 12px; line-height: 1.55; margin: 6px 0 0; }

.ai-providers { display: flex; gap: 8px; margin: 13px 0 4px; }
.ai-provider {
  flex: 1;
  border: 1.5px solid var(--border-strong);
  background: #fbfcfe;
  border-radius: 10px;
  padding: 9px 11px;
  cursor: pointer;
  text-align: left;
  display: flex; flex-direction: column; gap: 2px;
}
.ai-provider:hover { border-color: #b9c4d4; }
.ai-provider.active { border-color: var(--accent); background: #f2f8ef; }
.ai-provider-name { font-weight: 700; font-size: 12.5px; color: var(--text); }
.ai-provider-sub { font-size: 9.5px; color: var(--text-dim); font-family: var(--mono); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }

.ai-label {
  display: block;
  font: 700 11px var(--font);
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text-dim);
  margin: 13px 0 5px;
}
.ai-key-row, .ai-model-row { display: flex; gap: 6px; }
.ai-key-row input, .ai-model-row input {
  flex: 1;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 8px 10px;
  font: 12px var(--mono);
  outline: none;
  background: #f7f9fc;
  min-width: 0;
}
.ai-key-row input:focus, .ai-model-row input:focus { border-color: var(--accent); background: #fff; }
.ai-model-row input[readonly] { cursor: default; }

.ai-model-list {
  margin-top: 6px;
  border: 1px solid var(--border);
  border-radius: 9px;
  max-height: 168px;
  overflow-y: auto;
  background: #fbfcfe;
}
.ai-model-item {
  padding: 7px 11px;
  font: 12px var(--mono);
  cursor: pointer;
  border-bottom: 1px solid #f0f3f8;
  word-break: break-all;
}
.ai-model-item:last-child { border-bottom: none; }
.ai-model-item:hover { background: #eef4ff; }
.ai-model-item.selected { background: #e3f0e2; color: #24701f; font-weight: 700; }
.ai-model-empty { padding: 10px 12px; color: var(--text-dim); font-size: 12px; }

#ai-prompt {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  padding: 9px 11px;
  font: 12.5px/1.55 var(--font);
  resize: vertical;
  outline: none;
  background: #f7f9fc;
}
#ai-prompt:focus { border-color: var(--accent); background: #fff; }

.ai-examples { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.ai-examples button {
  border: 1px solid var(--border-strong);
  background: #f7f9fc;
  color: #45536b;
  border-radius: 999px;
  font: 600 11px var(--font);
  padding: 4px 10px;
  cursor: pointer;
}
.ai-examples button:hover { border-color: var(--accent); color: var(--accent-dark); background: #f2f8ef; }

.ai-go { width: 100%; margin-top: 11px; padding: 10px; font-size: 13px; border-radius: 9px; }
.ai-go[disabled] { opacity: .55; cursor: wait; }

.ai-status {
  margin-top: 10px;
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 12.5px;
  line-height: 1.5;
  background: #eef2f8;
  color: #38414f;
  word-break: break-word;
}
.ai-status.err { background: #fdecec; color: #8c1d1d; }
.ai-status.ok { background: #e2f3e2; color: #24701f; }
.ai-status.busy { background: #eaf1fd; color: #2456b3; }

.ai-output { margin-top: 12px; }
.ai-output-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 6px;
}
.ai-output-head b { font-size: 12.5px; }
.ai-output-head span { display: flex; gap: 5px; }
#ai-code {
  font: 12px/1.7 var(--mono);
  background: #10241a;
  color: #b8ecc9;
  border-radius: 9px;
  padding: 12px;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
  max-height: 260px;
  overflow-y: auto;
}
.ai-results { margin-top: 8px; }

/* ---- Modal ------------------------------------------------------------------------ */

.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(18, 26, 40, .45);
  backdrop-filter: blur(2px);
  z-index: 900;
  display: flex; align-items: center; justify-content: center;
}
.modal {
  width: min(680px, 92vw);
  background: var(--panel);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  padding: 18px;
  display: flex; flex-direction: column; gap: 10px;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; font-size: 14px; }
.modal-hint { color: var(--text-dim); font-size: 12.5px; margin: 0; line-height: 1.5; }
#paste-area {
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  font: 12.5px/1.65 var(--mono);
  padding: 11px;
  outline: none;
  background: #f7f9fc;
  resize: vertical;
}
#paste-area:focus { border-color: var(--accent); background: #fff; }
.modal-results { max-height: 200px; overflow-y: auto; display: flex; flex-direction: column; gap: 5px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; }
.rs-row { display: flex; gap: 9px; border-radius: 8px; padding: 7px 10px; font-size: 12.5px; line-height: 1.5; }
.rs-row.ok { background: #e9f5e9; color: #256b20; }
.rs-row.err { background: #fdecec; color: #8c1d1d; }
.rs-line { font: 700 10.5px var(--mono); background: rgba(0,0,0,.08); border-radius: 5px; padding: 2px 6px; height: fit-content; flex-shrink: 0; }

/* ---- Toast -------------------------------------------------------------------------- */

.toast {
  position: fixed;
  left: 50%; bottom: 26px;
  transform: translateX(-50%) translateY(80px);
  background: #232b3a;
  color: #fff;
  font: 600 13px var(--font);
  border-radius: 999px;
  padding: 11px 22px;
  box-shadow: var(--shadow-lg);
  transition: transform .22s ease, opacity .22s;
  opacity: 0;
  z-index: 1200;
  pointer-events: none;
  max-width: 70vw;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.ok { background: #1f6b33; }
.toast.err { background: #a72c2c; }
.toast.warn { background: #93610a; }

/* ---- Scrollbars ---------------------------------------------------------------------- */

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #c6cfdd; border-radius: 6px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #a8b4c6; background-clip: content-box; border: 2px solid transparent; }
::-webkit-scrollbar-track { background: transparent; }

/* ---- Responsive ----------------------------------------------------------------------- */

@media (max-width: 1180px) {
  :root { --inspector-w: 340px; --palette-w: 250px; --rail-w: 84px; }
}
@media (max-width: 940px) {
  .logo-text small, .topbar-group { display: none; }
  :root { --inspector-w: 300px; --palette-w: 220px; --rail-w: 66px; }
  .rail-btn { font-size: 9.5px; }
}
