:root{
  --bg: #eef4fa;
  --panel: #ffffff;
  --panel-2: #eaf0f8;
  --line: #d8e1ee;
  --accent: #1d6fa5;
  --accent-soft: #ddedf8;
  --accent-dim: #f0f6fb;
  --text: #16212c;
  --muted: #62717f;
  --muted-2: #93a2b0;
}

.content{ padding: 22px; }

.layout{ display: grid; grid-template-columns: 1fr 300px; gap: 18px; align-items: start; }
@media (max-width: 800px){ .layout{ grid-template-columns: 1fr; } }

.section-box{
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
}

.label{
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 10px;
  color: var(--muted);
}

.dropzone{
  border: 2px dashed var(--line);
  border-radius: 10px;
  padding: 30px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
  background: #fff;
}
.dropzone:hover, .dropzone.dragover{ border-color: var(--accent); background: var(--accent-dim); }
.dropzone .icon{ font-size: 26px; margin-bottom: 6px; }
.dropzone .main{ font-size: 13.5px; font-weight: 600; }
.dropzone .sub{ font-size: 11.5px; color: var(--muted); margin-top: 3px; }
input[type=file]{ display: none; }

.strip{ display: flex; gap: 8px; overflow-x: auto; padding-top: 12px; }
.frame{ flex: 0 0 auto; width: 70px; background: #fdfcf7; border-radius: 6px; padding: 4px; position: relative; box-shadow: 0 2px 6px rgba(0,0,0,0.12); }
.frame img{ width: 100%; height: 46px; object-fit: cover; border-radius: 3px; display: block; }
.frame .remove{
  position: absolute; top: 1px; right: 1px; width: 15px; height: 15px; border-radius: 50%;
  background: rgba(22,33,44,0.85); color: var(--accent-soft); border: none; font-size: 10px; line-height: 15px; cursor: pointer; padding: 0;
}

.canvas-area{
  background:
    linear-gradient(45deg, #e5e2d8 25%, transparent 25%),
    linear-gradient(-45deg, #e5e2d8 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e5e2d8 75%),
    linear-gradient(-45deg, transparent 75%, #e5e2d8 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 260px;
}
.canvas-area canvas{ max-width: 100%; max-height: 480px; display: block; }

.mode-picker{ display: flex; gap: 8px; }
.mode-chip{
  padding: 8px 14px; border-radius: 20px; border: 1px solid var(--line); background: #fff;
  color: var(--muted); font-size: 12.5px; font-weight: 600; cursor: pointer; flex: 1;
}
.mode-chip.active{ background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

.pos-grid{ display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; max-width: 150px; margin: 0 auto; }
.pos-cell{
  aspect-ratio: 1; border-radius: 6px; border: 1px solid var(--line); background: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.pos-cell::after{ content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted-2); }
.pos-cell.active{ border-color: var(--accent); background: var(--accent-soft); }
.pos-cell.active::after{ background: var(--accent); }

.field{ display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field:last-child{ margin-bottom: 0; }
.field .rowss{ display: flex; justify-content: space-between; align-items: baseline; font-size: 12.5px; }
.field .val{ font-family: 'JetBrains Mono', monospace; color: var(--accent); font-size: 11.5px; }
input[type=range]{ width: 100%; accent-color: var(--accent); }
input[type=text]{
  width: 100%; padding: 9px 10px; border-radius: 6px; border: 1px solid var(--line);
  font-size: 13px; font-family: 'Inter', sans-serif; background: #fff; color: var(--text);
}
input[type=color]{ width: 100%; height: 34px; border: 1px solid var(--line); border-radius: 6px; padding: 2px; background: #fff; cursor: pointer; }

.btns{ display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; flex-wrap: wrap; }

.app{
  padding: 11px 18px; border: none; border-radius: 6px; cursor: pointer; font-weight: 600; font-size: 13px;
  font-family: 'Inter', sans-serif; color: #fff; background: linear-gradient(135deg, var(--accent), #4fa3d1);
  transition: filter .15s ease; width: 100%;
}
.app:hover{ filter: brightness(1.08); }
.app:disabled{ opacity: 0.5; cursor: not-allowed; }
.gray{ background: var(--line); color: var(--text); }

.empty-state{ text-align: center; color: var(--muted-2); padding: 26px 10px; font-size: 13.5px; }

.result-grid{ display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-top: 14px; }
.result-card{ background: #fdfcf7; border-radius: 8px; overflow: hidden; }
.result-card img{ width: 100%; height: 120px; object-fit: cover; display: block; }
.result-card .dl-btn{
  width: 100%; padding: 7px; border: none; background: var(--accent-dim); color: var(--accent);
  font-size: 11px; font-weight: 600; cursor: pointer; font-family: 'Inter', sans-serif;
}

.note{
  margin-top: 16px; font-size: 12px; color: var(--muted); line-height: 1.6;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px;
}
