@font-face {
  font-family: 'Vazirmatn';
  src: url('../assets/fonts/Vazirmatn-Medium.woff2') format('woff2');
  font-weight: 500; font-display: block;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('../assets/fonts/Vazirmatn-Bold.woff2') format('woff2');
  font-weight: 700; font-display: block;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('../assets/fonts/Vazirmatn-Black.woff2') format('woff2');
  font-weight: 900; font-display: block;
}

:root {
  --bg: #16181d;
  --panel: #1e2128;
  --card: #23262e;
  --line: #32363f;
  --text: #eceef2;
  --muted: #9aa1af;
  --gold: #b08d55;
  --gold-hi: #cba869;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  font-weight: 500;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.topbar h1 { font-size: 17px; font-weight: 700; margin: 0; }

.formats { display: flex; gap: 8px; }
.formats button {
  font: inherit; font-weight: 700; font-size: 13px;
  padding: 8px 16px; border-radius: 10px; cursor: pointer;
  background: transparent; color: var(--muted);
  border: 1px solid var(--line);
}
.formats button.active { background: var(--gold); border-color: var(--gold); color: #fff; }

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  gap: 22px;
  padding: 22px;
  align-items: start;
}

.stage { display: flex; flex-direction: column; align-items: center; gap: 12px; }

.canvas-wrap { position: relative; }

#preview {
  display: block;
  max-height: calc(100vh - 200px);
  max-width: 100%;
  border-radius: 10px;
  background: #2a2d34;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
  touch-action: none;
  cursor: grab;
}
#preview.dragging { cursor: grabbing; }

.hint {
  position: absolute; inset-inline: 0; bottom: -26px;
  text-align: center; font-size: 12px; color: var(--muted);
}

.stage-tools { display: flex; gap: 8px; margin-top: 18px; }

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

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
}
.card-title {
  display: flex; align-items: center; justify-content: space-between;
  font-weight: 700; font-size: 14px; margin-bottom: 10px;
}

.dropzone {
  border: 1.5px dashed var(--line);
  border-radius: 12px;
  padding: 24px 12px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.dropzone:hover, .dropzone.over {
  border-color: var(--gold); color: var(--gold-hi); background: rgba(176,141,85,0.07);
}

.field-list { display: flex; flex-direction: column; gap: 8px; }

.field-row {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr) auto;
  gap: 6px; align-items: center;
}
.field-row input {
  font: inherit; font-size: 13px;
  width: 100%; min-width: 0;
  padding: 8px 10px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #1a1d23;
  color: var(--text);
}
.field-row input:focus { outline: none; border-color: var(--gold); }
.field-row input.label-input { color: var(--gold-hi); font-size: 12px; }

.row-tools { display: flex; gap: 2px; }
.icon-btn {
  font: inherit; font-size: 13px; line-height: 1;
  width: 26px; height: 30px;
  border: 1px solid var(--line); border-radius: 8px;
  background: transparent; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { color: var(--text); border-color: var(--gold); }
.icon-btn.on { background: var(--gold); border-color: var(--gold); color: #fff; }

.note { font-size: 11.5px; color: var(--muted); margin: 10px 0 0; line-height: 1.7; }

.actions { display: flex; flex-direction: column; gap: 8px; }

.btn {
  font: inherit; font-weight: 700; font-size: 13.5px;
  padding: 11px 16px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--line);
  background: #2b2f38; color: var(--text);
}
.btn:hover { border-color: var(--gold); }
.btn.primary { background: var(--gold); border-color: var(--gold); color: #fff; }
.btn.primary:hover { background: var(--gold-hi); }
.btn.ghost { background: transparent; }
.btn.danger:hover { border-color: #b4534b; color: #e08a82; }
.btn.tiny { padding: 5px 10px; font-size: 12px; }

.status { font-size: 12px; color: var(--muted); text-align: center; min-height: 18px; margin: 0; }
.status.error { color: #e08a82; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  #preview { max-height: 60vh; }
  .panel { order: 2; }
}
