.pfg-wrapper * {
  box-sizing: border-box;
}

.pfg-wrapper {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 12px;
}

.pfg-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 22px;
}

.pfg-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 8px 26px rgba(15, 23, 42, 0.06);
}

.pfg-stage {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: 16px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
}

.pfg-placeholder,
.pfg-editor {
  position: absolute;
  inset: 0;
}

.pfg-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
}

.pfg-frame-preview,
.pfg-frame-overlay {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.pfg-editor {
  overflow: hidden;
  cursor: grab;
  touch-action: none;
}

.pfg-editor.is-dragging {
  cursor: grabbing;
}

.pfg-user-layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.pfg-user-photo-wrap {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  transform-origin: center center;
  overflow: visible;
  will-change: transform, left, top, width, height;
}

.pfg-user-image {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  transform-origin: center center;
  pointer-events: none;
  user-select: none;
}

.pfg-frame-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.pfg-controls {
  margin-top: 14px;
  padding: 12px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
}

.pfg-control-header {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 10px;
}

.pfg-zoom-row,
.pfg-rotate-row {
  display: grid;
  grid-template-columns: 42px 1fr 42px;
  gap: 10px;
  align-items: center;
}

.pfg-rotate-row {
  margin-top: 10px;
}

.pfg-small-btn,
.pfg-reset-btn,
.pfg-main-btn {
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.pfg-small-btn:hover,
.pfg-reset-btn:hover,
.pfg-main-btn:hover {
  transform: translateY(-1px);
}

.pfg-small-btn {
  height: 40px;
  font-size: 22px;
  line-height: 1;
  background: #111827;
  color: #fff;
}

.pfg-zoom-slider {
  width: 100%;
}

.pfg-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  gap: 10px;
}

.pfg-zoom-value,
.pfg-rotate-value {
  font-size: 13px;
  font-weight: 700;
  color: #334155;
}

.pfg-rotate-value {
  text-align: center;
}

.pfg-reset-btn {
  padding: 10px 14px;
  background: #e2e8f0;
  color: #0f172a;
  font-weight: 700;
}

.pfg-help {
  margin-top: 8px;
  font-size: 12px;
  color: #64748b;
}

.pfg-actions {
  margin-top: 14px;
}

.pfg-main-btn {
  width: 100%;
  min-height: 46px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.pfg-download-btn {
  margin-top: 10px;
  background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

.photo-upload {
  display: none !important;
}

.is-hidden {
  display: none !important;
}

@media (max-width: 1024px) {
  .pfg-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .pfg-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .pfg-wrapper {
    padding: 14px 0;
  }

  .pfg-grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }
}
