:root {
  --pink: #D25B73;
  --pink-dark: #a8445a;
  --black: #0d0d0e;
  --white: #f5f1f2;
  --grey: #9a9496;
  --graffiti: 'Sedgwick Ave Display', cursive;
  --drip: 'Rubik Wet Paint', 'Anton', sans-serif;
  --block: 'Anton', 'Impact', sans-serif;
  --body: 'Barlow Condensed', 'Arial Narrow', sans-serif;
}

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

body {
  background: #0e0d0f;
  color: var(--white);
  font-family: var(--body);
  min-height: 100vh;
}

/* ---------- editor toolbar ---------- */
.toolbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  padding: 12px 24px;
  background: rgba(14, 13, 15, .92); backdrop-filter: blur(10px); border-bottom: 1px solid #2c2930;
}
.toolbar h1 { font-family: var(--block); font-weight: 400; font-size: 22px; letter-spacing: 1px; text-transform: uppercase; margin-right: auto; display: flex; align-items: center; }
.toolbar h1 a { display: inline-grid; place-items: center; width: 36px; height: 36px; margin-right: 12px; border: 1px solid #3b3740; border-radius: 8px;
  color: var(--grey); text-decoration: none; font-family: var(--body); font-size: 20px; transition: border-color .12s, color .12s; }
.toolbar h1 a:hover { border-color: var(--pink); color: var(--white); }
.toolbar button, .toolbar select {
  height: 40px; font-family: var(--body); font-weight: 700; font-size: 16px; letter-spacing: .5px;
  padding: 0 16px; border-radius: 8px; border: 1px solid #3b3740;
  background: #1f1d22; color: var(--white); cursor: pointer; transition: border-color .12s, background .12s;
}
.toolbar select { padding: 0 10px; max-width: 260px; color-scheme: dark; }
.toolbar button:hover, .toolbar select:hover { border-color: var(--pink); }
.toolbar button.primary { background: var(--pink); border-color: var(--pink); color: #fff; }
.toolbar button.primary:hover { filter: brightness(1.1); }

.workspace { padding: 24px 16px 48px; display: flex; justify-content: center; }
body.embed { background: #0d0d0e; overflow: hidden; }
body.embed .toolbar, body.embed .edit-only, body.embed .actionbar { display: none !important; }
body.embed .workspace { padding: 0; display: block; }
.stage { position: relative; }
.stage-inner { transform-origin: top left; }

/* ---------- poster ---------- */
.poster {
  position: relative; overflow: hidden;
  width: 1080px; height: 1350px;
  background-color: var(--black);
  background-size: cover;
  color: var(--white);
  font-family: var(--body);
}
.poster > * { position: absolute; }

[contenteditable] { outline: none; cursor: text; }
body:not(.exporting) [contenteditable]:hover { outline: 2px dashed rgba(210, 91, 115, .7); outline-offset: 4px; }
body:not(.exporting) [contenteditable]:focus { outline: 2px solid var(--pink); outline-offset: 4px; }
body.exporting .edit-only { display: none !important; }

.fit { white-space: nowrap; }

/* photo / logo slots */
.photo { overflow: hidden; cursor: pointer; }
.photo img { position: absolute; max-width: none; user-select: none; -webkit-user-drag: none; }
.photo.has-img { cursor: grab; }
.photo.dragging { cursor: grabbing; }
.photo .ph {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  border: 3px dashed rgba(210, 91, 115, .6);
  background: rgba(255, 255, 255, .03);
  color: rgba(245, 241, 242, .55);
  font-family: var(--body); font-weight: 700; font-size: 26px; letter-spacing: 1px; text-transform: uppercase;
  text-align: center; padding: 10px;
}
.photo .ph b { font-size: 60px; line-height: 1; color: var(--pink); }
.photo.has-img .ph { display: none; }
/* "Gostujemo": MSZ ide desno, protivnik levo */
.poster.away .team.home { left: auto; right: 60px; }
.poster.away .team.away { right: auto; left: 60px; }

.toolbar label.toggle {
  display: flex; align-items: center; gap: 8px; height: 40px; cursor: pointer; user-select: none;
  font-weight: 700; font-size: 16px; letter-spacing: .5px;
  padding: 0 14px; border-radius: 8px; border: 1px solid #3b3740; background: #1f1d22;
}
.toolbar label.toggle input { width: 16px; height: 16px; accent-color: var(--pink); cursor: pointer; }
.toolbar label.toggle:has(input:checked) { background: var(--pink); border-color: var(--pink); }

.photo .del {
  display: none; position: absolute; z-index: 20; top: 14px; right: 14px;
  width: 64px; height: 64px; border-radius: 50%; border: 3px solid var(--white);
  background: var(--pink); color: var(--white); font: 700 46px/1 var(--body); cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .6);
}
.photo.has-img .del { display: block; opacity: 0; transition: opacity .15s; }
.photo.has-img:hover .del { opacity: 1; }
.photo .del:hover { filter: brightness(1.15); }
body:not(.exporting) .photo.has-img:hover { outline: 2px dashed rgba(210, 91, 115, .7); outline-offset: -2px; }

/* shared pieces */
.topbar { left: 60px; right: 60px; top: 48px; height: 90px; display: flex; align-items: center; justify-content: space-between; }
.topbar .club { display: flex; align-items: center; gap: 18px; }
.topbar .club img { height: 78px; }
.topbar .club span { font-family: var(--block); font-size: 40px; letter-spacing: 2px; }
.topbar .league { font-family: var(--body); font-weight: 700; font-size: 28px; letter-spacing: 3px; text-transform: uppercase; color: var(--white); text-align: right; }
.topbar .league em { font-style: normal; color: var(--pink); }

.footer { left: 60px; right: 60px; bottom: 44px; display: flex; justify-content: space-between; align-items: center;
  font-family: var(--body); font-weight: 700; font-size: 26px; letter-spacing: 3px; text-transform: uppercase; color: var(--grey); }
.footer .liga-logo { height: 76px; margin: -20px 0; }
.footer .tag { color: var(--pink); text-shadow: 0 2px 8px #000, 0 0 3px #000; }

.graffiti { font-family: var(--graffiti); text-transform: uppercase; color: var(--pink); line-height: .9; text-shadow: 0 6px 0 rgba(0, 0, 0, .55); }
.block { font-family: var(--block); line-height: 1; }
.label { font-family: var(--body); font-weight: 700; text-transform: uppercase; letter-spacing: 3px; }

/* ---------- opis za Instagram i predlog pesme (pored posta) ---------- */
body.has-opis .workspace { align-items: flex-start; gap: 24px; }
.opis { width: 400px; flex: none; display: flex; flex-direction: column; gap: 16px; font-family: var(--body); }
.op-card { background: #17161a; border: 1px solid #2c2930; border-radius: 12px; padding: 16px 18px 18px; }
.op-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.op-head h2 { font-family: var(--block); font-weight: 400; font-size: 19px; letter-spacing: 1px; text-transform: uppercase; margin-right: auto; }
.op-state { font-weight: 700; font-size: 13px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--grey); }
.opis button { height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid #3b3740; background: #1f1d22; color: var(--white);
  font-family: var(--body); font-weight: 700; font-size: 15px; letter-spacing: .5px; cursor: pointer; transition: border-color .12s; }
.opis button:hover { border-color: var(--pink); }
.opis button.primary { background: var(--pink); border-color: var(--pink); color: #fff; }
.opis textarea { width: 100%; min-height: 220px; resize: vertical; background: #1f1d22; color: var(--white); border: 1px solid #3b3740; border-radius: 8px;
  padding: 12px 14px; font-family: system-ui, -apple-system, 'Segoe UI', sans-serif; font-size: 14.5px; line-height: 1.5; color-scheme: dark; }
.opis textarea:focus { outline: none; border-color: var(--pink); }
.op-btns { display: flex; gap: 8px; margin-top: 10px; }
.op-hint { margin-top: 10px; font-size: 14px; color: var(--grey); }
.op-hint b { color: var(--white); }
.songs { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.songs li { display: grid; grid-template-columns: 1fr; padding: 10px 12px; border-radius: 8px; background: #1f1d22; border: 1px solid #2c2930; cursor: pointer; transition: border-color .12s; }
.songs li:hover { border-color: var(--pink); }
.songs li.ok { border-color: var(--pink); background: rgba(210, 91, 115, .14); }
.songs li b { font-size: 14px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--grey); }
.songs li span { font-weight: 700; font-size: 19px; }
.songs li i { font-style: normal; font-size: 14px; color: var(--pink); }
body.embed .opis { display: none; }
@media (max-width: 1099px) {
  body.has-opis .workspace { flex-direction: column; align-items: center; }
  .opis { width: 100%; max-width: 640px; }
}

/* ---------- telefon ---------- */
.actionbar { display: contents; }
.toast { position: fixed; left: 50%; bottom: 96px; z-index: 10000; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 10px; background: #f3eff0; color: #0e0d0f;
  font-family: var(--body); font-weight: 700; font-size: 16px; text-align: center; box-shadow: 0 6px 24px rgba(0, 0, 0, .5); transition: opacity .2s, transform .2s; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.photo.has-img { touch-action: none; }
@media (hover: none) {
  /* nema "hover" na telefonu: dugme za brisanje slike se uvek vidi, i vece je */
  .photo.has-img .del { opacity: 1; width: 96px; height: 96px; font-size: 66px; }
  .toolbar button:hover, .toolbar select:hover { border-color: #3b3740; }
  .toolbar button.primary:hover { border-color: var(--pink); }
}
@media (max-width: 700px) {
  .toolbar { position: static; backdrop-filter: none; background: #0e0d0f; padding: 10px 12px; gap: 8px; }
  .toolbar h1 { width: 100%; font-size: 20px; }
  .toolbar h1 a { width: 38px; height: 38px; margin-right: 10px; }
  .toolbar select { flex: 1 1 150px; max-width: none; min-width: 0; height: 44px; font-size: 16px; }
  .toolbar label.toggle { height: 44px; }
  .toolbar #reset { height: 44px; }
  /* glavna dugmad uvek pri dnu ekrana */
  .actionbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; display: flex; gap: 8px;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: rgba(14, 13, 15, .96); border-top: 1px solid #2c2930; }
  .actionbar button { flex: 1; height: 50px; font-size: 18px; }
  .actionbar #share { flex: 1.6; }
  .workspace { padding: 14px 12px calc(96px + env(safe-area-inset-bottom)); }
  body .sy { bottom: calc(84px + env(safe-area-inset-bottom)); right: 12px; }
  .opis { gap: 12px; }
  .op-card { padding: 14px; }
  .opis textarea { font-size: 16px; }
  .op-btns button { flex: 1; height: 44px; }
}
