:root {
  --purple: #440099;
  --cyan:   #4CC9F0;
  --pink:   #F72585;
  --cream:  #EFEAE5;
  --ink:    #17032e;
  --line:   #dcd4c9;
  --white:  #ffffff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Montserrat", system-ui, -apple-system, sans-serif;
  background: var(--cream);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

.app {
  display: grid;
  grid-template-columns: 420px 1fr;
  min-height: 100vh;
}

/* ---------- Ovládací panel ---------- */
.panel {
  background: var(--white);
  border-right: 1px solid var(--line);
  padding: 28px 26px 60px;
  overflow-y: auto;
  max-height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}
.brand img { height: 30px; }
.brand .tag {
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--purple);
  font-weight: 700;
}
.subtitle { font-size: 13px; color: #6b6257; margin: 2px 0 24px; }

.field { margin-bottom: 18px; }
.field > label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .02em;
  margin-bottom: 7px;
  text-transform: uppercase;
  color: #4a4238;
}
.hint { font-size: 11.5px; color: #948a7d; margin: 5px 0 0; line-height: 1.4; }

input[type=text], textarea, select {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 11px 13px;
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  background: #fbfaf8;
  resize: vertical;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--purple); }
textarea { min-height: 84px; line-height: 1.45; }

/* Dropzone */
.drop {
  border: 2px dashed var(--line);
  border-radius: 12px;
  padding: 22px;
  text-align: center;
  cursor: pointer;
  transition: .15s;
  background: #fbfaf8;
  font-size: 13px;
  color: #7a7264;
}
.drop:hover, .drop.over { border-color: var(--purple); background: #f6f1ff; color: var(--purple); }
.drop.has-image { padding: 10px; border-style: solid; }
.drop img { max-height: 120px; max-width: 100%; border-radius: 8px; display: block; margin: 0 auto; }
.drop input { display: none; }

/* Segmentové přepínače (barva / logo) */
.seg { display: flex; gap: 6px; }
.seg button {
  flex: 1;
  border: 1.5px solid var(--line);
  background: #fbfaf8;
  border-radius: 9px;
  padding: 9px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}
.seg button .dot { width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(0,0,0,.15); }
.seg button.active { border-color: var(--purple); background: #f6f1ff; color: var(--purple); }


.generate {
  width: 100%; border: none; background: var(--pink); color: #fff;
  padding: 15px; border-radius: 12px; font-family: inherit; font-size: 15px; font-weight: 700;
  cursor: pointer; margin-top: 6px; letter-spacing: .01em;
  transition: .15s; box-shadow: 0 6px 18px rgba(247,37,133,.28);
}
.generate:hover { filter: brightness(1.05); }
.generate:disabled { opacity: .55; cursor: default; box-shadow: none; }

.download {
  width: 100%; border: 1.5px solid var(--purple); background: #fff; color: var(--purple);
  padding: 13px; border-radius: 12px; font-family: inherit; font-size: 14px; font-weight: 700;
  cursor: pointer; margin-top: 10px; display: none;
}
.download.show { display: block; }

.status { font-size: 12.5px; color: #7a7264; margin-top: 12px; text-align: center; min-height: 16px; }

/* ---------- Náhled ---------- */
.stage {
  display: grid;
  place-items: center;
  padding: 40px;
  background:
    radial-gradient(circle at 20% 20%, rgba(68,0,153,.06), transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(76,201,240,.10), transparent 45%),
    var(--cream);
}
.canvas-wrap {
  position: relative;
  background: #fff;
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 20px 60px rgba(30,10,60,.14);
  max-height: 84vh;
  display: grid;
  place-items: center;
}

/* Editor umístění fotky – rámeček s úchyty v rozích */
.crop {
  position: absolute;
  border: 2px dashed rgba(68,0,153,.95);
  box-shadow: 0 0 0 1px rgba(255,255,255,.6) inset;
  cursor: move;
  touch-action: none;
  z-index: 5;
}
.crop.hidden { display: none; }
.handle {
  position: absolute;
  width: 20px; height: 20px;
  background: #fff;
  border: 3px solid var(--purple);
  border-radius: 5px;
  box-shadow: 0 1px 5px rgba(0,0,0,.35);
  touch-action: none;
}
.handle.tl { left: -11px; top: -11px; cursor: nwse-resize; }
.handle.tr { right: -11px; top: -11px; cursor: nesw-resize; }
.handle.bl { left: -11px; bottom: -11px; cursor: nesw-resize; }
.handle.br { right: -11px; bottom: -11px; cursor: nwse-resize; }
#preview { touch-action: none; }

.posctrl {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 9px;
}
.posctrl .hint { margin: 0; flex: 1; }
.posctrl .reset {
  flex: none;
  border: 1.5px solid var(--line);
  background: #fbfaf8;
  border-radius: 8px;
  padding: 7px 11px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--purple);
  cursor: pointer;
}
.posctrl .reset:hover { border-color: var(--purple); }
.canvas-wrap.transparent-bg {
  background:
    linear-gradient(45deg,#e7ddcf 25%,transparent 25%,transparent 75%,#e7ddcf 75%) 0 0/22px 22px,
    linear-gradient(45deg,#e7ddcf 25%,#f6f1e9 25%,#f6f1e9 75%,#e7ddcf 75%) 11px 11px/22px 22px;
}
#preview { max-height: 78vh; max-width: 100%; border-radius: 6px; display: block; }

.hidden { display: none !important; }

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .panel { max-height: none; border-right: none; border-bottom: 1px solid var(--line); }
  .stage { padding: 22px; }
}

.weblink {
  display: flex;
  justify-content: center;
  align-items: center;
  text-decoration: none;
  width: 100%;
  background: var(--purple);
  color: var(--white);
  padding: 15px;
  border-radius: 12px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  margin-top: 6px;
  letter-spacing: .01em;
  transition: .15s;
  box-shadow: 0 6px 18px var(--purple);
}

.weblink:hover {
  filter: brightness(1.25);
}