:root {
  --bg: #111827;
  --card: #1f2937;
  --field: #111827;
  --border: #4b5563;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --accent: #dc2626;
  --accent-hover: #b91c1c;
  --secondary: #374151;
  --secondary-hover: #4b5563;
  --link: #93c5fd;
  --error: #fca5a5;
  --warn: #fcd34d;
}
* { box-sizing: border-box; }
body {
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  max-width: 960px;
  margin: 4vh auto;
  padding: 0 16px;
  color: var(--text);
  background: var(--bg);
}
a { color: var(--link); }
header { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.brand { display: inline-flex; background: #fff; border-radius: 10px; padding: 8px 14px; line-height: 0; }
.brand img { height: 48px; width: auto; max-width: 200px; object-fit: contain; }
.title { font-size: 1.6rem; font-weight: 700; color: var(--text); text-decoration: none; }
.card { padding: 20px; background: var(--card); border-radius: 12px; }

.layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
@media (max-width: 760px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .preview { order: -1; position: static; max-width: 360px; width: 100%; justify-self: center; }
}

fieldset { border: 0; padding: 0; margin: 0 0 18px; min-width: 0; }
legend { font-weight: 600; margin-bottom: 8px; padding: 0; }
label { display: block; margin-bottom: 6px; }
input[type="url"], input[type="text"], select, textarea, button { font: inherit; border-radius: 8px; padding: 11px; }
input[type="url"], input[type="text"], select {
  width: 100%;
  background: var(--field);
  color: #fff;
  border: 1px solid var(--border);
}
button { background: var(--accent); color: #fff; border: 0; cursor: pointer; }
button:hover:not(:disabled) { background: var(--accent-hover); }
button:disabled { opacity: .5; cursor: default; }
button.secondary { background: var(--secondary); }
button.secondary:hover:not(:disabled) { background: var(--secondary-hover); }

.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > div { flex: 1 1 150px; min-width: 0; }

.color-field { display: flex; align-items: center; gap: 10px; }
input[type="color"] {
  width: 48px; height: 44px; padding: 3px; border-radius: 8px;
  background: var(--field); border: 1px solid var(--border); cursor: pointer;
}
input[type="color"]:disabled { opacity: .4; cursor: default; }
.hex { font: 14px ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--muted); }

.check { display: flex; align-items: center; gap: 8px; margin: 8px 0 0; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; }

input[type="range"] { width: 100%; accent-color: var(--accent); }
input[type="file"] { width: 100%; color: var(--muted); font: inherit; }
input[type="file"]::file-selector-button {
  font: inherit; border: 0; border-radius: 8px; padding: 9px 12px; margin-right: 10px;
  background: var(--secondary); color: #fff; cursor: pointer;
}

.preview { position: sticky; top: 16px; }
.qr-box {
  aspect-ratio: 1;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  /* szachownica — widać przezroczyste tło */
  background-color: #fff;
  background-image:
    linear-gradient(45deg, #e5e7eb 25%, transparent 25%),
    linear-gradient(-45deg, #e5e7eb 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e5e7eb 75%),
    linear-gradient(-45deg, transparent 75%, #e5e7eb 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  overflow: hidden;
}
.qr-box svg { width: 100%; height: 100%; display: block; }
.qr-empty { color: #6b7280; text-align: center; padding: 20px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.actions button { flex: 1 1 auto; }

.muted { color: var(--muted); font-size: .92rem; }
.encoded { overflow-wrap: anywhere; font: 13px ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--muted); }
.error { color: var(--error); }
.warn { color: var(--warn); font-size: .92rem; margin: 8px 0 0; }
footer { margin-top: 16px; color: var(--muted); }
[hidden] { display: none !important; }
.mt { margin-top: 12px; }
