@charset "UTF-8";

:root {
  --bg: #f5f7fb;
  --ink: #1d2433;
  --muted: #5e6b7a;
  --accent: #2b8a3e;
  --accent-2: #2f6fed;
  --card: #ffffff;
  --stroke: #e5e9f2;
  --shadow: 0 18px 40px rgba(24, 32, 56, 0.08);
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", "Avenir Next", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, #f7f9ff 0%, #eef2f8 100%);
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  padding: 28px 28px 22px;
  border-bottom: 1px solid var(--stroke);
  background: #ffffff;
}

header h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0.3px;
}

header p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.panes {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 20px;
  padding: 20px 24px 32px;
  max-width: 1240px;
  width: 100%;
  margin: 0 auto;
}

.pane {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card {
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}

.card h2 {
  margin: 0 0 12px;
  font-size: 16px;
  letter-spacing: 0.3px;
}

.row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

input[type="file"] {
  padding: 8px;
  border: 1px dashed var(--stroke);
  border-radius: 12px;
  background: #f9fbff;
}

input[type="number"] {
  padding: 8px 10px;
  border: 1px solid var(--stroke);
  border-radius: 12px;
  width: 120px;
}

button {
  padding: 10px 16px;
  border-radius: 12px;
  border: none;
  background: var(--ink);
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.2s ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(20, 32, 56, 0.12);
}

button.secondary {
  background: transparent;
  border: 1px solid var(--stroke);
  color: var(--ink);
}

button.secondary.active {
  background: #eef5ff;
  border-color: var(--accent-2);
  color: #1f3fa3;
}

button.accent {
  background: linear-gradient(120deg, var(--accent) 0%, var(--accent-2) 100%);
}

select {
  padding: 8px 10px;
  border: 1px solid var(--stroke);
  border-radius: 12px;
}

.page-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.page-btn {
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: #f3f6fb;
  font-size: 12px;
  cursor: pointer;
}

.page-btn.active {
  background: linear-gradient(120deg, var(--accent) 0%, var(--accent-2) 100%);
  color: #fff;
  border-color: transparent;
}

.canvas-wrap {
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--stroke);
  background: #f8f9fe;
}

canvas {
  width: 100%;
  display: block;
}

.status {
  font-size: 12px;
  color: var(--muted);
  margin-top: 8px;
}

.download {
  display: inline-block;
  margin-top: 12px;
  font-weight: 600;
  color: var(--accent-2);
  text-decoration: none;
}

.tag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef5ff;
  color: #2d3f86;
  font-size: 11px;
}

.preview-box {
  min-height: 120px;
  border: 1px dashed var(--stroke);
  border-radius: 12px;
  background: #f7f8fd;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 13px;
}

.editor-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

textarea,
select,
input[type="number"],
input[type="file"] {
  outline: none;
}

textarea:focus,
select:focus,
input[type="number"]:focus,
input[type="file"]:focus {
  border-color: rgba(47, 111, 237, 0.4);
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.15);
}

@media (max-width: 1080px) {
  .panes {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  header {
    padding: 22px 18px;
  }

  .panes {
    padding: 16px;
  }

  .row {
    flex-direction: column;
    align-items: stretch;
  }

  input[type="number"] {
    width: 100%;
  }
}

.editor-title {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.4px;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.editor-divider {
  height: 1px;
  background: var(--stroke);
  border-radius: 999px;
}

textarea {
  width: 100%;
  min-height: 120px;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  padding: 10px;
  font-family: "Avenir Next", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  font-size: 13px;
  resize: vertical;
}

.replace-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.replace-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--stroke);
  border-radius: 10px;
  background: #f8faf8;
}

.replace-item img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid var(--stroke);
  background: #fff;
}

.replace-item span {
  flex: 1;
  font-size: 12px;
  color: var(--muted);
}

.result-preview {
  display: none;
  flex-direction: column;
  gap: 10px;
}

.result-image-wrap {
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--stroke);
  background: #f9faf9;
  display: flex;
  align-items: center;
  justify-content: center;
}

.result-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.thumbs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.thumbs img {
  width: 80px;
  height: auto;
  border-radius: 8px;
  border: 1px solid var(--stroke);
  cursor: pointer;
  opacity: 0.7;
}

.thumbs img.active {
  opacity: 1;
  border-color: var(--accent);
}

@media (max-width: 980px) {
  .panes {
    grid-template-columns: 1fr;
  }
}
