* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f2f4f8;
  color: #1f2937;
}

.layout {
  display: flex;
  height: 100vh;
  gap: 16px;
  padding: 16px;
}

.panel {
  width: 360px;
  flex-shrink: 0;
  background: #fff;
  border-radius: 14px;
  padding: 20px;
  overflow-y: auto;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.panel h1 { font-size: 20px; margin-bottom: 8px; }
.tip { font-size: 13px; color: #6b7280; line-height: 1.6; margin-bottom: 18px; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.field input[type="text"] {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
}
.field input[type="file"] { font-size: 13px; }

.preview-box {
  margin-top: 8px;
  height: 140px;
  border: 1px dashed #d1d5db;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #f9fafb;
}
.preview-box img { max-width: 100%; max-height: 100%; object-fit: contain; }
.preview-box span { font-size: 13px; color: #9ca3af; }

.options { display: flex; flex-direction: column; gap: 10px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 400; font-size: 14px; }
.check select {
  margin-left: auto;
  padding: 5px 8px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
}

.primary {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 10px;
  background: #2563eb;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.primary:disabled { background: #93c5fd; cursor: not-allowed; }
.primary:hover:not(:disabled) { background: #1d4ed8; }

.status { margin-top: 16px; }
.status-line { font-size: 14px; margin-bottom: 8px; }
.progress { height: 8px; background: #e5e7eb; border-radius: 999px; overflow: hidden; }
.progress-bar {
  height: 100%;
  width: 0;
  background: #2563eb;
  border-radius: 999px;
  transition: width 0.3s;
}

.result { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.download {
  display: inline-block;
  padding: 10px 14px;
  background: #10b981;
  color: #fff;
  border-radius: 8px;
  text-decoration: none;
  font-size: 14px;
  text-align: center;
}
.result img { max-width: 100%; border-radius: 10px; border: 1px solid #e5e7eb; }

.viewer {
  flex: 1;
  position: relative;
  background: #111827;
  border-radius: 14px;
  overflow: hidden;
}
#canvas { width: 100%; height: 100%; display: block; }
.viewer-hint {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  color: #9ca3af;
  font-size: 12px;
  background: rgba(0, 0, 0, 0.35);
  padding: 6px 12px;
  border-radius: 999px;
}

@media (max-width: 860px) {
  .layout { flex-direction: column; height: auto; }
  .panel { width: 100%; }
  .viewer { height: 60vh; }
}
