* {
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f7f7f8;
  margin: 0;
  color: #1a1a1a;
}

.app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
}

header h1 {
  margin-bottom: 4px;
}

.subtitle {
  color: #666;
  margin-top: 0;
}

section {
  margin: 20px 0;
}

section h2 {
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #444;
  ;
}

.thumb-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.thumb {
  width: 100px;
  height: 100px;
  border-radius: 8px;
  overflow: hidden;
  border: 3px solid transparent;
  cursor: pointer;
  position: relative;
  background: #eee;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  text-align: center;
  padding: 4px;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb.selected {
  border-color: #111;
}

.batch-dots {
  display: flex;
  gap: 6px;
}

.dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #ddd;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  cursor: pointer;
  color: #555;
}

.dot.done {
  background: #16a34a;
  color: #fff;
}

.dot.active {
  outline: 2px solid #111;
  outline-offset: 2px;
}

.workspace {
  display: flex;
  flex-direction: column;
  row-gap: 10px;
  width: 100%;
}

.line-top,
.line-middle,
.line-low {
  background: #fff;
  border-radius: 12px;
  padding: 18px;
  border: 1px solid #eee;
  width: 100%;
}

#previewCanvas {
  width: 100%;
  border-radius: 8px;
  background: #fafafa;
  position: relative;
  background-image: url(img/background.png);
  background-size: contain;
}

.uploader {
  margin: 14px 0;
}

.hint {
  font-size: 13px;
  color: #888;
}

.file-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.file-list .chip {
  font-size: 11px;
  background: #f0f0f0;
  padding: 4px 8px;
  border-radius: 20px;
}

.actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

button {
  padding: 10px 16px;
  border-radius: 8px;
  border: none;
  background: #111;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
}

button:disabled {
  background: #ccc;
  cursor: not-allowed;
}

button:hover:not(:disabled) {
  background: #333;
}

.status {
  font-size: 13px;
  margin-top: 10px;
  color: #16a34a;
  min-height: 18px;
}

.status.error {
  color: #dc2626;
}

.inputField {
  z-index: 10;
  position: absolute;
}

.notAddedField {
  background-image: url(img/field.png);
  background-size:contain;
  background-position: center center;
  background-repeat: no-repeat;
  background-color: white;
  outline: 4px dashed rgba(0, 0, 0, 0.722);
  outline-offset: -10px;
}

.hide-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
  opacity: 0;
}

.app-main {
  background: #fff;
  border-radius: 12px;
  padding: 18px;
  border: 1px solid #eee;
  margin-top: 10vh;
  text-align: center;
}

.personalize-option-button {
  padding: 20px;
  margin: 20px;
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  border: 1px solid #eee;
  background: #f4f3f3;
  color: #111;
  text-decoration: none;
}

.personalize-option-button img {
  height: 200px;
  width: 200px;
  margin-bottom: 20px;
}

.buttons-line {
  width: 100%;
  display: flex;
  justify-content: center;
  column-gap: 20px;
}

.previewActions {
  display: flex;
  column-gap: 20px;
}

.previewActionButtons {
  display: flex;
  flex-direction: column;
  row-gap: 10px;
}

.move {
  cursor: move;
}

.move label {
  cursor: move;
}

.scale {
  cursor: nwse-resize;
}

.scale label {
  cursor: nwse-resize;
}

.drop {
  border: 1.5px dashed var(--line);
  border-radius: 8px;
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.drop:hover,
.drop.drag {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.drop p {
  margin: 0;
  color: #6b6a63;
  font-size: 14px;
}

input[type="file"] {
  display: none;
}

.crop-stage {
  position: relative;
  display: inline-block;
  max-width: 100%;
  user-select: none;
  touch-action: none;
  line-height: 0;
  overflow: hidden;
  padding: 5px;
}

.crop-stage img {
  max-width: 100%;
  max-height: 60vh;
  display: block;
  border-radius: 4px;
}

.crop-box {
  position: absolute;
  border: 2px solid var(--accent);
  box-shadow: 0 0 0 2000px rgba(28, 28, 26, 0.55);
  cursor: move;
}

.handle {
  position: absolute;
  width: 14px;
  height: 14px;
  background: var(--accent);
  border: 2px solid #fff;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.handle.nw {
  top: 0;
  left: 0;
  cursor: nwse-resize;
}

.handle.ne {
  top: 0;
  left: 100%;
  cursor: nesw-resize;
}

.handle.sw {
  top: 100%;
  left: 0;
  cursor: nesw-resize;
}

.handle.se {
  top: 100%;
  left: 100%;
  cursor: nwse-resize;
}

.controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.controls label {
  font-size: 13px;
  color: #6b6a63;
  display: flex;
  align-items: center;
  gap: 6px;
}

select {
  font-family: var(--sans);
  font-size: 13px;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
}

.spacer {
  flex: 1;
}

button {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: 7px;
  border: 1px solid transparent;
  cursor: pointer;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: #274d43;
}

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}

.btn-ghost:hover {
  background: #f0efe9;
  color: white;
}

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.result {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.result img {
  max-width: 260px;
  max-height: 260px;
  border-radius: 6px;
  border: 1px solid var(--line);
}

.result-meta {
  font-size: 13px;
  color: #6b6a63;
  line-height: 1.6;
}

.result-meta code {
  font-family: var(--mono);
  background: #f0efe9;
  padding: 1px 5px;
  border-radius: 4px;
}

.hidden {
  display: none !important;
}

.result {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 10px;
}

#cropPanel {
  position: absolute;
  width: 90vw;
  top: 5vh;
  left: 5vw;
  z-index: 10;
  background-color: white;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 0 0 2000px rgba(28, 28, 26, 0.55);
}

#cropPanel .controls {
  z-index: 10;
  position: relative;
}

h2 {
  margin: 10px;
  margin-left: 0;
}

.panel .close{
  position: absolute;
  width: 30px;
  height: 30px;
  top: -10px;
  right: -10px;
  background-color: red;
  border-radius: 30px;
}

.hide .ne, .hide .nw, .hide .se, .hide .sw{
  display: none;
}