* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: #0f1115;
  color: #e6e8ec;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: #171a21;
  border-bottom: 1px solid #262b36;
}

.header-actions { display: flex; gap: 10px; }

h1 { font-size: 20px; margin: 0; }
h2 { font-size: 15px; margin: 0 0 12px; color: #9aa3b2; text-transform: uppercase; letter-spacing: .05em; }

section { padding: 20px 24px; }

.bar, .upload { background: #171a21; border-bottom: 1px solid #262b36; }

.links label { display: block; font-size: 13px; color: #9aa3b2; margin-bottom: 6px; }

.copy-row { display: flex; gap: 8px; }

input[type=text], input[type=file], input[type=number], textarea, select {
  background: #0f1115;
  border: 1px solid #2d3340;
  color: #e6e8ec;
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 14px;
  font-family: inherit;
}

input[type=text] { flex: 1; min-width: 0; }
input[type=color] {
  width: 44px; height: 40px; padding: 2px;
  border: 1px solid #2d3340; border-radius: 8px; background: #0f1115;
}

#uploadForm { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.btn {
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  color: #fff;
}

.btn-add { background: #2563eb; }
.btn-copy { background: #374151; }
.btn-stop { background: #dc2626; }
.btn-mini { background: #374151; }
.btn-del { background: #7f1d1d; }
.btn:hover { filter: brightness(1.1); }

.msg { font-size: 13px; color: #9aa3b2; margin: 10px 0 0; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 14px;
}

.card {
  background: #171a21;
  border: 1px solid #262b36;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.pad {
  border: none;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  padding: 26px 10px;
  cursor: pointer;
  text-align: center;
  word-break: break-word;
}
.pad:active { filter: brightness(0.85); }
.pad .type { display: block; font-size: 11px; opacity: .7; font-weight: 500; margin-top: 4px; }

.card-actions { padding: 10px; display: flex; gap: 6px; }
.card-actions .btn { flex: 1; padding: 7px; font-size: 12px; }

/* --- Modal --- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  overflow-y: auto;
  z-index: 50;
}
.modal-backdrop[hidden] { display: none; }

.modal {
  background: #171a21;
  border: 1px solid #2d3340;
  border-radius: 14px;
  padding: 24px;
  width: 100%;
  max-width: 440px;
}
.modal h2 { color: #e6e8ec; }

.field { margin-bottom: 14px; }
.field > label {
  display: block;
  font-size: 13px;
  color: #9aa3b2;
  margin-bottom: 6px;
}
.field input[type=text],
.field input[type=number],
.field textarea,
.field select { width: 100%; }
.field input[type=range] { width: 100%; }

label.inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #9aa3b2;
  margin-left: 10px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

/* --- Positions-Editor (720x1280-Vorschau) --- */
.pos-canvas {
  position: relative;
  width: 200px;
  aspect-ratio: 720 / 1280;
  margin: 0 auto;
  background: #0f1115;
  border: 1px solid #2d3340;
  border-radius: 8px;
  overflow: hidden;
  touch-action: none;
  cursor: crosshair;
}

.safe-zone {
  position: absolute;
  pointer-events: none;
  background: repeating-linear-gradient(
    45deg,
    rgba(220, 38, 38, 0.18) 0 5px,
    transparent 5px 10px
  );
}
.safe-top    { top: 0; left: 0; right: 0; height: 11%; }
.safe-bottom { bottom: 0; left: 0; right: 0; height: 20%; }
.safe-right  { top: 11%; bottom: 20%; right: 0; width: 14%; }

.pos-el {
  position: absolute;
  transform: translate(-50%, -50%);
  min-width: 22px;
  min-height: 16px;
  max-width: 100%;
  outline: 2px solid #2563eb;
  outline-offset: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
}
.pos-el img, .pos-el video { display: block; width: 100%; height: auto; }
.pos-el .pos-text {
  white-space: pre-wrap;
  text-align: center;
  line-height: 1.2;
  font-weight: 800;
  padding: 2px 4px;
}
.pos-el .pos-label {
  font-size: 10px;
  color: #fff;
  background: #2563eb;
  padding: 6px 8px;
  border-radius: 4px;
  white-space: nowrap;
}

.pos-presets {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  width: 96px;
  margin: 10px auto 0;
}
.pos-presets button {
  aspect-ratio: 1;
  padding: 0;
  border: 1px solid #2d3340;
  background: #0f1115;
  border-radius: 4px;
  cursor: pointer;
}
.pos-presets button:hover { background: #2563eb; }

.pos-hint {
  font-size: 11px;
  color: #6b7280;
  margin: 10px 0 0;
}
