:root {
  --paper: #f5efe5;
  --ink: #171512;
  --muted: #756d60;
  --line: rgba(23, 21, 18, 0.14);
  --panel: #fffaf1;
  --wine: #5a1f35;
  --moss: #52624d;
  --gold: #b68a4a;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: linear-gradient(135deg, #f7f0e6, #edf0ea 52%, #f8f4ef);
}

button,
input,
textarea,
select {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.editor-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px clamp(18px, 4vw, 42px);
  color: #fffdf8;
  background: rgba(17, 16, 18, 0.84);
  backdrop-filter: blur(18px);
}

.editor-header p {
  margin: 0 0 4px;
  color: rgba(255, 253, 248, 0.7);
  font-size: 12px;
}

.editor-header h1 {
  margin: 0;
  font-size: clamp(22px, 3vw, 34px);
}

.editor-header nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.editor-header a,
.editor-header button,
.photo-actions button,
.item-actions button {
  border: 1px solid rgba(255, 253, 248, 0.22);
  border-radius: 6px;
  padding: 10px 14px;
  color: #fffdf8;
  background: rgba(255, 253, 248, 0.08);
  cursor: pointer;
}

#downloadAll {
  background: var(--gold);
  border-color: var(--gold);
  color: #171512;
}

.editor-layout {
  display: grid;
  grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
  gap: clamp(18px, 3vw, 34px);
  padding: clamp(18px, 4vw, 42px);
}

.editor-guide {
  position: sticky;
  top: 118px;
  align-self: start;
  padding: 22px;
  border: 1px solid var(--line);
  background: rgba(255, 250, 241, 0.76);
  backdrop-filter: blur(14px);
}

.editor-guide h2 {
  margin: 0 0 14px;
}

.editor-guide li,
.editor-guide p {
  color: var(--muted);
  line-height: 1.65;
}

.editor-guide code {
  color: var(--wine);
}

#status {
  margin-top: 18px;
  padding: 12px;
  border-left: 3px solid var(--moss);
  background: rgba(82, 98, 77, 0.1);
  color: var(--moss);
}

.editor-panels {
  display: grid;
  gap: 14px;
}

details {
  border: 1px solid var(--line);
  background: rgba(255, 250, 241, 0.86);
}

summary {
  cursor: pointer;
  padding: 18px 20px;
  font-weight: 700;
}

.form-grid,
.list-editor,
.series-editor,
.photo-editor {
  display: grid;
  gap: 16px;
  padding: 0 20px 20px;
}

.form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 11px 12px;
  color: var(--ink);
  background: #fffdf8;
}

textarea {
  min-height: 96px;
  resize: vertical;
}

.wide {
  grid-column: 1 / -1;
}

.edit-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.68);
}

.edit-card h3 {
  margin: 0;
  font-size: 16px;
}

.item-actions,
.photo-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.photo-actions {
  padding: 0 20px 14px;
}

.photo-actions button,
.item-actions button {
  border-color: var(--line);
  color: var(--ink);
  background: #fffdf8;
}

.photo-row {
  display: grid;
  grid-template-columns: 86px 1fr 160px 130px;
  gap: 12px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.68);
}

.photo-row img {
  width: 86px;
  height: 66px;
  object-fit: cover;
  border-radius: 4px;
  background: #ddd;
}

@media (max-width: 900px) {
  .editor-header,
  .editor-layout {
    display: grid;
  }

  .editor-layout {
    grid-template-columns: 1fr;
  }

  .editor-guide {
    position: static;
  }

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