/*
 * ETS2 - Mods-Crafter 1.0
 *
 * Jezyk wizualny: grafit + mosiadz, zgodnie z banerem i klimatem ETS2.
 * Zasada nadrzedna: chrom ozdobny siedzi w ramach i naglowkach, a obszar
 * roboczy (plotno, pola liczbowe, lista warstw) zostaje czysty i kontrastowy.
 * Narzedzie z liczbami czyta sie krojem Inter, bez kursywy, etykiety nie
 * schodza ponizej 12 px - inaczej praca w nim meczy po kwadransie.
 */

:root {
  --bg: #16181c;
  --bg-2: #1c1f24;
  --panel: #21242a;
  --panel-2: #272b32;
  --line: #343941;
  --line-soft: #2b2f36;

  --brass: #c9a227;
  --brass-2: #b08d57;
  --brass-hi: #f0d98a;
  --brass-dim: #6b5a2a;

  --text: #e8e6e1;
  --text-2: #a7adb7;
  --text-3: #767d88;

  --ok: #4ea76b;
  --warn: #d99a2b;
  --err: #d9534f;
  --sel: #4a9eff;

  --rail: 74px;
  --insp: 322px;
  --radius: 8px;
  --shadow: 0 8px 28px rgba(0, 0, 0, .45);
  --font: 'Inter', 'Segoe UI', system-ui, sans-serif;
  --font-head: 'Oswald', 'Inter', sans-serif;

  /* kursor w stylu interfejsu ETS2: biala strzalka z ciemnym obrysem
     i cieniem; nad przyciskami - ta sama strzalka w mosiadzu */
  --kursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0' stop-color='%23ffffff'/%3E%3Cstop offset='1' stop-color='%23d7dadf'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpath d='M5 3.5v20.2l5.3-4.9 3.6 8.2 3.7-1.6-3.6-8.1 7.3-.3z' fill='rgba(0,0,0,.45)' transform='translate(1.3 1.7)'/%3E%3Cpath d='M5 3.5v20.2l5.3-4.9 3.6 8.2 3.7-1.6-3.6-8.1 7.3-.3z' fill='url(%23g)' stroke='%23111214' stroke-width='1.6' stroke-linejoin='round'/%3E%3Cpath d='M6.6 7.3v12.5' stroke='%23ffffff' stroke-width='1.1' stroke-linecap='round' opacity='.9'/%3E%3C/svg%3E") 5 3, default;
  --kursor-klik: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0' stop-color='%23fff4cf'/%3E%3Cstop offset='1' stop-color='%23e6b53c'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpath d='M5 3.5v20.2l5.3-4.9 3.6 8.2 3.7-1.6-3.6-8.1 7.3-.3z' fill='rgba(0,0,0,.45)' transform='translate(1.3 1.7)'/%3E%3Cpath d='M5 3.5v20.2l5.3-4.9 3.6 8.2 3.7-1.6-3.6-8.1 7.3-.3z' fill='url(%23g)' stroke='%23111214' stroke-width='1.6' stroke-linejoin='round'/%3E%3Cpath d='M6.6 7.3v12.5' stroke='%23fffbe8' stroke-width='1.1' stroke-linecap='round' opacity='.9'/%3E%3C/svg%3E") 5 3, pointer;
}

* { box-sizing: border-box; }

/*
 * Atrybut hidden ma ukrywac ZAWSZE. Przegladarka realizuje go przez
 * display: none w swoim arkuszu, a kazda regula autora z display: block
 * (np. dla plotna) go przebija. Tak wlasnie plotno 3D zostawalo na
 * wierzchu po wyjsciu z podgladu i zaslanialo rzut 2D oraz edytor.
 */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  height: 100dvh;
  background:
    radial-gradient(1100px 620px at 8% -8%, rgba(201, 162, 39, .12), transparent 62%),
    radial-gradient(900px 560px at 104% 2%, rgba(123, 21, 32, .22), transparent 60%),
    radial-gradient(1200px 700px at 50% 118%, rgba(56, 84, 122, .16), transparent 60%),
    linear-gradient(180deg, #1c1f25 0%, #15171b 48%, #111317 100%);
  background-attachment: fixed;
  color: var(--text);
  cursor: var(--kursor);
  font-family: var(--font);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: var(--kursor-klik); }
:focus-visible { outline: 2px solid var(--sel); outline-offset: 1px; }

/* ---------------------------------------------------------------- ukladi */

#app { display: flex; flex-direction: column; height: 100%; }

/* --- pasek gorny --------------------------------------------------- */

.topbar {
  display: flex;
  align-items: stretch;
  gap: 14px;
  height: 56px;
  padding: 0 14px;
  background: linear-gradient(180deg, #23262c, #1a1d22);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 2px 10px rgba(0, 0, 0, .5);
  flex: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-right: 14px;
  border-right: 1px solid var(--line);
  color: inherit;
  text-decoration: none;
}
.brand .brand-mark { transition: transform .2s ease, box-shadow .2s ease; }
.brand:hover .brand-mark { transform: scale(1.06) rotate(-4deg); box-shadow: 0 3px 12px rgba(201, 162, 39, .35); }

.brand-mark {
  width: 34px; height: 34px;
  flex: none;
  display: block;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .45);
}


.brand-name {
  font-family: var(--font-head);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: .4px;
  background: linear-gradient(180deg, #f6e6ae, var(--brass) 60%, #8a6f22);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  white-space: nowrap;
}
.brand-ver { font-size: 11px; color: var(--text-3); margin-left: 4px; }

/* kroki pracy - prowadza uzytkownika, ktory pierwszy raz widzi konfigurator */
.steps { display: flex; align-items: center; gap: 4px; }

.step {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 13px 7px 9px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: none;
  color: var(--text-2);
  font-size: 13px;
  white-space: nowrap;
  transition: background .12s, color .12s, border-color .12s;
}
.step:hover { background: var(--panel-2); color: var(--text); }
.step.is-active {
  background: linear-gradient(180deg, #2f333b, #262a31);
  border-color: var(--brass-dim);
  color: var(--brass-hi);
}
.step-num {
  width: 21px; height: 21px; flex: none;
  display: grid; place-items: center;
  border-radius: 50%;
  background: #33383f; color: var(--text-2);
  font-size: 11px; font-weight: 700;
}
.step.is-active .step-num { background: var(--brass); color: #201a06; }
.step.is-done .step-num { background: var(--ok); color: #06210f; }
.step-krotka { display: none; }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; min-width: 0; }
.steps { min-width: 0; overflow-x: auto; scrollbar-width: none; }
.steps::-webkit-scrollbar { display: none; }

.btn-ico {
  width: 15px; height: 15px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}

/* --- przyciski ------------------------------------------------------ */

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: linear-gradient(180deg, var(--panel-2), #202329);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: border-color .12s, background .12s, transform .06s;
}
.btn:hover { border-color: #4a515c; background: linear-gradient(180deg, #30343c, #24272d); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary {
  border-color: #8a6f22;
  background: linear-gradient(180deg, var(--brass-hi), var(--brass) 52%, #94761f);
  color: #1d1704;
  font-weight: 700;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45);
}
.btn-primary:hover { background: linear-gradient(180deg, #fbe9b4, #d6ad2a 52%, #a3831f); border-color: #a3831f; }
.btn-ghost { background: none; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--panel-2); color: var(--text); border-color: var(--line); }
.btn-sm { padding: 5px 9px; font-size: 12px; }
.btn-icon { padding: 7px; width: 32px; justify-content: center; }
.btn-danger:hover { border-color: #6d3330; color: #ff9b97; }

/* --- widoki --------------------------------------------------------- */

.view { display: none; flex: 1; min-height: 0; }
.view.is-active { display: flex; }

/* --- widok startowy ------------------------------------------------- */

#view-start { flex-direction: column; overflow: auto; }

/*
 * Widoki przewijane sa kontenerami flex, wiec ich dzieci domyslnie daja sie
 * sciskac - baner o wysokosci 500 px potrafi przez to zniknac do dwoch
 * pikseli ramki. flex: none wylacza kurczenie i przywraca naturalna wysokosc.
 */
#view-start > *, #view-mod > *, #view-export > * { flex: none; }

.hero {
  position: relative;
  max-width: 1180px;
  margin: 22px auto 0;
  width: calc(100% - 44px);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.hero img { display: block; width: 100%; height: auto; }
.hero-fade {
  position: absolute; inset: auto 0 0 0; height: 46%;
  background: linear-gradient(180deg, transparent, rgba(16, 18, 22, .92));
  pointer-events: none;
}
.hero-cta {
  position: absolute; left: 0; right: 0; bottom: 16px;
  display: flex; justify-content: center; gap: 10px;
}

.start-wrap { max-width: 1180px; width: calc(100% - 44px); margin: 0 auto 40px; }


.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(258px, 1fr)); gap: 14px; }
.card {
  background: linear-gradient(180deg, var(--panel), var(--bg-2));
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px 17px;
}
.card h3 {
  margin: 0 0 8px;
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: var(--brass-hi);
}
.card p { margin: 0; font-size: 13px; line-height: 1.6; color: var(--text-2); }
.card ol, .card ul { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.75; color: var(--text-2); }

.section-title {
  margin: 30px 0 14px;
  font-family: var(--font-head);
  font-size: 15px;
  letter-spacing: 1.1px;
  text-transform: uppercase;
  color: var(--text);
  display: flex; align-items: center; gap: 12px;
}
.section-title::after { content: ''; flex: 1; height: 1px; background: var(--line); }

/* --- widok edytora -------------------------------------------------- */

#view-edit { flex-direction: column; }
.edit-body { display: flex; flex: 1; min-height: 0; }

/* rail narzedzi */
.rail {
  width: var(--rail); flex: none;
  background: var(--bg-2);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  padding: 8px 0;
  gap: 2px;
  overflow-y: auto;
}
.tool {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 9px 2px;
  margin: 0 6px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: none;
  color: var(--text-2);
  font-size: 10.5px;
  letter-spacing: .2px;
}
.tool svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tool:hover { background: var(--panel-2); color: var(--text); }
.tool.is-active {
  background: linear-gradient(180deg, #34373e, #292c33);
  border-color: var(--brass-dim);
  color: var(--brass-hi);
}
.rail-sep { height: 1px; background: var(--line); margin: 6px 12px; }

/* scena */
/* position: relative jest tu konieczne - bez niego szuflada z biblioteka
   pozycjonuje sie wzgledem okna i wchodzi na pasek gorny. */
.stage-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; background: #101216; position: relative; }

.surface-tabs {
  display: flex; align-items: center; gap: 2px;
  padding: 6px 10px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  flex: none;
}
.stab {
  padding: 7px 13px;
  border: 1px solid transparent;
  border-radius: 6px 6px 0 0;
  background: none;
  color: var(--text-2);
  font-size: 12.5px;
  white-space: nowrap;
  display: flex; align-items: center; gap: 7px;
}
.stab:hover { background: var(--panel-2); color: var(--text); }
.stab.is-active { background: #101216; border-color: var(--line); border-bottom-color: #101216; color: var(--brass-hi); margin-bottom: -7px; padding-bottom: 14px; }
.stab-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--line); }
.stab.has-content .stab-dot { background: var(--ok); }
.stab-mirror { font-size: 10px; color: var(--text-3); border: 1px solid var(--line); border-radius: 4px; padding: 1px 4px; }

.stage {
  flex: 1; min-height: 0; position: relative;
  overflow: hidden;
  background:
    linear-gradient(45deg, #15171b 25%, transparent 25%) 0 0/22px 22px,
    linear-gradient(-45deg, #15171b 25%, transparent 25%) 0 11px/22px 22px,
    linear-gradient(45deg, transparent 75%, #15171b 75%) 11px -11px/22px 22px,
    linear-gradient(-45deg, transparent 75%, #15171b 75%) -11px 0/22px 22px,
    #101216;
}
#canvas { position: absolute; display: block; cursor: var(--kursor); }
.stage-hint {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  text-align: center; color: var(--text-3); font-size: 13px; line-height: 1.7;
  pointer-events: none; max-width: 340px;
}

.stage-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 12px;
  background: var(--bg-2);
  border-top: 1px solid var(--line);
  font-size: 12px; color: var(--text-2);
  flex: none;
}
.stage-bar .sep { width: 1px; height: 18px; background: var(--line); }
.stage-bar .grow { flex: 1; }
.dims { font-variant-numeric: tabular-nums; color: var(--text-3); }

/* inspektor */
.inspector {
  width: var(--insp); flex: none;
  background: var(--bg-2);
  border-left: 1px solid var(--line);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.insp-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; }

.group { border-bottom: 1px solid var(--line-soft); }
.group-head {
  display: flex; align-items: center; gap: 8px;
  width: 100%;
  padding: 11px 13px;
  background: none; border: 0;
  font-family: var(--font-head);
  font-size: 12px; letter-spacing: 1px; text-transform: uppercase;
  color: var(--text-2);
}
.group-head:hover { color: var(--text); background: rgba(255, 255, 255, .02); }
.group-head .chev { margin-left: auto; transition: transform .14s; color: var(--text-3); }
.group.is-open .chev { transform: rotate(90deg); }
.group.is-open .group-head { color: var(--brass-hi); }
.group-body { padding: 2px 13px 14px; display: none; }
.group.is-open .group-body { display: block; }

.row { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }
.row:last-child { margin-bottom: 0; }
.row label, .fld-label {
  font-size: 12px; color: var(--text-2);
  flex: none; width: 84px;
}
.row.stack { flex-direction: column; align-items: stretch; gap: 5px; }
.row.stack label { width: auto; }

input[type=text], input[type=number], select, textarea {
  width: 100%;
  padding: 7px 9px;
  background: #16181c;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-variant-numeric: tabular-nums;
}
input[type=text]:focus, input[type=number]:focus, select:focus, textarea:focus {
  border-color: var(--brass-dim); outline: none;
}
textarea { resize: vertical; min-height: 64px; line-height: 1.5; }
select { cursor: var(--kursor-klik); }
input[type=number] { -moz-appearance: textfield; }
input[type=number]::-webkit-outer-spin-button, input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

input[type=range] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 22px; background: none; cursor: var(--kursor-klik);
}
input[type=range]::-webkit-slider-runnable-track { height: 4px; background: #33373e; border-radius: 2px; }
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px; margin-top: -5px;
  border-radius: 50%; background: var(--brass); border: 2px solid #1a1d22;
}
input[type=color] {
  width: 34px; height: 30px; padding: 2px; flex: none;
  background: #16181c; border: 1px solid var(--line); border-radius: 6px; cursor: var(--kursor-klik);
}
input[type=checkbox] { accent-color: var(--brass); width: 15px; height: 15px; cursor: var(--kursor-klik); }

.seg { display: flex; gap: 0; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; width: 100%; }
.seg button {
  flex: 1; padding: 6px 4px; background: #16181c; border: 0;
  border-right: 1px solid var(--line); color: var(--text-2); font-size: 12px;
}
.seg button:last-child { border-right: 0; }
.seg button:hover { background: var(--panel-2); color: var(--text); }
.seg button.is-active { background: linear-gradient(180deg, #3a3d45, #2e323a); color: var(--brass-hi); }
.seg svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }

.hint { font-size: 11.5px; line-height: 1.55; color: var(--text-3); margin: 6px 0 0; }
.hint-warn { color: var(--warn); }

/* lista warstw */
.layers { padding: 6px 8px 10px; }
.layer {
  display: flex; align-items: center; gap: 7px;
  padding: 6px 7px;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: var(--kursor-klik);
  user-select: none;
}
.layer:hover { background: var(--panel-2); }
.layer.is-sel { background: linear-gradient(180deg, #34373e, #292c33); border-color: var(--brass-dim); }
.layer-thumb {
  width: 26px; height: 26px; flex: none;
  border-radius: 4px; background: #14161a; border: 1px solid var(--line);
  display: grid; place-items: center; color: var(--text-3);
}
.layer-thumb svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.layer-name {
  flex: 1; min-width: 0; font-size: 12.5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.layer.is-hidden .layer-name, .layer.is-hidden .layer-thumb { opacity: .4; }
.layer-btn { background: none; border: 0; padding: 3px; color: var(--text-3); border-radius: 4px; display: grid; }
.layer-btn:hover { color: var(--text); background: rgba(255, 255, 255, .06); }
.layer-btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.layer-drag { cursor: grab; color: var(--text-3); }
.layer.is-drag { opacity: .45; }
.layer.drop-above { box-shadow: inset 0 2px 0 var(--brass); }
.layer.drop-below { box-shadow: inset 0 -2px 0 var(--brass); }

.empty { padding: 20px 14px; text-align: center; color: var(--text-3); font-size: 12.5px; line-height: 1.6; }

/* --- paleta / biblioteki (szuflada) --------------------------------- */

.drawer {
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 302px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  box-shadow: 14px 0 30px rgba(0, 0, 0, .35);
  display: none; flex-direction: column;
  z-index: 20;
}
.drawer.is-open { display: flex; }
.drawer-head {
  display: flex; align-items: center; gap: 8px;
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-head); font-size: 13px; letter-spacing: .8px;
  text-transform: uppercase; color: var(--brass-hi);
}
.drawer-head .btn-icon { margin-left: auto; }
.drawer-body { flex: 1; overflow-y: auto; padding: 10px; }
.drawer-search { padding: 8px 10px; border-bottom: 1px solid var(--line-soft); }

.pick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.pick-grid.wide { grid-template-columns: repeat(2, 1fr); }
.pick {
  aspect-ratio: 1;
  background: #16181c;
  border: 1px solid var(--line);
  border-radius: 7px;
  display: grid; place-items: center;
  padding: 7px;
  color: var(--text-2);
  transition: border-color .12s, background .12s;
}
.pick:hover { border-color: var(--brass-dim); background: #1d2026; color: var(--brass-hi); }
.pick svg, .pick canvas { width: 100%; height: 100%; display: block; }
.pick-cat {
  grid-column: 1 / -1;
  font-size: 11px; letter-spacing: .8px; text-transform: uppercase;
  color: var(--text-3); margin: 8px 0 1px;
}
.pick-cat:first-child { margin-top: 0; }

.tpl {
  border: 1px solid var(--line); border-radius: 8px; overflow: hidden;
  background: #16181c; text-align: left; padding: 0; width: 100%;
  margin-bottom: 9px; display: block;
}
.tpl:hover { border-color: var(--brass-dim); }
.tpl canvas { display: block; width: 100%; height: auto; background: #0e1013; }
.tpl-name { padding: 7px 9px; font-size: 12.5px; color: var(--text); }
.tpl-name small { display: block; color: var(--text-3); font-size: 11px; margin-top: 2px; line-height: 1.4; }

/* --- widok moda / eksportu ------------------------------------------ */

#view-mod, #view-export { flex-direction: column; overflow: auto; }
.form-wrap { max-width: 1180px; width: calc(100% - 44px); margin: 24px auto 48px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; align-items: start; }

.fld { margin-bottom: 13px; }
.fld:last-child { margin-bottom: 0; }
.fld > label { display: block; font-size: 12px; color: var(--text-2); margin-bottom: 5px; }
.fld .hint { margin-top: 5px; }
.fld-row { display: flex; gap: 10px; }
.fld-row > * { flex: 1; }

.vlist { display: grid; gap: 7px; }
.vitem {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 11px;
  background: #16181c;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: var(--kursor-klik);
}
.vitem:hover { border-color: #4a515c; }
.vitem.is-on { border-color: var(--brass-dim); background: #1c1f26; }
.vitem input { margin-top: 2px; }
.vitem-main { flex: 1; min-width: 0; }
.vitem-name { font-size: 13px; }
.vitem-sub { font-size: 11.5px; color: var(--text-3); margin-top: 3px; line-height: 1.5; }
.tag {
  display: inline-block; padding: 1px 6px; border-radius: 4px;
  font-size: 10.5px; letter-spacing: .3px; margin-left: 6px; vertical-align: 1px;
}
.tag-ok { background: rgba(78, 167, 107, .16); color: #7fd49a; border: 1px solid rgba(78, 167, 107, .35); }
.tag-plain { background: rgba(217, 154, 43, .14); color: #e2b35c; border: 1px solid rgba(217, 154, 43, .32); }
.tag-dlc { background: rgba(74, 158, 255, .13); color: #86bcff; border: 1px solid rgba(74, 158, 255, .3); }

.drop {
  border: 1.5px dashed var(--line); border-radius: 9px;
  padding: 18px; text-align: center; color: var(--text-3);
  font-size: 12.5px; line-height: 1.6; cursor: var(--kursor-klik);
  background: #16181c; transition: border-color .12s, color .12s, background .12s;
}
.drop:hover, .drop.is-over { border-color: var(--brass); color: var(--brass-hi); background: #1b1e24; }
.drop img { max-width: 100%; max-height: 132px; border-radius: 6px; display: block; margin: 0 auto 9px; }

/*
 * Podglady paneli. Burta ma proporcje 5:1, a sciana przednia prawie 1:1 -
 * gdyby kazdy kafelek dostal pelna szerokosc karty, przod i tyl zajelyby
 * po pol ekranu. Dlatego kafelek ma stala wysokosc, a plotno wpasowuje sie
 * w nia zachowujac proporcje.
 */
.preview-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
}
.preview-item {
  border: 1px solid var(--line); border-radius: 9px;
  overflow: hidden; background: #0e1013;
  display: flex; flex-direction: column;
}
.preview-item .shot {
  height: 132px;
  display: flex; align-items: center; justify-content: center;
  padding: 8px;
  background:
    linear-gradient(45deg, #15171b 25%, transparent 25%) 0 0/16px 16px,
    linear-gradient(-45deg, #15171b 25%, transparent 25%) 0 8px/16px 16px,
    linear-gradient(45deg, transparent 75%, #15171b 75%) 8px -8px/16px 16px,
    linear-gradient(-45deg, transparent 75%, #15171b 75%) -8px 0/16px 16px,
    #0e1013;
}
.preview-item .shot canvas { max-width: 100%; max-height: 100%; width: auto; height: auto; display: block; }
/*
 * Kolumnowy flex rozciaga dzieci na cala szerokosc, co powiekszalo miniature
 * 276 x 162 do ponad 500 px i robilo z niej rozmyty plakat. Miniatury maja
 * sie pokazywac w rozmiarze, w jakim zobaczy je gra.
 */
.preview-item { align-items: stretch; }
.preview-item canvas { display: block; max-width: 100%; height: auto; align-self: center; }
.preview-item .shot.is-natural { height: auto; padding: 14px; }
.preview-item .shot.is-natural canvas { width: auto; height: auto; image-rendering: auto; }
/* burta jest tak dluga, ze w jednej kolumnie bylaby paskiem - dostaje dwie */
.preview-item.is-wide { grid-column: span 2; }
@media (max-width: 720px) { .preview-item.is-wide { grid-column: span 1; } }
.preview-item .cap {
  padding: 7px 11px; font-size: 12px; color: var(--text-2);
  background: var(--panel); border-top: 1px solid var(--line);
  display: flex; align-items: center; gap: 8px;
}
.cap .dims { margin-left: auto; }

/* pasek postepu budowania */
.build-log {
  background: #0e1013; border: 1px solid var(--line); border-radius: 8px;
  padding: 12px 14px; font-size: 12.5px; line-height: 1.85;
  color: var(--text-2); max-height: 260px; overflow-y: auto;
  font-variant-numeric: tabular-nums;
}
.build-log .ok { color: var(--ok); }
.build-log .warn { color: var(--warn); }
.build-log .muted { color: var(--text-3); }
.bar { height: 7px; background: #23262c; border-radius: 4px; overflow: hidden; margin: 12px 0; }
.bar > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--brass-2), var(--brass-hi)); transition: width .2s; }

/* --- modal ---------------------------------------------------------- */

.modal-bg {
  position: fixed; inset: 0; background: rgba(8, 9, 11, .72);
  display: none; place-items: center; z-index: 200; padding: 24px;
  backdrop-filter: blur(2px);
}
.modal-bg.is-open { display: grid; }
.modal {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow);
  width: min(560px, 100%); max-height: 86vh; display: flex; flex-direction: column;
}
.modal-head {
  padding: 15px 18px; border-bottom: 1px solid var(--line);
  font-family: var(--font-head); font-size: 14px; letter-spacing: .8px;
  text-transform: uppercase; color: var(--brass-hi);
  display: flex; align-items: center; gap: 10px;
}
.modal-body { padding: 17px 18px; overflow-y: auto; font-size: 13.5px; line-height: 1.65; color: var(--text-2); }
.modal-foot { padding: 13px 18px; border-top: 1px solid var(--line); display: flex; gap: 9px; justify-content: flex-end; }

/* --- powiadomienia --------------------------------------------------- */

/* nad stopka aplikacji - komunikat nie zaslania numeru wersji */
.toasts { position: fixed; right: 16px; bottom: 54px; display: flex; flex-direction: column; gap: 8px; z-index: 300; }
.toast {
  background: var(--panel-2); border: 1px solid var(--line); border-left: 3px solid var(--brass);
  border-radius: 7px; padding: 10px 14px; font-size: 13px; box-shadow: var(--shadow);
  max-width: 340px; animation: toast-in .18s ease-out;
}
.toast.ok { border-left-color: var(--ok); }
.toast.err { border-left-color: var(--err); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* --- nota prawna ------------------------------------------------------ */

.legal {
  max-width: 1180px;
  width: calc(100% - 44px);
  margin: 36px auto 30px;
  padding: 18px 20px 20px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: #131519;
}
.legal h4 {
  margin: 0 0 9px;
  font-family: var(--font-head);
  font-size: 11.5px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-3);
}
.legal p {
  margin: 0 0 7px;
  font-size: 11.5px;
  line-height: 1.65;
  color: var(--text-3);
}
.legal p:last-child { margin-bottom: 0; }
.legal strong { color: var(--text-2); font-weight: 600; }
.legal a { color: var(--brass-2); text-decoration: none; }
.legal a:hover { text-decoration: underline; }

/* zwijanie noty: po zwinieciu zostaje pierwszy akapit, reszta chowa sie
   plynnie (grid 0fr -> 1fr animuje wysokosc bez znajomosci jej wartosci) */
.legal-glowka { display: flex; align-items: center; gap: 12px; margin-bottom: 9px; }
.legal-glowka h4 { margin: 0; flex: 1; }
.legal-przelacz {
  display: inline-flex; align-items: center; gap: 6px;
  flex: none;
  padding: 5px 10px 5px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: linear-gradient(180deg, #23262c, #1b1d22);
  color: var(--brass-2);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .03em;
  transition: border-color .15s, color .15s, transform .08s;
}
.legal-przelacz:hover { border-color: var(--brass-dim); color: var(--brass-hi); }
.legal-przelacz svg {
  width: 14px; height: 14px;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  transition: transform .25s ease;
}
.legal:not(.is-zwinieta) .legal-przelacz svg { transform: rotate(180deg); }
.legal-reszta {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows .35s ease, opacity .3s ease;
}
.legal-reszta-w { min-height: 0; overflow: hidden; padding-top: 7px; }
.legal.is-zwinieta .legal-reszta { grid-template-rows: 0fr; opacity: 0; }
.legal.is-zwinieta > p { margin-bottom: 0; }

/* pasek znakow - renderuje sie tylko, gdy pliki istnieja */

.legal-inline {
  font-size: 11px; line-height: 1.6; color: var(--text-3);
  border-top: 1px solid var(--line-soft); margin-top: 18px; padding-top: 12px;
}

/* --- stan autozapisu --------------------------------------------------- */

.save-state {
  font-size: 11.5px;
  color: var(--text-3);
  white-space: nowrap;
  padding-right: 4px;
  display: inline-flex; align-items: center; gap: 6px;
}
.save-state::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: var(--line); flex: none;
}
.save-state.is-saved::before { background: var(--ok); }
.save-state.is-saving::before { background: var(--warn); animation: pulse 1s infinite; }
.save-state.is-off::before { background: var(--err); }
.save-state.is-off { color: var(--err); }
@keyframes pulse { 50% { opacity: .3; } }

/* --- lista projektow w pamieci ----------------------------------------- */

.prj-list { display: grid; gap: 9px; }
.prj {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 10px;
  background: #16181c;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.prj.is-current { border-color: var(--brass-dim); background: #1c1f26; }
.prj img, .prj-nothumb {
  width: 92px; height: 34px; flex: none;
  object-fit: cover; border-radius: 4px;
  background: #0e1013; border: 1px solid var(--line);
}
.prj-main { flex: 1; min-width: 0; }
.prj-name {
  font-size: 13px; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.prj-when { font-size: 11px; color: var(--text-3); margin-top: 3px; }
.prj-acts { display: flex; gap: 6px; flex: none; }

/* --- ekran powitalny edytora ------------------------------------------- */

.stage-hint kbd {
  display: inline-block;
  padding: 1px 5px; margin: 0 1px;
  border: 1px solid var(--line); border-radius: 4px;
  background: #1c1f24; color: var(--text-2);
  font-family: inherit; font-size: 11px;
}

#icon-canvas, #thumb-canvas { max-width: 100%; height: auto; }
#icon-canvas { width: 512px; }
#thumb-canvas { width: 276px; }

/* --- glowne wezwanie do dzialania ------------------------------------- */

/*
 * Przycisk, ktory ma byc widoczny od wejscia. Pulsujaca poswiata i lekkie
 * powiekszenie przyciagaja wzrok, ale animacja znika przy najechaniu
 * (zeby nie uciekala spod kursora) i przy wlaczonym ograniczeniu ruchu
 * w systemie - migajace elementy potrafia byc problemem zdrowotnym,
 * a nie tylko kwestia gustu.
 */
.btn-cta {
  justify-content: center;     /* przy szerokosci 100% etykieta musi byc na srodku */
  padding: 12px 22px;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: .6px;
  text-transform: uppercase;
  transform-origin: center;
  animation: cta-pulse 2.6s ease-in-out infinite;
  will-change: transform, box-shadow;
}
@keyframes cta-pulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), 0 0 0 0 rgba(201, 162, 39, .5);
  }
  50% {
    transform: scale(1.045);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6), 0 0 26px 5px rgba(201, 162, 39, .55);
  }
}
.btn-cta:hover {
  animation: none;
  transform: scale(1.06);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6), 0 0 30px 6px rgba(201, 162, 39, .7);
}
.btn-cta:active { transform: scale(1.02); }

@media (prefers-reduced-motion: reduce) {
  .btn-cta { animation: none; }
  .btn-cta:hover { transform: none; }
}

/* --- akapit wstepny z wezwaniem do dzialania -------------------------- */

/*
 * Tekst i przycisk stoja obok siebie, a caly rzad ma dokladnie szerokosc
 * banera nad nim - to jeden uklad kontenerow, nie dwa niezalezne bloki.
 * Dlatego akapit nie ma tu wlasnego ograniczenia szerokosci: gdyby je
 * mial, rzad konczylby sie wczesniej niz baner i krawedzie by sie
 * rozjechaly.
 */
.lead-row {
  display: flex;
  align-items: stretch;
  gap: 26px;
  margin: 22px 0 18px;
}
/*
 * Kafel wprowadzajacy. Akapit bez oprawy gubil sie miedzy banerem
 * a kartami - dostaje wiec mosiezna krawedz, wlasny naglowek i powolny
 * polysk przesuwajacy sie po tle, ktory sugeruje metal, a nie migajacy
 * baner. Tekst wchodzi lagodnym przesunieciem, dwoma etapami.
 */
.lead-row .lead {
  flex: 1;
  min-width: 0;
  margin: 0;
  align-self: stretch;
  position: relative;
  overflow: hidden;
  padding: 20px 24px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--brass);
  border-radius: 12px;
  background: linear-gradient(135deg, #22262d 0%, #1a1d23 55%, #191c21 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04);
}

/* powolny polysk po powierzchni - imituje swiatlo na blasze */
.lead-row .lead::after {
  content: '';
  position: absolute;
  inset: -40% -60%;
  background: linear-gradient(105deg,
    transparent 40%,
    rgba(201, 162, 39, .10) 48%,
    rgba(240, 217, 138, .16) 50%,
    rgba(201, 162, 39, .10) 52%,
    transparent 60%);
  transform: translateX(-60%);
  animation: lead-sheen 7.5s ease-in-out infinite;
  pointer-events: none;
}
@keyframes lead-sheen {
  0%, 62% { transform: translateX(-60%); }
  88%, 100% { transform: translateX(60%); }
}

.lead-head {
  display: flex; align-items: center; gap: 9px;
  margin-bottom: 12px;
  font-family: var(--font-head);
  font-size: 11.5px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--brass-hi);
}
.lead-head svg {
  width: 19px; height: 19px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.6;
  stroke-linecap: round; stroke-linejoin: round;
}
.lead-head::after {
  content: ''; flex: 1; height: 1px;
  background: linear-gradient(90deg, var(--brass-dim), transparent);
}

.lead p {
  position: relative;
  z-index: 1;
  margin: 0 0 10px;
  font-size: 15px;
  line-height: 1.68;
  color: var(--text-2);
  animation: lead-in .5s cubic-bezier(.2, .7, .3, 1) both;
}
.lead p:last-child { margin-bottom: 0; animation-delay: .12s; }

@keyframes lead-in {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: none; }
}

/* podkreslenie kluczowych fraz - linia dojezdza po wejsciu tekstu */
.lead .mark {
  position: relative;
  color: var(--text);
  font-weight: 600;
  white-space: normal;
}
.lead .mark::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -2px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--brass), var(--brass-hi));
  transform: scaleX(0);
  transform-origin: left;
  animation: mark-draw .7s cubic-bezier(.2, .7, .3, 1) .45s both;
}
.lead p:last-child .mark::after { animation-delay: .72s; }

@keyframes mark-draw { to { transform: scaleX(1); } }

.lead code {
  padding: 1px 5px;
  border-radius: 4px;
  background: #101216;
  border: 1px solid var(--line);
  color: var(--brass-hi);
  font-size: .92em;
}

@media (prefers-reduced-motion: reduce) {
  .lead-row .lead::after { animation: none; opacity: 0; }
  .lead p { animation: none; }
  .lead .mark::after { animation: none; transform: scaleX(1); }
}

.lead-cta {
  flex: 0 0 310px;
  display: flex; flex-direction: column; align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, var(--panel), var(--bg-2));
  text-align: center;
}
.lead-cta .btn-cta { width: 100%; }
.lead-cta .hint { margin: 0; }

.lead-badge {
  width: 104px; height: 104px;
  flex: none;
  display: block;
  filter: drop-shadow(0 6px 18px rgba(0, 0, 0, .55));
}

@media (max-width: 900px) {
  .lead-cta { flex-basis: 260px; padding: 18px; }
  .lead-badge { width: 88px; height: 88px; }
}

@media (max-width: 720px) {
  .lead-row { flex-direction: column; gap: 18px; }
  .lead-cta { flex: none; width: 100%; }
}

/* ====================================================================
   RESPONSYWNOSC
   --------------------------------------------------------------------
   Cztery progi, kazdy rozwiazuje konkretny problem, a nie "zmniejszmy
   wszystko o 10%":

     1280  inspektor traci na szerokosci, plotno zyskuje
     1024  kroki pracy gubia podpisy, zostaja numery
      860  edytor przestaje byc trzykolumnowy - rail idzie w poziom,
           inspektor pod plotno
      560  jeden ekran = jedna kolumna, przyciski na cala szerokosc

   Na dotyku plotno musi miec touch-action: none, inaczej przeciagniecie
   warstwy przewija strone zamiast przesuwac obiekt.
   ==================================================================== */

#canvas { touch-action: none; }

@media (max-width: 1280px) {
  :root { --insp: 292px; }
  .form-wrap, .start-wrap, .hero, .legal { width: calc(100% - 32px); }
}

@media (max-width: 1024px) {
  .steps .step .step-pelna { display: none; }
  .steps .step { padding: 7px 9px; }
  .brand { padding-right: 10px; }
  .topbar { gap: 10px; }
  .cards { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
}

@media (max-width: 880px) {
  .brand-name { display: none; }
  .save-state { display: none; }
  .topbar-right .btn { padding: 6px 10px; font-size: 12px; }
}

/*
 * Ponizej 760 px podpisy przyciskow w pasku gornym przestaja sie miescic
 * i wychodza poza ekran - a wtedy sa nie tyle brzydkie, co nieklikalne.
 * Zostaja same ikony z podpowiedzia; pelne nazwy wracaja w oknie projektow.
 */
@media (max-width: 760px) {
  .topbar-right .btn-txt { display: none; }
  .topbar-right .btn { padding: 8px; }
  .topbar-right .btn-ico { width: 17px; height: 17px; }
}

/* --- edytor przestaje byc trzykolumnowy ------------------------------ */

@media (max-width: 860px) {
  .edit-body { flex-direction: column; }

  .rail {
    flex-direction: row;
    width: 100%; height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
    overflow-y: hidden;
    padding: 6px 4px;
    gap: 0;
    scrollbar-width: thin;
  }
  .tool { flex: none; min-width: 60px; margin: 0 3px; padding: 7px 2px; font-size: 10px; }
  .tool svg { width: 19px; height: 19px; }
  .rail-sep { width: 1px; height: auto; margin: 6px 5px; }

  .stage-wrap { min-height: 46vh; }
  .inspector {
    width: 100%;
    border-left: 0;
    border-top: 1px solid var(--line);
    max-height: 42vh;
  }

  .drawer { width: 100%; }

  .stage-bar { flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain; }
  .stage-bar > * { flex: none; }
  .stage-bar .grow, .stage-bar .dims { display: none; }

  .surface-tabs { padding: 5px 8px; }
  .stab { padding: 6px 10px; font-size: 12px; }
  .stab.is-active { padding-bottom: 12px; }
}

/* --- telefon --------------------------------------------------------- */

@media (max-width: 620px) {
  :root { --rail: 100%; }

  .topbar { height: 52px; padding: 0 10px; gap: 8px; }
  .brand { padding-right: 8px; }
  .brand-mark { width: 30px; height: 30px; }

  .form-wrap, .start-wrap, .hero, .legal { width: calc(100% - 20px); }
  .form-grid, .cards { grid-template-columns: 1fr; }
  .preview-strip { grid-template-columns: 1fr; }
  .preview-item.is-wide { grid-column: span 1; }

  .lead p { font-size: 14px; }
  .lead-row .lead { padding: 16px 16px; }
  .section-title { font-size: 13.5px; margin: 24px 0 12px; }

  .hero-cta { position: static; padding: 0 12px 14px; flex-direction: column; }
  .hero-cta .btn { width: 100%; justify-content: center; }
  .hero-fade { display: none; }

  .modal { max-height: 92vh; }
  .modal-foot { flex-wrap: wrap; }
  .modal-foot .btn { flex: 1; justify-content: center; }

  .prj { flex-wrap: wrap; }
  .prj-acts { width: 100%; }
  .prj-acts .btn { flex: 1; justify-content: center; }

  .fld-row { flex-direction: column; gap: 0; }
  .fld-row > * { margin-bottom: 13px; }

  .toasts { left: 12px; right: 12px; }
  .toast { max-width: none; }

  .inspector { max-height: 46vh; }
  .row label, .fld-label { width: 76px; font-size: 11.5px; }
}

@media (max-width: 420px) {
  .topbar-right .btn { padding: 6px 8px; }
  .tool { min-width: 54px; }
  .lead-cta { padding: 16px 12px; }
}

/* --- ekrany bardzo szerokie ------------------------------------------ */

@media (min-width: 1700px) {
  :root { --insp: 348px; }
  .form-wrap, .start-wrap, .hero, .legal { max-width: 1360px; }
}

/* --- urzadzenia dotykowe --------------------------------------------- */

/*
 * Na dotyku nie ma najechania kursorem, wiec uchwyty i przyciski musza
 * byc od razu dostatecznie duze. 44 px to prog, ponizej ktorego trafienie
 * palcem zaczyna byc loteria.
 */
@media (pointer: coarse) {
  .btn { padding: 10px 16px; }
  .btn-sm { padding: 8px 12px; }
  .layer { padding: 9px 7px; }
  .layer-btn { padding: 6px; }
  .tool { padding: 10px 2px; }
  input[type=text], input[type=number], select, textarea { padding: 9px 10px; }
  input[type=range] { height: 30px; }
  .stab { padding: 9px 13px; }
}

/* --- druk / eksport ekranu ------------------------------------------- */

@media print {
  .topbar, .rail, .inspector, .stage-bar, .drawer, .toasts { display: none !important; }
}

/* --- wyrozniona podpowiedz ------------------------------------------- */

.hint-box {
  margin-top: 14px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--warn);
  border-radius: 8px;
  background: #16181c;
}
.hint-box strong { color: var(--text); }

/* ====================================================================
   PASEK PROJEKTU
   --------------------------------------------------------------------
   Trzy grupy oddzielone kreskami: dzialania na projekcie, na zaznaczeniu
   i czyszczenie. Podzial nie jest ozdoba - przycisk "Usun" wystepuje
   w dwoch znaczeniach (usun projekt, usun warstwe) i bez rozdzielenia
   grup latwo kliknac nie ten.
   ==================================================================== */

.toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: none;
  padding: 6px 10px;
  background: linear-gradient(180deg, #1f2228, #1a1d22);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
}
.toolbar::-webkit-scrollbar { height: 6px; }
.toolbar::-webkit-scrollbar-thumb { background: #363b44; border-radius: 3px; }

.tb-group { display: flex; align-items: center; gap: 2px; flex: none; }

.tb {
  display: inline-flex; align-items: center; gap: 7px;
  flex: none;
  padding: 7px 11px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: none;
  color: var(--text-2);
  font-size: 12.5px;
  white-space: nowrap;
  transition: background .12s, color .12s, border-color .12s;
}
.tb svg {
  width: 16px; height: 16px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round;
}
.tb:hover { background: var(--panel-2); color: var(--text); border-color: var(--line); }
.tb:active { transform: translateY(1px); }
.tb:disabled { opacity: .35; cursor: not-allowed; }
.tb:disabled:hover { background: none; border-color: transparent; color: var(--text-2); }
.tb-danger:hover { border-color: #6d3330; color: #ff9b97; background: rgba(109, 51, 48, .16); }

.tb-sep { width: 1px; height: 22px; background: var(--line); margin: 0 7px; flex: none; }
.tb-grow { flex: 1; min-width: 10px; }

.tb-name {
  flex: none;
  max-width: 260px;
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #16181c;
  color: var(--text-2);
  font-size: 12px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tb-name::before {
  content: '';
  display: inline-block;
  width: 6px; height: 6px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--brass);
  vertical-align: 1px;
}

/* ponizej 1720 px zostaja same ikony - pelne podpisy potrzebuja ok. 1670 px */
@media (max-width: 1720px) {
  .tb span { display: none; }
  .tb { padding: 8px; }
  .tb svg { width: 17px; height: 17px; }
  .tb-sep { margin: 0 5px; }
}
@media (max-width: 620px) {
  .toolbar { padding: 5px 8px; }
  .tb-name { display: none; }
}


/* ====================================================================
   OKNO PODGLADU 3D
   Plywajace okienko nad edytorem: da sie je przesunac za pasek tytulu,
   zmienic mu rozmiar za prawy dolny rog, rozwinac na pelny ekran
   i zamknac. Edytor pod spodem dziala dalej, wiec kazda zmiana
   na plotnie od razu widac na bryle.
   ==================================================================== */

.pv-okno {
  position: fixed;
  z-index: 60;
  left: calc(100vw - 880px - 24px);
  top: 96px;
  width: 880px;
  height: 560px;
  min-width: 360px;
  min-height: 300px;
  max-width: calc(100vw - 16px);
  max-height: calc(100dvh - 16px);
  display: flex;
  flex-direction: column;
  border: 1px solid #3b4049;
  border-radius: 12px;
  background: #0f1115;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .6), 0 0 0 1px rgba(201, 162, 39, .10);
  overflow: hidden;
  container-type: inline-size;
  container-name: podglad;
}
/* animacja tylko przy otwarciu - nie przy powrocie z pelnego ekranu */
.pv-okno.is-wejscie { animation: pv-wejscie .18s ease-out; }
@keyframes pv-wejscie {
  from { opacity: 0; transform: translateY(10px) scale(.985); }
  to { opacity: 1; transform: none; }
}

.pv-glowka {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  padding: 0 6px 0 12px;
  flex: none;
  background: linear-gradient(180deg, #262a31, #1d2026);
  border-bottom: 1px solid var(--line);
  cursor: grab;
  user-select: none;
  touch-action: none;
}
.pv-okno.is-ciagniete .pv-glowka { cursor: grabbing; }
.pv-glowka > svg {
  width: 18px; height: 18px; flex: none;
  fill: none; stroke: var(--brass); stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round;
}
.pv-tytul {
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text);
  white-space: nowrap;
}
.pv-znacznik {
  padding: 2px 7px;
  border: 1px solid var(--brass-dim);
  border-radius: 999px;
  color: var(--brass-hi);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
}
.pv-glowka .grow { flex: 1; }

.pv-okno-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 32px;
  flex: none;
  border: 1px solid transparent;
  border-radius: 7px;
  background: none;
  color: var(--text-2);
}
.pv-okno-btn svg {
  width: 17px; height: 17px;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.pv-okno-btn:hover { background: var(--panel-2); color: var(--text); border-color: var(--line); }
.pv-okno-btn.is-on { color: var(--brass-hi); border-color: var(--brass-dim); background: #2a2a24; }
.pv-okno-zamknij:hover { background: #4a1d20; border-color: #7b2a2f; color: #ffd9d9; }

.pv-cialo {
  position: relative;
  flex: 1;
  min-height: 0;
  background: #101216;
}
.pv-cialo canvas { position: absolute; left: 0; top: 0; display: block; touch-action: none; }

.pv-ladowanie {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  color: var(--text-2);
  font-size: 13px;
  background: #101216;
}
.pv-ladowanie i {
  width: 30px; height: 30px;
  border: 3px solid var(--line);
  border-top-color: var(--brass);
  border-radius: 50%;
  animation: pv-krec .8s linear infinite;
}
@keyframes pv-krec { to { transform: rotate(360deg); } }

.pv-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
  padding: 8px 10px;
  border-top: 1px solid var(--line);
  background: #181a1f;
  overflow-x: auto;
  scrollbar-width: none;
}
.pv-bar::-webkit-scrollbar { display: none; }

.pv-views { display: flex; gap: 2px; flex: none; }
.pv-views button {
  padding: 6px 11px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: none;
  color: var(--text-2);
  font-size: 12px;
  white-space: nowrap;
}
.pv-views button:hover { background: var(--panel-2); color: var(--text); }
.pv-views button.is-active {
  background: linear-gradient(180deg, #34373e, #292c33);
  border-color: var(--brass-dim);
  color: var(--brass-hi);
}

.pv-btn {
  display: inline-flex; align-items: center; gap: 6px;
  flex: none;
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #121418;
  color: var(--text-2);
  font-size: 12px;
  white-space: nowrap;
}
.pv-btn svg {
  width: 15px; height: 15px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.pv-btn:hover { color: var(--text); border-color: #4a515c; }
.pv-btn.is-on {
  background: linear-gradient(180deg, #3a3d45, #2e323a);
  border-color: var(--brass-dim);
  color: var(--brass-hi);
}

.pv-sep { width: 1px; height: 20px; background: var(--line); margin: 0 4px; flex: none; }
.pv-grow { flex: 1; min-width: 4px; }
.pv-hint { font-size: 11.5px; color: var(--text-3); white-space: nowrap; flex: none; }

.pv-autorzy {
  position: absolute;
  right: 10px; bottom: 8px;
  max-width: calc(100% - 20px);
  font-size: 10.5px;
  line-height: 1.4;
  color: rgba(167, 173, 183, .62);
  text-align: right;
  pointer-events: auto;
}
.pv-autorzy a { color: inherit; }
.pv-autorzy a:hover { color: var(--text-2); }

/* uchwyt zmiany rozmiaru w prawym dolnym rogu */
.pv-uchwyt {
  position: absolute;
  right: 0; bottom: 0;
  width: 18px; height: 18px;
  cursor: nwse-resize;
  touch-action: none;
  z-index: 2;
  background:
    linear-gradient(135deg, transparent 50%, rgba(201, 162, 39, .55) 50%, rgba(201, 162, 39, .55) 58%,
      transparent 58%, transparent 70%, rgba(201, 162, 39, .55) 70%, rgba(201, 162, 39, .55) 78%, transparent 78%);
}

/* pelny ekran: API przegladarki albo - gdy go brak - okno na cala strone */
.pv-okno:fullscreen,
.pv-okno.is-max {
  left: 0 !important; top: 0 !important;
  width: 100vw !important; height: 100dvh !important;
  max-width: none; max-height: none;
  border: 0; border-radius: 0;
}
.pv-okno:fullscreen .pv-uchwyt,
.pv-okno.is-max .pv-uchwyt { display: none; }
.pv-okno:fullscreen .pv-glowka,
.pv-okno.is-max .pv-glowka { cursor: var(--kursor); }

/* przycisk w pasku gornym i w railu, gdy okno jest otwarte */
.tool.is-on { color: var(--brass-hi); }
.tool.is-on svg { stroke: var(--brass-hi); }
#btn-podglad.is-on { color: var(--brass-hi); border-color: var(--brass-dim); }

/* waskie okno podgladu: najpierw znika podpowiedz, potem podpisy */
@container podglad (max-width: 980px) {
  .pv-hint { display: none; }
}
.pv-okno.is-waskie .pv-btn span { display: none; }
.pv-okno.is-waskie .pv-btn { padding: 7px; }
.pv-okno.is-waskie .pv-views button { padding: 6px 8px; }
.pv-okno.is-waskie .pv-autorzy { display: none; }

/* telefon i maly tablet: okno zajmuje caly ekran jak arkusz */
@media (max-width: 760px), (max-height: 520px) {
  .pv-okno {
    left: 0 !important; top: 0 !important;
    width: 100vw !important; height: 100dvh !important;
    max-width: none; max-height: none;
    border: 0; border-radius: 0;
  }
  .pv-glowka { cursor: var(--kursor); }
  .pv-uchwyt { display: none; }
  .pv-btn span { display: none; }
  .pv-btn { padding: 8px; }
  .pv-views button { padding: 7px 9px; }
}

@media (prefers-reduced-motion: reduce) {
  .pv-okno.is-wejscie { animation: none; }
  .pv-ladowanie i { animation-duration: 2.4s; }
}

/* --- arkusz widokow 2D -------------------------------------------- */

.pv-arkusz-tlo, .pv-arkusz-opisy { position: absolute; inset: 0; pointer-events: none; }
.pv-arkusz-tlo { background: #1b1d21; }
.pv-arkusz-opisy { z-index: 1; }
#preview3d-canvas { z-index: 0; }
.pv-okno #preview-canvas { z-index: 2; }

.pv-kafel {
  position: absolute;
  overflow: hidden;
  background: radial-gradient(ellipse 80% 90% at 50% 38%, #54585f 0%, #3c3f45 58%, #2e3136 100%);
}
.pv-kafel.is-hero {
  background: radial-gradient(ellipse 70% 95% at 50% 42%, #6d7178 0%, #50535a 55%, #3a3d42 100%);
}
.pv-kafel.is-uv { background: #17191d; }
/* miekki cien pod kolami - jak na zdjeciu studyjnym */
.pv-cien {
  position: absolute;
  height: 10px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, .55) 0%, rgba(0, 0, 0, 0) 70%);
}
.pv-podpis {
  position: absolute;
  height: 24px;
  line-height: 24px;
  text-align: center;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #cfd3d9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ====================================================================
   ANIMACJA LOGO: przyblizenie, zamiana w kolo, ruszenie z miejsca
   ==================================================================== */

.logo-scena { position: fixed; inset: 0; z-index: 200; pointer-events: none; overflow: hidden; }
.logo-kolo { position: absolute; transform-origin: 50% 50%; will-change: transform; }
.logo-kolo img {
  position: relative; z-index: 1;
  display: block; width: 100%; height: 100%;
  border-radius: 8px;
  transition: border-radius .6s ease, transform .6s ease;
}
.logo-kolo.is-opona img { border-radius: 50%; transform: scale(.72); }

/* opona z bieznikiem: pierscien wyciety maska z paskow kolowych */
.logo-opona {
  position: absolute; inset: -16%;
  border-radius: 50%;
  opacity: 0;
  transform: scale(.55);
  transition: opacity .55s ease, transform .6s cubic-bezier(.3, 1.45, .5, 1);
  background:
    radial-gradient(circle, transparent 56%, rgba(255, 255, 255, .10) 57%, transparent 60%,
      transparent 86%, rgba(0, 0, 0, .55) 100%),
    repeating-conic-gradient(#17181b 0deg 6deg, #2d2f34 6deg 9deg, #17181b 9deg 15deg);
  -webkit-mask: radial-gradient(circle, transparent 55%, #000 56%);
  mask: radial-gradient(circle, transparent 55%, #000 56%);
}
.logo-kolo.is-opona .logo-opona { opacity: 1; transform: none; }

/* mosiezna felga miedzy opona a logo */
.logo-felga {
  position: absolute; inset: 11%;
  z-index: 2;
  border-radius: 50%;
  border: 2px solid transparent;
  transition: border-color .5s ease .15s, box-shadow .5s ease .15s;
}
.logo-kolo.is-opona .logo-felga {
  border-color: var(--brass);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .65), inset 0 0 0 1px rgba(0, 0, 0, .5), 0 0 14px rgba(201, 162, 39, .35);
}

/* ====================================================================
   TLA GRADIENTOWE I KURSOR
   Strona i edytor dostaja glebie: cieply mosiadz z lewej u gory,
   bordo z prawej, chlodny granat u dolu - jak swiatlo w salonie
   ciezarowek. Obszar roboczy (plotno) zostaje ciemny i spokojny.
   ==================================================================== */

input[type=text], input[type=number], input[type=search], input[type=email],
input:not([type]), textarea, [contenteditable="true"] { cursor: text; }
input[type=range] { cursor: var(--kursor-klik); }

.topbar {
  background:
    linear-gradient(90deg, rgba(123, 21, 32, .28), transparent 38%, transparent 70%, rgba(201, 162, 39, .10)),
    linear-gradient(180deg, #262a31, #1a1d22);
}
.toolbar { background: linear-gradient(180deg, rgba(34, 37, 43, .96), rgba(27, 30, 35, .96)); }

.rail {
  background: linear-gradient(180deg, #23262c 0%, #1b1e23 55%, #17191d 100%);
}
.inspector {
  background: linear-gradient(180deg, #22252b 0%, #1c1f24 40%, #181a1f 100%);
}
.surface-tabs, .stage-bar {
  background: linear-gradient(180deg, #202329, #1b1e23);
}
.stage-wrap {
  background: radial-gradient(ellipse 90% 70% at 50% 42%, #1c2026 0%, #121418 62%, #0d0f12 100%);
}
.stab.is-active { background: #16191e; border-bottom-color: #16191e; }
.stage {
  background:
    radial-gradient(ellipse 75% 65% at 50% 45%, rgba(201, 162, 39, .07), transparent 70%),
    linear-gradient(45deg, rgba(0, 0, 0, .22) 25%, transparent 25%) 0 0/22px 22px,
    linear-gradient(-45deg, rgba(0, 0, 0, .22) 25%, transparent 25%) 0 11px/22px 22px,
    linear-gradient(45deg, transparent 75%, rgba(0, 0, 0, .22) 75%) 11px -11px/22px 22px,
    linear-gradient(-45deg, transparent 75%, rgba(0, 0, 0, .22) 75%) -11px 0/22px 22px,
    radial-gradient(ellipse at 50% 40%, #1a1d22, #111317 75%);
}

/* ====================================================================
   KROKI NA TELEFONIE
   Na waskim ekranie kroki schodza pod pasek gorny jako pelna linia
   postepu: numer w kolku, pod nim podpis, miedzy krokami kreska, ktora
   wypelnia sie zielenia za ukonczonymi etapami.
   ==================================================================== */

@media (max-width: 760px) {
  .topbar { height: auto; flex-wrap: wrap; row-gap: 0; padding-top: 6px; }
  .topbar .brand, .topbar .topbar-right { height: 44px; }
  .steps {
    order: 3;
    flex: 0 0 calc(100% + 20px);
    margin: 0 -10px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    padding: 8px 6px 7px;
    border-top: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(0, 0, 0, .18), rgba(0, 0, 0, .05));
    overflow: visible;
  }
  .steps .step {
    position: relative;
    flex-direction: column;
    gap: 4px;
    padding: 2px 2px 3px;
    border: 0;
    border-radius: 8px;
    background: none;
    min-width: 0;
  }
  .steps .step.is-active { background: none; }
  .steps .step .step-krotka {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: .02em;
    color: var(--text-3);
  }
  .steps .step.is-active .step-krotka { color: var(--brass-hi); }
  .steps .step.is-done .step-krotka { color: var(--text-2); }
  .steps .step .step-pelna { display: none; }
  .steps .step-num {
    position: relative; z-index: 1;
    width: 26px; height: 26px;
    font-size: 12px;
    box-shadow: 0 0 0 3px #1c1f24;
  }
  .steps .step.is-active .step-num { box-shadow: 0 0 0 3px #1c1f24, 0 0 0 5px rgba(201, 162, 39, .45); }
  /* kreska do nastepnego kroku */
  .steps .step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 15px;
    left: calc(50% + 17px);
    right: calc(-50% + 17px);
    height: 2px;
    border-radius: 2px;
    background: var(--line);
  }
  .steps .step.is-done:not(:last-child)::after { background: var(--ok); }
}

/* ====================================================================
   PRZYCISKI - wykonczenie w duchu cssbuttons.io
   Polysk przejezdzajacy po najechaniu i "wcisniecie" z grubym cieniem
   od spodu, jak fizyczny klawisz. Wlasny kod, w kolorach konfiguratora.
   ==================================================================== */

.btn {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  box-shadow: 0 2px 0 rgba(0, 0, 0, .38), inset 0 1px 0 rgba(255, 255, 255, .06);
  transition: border-color .15s, background .15s, transform .08s, box-shadow .08s;
}
.btn::before {
  content: '';
  position: absolute; inset: 0;
  z-index: -1;
  background: linear-gradient(115deg, transparent 32%, rgba(255, 255, 255, .16) 48%, rgba(255, 255, 255, .04) 56%, transparent 70%);
  transform: translateX(-130%);
  transition: transform .65s cubic-bezier(.2, .7, .2, 1);
  pointer-events: none;
}
.btn:hover::before { transform: translateX(130%); }
.btn:active { transform: translateY(2px); box-shadow: 0 0 0 rgba(0, 0, 0, .38), inset 0 1px 0 rgba(255, 255, 255, .04); }
.btn:disabled::before { display: none; }
.btn:disabled:active { transform: none; }

.btn-primary {
  box-shadow: 0 3px 0 #6b5518, 0 7px 16px rgba(201, 162, 39, .22), inset 0 1px 0 rgba(255, 255, 255, .5);
}
.btn-primary::before {
  background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, .55) 47%, rgba(255, 255, 255, .15) 55%, transparent 68%);
}
.btn-primary:hover { box-shadow: 0 3px 0 #6b5518, 0 9px 22px rgba(201, 162, 39, .32), inset 0 1px 0 rgba(255, 255, 255, .55); }
.btn-primary:active {
  transform: translateY(3px);
  box-shadow: 0 0 0 #6b5518, 0 3px 8px rgba(201, 162, 39, .2), inset 0 1px 0 rgba(255, 255, 255, .35);
}

.btn-ghost { box-shadow: none; }
.btn-ghost:active { box-shadow: none; transform: translateY(1px); }
.btn-ghost::before { background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, .07) 50%, transparent 65%); }

.tb:active, .pv-btn:active, .pv-okno-btn:active, .tool:active, .stab:active, .step:active {
  transform: translateY(1px);
}
.tb, .pv-btn, .pv-okno-btn, .tool { transition: background .15s, color .15s, border-color .15s, transform .08s; }

@media (prefers-reduced-motion: reduce) {
  .btn::before { display: none; }
}

/* ====================================================================
   STOPKA APLIKACJI
   Czesc ukladu kolumnowego #app (topbar - widok - stopka), wiec zadne
   panele edytora jej nie przykrywaja, a numer wersji jest zawsze widoczny.
   ==================================================================== */

.app-stopka {
  flex: none;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 38px;
  padding: 4px 12px;
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, #1b1e23, #15171b);
  font-size: 11.5px;
  color: var(--text-3);
  position: relative;
  z-index: 5;
}
.stopka-tworca {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
}
.stopka-tworca strong { color: var(--text-2); font-weight: 600; }
.stopka-romb { color: var(--brass); font-size: 10px; }
.stopka-prawa { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.stopka-rok { display: none; }
.stopka-linki { display: inline-flex; align-items: center; gap: 6px; flex: none; }
.stopka-linki i { font-style: normal; opacity: .6; }
.stopka-tworca a, .stopka-link {
  color: var(--brass-2);
  text-decoration: none;
  background: none;
  border: 0;
  padding: 0;
  font-size: inherit;
}
.stopka-tworca a:hover, .stopka-link:hover { color: var(--brass-hi); text-decoration: underline; }

.stopka-akcje { display: flex; align-items: center; gap: 8px; flex: none; }
.stopka-wersja {
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #121418;
  color: var(--text-2);
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: .04em;
}

/* przyciski funkcyjne - animowane, ale spokojne: ruch przyciaga oko,
   nie odciaga od pracy */
.btn-akcja {
  position: relative;
  display: inline-flex; align-items: center; gap: 7px;
  height: 28px;
  padding: 0 12px 0 9px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  isolation: isolate;
  transition: transform .12s, box-shadow .2s, filter .2s;
}
.btn-akcja svg {
  width: 17px; height: 17px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}
.btn-akcja small { font-weight: 500; opacity: .75; margin-left: 2px; }
.btn-akcja:hover { transform: translateY(-1px); filter: brightness(1.08); }
.btn-akcja:active { transform: translateY(1px); }

/* Install App: przelewajacy sie gradient i strzalka "wpadajaca" do ekranu */
.btn-instaluj {
  color: #eaf3ff;
  border-color: rgba(120, 180, 255, .45);
  background: linear-gradient(110deg, #1d4f91, #2c7be5, #1d4f91, #2c7be5);
  background-size: 300% 100%;
  animation: instaluj-tlo 6s linear infinite;
}
.btn-instaluj:hover { box-shadow: 0 0 14px rgba(44, 123, 229, .55); }
.btn-instaluj .ico-strzalka { animation: instaluj-strzalka 1.6s ease-in-out infinite; }
@keyframes instaluj-tlo { to { background-position: -300% 0; } }
@keyframes instaluj-strzalka {
  0%, 100% { transform: translateY(-1.5px); }
  50% { transform: translateY(1.5px); }
}
.btn-instaluj.is-zainstalowana { animation: none; background: #1b3b62; }
.btn-instaluj.is-zainstalowana .ico-strzalka { animation: none; }

/* Buy us a Coffee: mosiadz z unoszaca sie para nad filizanka */
.btn-kawa {
  color: #2a1a05;
  border-color: #9a7a24;
  background: linear-gradient(180deg, #f6dc8c, #d8a93a 60%, #b8862a);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5);
}
.btn-kawa:hover { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5), 0 0 14px rgba(216, 169, 58, .55); }
.btn-kawa .para, .kawa-okno .para { animation: kawa-para 2.4s ease-in-out infinite; opacity: 0; }
.btn-kawa .para-2, .kawa-okno .para-2 { animation-delay: .8s; }
.btn-kawa .para-3, .kawa-okno .para-3 { animation-delay: 1.6s; }
@keyframes kawa-para {
  0% { opacity: 0; transform: translateY(3px); }
  35% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-3px); }
}
.btn-kawa:hover svg { animation: kawa-kolys .6s ease-in-out; }
@keyframes kawa-kolys {
  0%, 100% { transform: rotate(0); }
  30% { transform: rotate(-9deg); }
  65% { transform: rotate(6deg); }
}

/* okienko kawy */
.kawa-okno { text-align: center; }
.kawa-okno svg {
  width: 72px; height: 72px; margin: 4px auto 10px; display: block;
  fill: none; stroke: var(--brass); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round;
}
.kawa-okno p { margin: 0 0 10px; line-height: 1.6; color: var(--text-2); }
.kawa-okno .kawa-adres { font-size: 12px; color: var(--text-3); }

/* teksty prawne w oknie */
.dok-prawny { max-height: 60vh; overflow-y: auto; padding-right: 6px; font-size: 13px; line-height: 1.65; color: var(--text-2); }
.dok-prawny h4 { margin: 14px 0 4px; font-size: 13px; color: var(--text); }
.dok-prawny p, .dok-prawny ul { margin: 0 0 8px; }
.dok-prawny ul { padding-left: 18px; }
.dok-prawny .dok-data { font-size: 11.5px; color: var(--text-3); }

@media (max-width: 1100px) {
  .stopka-prawa { display: none; }
  .stopka-rok { display: inline; }
}
@media (max-width: 860px) {
  .stopka-mail, .stopka-mail-sep { display: none; }
  .btn-akcja small { display: none; }
}
@media (max-width: 620px) {
  .app-stopka { gap: 8px; padding: 4px 8px; font-size: 11px; }
  .btn-akcja { padding: 0 8px; }
  .btn-akcja .akcja-tekst { display: none; }
  .stopka-linki { gap: 4px; }
}
@media (max-width: 380px) {
  .stopka-tworca strong { overflow: hidden; text-overflow: ellipsis; }
  .stopka-rok { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .btn-instaluj, .btn-instaluj .ico-strzalka, .btn-kawa .para, .kawa-okno .para { animation: none; }
  .btn-kawa .para, .kawa-okno .para { opacity: 1; }
}

/* Paski przewijane w poziomie: zakladki mialy 1 px przepelnienia w pionie
   (aktywna zakladka zachodzi na scene), co rysowalo pasek przewijania. Na
   dotyku paski przewija sie palcem, wiec suwak tylko zaslania tresc. */
.surface-tabs { overflow-y: hidden; }
@media (max-width: 760px), (pointer: coarse) {
  .toolbar, .surface-tabs, .rail, .stage-bar { scrollbar-width: none; }
  .toolbar::-webkit-scrollbar, .surface-tabs::-webkit-scrollbar,
  .rail::-webkit-scrollbar, .stage-bar::-webkit-scrollbar { display: none; }
}

/* ====================================================================
   KONTRAST I POWIEKSZENIE PRZYCISKOW
   ==================================================================== */

/* Przycisk ostrzegawczy w oknie potwierdzenia ("Przywroc domyslne",
   "Usun") byl jednoczesnie glowny: jasnoczerwony napis na jasnym
   mosiadzu po najechaniu mial kontrast ok. 1,6:1. Teraz to pelny
   czerwony przycisk z bialym napisem (5,9:1, po najechaniu 7,4:1). */
.btn-primary.btn-danger {
  border-color: #7a1f1c;
  background: linear-gradient(180deg, #c9433d, #a8302b 55%, #8e2622);
  color: #ffffff;
  box-shadow: 0 3px 0 #5e1714, 0 7px 16px rgba(201, 67, 61, .25), inset 0 1px 0 rgba(255, 255, 255, .28);
}
.btn-primary.btn-danger:hover {
  border-color: #6a1a17;
  background: linear-gradient(180deg, #b83731, #962823 55%, #7c1f1b);
  color: #ffffff;
  box-shadow: 0 3px 0 #5e1714, 0 9px 22px rgba(201, 67, 61, .35), inset 0 1px 0 rgba(255, 255, 255, .28);
}
.btn-primary.btn-danger:active { box-shadow: 0 0 0 #5e1714, inset 0 1px 0 rgba(255, 255, 255, .2); }
.btn-primary.btn-danger::before {
  background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, .28) 47%, transparent 66%);
}

/* Install App: bialy napis na jasnym niebieskim mial 4,1:1 - ciemniejszy gradient daje 5,6:1 */
.btn-instaluj { background: linear-gradient(110deg, #173f75, #2261b8, #173f75, #2261b8); background-size: 300% 100%; }

/* Kazdy przycisk lekko sie przybliza po najechaniu kursorem. */
button:not(:disabled), .btn, .brand {
  transition-property: transform, background, color, border-color, box-shadow, filter;
  transition-duration: .16s;
  transition-timing-function: cubic-bezier(.3, .7, .3, 1.3);
}
button:not(:disabled):not(.btn-cta):hover { transform: scale(1.06); }
button:not(:disabled):not(.btn-cta):active { transform: scale(1.02) translateY(1px); }
/* male przyciski ikon w gestych paskach - mniejszy skok, zeby nie wchodzily na sasiadow */
.tb:not(:disabled):hover, .pv-views button:hover, .seg button:hover, .layer-btn:hover { transform: scale(1.1); }
.stab:hover, .step:hover { transform: scale(1.04); }
@media (prefers-reduced-motion: reduce) {
  button:not(:disabled), .btn { transition-duration: 0s; }
}

/* Ikony Phosphor (phosphoricons.com, MIT) to wypelnione sciezki, a nie
   kontury - reguly "fill: none; stroke: currentColor" dla ikon rysowanych
   linia zrobilyby z nich puste obrysy. */
svg.ph { fill: currentColor !important; stroke: none !important; }

/* ====================================================================
   STRONA GLOWNA: NAGLOWEK H1 I NAJCZESTSZE PYTANIA
   H1 mowi wyszukiwarce i asystentom AI jednym zdaniem, czym jest
   strona; FAQ odpowiada na pytania, ktore ludzie faktycznie wpisuja.
   ==================================================================== */

.start-naglowek { margin: 26px 0 18px; }
.start-naglowek h1 {
  margin: 0 0 6px;
  font-family: var(--font-head);
  font-size: clamp(22px, 2.6vw, 30px);
  font-weight: 600;
  letter-spacing: .02em;
  line-height: 1.2;
  background: linear-gradient(180deg, #f6e6ae, var(--brass) 65%, #9c7b24);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.start-naglowek p { margin: 0; max-width: 860px; font-size: 15px; line-height: 1.6; color: var(--text-2); }
.start-naglowek code, .faq code {
  padding: 1px 6px; border-radius: 4px; background: #0f1114; border: 1px solid var(--line);
  font-size: .9em; color: var(--brass-hi);
}

.faq { margin-top: 8px; }
.faq details {
  margin-bottom: 8px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: linear-gradient(180deg, rgba(39, 43, 50, .7), rgba(28, 31, 36, .7));
  overflow: hidden;
}
.faq details[open] { border-color: var(--brass-dim); }
.faq summary {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 16px;
  list-style: none;
  font-weight: 600;
  color: var(--text);
  cursor: var(--kursor-klik);
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before {
  content: '';
  width: 8px; height: 8px; flex: none;
  border-right: 2px solid var(--brass); border-bottom: 2px solid var(--brass);
  transform: rotate(-45deg);
  transition: transform .2s ease;
}
.faq details[open] summary::before { transform: rotate(45deg); }
.faq summary:hover { color: var(--brass-hi); }
.faq details p { margin: 0; padding: 0 16px 14px 34px; line-height: 1.65; color: var(--text-2); }
.faq details a { color: var(--brass-2); }

.bez-js { margin: 20px; padding: 16px; border: 1px solid var(--line); border-radius: 8px; color: var(--text-2); }


/* ====================================================================
   GOTOWE ZESTAWIENIA KOLOROW
   Karta = miniatura burty w kolorach zestawu (nadwozie, dwa pasy
   akcentu, probka napisu) + nazwa i trzy probki. Wybrany zestaw ma
   mosiezna ramke i znacznik.
   ==================================================================== */

.palety-glowka { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.palety-glowka label { margin: 0; }
.palety-glowka .hint { margin: 0; font-size: 11.5px; }

.paleta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 10px;
}

.paleta {
  display: flex;
  flex-direction: column;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(180deg, #1f2227, #181a1f);
  color: var(--text-2);
  text-align: left;
  overflow: hidden;
  box-shadow: 0 2px 0 rgba(0, 0, 0, .35);
}
.paleta:hover {
  border-color: var(--brass-dim);
  color: var(--text);
  box-shadow: 0 8px 20px rgba(0, 0, 0, .45), 0 0 0 1px rgba(201, 162, 39, .25);
}
.paleta:focus-visible { outline: 2px solid var(--sel); outline-offset: 2px; }

/* miniatura burty: nadwozie z polyskiem, dwa ukosne pasy akcentu, napis */
.paleta-burta {
  position: relative;
  display: block;
  height: 58px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .16), rgba(255, 255, 255, 0) 45%, rgba(0, 0, 0, .18)),
    var(--p-baza);
  border-bottom: 1px solid rgba(0, 0, 0, .35);
  overflow: hidden;
}
.paleta-pas {
  position: absolute;
  left: -20%;
  top: 56%;
  width: 90%;
  height: 11px;
  background: var(--p-akcent);
  transform: skewX(-32deg);
  box-shadow: 0 1px 0 rgba(0, 0, 0, .25);
}
.paleta-pas-2 { top: 76%; height: 5px; width: 75%; opacity: .85; }
.paleta-napis {
  position: absolute;
  right: 10px;
  top: 8px;
  font-family: var(--font-head);
  font-size: 22px;
  font-weight: 600;
  line-height: 1;
  color: var(--p-napis);
  text-shadow: 0 1px 2px rgba(0, 0, 0, .35);
}
.paleta-znak {
  position: absolute;
  left: 7px;
  top: 7px;
  width: 20px;
  height: 20px;
  padding: 3px;
  border-radius: 50%;
  background: var(--brass);
  fill: #1d1704;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .45);
  opacity: 0;
  transform: scale(.4);
  transition: opacity .18s, transform .22s cubic-bezier(.3, 1.6, .5, 1);
}

.paleta-opis {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 8px 9px 9px;
}
.paleta-nazwa {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 600;
}
.paleta-kropki { display: flex; flex: none; }
.paleta-kropki i {
  width: 12px;
  height: 12px;
  margin-left: -3px;
  border-radius: 50%;
  border: 2px solid #1b1d22;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .12);
}
.paleta-kropki i:first-child { margin-left: 0; }

.paleta.is-wybrana {
  border-color: var(--brass);
  color: var(--brass-hi);
  box-shadow: 0 0 0 1px var(--brass), 0 6px 18px rgba(201, 162, 39, .18);
}
.paleta.is-wybrana .paleta-znak { opacity: 1; transform: none; }

@media (max-width: 420px) {
  .paleta-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
}


/* co robia kolory bazowe - legenda nad zestawieniami */
.palety-dzialanie {
  list-style: none;
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(15, 17, 21, .45);
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-3);
}
.palety-dzialanie li { display: flex; gap: 8px; align-items: baseline; margin-bottom: 4px; }
.palety-dzialanie li:last-child { margin-bottom: 0; }
.palety-dzialanie b { color: var(--text-2); font-weight: 600; }
.palety-dzialanie .kropka {
  flex: none;
  width: 10px; height: 10px;
  border-radius: 50%;
  transform: translateY(1px);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .25);
}

/* pasek przemalowania pod zestawieniami */
.przemaluj {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding: 11px 12px;
  border: 1px dashed var(--line);
  border-radius: 9px;
  background: rgba(15, 17, 21, .35);
  transition: border-color .2s, background .2s;
}
.przemaluj.is-gotowe {
  border-style: solid;
  border-color: var(--brass-dim);
  background: linear-gradient(180deg, rgba(201, 162, 39, .10), rgba(201, 162, 39, .03));
}
.przemaluj-opis { flex: 1; margin: 0; font-size: 12px; line-height: 1.5; color: var(--text-3); }
.przemaluj.is-gotowe .przemaluj-opis { color: var(--text-2); }
.przemaluj-opis b { color: var(--brass-hi); }
.przemaluj .btn { flex: none; }
@media (max-width: 520px) {
  .przemaluj { flex-direction: column; align-items: stretch; }
  .przemaluj .btn { justify-content: center; }
}
/* karta kolorow jest waska - opis nad przyciskiem, a nie sciskany obok niego */
.przemaluj { flex-direction: column; align-items: stretch; }
.przemaluj .btn { justify-content: center; }
/* legenda: kropka z lewej, nazwa i opis jako jeden plynacy akapit
   (flex rozbijal je na trzy waskie kolumny) */
.palety-dzialanie li { display: block; position: relative; padding-left: 18px; }
.palety-dzialanie .kropka { position: absolute; left: 0; top: 4px; transform: none; }

/* ====================================================================
   ODSTEPY POD POWIEKSZENIE PRZYCISKOW
   Przycisk po najechaniu rosnie o 4-10 %, wiec odstep miedzy sasiadami
   musi byc wiekszy niz ten przyrost - przy 2-4 px powiekszony przycisk
   wchodzil na sasiada (kroki 1-4, pasek projektu, rail, zakladki).
   ==================================================================== */

.steps { gap: 12px; }
.tb-group { gap: 6px; }
.tb-sep { margin: 0 10px; }
.rail { gap: 7px; }
.surface-tabs { gap: 8px; }
.pv-views { gap: 6px; }

/* przelaczniki trybow (ekran budowy): osobne przyciski zamiast sklejonego
   paska - sklejony przycinal powiekszony przycisk na krawedziach */
.seg { gap: 6px; border: 0; border-radius: 0; overflow: visible; }
.seg button {
  border: 1px solid var(--line);
  border-radius: 6px;
}
.seg button:last-child { border-right: 1px solid var(--line); }
.seg button.is-active { border-color: var(--brass-dim); }
.seg button:hover { transform: scale(1.05); }

/* podpisy paska projektu potrzebuja teraz ok. 1730 px */
@media (max-width: 1800px) {
  .tb span { display: none; }
  .tb { padding: 8px; }
  .tb svg { width: 17px; height: 17px; }
}
@media (max-width: 1024px) { .steps { gap: 8px; } }
/* szerokie przelaczniki - maly procent powiekszenia to juz kilka pikseli */
.seg { gap: 8px; }
.seg button:not(:disabled):hover { transform: scale(1.03); }
/* stan zapisu: ponizej 1500 px sama kropka, zeby kroki 1-4 z wiekszymi
   odstepami miescily sie w pasku gornym bez ucinania "Budowa .scs" */
@media (max-width: 1500px) {
  .save-state { font-size: 0; gap: 0; padding: 0 4px; }
  .save-state::before { width: 8px; height: 8px; }
}
/* 1140-1300 px: pelne nazwy krokow sie nie mieszcza, same numery sa
   zbyt oszczedne - krotkie nazwy (Start, Pojazdy, Projekt, Budowa) */
@media (min-width: 1140px) and (max-width: 1300px) {
  .steps .step .step-pelna { display: none; }
  .steps .step .step-krotka { display: inline; }
}
/* 1025-1139 px: nawet krotkie nazwy wchodza pod przyciski po prawej */
@media (min-width: 1025px) and (max-width: 1139px) {
  .steps .step .step-pelna { display: none; }
  .steps .step { padding: 7px 9px; }
}
/* oddech za ostatnim krokiem ("Budowa .scs") - linia oddziela kroki od
   przyciskow po prawej, tak jak przy logo po lewej */
.topbar-right { padding-left: 16px; border-left: 1px solid var(--line); }
.steps { padding-right: 4px; }
@media (max-width: 760px) {
  .topbar-right { padding-left: 0; border-left: 0; }
  .steps { padding-right: 6px; }
}
/* telefon: "Budowa" nie moze dotykac krawedzi ekranu */
@media (max-width: 760px) {
  .steps { padding: 8px 14px 7px; }
}


/* ====================================================================
   BIBLIOTEKA TEL
   ==================================================================== */

.tlo-cel { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; font-size: 12px; color: var(--text-3); }
.tlo-cel .seg { flex: 1; }
.tlo-cel .seg button { padding: 6px 6px; }

.tlo-grid { grid-template-columns: repeat(2, 1fr); gap: 9px; }
.tlo-kafel {
  display: flex;
  flex-direction: column;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #16181c;
  overflow: hidden;
  color: var(--text-2);
  text-align: left;
}
.tlo-kafel canvas { display: block; width: 100%; height: auto; aspect-ratio: 2 / 1; }
.tlo-nazwa {
  padding: 6px 8px 7px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-top: 1px solid rgba(0, 0, 0, .35);
}
.tlo-kafel:hover { border-color: var(--brass-dim); color: var(--text); box-shadow: 0 6px 16px rgba(0, 0, 0, .4); }
.tlo-kafel.is-wybrane { border-color: var(--brass); color: var(--brass-hi); box-shadow: 0 0 0 1px var(--brass); }
.tlo-wlasny { justify-content: flex-end; min-height: 90px; border-style: dashed; }
.tlo-plus {
  flex: 1;
  display: grid; place-items: center;
  font-size: 30px; font-weight: 300; color: var(--brass);
}
/* dluzsze nazwy tel w dwoch liniach zamiast ucinania */
.tlo-nazwa {
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.3;
  min-height: calc(2 * 1.3em + 13px);
}
/* nazwa tworcy w stopce prowadzi na strone studia */
.stopka-tworca a.stopka-studio { color: var(--text-2); font-weight: 600; }
.stopka-tworca a.stopka-studio:hover { color: var(--brass-hi); }
@media (max-width: 380px) { .stopka-studio { overflow: hidden; text-overflow: ellipsis; } }
/* oddech przed pierwszym krokiem ("Start") - linia przy logo nie moze stac
   tuz przy przycisku, zwlaszcza gdy ten sie powieksza po najechaniu */
@media (min-width: 761px) {
  .steps { padding-left: 14px; }
}
