:root {
  --bg: #030504;
  --bg-2: #060b08;
  --surface: rgba(10, 18, 13, .86);
  --surface-solid: #0a120d;
  --surface-2: #0e1912;
  --surface-3: #13231a;
  --line: #15281c;
  --line-2: #1f3a29;
  --line-3: #2c513a;
  --green: #22c55e;
  --accent-rgb: 34, 197, 94;
  --ui-scale: 1;
  --green-2: #4ade80;
  --green-3: #16a34a;
  --green-4: #15803d;
  --mint: #bbf7d0;
  --text: #e8fbef;
  --text-2: #a9cdb7;
  --muted: #628d73;
  --warn: #facc15;
  --err: #f87171;
  --r: 12px;
  --r-sm: 8px;
  --ease: cubic-bezier(.2, .9, .3, 1);
  --spring: cubic-bezier(.2, 1.4, .4, 1);
  --font: 'Space Grotesk', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
  --glow: 0 0 0 1px rgba(var(--accent-rgb), .25), 0 0 22px rgba(var(--accent-rgb), .18);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 var(--font);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-columns: minmax(0, 1fr);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea { font: inherit; color: inherit; }
code, kbd, pre { font-family: var(--mono); }
code { color: var(--green-2); background: rgba(var(--accent-rgb), .09); padding: 1px 6px; border-radius: 5px; font-size: .88em; }
kbd {
  display: inline-block; min-width: 20px; text-align: center; padding: 1px 6px; border-radius: 6px;
  background: var(--surface-3); border: 1px solid var(--line-2); border-bottom-width: 2px;
  font-size: 11px; color: var(--text-2); line-height: 1.5;
}
::selection { background: rgba(var(--accent-rgb), .35); }

.ico { width: 18px; height: 18px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ================= tło ================= */
.bg-fx { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.bg-grid {
  position: absolute; inset: -40px;
  background-image: linear-gradient(rgba(var(--accent-rgb), .045) 1px, transparent 1px), linear-gradient(90deg, rgba(var(--accent-rgb), .045) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(ellipse at 50% 40%, #000 30%, transparent 75%);
  animation: gridDrift 30s linear infinite;
}
.bg-orb { position: absolute; border-radius: 50%; filter: blur(80px); opacity: .35; }
.bg-orb.o1 { width: 520px; height: 520px; background: #14532d; top: -180px; left: -120px; animation: orb 18s ease-in-out infinite; }
.bg-orb.o2 { width: 460px; height: 460px; background: #064e3b; bottom: -200px; right: 8%; animation: orb 22s ease-in-out infinite reverse; }
.bg-fx img { position: absolute; bottom: -90px; width: 40px; opacity: 0; filter: drop-shadow(0 0 10px rgba(var(--accent-rgb), .9)); animation: rise 24s linear infinite; }
.bg-fx img:nth-of-type(1) { left: 6%; }
.bg-fx img:nth-of-type(2) { left: 24%; width: 28px; animation-delay: 7s; animation-duration: 28s; }
.bg-fx img:nth-of-type(3) { left: 43%; width: 52px; animation-delay: 12s; }
.bg-fx img:nth-of-type(4) { left: 61%; width: 32px; animation-delay: 3s; animation-duration: 30s; }
.bg-fx img:nth-of-type(5) { left: 79%; animation-delay: 16s; animation-duration: 26s; }
.bg-fx img:nth-of-type(6) { left: 92%; width: 26px; animation-delay: 10s; }

/* ================= ekran startowy ================= */
.splash {
  position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; align-content: center; gap: 10px;
  background: radial-gradient(circle at 50% 45%, #0b2615, #020403 65%);
  transition: opacity .7s var(--ease), visibility .7s, transform .7s var(--ease);
}
.splash.hide { opacity: 0; visibility: hidden; transform: scale(1.04); }
.splash-ring {
  position: absolute; width: 230px; height: 230px; border-radius: 50%; top: 50%; left: 50%; margin: -175px 0 0 -115px;
  border: 1px solid rgba(74, 222, 128, .35); animation: ring 2.2s var(--ease) infinite;
}
.splash-ring.r2 { animation-delay: 1.1s; }
.splash-logo { width: 150px; position: relative; filter: drop-shadow(0 0 34px rgba(var(--accent-rgb), .8)); animation: splashIn 1s var(--spring) both, float 3.2s ease-in-out 1s infinite; }
.splash-title { font: 700 38px var(--font); letter-spacing: .5px; animation: fadeUp .7s .25s both; }
.splash-title span, .brand-text span { background: linear-gradient(90deg, var(--green), var(--mint), var(--green-2), var(--green)); background-size: 300% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: shimmer 5s linear infinite; }
.splash-sub { color: var(--muted); font-size: 13px; letter-spacing: 2px; text-transform: uppercase; animation: fadeUp .7s .35s both; }
.splash-bar { width: 200px; height: 3px; margin-top: 10px; background: var(--line); border-radius: 3px; overflow: hidden; animation: fadeUp .7s .45s both; }
.splash-bar i { display: block; height: 100%; width: 40%; background: linear-gradient(90deg, transparent, var(--green-2), transparent); animation: loading 1s linear infinite; }

/* ================= nagłówek ================= */
.top {
  position: relative; z-index: 20; display: flex; align-items: center; gap: 14px; padding: 0 14px; min-width: 0;
  background: linear-gradient(180deg, rgba(8, 15, 11, .92), rgba(5, 10, 7, .85));
  backdrop-filter: blur(12px); border-bottom: 1px solid var(--line);
  animation: slideDown .6s .2s var(--ease) both;
}
.top::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; background: linear-gradient(90deg, transparent, var(--green), transparent); opacity: .5; animation: scan 6s linear infinite; background-size: 50% 100%; background-repeat: no-repeat; }
.brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.brand-logo { width: 38px; height: 38px; cursor: pointer; filter: drop-shadow(0 0 10px rgba(var(--accent-rgb), .55)); animation: float 4s ease-in-out infinite; transition: transform .3s var(--spring); }
.brand-logo:hover { transform: scale(1.12) rotate(-6deg); }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-text b { font-size: 18px; letter-spacing: .3px; }
.brand-text small { color: var(--muted); font-size: 10px; letter-spacing: 3px; text-transform: uppercase; }

.project {
  display: flex; align-items: center; gap: 8px; padding: 5px 10px 5px 8px; border-radius: 10px; min-width: 0;
  background: var(--surface-2); border: 1px solid var(--line-2); transition: border-color .2s, box-shadow .2s;
}
.project:focus-within { border-color: var(--green); box-shadow: var(--glow); }
.project-icon { color: var(--green-2); display: grid; }
.project-icon .ico { width: 16px; height: 16px; }
.project-name { background: none; border: 0; outline: none; font-weight: 600; width: 150px; min-width: 60px; padding: 0; }
.project-version { font: 12px var(--mono); color: var(--muted); }
.save-state { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); padding-left: 8px; border-left: 1px solid var(--line-2); white-space: nowrap; }
.save-state i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); transition: background .3s; }
.save-state.dirty i { background: var(--warn); box-shadow: 0 0 8px var(--warn); animation: blink 1s infinite; }

.search-trigger {
  flex: 1; max-width: 420px; margin: 0 auto; display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 12px; cursor: pointer;
  background: rgba(14, 25, 18, .7); border: 1px solid var(--line-2); border-radius: 10px; color: var(--muted); text-align: left;
  transition: border-color .2s, box-shadow .2s, color .2s, transform .2s var(--spring);
}
.search-trigger span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-trigger:hover { border-color: var(--green-3); color: var(--text-2); box-shadow: var(--glow); }
.search-trigger:active { transform: scale(.98); }

.actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* ================= przyciski ================= */
.btn {
  position: relative; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 13px; border-radius: 10px; cursor: pointer; white-space: nowrap; font-weight: 600; font-size: 13px;
  background: var(--surface-2); border: 1px solid var(--line-2); color: var(--text);
  transition: transform .2s var(--spring), border-color .2s, box-shadow .2s, background .2s;
}
.btn .ico { width: 16px; height: 16px; }
.btn:hover { transform: translateY(-1px); border-color: var(--green-3); box-shadow: var(--glow); }
.btn:active { transform: translateY(1px) scale(.97); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12px; }
.btn-primary { background: linear-gradient(180deg, #2bd36a, #18a74b); border-color: #2bd36a; color: #02180a; }
.btn-primary:hover { background: linear-gradient(180deg, #4ade80, #22c55e); box-shadow: 0 0 0 1px rgba(74, 222, 128, .5), 0 8px 28px rgba(var(--accent-rgb), .35); }
.btn-primary::after { content: ""; position: absolute; top: 0; left: -70%; width: 45%; height: 100%; background: linear-gradient(110deg, transparent, rgba(255, 255, 255, .55), transparent); transform: skewX(-20deg); }
.btn-primary:hover::after { animation: shine .8s ease; }
.btn-save { animation: savePulse 2.8s ease-in-out infinite; }
.btn-save:hover { animation: none; }
.btn-danger:hover { border-color: var(--err); box-shadow: 0 0 18px rgba(248, 113, 113, .2); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.btn-row.center { justify-content: center; }
.btn-group { display: flex; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 10px; padding: 2px; }
.btn-group .icon-btn { border: 0; background: none; }

.icon-btn {
  position: relative; display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--line-2); color: var(--text-2);
  transition: color .2s, background .2s, border-color .2s, transform .2s var(--spring);
}
.icon-btn:hover { color: var(--green-2); background: var(--surface-3); border-color: var(--line-3); }
.icon-btn:active { transform: scale(.9); }
.icon-btn .ico { width: 17px; height: 17px; }

.ripple { position: absolute; border-radius: 50%; background: rgba(187, 247, 208, .45); pointer-events: none; transform: scale(0); animation: ripple .6s ease-out forwards; }

[data-tip] { position: relative; }
[data-tip]::after {
  content: attr(data-tip); position: absolute; top: calc(100% + 8px); left: 50%; transform: translate(-50%, -4px);
  background: #000; color: var(--text); border: 1px solid var(--line-3); border-radius: 6px; padding: 3px 8px;
  font: 500 11.5px var(--font); white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .15s, transform .15s; z-index: 50;
}
[data-tip]:hover::after { opacity: 1; transform: translate(-50%, 0); }
.dock [data-tip]::after { top: auto; bottom: calc(100% + 8px); }

/* ================= układ ================= */
.layout { position: relative; z-index: 1; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; min-height: 0; }
.editor { position: relative; min-width: 0; min-height: 0; animation: fadeIn .8s .35s both; }
#blockly { position: absolute; inset: 0; }

.welcome {
  position: absolute; left: calc(50% + 100px); top: 50%; transform: translate(-50%, -50%); z-index: 2;
  text-align: center; color: var(--muted); max-width: 420px; pointer-events: none; animation: popIn .7s .9s var(--spring) both;
}
.welcome img { width: 140px; filter: drop-shadow(0 0 28px rgba(var(--accent-rgb), .6)); animation: float 4s ease-in-out infinite; }
.welcome h2 { color: var(--text); font-size: 22px; margin: 12px 0 6px; }
.welcome b { color: var(--green-2); }
.welcome-actions { display: flex; gap: 10px; justify-content: center; margin-top: 16px; pointer-events: auto; }

.dock {
  position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 5; margin-left: 100px;
  display: flex; align-items: center; gap: 4px; padding: 5px; border-radius: 12px;
  background: rgba(10, 18, 13, .82); backdrop-filter: blur(10px); border: 1px solid var(--line-2);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .5); animation: dockIn .6s 1.1s var(--spring) both;
}
.dock .icon-btn { border: 0; background: none; }
.dock-sep { width: 1px; height: 20px; background: var(--line-2); margin: 0 3px; }

/* ================= panel boczny ================= */
.inspector {
  width: 370px; overflow: hidden; background: var(--surface); backdrop-filter: blur(12px);
  border-left: 1px solid var(--line); transition: width .45s var(--ease);
}
.layout.collapsed .inspector { width: 0; }
.insp-inner { width: 370px; height: 100%; display: flex; flex-direction: column; }
.insp-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 10px; }
.insp-head h2 { margin: 0; font-size: 16px; }
.panel { display: none; padding: 0 14px 24px; overflow-y: auto; flex: 1; min-height: 0; overscroll-behavior: contain; scroll-behavior: smooth; }
.panel.active { display: block; }
.panel.active > * { animation: fadeUp .45s var(--ease) both; }
.panel.active > *:nth-child(2) { animation-delay: .06s; }
.panel.active > *:nth-child(3) { animation-delay: .12s; }
.panel.active > *:nth-child(4) { animation-delay: .18s; }
.panel.active > *:nth-child(5) { animation-delay: .24s; }

.rail {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 0;
  background: rgba(5, 10, 7, .9); border-left: 1px solid var(--line);
}
.rail-btn {
  position: relative; z-index: 1; width: 52px; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 9px 0 7px;
  background: none; border: 0; border-radius: 10px; color: var(--muted); cursor: pointer; font-size: 10.5px; font-weight: 600;
  transition: color .2s, transform .2s var(--spring);
}
.rail-btn .ico { width: 20px; height: 20px; transition: transform .3s var(--spring); }
.rail-btn:hover { color: var(--text); }
.rail-btn:hover .ico { transform: translateY(-2px); }
.rail-btn.active { color: var(--green-2); }
.rail-indicator {
  position: absolute; left: 6px; top: 0; width: 52px; height: 0; border-radius: 10px;
  background: rgba(var(--accent-rgb), .12); border: 1px solid rgba(var(--accent-rgb), .35); box-shadow: 0 0 18px rgba(var(--accent-rgb), .2);
  transition: transform .4s var(--spring), height .3s;
}
.rail-indicator::before { content: ""; position: absolute; left: -7px; top: 25%; bottom: 25%; width: 3px; border-radius: 3px; background: var(--green); box-shadow: 0 0 10px var(--green); }

/* ================= karty / formularze ================= */
.card { background: rgba(14, 25, 18, .7); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; margin-bottom: 12px; transition: border-color .25s; }
.card:hover { border-color: var(--line-2); }
.card-title { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font-size: 12px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--green-2); }
.card-title .ico { width: 15px; height: 15px; }
.card-title small { text-transform: none; letter-spacing: 0; color: var(--muted); font-weight: 400; margin-left: auto; }
.field { margin-bottom: 11px; }
.field:last-child { margin-bottom: 0; }
.field label { display: block; font-size: 12px; color: var(--text-2); margin-bottom: 5px; font-weight: 500; }
.field label small { color: var(--green-3); font-family: var(--mono); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
input:not([type]):not(.blocklyHtmlInput), input[type=text]:not(.blocklyHtmlInput), textarea:not(.blocklyHtmlInput) {
  width: 100%; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 9px 11px; outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
input:not([type]):not(.blocklyHtmlInput):hover, textarea:not(.blocklyHtmlInput):hover { border-color: var(--line-3); }
input:not([type]):not(.blocklyHtmlInput):focus, textarea:not(.blocklyHtmlInput):focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .15); background: #08100b; }
textarea { resize: vertical; }
.hint { color: var(--muted); font-size: 12.5px; margin: -4px 0 12px; }
.muted { color: var(--muted); }
.status-line { display: flex; align-items: center; gap: 6px; font-size: 12.5px; min-height: 18px; margin-top: 8px; }
.status-line .ico { width: 15px; height: 15px; }
.status-line.ok { color: var(--green-2); }
.status-line.err { color: var(--err); }

.mc-preview { margin-top: 7px; background: #000; border: 1px solid var(--line); border-radius: 7px; padding: 7px 9px; font: 13px var(--mono); min-height: 32px; text-shadow: 2px 2px 0 rgba(0, 0, 0, .7); }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.stat { position: relative; overflow: hidden; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; transition: border-color .2s, transform .2s var(--spring); }
.stat:hover { border-color: var(--line-3); transform: translateY(-2px); }
.stat b { display: block; font-size: 24px; color: var(--text); font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat span { font-size: 11.5px; color: var(--muted); }
.stat .ico { position: absolute; right: 10px; top: 10px; color: var(--green-3); opacity: .7; }
.stat.bump b { animation: bump .5s var(--spring); }

.diag { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.diag li { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg-2); animation: fadeUp .35s both; animation-delay: calc(var(--i, 0) * 50ms); }
.diag li .ico { width: 15px; height: 15px; margin-top: 1px; }
.diag li.ok { color: var(--green-2); }
.diag li.warn { border-color: rgba(250, 204, 21, .3); color: #fde68a; }
.diag li.err { border-color: rgba(248, 113, 113, .35); color: #fecaca; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  background: rgba(var(--accent-rgb), .07); border: 1px solid var(--line-2); color: var(--green-2); cursor: pointer;
  font: 12px var(--mono); padding: 4px 9px; border-radius: 999px; transition: transform .2s var(--spring), border-color .2s, background .2s;
}
.chip:hover { transform: translateY(-2px); border-color: var(--green-3); background: rgba(var(--accent-rgb), .14); }
.chip small { color: var(--muted); font-family: var(--font); }

.colors { display: grid; grid-template-columns: repeat(8, 1fr); gap: 5px; }
.colors button { border: 1px solid var(--line-2); border-radius: 7px; padding: 7px 0; font: 600 11px var(--mono); cursor: pointer; background: #000; transition: transform .2s var(--spring), border-color .2s; }
.colors button:hover { transform: scale(1.12); border-color: var(--green-3); }

.timeline { list-style: none; counter-reset: s; margin: 0; padding: 0; display: grid; gap: 12px; }
.timeline li { counter-increment: s; position: relative; padding-left: 38px; display: grid; gap: 2px; font-size: 12.5px; color: var(--text-2); }
.timeline li b { color: var(--text); font-size: 13.5px; }
.timeline li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 12px; background: linear-gradient(180deg, #2bd36a, #16a34a); color: #02180a; box-shadow: 0 0 12px rgba(var(--accent-rgb), .4); }
.timeline li:not(:last-child)::after { content: ""; position: absolute; left: 12px; top: 28px; bottom: -12px; width: 2px; background: linear-gradient(var(--green-3), transparent); }

.cmd-list { display: grid; gap: 6px; }
.cmd-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 12.5px; color: var(--text-2); padding: 7px 10px; border-radius: 8px; background: var(--bg-2); border: 1px solid var(--line); cursor: pointer; transition: border-color .2s; }
.cmd-row:hover { border-color: var(--green-3); }
.cmd-row code { white-space: nowrap; }
.kbd-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 7px; font-size: 12.5px; color: var(--text-2); }
.kbd-list li { display: flex; justify-content: space-between; align-items: center; }

.code-editor { display: grid; grid-template-columns: auto 1fr; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--bg-2); overflow: hidden; height: 330px; transition: border-color .2s, box-shadow .2s; }
.code-editor:focus-within { border-color: var(--green); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .15); }
.gutter { margin: 0; padding: 10px 8px 10px 10px; text-align: right; color: #2e5a3f; font: 12.5px/1.6 var(--mono); background: rgba(0, 0, 0, .3); border-right: 1px solid var(--line); overflow: hidden; user-select: none; }
.code-editor textarea { border: 0; border-radius: 0; background: transparent; resize: none; height: 100%; font: 12.5px/1.6 var(--mono); padding: 10px; white-space: pre; overflow: auto; box-shadow: none !important; }
.code-view { margin: 0; max-height: 58vh; overflow: auto; padding: 12px; border-radius: var(--r-sm); background: var(--bg-2); border: 1px solid var(--line); font: 12px/1.6 var(--mono); color: var(--text-2); }
.code-view .k { color: var(--green-2); }
.code-view .s { color: #fde68a; }
.code-view .n { color: #93c5fd; }
.code-view .b { color: #f0abfc; }

/* ================= pasek stanu ================= */
.statusbar { position: relative; z-index: 2; display: flex; align-items: center; gap: 16px; padding: 0 14px; white-space: nowrap; overflow: hidden; font-size: 11.5px; color: var(--muted); background: #020403; border-top: 1px solid var(--line); }
.statusbar > span { display: inline-flex; align-items: center; gap: 6px; }
.statusbar .ico { width: 13px; height: 13px; }
.statusbar .grow { flex: 1; }
#sb-diag.err { color: var(--err); }
#sb-diag.warn { color: #fde68a; }
#sb-diag.ok { color: var(--green-3); }
.sb-brand { color: var(--green-4); }

/* ================= nakładki ================= */
.overlay { position: fixed; inset: 0; z-index: 200; display: grid; place-items: start center; padding: 10vh 16px 16px; background: rgba(1, 4, 2, .7); backdrop-filter: blur(6px); animation: fadeIn .2s both; }
.overlay[hidden] { display: none; }
.overlay.closing { animation: fadeOut .18s both; }

.palette { width: min(640px, 100%); background: var(--surface-solid); border: 1px solid var(--line-2); border-radius: 16px; overflow: hidden; box-shadow: 0 30px 90px rgba(0, 0, 0, .7), 0 0 40px rgba(var(--accent-rgb), .12); animation: dropIn .3s var(--spring) both; }
.palette-input { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); color: var(--green-2); }
.palette-input input { flex: 1; border: 0 !important; background: none !important; box-shadow: none !important; padding: 0 !important; font-size: 16px; outline: none; }
.palette-list { list-style: none; margin: 0; padding: 6px; max-height: 52vh; overflow-y: auto; }
.pal-group { padding: 8px 10px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--muted); }
.pal-item { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 10px; cursor: pointer; animation: fadeUp .25s both; animation-delay: calc(var(--i, 0) * 14ms); }
.pal-item .pal-ic { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: #fff; flex-shrink: 0; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12); }
.pal-item .pal-ic .ico { width: 16px; height: 16px; }
.pal-item .pal-main { flex: 1; min-width: 0; }
.pal-item .pal-label { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pal-item .pal-label mark { background: none; color: var(--green-2); font-weight: 700; }
.pal-item .pal-sub { display: block; font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pal-item .pal-kind { font: 10.5px var(--mono); color: var(--muted); border: 1px solid var(--line-2); border-radius: 5px; padding: 1px 6px; }
.pal-item.active { background: rgba(var(--accent-rgb), .12); box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), .3); }
.pal-empty { padding: 30px; text-align: center; color: var(--muted); }
.palette-foot { display: flex; gap: 14px; padding: 9px 14px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--muted); }
.palette-foot span:last-child { margin-left: auto; }

.sheet { width: min(980px, 100%); max-height: 80vh; display: flex; flex-direction: column; background: var(--surface-solid); border: 1px solid var(--line-2); border-radius: 18px; box-shadow: 0 30px 90px rgba(0, 0, 0, .7); animation: dropIn .35s var(--spring) both; }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; padding: 20px 22px 8px; }
.sheet-head h2 { margin: 0 0 2px; }
.sheet-head p { margin: 0; }
.ex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; padding: 12px 22px 22px; overflow-y: auto; }
.ex-card {
  position: relative; text-align: left; display: flex; flex-direction: column; gap: 8px; padding: 16px; cursor: pointer; border-radius: 14px;
  background: linear-gradient(180deg, rgba(20, 38, 27, .9), rgba(10, 18, 13, .9)); border: 1px solid var(--line-2);
  transition: transform .3s var(--spring), border-color .25s, box-shadow .25s; animation: popIn .45s var(--spring) both; animation-delay: calc(var(--i, 0) * 45ms);
}
.ex-card:hover { transform: translateY(-4px); border-color: var(--green-3); box-shadow: 0 14px 34px rgba(0, 0, 0, .5), 0 0 24px rgba(var(--accent-rgb), .18); }
.ex-card .ex-ic { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; color: #02180a; background: linear-gradient(135deg, var(--green-2), var(--green-3)); box-shadow: 0 0 18px rgba(var(--accent-rgb), .35); transition: transform .35s var(--spring); }
.ex-card:hover .ex-ic { transform: rotate(-8deg) scale(1.08); }
.ex-card b { font-size: 15px; }
.ex-card span { color: var(--muted); font-size: 12.5px; }
.ex-card .ex-meta { margin-top: auto; font: 11px var(--mono); color: var(--green-3); }
.ex-card.blank .ex-ic { background: var(--surface-3); color: var(--green-2); box-shadow: none; border: 1px dashed var(--line-3); }

.modal-card, .dialog {
  position: relative; margin-top: 6vh; width: min(470px, 100%); background: linear-gradient(180deg, #0f1f15, #08110b);
  border: 1px solid var(--line-2); border-radius: 20px; padding: 26px 24px 20px; text-align: center;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .65), 0 0 40px rgba(var(--accent-rgb), .15); animation: popIn .45s var(--spring) both;
}
.modal-logo { width: 96px; margin-top: -72px; filter: drop-shadow(0 0 22px rgba(var(--accent-rgb), .7)); animation: float 3s ease-in-out infinite; }
.modal-card h2, .dialog h2 { margin: 8px 0 4px; font-size: 20px; }
.modal-card h2 span { color: var(--green-2); font-family: var(--mono); font-size: 16px; }
.modal-steps { list-style: none; padding: 0; margin: 16px 0; text-align: left; display: grid; gap: 10px; }
.modal-steps li { display: flex; gap: 12px; align-items: center; background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; animation: fadeUp .4s both; }
.modal-steps li:nth-child(2) { animation-delay: .1s; }
.modal-steps li:nth-child(3) { animation-delay: .2s; }
.modal-steps li > span { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--green); color: #02180a; font-weight: 700; font-size: 12px; flex-shrink: 0; box-shadow: 0 0 12px rgba(var(--accent-rgb), .5); }
.modal-steps li > div { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.cmd { font: 600 13px var(--mono); color: var(--green-2); background: #000; border: 1px dashed var(--green-3); border-radius: 7px; padding: 5px 10px; cursor: pointer; transition: border-color .2s, box-shadow .2s; }
.cmd:hover { border-color: var(--green); box-shadow: 0 0 14px rgba(var(--accent-rgb), .3); }
.dialog p { color: var(--text-2); margin: 0 0 14px; }
.dialog-icon { width: 54px; height: 54px; margin: 0 auto; border-radius: 16px; display: grid; place-items: center; background: rgba(var(--accent-rgb), .12); border: 1px solid rgba(var(--accent-rgb), .35); color: var(--green-2); animation: popIn .5s .1s var(--spring) both; }
.dialog-icon.warn { background: rgba(250, 204, 21, .1); border-color: rgba(250, 204, 21, .35); color: var(--warn); }
.dialog-icon .ico { width: 26px; height: 26px; }

.toasts { position: fixed; right: 16px; bottom: 40px; z-index: 300; display: grid; gap: 8px; justify-items: end; pointer-events: none; }
.toast {
  position: relative; overflow: hidden; display: flex; align-items: center; gap: 10px; max-width: min(420px, calc(100vw - 32px));
  padding: 11px 14px; border-radius: 12px; background: var(--surface-solid); border: 1px solid var(--line-3); color: var(--text);
  box-shadow: 0 12px 30px rgba(0, 0, 0, .5); pointer-events: auto; animation: toastIn .4s var(--spring) both; font-size: 13px;
}
.toast .ico { color: var(--green-2); }
.toast.err { border-color: rgba(248, 113, 113, .5); }
.toast.err .ico { color: var(--err); }
.toast::after { content: ""; position: absolute; left: 0; bottom: 0; height: 2px; width: 100%; background: var(--green); transform-origin: left; animation: timer var(--t, 3s) linear forwards; }
.toast.err::after { background: var(--err); }
.toast.out { animation: toastOut .3s ease forwards; }
.spark { position: fixed; width: 7px; height: 7px; border-radius: 2px; pointer-events: none; z-index: 400; animation: spark .9s ease-out forwards; }

/* ================= Blockly ================= */
.blocklyToolboxDiv { background: rgba(5, 10, 7, .92) !important; border-right: 1px solid var(--line); padding: 10px 0 !important; backdrop-filter: blur(10px); }
.blocklyToolboxCategory { animation: fadeLeft .45s var(--ease) both; }
.blocklyTreeRow {
  height: 34px !important; line-height: 34px !important; margin: 1px 8px 1px 6px !important; padding-right: 10px !important;
  border-radius: 9px; border-left-width: 3px !important; transition: background .2s, transform .2s var(--spring) !important;
}
.blocklyTreeRow:hover { background: rgba(var(--accent-rgb), .08) !important; transform: translateX(3px); }
.blocklyTreeRow.blocklyTreeSelected { background: rgba(var(--accent-rgb), .16) !important; box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), .3); }
.blocklyTreeRowContentContainer { display: flex; align-items: center; height: 100%; }
.gb-cat-icon { display: inline-block; width: 17px; height: 17px; margin: 0 9px 0 6px; flex-shrink: 0; -webkit-mask-size: contain; mask-size: contain; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; transition: transform .25s var(--spring); }
.blocklyTreeRow:hover .gb-cat-icon { transform: scale(1.15) rotate(-6deg); }
.blocklyTreeLabel { font: 500 13px var(--font) !important; color: var(--text-2) !important; }
.blocklyTreeSelected .blocklyTreeLabel { color: #fff !important; }
.blocklyFlyoutBackground { fill: #08110b !important; fill-opacity: .97 !important; }
.blocklyFlyoutLabelText { fill: var(--muted) !important; font: 12px var(--font) !important; }
.blocklyMainBackground { stroke: none !important; }
.blocklyWidgetDiv .blocklyMenu, .blocklyDropDownDiv { background: var(--surface-solid) !important; border: 1px solid var(--line-2) !important; border-radius: 10px !important; box-shadow: 0 14px 34px rgba(0, 0, 0, .55) !important; }
.blocklyMenuItem { color: var(--text) !important; font-family: var(--font) !important; border-radius: 6px; }
.blocklyMenuItemHighlight { background: rgba(var(--accent-rgb), .15) !important; }
.blocklyMenuItemDisabled { color: var(--muted) !important; }
.blocklyTooltipDiv { background: #000 !important; color: var(--text) !important; border: 1px solid var(--line-3) !important; border-radius: 8px !important; font-family: var(--font) !important; padding: 6px 9px !important; }
.blocklyScrollbarHandle { fill: var(--line-3) !important; }
.blocklyHtmlInput { font-family: var(--font) !important; font-weight: 600; color: #0b1a10 !important; background: #fff !important; border: 0 !important; padding: 0 4px !important; margin: 0; width: 100%; height: 100%; box-sizing: border-box; text-align: center; outline: none; box-shadow: 0 0 0 2px var(--green), 0 6px 18px rgba(0, 0, 0, .45) !important; caret-color: var(--green-3); }
.blocklyHtmlInput::selection { background: rgba(var(--accent-rgb), .35); color: #0b1a10; }
.blocklyWidgetDiv { zoom: 1; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--line-3); background-clip: padding-box; border: 2px solid transparent; }
::-webkit-scrollbar-track { background: transparent; }

/* ================= animacje ================= */
@keyframes savePulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(var(--accent-rgb), 0); } 50% { box-shadow: 0 0 0 4px rgba(var(--accent-rgb), .18), 0 0 24px rgba(var(--accent-rgb), .35); } }
@keyframes splashIn { from { transform: scale(.3) rotate(-25deg); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes ring { from { transform: scale(.6); opacity: .9; } to { transform: scale(1.9); opacity: 0; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fadeLeft { from { opacity: 0; transform: translateX(-14px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeOut { to { opacity: 0; } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-100%); } to { opacity: 1; transform: none; } }
@keyframes loading { from { transform: translateX(-100%); } to { transform: translateX(260%); } }
@keyframes float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -5px; } }
@keyframes shimmer { from { background-position: 0% 0; } to { background-position: 300% 0; } }
@keyframes shine { from { left: -70%; } to { left: 130%; } }
@keyframes ripple { to { transform: scale(3); opacity: 0; } }
@keyframes bump { 40% { transform: scale(1.25); color: var(--mint); } }
@keyframes dropIn { from { opacity: 0; transform: translateY(-14px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes popIn { from { opacity: 0; transform: scale(.88) translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes dockIn { from { opacity: 0; transform: translate(-50%, 30px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes toastIn { from { opacity: 0; transform: translateX(40px) scale(.95); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(40px) scale(.95); } }
@keyframes timer { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@keyframes blink { 50% { opacity: .25; } }
@keyframes spark { to { transform: translate(var(--dx), var(--dy)) rotate(540deg); opacity: 0; } }
@keyframes gridDrift { from { transform: translate(0, 0); } to { transform: translate(40px, 40px); } }
@keyframes orb { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(80px, 60px) scale(1.15); } }
@keyframes scan { from { background-position: -50% 0; } to { background-position: 150% 0; } }
@keyframes wiggle { 0%, 100% { rotate: 0deg; } 25% { rotate: -14deg; } 75% { rotate: 12deg; } }
@keyframes rise {
  0% { transform: translate(0, 0) rotate(-8deg); opacity: 0; }
  10% { opacity: .14; }
  50% { transform: translate(40px, -55vh) rotate(8deg); }
  90% { opacity: .08; }
  100% { transform: translate(-10px, -115vh) rotate(-6deg); opacity: 0; }
}
.wiggle { animation: wiggle .6s ease-in-out; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .bg-fx img, .bg-orb { display: none; }
}

/* ================= projekt i konto w nagłówku ================= */
button.project { cursor: pointer; text-align: left; min-width: 0; max-width: 340px; transition: border-color .2s, box-shadow .2s, transform .2s var(--spring); }
button.project:hover { border-color: var(--green-3); box-shadow: var(--glow); }
button.project:active { transform: scale(.98); }
.project-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.project-text b { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }
.project-text small { font: 11px var(--mono); color: var(--muted); white-space: nowrap; }
.project-chevron { color: var(--muted); display: grid; }
.project-chevron .ico { width: 15px; height: 15px; }
.avatar-btn { background: none; border: 0; padding: 0; cursor: pointer; border-radius: 50%; transition: transform .25s var(--spring); }
.avatar-btn:hover { transform: scale(1.08); }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #02180a; background: var(--green); box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px var(--line-3); }
.avatar.guest { background: var(--surface-3); color: var(--text-2); }
.avatar .ico { width: 18px; height: 18px; }

.drop-zone { position: fixed; inset: 0; z-index: 500; display: grid; place-items: center; background: rgba(1, 6, 3, .8); backdrop-filter: blur(6px); animation: fadeIn .15s both; }
.drop-zone[hidden] { display: none; }
.drop-card { display: grid; justify-items: center; gap: 8px; padding: 44px 60px; border: 2px dashed var(--green); border-radius: 22px; color: var(--muted); animation: popIn .35s var(--spring) both; }
.drop-card b { color: var(--text); font-size: 20px; }
.drop-card .ico { width: 42px; height: 42px; color: var(--green-2); animation: float 1.6s ease-in-out infinite; }

/* ================= pliki configu ================= */
.file-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.file-tab { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 8px; cursor: pointer; font: 12.5px var(--mono); background: var(--bg-2); border: 1px solid var(--line-2); color: var(--text-2); transition: border-color .2s, background .2s, transform .2s var(--spring); }
.file-tab:hover { border-color: var(--line-3); transform: translateY(-1px); }
.file-tab.active { border-color: var(--green); color: var(--green-2); background: rgba(var(--accent-rgb), .1); }
.file-tab.add { border-style: dashed; color: var(--green-2); font-family: var(--font); }
.file-tab .ico { width: 14px; height: 14px; }
.file-bar { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; font: 13px var(--mono); }
.file-bar .grow { flex: 1; }
.empty-state { display: grid; justify-items: center; text-align: center; gap: 6px; padding: 22px 10px; color: var(--muted); font-size: 12.5px; }
.empty-state b { color: var(--text); font-size: 14px; }
.empty-state .ico { width: 30px; height: 30px; color: var(--green-3); }
.empty-state[hidden] { display: none; }

/* ================= baza ================= */
.seg { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 10px; }
.seg button { display: inline-flex; align-items: center; gap: 5px; padding: 5px 9px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--bg-2); color: var(--text-2); cursor: pointer; font-size: 12px; transition: all .2s; }
.seg button .ico { width: 13px; height: 13px; }
.seg button:hover { border-color: var(--line-3); }
.seg button.active { background: var(--green); border-color: var(--green); color: #02180a; font-weight: 600; }
.search-field { display: flex; align-items: center; gap: 8px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--bg-2); color: var(--muted); transition: border-color .2s, box-shadow .2s; }
.search-field:focus-within { border-color: var(--green); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .15); }
.search-field input { border: 0 !important; background: none !important; box-shadow: none !important; padding: 9px 0 !important; }
.search-field .ico { width: 16px; height: 16px; }
.search-field.compact { width: 220px; }
.db-meta { display: flex; justify-content: space-between; align-items: center; margin: 8px 0; font-size: 12px; color: var(--muted); }
.link-btn { display: inline-flex; align-items: center; gap: 5px; background: none; border: 0; color: var(--green-2); cursor: pointer; font-size: 12px; }
.link-btn .ico { width: 14px; height: 14px; transition: transform .5s; }
.link-btn:hover .ico { transform: rotate(180deg); }
.db-list { display: grid; gap: 4px; }
.db-row { display: flex; align-items: center; gap: 8px; padding: 6px 9px; border-radius: 8px; border: 1px solid transparent; cursor: pointer; transition: background .15s, border-color .15s; }
.db-row:hover { background: rgba(var(--accent-rgb), .07); border-color: var(--line-2); }
.db-row code { flex-shrink: 0; max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.db-row span { flex: 1; min-width: 0; color: var(--text-2); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.db-row small { color: var(--muted); font-size: 11px; }
.badge { font: 11px var(--mono); color: var(--green-2); border: 1px solid var(--line-3); border-radius: 6px; padding: 1px 7px; }

/* ================= fragmenty ================= */
.snippet-list { display: grid; gap: 8px; }
.snippet { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--line); animation: fadeUp .35s both; animation-delay: calc(var(--i, 0) * 40ms); transition: border-color .2s; }
.snippet:hover { border-color: var(--line-3); }
.snippet .pal-ic { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; color: #fff; }
.snippet .pal-ic .ico { width: 16px; height: 16px; }
.snippet div { flex: 1; min-width: 0; }
.snippet b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.snippet small { color: var(--muted); font-size: 11.5px; }

/* ================= ustawienia ================= */
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 13px; }
.set-row:first-of-type { border-top: 0; }
.set-row label { flex: 1; color: var(--text); }
.set-row small { display: block; color: var(--muted); font-size: 11.5px; margin-top: 1px; }
.set-row select, .set-row input[type=number], .set-row input.set-text {
  background: var(--bg-2); color: var(--text); border: 1px solid var(--line-2); border-radius: 8px; padding: 6px 8px; font: 12.5px var(--font); outline: none; max-width: 150px;
}
.set-row select:focus, .set-row input:focus { border-color: var(--green); }
.switch { position: relative; width: 40px; height: 22px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch i { position: absolute; inset: 0; border-radius: 22px; background: var(--surface-3); border: 1px solid var(--line-3); cursor: pointer; transition: background .25s; }
.switch i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--text-2); transition: transform .3s var(--spring), background .25s; }
.switch input:checked + i { background: var(--green-3); border-color: var(--green); }
.switch input:checked + i::after { transform: translateX(18px); background: #fff; }
.accents { display: flex; gap: 6px; }
.accents button { width: 22px; height: 22px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; transition: transform .2s var(--spring); }
.accents button:hover { transform: scale(1.15); }
.accents button.active { border-color: #fff; box-shadow: 0 0 10px currentColor; }

/* ================= wybierak, projekty, konto ================= */
.picker-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px 0; }
.picker-head .pal-ic { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: #fff; }
.picker-head b { flex: 1; font-size: 15px; }
.picker-list .pal-item code { font-size: 12px; }
.pal-item.current { box-shadow: inset 3px 0 0 var(--green); }
.sheet-tools { display: flex; align-items: center; gap: 8px; }
.proj-card { cursor: default; }
.proj-card.current { border-color: var(--green); box-shadow: 0 0 0 1px rgba(var(--accent-rgb), .35), 0 0 22px rgba(var(--accent-rgb), .15); }
.proj-actions { display: flex; gap: 4px; margin-top: 6px; }
.proj-actions .icon-btn { width: 28px; height: 28px; }
.proj-actions .btn { height: 28px; padding: 0 10px; font-size: 12px; }
.proj-card b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account-sheet { width: min(560px, 100%); }
.account-body { padding: 4px 22px 22px; overflow-y: auto; }
.ac-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line); margin-bottom: 14px; }
.ac-tabs button { padding: 8px; border-radius: 9px; border: 0; background: none; color: var(--muted); cursor: pointer; font-weight: 600; transition: all .2s; }
.ac-tabs button.active { background: var(--surface-3); color: var(--green-2); box-shadow: inset 0 0 0 1px var(--line-3); }
.ac-form { display: grid; gap: 10px; animation: fadeUp .3s both; }
.ac-form .check { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 12.5px; }
.ac-form .check input { width: auto; accent-color: var(--green); }
.ac-error { color: var(--err); font-size: 12.5px; min-height: 16px; }
.ac-profile { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.ac-profile .avatar { width: 56px; height: 56px; font-size: 22px; }
.ac-profile b { font-size: 18px; display: block; }
.ac-section { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
.ac-section h4 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--green-2); }
.dialog .field { text-align: left; }

/* ================= skala, przewijanie, podgląd bloczka ================= */
.top { height: calc(60px * var(--ui-scale)); }
.top > *, .inspector, .rail, .statusbar, .overlay > *, .toasts { zoom: var(--ui-scale); }
.top { padding-top: 0; padding-bottom: 0; }
.statusbar { height: 28px; }
* { scrollbar-width: thin; scrollbar-color: var(--line-3) transparent; }
.blocklyToolboxDiv { overflow-y: auto !important; overscroll-behavior: contain; }
.insp-inner { min-height: 0; }
.inspector { height: 100%; min-height: 0; }
.rail { overflow-y: auto; min-height: 0; }
body.no-statusbar .statusbar { display: none; }
body.no-dock .dock { display: none; }

.block-card {
  position: absolute; right: 16px; top: 16px; z-index: 6; width: min(340px, calc(100% - 32px));
  background: rgba(10, 18, 13, .92); backdrop-filter: blur(12px); border: 1px solid var(--line-2); border-radius: 14px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .5); padding: 12px 14px; animation: popIn .3s var(--spring) both; zoom: var(--ui-scale);
}
.block-card[hidden] { display: none; }
.block-card .bc-head { display: flex; align-items: center; gap: 10px; }
.block-card .pal-ic { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; color: #fff; flex-shrink: 0; }
.block-card .pal-ic .ico { width: 16px; height: 16px; }
.block-card .bc-title { flex: 1; min-width: 0; }
.block-card .bc-title b { display: block; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.block-card .bc-title small { color: var(--muted); font-size: 11.5px; }
.block-card p { margin: 8px 0 0; color: var(--text-2); font-size: 12.5px; }
.block-card .bc-previews { display: grid; gap: 5px; margin-top: 8px; }
.block-card .mc-preview { margin: 0; min-height: 0; font-size: 12.5px; }
.block-card .bc-actions { display: flex; gap: 6px; margin-top: 10px; }
.block-card .bc-actions .btn { height: 28px; padding: 0 10px; font-size: 12px; }

/* ================= tryby ================= */
body.no-anim *, body.no-anim *::before, body.no-anim *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
body.no-bg .bg-fx { display: none; }
body.compact .card { padding: 10px; margin-bottom: 8px; }
body.compact .field { margin-bottom: 7px; }
body.compact .btn { height: 32px; }

/* ================= responsywność ================= */
@media (max-width: 1320px) {
  .search-trigger span, .search-trigger kbd { display: none; }
  .search-trigger { flex: 0 0 auto; margin: 0 0 0 auto; }
  .project-name { width: 120px; }
}
@media (max-width: 1120px) {
  .actions .btn:not(.btn-save) span { display: none; }
  .actions .btn:not(.btn-save) { width: 36px; padding: 0; }
}
@media (max-width: 920px) {
  .actions .btn span { display: none; }
  .actions .btn { width: 36px; padding: 0; }
  .save-state span { display: none; }
  .brand-text { display: none; }
  .project-text small { display: none; }
  .search-field.compact { width: 140px; }
  .inspector { position: absolute; right: 64px; top: 0; bottom: 0; z-index: 10; box-shadow: -20px 0 40px rgba(0, 0, 0, .5); }
  .layout { grid-template-columns: 1fr 64px; }
  .welcome, .dock { left: 50%; margin-left: 0; }
}
@media (max-width: 560px) {
  body { grid-template-rows: auto 1fr 28px; }
  .top { flex-wrap: wrap; padding: 8px 12px; gap: 8px; }
  .project { order: 3; flex: 1 1 100%; max-width: none; }
  .project-text { flex: 1; }
  .actions { margin-left: auto; gap: 4px; }
  .btn-group { display: none; }
  .inspector, .insp-inner { width: calc(100vw - 64px); }
  .row2 { grid-template-columns: 1fr; }
  .statusbar .sb-brand, .statusbar #sb-count { display: none; }
  .blocklyTreeLabel { display: none !important; }
  .blocklyTreeRow { margin: 1px 4px !important; padding-right: 0 !important; }
  .gb-cat-icon { margin: 0 6px; }
  .dock { bottom: 10px; }
}
