/* ═══════════════════════════════════════════
   Konfigurátor — Zeď + Editace
   ═══════════════════════════════════════════ */

:root {
  --cream: #faf6ed;
  --paper: #f3ead6;
  --ink: #1a1410;
  --char: #2a1f14;
  --mid: #8a7c66;
  --line: #e9dfc6;
  --line-soft: #f0e8d4;
  --accent: #ff4013;
  --accent-hover: #e63608;
  --accent-light: #ffe9e0;
  --shadow-frame: 0 28px 60px -20px rgba(40,25,12,0.30), 0 10px 22px -10px rgba(40,25,12,0.18);
  --shadow-toolbar: 0 18px 40px -12px rgba(40,25,12,0.16), 0 4px 12px -4px rgba(40,25,12,0.10);
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'DM Sans', system-ui, sans-serif;
  --topbar-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font-body);
  background: var(--cream);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
a { color: inherit; text-decoration: none; }
input[type="range"] { -webkit-appearance: none; appearance: none; background: transparent; width: 100%; }
input[type="range"]::-webkit-slider-runnable-track { height: 4px; background: var(--line); border-radius: 2px; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%; background: white; margin-top: -8px; border: 2px solid var(--accent); box-shadow: 0 2px 6px rgba(40,25,12,.18); }

/* ═══ TOPBAR ═══ */
.topbar {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 40px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--cream);
  z-index: 100;
}
.topbar-back {
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 50%;
  transition: background .15s;
}
.topbar-back:hover { background: var(--paper); }
.topbar-brand {
  display: flex; align-items: center;
}
.topbar-brand img { display: block; height: 24px; width: auto; }
@media (max-width: 720px) {
  .topbar-brand img { height: 20px; }
}
.topbar-right { display: flex; align-items: center; gap: 14px; }
.topbar-price {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  color: var(--char);
  white-space: nowrap;
}
.topbar-price:empty { display: none; }
.topbar-price-old {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 14px;
  color: var(--mid-gray, #888);
  text-decoration: line-through;
  margin-right: 6px;
}

/* ── Akce 3+1 ZDARMA chip ── */
.promo-chip {
  position: fixed;
  top: 96px;
  left: 28px;
  z-index: 90;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--accent, #ff4013);
  color: #fff;
  border-radius: 100px;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.3px;
  box-shadow: 0 6px 18px rgba(255, 64, 19, 0.28);
  pointer-events: none;
  text-transform: uppercase;
}
.promo-chip svg { flex-shrink: 0; }
.promo-chip-sub {
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  opacity: 0.9;
  margin-left: 4px;
}
.promo-chip-short { display: none; }
@media (max-width: 720px) {
  .promo-chip {
    left: 12px;
    top: calc(var(--topbar-h) + 10px);
    padding: 6px 10px;
    font-size: 12px;
  }
  .promo-chip-full { display: none; }
  .promo-chip-short { display: inline; }
}
@media (max-width: 720px) {
  /* Topbar mobil: cena vlevo, logo uprostřed, košík vpravo (stejně jako na úvodní stránce) */
  .topbar {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    grid-template-rows: 100%;
    align-items: center;
  }
  .topbar-right { display: contents; }
  .topbar-price {
    grid-column: 1; grid-row: 1;
    justify-self: start;
    display: flex; flex-direction: column; align-items: flex-start;
    line-height: 1.1;
    font-size: 15px;
  }
  .topbar-price-old {
    display: block;
    margin: 0 0 1px;
    font-size: 11px;
    line-height: 1;
  }
  .topbar-brand { grid-column: 2; grid-row: 1; justify-self: center; }
  .topbar-brand img { height: 22px; }
  .topbar-cart {
    grid-column: 3; grid-row: 1; justify-self: end;
    padding: 8px;
  }
  .topbar-cart .cart-badge { top: 0; right: 0; }
}

.save-indicator {
  position: fixed; left: 28px; top: 96px;
  display: none;
  align-items: center; gap: 8px;
  padding: 9px 16px 9px 14px;
  background: white;
  border-radius: 100px;
  box-shadow: var(--shadow-toolbar);
  font-size: 13px; font-weight: 500;
  color: var(--mid);
  opacity: 0; transition: opacity .2s;
  pointer-events: none;
  z-index: 15;
}
.save-indicator.active { display: flex; opacity: 1; }
.save-indicator-spinner {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  animation: save-spin .8s linear infinite;
}
@keyframes save-spin { to { transform: rotate(360deg); } }
@media (max-width: 640px) {
  .save-indicator { left: 16px; padding: 8px 12px 8px 10px; }
  .save-indicator-text { display: none; }
}
.topbar-cart {
  position: relative;
  display: flex; align-items: center;
  color: var(--mid); background: transparent;
  border: none; cursor: pointer;
  transition: color .15s;
}
.topbar-cart:hover { color: var(--char); }
.cart-badge {
  position: absolute;
  top: -6px; right: -8px;
  min-width: 18px; height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--accent);
  color: white;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  box-shadow: 0 2px 6px rgba(255,64,19,0.35);
  pointer-events: none;
}

/* ═══ WALL VIEW ═══ */
.wall-view {
  position: fixed;
  top: var(--topbar-h); left: 0; right: 0; bottom: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  transition: opacity .3s, transform .3s;
}
.wall-view.hidden { opacity: 0; pointer-events: none; transform: scale(.97); }

/* Empty state */
.wall-empty { text-align: center; }
.wall-empty-btn {
  display: inline-flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 40px 56px; border-radius: 22px;
  border: 2px dashed var(--line);
  color: var(--mid);
  font-size: 16px; font-weight: 600;
  transition: border-color .2s, color .2s, background .2s;
}
.wall-empty-btn:hover {
  border-color: var(--accent); color: var(--char); background: white;
}
.wall-empty-hint {
  margin-top: 14px; font-size: 13px; color: var(--mid);
}

/* Wall scroll */
.wall-scroll {
  width: 100%;
  flex: 1;
  display: flex; align-items: center; justify-content: safe center;
  overflow-x: auto; overflow-y: hidden;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  padding: 0 48px;
}
.wall-scroll::-webkit-scrollbar { height: 6px; }
.wall-scroll::-webkit-scrollbar-track { background: transparent; }
.wall-scroll::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }
.wall-track {
  display: flex; align-items: center;
  gap: 32px;
  margin: 0 auto;
  padding: 24px 0;
}
/* Vertikální zarovnání obrazů na zdi */
.wall-track.align-top    { align-items: flex-start; }
.wall-track.align-center { align-items: center; }
.wall-track.align-bottom { align-items: flex-end; }

/* Zarovnání obrazů — sekce v popoveru pozadí (vlevo dole) */
.bg-align-section { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.bg-align-section .bg-popover-title { margin-bottom: 8px; }
.wall-align { display: flex; gap: 6px; }
.wall-align-btn {
  flex: 1; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: var(--paper); border: none; cursor: pointer; color: var(--char);
  transition: background .15s, color .15s, box-shadow .15s;
}
.wall-align-btn svg { width: 22px; height: 22px; }
.wall-align-btn:hover { background: var(--accent-light); color: var(--accent); }
.wall-align-btn.active { background: var(--accent-light); color: var(--accent); box-shadow: inset 0 0 0 2px var(--accent); }

/* Individual wall frame */
.wframe {
  position: relative;
  flex-shrink: 0;
  cursor: pointer;
  transition: transform .25s cubic-bezier(.22,1,.36,1);
}
.wframe:hover { transform: translateY(-6px); }
.wframe-inner {
  position: relative;
  overflow: hidden;
  border-radius: 2px;
  box-shadow: 0 0 6px 2px rgba(0, 0, 0, 0.26);
}
.wframe-inner img.wframe-img {
  display: block; width: 100%; height: 100%;
  position: relative; z-index: 2;
  pointer-events: none;
}
.wframe-mask {
  position: absolute; z-index: 1;
  overflow: hidden;
  background: #efe5cd;
}
.wframe-photo {
  position: absolute; inset: 0;
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  transform-origin: center center;
}
.wframe-okraj {
  position: absolute; z-index: 1; pointer-events: none;
}
.wframe-label {
  margin-top: 10px; text-align: center;
  font-size: 12px; color: var(--mid); font-weight: 500;
  white-space: nowrap;
}
/* Wall frame action buttons (delete, duplicate) */
.wframe-actions {
  position: absolute;
  top: -14px; left: 50%;
  transform: translateX(-50%);
  display: flex; gap: 6px;
  z-index: 6;
  opacity: 0;
  transition: opacity .15s;
}
.wframe:hover .wframe-actions { opacity: 1; }
@media (hover: none) {
  .wframe-actions { opacity: 1; }
}
.wframe-action {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: white;
  color: var(--char);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(40,25,12,.18), 0 2px 4px rgba(40,25,12,.08);
  transition: background .15s, color .15s, transform .15s;
  cursor: pointer;
  border: none;
  padding: 0;
}
.wframe-action svg { width: 16px; height: 16px; pointer-events: none; }
.wframe-action:hover { transform: translateY(-1px); }
.wframe-action[data-action="duplicate"]:hover { background: var(--accent-light); color: var(--accent); }
.wframe-action[data-action="delete"]:hover { background: #c83a2e; color: white; }

/* Indikátor nedostatečné kvality fotky pro vybraný rám */
.wframe-warning {
  position: absolute;
  top: -11px; right: -1px;
  z-index: 5;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: #f97316;
  color: white;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(40,25,12,.28), 0 0 0 2px rgba(255,255,255,.85);
  cursor: help;
  pointer-events: auto;
}
.wframe-warning svg { width: 14px; height: 14px; }

/* Wall add frame button (in track) */
.wframe-add {
  min-width: 140px; height: 200px;
  border-radius: 6px;
  border: 2px dashed var(--line);
  background: rgba(255,255,255,0.4);
  color: var(--accent);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px;
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .15s;
  flex-shrink: 0;
}
.wframe-add-wrap { flex-shrink: 0; display: flex; flex-direction: column; align-items: center; }
.wframe-add:hover { border-color: var(--accent); background: white; transform: translateY(-2px); }
.wframe-add-icon {
  width: 56px; height: 56px; border-radius: 50%;
  background: white;
  box-shadow: 0 2px 8px rgba(40,25,12,.12);
  display: flex; align-items: center; justify-content: center;
}
.wframe-add span {
  font-family: var(--font-display); font-style: italic; font-size: 14px; color: var(--mid);
}

/* ═══ WALL TOOLBAR (floating pill) ═══ */
.wall-toolbar {
  position: fixed;
  bottom: 10px; left: 50%; z-index: 100;
  transform: translateX(-50%);
  background: white;
  border-radius: 22px;
  box-shadow: var(--shadow-toolbar);
  padding: 14px;
  display: flex; align-items: center; gap: 6px;
}
.wtool {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 10px 18px; border-radius: 14px;
  color: var(--char);
  font-size: 12px; font-weight: 600;
  transition: background .15s;
  min-width: 68px;
}
.wtool svg { width: 22px; height: 22px; stroke-width: 1.6; }
.wtool:hover { background: var(--paper); }
.wtool.active { background: var(--accent-light); color: var(--accent); }
.wtool-divider {
  width: 1px; height: 38px;
  background: var(--line-soft);
  margin: 0 6px;
}
.wtool-upload {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 10px 8px; border-radius: 14px;
  color: var(--accent);
  font-size: 12px; font-weight: 600;
  min-width: 60px;
  background: transparent; border: none; cursor: pointer;
  transition: background .15s;
}
.wtool-upload svg { width: 22px; height: 22px; stroke-width: 1.6; }
.wtool-upload:hover { background: var(--accent-light); }
.wtool-cart {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 10px 18px; border-radius: 14px;
  color: #16a34a;
  font-size: 12px; font-weight: 600;
  min-width: 68px;
  background: transparent; border: none; cursor: pointer;
  transition: background .15s;
}
.wtool-cart svg { width: 22px; height: 22px; stroke-width: 1.6; }
.wtool-cart:hover { background: #dcfce7; }
.wtool-cart[disabled] { color: var(--mid); cursor: default; opacity: 0.5; }
.wtool-cart[disabled]:hover { background: transparent; }

/* Wall popovers */
.wpop {
  position: fixed;
  left: 50%; bottom: 132px; z-index: 105;
  transform: translateX(-50%) translateY(8px);
  opacity: 0; pointer-events: none;
  background: white;
  border-radius: 18px;
  box-shadow: var(--shadow-toolbar);
  padding: 22px 26px;
  max-width: calc(100vw - 32px);
  min-width: 300px;
  transition: opacity .2s, transform .2s;
}
.pop-close {
  position: absolute; top: 10px; right: 10px;
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--paper); color: var(--mid);
  transition: background .15s, color .15s;
  z-index: 1;
}
.pop-close:hover { background: var(--line); color: var(--char); }
.pop-close svg { display: block; width: 16px; height: 16px; }

/* Úchyt pro přesun popoveru (drag & drop za horní část) */
.pop-drag {
  position: absolute; top: 5px; left: 50%; transform: translateX(-50%);
  width: 46px; height: 16px;
  display: flex; align-items: center; justify-content: center;
  color: var(--mid); opacity: .55; cursor: grab; touch-action: none;
  border-radius: 7px; z-index: 2;
  transition: opacity .15s, background .15s;
}
.pop-drag:hover { opacity: 1; background: var(--paper); }
.pop-drag:active { cursor: grabbing; opacity: 1; }
.pop-drag svg { width: 20px; height: 12px; pointer-events: none; }

/* Zprůhlednění popoveru při zoomování fotky (ať nepřekáží ve výhledu) */
.epop.dimmed, .wpop.dimmed { opacity: .35 !important; }
.wpop.open {
  opacity: 1; pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}
.wpop-title {
  font-family: var(--font-display);
  font-size: 18px; font-style: italic; font-weight: 600;
  margin-bottom: 14px; color: var(--char);
}
.wpop-section { margin-bottom: 18px; }
.wpop-section:last-child { margin-bottom: 0; }
.wpop-label {
  font-size: 11px; font-weight: 600; color: var(--mid);
  text-transform: uppercase; letter-spacing: .05em;
  margin-bottom: 10px;
}

.wpop-card {
  min-width: 108px;
  padding: 14px 16px; border-radius: 14px;
  border: 1.5px solid transparent;
  background: var(--paper);
  display: flex; flex-direction: column; gap: 4px;
  text-align: center;
  transition: border-color .15s, transform .15s;
}
.wpop-card:hover { transform: translateY(-2px); }
.wpop-card.active { border-color: var(--accent); background: var(--accent-light); }
.wpop-card strong { font-family: var(--font-display); font-size: 16px; font-weight: 700; color: var(--char); }
.wpop-card span { font-size: 12px; color: var(--mid); font-weight: 500; }

.wpop-pill, .epop-pill {
  padding: 9px 16px; border-radius: 100px;
  font-size: 13px; font-weight: 600;
  color: var(--char);
  background: var(--paper);
  border: 1.5px solid transparent;
  transition: border-color .15s, background .15s, transform .1s;
}
.epop-pill--ico { display: inline-flex; align-items: center; gap: 6px; }
.epop-pill--ico svg { flex: none; }
.wpop-pill:hover, .epop-pill:hover { transform: translateY(-1px); }
.wpop-pill.active, .epop-pill.active { border-color: var(--accent); background: var(--accent-light); }

.wpop-orient {
  display: inline-flex; padding: 3px;
  background: var(--paper);
  border-radius: 100px;
  align-items: center;
}
.wpop-orient button {
  padding: 7px 13px; border-radius: 100px;
  font-size: 12px; font-weight: 600; color: var(--mid);
  background: transparent;
  display: inline-flex; align-items: center; gap: 6px;
  transition: background .15s, color .15s;
}
.wpop-orient button.active {
  background: white; color: var(--char);
  box-shadow: 0 1px 4px rgba(40,25,12,.10);
}

/* Effect picker (wall + edit popover) */
.effect-grid {
  display: flex; flex-wrap: wrap; gap: 10px;
}
.effect-card {
  display: flex; flex-direction: column; align-items: center;
  gap: 6px; padding: 4px;
  background: transparent;
  border: 2px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .15s;
}
.effect-card:hover { transform: translateY(-1px); }
.effect-card.active {
  border-color: var(--accent);
  background: var(--accent-light);
}
.effect-thumb {
  display: block;
  width: 56px; height: 56px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--paper);
}
.effect-thumb img {
  display: block; width: 100%; height: 100%;
  object-fit: cover;
  pointer-events: none;
}
.effect-name {
  font-size: 11px; font-weight: 600;
  color: var(--char);
  white-space: nowrap;
}

.okraj-dot {
  width: 36px; height: 36px;
  border-radius: 100px; padding: 3px;
  border: 2px solid transparent;
  transition: border-color .15s;
}
.okraj-dot span {
  display: block; width: 100%; height: 100%;
  border-radius: 100px;
  border: 1px solid var(--line);
}
.okraj-dot.active { border-color: var(--accent); }
.okraj-dot:hover { border-color: var(--mid); }
.okraj-barva-wrap.locked .okraj-dot {
  opacity: .35;
  pointer-events: none;
  cursor: not-allowed;
}
.okraj-barva-wrap.locked { cursor: not-allowed; }

/* ═══ EDIT VIEW ═══ */
.edit-view {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 200;
  background: var(--cream);
  display: flex; flex-direction: column;
  opacity: 0; pointer-events: none;
  transform: scale(1.02);
  transition: opacity .3s, transform .3s;
}
.edit-view.open {
  opacity: 1; pointer-events: auto;
  transform: scale(1);
}

.edit-top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px;
  flex-shrink: 0;
}
.edit-back {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 600; color: var(--mid);
  padding: 8px 14px; border-radius: 100px;
  transition: color .15s, background .15s;
}
.edit-back:hover { color: var(--char); background: var(--paper); }

/* Indikátor kvality tisku — nad fotkou v edit view */
.edit-quality {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 14px; border-radius: 100px;
  font-size: 13px; font-weight: 600;
  line-height: 1.3;
  max-width: 60%;
}
.edit-quality svg { width: 16px; height: 16px; flex-shrink: 0; }
.edit-quality--ok   { background: #dcfce7; color: #15803d; }
.edit-quality--warn { background: #ffedd5; color: #c2410c; }

/* Indikátor velikosti rámečku — přímo nad fotkou v edit view (stejný styl jako .wframe-label) */
.edit-frame-size {
  text-align: center;
  font-size: 12px; color: var(--mid); font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
  padding: 4px 12px 6px;
}
.edit-frame-size:empty { display: none; }

.edit-delete-tool {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 10px 18px; border-radius: 14px;
  color: #c83a2e;
  font-size: 12px; font-weight: 600;
  min-width: 68px;
  background: transparent; border: none; cursor: pointer;
  transition: background .15s;
}
.edit-delete-tool svg { width: 22px; height: 22px; stroke-width: 1.6; }
.edit-delete-tool:hover { background: rgba(200,58,46,.08); }

.edit-canvas-area {
  flex: 1 1 0;
  display: flex; align-items: center; justify-content: center;
  padding: 0 32px;
  /*overflow: hidden;*/
  min-height: 0;
  max-height: calc(100vh - 260px);
}
.edit-frame-wrap {
  position: relative;
  max-height: 100%; max-width: 100%;

  /*box-shadow: 0 0 6px 2px rgba(0, 0, 0, 0.26);*/
  box-shadow: var(--shadow-frame);
  border-radius: 2px;
}
.edit-frame-wrap .ef-inner {
  position: relative;
  overflow: hidden;
}
.edit-frame-wrap .ef-inner img {
  display: block; width: 100%; height: 100%;
  position: relative; z-index: 2;
  pointer-events: none;
}
.edit-frame-wrap .ef-mask {
  position: absolute; z-index: 1;
  overflow: hidden;
  background: #efe5cd;
}
.edit-frame-wrap .ef-photo {
  position: absolute; inset: 0;
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  transform-origin: center center;
  cursor: grab;
}
.edit-frame-wrap .ef-photo:active { cursor: grabbing; }
.edit-frame-wrap .ef-okraj {
  position: absolute; z-index: 1;
  pointer-events: none;
}

/* Edit controls (zoom + rotate — používá se v popoveru .epop[data-epop="fotka"]) */
.edit-slider-row {
  display: flex; align-items: center; gap: 12px;
  width: 100%; max-width: 360px;
  color: var(--mid);
}
.edit-slider-row input[type="range"] { flex: 1; }
.edit-btn-row {
  display: flex; gap: 10px;
}
.edit-action-btn {
  display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 14px;
  background: var(--paper);
  color: var(--char);
  transition: background .15s, transform .15s;
}
.edit-action-btn:hover { background: var(--accent-light); color: var(--accent); transform: translateY(-2px); }

/* Edit toolbar (floating pill) */
.edit-toolbar {
  position: fixed;
  bottom: 10px; left: 50%; z-index: 210;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 6px;
  padding: 14px;
  background: white;
  border-radius: 22px;
  box-shadow: var(--shadow-toolbar);
}
.etool {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 10px 18px; border-radius: 14px;
  color: var(--char);
  font-size: 12px; font-weight: 600;
  min-width: 68px;
  transition: background .15s;
}
.etool svg { width: 22px; height: 22px; stroke-width: 1.6; }
.etool:hover { background: var(--paper); }
.etool.active { background: var(--accent-light); color: var(--accent); }
.etool-divider {
  width: 1px; height: 38px;
  background: var(--line-soft);
  margin: 0 6px;
}
.edit-confirm-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 10px 18px; border-radius: 14px;
  color: #16a34a;
  font-size: 12px; font-weight: 600;
  min-width: 68px;
  background: transparent; border: none; cursor: pointer;
  transition: background .15s;
}
.edit-confirm-btn svg { width: 22px; height: 22px; stroke-width: 1.6; }
.edit-confirm-btn:hover { background: #dcfce7; }
.edit-confirm-btn[disabled] { color: var(--mid); cursor: default; }
.edit-confirm-btn[disabled]:hover { background: transparent; }

/* Edit popovers */
.epop {
  position: fixed;
  left: 50%; bottom: 140px; z-index: 210;
  transform: translateX(-50%) translateY(8px);
  opacity: 0; pointer-events: none;
  background: white;
  border-radius: 18px;
  box-shadow: var(--shadow-toolbar);
  padding: 22px 26px;
  max-width: calc(100vw - 32px);
  min-width: 300px;
  transition: opacity .2s, transform .2s;
}
.epop.open {
  opacity: 1; pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}
.epop--fotka { min-width: 380px; }
.epop-section { margin-bottom: 14px; }
.epop-section:last-child { margin-bottom: 0; }
.epop-label {
  font-size: 11px; font-weight: 600; color: var(--mid);
  text-transform: uppercase; letter-spacing: .05em;
  margin-bottom: 10px;
}
.epop-replace-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px; border-radius: 12px;
  background: var(--paper); color: var(--char);
  font-size: 13px; font-weight: 600;
  border: none; cursor: pointer;
  transition: background .15s, color .15s;
}
.epop-replace-btn:hover { background: var(--accent-light); color: var(--accent); }

.epop-card {
  min-width: 100px;
  padding: 12px 16px; border-radius: 14px;
  border: 1.5px solid transparent;
  background: var(--paper);
  display: flex; flex-direction: column; gap: 4px;
  text-align: center;
  transition: border-color .15s, transform .15s;
}
.epop-card:hover { transform: translateY(-2px); }
.epop-card.active { border-color: var(--accent); background: var(--accent-light); }
.epop-card strong { font-family: var(--font-display); font-size: 16px; font-weight: 700; color: var(--char); }
.epop-card span { font-size: 12px; color: var(--mid); }

.epop-orient {
  display: inline-flex; padding: 3px;
  background: var(--paper);
  border-radius: 100px;
}
.epop-orient button {
  padding: 7px 13px; border-radius: 100px;
  font-size: 12px; font-weight: 600; color: var(--mid);
  display: inline-flex; align-items: center; gap: 6px;
  transition: background .15s, color .15s;
}
.epop-orient button.active {
  background: white; color: var(--char);
  box-shadow: 0 1px 4px rgba(40,25,12,.10);
}

/* Frame swatches (edit Rám popover) */
.frame-swatch {
  overflow: hidden;
  width: 96px;
  display: flex; flex-direction: column; gap: 8px;
  align-items: center;
  padding: 0 0 10px;
  border-radius: 14px;
  border: 1.5px solid transparent;
  background: var(--paper);
  transition: border-color .15s, transform .15s;
}
.frame-swatch:hover { transform: translateY(-2px); }
.frame-swatch.active { border-color: var(--accent); background: var(--accent-light); }
.swatch {
  width: 100%;
  height: 100%;
  border-radius: 4px;
  object-fit: cover;
  display: block;
  box-shadow: 0 4px 10px -2px rgba(40,25,12,0.18);
}
.swatch-name { font-size: 13px; font-weight: 600; color: var(--char); }

/* ═══ MODALS ═══ */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(26,20,16,0.45);
  opacity: 0; pointer-events: none;
  transition: opacity .2s;
}
.modal-backdrop.open { opacity: 1; pointer-events: auto; }
.modal {
  position: fixed; top: 50%; left: 50%; z-index: 310;
  transform: translate(-50%, -50%);
  background: var(--cream);
  border-radius: 22px;
  padding: 36px 36px 32px;
  width: min(440px, calc(100vw - 32px));
  opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s;
  box-shadow: 0 30px 60px -20px rgba(40,25,12,0.4);
}
.modal.open { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%) scale(1); }
.modal-close {
  position: absolute; top: 14px; right: 14px;
  padding: 8px; border-radius: 50%; color: var(--mid);
  transition: background .15s;
}
.modal-close:hover { background: var(--paper); }
.modal-title {
  font-family: var(--font-display);
  font-size: 28px; font-weight: 700;
  color: var(--char); margin-bottom: 6px;
}
.modal-title em { font-style: italic; color: var(--accent); font-weight: 600; }
.modal-text { font-size: 14px; color: var(--mid); line-height: 1.55; margin-bottom: 20px; }
.modal-btn {
  flex: 1; padding: 12px 16px; border-radius: 14px;
  font-size: 14px; font-weight: 600;
  background: var(--paper); color: var(--char);
  transition: background .15s, transform .1s;
}
.modal-btn:hover { transform: translateY(-1px); }
.modal-btn.confirm { background: #c83a2e; color: white; }
.modal-btn.confirm:hover { background: #b0322a; }

/* Share modal */
.share-link-row {
  display: flex; align-items: center; gap: 6px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 100px;
  padding: 6px 6px 6px 16px;
  margin-bottom: 16px;
}
.share-link-row input {
  flex: 1; min-width: 0;
  border: none; background: transparent; outline: none;
  font-family: var(--font-body); font-size: 13px;
  color: var(--char);
}
.share-copy {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px;
  border-radius: 100px;
  background: var(--ink); color: var(--cream);
  font-size: 13px; font-weight: 600;
  transition: background .15s;
}
.share-copy:hover { background: var(--accent); }
.share-copy.copied { background: #2f7a4f; }
.share-icons { display: flex; gap: 8px; flex-wrap: wrap; }
.share-icons button {
  flex: 1;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 11px 12px;
  border-radius: 100px;
  border: 1px solid var(--line);
  background: white;
  font-size: 13px; font-weight: 500;
  color: var(--char);
  transition: background .15s, border-color .15s;
}
.share-icons button:hover { background: var(--paper); border-color: #d8ccaa; }

/* Share FAB */
.share-fab {
  position: fixed; right: 28px; top: 96px;
  background: white;
  border-radius: 100px;
  padding: 9px 16px 9px 12px;
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 600;
  color: var(--char);
  box-shadow: var(--shadow-toolbar);
  transition: transform .15s;
  z-index: 15;
}
.share-fab:hover { transform: translateY(-1px); }
.share-fab svg { color: var(--accent); }

/* Background color FAB (bottom-left) */
.bg-fab {
  position: fixed; left: 16px; bottom: 16px;
  width: 44px; height: 44px;
  background: white;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-toolbar);
  z-index: 50;
  transition: transform .15s;
  color: var(--char);
}
.bg-fab:hover { transform: translateY(-1px); }
.bg-fab svg { color: var(--accent); }

.bg-popover {
  position: fixed; left: 16px; bottom: 72px;
  background: white;
  border-radius: 18px;
  padding: 14px 16px;
  box-shadow: var(--shadow-toolbar);
  z-index: 55;
  opacity: 0; pointer-events: none;
  transform: translateY(8px);
  transition: opacity .2s, transform .2s;
  min-width: 200px;
}
.bg-popover.open { opacity: 1; pointer-events: auto; transform: translateY(0); }
.bg-popover-title {
  font-size: 11px; font-weight: 600; color: var(--mid);
  text-transform: uppercase; letter-spacing: 0.08em;
  margin-bottom: 10px;
}
.bg-swatches { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.bg-swatch {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 2px solid rgba(0,0,0,0.08);
  cursor: pointer;
  transition: transform .15s, border-color .15s;
  padding: 0;
}
.bg-swatch:hover { transform: scale(1.08); }
.bg-swatch.active { border-color: var(--accent); border-width: 3px; }

/* Vlastní fotka zdi */
.bg-photo-actions { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 6px; }
.bg-photo-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 12px; border-radius: 10px;
  background: var(--paper); color: var(--char);
  font-size: 13px; font-weight: 600;
  border: none; cursor: pointer; text-align: left;
  transition: background .15s, color .15s;
}
.bg-photo-btn:hover { background: var(--accent-light); color: var(--accent); }
.bg-photo-btn svg { flex: 0 0 auto; }
.bg-photo-remove { color: #c83a2e; }
.bg-photo-remove:hover { background: #fde8e6; color: #c83a2e; }

/* ═══ UPLOAD OVERLAY ═══ */
.upload-overlay {
  position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
  z-index: 400;
  background: rgba(250,246,237,.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center; justify-content: center;
}
.upload-overlay.visible { display: flex; }
.upload-inner { text-align: center; }
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  margin: 0 auto 14px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.upload-inner p { font-size: 15px; color: var(--char); font-weight: 500; }
.upload-progress {
  width: 220px; height: 4px;
  margin: 14px auto 0;
  background: rgba(0,0,0,.08);
  border-radius: 2px;
  overflow: hidden;
}
.upload-progress-bar {
  height: 100%; width: 0;
  background: var(--accent);
  border-radius: 2px;
  transition: width .15s ease;
}

/* ═══ DRAG OVER ═══ */
.wall-view.dragover::after {
  content: 'Pusťte fotku kamkoliv';
  position: fixed;
  top: var(--topbar-h); left: 0; right: 0; bottom: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 22px; font-style: italic; font-weight: 600;
  color: var(--char);
  background: rgba(250,246,237,.88);
  border: 3px dashed var(--line);
  margin: 20px;
  border-radius: 22px;
  z-index: 10;
  pointer-events: none;
}
/* V editaci koláže: fotky se pustí do prázdných políček. */
.edit-view.dragover::after {
  content: 'Pusťte fotky do prázdných políček';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 22px; font-style: italic; font-weight: 600;
  color: var(--char);
  background: rgba(250,246,237,.88);
  border: 3px dashed var(--accent);
  margin: 20px;
  border-radius: 22px;
  z-index: 205;
  pointer-events: none;
}

/* ═══ MOBILE ═══ */
@media (max-width: 720px) {
  .topbar { padding: 0 20px; }
  .topbar-back { display: none; }
  .wall-scroll { padding: 0 24px; }
  .wall-track { gap: 20px; }

  /* Toolbary — vždy vejdou na displej; pokud ne, horizontální swipe scroll */
  .wall-toolbar, .edit-toolbar {
    bottom: 10px; padding: 6px 8px; border-radius: 18px;
    gap: 2px;
    max-width: calc(100vw - 12px);
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .wall-toolbar::-webkit-scrollbar, .edit-toolbar::-webkit-scrollbar { display: none; }
  .edit-toolbar { margin: 0 12px 14px; }
  .wtool, .wtool-upload, .wtool-cart, .wtool-divider,
  .etool, .edit-delete-tool, .edit-confirm-btn, .etool-divider { flex-shrink: 0; }
  .wtool-divider, .etool-divider { margin: 0 2px; }

  .edit-quality { font-size: 11px; padding: 5px 10px; gap: 5px; max-width: 60%; }
  .edit-quality svg { width: 13px; height: 13px; }

  .edit-frame-size { font-size: 11px; padding: 2px 10px 4px; }

  .wtool, .wtool-upload, .wtool-cart { padding: 6px 8px; min-width: 48px; font-size: 11px; gap: 2px; }
  .wtool svg, .wtool-upload svg, .wtool-cart svg { width: 18px; height: 18px; }
  .wtool-upload span {
    display: inline-block;
    max-width: 40px;
    white-space: normal;
    line-height: 1;
    text-align: center;
  }
  .etool, .edit-delete-tool, .edit-confirm-btn { padding: 6px 8px; min-width: 48px; font-size: 11px; gap: 2px; }
  .etool svg, .edit-delete-tool svg, .edit-confirm-btn svg { width: 18px; height: 18px; }

  /* Sdílet — zrcadlově k 3+1 ZDARMA (stejný top, stejná vzdálenost od kraje) */
  .share-fab {
    right: 12px;
    top: calc(var(--topbar-h) + 10px);
  }
  .edit-slider-row { max-width: 280px; }
  .wpop, .epop { min-width: 280px; max-width: calc(100vw - 24px); padding: 18px 20px; }
}

@media (min-width: 721px) {
  .wall-track { gap: 40px; }

  /* Posunout edit view nahoru — fotka i ovládací prvky výš, větší odstup od dolního toolbaru */
  .edit-canvas-area { max-height: calc(100vh - 340px); }
}

/* ═══════════════════ KOLÁŽE ═══════════════════ */

/* Prázdný stav — výběr typu (Fotoobraz / Koláž) */
.empty-choose { display: flex; gap: 20px; justify-content: center; flex-wrap: wrap; }
.empty-card {
  width: 220px; max-width: 42vw; min-width: 150px;
  background: white;
  border: 1.5px solid var(--line);
  border-radius: 20px;
  padding: 28px 22px;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  cursor: pointer;
  transition: border-color .18s, transform .18s, box-shadow .18s;
}
.empty-card:hover { border-color: var(--accent); transform: translateY(-3px); box-shadow: var(--shadow-frame); }
.empty-card-ill {
  width: 84px; height: 84px; border-radius: 16px;
  background: var(--paper);
  display: flex; align-items: center; justify-content: center;
}
.empty-card-ill svg { width: 42px; height: 42px; stroke: var(--accent); }
.empty-card-grid { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 5px; width: 42px; height: 42px; }
.empty-card-grid i { background: var(--accent); border-radius: 2px; }
.empty-card strong { font-family: var(--font-display); font-size: 18px; color: var(--char); font-weight: 700; font-style: italic; }
.empty-card small { font-size: 12.5px; color: var(--mid); }
@media (max-width: 520px) { .empty-card { padding: 20px 16px; } .empty-card-ill { width: 68px; height: 68px; } }

/* Dropdown „Nový rámeček" */
.new-frame-pop {
  position: fixed; z-index: 130;
  background: white; border-radius: 16px;
  box-shadow: var(--shadow-toolbar);
  padding: 8px; width: 248px;
  opacity: 0; pointer-events: none;
  transform: translateY(6px);
  transition: opacity .16s, transform .16s;
}
.new-frame-pop.open { opacity: 1; pointer-events: auto; transform: translateY(0); }
.nf-item {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 12px; border-radius: 12px;
  background: transparent; border: none; cursor: pointer; text-align: left;
  transition: background .15s;
}
.nf-item:hover { background: var(--paper); }
.nf-pic { width: 42px; height: 42px; border-radius: 10px; background: var(--paper); display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.nf-item:hover .nf-pic { background: white; }
.nf-pic svg { width: 22px; height: 22px; stroke: var(--accent); }
.nf-txt b { display: block; font-size: 14px; color: var(--char); }
.nf-txt small { font-size: 11.5px; color: var(--mid); }

/* Buňky koláže — sdílené zdí i editací */
.kz-bg { position: absolute; z-index: 1; pointer-events: none; }
.kz-cell { position: absolute; z-index: 1; overflow: hidden; background: #efe5cd; }
.kz-cell-photo {
  position: absolute; inset: 0;
  background-size: contain; background-position: center; background-repeat: no-repeat;
  transform-origin: center center;
}
.kz-cell-empty {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: #ece3cf; color: var(--mid);
}
.kz-cell-empty svg { width: 28px; height: 28px; opacity: .5; }
.edit-frame-wrap .kz-cell { cursor: pointer; }
/* Výrazný focus vybrané buňky: vystoupí nad sousedy (kruhový akcentový lem +
   záře) a navíc dostane vnitřní rámeček nad fotkou. */
.edit-frame-wrap .kz-cell.selected {
  z-index: 4;
  box-shadow: 0 0 0 1.5px var(--accent), 0 4px 12px 0 rgba(255, 64, 19, .35);
}
.edit-frame-wrap .kz-cell.selected::after {
  content: ""; position: absolute; inset: 0; z-index: 5;
  border: 2px dashed var(--accent);
  pointer-events: none;
}
.edit-frame-wrap .kz-cell.selected .kz-cell-photo { cursor: grab; }

/* Ikonka přemístění fotky do jiného políčka (vpravo nahoře ve vybrané buňce) */
.kz-move {
  position: absolute; top: 5px; right: 5px; z-index: 6;
  width: 28px; height: 28px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: #fff; border: none;
  cursor: grab; touch-action: none;
  box-shadow: 0 2px 8px rgba(40,25,12,.35);
}
.kz-move:active { cursor: grabbing; }
.kz-move svg { width: 16px; height: 16px; pointer-events: none; }
/* Cílová buňka pod kurzorem při přetahování */
.edit-frame-wrap .kz-cell.kz-drop { z-index: 3; outline: 3px dashed var(--accent); outline-offset: -3px; }
.edit-frame-wrap .kz-cell.kz-drop::before {
  content: ""; position: absolute; inset: 0; z-index: 4;
  background: rgba(255, 64, 19, .18);
}
/* Plovoucí náhled tažené fotky */
.kz-move-ghost {
  position: fixed; z-index: 9999;
  width: 84px; height: 84px;
  transform: translate(-50%, -50%);
  background-size: cover; background-position: center;
  border-radius: 8px; border: 2px solid #fff;
  box-shadow: 0 10px 28px rgba(0,0,0,.45);
  opacity: .92; pointer-events: none;
}
body.kz-moving { cursor: grabbing; user-select: none; }
.edit-frame-wrap .kz-cell.selected .kz-cell-photo:active { cursor: grabbing; }

/* Popover Rozložení — mřížka variant */
.layout-grid { display: flex; flex-wrap: wrap; gap: 10px; max-width: 320px; }
.layout-card {
  padding: 6px; border: 2px solid transparent; border-radius: 10px;
  background: var(--paper); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: border-color .15s, transform .15s;
}
.layout-card:hover { transform: translateY(-2px); }
.layout-card.active { border-color: var(--accent); background: var(--accent-light); }
.layout-mini { position: relative; display: block; background: var(--char); border-radius: 2px; }
.layout-card--vyska .layout-mini { width: 48px; height: 64px; }
.layout-card--sirka .layout-mini { width: 64px; height: 48px; }
.layout-card--ctverec .layout-mini { width: 56px; height: 56px; }
.layout-mini i { position: absolute; background: #d8cdb4; border: 0.5px solid var(--char); box-sizing: border-box; }

/* Odebrat fotku — varovná varianta replace tlačítka */
.epop-remove-btn { margin-top: 8px; color: #c83a2e; }
.epop-remove-btn:hover { background: #fde8e6; color: #c83a2e; }

/* Zakázaný nástroj v edit toolbaru (např. „Fotka" bez vybrané buňky) */
.etool.disabled { opacity: .4; pointer-events: none; }

/* Na mobilu zkrátit popisky tlačítek fotky: „Změnit fotku" → „Změnit" apod. */
@media (max-width: 720px) {
  .kz-optword { display: none; }
}
