*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:       #0b0b14;
  --bg2:      #12121e;
  --surface:  #1a1a2e;
  --surface2: #23233a;
  --border:   #2a2a46;
  --baccent:  #5050a0;
  --text:     #eaeaff;
  --muted:    #8080b8;
  --accent:   #7c5cfc;
  --accent2:  #4ecdc4;
  --danger:   #f44336;
  --glow:     rgba(124,92,252,.4);
  --glow-sm:  rgba(124,92,252,.12);
  --shadow:   0 8px 32px rgba(0,0,0,.6);
  --shadow-s: 0 3px 12px rgba(0,0,0,.4);
  --r:        16px;
  --rs:       10px;
  --t:        .18s cubic-bezier(.4,0,.2,1);
}

[data-theme="light"] {
  --bg:       #f0f0ff;
  --bg2:      #e6e6f8;
  --surface:  #ffffff;
  --surface2: #f0f0ff;
  --border:   #c8c8e0;
  --baccent:  #7070c0;
  --text:     #181830;
  --muted:    #5050a0;
  --accent:   #5c3ef0;
  --accent2:  #1a9e96;
  --glow:     rgba(92,62,240,.28);
  --glow-sm:  rgba(92,62,240,.08);
  --shadow:   0 6px 24px rgba(0,0,0,.1);
  --shadow-s: 0 2px 8px rgba(0,0,0,.07);
}

/* ── Base ── */
html { scroll-behavior: smooth; }
body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background-color .28s ease, color .2s ease;
}

/* ── Header ── */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: .75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  gap: .5rem;
  transition: background .28s ease, border-color .2s ease;
}

.logo { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.logo-icon { display: flex; align-items: center; flex-shrink: 0; }
.logo-text {
  font-size: 1.05rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  white-space: nowrap;
}
.logo-sub {
  font-size: .62rem;
  color: var(--muted);
  display: block;
  -webkit-text-fill-color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.theme-btn {
  display: flex;
  align-items: center;
  gap: .35rem;
  background: var(--surface2);
  border: 1.5px solid var(--border);
  color: var(--text);
  padding: .42rem .85rem;
  border-radius: 50px;
  cursor: pointer;
  font-size: .78rem;
  font-weight: 700;
  transition: all var(--t);
  flex-shrink: 0;
  white-space: nowrap;
}
.theme-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--glow-sm); }

/* ── Ad slots — tymczasowo ukryte; aktywuj przy wdrożeniu AdSense ──
   Aby przywrócić: usuń display:none z .ad-banner i .ad-sidebar-box,
   oraz odkomentuj bloki HTML w index.html (szukaj: "AdSense TOP/MID/SIDEBAR").
   ──────────────────────────────────────────────────────────────────── */
.ad-banner  { display: none; }       /* ukryty — banner top i mid      */
.ad-slot    {                         /* zachowane dla AdSense JS        */
  background: var(--bg2);
  border: 2px dashed var(--baccent);
  border-radius: var(--rs);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: .3rem;
  color: var(--muted);
  font-size: .75rem;
  transition: background var(--t);
}
.ad-slot strong {
  font-size: .65rem;
  color: var(--baccent);
  letter-spacing: .6px;
  text-transform: uppercase;
  font-weight: 800;
}
.ad-slot span  { opacity: .7; }
.ad-banner .ad-slot { min-height: 96px; border-radius: var(--rs); }
.ad-sidebar-box     { display: none; min-height: 270px; } /* ukryty — sidebar */

/* ── Layout ── */
.page { max-width: 1200px; margin: 0 auto; padding: 0 1.25rem; }

/* Spacing między głównymi sekcjami (wcześniej tworzyły go bannery AdSense).
   Przy ponownym włączeniu reklam można zmniejszyć lub usunąć ten margines. */
.page + .page { margin-top: 2rem; }

/* ── Section header ── */
.sec-label {
  display: flex;
  align-items: center;
  gap: .55rem;
  margin-bottom: 1rem;
}
.sec-num {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .72rem;
  font-weight: 800;
  flex-shrink: 0;
  box-shadow: 0 2px 8px var(--glow-sm);
}
.sec-title { font-size: 1.05rem; font-weight: 800; letter-spacing: -.01em; }

/* ── Hero Section ── */
.hero-section {
  padding: 2rem 0 1.25rem;
  text-align: center;
}
.hero-h1 {
  font-size: clamp(1.45rem, 4vw, 2rem);
  font-weight: 900;
  letter-spacing: -.03em;
  line-height: 1.2;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: .65rem;
}
.hero-desc {
  font-size: .98rem;
  color: var(--muted);
  max-width: 520px;
  margin: 0 auto .85rem;
  line-height: 1.65;
}
.hero-badges {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .55rem;
  flex-wrap: wrap;
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .36rem .9rem;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 50px;
  font-size: .78rem;
  font-weight: 700;
  color: var(--accent2);
  letter-spacing: .02em;
  transition: border-color var(--t), background var(--t);
}
.hero-badge:hover { border-color: var(--accent2); background: rgba(78,205,196,.07); }

/* ── Templates section ── */
.templates-section { padding: 1.25rem 0 .75rem; }

/* Sticky filter bar — przyklejony pod nagłówkiem strony */
.toolbar-row {
  position: sticky;
  top: 58px;           /* wysokość .site-header */
  z-index: 50;
  background: var(--bg);
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
  padding: .5rem 0 .6rem;
  margin-bottom: .5rem;
  /* shadow maskuje zawartość gridu przewijającą się pod paskiem */
  box-shadow: 0 6px 18px var(--bg);
}
.toolbar-row .search-wrap { flex: 1; min-width: 140px; margin-bottom: 0; }
.toolbar-row .search-input { max-width: none; }

.search-wrap { position: relative; margin-bottom: .9rem; }
.search-icon {
  position: absolute;
  left: .8rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
  font-style: normal;
}
.search-input {
  width: 100%;
  padding: .6rem 1rem .6rem 2.2rem;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 50px;
  color: var(--text);
  font-size: .9rem;
  transition: border-color var(--t), box-shadow var(--t);
}
.search-input::placeholder { color: var(--muted); }
.search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--glow-sm);
}

.category-select { max-width: 210px; min-width: 175px; flex-shrink: 0; }

.btn-upload,
.btn-random {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .58rem 1rem;
  border-radius: var(--rs);
  font-size: .84rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--t);
  white-space: nowrap;
  flex-shrink: 0;
}
.btn-upload {
  border: 2px dashed var(--accent2);
  color: var(--accent2);
  background: rgba(78,205,196,.07);
}
.btn-upload:hover { background: rgba(78,205,196,.16); border-style: solid; transform: translateY(-1px); }
.btn-random {
  border: 1.5px solid var(--border);
  color: var(--text);
  background: var(--surface);
  font-family: inherit;
}
.btn-random:hover { border-color: var(--accent); color: var(--accent); background: var(--glow-sm); transform: translateY(-1px); }

/* ── Template grid ── */
.templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: .4rem;
  /* scrollowalna biblioteka */
  max-height: 370px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 2px;
  /* fade na dole sugerujący więcej kart */
  -webkit-mask-image: linear-gradient(to bottom, black 82%, transparent 100%);
  mask-image:         linear-gradient(to bottom, black 82%, transparent 100%);
  /* scroll bar */
  scrollbar-width: thin;
  scrollbar-color: var(--baccent) transparent;
}
.templates-grid::-webkit-scrollbar { width: 4px; }
.templates-grid::-webkit-scrollbar-track { background: transparent; }
.templates-grid::-webkit-scrollbar-thumb { background: var(--baccent); border-radius: 4px; }
.templates-grid::-webkit-scrollbar-thumb:hover { background: var(--accent); }
.template-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--rs);
  overflow: hidden;
  cursor: pointer;
  transition: border-color var(--t), box-shadow var(--t), transform var(--t);
  position: relative;
}
.template-card:hover { border-color: var(--baccent); transform: translateY(-2px); box-shadow: var(--shadow-s); }
.template-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.template-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent);
}
.template-card.selected::after {
  content: '✓';
  position: absolute;
  top: 4px;
  right: 4px;
  background: var(--accent);
  color: #fff;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .55rem;
  font-weight: 800;
}

.tmpl-thumb { position: relative; width: 100%; height: 68px; overflow: hidden; }
.tmpl-fb {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .1rem;
  padding: .25rem;
  text-align: center;
}
.tmpl-fb-ico { font-size: 1.2rem; line-height: 1; }
.tmpl-fb-name { font-size: .55rem; font-weight: 700; color: rgba(255,255,255,.88); line-height: 1.2; word-break: break-word; }
.tmpl-thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--t);
}
.template-card:hover .tmpl-thumb img { transform: scale(1.06); }

.tmpl-name {
  padding: .22rem .3rem .08rem;
  font-size: .62rem;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}
.tmpl-category {
  padding: 0 .3rem .25rem;
  font-size: .52rem;
  font-weight: 800;
  color: var(--baccent);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: .4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.template-card.selected .tmpl-name { color: var(--accent); }

.no-results { color: var(--muted); font-size: .88rem; padding: 2rem 0 1rem; text-align: center; line-height: 1.7; }
.no-results,
.max-layers-msg,
.file-input { display: none; }

/* ── Drag-over canvas ── */
.canvas-wrap.drop-active {
  border-color: var(--accent2);
  box-shadow: 0 0 0 3px rgba(78,205,196,.22);
  background: rgba(78,205,196,.04);
}

/* ── Editor ── */
.editor-section { padding: 1.25rem 0 3rem; }
.editor-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 1.25rem;
  align-items: start;
}

/* Canvas area */
.canvas-wrap {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 380px;
  justify-content: center;
  transition: border-color var(--t), box-shadow var(--t), background-color .28s ease;
}
.canvas-ph { text-align: center; color: var(--muted); }
.canvas-ph .ph-ico { font-size: 2.8rem; display: block; margin-bottom: .5rem; opacity: .5; }
.canvas-ph strong { font-size: 1rem; font-weight: 700; }
.canvas-note { margin-top: .35rem; font-size: .82rem; opacity: .75; }

.canvas-loading {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: .6rem;
  color: var(--muted);
  font-size: .85rem;
}
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 6px 22px var(--glow), 0 0 0 1px rgba(124,92,252,.18); }
  50%       { box-shadow: 0 10px 32px var(--glow), 0 0 0 3px rgba(124,92,252,.40); }
}

#memeCanvas {
  max-width: 100%;
  height: auto;
  display: none;
  border-radius: var(--rs);
  box-shadow: var(--shadow-s);
}

.drag-hint {
  font-size: .72rem;
  color: var(--muted);
  margin-top: .65rem;
  text-align: center;
  display: none;
}

/* Canvas action buttons */
.canvas-actions {
  display: none;
  gap: .5rem;
  margin-top: 1.1rem;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
}

/* ── Controls panel ── */
.controls-panel {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transition: background .28s ease, border-color .2s ease;
}
.ctrl-group { display: flex; flex-direction: column; gap: .45rem; }
.ctrl-label {
  font-size: .68rem;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .6px;
}

.ctrl-input {
  background: var(--bg2);
  border: 1.5px solid var(--border);
  border-radius: var(--rs);
  color: var(--text);
  font-size: .92rem;
  padding: .55rem .8rem;
  width: 100%;
  transition: border-color var(--t), box-shadow var(--t);
  /* larger tap target on mobile */
  min-height: 44px;
}
.ctrl-input::placeholder { color: var(--muted); }
.ctrl-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--glow-sm); }

.ctrl-select {
  background: var(--bg2);
  border: 1.5px solid var(--border);
  border-radius: var(--rs);
  color: var(--text);
  font-size: .9rem;
  padding: .52rem .8rem;
  width: 100%;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238080b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .65rem center;
  background-size: .9rem;
  transition: border-color var(--t);
  min-height: 44px;
}
.ctrl-select:focus { outline: none; border-color: var(--accent); }

.slider-row { display: flex; align-items: center; gap: .6rem; }
.slider-val {
  font-size: .8rem;
  font-weight: 800;
  color: var(--accent);
  min-width: 34px;
  text-align: right;
}
input[type="range"] {
  flex: 1;
  height: 6px;
  appearance: none;
  -webkit-appearance: none;
  background: var(--border);
  border-radius: 4px;
  cursor: pointer;
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  border: 2.5px solid var(--surface);
  cursor: grab;
  box-shadow: 0 0 0 2px var(--accent);
}
input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  border: 2.5px solid var(--surface);
  cursor: grab;
}

.color-row { display: flex; gap: .55rem; }
.color-pick { flex: 1; display: flex; flex-direction: column; gap: .3rem; }
.color-pick-lbl { font-size: .68rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .4px; }
input[type="color"] {
  width: 100%;
  height: 40px;
  border: 1.5px solid var(--border);
  border-radius: var(--rs);
  background: var(--bg2);
  cursor: pointer;
  padding: 2px;
}

.sep { height: 1px; background: var(--border); }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .62rem 1.05rem;
  border: none;
  border-radius: var(--rs);
  font-size: .86rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--t);
  white-space: nowrap;
  min-height: 44px;
  font-family: inherit;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #4a30e0);
  color: #fff;
  box-shadow: 0 4px 16px var(--glow);
  letter-spacing: .01em;
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px var(--glow);
  filter: brightness(1.08);
}
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: .4; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-ghost {
  background: var(--surface2);
  color: var(--text);
  border: 1.5px solid var(--border);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); background: var(--glow-sm); }

/* Download CTA — bigger, more prominent */
.btn-full {
  width: 100%;
  padding: .9rem;
  font-size: 1rem;
  border-radius: 12px;
  letter-spacing: .01em;
}
.btn-full:not(:disabled) {
  animation: pulse-glow 2.8s ease-in-out infinite;
}
.btn-full:not(:disabled):hover {
  animation: none;
  transform: translateY(-2px);
  box-shadow: 0 10px 30px var(--glow), 0 0 0 1px rgba(124,92,252,.35);
}

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 999;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--rs);
  padding: .7rem 1.15rem;
  font-size: .86rem;
  font-weight: 700;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: .5rem;
  transform: translateY(80px);
  opacity: 0;
  transition: all .3s cubic-bezier(.4,0,.2,1);
  pointer-events: none;
  max-width: calc(100vw - 3rem);
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.ok { border-color: #4caf50; }
.toast.err { border-color: var(--danger); }

/* ── Layer controls ── */
.layers-header { display: flex; align-items: center; justify-content: space-between; }
.add-layer-btn {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .32rem .7rem;
  border-radius: var(--rs);
  background: linear-gradient(135deg, var(--accent), #4a30e0);
  color: #fff;
  border: none;
  font-size: .8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--t);
  box-shadow: 0 2px 8px var(--glow-sm);
  font-family: inherit;
  min-height: 36px;
}
.add-layer-btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 4px 14px var(--glow); }
.add-layer-btn:disabled { opacity: .35; cursor: not-allowed; transform: none; }

.max-layers-msg { font-size: .72rem; color: var(--accent2); margin-top: .3rem; }

#layersContainer { display: flex; flex-direction: column; gap: .45rem; margin-top: .5rem; }
.layer-row { display: flex; align-items: center; gap: .4rem; }
.layer-row .ctrl-input { flex: 1; min-width: 0; }

.btn-remove-layer {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: var(--rs);
  color: var(--muted);
  font-size: .75rem;
  cursor: pointer;
  transition: all var(--t);
}
.btn-remove-layer:hover { border-color: var(--danger); color: var(--danger); background: rgba(244,67,54,.1); }

/* ── Footer ── */
footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  text-align: center;
  padding: 1.25rem 1rem;
  font-size: .76rem;
  color: var(--muted);
  transition: background .28s ease, border-color .2s ease, color .2s ease;
}
.footer-note { margin-top: .35rem; opacity: .7; }
.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .45rem .9rem;
  margin-top: .55rem;
}
.footer-links a,
.legal-card a {
  color: var(--accent2);
  text-decoration: none;
}
.footer-links a:hover,
.legal-card a:hover { text-decoration: underline; }

/* ── SEO Section ── */
.seo-section {
  background: var(--bg2);
  border-top: 1px solid var(--border);
  padding: 2.75rem 0 2.5rem;
  margin-top: 0;
  transition: background .28s ease, border-color .2s ease;
}
.seo-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.25rem;
  margin-bottom: 2.25rem;
}
.seo-h2 {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 1rem;
  padding-bottom: .45rem;
  border-bottom: 2px solid var(--accent);
  display: inline-block;
  letter-spacing: -.01em;
}
.seo-steps {
  list-style: none;
  counter-reset: steps;
  display: flex;
  flex-direction: column;
  gap: .8rem;
  padding: 0;
}
.seo-steps li {
  counter-increment: steps;
  display: flex;
  gap: .75rem;
  font-size: .87rem;
  color: var(--muted);
  line-height: 1.65;
}
.seo-steps li::before {
  content: counter(steps);
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  min-width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .68rem;
  font-weight: 800;
  flex-shrink: 0;
  margin-top: .15rem;
}
.seo-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: .55rem;
  padding: 0;
}
.seo-list li {
  font-size: .87rem;
  color: var(--muted);
  line-height: 1.65;
}

/* FAQ */
.faq-section {
  border-top: 1px solid var(--border);
  padding-top: 1.75rem;
}
.faq-h2 {
  display: block !important;
  margin-bottom: 1.25rem;
}
.faq-list {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.faq-item {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--rs);
  overflow: hidden;
  transition: border-color var(--t), background .28s ease;
}
.faq-item[open] { border-color: var(--baccent); }
.faq-q {
  padding: .85rem 1rem;
  cursor: pointer;
  font-size: .9rem;
  font-weight: 700;
  color: var(--text);
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  user-select: none;
  transition: color var(--t);
}
.faq-q::-webkit-details-marker { display: none; }
.faq-q::after {
  content: '+';
  font-size: 1.25rem;
  line-height: 1;
  color: var(--accent);
  flex-shrink: 0;
  font-weight: 400;
  transition: transform var(--t);
}
.faq-item[open] .faq-q { color: var(--accent); }
.faq-item[open] .faq-q::after { content: '−'; }
.faq-a {
  padding: 0 1rem .9rem;
  font-size: .86rem;
  color: var(--muted);
  line-height: 1.75;
}

/* ── Trust pages ── */
.legal-logo { text-decoration: none; }
.legal-page { min-height: calc(100vh - 154px); }
.legal-card {
  max-width: 860px;
  margin: 0 auto;
}
.legal-title {
  font-size: 2rem;
  line-height: 1.15;
  color: var(--text);
  margin-bottom: 1.5rem;
  letter-spacing: -.01em;
}
.legal-kicker {
  color: var(--muted);
  font-size: .82rem;
  margin-bottom: .6rem;
}
.legal-card p {
  color: var(--muted);
  font-size: .92rem;
  line-height: 1.75;
  margin-bottom: 1rem;
}
.legal-card .seo-h2 {
  margin-top: 1.15rem;
}

/* ═══════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════ */

/* Duży desktop — więcej kart w rzędzie */
@media (min-width: 1100px) {
  .templates-grid { grid-template-columns: repeat(auto-fill, minmax(82px, 1fr)); }
  .hero-h1 { font-size: 2.1rem; }
}

/* Tablet */
@media (max-width: 900px) {
  .editor-layout { grid-template-columns: 1fr; }
  .ad-sidebar-box { min-height: 100px; }
  /* na tablecie galeria trochę wyższa bo edytor jest pod spodem */
  .templates-grid { max-height: 320px; }
  .seo-grid { grid-template-columns: 1fr; gap: 1.75rem; }
}

/* Mobile ≤ 600px */
@media (max-width: 600px) {
  .site-header { padding: .65rem 1rem; }
  .logo-text { font-size: .9rem; }
  .logo-sub { display: none; }
  .theme-btn span:last-child { display: none; }

  .page { padding: 0 .9rem; }

  .ad-banner { padding: 0 .9rem; margin: .5rem auto; }
  .ad-banner .ad-slot { min-height: 72px; }

  /* sticky toolbar: nagłówek na mobile jest niższy */
  .toolbar-row { top: 50px; gap: .5rem; }
  .toolbar-row .search-wrap { order: 0; flex: 1 0 100%; }
  .category-select { flex: 1 1 auto; min-width: 0; max-width: none; order: 1; }
  .btn-random { flex: 0 0 auto; order: 2; }
  .btn-upload { flex: 1 0 100%; order: 3; justify-content: center; }

  /* galeria — 4 kolumny na telefonie, karty z wygodnym thumb */
  .templates-grid {
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: .35rem;
    max-height: 290px;
  }
  .tmpl-thumb { height: 62px; }
  .tmpl-name { font-size: .58rem; padding: .18rem .25rem .06rem; }
  .tmpl-category { font-size: .5rem; padding: 0 .25rem .2rem; }

  .sec-title { font-size: .95rem; }

  /* canvas panel */
  .canvas-wrap { padding: .9rem; min-height: 280px; }
  .canvas-actions { gap: .4rem; }
  .canvas-actions .btn { font-size: .8rem; padding: .55rem .75rem; flex: 1 1 auto; }

  /* controls */
  .controls-panel { padding: 1rem; }

  /* CTA download */
  .btn-full { font-size: .95rem; padding: .85rem; }

  /* toast positioning */
  .toast { bottom: 1rem; right: .75rem; left: .75rem; max-width: none; font-size: .82rem; }

  /* hero */
  .hero-section { padding: 1.35rem 0 .85rem; }
  .hero-h1 { font-size: 1.35rem; }
  .hero-desc { font-size: .86rem; }
  .hero-badge { font-size: .74rem; padding: .3rem .75rem; }

  /* seo */
  .seo-section { padding: 2rem 0; }
  .faq-q { font-size: .86rem; padding: .75rem .9rem; }
  .faq-a { font-size: .83rem; padding: 0 .9rem .8rem; }
}

/* Very small (≤ 360px) */
@media (max-width: 360px) {
  .templates-grid { grid-template-columns: repeat(4, 1fr); max-height: 260px; }
  .tmpl-thumb { height: 56px; }
  .tmpl-category { display: none; }
  .canvas-actions { flex-direction: column; }
  .canvas-actions .btn { width: 100%; }
}
