:root {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --border: #e2e4ec;
  --text: #1a1a2e;
  --text-muted: #6b6f80;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eef0fe;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(20, 20, 40, 0.06), 0 8px 24px rgba(20, 20, 40, 0.05);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14141f;
    --surface: #1d1e2c;
    --border: #2c2d3f;
    --text: #edeef5;
    --text-muted: #9698ab;
    --accent: #7c74f1;
    --accent-hover: #8f88f4;
    --accent-soft: #262745;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.2), 0 8px 24px rgba(0, 0, 0, 0.25);
  }
}

* { box-sizing: border-box; }

/* Elementy renderowane dynamicznie (menu, reklamy, logo) używają [hidden] do ukrywania —
   ta reguła gwarantuje, że wygrywa z innymi regułami display, niezależnie od kolejności. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.topbar {
  background: var(--header-bg, var(--surface));
  border-bottom: 1px solid var(--border);
  padding: 28px 20px 24px;
}

.topbar-inner {
  max-width: 1100px;
  margin: 0 auto;
}

.topbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 auto;
  min-width: 0;
}

.brand-mark {
  color: var(--accent);
  display: inline-flex;
}

.brand-name {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.site-title-row {
  margin: 10px 0 0;
  text-align: left;
}

.tagline {
  margin: 8px 0 0;
  color: var(--text-muted);
  font-size: 0.98rem;
  text-align: left;
}

.site-logo {
  height: 28px;
  width: auto;
  max-width: 160px;
  object-fit: contain;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 20px;
}

.site-nav a {
  color: var(--menu-top-color, var(--text-muted));
  text-decoration: none;
  font-size: var(--menu-top-font-size, 0.9rem);
  font-weight: 500;
}

.site-nav a:hover { color: var(--accent); }

.site-nav-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 18px;
  margin-bottom: 12px;
}

.site-nav-bottom a {
  color: var(--menu-bottom-color, var(--text-muted));
  text-decoration: none;
  font-size: var(--menu-bottom-font-size, 0.85rem);
}

.site-nav-bottom a:hover { color: var(--accent); }

/* ---------- ad slots ---------- */

.ad-slot {
  display: flex;
  justify-content: center;
  align-items: center;
}

.ad-slot a {
  display: inline-flex;
  max-width: 100%;
}

.ad-slot img {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  display: block;
}

.ad-slot-top {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px 20px 0;
}

.ad-slot-sidebar {
  margin-top: 18px;
}

.ad-slot-sidebar img {
  border-radius: var(--radius);
}

.ad-slot-footer {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px 24px;
}

.layout {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 20px 60px;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 22px;
  align-items: start;
}

@media (max-width: 860px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .preview-panel {
    order: -1;
  }
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}

.card-title {
  font-size: 1.02rem;
  font-weight: 600;
  margin: 0 0 16px;
}

.type-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 8px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.type-btn {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.15;
  padding: 10px 4px 8px;
  border-radius: 10px;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.type-btn .type-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.type-btn:hover {
  color: var(--text);
  background: var(--accent-soft);
}

.type-btn.active {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: var(--accent);
}

.tab-panel {
  display: none;
  flex-direction: column;
  gap: 14px;
}

.tab-panel.active {
  display: flex;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
  width: 100%;
}

.field:last-child { margin-bottom: 0; }

.field-label {
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--text-muted);
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="url"],
input[type="password"],
input[type="date"],
select,
textarea {
  font-family: inherit;
  font-size: 0.95rem;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  width: 100%;
  resize: vertical;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input[type="date"] {
  color-scheme: light dark;
}

input[type="date"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

input[type="color"] {
  width: 100%;
  height: 42px;
  padding: 3px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  cursor: pointer;
}

input[type="file"] {
  font-size: 0.88rem;
  color: var(--text-muted);
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.checkbox-field {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.checkbox-field input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: var(--accent);
}

.checkbox-field .field-label { color: var(--text); }

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 480px) {
  .grid-2 { grid-template-columns: 1fr; }
}

.range-field output {
  color: var(--accent);
  font-weight: 600;
}

.accordion {
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 12px;
  overflow: hidden;
}

.accordion:last-child { margin-bottom: 0; }

.accordion summary {
  padding: 13px 16px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.93rem;
  background: var(--bg);
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.accordion summary::-webkit-details-marker { display: none; }

.accordion summary::after {
  content: "+";
  color: var(--text-muted);
  font-weight: 400;
  font-size: 1.1rem;
}

.accordion[open] summary::after {
  content: "–";
}

.accordion-body {
  padding: 16px;
  border-top: 1px solid var(--border);
}

.preview-panel { position: sticky; top: 20px; }

@media (max-width: 860px) {
  /* Na jednej kolumnie "sticky" powodowało, że panel podglądu (razem z reklamą boczną
     pod przyciskami pobierania) zostawał przyklejony u góry i zasłaniał przewijane
     niżej ustawienia. Na telefonie/tablecie ma się przewijać normalnie, jak reszta strony. */
  .preview-panel {
    position: static;
    top: auto;
  }
}

.preview-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.qr-preview-box {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 260px;
  width: 100%;
  padding: 16px;
  background: repeating-conic-gradient(#00000008 0% 25%, transparent 0% 50%) 50% / 20px 20px;
  border-radius: 12px;
  margin-bottom: 12px;
}

.qr-preview-box canvas,
.qr-preview-box svg {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
}

.hint {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0 0 18px;
}

.download-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  width: 100%;
}

.btn-primary, .btn-secondary {
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  padding: 11px 18px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.05s ease;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary {
  background: var(--accent-soft);
  color: var(--accent);
}

.btn-secondary:hover { background: var(--border); }

.btn-secondary.small {
  padding: 7px 12px;
  font-size: 0.82rem;
  margin-bottom: 14px;
}

.btn-primary:active, .btn-secondary:active { transform: scale(0.98); }

.logo-suggestion {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--accent-soft);
  border-radius: 10px;
  padding: 8px 10px;
  margin: -6px 0 18px;
}

.logo-suggestion img {
  border-radius: 7px;
  flex-shrink: 0;
  display: block;
  object-fit: contain;
  background: #fff;
}

.logo-suggestion-text {
  flex: 1;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.logo-suggestion .btn-secondary.small {
  margin-bottom: 0;
  white-space: nowrap;
}

.reset-row {
  display: flex;
  justify-content: center;
  width: 100%;
  margin-top: 10px;
}

.linklist-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  align-items: center;
}

.linklist-row input {
  flex: 1;
  min-width: 0;
}

.linklist-row .btn-remove-row {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  line-height: 1;
}

.linklist-row .btn-remove-row:hover {
  background: var(--border);
}

.btn-reset {
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: 10px;
  border: 1px dashed var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.05s ease;
}

.btn-reset:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.btn-reset:active { transform: scale(0.98); }

.shortener-box {
  margin-top: 4px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
}

.shortener-box .hint {
  margin: 8px 0 10px;
}

.hint-privacy {
  background: var(--accent-soft);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 10px;
  line-height: 1.4;
}

.shortener-box code {
  background: var(--accent-soft);
  color: var(--accent);
  padding: 1px 5px;
  border-radius: 5px;
  font-size: 0.85em;
}

.shorten-status {
  font-size: 0.86rem;
  min-height: 1.2em;
  margin-bottom: 8px;
  color: var(--text-muted);
}

.shorten-status.error { color: #d9376e; }
.shorten-status.success { color: #1a9e6b; }

.shorten-result-row {
  display: flex;
  gap: 8px;
}

.shorten-result-row input {
  flex: 1;
}

.site-footer {
  text-align: center;
  padding: 20px;
  color: var(--text-muted);
  font-size: 0.84rem;
  background: var(--footer-bg, transparent);
}

/* ---------- karuzela obrazków ---------- */

.carousel {
  max-width: 1100px;
  margin: 0 auto;
  padding: 10px 0 24px;
  overflow: hidden;
}

.carousel-track {
  display: flex;
  align-items: center;
  width: max-content;
  will-change: transform;
}

.carousel-item {
  flex: 0 0 auto;
  display: inline-flex;
}

.carousel-item img {
  width: auto;
  border-radius: 10px;
  display: block;
}
