/* ============================================================
   图印工坊 · PicMark Studio
   极简主义 · 墨印主题
   色彩骨架：宣纸暖白 · 墨黑 · 朱砂红
   ============================================================ */

:root {
  /* 纸 · Paper */
  --paper: #F4F0E7;
  --paper-soft: #FBF8F1;
  --paper-deep: #ECE7DA;

  /* 墨 · Ink */
  --ink: #1A1A1A;
  --ink-soft: #555555;
  --ink-faint: #9A9388;

  /* 朱砂 · Seal red */
  --seal: #C8442C;
  --seal-deep: #A8341E;

  /* 发丝线 · Hairlines */
  --rule: rgba(26, 26, 26, 0.12);
  --rule-strong: rgba(26, 26, 26, 0.24);

  /* 字体族 */
  --serif: "Noto Serif SC", "Songti SC", "SimSun", "STSong", serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  --mono: "SF Mono", "JetBrains Mono", "Courier New", monospace;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  accent-color: var(--seal);
}

::selection {
  background: var(--seal);
  color: var(--paper-soft);
}

.app {
  max-width: 680px;
  margin: 0 auto;
  padding-bottom: 64px;
}

/* ============================================================
   Hero
   ============================================================ */
.hero {
  padding: 64px 28px 56px;
  position: relative;
  border-bottom: 1px solid var(--rule);
}

.lang-toggle {
  position: absolute;
  top: 28px;
  right: 28px;
  padding: 6px 14px;
  border: 1px solid var(--rule-strong);
  border-radius: 0;
  background: transparent;
  color: var(--ink-soft);
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
  z-index: 10;
}

.lang-toggle:hover {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper-soft);
}

.hero-inner {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 36px;
}

.hero-left {
  position: relative;
  flex: 1;
  min-width: 0;
}

.hero-right {
  flex-shrink: 0;
  width: 196px;
  padding-top: 6px;
}

.hero-seal {
  position: absolute;
  top: -6px;
  right: 0;
  width: 60px;
  height: 60px;
  background: var(--seal);
  color: var(--paper-soft);
  font-family: var(--serif);
  font-size: 34px;
  font-weight: 700;
  display: grid;
  place-items: center;
  transform: rotate(-3deg);
  box-shadow:
    inset 0 0 0 3px var(--paper-soft),
    2px 3px 0 rgba(26, 26, 26, 0.06);
  letter-spacing: 0;
  line-height: 1;
}

.hero-kicker {
  font-size: 11px;
  letter-spacing: 0.32em;
  color: var(--ink-faint);
  text-transform: uppercase;
  font-weight: 500;
  margin-bottom: 18px;
}

.hero-title {
  font-family: var(--serif);
  font-size: clamp(52px, 14vw, 84px);
  font-weight: 700;
  line-height: 0.96;
  letter-spacing: 0.04em;
  color: var(--ink);
  margin-bottom: 28px;
}

.hero-desc {
  font-size: 14px;
  color: var(--ink-soft);
  max-width: 420px;
  line-height: 1.9;
  letter-spacing: 0.02em;
}

.hero-right-label {
  font-size: 10px;
  letter-spacing: 0.24em;
  color: var(--ink-faint);
  text-transform: uppercase;
  font-weight: 500;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--rule);
}

.hero-scenes {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.hero-scenes li {
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-family: var(--serif);
  font-size: 13px;
  color: var(--ink-soft);
  letter-spacing: 0.04em;
  line-height: 1.4;
}

.scene-no {
  font-family: var(--serif);
  font-size: 11px;
  color: var(--seal);
  font-weight: 600;
  flex-shrink: 0;
  width: 14px;
}

/* ============================================================
   Container & Sections (catalog style)
   ============================================================ */
.container {
  padding: 0 28px;
}

.sec {
  padding: 44px 0 40px;
  border-bottom: 1px solid var(--rule);
}

.sec:last-of-type {
  border-bottom: none;
}

.sec-head {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 26px;
}

.sec-no {
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 500;
  line-height: 1;
  color: var(--ink);
  font-feature-settings: "tnum";
  flex-shrink: 0;
  padding-top: 2px;
}

.sec-titles {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sec-title {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0.06em;
  line-height: 1.3;
}

.sec-sub {
  font-size: 10px;
  letter-spacing: 0.28em;
  color: var(--ink-faint);
  text-transform: uppercase;
  font-weight: 500;
}

.hint {
  font-size: 12px;
  color: var(--ink-faint);
  margin-bottom: 16px;
  line-height: 1.7;
  letter-spacing: 0.02em;
}

.sub-divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 28px 0 20px;
}

.sub-divider::before,
.sub-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--rule);
}

.sub-divider span {
  font-family: var(--serif);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-faint);
  letter-spacing: 0.16em;
  white-space: nowrap;
}

/* ============================================================
   Drop zone
   ============================================================ */
.drop-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 44px 20px;
  border: 1px dashed var(--rule-strong);
  background: var(--paper-soft);
  cursor: pointer;
  transition: border-color 0.25s ease, background 0.25s ease;
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--seal);
  border-style: solid;
  background: var(--paper);
}

.drop-zone .icon {
  width: 34px;
  height: 34px;
  color: var(--ink-faint);
  transition: color 0.25s ease;
}

.drop-zone:hover .icon,
.drop-zone.drag-over .icon {
  color: var(--seal);
}

.drop-title {
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: 0.04em;
}

.drop-sub {
  font-size: 10px;
  letter-spacing: 0.32em;
  color: var(--ink-faint);
  text-transform: uppercase;
}

.file-info {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-faint);
  margin-top: 14px;
  min-height: 16px;
  letter-spacing: 0.02em;
}

/* ============================================================
   Forms
   ============================================================ */
.form-row {
  display: flex;
  gap: 14px;
  width: 100%;
}

.form-row.compact {
  gap: 12px;
}

.form-row label.coord {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  overflow: hidden;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  background: var(--paper-soft);
  padding: 12px 14px;
  border: 1px solid var(--rule);
}

.form-row label.coord input {
  flex: 1;
  width: 100%;
  border: none;
  background: transparent;
  font-family: var(--mono);
  font-size: 14px;
  color: var(--ink);
  outline: none;
  min-width: 0;
  font-weight: 500;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 16px;
}

.field {
  font-size: 11px;
  color: var(--ink-faint);
  font-weight: 600;
  letter-spacing: 0.04em;
  display: block;
}

.field input,
.field select {
  width: 100%;
  margin-top: 8px;
  padding: 11px 12px;
  border: 1px solid var(--rule-strong);
  border-radius: 0;
  font-size: 14px;
  color: var(--ink);
  background: var(--paper-soft);
  outline: none;
  font-family: var(--sans);
  transition: border-color 0.2s ease, background 0.2s ease;
  -webkit-appearance: none;
  appearance: none;
}

.field input:focus,
.field select:focus {
  border-color: var(--seal);
  background: var(--paper-soft);
}

.field select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' fill='none' stroke='%239A9388' stroke-width='1.2'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 34px;
  cursor: pointer;
}

.field input[type="color"] {
  height: 44px;
  padding: 5px;
  cursor: pointer;
}

.field input[type="number"] {
  font-family: var(--mono);
  font-weight: 500;
}

.field.full {
  grid-column: 1 / -1;
}

.error-msg {
  display: block;
  margin-top: 8px;
  font-size: 11px;
  color: var(--seal);
  line-height: 1.5;
  min-height: 14px;
  letter-spacing: 0.02em;
}

.weight-status {
  display: inline-block;
  margin-top: 8px;
  margin-right: 8px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink);
  font-weight: 600;
  background: var(--paper-deep);
  padding: 3px 8px;
  letter-spacing: 0.04em;
}

.weight-hint {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  color: var(--ink-faint);
  line-height: 1.5;
  min-height: 14px;
  letter-spacing: 0.02em;
}

.field input.invalid {
  border-color: var(--seal);
}

.custom-font {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 4px;
}

textarea {
  width: 100%;
  padding: 16px;
  border: 1px solid var(--rule-strong);
  border-radius: 0;
  font-size: 14px;
  color: var(--ink);
  background: var(--paper-soft);
  resize: vertical;
  margin-bottom: 14px;
  outline: none;
  font-family: var(--sans);
  line-height: 1.8;
  letter-spacing: 0.02em;
  transition: border-color 0.2s ease;
}

textarea:focus {
  border-color: var(--seal);
}

textarea::placeholder {
  color: var(--ink-faint);
}

/* ============================================================
   Buttons
   ============================================================ */
.primary-btn {
  width: 100%;
  padding: 18px;
  background: var(--ink);
  color: var(--paper-soft);
  border: none;
  border-radius: 0;
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.16em;
  cursor: pointer;
  transition: background 0.25s ease, letter-spacing 0.25s ease;
  position: relative;
}

.primary-btn::after {
  content: "→";
  margin-left: 12px;
  font-family: var(--sans);
  font-weight: 400;
  letter-spacing: 0;
  display: inline-block;
  transition: transform 0.25s ease;
}

.primary-btn:not(:disabled):hover {
  background: var(--seal);
  letter-spacing: 0.2em;
}

.primary-btn:not(:disabled):hover::after {
  transform: translateX(4px);
}

.primary-btn:disabled {
  background: var(--paper-deep);
  color: var(--ink-faint);
  cursor: not-allowed;
}

.primary-btn:disabled::after {
  color: var(--ink-faint);
}

.secondary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 20px;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--rule-strong);
  border-radius: 0;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.12em;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.secondary-btn:hover {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper-soft);
}

/* ============================================================
   Mode switch & color badge
   ============================================================ */
.mode-switch {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 16px;
  border: 1px solid var(--rule-strong);
  width: fit-content;
  max-width: 100%;
}

.mode-btn {
  padding: 10px 20px;
  border: none;
  border-right: 1px solid var(--rule-strong);
  background: var(--paper-soft);
  font-family: var(--serif);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
  letter-spacing: 0.08em;
}

.mode-btn:last-of-type {
  border-right: none;
}

.mode-btn:hover {
  color: var(--ink);
}

.mode-btn.active {
  background: var(--ink);
  color: var(--paper-soft);
}

.color-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: 16px;
  padding: 6px 12px;
  background: var(--paper-soft);
  border: 1px solid var(--rule-strong);
}

.color-swatch {
  width: 16px;
  height: 16px;
  border: 1px solid var(--rule-strong);
  background: var(--seal);
}

.color-value {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink);
  font-weight: 600;
  letter-spacing: 0.04em;
}

/* ============================================================
   Canvas
   ============================================================ */
.canvas-wrapper {
  position: relative;
  width: 100%;
  min-height: 200px;
  background: var(--paper-deep);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  border: 1px solid var(--rule);
}

#previewCanvas {
  display: block;
  max-width: 100%;
  height: auto;
  cursor: crosshair;
}

#previewCanvas.pick-mode {
  cursor: copy;
}

.marker {
  position: absolute;
  left: 0;
  top: 0;
  display: none;
  pointer-events: none;
  white-space: nowrap;
  line-height: 1;
  transform-origin: left top;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================================================
   Quality row
   ============================================================ */
.quality-row {
  margin-top: 16px;
}

/* ============================================================
   Performance panel
   ============================================================ */
.perf-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
  padding: 16px 18px;
  background: var(--paper-soft);
  border: 1px solid var(--rule);
  margin-bottom: 14px;
}

.perf-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 80px;
}

.perf-item span {
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--ink-faint);
  text-transform: uppercase;
}

.perf-item b {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.perf-warning {
  font-size: 12px;
  color: var(--seal);
  margin-bottom: 14px;
  min-height: 16px;
  letter-spacing: 0.02em;
}

/* ============================================================
   Progress
   ============================================================ */
.progress {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.progress-bar {
  flex: 1;
  height: 2px;
  background: var(--rule);
  position: relative;
}

.progress-bar-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0%;
  background: var(--seal);
  transition: width 0.2s ease;
}

.progress span {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-soft);
  min-width: 40px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

/* ============================================================
   Preview list
   ============================================================ */
.preview-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 22px;
}

.preview-list img {
  width: 100%;
  border: 1px solid var(--rule);
  aspect-ratio: 1;
  object-fit: cover;
  background: var(--paper-deep);
}

/* ============================================================
   Region editor
   ============================================================ */
.region-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.btn-small {
  padding: 8px 14px;
  border: 1px solid var(--rule-strong);
  border-radius: 0;
  background: var(--paper-soft);
  color: var(--ink);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.preset-select {
  padding: 8px 14px;
  border: 1px solid var(--rule-strong);
  border-radius: 0;
  background: var(--paper-soft);
  color: var(--ink);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  cursor: pointer;
  font-family: var(--sans);
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' fill='none' stroke='%239A9388' stroke-width='1.2'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.preset-select:hover {
  border-color: var(--seal);
}

.preset-select:focus {
  border-color: var(--seal);
  outline: none;
}

.btn-small:hover {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper-soft);
}

.btn-small:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-small:disabled:hover {
  border-color: var(--rule-strong);
  background: var(--paper-soft);
  color: var(--ink);
}

.btn-danger {
  color: var(--seal);
  border-color: rgba(200, 68, 44, 0.4);
}

.btn-danger:hover {
  background: var(--seal);
  border-color: var(--seal);
  color: var(--paper-soft);
}

.region-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.region-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: var(--paper-soft);
  border: 1px solid var(--rule);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-soft);
  letter-spacing: 0.04em;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.region-item:hover {
  border-color: var(--rule-strong);
}

.region-item.active {
  border-color: var(--seal);
  background: var(--paper);
  color: var(--ink);
}

.region-config {
  padding: 18px;
  background: var(--paper-soft);
  border: 1px solid var(--rule);
}

.region-config .form-row {
  margin-bottom: 14px;
}

.region-config .field input[type="range"] {
  padding: 0;
  margin-top: 12px;
  height: 4px;
  background: var(--rule);
  -webkit-appearance: none;
  appearance: none;
}

.region-config .field input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  background: var(--seal);
  cursor: pointer;
  border: 2px solid var(--paper-soft);
}

.region-config .field input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: var(--seal);
  cursor: pointer;
  border: 2px solid var(--paper-soft);
}

.region-config .field input[type="checkbox"] {
  width: auto;
  margin-right: 8px;
  margin-top: 0;
  accent-color: var(--seal);
}

/* ============================================================
   Footer
   ============================================================ */
.footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 36px 28px 0;
}

.footer-rule {
  width: 40px;
  height: 1px;
  background: var(--rule-strong);
  margin-bottom: 12px;
}

.footer-title {
  font-family: var(--serif);
  font-size: 12px;
  color: var(--ink-soft);
  letter-spacing: 0.16em;
}

.signature {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-faint);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  transition: color 0.2s ease;
  cursor: default;
}

.signature:hover {
  color: var(--seal);
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 560px) {
  .hero-inner {
    flex-direction: column;
    gap: 32px;
  }

  .lang-toggle {
    top: 16px;
    right: 16px;
  }

  .hero-right {
    width: 100%;
  }

  .hero-seal {
    width: 52px;
    height: 52px;
    font-size: 30px;
  }
}

@media (max-width: 420px) {
  .hero {
    padding: 52px 22px 44px;
  }

  .container {
    padding: 0 22px;
  }

  .sec {
    padding: 36px 0 32px;
  }

  .hero-seal {
    width: 52px;
    height: 52px;
    font-size: 30px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .mode-switch {
    width: 100%;
  }

  .mode-btn {
    flex: 1;
    padding: 10px 12px;
    text-align: center;
  }

  .color-badge {
    margin-left: 0;
    margin-top: 10px;
  }

  .mode-switch-wrap {
    flex-direction: column;
    align-items: flex-start;
  }

  .sec-no {
    font-size: 26px;
  }

  .sec-title {
    font-size: 17px;
  }
}
